commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
fa09a1300bb527ad8c804e06bc33edc1b9213ea4
test/integration-test.js
test/integration-test.js
var injection = require('../services/injection.js'); var Q = require('q'); var mongoose = require('mongoose'); module.exports = function (test, fixtureName, testFn) { var dbUrl = 'mongodb://localhost:27017/' + fixtureName; var cleanUp = function () { return Q.nbind(mongoose.connect, mongoose)(dbUrl).then(function () { var db = mongoose.connection.db; return Q.nbind(db.dropDatabase, db)().then(function () { db.close(); }); }); }; cleanUp().then(function () { var allcountServer = require('../allcount-server.js'); injection.resetInjection(); injection.bindFactory('port', 9080); injection.bindFactory('dbUrl', dbUrl); injection.bindFactory('gitRepoUrl', 'test-fixtures/' + fixtureName); allcountServer.reconfigureAllcount(); return allcountServer.inject('allcountServerStartup'); }).then(function (server) { return Q.nbind(server.startup, server)().then(function (errors) { if (errors) { throw new Error(errors.join('\n')); } return Q(testFn()).then(function () { return server.stop().then(function () { injection.resetInjection(); }); }); }); }).finally(cleanUp).done(function () { test.done(); }); };
var injection = require('../services/injection.js'); var Q = require('q'); var mongoose = require('mongoose'); module.exports = function (test, fixtureName, testFn) { var dbUrl = 'mongodb://localhost:27017/' + fixtureName; var cleanUp = function () { return Q.nbind(mongoose.connect, mongoose)(dbUrl).then(function () { var db = mongoose.connection.db; return Q.nbind(db.dropDatabase, db)().then(function () { db.close(); }); }); }; cleanUp().then(function () { var allcountServer = require('../allcount-server.js'); injection.resetInjection(); injection.bindFactory('port', 9080); injection.bindFactory('dbUrl', dbUrl); injection.bindFactory('gitRepoUrl', 'test-fixtures/' + fixtureName); allcountServer.reconfigureAllcount(); return allcountServer.inject('allcountServerStartup'); }).then(function (server) { return Q.nbind(server.startup, server)().then(function (errors) { if (errors) { throw new Error(errors.join('\n')); } return Q(testFn()).then(function () { return server.stop().then(function () { injection.resetInjection(); }); }); }); }).finally(cleanUp).finally(function () { test.done(); }).done(); };
Fix endless execution of integration tests
Fix endless execution of integration tests
JavaScript
mit
allcount/allcountjs,chikh/allcountjs,chikh/allcountjs,allcount/allcountjs
11c5510b06900c328ff61101bbf11cabf00419c4
tests/e2e/jest.config.js
tests/e2e/jest.config.js
const path = require( 'path' ); module.exports = { preset: 'jest-puppeteer', setupFilesAfterEnv: [ '<rootDir>/config/bootstrap.js', '@wordpress/jest-console', 'expect-puppeteer', ], testMatch: [ '<rootDir>/**/*.test.js', '<rootDir>/specs/**/__tests__/**/*.js', '<rootDir>/specs/**/?(*.)(spec|test).js', '<rootDir>/specs/**/test/*.js', ], transform: { '^.+\\.[jt]sx?$': path.join( __dirname, 'babel-transform' ), }, transformIgnorePatterns: [ 'node_modules' ], testPathIgnorePatterns: [ '.git', 'node_modules' ], };
const path = require( 'path' ); module.exports = { preset: 'jest-puppeteer', setupFilesAfterEnv: [ '<rootDir>/config/bootstrap.js', '@wordpress/jest-console', 'expect-puppeteer', ], testMatch: [ '<rootDir>/**/*.test.js', '<rootDir>/specs/**/__tests__/**/*.js', '<rootDir>/specs/**/?(*.)(spec|test).js', '<rootDir>/specs/**/test/*.js', ], transform: { '^.+\\.[jt]sx?$': path.join( __dirname, 'babel-transform' ), }, transformIgnorePatterns: [ 'node_modules' ], testPathIgnorePatterns: [ '.git', 'node_modules' ], verbose: true, };
Add verbose option to E2E tests.
Add verbose option to E2E tests.
JavaScript
apache-2.0
google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp
fee641c22a50f685055139a8abb34a6a6159378e
src/js/index.js
src/js/index.js
require("../scss/index.scss"); var React = require('react'); var Locale = require('grommet/utils/Locale'); var Cabler = require('./components/Cabler'); var locale = Locale.getCurrentLocale(); var localeData; try { localeData = Locale.getLocaleData(require('../messages/' + locale)); } catch (e) { localeData = Locale.getLocaleData(require('../messages/en-US')); } var element = document.getElementById('content'); React.render(React.createElement(Cabler, {locales: localeData.locale, messages: localeData.messages}), element); document.body.classList.remove('loading');
require("../scss/index.scss"); var React = require('react'); var ReactDOM = require('react-dom'); var Locale = require('grommet/utils/Locale'); var Cabler = require('./components/Cabler'); var locale = Locale.getCurrentLocale(); var localeData; try { localeData = Locale.getLocaleData(require('../messages/' + locale)); } catch (e) { localeData = Locale.getLocaleData(require('../messages/en-US')); } var element = document.getElementById('content'); ReactDOM.render(React.createElement(Cabler, {locales: localeData.locale, messages: localeData.messages}), element); document.body.classList.remove('loading');
Use react-dom package for rendering application
Use react-dom package for rendering application
JavaScript
apache-2.0
grommet/grommet-cabler,grommet/grommet-cabler
dadee563a1ea459c588b1507a4a98078e20d0dc6
javascript/cucumber-blanket.js
javascript/cucumber-blanket.js
(function (){ /* ADAPTER * * This blanket.js adapter is designed to autostart coverage * immediately. The other side of this is handled from Cucumber * * Required blanket commands: * blanket.setupCoverage(); // Do it ASAP * blanket.onTestStart(); // Do it ASAP * blanket.onTestDone(); // After Scenario Hook * blanket.onTestsDone(); // After Scenario Hook */ blanket.beforeStartTestRunner({ callback: function() { blanket.setupCoverage(); blanket.onTestStart(); } }); /* REPORTER * * Blanket.js docs speak of blanket.customReporter but * that doesn't actually work so we'll override defaultReporter */ blanket.defaultReporter = function(coverage_results){ window.COVERAGE_RESULTS = coverage_results; // We'll grab this on selenium side }; })();
(function (){ /* ADAPTER * * This blanket.js adapter is designed to autostart coverage * immediately. The other side of this is handled from Cucumber * * Required blanket commands: * blanket.setupCoverage(); // Do it ASAP * blanket.onTestStart(); // Do it ASAP * blanket.onTestDone(); // After Scenario Hook (Not necessary) * blanket.onTestsDone(); // After Scenario Hook */ blanket.beforeStartTestRunner({ callback: function() { blanket.setupCoverage(); blanket.onTestStart(); window.CUCUMBER_BLANKET = { files: {}, sources: {}, done: false, is_setup: true }; } }); /* REPORTER * * Blanket.js docs speak of blanket.customReporter but * that doesn't actually work so we'll override defaultReporter */ blanket.defaultReporter = function(coverage_results){ window.CUCUMBER_BLANKET.files = coverage_results.files; // Strangely enough it looks like we need to iterate in order to grab the `source` // data which is necessary to know which lines of code are being reported on. var files = Object.keys(coverage_results.files); for (var i = 0, l = files.length; i < l; i ++) { var file = files[i]; window.CUCUMBER_BLANKET.sources[file] = window.CUCUMBER_BLANKET.files[file].source; } window.CUCUMBER_BLANKET.done = true; // Now we can grab all this on the selenium side through window.CUCUMBER_BLANKET }; })();
Update javascript blanket adapter to include sources data.
Update javascript blanket adapter to include sources data.
JavaScript
mit
vemperor/capybara-blanket,kfatehi/cucumber-blanket,kfatehi/cucumber-blanket,keyvanfatehi/cucumber-blanket,keyvanfatehi/cucumber-blanket
a37ea675122ca7da96a84090aa86f7e7eaa038d4
src/lib/get-costume-url.js
src/lib/get-costume-url.js
import storage from './storage'; import {SVGRenderer} from 'scratch-svg-renderer'; // Contains 'font-family', but doesn't only contain 'font-family="none"' const HAS_FONT_REGEXP = 'font-family(?!="none")'; const getCostumeUrl = (function () { let cachedAssetId; let cachedUrl; return function (asset) { if (cachedAssetId === asset.assetId) { return cachedUrl; } cachedAssetId = asset.assetId; // If the SVG refers to fonts, they must be inlined in order to display correctly in the img tag. // Avoid parsing the SVG when possible, since it's expensive. if (asset.assetType === storage.AssetType.ImageVector) { const svgString = asset.decodeText(); if (svgString.match(HAS_FONT_REGEXP)) { const svgRenderer = new SVGRenderer(); svgRenderer.loadString(svgString); const svgText = svgRenderer.toString(true /* shouldInjectFonts */); cachedUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svgText)}`; } else { cachedUrl = asset.encodeDataURI(); } } else { cachedUrl = asset.encodeDataURI(); } return cachedUrl; }; }()); export { getCostumeUrl as default, HAS_FONT_REGEXP };
import storage from './storage'; import {inlineSvgFonts} from 'scratch-svg-renderer'; // Contains 'font-family', but doesn't only contain 'font-family="none"' const HAS_FONT_REGEXP = 'font-family(?!="none")'; const getCostumeUrl = (function () { let cachedAssetId; let cachedUrl; return function (asset) { if (cachedAssetId === asset.assetId) { return cachedUrl; } cachedAssetId = asset.assetId; // If the SVG refers to fonts, they must be inlined in order to display correctly in the img tag. // Avoid parsing the SVG when possible, since it's expensive. if (asset.assetType === storage.AssetType.ImageVector) { const svgString = asset.decodeText(); if (svgString.match(HAS_FONT_REGEXP)) { const svgText = inlineSvgFonts(svgString); cachedUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svgText)}`; } else { cachedUrl = asset.encodeDataURI(); } } else { cachedUrl = asset.encodeDataURI(); } return cachedUrl; }; }()); export { getCostumeUrl as default, HAS_FONT_REGEXP };
Use fontInliner instead of entire SVGRenderer for showing costume tiles.
Use fontInliner instead of entire SVGRenderer for showing costume tiles. The fontInliner from the scratch-svg-renderer was changed recently to work entirely on strings, so we can use that instead of parsing/loading/possibly drawing/stringifying the entire SVG. This does not address the size-1 cache issue where the cache is invalidated any time there is more than 1 sprite. But that can be handled later. Using the 4x CPU slowdown in chrome dev tools, on a simple costume that just has a single text element the getCostumeUrl time goes from 10ms to 1ms, very important for updating in a timely way.
JavaScript
bsd-3-clause
LLK/scratch-gui,LLK/scratch-gui
69772952eaa4bbde2a35fc767ac5f496e1c57e99
src/filter.js
src/filter.js
function hide_covers() { // Remove covers $(".mix_element div.cover").remove() // Add class so cards can be restyled $(".mix_card.half_card").addClass("ext-coverless_card") // Remove covers on track page $("#cover_art").remove() // Remove covers in the sidebar of a track page $(".card.sidebar_mix .cover").remove() $(".card.sidebar_mix").addClass("ext-coverless_card") } function filter() { chrome.storage.local.get("state", function(result) { if(result["state"] == "on") { hide_covers() } }); } // Make sure that when we navigate the site (which doesn't refresh the page), the filter is still run $('#body_container').bind('DOMSubtreeModified',filter); filter();
function hide_covers() { // Remove covers $(".mix_element div.cover").remove() // Add class so cards can be restyled $(".mix_card.half_card").addClass("ext-coverless_card") // Remove covers on track page $("#cover_art").remove() // Remove covers in the sidebar of a track page $(".card.sidebar_mix .cover").remove() $(".card.sidebar_mix").addClass("ext-coverless_card") } function filter() { chrome.storage.local.get("state", function(result) { if(result["state"] == "on") { hide_covers() } }); } // Make sure that when we navigate the site (which doesn't refresh the page), the filter is still run var observer = new MutationObserver(filter) observer.observe(document.getElementById("main"), {childList: true, subtree: true}) filter();
Use MutationObserver API to catch dom updates
Use MutationObserver API to catch dom updates
JavaScript
mit
pbhavsar/8tracks-Filter
63625631eafd8b8d68bcc213243f8105d76269dd
src/js/app.js
src/js/app.js
// JS Goes here - ES6 supported if (window.netlifyIdentity) { window.netlifyIdentity.on('login', () => { document.location.href = '/admin/'; }); }
// JS Goes here - ES6 supported if (window.netlifyIdentity && !window.netlifyIdentity.currentUser()) { window.netlifyIdentity.on('login', () => { document.location.href = '/admin/'; }); }
Fix issue with always redirecting to /admin when logged in
Fix issue with always redirecting to /admin when logged in
JavaScript
mit
netlify-templates/one-click-hugo-cms,chromicant/blog,doudigit/doudigit.github.io,netlify-templates/one-click-hugo-cms,chromicant/blog,doudigit/doudigit.github.io
b2648c0b5fa32934d24b271fdb050d11d0484c21
src/index.js
src/index.js
/** * Detects if only the primary button has been clicked in mouse events. * @param {MouseEvent} e Event instance (or Event-like, i.e. `SyntheticEvent`) * @return {Boolean} */ export const isPrimaryClick = e => !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) && (("button" in e && e.button === 0) || ("buttons" in e && e.buttons === 1)); /** * Decorates a function so it calls if only the primary button has been * pressed in mouse events. * @param {Function} fn * @return {Function} */ export const onPrimaryClick = fn => e => (isPrimaryClick(e) ? fn(e) : true);
/** * Detects if only the primary button has been clicked in mouse events. * @param {MouseEvent} e Event instance (or Event-like, i.e. `SyntheticEvent`) * @return {Boolean} */ export const isPrimaryClick = e => !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) && (("button" in e && e.button === 0) || ("buttons" in e && e.buttons === 1)); /** * Decorates a function so it calls if only the primary button has been * pressed in mouse events. * @param {Function} fn * @return {Function} */ export const onPrimaryClick = fn => (e, ...args) => isPrimaryClick(e, ...args) ? fn(e) : true;
Update onPrimaryClick to pass down multiple args
Update onPrimaryClick to pass down multiple args
JavaScript
mit
jacobbuck/primary-click
d54e3be13f374f3aa9b2f1e24bc476e7aadbfbcb
src/index.js
src/index.js
require('Common'); var win = new Window(); application.exitAfterWindowsClose = true; win.visible = true; win.title = "Hi Tint World!"; var webview = new WebView(); // Create a new webview for HTML. win.appendChild(webview); // attach the webview to the window. // position the webview 0 pixels from all the window's edges. webview.left=webview.right=webview.top=webview.bottom=0; // What we should do when the web-page loads. webview.addEventListener('load', function() { webview.postMessage(JSON.stringify(process.versions)); }); webview.location = "app://src/index.html"; // Tell the webview to render the index.html
require('Common'); var win = new Window(); var toolbar = new Toolbar(); application.exitAfterWindowsClose = true; win.visible = true; win.title = "Hi Tint World!"; btn = new Button(); btn.image = 'back'; toolbar.appendChild( btn ); win.toolbar = toolbar; var webview = new WebView(); // Create a new webview for HTML. win.appendChild(webview); // attach the webview to the window. // position the webview 0 pixels from all the window's edges. webview.left=webview.right=webview.top=webview.bottom=0; // What we should do when the web-page loads. webview.addEventListener('load', function() { webview.postMessage(JSON.stringify(process.versions)); }); webview.location = "app://src/index.html"; // Tell the webview to render the index.html
Add toolbar with back button
Add toolbar with back button
JavaScript
mit
niaxi/hello-tint,niaxi/hello-tint
0c28f538d9382d85c69ecb06a208ae1b0874b29c
src/index.js
src/index.js
/** * Created by thram on 21/01/17. */ import forEach from "lodash/forEach"; import assign from "lodash/assign"; import isArray from "lodash/isArray"; import {observe, state, removeObserver} from "thrux"; export const connect = (stateKey, ReactComponent) => { class ThruxComponent extends ReactComponent { observers = {}; constructor(props) { super(props); this.state = assign(this.state || {}, state([].concat(stateKey))); } addObserver = (key) => { this.observers[key] = (state) => { let newState = {}; newState[key] = state; this.setState(newState); }; observe(key, this.observers[key]); }; componentDidMount(...args) { isArray(stateKey) ? forEach(stateKey, this.addObserver) : this.addObserver(stateKey); super.componentDidMount.apply(this, args); } componentWillUnmount(...args) { super.componentWillUnmount.apply(this, args); forEach(this.observers, (observer, key) => removeObserver(key, observer)); } } return ThruxComponent; };
/** * Created by thram on 21/01/17. */ import forEach from "lodash/forEach"; import assign from "lodash/assign"; import isArray from "lodash/isArray"; import {observe, state, removeObserver} from "thrux"; export const connect = (stateKey, ReactComponent) => { class ThruxComponent extends ReactComponent { observers = {}; constructor(props) { super(props); this.state = assign(this.state || {}, state([].concat(stateKey))); } addObserver = (key) => { this.observers[key] = (state) => { let newState = {}; newState[key] = state; this.setState(newState); }; observe(key, this.observers[key]); }; componentDidMount(...args) { isArray(stateKey) ? forEach(stateKey, this.addObserver) : this.addObserver(stateKey); super.componentDidMount && super.componentDidMount.apply(this, args); } componentWillUnmount(...args) { super.componentWillUnmount && super.componentWillUnmount.apply(this, args); forEach(this.observers, (observer, key) => removeObserver(key, observer)); } } return ThruxComponent; };
Check first if the componentDidMount and componentWillUnmount are defined
fix(mount): Check first if the componentDidMount and componentWillUnmount are defined
JavaScript
mit
Thram/react-thrux
f563f24c06d6de9401aa7d43fea0d5319bf5df0e
src/index.js
src/index.js
#! /usr/bin/env node import chalk from 'chalk'; import console from 'console'; import gitAuthorStats from './git-author-stats'; gitAuthorStats().forEach((gitAuthorStat) => { const author = chalk.bold(gitAuthorStat.author); const commits = `${gitAuthorStat.commits} commits`; const added = chalk.green(`${gitAuthorStat.added} ++`); const removed = chalk.red(`${gitAuthorStat.removed} --`); const authorStats = [commits, added, removed].join(' / '); console.log(`${author}: ${authorStats}`); });
#! /usr/bin/env node import { bold, green, red } from 'chalk'; import console from 'console'; import gitAuthorStats from './git-author-stats'; gitAuthorStats().forEach((gitAuthorStat) => { const { author, commits, added, removed, } = gitAuthorStat; const gitAuthorText = [ `${commits} commits`, green(`${added} ++`), red(`${removed} --`), ].join(' / '); console.log(`${bold(author)}: ${gitAuthorText}`); });
Refactor Git author text writing
Refactor Git author text writing
JavaScript
mit
caedes/git-author-stats
af6776fc87f7a18c18355f40e58364e5ca3237b7
components/base/Footer.js
components/base/Footer.js
import React from 'react' class Footer extends React.PureComponent { render () { return <footer className='container row'> <p className='col-xs-12'> Copyright 2017 Junyoung Choi.&nbsp;<a href='https://github.com/CarbonStack/carbonstack' target='_blank'>Source code of Carbonstack</a>&nbsp;is published under MIT. </p> <style jsx>{` p { text-align: center; margin: 0 auto; line-height: 60px; } `}</style> </footer> } } export default Footer
import React from 'react' class Footer extends React.PureComponent { render () { return <footer> <p> Copyright 2017 Junyoung Choi.&nbsp;<a href='https://github.com/CarbonStack/carbonstack' target='_blank'>Source code of Carbonstack</a>&nbsp;is published under MIT. </p> <style jsx>{` p { text-align: center; padding: 15px 0; } `}</style> </footer> } } export default Footer
Fix stye bug of footer again
Fix stye bug of footer again
JavaScript
mit
CarbonStack/carbonstack
08cad5105b71b10b063af27ed256bc4ab7571896
src/index.js
src/index.js
import _ from './utils'; export default { has: (value = {}, conditions = {}) => { if (!_.isObject(conditions)) return false; if (_.isArray(value)) return !!_.find(value, conditions); if (_.isObject(value)) return !!_.find(value.transitions, conditions); return false; }, find: (value = {}, conditions = {}) => { if (!_.isObject(conditions) && typeof (conditions) !== 'function') return undefined; if (_.isArray(value)) return _.find(value, conditions); if (_.isObject(value)) return _.find(value.transitions, conditions); return undefined; }, filter: (value = {}, conditions = {}) => { if (!_.isObject(conditions) && typeof (conditions) !== 'function') return []; if (_.isArray(value)) return _.filter(value, conditions); if (_.isObject(value)) return _.filter(value.transitions, conditions); return []; }, metaAttributes: (obj = {}) => { if (!_.isObject(obj)) return {}; if (!_.isObject(obj.meta)) return {}; return obj.meta.attributes || {}; }, metaLinks: (obj = {}) => { if (!_.isObject(obj)) return []; if (!_.isObject(obj.meta)) return []; return obj.meta.links || []; }, attributes: (obj = {}) => { if (!_.isObject(obj)) return {}; return obj.attributes || {}; }, transitions: (obj = {}) => { if (!_.isObject(obj)) return []; return obj.transitions || []; }, get: _.get, };
import _ from './utils'; function getTransitions(value) { if (_.isArray(value)) return value; if (_.isObject(value)) return value.transitions; } export default { has: (value = {}, conditions = {}) => { return !!_.find(getTransitions(value), conditions); }, find: (value = {}, conditions = {}) => { return _.find(getTransitions(value), conditions); }, filter: (value = {}, conditions = {}) => { return _.filter(getTransitions(value), conditions); }, metaAttributes: (obj = {}) => { if (!_.isObject(obj)) return {}; if (!_.isObject(obj.meta)) return {}; return obj.meta.attributes || {}; }, metaLinks: (obj = {}) => { if (!_.isObject(obj)) return []; if (!_.isObject(obj.meta)) return []; return obj.meta.links || []; }, attributes: (obj = {}) => { if (!_.isObject(obj)) return {}; return obj.attributes || {}; }, transitions: (obj = {}) => { if (!_.isObject(obj)) return []; return obj.transitions || []; }, get: _.get, };
Trim code a little more
Trim code a little more
JavaScript
mit
smizell/hf
f47b43cee6bbd40a6879f5ce09eb2612c83496f9
src/index.js
src/index.js
import AtomControl from './components/AtomControl'; import CardControl from './components/CardControl'; import { classToDOMCard } from './utils/classToCard'; import Container, { EMPTY_MOBILEDOC } from './components/Container'; import DropWrapper from './components/DropWrapper'; import Editor from './components/Editor'; import LinkControl from './components/LinkControl'; import LinkForm from './components/LinkForm'; import MarkupControl from './components/MarkupControl'; import SectionControl from './components/SectionControl'; import Toolbar from './components/Toolbar'; export { AtomControl, CardControl, classToDOMCard, Container, DropWrapper, Editor, EMPTY_MOBILEDOC, LinkControl, LinkForm, MarkupControl, SectionControl, Toolbar };
import AtomControl from './components/AtomControl'; import CardControl from './components/CardControl'; import { classToDOMCard } from './utils/classToCard'; import Container, { EMPTY_MOBILEDOC } from './components/Container'; import Editor from './components/Editor'; import LinkControl from './components/LinkControl'; import LinkForm from './components/LinkForm'; import MarkupControl from './components/MarkupControl'; import SectionControl from './components/SectionControl'; import Toolbar from './components/Toolbar'; export { AtomControl, CardControl, classToDOMCard, Container, Editor, EMPTY_MOBILEDOC, LinkControl, LinkForm, MarkupControl, SectionControl, Toolbar };
Remove drop wrapper from exports
Remove drop wrapper from exports
JavaScript
bsd-3-clause
upworthy/react-mobiledoc-editor
7390f356615c375960ebf49bca2001a1fee43788
lib/dasher.js
lib/dasher.js
var url = require('url') var dashButton = require('node-dash-button'); var request = require('request') function DasherButton(button) { var options = {headers: button.headers, body: button.body, json: button.json} this.dashButton = dashButton(button.address, button.interface) this.dashButton.on("detected", function() { console.log(button.name + " pressed.") doRequest(button.url, button.method, options) }) console.log(button.name + " added.") } function doRequest(requestUrl, method, options, callback) { options = options || {} options.query = options.query || {} options.json = options.json || false options.headers = options.headers || {} var reqOpts = { url: url.parse(requestUrl), method: method || 'GET', qs: options.query, body: options.body, json: options.json, headers: options.headers } request(reqOpts, function onResponse(error, response, body) { if (error) { console.log("there was an error"); console.log(error); } if (response.statusCode === 401) { console.log("Not authenticated"); console.log(error); } if (response.statusCode !== 200) { console.log("Not a 200"); console.log(error); } if (callback) { callback(error, response, body) } }) } module.exports = DasherButton
var url = require('url') var dashButton = require('node-dash-button'); var request = require('request') function DasherButton(button) { var options = {headers: button.headers, body: button.body, json: button.json} this.dashButton = dashButton(button.address, button.interface) this.dashButton.on("detected", function() { console.log(button.name + " pressed.") doRequest(button.url, button.method, options) }) console.log(button.name + " added.") } function doRequest(requestUrl, method, options, callback) { options = options || {} options.query = options.query || {} options.json = options.json || false options.headers = options.headers || {} var reqOpts = { url: url.parse(requestUrl), method: method || 'GET', qs: options.query, body: options.body, json: options.json, headers: options.headers } request(reqOpts, function onResponse(error, response, body) { if (error) { console.log("there was an error"); console.log(error); } if (response && response.statusCode === 401) { console.log("Not authenticated"); console.log(error); } if (response && response.statusCode !== 200) { console.log("Not a 200"); console.log(error); } if (callback) { callback(error, response, body) } }) } module.exports = DasherButton
Add check for nil response
Add check for nil response The app was erroring on missing statusCode when no response was received. This allows the app not to crash if the url doesn't respond.
JavaScript
mit
maddox/dasher,maddox/dasher
f234cf043c80a66e742862cff36218fa04589398
src/index.js
src/index.js
'use strict'; import AssetLoader from './assetloader'; import Input from './input'; import Loop from './loop'; import Log from './log'; import Timer from './timer'; import Math from './math'; export default { AssetLoader, Input, Loop, Log, Timer, Math };
'use strict'; import AssetLoader from './assetloader'; import Input from './input'; import Loop from './loop'; import Log from './log'; import Timer from './timer'; import Math from './math'; import Types from './types'; export default { AssetLoader, Input, Loop, Log, Timer, Math };
Add types to be exported
Add types to be exported
JavaScript
unknown
freezedev/gamebox,gamebricks/gamebricks,freezedev/gamebox,gamebricks/gamebricks,maxwerr/gamebox
4aa75606353bd190240cbfd559eb291a891a7432
src/ui/app.js
src/ui/app.js
angular.module('proxtop', ['ngMaterial', 'ui.router', 'angular-progress-arc', 'pascalprecht.translate']) .config(['$stateProvider', '$urlRouterProvider', '$translateProvider', function($stateProvider, $urlRouterProvider, $translateProvider) { $urlRouterProvider.otherwise('/'); $translateProvider.useStaticFilesLoader({ prefix: 'ui/locale/locale-', suffix: '.json' }); $translateProvider.preferredLanguage('de'); $translateProvider.useSanitizeValueStrategy('sanitizeParameters'); }]);
angular.module('proxtop', ['ngMaterial', 'ui.router', 'angular-progress-arc', 'pascalprecht.translate']) .config(['$stateProvider', '$urlRouterProvider', '$translateProvider', function($stateProvider, $urlRouterProvider, $translateProvider) { $urlRouterProvider.otherwise('/'); $translateProvider.useStaticFilesLoader({ prefix: 'ui/locale/locale-', suffix: '.json' }); $translateProvider.preferredLanguage('de'); $translateProvider.useSanitizeValueStrategy('escape'); }]);
Fix missing dependency when using ng-translate
Fix missing dependency when using ng-translate
JavaScript
mit
kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop
cbb27012bb0c8ffc338d92b2cf3ef4449a65e4a4
src/config.js
src/config.js
const config = Object.assign({ development: { api: { trade_events: { host: 'https://intrasearch.govwizely.com/v1/trade_events', }, }, }, production: { api: { trade_events: { host: 'https://intrasearch.export.gov/v1/trade_events', }, }, }, }); export default config[process.env.NODE_ENV];
import assign from 'object-assign'; const config = assign({ development: { api: { trade_events: { host: 'https://intrasearch.govwizely.com/v1/trade_events', }, }, }, production: { api: { trade_events: { host: 'https://intrasearch.export.gov/v1/trade_events', }, }, }, }); export default config[process.env.NODE_ENV];
Use object-assign instead of Object.assign
Use object-assign instead of Object.assign
JavaScript
mit
GovWizely/trade-event-search-app,GovWizely/trade-event-search-app
8295d27a906f850cefd86321d212162cba7ef296
local-cli/wrong-react-native.js
local-cli/wrong-react-native.js
#!/usr/bin/env node /** * 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. */ console.error([ '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', 'To fix the issue, run:\033[0m', 'npm uninstall -g react-native', 'npm install -g react-native-cli' ].join('\n')); process.exit(1);
#!/usr/bin/env node /** * 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. */ var script = process.argv[1]; var installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1; if (installedGlobally) { console.error([ '\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?', 'To fix the issue, run:\033[0m', 'npm uninstall -g react-native', 'npm install -g react-native-cli' ].join('\n')); process.exit(1); } else { require('./cli').run(); }
Fix usage of react-native cli inside package.json scripts
Fix usage of react-native cli inside package.json scripts Summary: IIRC we made `wrong-react-native` to warn people in case they installed `react-native` globally (instead of `react-native-cli` what the guide suggests). To do that we added `bin` entry to React Native's `package.json` that points to `local-cli/wrong-react-native.js` However, this means that if we have a project that uses `react-native` package and has call to `react-native` CLI inside its package.json, npm will execute *local* override (which just prints a confusing in this context error message). In fact, the template we generate with `react-native init` has `react-native start` as `start` script, which makes it useless. Let's fix it by making `wrong-react-native` script smarter – it can detect that it has been executed from local `node_modules` and run the actual CLI. cc vjeux ide Closes https://github.com/facebook/react-native/pull/7243 Differential Revision: D3226645 Pulled By: frantic fb-gh-sync-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7 fbshipit-source-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
JavaScript
bsd-3-clause
CodeLinkIO/react-native,imjerrybao/react-native,shrutic123/react-native,tszajna0/react-native,gitim/react-native,DanielMSchmidt/react-native,jadbox/react-native,ndejesus1227/react-native,tsjing/react-native,exponent/react-native,naoufal/react-native,martinbigio/react-native,mironiasty/react-native,browniefed/react-native,corbt/react-native,InterfaceInc/react-native,makadaw/react-native,doochik/react-native,happypancake/react-native,jhen0409/react-native,shrutic123/react-native,dikaiosune/react-native,InterfaceInc/react-native,rickbeerendonk/react-native,nickhudkins/react-native,Bhullnatik/react-native,myntra/react-native,DannyvanderJagt/react-native,salanki/react-native,facebook/react-native,jadbox/react-native,jadbox/react-native,gitim/react-native,jaggs6/react-native,catalinmiron/react-native,BretJohnson/react-native,tsjing/react-native,tadeuzagallo/react-native,makadaw/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,arthuralee/react-native,facebook/react-native,negativetwelve/react-native,skevy/react-native,cdlewis/react-native,hoangpham95/react-native,luqin/react-native,wenpkpk/react-native,negativetwelve/react-native,dikaiosune/react-native,skatpgusskat/react-native,arthuralee/react-native,hammerandchisel/react-native,tgoldenberg/react-native,farazs/react-native,Swaagie/react-native,cdlewis/react-native,Ehesp/react-native,Swaagie/react-native,esauter5/react-native,cosmith/react-native,doochik/react-native,cosmith/react-native,BretJohnson/react-native,htc2u/react-native,jadbox/react-native,alin23/react-native,Maxwell2022/react-native,CntChen/react-native,wenpkpk/react-native,hoastoolshop/react-native,forcedotcom/react-native,imjerrybao/react-native,rickbeerendonk/react-native,browniefed/react-native,cpunion/react-native,formatlos/react-native,shrutic/react-native,PlexChat/react-native,csatf/react-native,myntra/react-native,pandiaraj44/react-native,nickhudkins/react-native,foghina/react-native,imDangerous/react-native,aaron-goshine/react-native,rickbeerendonk/react-native,eduardinni/react-native,arthuralee/react-native,aaron-goshine/react-native,ndejesus1227/react-native,jaggs6/react-native,peterp/react-native,thotegowda/react-native,BretJohnson/react-native,PlexChat/react-native,cdlewis/react-native,dikaiosune/react-native,xiayz/react-native,CodeLinkIO/react-native,hoastoolshop/react-native,pandiaraj44/react-native,cdlewis/react-native,jevakallio/react-native,jhen0409/react-native,htc2u/react-native,frantic/react-native,DanielMSchmidt/react-native,adamjmcgrath/react-native,peterp/react-native,jadbox/react-native,tadeuzagallo/react-native,Guardiannw/react-native,xiayz/react-native,naoufal/react-native,lelandrichardson/react-native,pandiaraj44/react-native,catalinmiron/react-native,Swaagie/react-native,luqin/react-native,catalinmiron/react-native,alin23/react-native,dikaiosune/react-native,aljs/react-native,catalinmiron/react-native,xiayz/react-native,tadeuzagallo/react-native,peterp/react-native,hoangpham95/react-native,orenklein/react-native,ptomasroos/react-native,jevakallio/react-native,christopherdro/react-native,PlexChat/react-native,pandiaraj44/react-native,shrutic123/react-native,Bhullnatik/react-native,ndejesus1227/react-native,brentvatne/react-native,peterp/react-native,ankitsinghania94/react-native,Maxwell2022/react-native,foghina/react-native,formatlos/react-native,orenklein/react-native,tarkus/react-native-appletv,Maxwell2022/react-native,frantic/react-native,farazs/react-native,happypancake/react-native,hoangpham95/react-native,esauter5/react-native,forcedotcom/react-native,catalinmiron/react-native,farazs/react-native,gitim/react-native,adamjmcgrath/react-native,shrutic123/react-native,tgoldenberg/react-native,clozr/react-native,BretJohnson/react-native,facebook/react-native,nathanajah/react-native,foghina/react-native,charlesvinette/react-native,CntChen/react-native,javache/react-native,javache/react-native,corbt/react-native,jevakallio/react-native,martinbigio/react-native,tsjing/react-native,InterfaceInc/react-native,skevy/react-native,Swaagie/react-native,callstack-io/react-native,chnfeeeeeef/react-native,csatf/react-native,nickhudkins/react-native,cosmith/react-native,InterfaceInc/react-native,chnfeeeeeef/react-native,corbt/react-native,gilesvangruisen/react-native,jhen0409/react-native,xiayz/react-native,thotegowda/react-native,negativetwelve/react-native,eduardinni/react-native,aljs/react-native,Livyli/react-native,PlexChat/react-native,Andreyco/react-native,tszajna0/react-native,ptmt/react-native-macos,foghina/react-native,tgoldenberg/react-native,CntChen/react-native,mironiasty/react-native,negativetwelve/react-native,hoangpham95/react-native,brentvatne/react-native,tadeuzagallo/react-native,Maxwell2022/react-native,CntChen/react-native,Emilios1995/react-native,DannyvanderJagt/react-native,htc2u/react-native,janicduplessis/react-native,cpunion/react-native,skatpgusskat/react-native,Bhullnatik/react-native,farazs/react-native,salanki/react-native,esauter5/react-native,salanki/react-native,Guardiannw/react-native,ankitsinghania94/react-native,tsjing/react-native,lelandrichardson/react-native,myntra/react-native,chnfeeeeeef/react-native,Livyli/react-native,kesha-antonov/react-native,mironiasty/react-native,salanki/react-native,janicduplessis/react-native,ptmt/react-native-macos,chnfeeeeeef/react-native,shrutic/react-native,imjerrybao/react-native,ptmt/react-native-macos,htc2u/react-native,xiayz/react-native,myntra/react-native,eduardinni/react-native,csatf/react-native,adamjmcgrath/react-native,adamjmcgrath/react-native,martinbigio/react-native,esauter5/react-native,forcedotcom/react-native,janicduplessis/react-native,jaggs6/react-native,jevakallio/react-native,rickbeerendonk/react-native,browniefed/react-native,forcedotcom/react-native,peterp/react-native,wenpkpk/react-native,exponentjs/react-native,gitim/react-native,doochik/react-native,skevy/react-native,ndejesus1227/react-native,InterfaceInc/react-native,Guardiannw/react-native,mrspeaker/react-native,iodine/react-native,cpunion/react-native,christopherdro/react-native,Andreyco/react-native,browniefed/react-native,CntChen/react-native,mironiasty/react-native,facebook/react-native,naoufal/react-native,jhen0409/react-native,lprhodes/react-native,exponentjs/react-native,farazs/react-native,forcedotcom/react-native,Emilios1995/react-native,doochik/react-native,tarkus/react-native-appletv,doochik/react-native,alin23/react-native,Maxwell2022/react-native,Guardiannw/react-native,doochik/react-native,christopherdro/react-native,brentvatne/react-native,lelandrichardson/react-native,facebook/react-native,doochik/react-native,Livyli/react-native,Livyli/react-native,esauter5/react-native,clozr/react-native,javache/react-native,naoufal/react-native,pandiaraj44/react-native,mrspeaker/react-native,Bhullnatik/react-native,iodine/react-native,Purii/react-native,tarkus/react-native-appletv,wenpkpk/react-native,shrutic123/react-native,luqin/react-native,thotegowda/react-native,eduardinni/react-native,skatpgusskat/react-native,aljs/react-native,gre/react-native,alin23/react-native,gre/react-native,gre/react-native,Emilios1995/react-native,browniefed/react-native,callstack-io/react-native,browniefed/react-native,catalinmiron/react-native,exponentjs/react-native,gilesvangruisen/react-native,peterp/react-native,adamjmcgrath/react-native,jaggs6/react-native,makadaw/react-native,salanki/react-native,clozr/react-native,Andreyco/react-native,luqin/react-native,negativetwelve/react-native,charlesvinette/react-native,ptmt/react-native-macos,InterfaceInc/react-native,ptomasroos/react-native,shrutic123/react-native,hammerandchisel/react-native,chnfeeeeeef/react-native,nathanajah/react-native,happypancake/react-native,jhen0409/react-native,hammerandchisel/react-native,hoangpham95/react-native,jaggs6/react-native,lprhodes/react-native,clozr/react-native,Livyli/react-native,cpunion/react-native,javache/react-native,luqin/react-native,exponent/react-native,ptmt/react-native-macos,CodeLinkIO/react-native,jasonnoahchoi/react-native,iodine/react-native,lelandrichardson/react-native,jaggs6/react-native,satya164/react-native,jasonnoahchoi/react-native,Maxwell2022/react-native,gre/react-native,Swaagie/react-native,tarkus/react-native-appletv,corbt/react-native,tszajna0/react-native,gre/react-native,cdlewis/react-native,tgoldenberg/react-native,makadaw/react-native,tgoldenberg/react-native,Livyli/react-native,cpunion/react-native,Andreyco/react-native,forcedotcom/react-native,doochik/react-native,htc2u/react-native,aljs/react-native,cosmith/react-native,DannyvanderJagt/react-native,dikaiosune/react-native,lelandrichardson/react-native,thotegowda/react-native,iodine/react-native,tsjing/react-native,csatf/react-native,corbt/react-native,aaron-goshine/react-native,kesha-antonov/react-native,foghina/react-native,kesha-antonov/react-native,tgoldenberg/react-native,nickhudkins/react-native,orenklein/react-native,christopherdro/react-native,jadbox/react-native,PlexChat/react-native,callstack-io/react-native,tadeuzagallo/react-native,kesha-antonov/react-native,nathanajah/react-native,mironiasty/react-native,Swaagie/react-native,lprhodes/react-native,farazs/react-native,makadaw/react-native,lprhodes/react-native,csatf/react-native,rickbeerendonk/react-native,Purii/react-native,gitim/react-native,cdlewis/react-native,kesha-antonov/react-native,Purii/react-native,htc2u/react-native,orenklein/react-native,tszajna0/react-native,cosmith/react-native,satya164/react-native,forcedotcom/react-native,shrutic/react-native,formatlos/react-native,salanki/react-native,DanielMSchmidt/react-native,gre/react-native,csatf/react-native,adamjmcgrath/react-native,Swaagie/react-native,wenpkpk/react-native,Purii/react-native,mironiasty/react-native,rickbeerendonk/react-native,Guardiannw/react-native,hammerandchisel/react-native,DannyvanderJagt/react-native,aljs/react-native,gilesvangruisen/react-native,arthuralee/react-native,alin23/react-native,christopherdro/react-native,charlesvinette/react-native,gilesvangruisen/react-native,formatlos/react-native,martinbigio/react-native,alin23/react-native,nickhudkins/react-native,DannyvanderJagt/react-native,myntra/react-native,brentvatne/react-native,naoufal/react-native,hoangpham95/react-native,imDangerous/react-native,lelandrichardson/react-native,jhen0409/react-native,pandiaraj44/react-native,mrspeaker/react-native,thotegowda/react-native,rickbeerendonk/react-native,Bhullnatik/react-native,hoastoolshop/react-native,exponentjs/react-native,iodine/react-native,Emilios1995/react-native,jasonnoahchoi/react-native,BretJohnson/react-native,adamjmcgrath/react-native,imDangerous/react-native,cosmith/react-native,PlexChat/react-native,luqin/react-native,exponentjs/react-native,happypancake/react-native,dikaiosune/react-native,Ehesp/react-native,formatlos/react-native,nickhudkins/react-native,tgoldenberg/react-native,corbt/react-native,alin23/react-native,makadaw/react-native,martinbigio/react-native,mrspeaker/react-native,DanielMSchmidt/react-native,DanielMSchmidt/react-native,forcedotcom/react-native,janicduplessis/react-native,imjerrybao/react-native,Swaagie/react-native,orenklein/react-native,Purii/react-native,BretJohnson/react-native,htc2u/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,PlexChat/react-native,Livyli/react-native,mironiasty/react-native,imDangerous/react-native,gre/react-native,Ehesp/react-native,brentvatne/react-native,Ehesp/react-native,pandiaraj44/react-native,satya164/react-native,tadeuzagallo/react-native,ankitsinghania94/react-native,mrspeaker/react-native,hoangpham95/react-native,skatpgusskat/react-native,salanki/react-native,jasonnoahchoi/react-native,lprhodes/react-native,tsjing/react-native,mironiasty/react-native,ptomasroos/react-native,Emilios1995/react-native,facebook/react-native,shrutic/react-native,Andreyco/react-native,martinbigio/react-native,aaron-goshine/react-native,Guardiannw/react-native,mrspeaker/react-native,gilesvangruisen/react-native,satya164/react-native,wenpkpk/react-native,BretJohnson/react-native,thotegowda/react-native,Emilios1995/react-native,Maxwell2022/react-native,kesha-antonov/react-native,salanki/react-native,aaron-goshine/react-native,nathanajah/react-native,jevakallio/react-native,esauter5/react-native,jadbox/react-native,facebook/react-native,lprhodes/react-native,Guardiannw/react-native,gitim/react-native,imDangerous/react-native,DanielMSchmidt/react-native,orenklein/react-native,gitim/react-native,formatlos/react-native,gilesvangruisen/react-native,jadbox/react-native,janicduplessis/react-native,martinbigio/react-native,Bhullnatik/react-native,InterfaceInc/react-native,farazs/react-native,CodeLinkIO/react-native,hammerandchisel/react-native,ankitsinghania94/react-native,ptomasroos/react-native,exponentjs/react-native,imjerrybao/react-native,shrutic/react-native,dikaiosune/react-native,satya164/react-native,jasonnoahchoi/react-native,jasonnoahchoi/react-native,naoufal/react-native,tsjing/react-native,exponent/react-native,Bhullnatik/react-native,jaggs6/react-native,rickbeerendonk/react-native,happypancake/react-native,callstack-io/react-native,imDangerous/react-native,happypancake/react-native,doochik/react-native,shrutic123/react-native,charlesvinette/react-native,nickhudkins/react-native,Andreyco/react-native,brentvatne/react-native,Ehesp/react-native,iodine/react-native,exponent/react-native,hammerandchisel/react-native,catalinmiron/react-native,imDangerous/react-native,arthuralee/react-native,jevakallio/react-native,Purii/react-native,hammerandchisel/react-native,clozr/react-native,exponent/react-native,charlesvinette/react-native,tszajna0/react-native,janicduplessis/react-native,skatpgusskat/react-native,farazs/react-native,eduardinni/react-native,tszajna0/react-native,christopherdro/react-native,makadaw/react-native,xiayz/react-native,satya164/react-native,hoangpham95/react-native,jasonnoahchoi/react-native,satya164/react-native,Livyli/react-native,cpunion/react-native,ndejesus1227/react-native,shrutic/react-native,lprhodes/react-native,naoufal/react-native,makadaw/react-native,tszajna0/react-native,frantic/react-native,DannyvanderJagt/react-native,cpunion/react-native,browniefed/react-native,skevy/react-native,aljs/react-native,jasonnoahchoi/react-native,aaron-goshine/react-native,clozr/react-native,aljs/react-native,wenpkpk/react-native,aaron-goshine/react-native,BretJohnson/react-native,lprhodes/react-native,eduardinni/react-native,csatf/react-native,hoastoolshop/react-native,myntra/react-native,gilesvangruisen/react-native,CntChen/react-native,cosmith/react-native,hoastoolshop/react-native,tadeuzagallo/react-native,callstack-io/react-native,Ehesp/react-native,Purii/react-native,myntra/react-native,eduardinni/react-native,skevy/react-native,janicduplessis/react-native,ptomasroos/react-native,esauter5/react-native,thotegowda/react-native,luqin/react-native,makadaw/react-native,shrutic/react-native,tarkus/react-native-appletv,Emilios1995/react-native,aljs/react-native,dikaiosune/react-native,jaggs6/react-native,nickhudkins/react-native,brentvatne/react-native,mrspeaker/react-native,orenklein/react-native,Bhullnatik/react-native,hoastoolshop/react-native,wenpkpk/react-native,shrutic123/react-native,formatlos/react-native,CntChen/react-native,skevy/react-native,nathanajah/react-native,ptomasroos/react-native,myntra/react-native,imDangerous/react-native,brentvatne/react-native,thotegowda/react-native,clozr/react-native,jhen0409/react-native,javache/react-native,ndejesus1227/react-native,adamjmcgrath/react-native,kesha-antonov/react-native,jevakallio/react-native,negativetwelve/react-native,cdlewis/react-native,tgoldenberg/react-native,mironiasty/react-native,exponentjs/react-native,negativetwelve/react-native,alin23/react-native,cosmith/react-native,naoufal/react-native,CodeLinkIO/react-native,tarkus/react-native-appletv,hammerandchisel/react-native,aaron-goshine/react-native,javache/react-native,mrspeaker/react-native,lelandrichardson/react-native,frantic/react-native,exponentjs/react-native,cdlewis/react-native,nathanajah/react-native,csatf/react-native,DannyvanderJagt/react-native,orenklein/react-native,tadeuzagallo/react-native,nathanajah/react-native,peterp/react-native,eduardinni/react-native,myntra/react-native,callstack-io/react-native,CntChen/react-native,ankitsinghania94/react-native,foghina/react-native,tszajna0/react-native,shrutic/react-native,happypancake/react-native,PlexChat/react-native,cpunion/react-native,rickbeerendonk/react-native,charlesvinette/react-native,facebook/react-native,gilesvangruisen/react-native,lelandrichardson/react-native,Ehesp/react-native,Andreyco/react-native,christopherdro/react-native,xiayz/react-native,imjerrybao/react-native,foghina/react-native,corbt/react-native,kesha-antonov/react-native,chnfeeeeeef/react-native,clozr/react-native,foghina/react-native,xiayz/react-native,janicduplessis/react-native,DanielMSchmidt/react-native,skevy/react-native,facebook/react-native,esauter5/react-native,javache/react-native,jhen0409/react-native,imjerrybao/react-native,InterfaceInc/react-native,catalinmiron/react-native,Andreyco/react-native,imjerrybao/react-native,farazs/react-native,javache/react-native,martinbigio/react-native,CodeLinkIO/react-native,DannyvanderJagt/react-native,kesha-antonov/react-native,gre/react-native,CodeLinkIO/react-native,browniefed/react-native,Purii/react-native,formatlos/react-native,jevakallio/react-native,chnfeeeeeef/react-native,ankitsinghania94/react-native,happypancake/react-native,ptmt/react-native-macos,Guardiannw/react-native,luqin/react-native,callstack-io/react-native,nathanajah/react-native,tsjing/react-native,tarkus/react-native-appletv,CodeLinkIO/react-native,ndejesus1227/react-native,iodine/react-native,charlesvinette/react-native,htc2u/react-native,negativetwelve/react-native,hoastoolshop/react-native,DanielMSchmidt/react-native,christopherdro/react-native,exponent/react-native,skatpgusskat/react-native,corbt/react-native,tarkus/react-native-appletv,ptmt/react-native-macos,frantic/react-native,Emilios1995/react-native,chnfeeeeeef/react-native,ndejesus1227/react-native,peterp/react-native,Ehesp/react-native,ptomasroos/react-native,cdlewis/react-native,brentvatne/react-native,ptomasroos/react-native,pandiaraj44/react-native,exponent/react-native,gitim/react-native,charlesvinette/react-native,satya164/react-native,callstack-io/react-native,iodine/react-native,jevakallio/react-native,negativetwelve/react-native,hoastoolshop/react-native,skevy/react-native,exponent/react-native,ptmt/react-native-macos,javache/react-native,Maxwell2022/react-native,formatlos/react-native
1aac1de738fdef73676948be8e4d5d8fc18eb27c
caspy/static/js/api.js
caspy/static/js/api.js
(function(){ var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']); mod.config(['$resourceProvider', function($resourceProvider) { $resourceProvider.defaults.stripTrailingSlashes = false; }] ); mod.factory('caspyAPI', ['$q', '$http', '$resource', 'Constants', function($q, $http, $resource, Constants) { var api = { root: null , resources: {} , resolve: function(name) { var d = $q.defer(); if (typeof api.root[name] === 'undefined') { d.reject(new Error(name + ' endpoint not available')); } else { d.resolve(api.root[name]); } return d.promise; } , get_endpoint: function(name) { if (api.root) return api.resolve(name); return $http.get(Constants.apiRootUrl) .then(function(response) { api.root = response.data; return api.resolve(name); }) } , get_resource: function(name) { if (typeof api.resources[name] !== 'undefined') return api.resources[name]; return api.resources[name] = api.get_endpoint(name) .then(api.build_resource); } , build_resource: function(endpoint) { return $resource(endpoint); } }; return api; }] ); })();
(function(){ var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']); mod.config(['$resourceProvider', function($resourceProvider) { $resourceProvider.defaults.stripTrailingSlashes = false; }] ); mod.factory('caspyAPI', ['$q', '$http', '$resource', 'Constants', function($q, $http, $resource, Constants) { var api = { root: null , resources: {} , get_resource: function(name) { if (typeof api.resources[name] !== 'undefined') return api.resources[name]; return api.resources[name] = api.get_endpoint(name) .then(api.build_resource); } , get_endpoint: function(name) { if (api.root) return api.resolve(name); return $http.get(Constants.apiRootUrl) .then(function(response) { api.root = response.data; return api.resolve(name); }) } , build_resource: function(endpoint) { return $resource(endpoint); } , resolve: function(name) { var d = $q.defer(); if (typeof api.root[name] === 'undefined') { d.reject(new Error(name + ' endpoint not available')); } else { d.resolve(api.root[name]); } return d.promise; } }; return api; }] ); })();
Put higher level functions first
Put higher level functions first
JavaScript
bsd-3-clause
altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy
cb754daf342cdea42225efca3834966bd5328fba
src/footer.js
src/footer.js
/* backgrid http://github.com/wyuenho/backgrid Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors Licensed under the MIT @license. */ /** A Footer is a generic class that only defines a default tag `tfoot` and number of required parameters in the initializer. @abstract @class Backgrid.Footer @extends Backbone.View */ var Footer = Backgrid.Footer = Backbone.View.extend({ /** @property */ tagName: "tfoot", /** Initializer. @param {Object} options @param {*} options.parent The parent view class of this footer. @param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata. @param {Backbone.Collection} options.collection @throws {TypeError} If options.columns or options.collection is undefined. */ initialize: function (options) { Backgrid.requireOptions(options, ["columns", "collection"]); this.parent = options.parent; this.columns = options.columns; if (!(this.columns instanceof Backbone.Collection)) { this.columns = new Backgrid.Columns(this.columns); } } });
/* backgrid http://github.com/wyuenho/backgrid Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors Licensed under the MIT @license. */ /** A Footer is a generic class that only defines a default tag `tfoot` and number of required parameters in the initializer. @abstract @class Backgrid.Footer @extends Backbone.View */ var Footer = Backgrid.Footer = Backbone.View.extend({ /** @property */ tagName: "tfoot", /** Initializer. @param {Object} options @param {*} options.parent The parent view class of this footer. @param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata. @param {Backbone.Collection} options.collection @throws {TypeError} If options.columns or options.collection is undefined. */ initialize: function (options) { Backgrid.requireOptions(options, ["columns", "collection"]); this.columns = options.columns; if (!(this.columns instanceof Backbone.Collection)) { this.columns = new Backgrid.Columns(this.columns); } } });
Remove extraneous parent reference from Footer
Remove extraneous parent reference from Footer
JavaScript
mit
goodwall/backgrid,blackducksoftware/backgrid,wyuenho/backgrid,wyuenho/backgrid,digideskio/backgrid,qferr/backgrid,bryce-gibson/backgrid,aboieriu/backgrid,ludoo0d0a/backgrid,bryce-gibson/backgrid,blackducksoftware/backgrid,aboieriu/backgrid,digideskio/backgrid,Acquisio/backgrid,kirill-zhirnov/backgrid,crealytics/backgrid,ludoo0d0a/backgrid,kirill-zhirnov/backgrid,getjaco/backgrid,jesseditson/backgrid,qferr/backgrid,goodwall/backgrid,jesseditson/backgrid,getjaco/backgrid,Acquisio/backgrid
8d46d03dd81046fb1e9821ab5e3c4c85e7eba747
lib/modules/storage/class_static_methods/is_secured.js
lib/modules/storage/class_static_methods/is_secured.js
function isSecured(operation) { if (_.has(this.schema.secured, operation)) { return this.schema.secured[operation]; } else { return this.schema.secured.common || false; } }; export default isSecured;
import _ from 'lodash'; function isSecured(operation) { if (_.has(this.schema.secured, operation)) { return this.schema.secured[operation]; } else { return this.schema.secured.common || false; } }; export default isSecured;
Fix lack of loads import
Fix lack of loads import
JavaScript
mit
jagi/meteor-astronomy
f6397f79ef1471f87aa113a4dc4bab900e07935c
lib/routes.js
lib/routes.js
var addFollowers = require('./follow'); var checkAuth = require('./check_auth'); var checkPrivilege = require('./privilege_check'); var githubOAuth = require('./github_oauth'); var users = require('./db').get('users'); module.exports = function(app) { app.get('/me', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.find({ following: req.session.user.login }, function(err, following) { res.json({ privilege: privilege, following: following }); }); }); }); app.get('/user', checkAuth, function(req, res) { return res.json(req.session.user); }); app.post('/follow/:login', function(req, res) { if (!req.session.user) { return res.status(401).json({ error: 'Not logged in' }); } var amount = req.body.amount; if (!amount) { amount = 10; } addFollowers(req.session.user.login, -1, function(err, result) { res.json(result); }); }); githubOAuth.addRoutes(app, function(err, token, res, ignore, req) { if (token.error) { return res.send('There was an error logging in: ' + token.error_description); } req.session.token = token.access_token; res.redirect('/'); }); };
var addFollowers = require('./follow'); var checkAuth = require('./check_auth'); var checkPrivilege = require('./privilege_check'); var githubOAuth = require('./github_oauth'); var users = require('./db').get('users'); module.exports = function(app) { app.get('/me', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.find({ following: req.session.user.login }, function(err, following) { res.json({ privilege: privilege, following: following }); }); }); }); app.get('/user', checkAuth, function(req, res) { return res.json(req.session.user); }); app.post('/follow/:login', checkAuth, function(req, res) { checkPrivilege(req.session.user.login, function(err, privilege) { users.findOne({ login: req.session.user.login }, function(error, user) { var amount = privilege.following - user.following; addFollowers(req.session.user.login, amount, function(err, result) { res.json(result); }); }); }); }); githubOAuth.addRoutes(app, function(err, token, res, ignore, req) { if (token.error) { return res.send('There was an error logging in: ' + token.error_description); } req.session.token = token.access_token; res.redirect('/'); }); };
Add privilege check on follow button
Add privilege check on follow button
JavaScript
mit
simplyianm/ghfollowers,legoboy0215/ghfollowers,simplyianm/ghfollowers,legoboy0215/ghfollowers
3bed3dbca37e1e2072581ae8fc1a532c63c1afd7
js/plugins/EncryptedInsightStorage.js
js/plugins/EncryptedInsightStorage.js
var cryptoUtil = require('../util/crypto'); var InsightStorage = require('./InsightStorage'); var inherits = require('inherits'); function EncryptedInsightStorage(config) { InsightStorage.apply(this, [config]); } inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { if (err) { return callback(err); } var decryptedJson = cryptoUtil.decrypt(key, body); if (!decryptedJson) { return callback('Internal Error'); } return callback(null, decryptedJson); } ]); }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { var key = cryptoUtil.kdfbinary(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); }; module.exports = EncryptedInsightStorage;
var cryptoUtil = require('../util/crypto'); var InsightStorage = require('./InsightStorage'); var inherits = require('inherits'); function EncryptedInsightStorage(config) { InsightStorage.apply(this, [config]); } inherits(EncryptedInsightStorage, InsightStorage); EncryptedInsightStorage.prototype.getItem = function(name, callback) { var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.getItem.apply(this, [name, function(err, body) { if (err) { return callback(err); } var decryptedJson = cryptoUtil.decrypt(key, body); if (!decryptedJson) { return callback('Internal Error'); } return callback(null, decryptedJson); } ]); }; EncryptedInsightStorage.prototype.setItem = function(name, value, callback) { var key = cryptoUtil.kdf(this.password + this.email); var record = cryptoUtil.encrypt(key, value); InsightStorage.prototype.setItem.apply(this, [name, record, callback]); }; EncryptedInsightStorage.prototype.removeItem = function(name, callback) { var key = cryptoUtil.kdf(this.password + this.email); InsightStorage.prototype.removeItem.apply(this, [name, callback]); }; module.exports = EncryptedInsightStorage;
Use the same kdf for Insight Storage
Use the same kdf for Insight Storage
JavaScript
mit
LedgerHQ/copay,troggy/unicoisa,Bitcoin-com/Wallet,BitGo/copay,wallclockbuilder/copay,msalcala11/copay,cmgustavo/copay,BitGo/copay,Kirvx/copay,DigiByte-Team/copay,mpolci/copay,Neurosploit/copay,payloadtech/wallet,mzpolini/copay,mpolci/copay,wallclockbuilder/copay,wallclockbuilder/copay,ObsidianCryptoVault/copay,fr34k8/copay,ionux/copay,habibmasuro/copay,Neurosploit/copay,robjohnson189/copay,msalcala11/copay,msalcala11/copay,jameswalpole/copay,JDonadio/copay,urv2/wallet,Tetpay/copay,gabrielbazan7/copay,gabrielbazan7/copay,kleetus/copay,wallclockbuilder/copay,troggy/unicoisa,julianromera/copay,DigiByte-Team/copay,troggy/copay,habibmasuro/copay,kleetus/copay,BitGo/copay,gabrielbazan7/copay,wyrdmantis/copay,solderzzc/copay,jameswalpole/copay,isocolsky/copay,bitchk-wallet/copay,ajp8164/copay,solderzzc/copay,payloadtech/wallet,troggy/colu-copay-wallet,wyrdmantis/copay,johnsmith76/Lite-Wallet,fr34k8/copay,urv2/wallet,matiu/copay,payloadpk/wallet,philosodad/copay,gabrielbazan7/copay,Bitcoin-com/Wallet,DigiByte-Team/copay,tanojaja/copay,wyrdmantis/copay,johnsmith76/Lite-Wallet,mpolci/copay,Neurosploit/copay,Groestlcoin/GroestlPay,Kirvx/copay,bitchk-wallet/copay,DigiByte-Team/copay,matiu/copay,robjohnson189/copay,MonetaryUnit/copay,JDonadio/copay,isocolsky/copay,CryptArc/platinumpay,ionux/copay,bitjson/copay,Neurosploit/copay,dabura667/copay,payloadpk/wallet,troggy/colu-copay-wallet,janko33bd/copay,willricketts/copay,troggy/colu-copay-wallet,ObsidianCryptoVault/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,bankonme/copay,mzpolini/copay,matiu/copay,JDonadio/copay,troggy/copay,javierbitpay/copay,startcoin-project/startwallet,Kirvx/copay,julianromera/copay,jameswalpole/copay,DigiByte-Team/copay,payloadpk/wallet,johnsmith76/Lite-Wallet,startcoin-project/startwallet,javierbitpay/copay,solderzzc/copay,LedgerHQ/copay,Bitcoin-com/Wallet,troggy/unicoisa,bankonme/copay,bankonme/copay,fr34k8/copay,cobit-wallet/cobit,cobit-wallet/cobit,julianromera/copay,tanojaja/copay,kleetus/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,Kirvx/copay,bitjson/copay,willricketts/copay,jmaurice/copay,ionux/copay,jmaurice/copay,payloadpk/wallet,bechi/copay,mzpolini/copay,robjohnson189/copay,isocolsky/copay,mpolci/copay,ObsidianCryptoVault/copay,cmgustavo/copay,digibyte/digibytego,JDonadio/copay,isocolsky/copay,cobit-wallet/cobit,Groestlcoin/GroestlPay,digibyte/digibytego,MonetaryUnit/copay,ztalker/copay,troggy/colu-copay-wallet,bitchk-wallet/copay,MonetaryUnit/copay,BitGo/copay,bankonme/copay,javierbitpay/copay,ajp8164/copay,hideoussquid/aur-copay,troggy/copay,julianromera/copay,payloadtech/wallet,CryptArc/platinumpay,troggy/unicoisa,CryptArc/platinumpay,dabura667/copay,jmaurice/copay,cmgustavo/copay,fr34k8/copay,bechi/copay,mzpolini/copay,msalcala11/copay,ionux/copay,habibmasuro/copay,robjohnson189/copay,startcoin-project/startwallet,philosodad/copay,philosodad/copay,CryptArc/platinumpay,ztalker/copay,startcoin-project/startwallet,DigiByte-Team/copay,ObsidianCryptoVault/copay,hideoussquid/aur-copay,janko33bd/copay,wyrdmantis/copay,Tetpay/copay,tanojaja/copay,payloadtech/wallet,bechi/copay,kleetus/copay,willricketts/copay,dabura667/copay,matiu/copay,urv2/wallet,cmgustavo/copay,ztalker/copay,habibmasuro/copay,willricketts/copay,jameswalpole/copay,janko33bd/copay,LedgerHQ/copay,philosodad/copay,digibyte/digibytego,johnsmith76/Lite-Wallet,Bitcoin-com/Wallet,ztalker/copay,DigiByte-Team/copay,jmaurice/copay,ajp8164/copay,solderzzc/copay,troggy/copay,bitjson/copay,MonetaryUnit/copay,urv2/wallet,tanojaja/copay,LedgerHQ/copay,bitjson/copay,javierbitpay/copay
197b667ca677c5961c9c1d116fb86032bd2ef861
app/assets/javascripts/application.js
app/assets/javascripts/application.js
//= require jquery $(function() { $('.login-trello').click(function() { Trello.authorize({ type: "redirect", name: "Reportrello", scope: { read: true, write: true } }); }); })
//= require jquery $(function() { $('.login-trello').click(function() { Reportrello.authorize(); }); Reportrello = { authorize: function() { var self = this Trello.authorize({ type: 'popup', name: 'Reportrello', fragment: 'postmessage', scope: { read: true, write: true }, expiration: 'never', success: function() { self.getMe(); }, error: function() { alert("Failed authentication"); } }); }, getMe: function() { var token = localStorage.getItem('trello_token'); Trello.rest( 'GET', 'members/me', { fields: 'username,fullName,avatar', token: token }, function (object) { location.href = '/authentication/?user[token]=' + token + '&user[username]=' + object.username + '&user[fullname]=' + object.fullName }, function (a) { alert("Failed authentication"); } ); }, newReport: function() { } } })
Add JS to authentication and get user information by token
Add JS to authentication and get user information by token
JavaScript
mit
SauloSilva/reportrello,SauloSilva/reportrello,SauloSilva/reportrello
3578177e3e10ebb0c5c0403b2df13fa472c70edb
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree .
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require turbolinks //= require_tree .
Enable JavaScript code of bootstrap
Enable JavaScript code of bootstrap
JavaScript
mit
eqot/petroglyph3,eqot/petroglyph3
9716b2cd82d4f4a778f798b88838a5685db2b7ea
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require turbolinks //= require_tree .
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require turbolinks //= require rails-ujs //= require_tree .
Enable rails-ujs to make working REST methods on link by js
Enable rails-ujs to make working REST methods on link by js
JavaScript
mit
gadzorg/gram2_api_server,gadzorg/gram2_api_server,gadzorg/gram2_api_server
700f316c0ca9aa873181111752ba99b0f17a1d35
src-es6/test/classTest.js
src-es6/test/classTest.js
import test from 'tape' import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..' test('Polygon#contains', t => { t.plan(5) //Disable warning about missing 'new'. That's what we are testing /*jshint -W064 */ /*eslint-disable new-cap */ t.throws(()=> Polygon(), TypeError) t.throws(()=> Rectangle(), TypeError) t.throws(()=> Vector(), TypeError) t.throws(()=> Circle(), TypeError) t.throws(()=> ShapeEventEmitter(), TypeError) /*eslint-enable new-cap */ })
import test from 'tape' import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..' test('Classtest', t => { t.plan(5) //Disable warning about missing 'new'. That's what we are testing /*jshint -W064 */ /*eslint-disable new-cap */ t.throws(()=> Polygon(), TypeError) t.throws(()=> Rectangle(), TypeError) t.throws(()=> Vector(), TypeError) t.throws(()=> Circle(), TypeError) t.throws(()=> ShapeEventEmitter(), TypeError) /*eslint-enable new-cap */ })
Fix name for the classtest
Fix name for the classtest
JavaScript
mit
tillarnold/shapes
1cf21242ccd82a54bf1b0da0f61184065f3bd765
WebContent/js/moe-list.js
WebContent/js/moe-list.js
/* Cached Variables *******************************************************************************/ var context = sessionStorage.getItem('context'); var rowThumbnails = document.querySelector('.row-thumbnails'); /* Initialization *********************************************************************************/ rowThumbnails.addEventListener("click", moeRedirect, false); function moeRedirect(event) { var target = event.target; var notImage = target.className !== 'thumbnail-image'; if(notImage) return; var pageId = target.getAttribute('data-page-id'); window.location.href = context + '/page/' + pageId; } var thumbnails = window.document.querySelectorAll('.thumbnail'); var tallestThumbnailSize = 0; thumbnails.forEach(function(value, key, listObj, argument) { var offsetHeight = listObj[key].offsetHeight; if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; }); thumbnails.forEach(function(value, key, listObj, argument) { listObj[key].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); }); //After thumbnail processing, remove the page-loading blocker document.querySelector('body').classList.remove('content-loading');
/* Cached Variables *******************************************************************************/ var context = sessionStorage.getItem('context'); var rowThumbnails = document.querySelector('.row-thumbnails'); /* Initialization *********************************************************************************/ rowThumbnails.addEventListener("click", moeRedirect, false); function moeRedirect(event) { var target = event.target; var notImage = target.className !== 'thumbnail-image'; if(notImage) return; var pageId = target.getAttribute('data-page-id'); window.location.href = context + '/page/' + pageId; } var thumbnails = window.document.querySelectorAll('.thumbnail'); var tallestThumbnailSize = 0; for (var i = 0; i < thumbnails.length; i++) { var offsetHeight = thumbnails[i].offsetHeight; if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight; }; for (var i = 0; i < thumbnails.length; i++) { thumbnails[i].setAttribute('style','min-height:' + tallestThumbnailSize + 'px'); }; //After thumbnail processing, remove the page-loading blocker document.querySelector('body').classList.remove('content-loading');
Change nodelist.foreach to a normal for loop
Change nodelist.foreach to a normal for loop This should bring much greater browser compatibility the the nodelist foreach allowing it to work on all the major browser vendors. Fixes #95
JavaScript
mit
NYPD/moe-sounds,NYPD/moe-sounds
0a5d4a96c4f656ff2aa154274dc19cfa3f4d3d17
openstack_dashboard/static/fiware/contextualHelp.js
openstack_dashboard/static/fiware/contextualHelp.js
$( document ).ready(function () { $('.contextual-help').click(function (){ $(this).find('i').toggleClass('active'); }); $('body').click(function (e) { $('[data-toggle="popover"]').each(function () { //the 'is' for buttons that trigger popups //the 'has' for icons within a button that triggers a popup if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { $(this).popover('hide'); $(this).find('i').removeClass('active'); } }); }); });
$( document ).ready(function () { $('.contextual-help').click(function (){ $(this).find('i').toggleClass('active'); }); $('body').click(function (e) { $('[data-toggle="popover"].contextual-help').each(function () { //the 'is' for buttons that trigger popups //the 'has' for icons within a button that triggers a popup if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { $(this).popover('hide'); $(this).find('i').removeClass('active'); } }); }); });
Improve usability of contextual-help popovers
Improve usability of contextual-help popovers
JavaScript
apache-2.0
ging/horizon,ging/horizon,ging/horizon,ging/horizon
f4ac2aad1922930d4c27d4841e5665714a509a14
src/command-line/index.js
src/command-line/index.js
var program = require("commander"); var pkg = require("../../package.json"); var fs = require("fs"); var mkdirp = require("mkdirp"); var Helper = require("../helper"); program.version(pkg.version, "-v, --version"); program.option(""); program.option(" --home <path>" , "home path"); require("./start"); require("./config"); require("./list"); require("./add"); require("./remove"); require("./reset"); require("./edit"); var argv = program.parseOptions(process.argv); if (program.home) { Helper.HOME = program.home; } var config = Helper.HOME + "/config.js"; if (!fs.existsSync(config)) { mkdirp.sync(Helper.HOME); fs.writeFileSync( config, fs.readFileSync(__dirname + "/../../defaults/config.js") ); console.log("Config created:"); console.log(config); } program.parse(argv.args); if (!program.args.length) { program.parse(process.argv.concat("start")); }
var program = require("commander"); var pkg = require("../../package.json"); var fs = require("fs"); var mkdirp = require("mkdirp"); var Helper = require("../helper"); program.version(pkg.version, "-v, --version"); program.option(""); program.option(" --home <path>" , "home path"); var argv = program.parseOptions(process.argv); if (program.home) { Helper.HOME = program.home; } var config = Helper.HOME + "/config.js"; if (!fs.existsSync(config)) { mkdirp.sync(Helper.HOME); fs.writeFileSync( config, fs.readFileSync(__dirname + "/../../defaults/config.js") ); console.log("Config created:"); console.log(config); } require("./start"); require("./config"); require("./list"); require("./add"); require("./remove"); require("./reset"); require("./edit"); program.parse(argv.args); if (!program.args.length) { program.parse(process.argv.concat("start")); }
Fix loading config before HOME variable is set
Fix loading config before HOME variable is set
JavaScript
mit
realies/lounge,ScoutLink/lounge,realies/lounge,rockhouse/lounge,rockhouse/lounge,FryDay/lounge,williamboman/lounge,rockhouse/lounge,sebastiencs/lounge,sebastiencs/lounge,libertysoft3/lounge-autoconnect,metsjeesus/lounge,FryDay/lounge,williamboman/lounge,williamboman/lounge,metsjeesus/lounge,ScoutLink/lounge,sebastiencs/lounge,MaxLeiter/lounge,thelounge/lounge,FryDay/lounge,metsjeesus/lounge,thelounge/lounge,realies/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge,ScoutLink/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge
2135e956f28bafdfe11786d3157f52ea05bccf33
config/env/production.js
config/env/production.js
'use strict'; module.exports = { db: 'mongodb://localhost/mean', app: { name: 'MEAN - A Modern Stack - Production' }, facebook: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/facebook/callback' }, twitter: { clientID: 'CONSUMER_KEY', clientSecret: 'CONSUMER_SECRET', callbackURL: 'http://localhost:3000/auth/twitter/callback' }, github: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/github/callback' }, google: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/google/callback' }, linkedin: { clientID: 'API_KEY', clientSecret: 'SECRET_KEY', callbackURL: 'http://localhost:3000/auth/linkedin/callback' } };
'use strict'; module.exports = { app: { name: 'MEAN - A Modern Stack - Production' }, facebook: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/facebook/callback' }, twitter: { clientID: 'CONSUMER_KEY', clientSecret: 'CONSUMER_SECRET', callbackURL: 'http://localhost:3000/auth/twitter/callback' }, github: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/github/callback' }, google: { clientID: 'APP_ID', clientSecret: 'APP_SECRET', callbackURL: 'http://localhost:3000/auth/google/callback' }, linkedin: { clientID: 'API_KEY', clientSecret: 'SECRET_KEY', callbackURL: 'http://localhost:3000/auth/linkedin/callback' } };
Use MONGOHQ_URL for database connection in prod
Use MONGOHQ_URL for database connection in prod
JavaScript
bsd-2-clause
asm-products/barrtr,asm-products/barrtr
f6f3afda12313c5093774b47b62fa79789efccc0
dev/_/components/js/sourceModel.js
dev/_/components/js/sourceModel.js
// Source Model AV.source = Backbone.Model.extend({ url: 'php/redirect.php/source', defaults: { name: '', type: 'raw', contentType: 'txt', data: '' }, }); // Source Model Tests // test_source = new AV.source({ // name: 'The Wind and the Rain', // type: 'raw', // contentType: 'txt', // data: "When that I was and a little tiny boy, with a hey-ho, the wind and the rain, a foolish thing was but a toy, for the rain it raineth every day." // }); // alert('potato'); // test_source.save( { // success: function () { // alert('success'); // }, // error: function(d){ // alert('everything is terrible'); // } // }); other_test = new AV.source(); other_test.url = 'php/redirect.php/source/15'; other_test.fetch(); // Source Model End
// Source Model AV.Source = Backbone.Model.extend({ url: 'php/redirect.php/source', defaults: { name: '', type: 'raw', contentType: 'txt', data: '' }, }); // Source Model Tests // test_Source = new AV.Source({ // name: 'The Wind and the Rain', // type: 'raw', // contentType: 'txt', // data: "When that I was and a little tiny boy, with a hey-ho, the wind and "+ // the rain, a foolish thing was but a toy, for the rain it raineth every day." // }); // alert('potato'); // test_Source.save( { // success: function () { // alert('success'); // }, // error: function(d){ // alert('everything is terrible'); // } // }); // other_test = new AV.Source(); // other_test.url = 'php/redirect.php/Source/15'; // other_test.fetch(); // alert(other_test.name); // Source Model End
Add some tests, they're commented out right now. Things work!
Add some tests, they're commented out right now. Things work!
JavaScript
bsd-3-clause
Swarthmore/juxtaphor,Swarthmore/juxtaphor
625fc78ee616baedf64aa37357403b4b72c7363c
src/js/select2/i18n/th.js
src/js/select2/i18n/th.js
define(function () { // Thai return { inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร'; return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร'; return message; }, loadingMore: function () { return 'กำลังค้นข้อมูลเพิ่ม…'; }, maximumSelected: function (args) { var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ'; return message; }, noResults: function () { return 'ไม่พบข้อมูล'; }, searching: function () { return 'กำลังค้นข้อมูล…'; } }; });
define(function () { // Thai return { errorLoading: function () { return 'ไม่สามารถค้นข้อมูลได้'; }, inputTooLong: function (args) { var overChars = args.input.length - args.maximum; var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร'; return message; }, inputTooShort: function (args) { var remainingChars = args.minimum - args.input.length; var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร'; return message; }, loadingMore: function () { return 'กำลังค้นข้อมูลเพิ่ม…'; }, maximumSelected: function (args) { var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ'; return message; }, noResults: function () { return 'ไม่พบข้อมูล'; }, searching: function () { return 'กำลังค้นข้อมูล…'; } }; });
Add errorLoading translation of Thai language.
Add errorLoading translation of Thai language. This closes https://github.com/select2/select2/pull/4521.
JavaScript
mit
bottomline/select2,select2/select2,ZaArsProgger/select2,inway/select2,ZaArsProgger/select2,iestruch/select2,inway/select2,bottomline/select2,iestruch/select2,select2/select2
263e6691ad0cda4c2adaee1aca584316fedcf382
test/index.js
test/index.js
var assert = require('assert') var mongo = require('../') var db = mongo('mongodb://read:read@ds031617.mongolab.com:31617/esdiscuss') before(function (done) { this.timeout(10000) db._get(done) }) describe('read only operation', function () { it('db.getCollectionNames', function (done) { db.getCollectionNames() .then(function (names) { assert(names.indexOf('contents') != -1) assert(names.indexOf('headers') != -1) assert(names.indexOf('history') != -1) assert(names.indexOf('messages') != -1) assert(names.indexOf('topics') != -1) }) .nodeify(done) }) it('db.collection("name").find().limit(10)', function (done) { db.collection('headers').find().limit(10) .then(function (headers) { assert(Array.isArray(headers)) assert(headers.length === 10) }) .nodeify(done) }) })
var assert = require('assert') var mongo = require('../') var db = mongo('mongodb://read:read@ds031617.mongolab.com:31617/esdiscuss') before(function (done) { this.timeout(10000) db._get(done) }) describe('read only operation', function () { it('db.getCollectionNames', function (done) { db.getCollectionNames() .then(function (names) { assert(names.indexOf('contents') != -1) assert(names.indexOf('headers') != -1) assert(names.indexOf('history') != -1) assert(names.indexOf('messages') != -1) assert(names.indexOf('topics') != -1) }) .nodeify(done) }) it('db.collection("name").find().limit(10)', function (done) { db.collection('headers').find().limit(10) .then(function (headers) { assert(Array.isArray(headers)) assert(headers.length === 10) }) .nodeify(done) }) it('db.collection("name").find().count()', function (done) { db.collection('headers').count() .then(function (count) { assert(typeof count === 'number'); assert(count > 0); }) .nodeify(done) }) })
Add test case for `count` method
Add test case for `count` method
JavaScript
mit
then/mongod,then/then-mongo
74632c81aa309e7d4cfab2bc4fb80effd49da773
test/index.js
test/index.js
'use strict'; var test = require('tape'); var isError = require('../index.js'); test('isError is a function', function t(assert) { assert.equal(typeof isError, 'function'); assert.end(); }); test('returns true for error', function t(assert) { assert.equal(isError(new Error('foo')), true); assert.equal(isError(Error('foo')), true); assert.end(); }); test('returns false for non-error', function t(assert) { assert.equal(isError(null), false); assert.equal(isError(undefined), false); assert.equal(isError({message: 'hi'}), false); assert.end(); });
'use strict'; var test = require('tape'); var vm = require('vm'); var isError = require('../index.js'); test('isError is a function', function t(assert) { assert.equal(typeof isError, 'function'); assert.end(); }); test('returns true for error', function t(assert) { assert.equal(isError(new Error('foo')), true); assert.equal(isError(Error('foo')), true); assert.end(); }); test('returns false for non-error', function t(assert) { assert.equal(isError(null), false); assert.equal(isError(undefined), false); assert.equal(isError({message: 'hi'}), false); assert.end(); }); test('errors that inherit from Error', function t(assert) { var error = Object.create(new Error()); assert.equal(isError(error), true); assert.end(); }); test('errors from other contexts', function t(assert) { var error = vm.runInNewContext('new Error()'); assert.equal(isError(error), true); assert.end(); }); test('errors that inherit from Error in another context', function t(assert) { var error = vm.runInNewContext('Object.create(new Error())'); assert.equal(isError(error), true); assert.end(); });
Add breaking tests for foreign/inherited errors
Add breaking tests for foreign/inherited errors
JavaScript
mit
Raynos/is-error
ce11c728c6aba22c377c9abd563aebc03df71964
core/client/views/settings/tags/settings-menu.js
core/client/views/settings/tags/settings-menu.js
var TagsSettingsMenuView = Ember.View.extend({ saveText: Ember.computed('controller.model.isNew', function () { return this.get('controller.model.isNew') ? 'Add Tag' : 'Save Tag'; }), // This observer loads and resets the uploader whenever the active tag changes, // ensuring that we can reuse the whole settings menu. updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () { var uploader = this.get('controller.uploaderReference'), image = this.get('controller.activeTag.image'); if (uploader && uploader[0]) { if (image) { uploader[0].uploaderUi.initWithImage(); } else { uploader[0].uploaderUi.initWithDropzone(); } } }) }); export default TagsSettingsMenuView;
var TagsSettingsMenuView = Ember.View.extend({ saveText: Ember.computed('controller.model.isNew', function () { return this.get('controller.model.isNew') ? 'Add Tag' : 'Save Tag'; }), // This observer loads and resets the uploader whenever the active tag changes, // ensuring that we can reuse the whole settings menu. updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () { var uploader = this.get('controller.uploaderReference'), image = this.get('controller.activeTag.image'); if (uploader && uploader[0]) { if (image) { uploader[0].uploaderUi.initWithImage(); } else { uploader[0].uploaderUi.reset(); } } }) }); export default TagsSettingsMenuView;
Reset upload component on tag switch
Reset upload component on tag switch Closes #4755
JavaScript
mit
sangcu/Ghost,thinq4yourself/Unmistakable-Blog,JohnONolan/Ghost,ThorstenHans/Ghost,optikalefx/Ghost,wemakeweb/Ghost,jomahoney/Ghost,lanffy/Ghost,tidyui/Ghost,rollokb/Ghost,shrimpy/Ghost,fredeerock/atlabghost,ClarkGH/Ghost,letsjustfixit/Ghost,UsmanJ/Ghost,rito/Ghost,TribeMedia/Ghost,BlueHatbRit/Ghost,e10/Ghost,NovaDevelopGroup/Academy,llv22/Ghost,yundt/seisenpenji,cysys/ghost-openshift,mohanambati/Ghost,Azzurrio/Ghost,Trendy/Ghost,mlabieniec/ghost-env,ashishapy/ghostpy,BayPhillips/Ghost,wspandihai/Ghost,k2byew/Ghost,VillainyStudios/Ghost,ManRueda/Ghost,delgermurun/Ghost,axross/ghost,JonSmith/Ghost,rizkyario/Ghost,TribeMedia/Ghost,no1lov3sme/Ghost,singular78/Ghost,ignasbernotas/nullifer,gcamana/Ghost,lukekhamilton/Ghost,kwangkim/Ghost,Coding-House/Ghost,anijap/PhotoGhost,situkangsayur/Ghost,handcode7/Ghost,Kikobeats/Ghost,k2byew/Ghost,IbrahimAmin/Ghost,flomotlik/Ghost,vainglori0us/urban-fortnight,Trendy/Ghost,chevex/undoctrinate,JonathanZWhite/Ghost,pollbox/ghostblog,sajmoon/Ghost,Dnlyc/Ghost,lukaszklis/Ghost,tidyui/Ghost,JulienBrks/Ghost,ckousik/Ghost,katrotz/blog.katrotz.space,novaugust/Ghost,edsadr/Ghost,TryGhost/Ghost,lukw00/Ghost,NikolaiIvanov/Ghost,davidmenger/nodejsfan,weareleka/blog,ddeveloperr/Ghost,jeonghwan-kim/Ghost,pathayes/FoodBlog,Romdeau/Ghost,rafaelstz/Ghost,load11/ghost,lethalbrains/Ghost,panezhang/Ghost,Coding-House/Ghost,cysys/ghost-openshift,vishnuharidas/Ghost,mayconxhh/Ghost,ErisDS/Ghost,carlyledavis/Ghost,tmp-reg/Ghost,jamesslock/Ghost,alecho/Ghost,Xibao-Lv/Ghost,bsansouci/Ghost,dYale/blog,kortemy/Ghost,duyetdev/islab,madole/diverse-learners,PaulBGD/Ghost-Plus,jin/Ghost,bbmepic/Ghost,Sebastian1011/Ghost,bastianbin/Ghost,memezilla/Ghost,dbalders/Ghost,jeonghwan-kim/Ghost,notno/Ghost,daihuaye/Ghost,kevinansfield/Ghost,wallmarkets/Ghost,neynah/GhostSS,blankmaker/Ghost,diancloud/Ghost,akveo/akveo-blog,diancloud/Ghost,MadeOnMars/Ghost,daihuaye/Ghost,tanbo800/Ghost,shannonshsu/Ghost,ryansukale/ux.ryansukale.com,sangcu/Ghost,gcamana/Ghost,patterncoder/patterncoder,rizkyario/Ghost,dggr/Ghost-sr,ryansukale/ux.ryansukale.com,qdk0901/Ghost,optikalefx/Ghost,praveenscience/Ghost,mohanambati/Ghost,Japh/shortcoffee,Loyalsoldier/Ghost,jorgegilmoreira/ghost,vainglori0us/urban-fortnight,pedroha/Ghost,melissaroman/ghost-blog,rameshponnada/Ghost,greenboxindonesia/Ghost,metadevfoundation/Ghost,akveo/akveo-blog,omaracrystal/Ghost,notno/Ghost,aschmoe/jesse-ghost-app,influitive/crafters,bosung90/Ghost,Kaenn/Ghost,tyrikio/Ghost,situkangsayur/Ghost,Rovak/Ghost,Japh/shortcoffee,NovaDevelopGroup/Academy,greyhwndz/Ghost,skmezanul/Ghost,imjerrybao/Ghost,mattchupp/blog,camilodelvasto/herokughost,KnowLoading/Ghost,ManRueda/Ghost,benstoltz/Ghost,morficus/Ghost,zackslash/Ghost,dggr/Ghost-sr,riyadhalnur/Ghost,GarrethDottin/Habits-Design,carlosmtx/Ghost,allanjsx/Ghost,Japh/Ghost,ITJesse/Ghost-zh,ygbhf/Ghost,ClarkGH/Ghost,telco2011/Ghost,jomofrodo/ccb-ghost,sebgie/Ghost,Yarov/yarov,sfpgmr/Ghost,vloom/blog,velimir0xff/Ghost,trunk-studio/Ghost,RufusMbugua/TheoryOfACoder,allanjsx/Ghost,daimaqiao/Ghost-Bridge,smedrano/Ghost,wangjun/Ghost,LeandroNascimento/Ghost,sifatsultan/js-ghost,blankmaker/Ghost,dai-shi/Ghost,etanxing/Ghost,acburdine/Ghost,mdbw/ghost,kevinansfield/Ghost,psychobunny/Ghost,ladislas/ghost,v3rt1go/Ghost,Xibao-Lv/Ghost,Netazoic/bad-gateway,aroneiermann/GhostJade,acburdine/Ghost,lukekhamilton/Ghost,letsjustfixit/Ghost,Elektro1776/javaPress,darvelo/Ghost,jacostag/Ghost,tksander/Ghost,pbevin/Ghost,patrickdbakke/ghost-spa,disordinary/Ghost,gabfssilva/Ghost,diogogmt/Ghost,r1N0Xmk2/Ghost,jacostag/Ghost,obsoleted/Ghost,Kikobeats/Ghost,nmukh/Ghost,lanffy/Ghost,sceltoas/Ghost,JonSmith/Ghost,metadevfoundation/Ghost,hnarayanan/narayanan.co,smaty1/Ghost,thomasalrin/Ghost,Shauky/Ghost,rmoorman/Ghost,telco2011/Ghost,johngeorgewright/blog.j-g-w.info,karmakaze/Ghost,alecho/Ghost,sunh3/Ghost,laispace/laiblog,phillipalexander/Ghost,letsjustfixit/Ghost,dqj/Ghost,gabfssilva/Ghost,Azzurrio/Ghost,bisoe/Ghost,dYale/blog,rouanw/Ghost,dqj/Ghost,carlosmtx/Ghost,hoxoa/Ghost,jiangjian-zh/Ghost,exsodus3249/Ghost,NikolaiIvanov/Ghost,nmukh/Ghost,etdev/blog,wspandihai/Ghost,bastianbin/Ghost,atandon/Ghost,codeincarnate/Ghost,shannonshsu/Ghost,icowan/Ghost,Remchi/Ghost,pensierinmusica/Ghost,ghostchina/Ghost-zh,zhiyishou/Ghost,liftup/ghost,lowkeyfred/Ghost,bisoe/Ghost,ErisDS/Ghost,manishchhabra/Ghost,kaychaks/kaushikc.org,mlabieniec/ghost-env,yangli1990/Ghost,johnnymitch/Ghost,r14r/fork_nodejs_ghost,smaty1/Ghost,trunk-studio/Ghost,kolorahl/Ghost,PDXIII/Ghost-FormMailer,zeropaper/Ghost,Bunk/Ghost,PDXIII/Ghost-FormMailer,schematical/Ghost,patterncoder/patterncoder,javorszky/Ghost,dbalders/Ghost,johngeorgewright/blog.j-g-w.info,memezilla/Ghost,PeterCxy/Ghost,makapen/Ghost,Netazoic/bad-gateway,velimir0xff/Ghost,pensierinmusica/Ghost,melissaroman/ghost-blog,ballPointPenguin/Ghost,UsmanJ/Ghost,dai-shi/Ghost,tchapi/igneet-blog,jgillich/Ghost,dymx101/Ghost,leonli/ghost,schneidmaster/theventriloquist.us,Loyalsoldier/Ghost,dgem/Ghost,Rovak/Ghost,developer-prosenjit/Ghost,gleneivey/Ghost,ananthhh/Ghost,klinker-apps/ghost,NamedGod/Ghost,Klaudit/Ghost,psychobunny/Ghost,yundt/seisenpenji,Smile42RU/Ghost,singular78/Ghost,ITJesse/Ghost-zh,jorgegilmoreira/ghost,telco2011/Ghost,delgermurun/Ghost,Feitianyuan/Ghost,thomasalrin/Ghost,janvt/Ghost,woodyrew/Ghost,olsio/Ghost,ngosinafrica/SiteForNGOs,jiachenning/Ghost,r14r/fork_nodejs_ghost,jiachenning/Ghost,allanjsx/Ghost,darvelo/Ghost,jaswilli/Ghost,flpms/ghost-ad,UnbounDev/Ghost,ineitzke/Ghost,achimos/ghost_as,lf2941270/Ghost,Sebastian1011/Ghost,ljhsai/Ghost,sfpgmr/Ghost,greenboxindonesia/Ghost,wangjun/Ghost,TryGhost/Ghost,lukw00/Ghost,devleague/uber-hackathon,load11/ghost,NovaDevelopGroup/Academy,uploadcare/uploadcare-ghost-demo,Brunation11/Ghost,SkynetInc/steam,arvidsvensson/Ghost,ngosinafrica/SiteForNGOs,GroupxDev/javaPress,davidmenger/nodejsfan,AlexKVal/Ghost,weareleka/blog,tandrewnichols/ghost,benstoltz/Ghost,veyo-care/Ghost,r1N0Xmk2/Ghost,julianromera/Ghost,BayPhillips/Ghost,ManRueda/manrueda-blog,woodyrew/Ghost,sebgie/Ghost,singular78/Ghost,hoxoa/Ghost,jomofrodo/ccb-ghost,bosung90/Ghost,KnowLoading/Ghost,anijap/PhotoGhost,ManRueda/manrueda-blog,JohnONolan/Ghost,ErisDS/Ghost,veyo-care/Ghost,cqricky/Ghost,FredericBernardo/Ghost,Kikobeats/Ghost,sebgie/Ghost,tyrikio/Ghost,djensen47/Ghost,devleague/uber-hackathon,dylanchernick/ghostblog,schematical/Ghost,no1lov3sme/Ghost,neynah/GhostSS,adam-paterson/blog,manishchhabra/Ghost,PepijnSenders/whatsontheotherside,YY030913/Ghost,yanntech/Ghost,javorszky/Ghost,dbalders/Ghost,ddeveloperr/Ghost,pbevin/Ghost,lowkeyfred/Ghost,edurangel/Ghost,Netazoic/bad-gateway,tandrewnichols/ghost,codeincarnate/Ghost,edsadr/Ghost,kaychaks/kaushikc.org,denzelwamburu/denzel.xyz,hnarayanan/narayanan.co,VillainyStudios/Ghost,ryanbrunner/crafters,mnitchie/Ghost,jaswilli/Ghost,augbog/Ghost,camilodelvasto/herokughost,tmp-reg/Ghost,stridespace/Ghost,Klaudit/Ghost,hyokosdeveloper/Ghost,ryanbrunner/crafters,cqricky/Ghost,liftup/ghost,petersucks/blog,francisco-filho/Ghost,zackslash/Ghost,panezhang/Ghost,duyetdev/islab,Alxandr/Blog,e10/Ghost,mhhf/ghost-latex,ignasbernotas/nullifer,GarrethDottin/Habits-Design,LeandroNascimento/Ghost,rafaelstz/Ghost,morficus/Ghost,ineitzke/Ghost,javimolla/Ghost,cwonrails/Ghost,klinker-apps/ghost,ballPointPenguin/Ghost,djensen47/Ghost,Feitianyuan/Ghost,Alxandr/Blog,pedroha/Ghost,trepafi/ghost-base,zeropaper/Ghost,ckousik/Ghost,jiangjian-zh/Ghost,cicorias/Ghost,jin/Ghost,olsio/Ghost,ManRueda/manrueda-blog,cncodog/Ghost-zh-codog,jamesslock/Ghost,jaguerra/Ghost,STANAPO/Ghost,carlyledavis/Ghost,jparyani/GhostSS,flpms/ghost-ad,rchrd2/Ghost,devleague/uber-hackathon,influitive/crafters,yangli1990/Ghost,rameshponnada/Ghost,aschmoe/jesse-ghost-app,atandon/Ghost,jgillich/Ghost,pollbox/ghostblog,bitjson/Ghost,PeterCxy/Ghost,handcode7/Ghost,madole/diverse-learners,SkynetInc/steam,mohanambati/Ghost,rouanw/Ghost,acburdine/Ghost,epicmiller/pages,kortemy/Ghost,dgem/Ghost,hyokosdeveloper/Ghost,prosenjit-itobuz/Ghost,epicmiller/pages,claudiordgz/Ghost,phillipalexander/Ghost,netputer/Ghost,daimaqiao/Ghost-Bridge,Remchi/Ghost,tanbo800/Ghost,sceltoas/Ghost,mayconxhh/Ghost,neynah/GhostSS,icowan/Ghost,ladislas/ghost,fredeerock/atlabghost,daimaqiao/Ghost-Bridge,greyhwndz/Ghost,bsansouci/Ghost,theonlypat/Ghost,vloom/blog,cncodog/Ghost-zh-codog,yanntech/Ghost,andrewconnell/Ghost,chris-yoon90/Ghost,schneidmaster/theventriloquist.us,arvidsvensson/Ghost,mtvillwock/Ghost,novaugust/Ghost,Kaenn/Ghost,Elektro1776/javaPress,ivanoats/ivanstorck.com,ghostchina/Ghost-zh,virtuallyearthed/Ghost,denzelwamburu/denzel.xyz,virtuallyearthed/Ghost,BlueHatbRit/Ghost,sifatsultan/js-ghost,laispace/laiblog,barbastan/Ghost,lukaszklis/Ghost,adam-paterson/blog,imjerrybao/Ghost,FredericBernardo/Ghost,hilerchyn/Ghost,ThorstenHans/Ghost,Bunk/Ghost,Dnlyc/Ghost,PaulBGD/Ghost-Plus,ljhsai/Ghost,kevinansfield/Ghost,sajmoon/Ghost,disordinary/Ghost,NamedGod/Ghost,v3rt1go/Ghost,leninhasda/Ghost,Netazoic/bad-gateway,cicorias/Ghost,developer-prosenjit/Ghost,cwonrails/Ghost,zumobi/Ghost,stridespace/Ghost,beautyOfProgram/Ghost,novaugust/Ghost,barbastan/Ghost,julianromera/Ghost,nneko/Ghost,netputer/Ghost,RufusMbugua/TheoryOfACoder,ashishapy/ghostpy,smedrano/Ghost,lf2941270/Ghost,katrotz/blog.katrotz.space,Japh/Ghost,Gargol/Ghost,theonlypat/Ghost,GroupxDev/javaPress,johnnymitch/Ghost,dymx101/Ghost,kwangkim/Ghost,rito/Ghost,jparyani/GhostSS,JonathanZWhite/Ghost,pathayes/FoodBlog,aroneiermann/GhostJade,davidenq/Ghost-Blog,JulienBrks/Ghost,xiongjungit/Ghost,hnq90/Ghost,beautyOfProgram/Ghost,andrewconnell/Ghost,petersucks/blog,rollokb/Ghost,syaiful6/Ghost,leonli/ghost,jomahoney/Ghost,thinq4yourself/Unmistakable-Blog,dylanchernick/ghostblog,hnq90/Ghost,Yarov/yarov,jparyani/GhostSS,chris-yoon90/Ghost,shrimpy/Ghost,obsoleted/Ghost,nneko/Ghost,Kaenn/Ghost,GroupxDev/javaPress,lethalbrains/Ghost,leninhasda/Ghost,syaiful6/Ghost,prosenjit-itobuz/Ghost,ManRueda/Ghost,Alxandr/Blog,augbog/Ghost,thehogfather/Ghost,mnitchie/Ghost,camilodelvasto/localghost,gleneivey/Ghost,hilerchyn/Ghost,jomofrodo/ccb-ghost,etanxing/Ghost,Romdeau/Ghost,vainglori0us/urban-fortnight,jaguerra/Ghost,mdbw/ghost,davidenq/Ghost-Blog,etdev/blog,riyadhalnur/Ghost,ASwitlyk/Ghost,uploadcare/uploadcare-ghost-demo,sunh3/Ghost,rmoorman/Ghost,praveenscience/Ghost,camilodelvasto/localghost,cwonrails/Ghost,TryGhost/Ghost,SachaG/bjjbot-blog,stridespace/Ghost,laispace/laiblog,ASwitlyk/Ghost,qdk0901/Ghost,JohnONolan/Ghost,davidenq/Ghost-Blog,llv22/Ghost,leonli/ghost,tadityar/Ghost,axross/ghost,STANAPO/Ghost,edurangel/Ghost,AnthonyCorrado/Ghost,ivantedja/ghost,omaracrystal/Ghost,ivanoats/ivanstorck.com,Jai-Chaudhary/Ghost,makapen/Ghost,zhiyishou/Ghost,claudiordgz/Ghost,Elektro1776/javaPress,YY030913/Ghost,Smile42RU/Ghost,zumobi/Ghost,wemakeweb/Ghost,tadityar/Ghost,ygbhf/Ghost,cncodog/Ghost-zh-codog,francisco-filho/Ghost,DesenTao/Ghost,bitjson/Ghost,jorgegilmoreira/ghost,kolorahl/Ghost,xiongjungit/Ghost,uniqname/everydaydelicious,MadeOnMars/Ghost,janvt/Ghost,mhhf/ghost-latex,ananthhh/Ghost,exsodus3249/Ghost,bbmepic/Ghost,mlabieniec/ghost-env,DesenTao/Ghost,AnthonyCorrado/Ghost,achimos/ghost_as,mtvillwock/Ghost,skmezanul/Ghost,thehogfather/Ghost,rizkyario/Ghost,cysys/ghost-openshift,rchrd2/Ghost,diogogmt/Ghost,wallmarkets/Ghost,UnbounDev/Ghost,sergeylukin/Ghost,Brunation11/Ghost,kortemy/Ghost,SachaG/bjjbot-blog,dggr/Ghost-sr,tksander/Ghost,AlexKVal/Ghost,sergeylukin/Ghost,PepijnSenders/whatsontheotherside,flomotlik/Ghost,mattchupp/blog,karmakaze/Ghost,Gargol/Ghost,IbrahimAmin/Ghost,javimolla/Ghost,Jai-Chaudhary/Ghost
9d75d13fcca1105093170e6b98d1e690fc9cbd29
system-test/env.js
system-test/env.js
const expect = require('chai').expect; const version = process.env.QB_VERSION; describe('check compiler version inside docker', function () { it('should have the same version', async () => { const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.eql(version); }).timeout(60000); });
const expect = require('chai').expect; const version = process.env.QB_VERSION; describe('check compiler version inside docker', function () { it('should have the same version', async () => { const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.eql(version); }).timeout(60000); }); describe('check available standards', function() { it('should contain multiple standards', async() =>{ const exec = require('child_process').exec; let options = { timeout: 60000, killSignal: 'SIGKILL' }; const result = await new Promise(resolve => exec(`docker run --rm -t fredtingaud/quick-bench:${version} /bin/bash -c "./std-versions"`, options, (error, stdout, stderr) => { resolve(stdout + stderr); })); expect(result).to.not.be.empty(); expect(result).to.contain('c++11'); }) })
Add a test for std-versions script
Add a test for std-versions script
JavaScript
bsd-2-clause
FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end
210babd039054adf81522da01f55b10b5e0dc06f
tests/dev.js
tests/dev.js
var f_ = require('../index.js'); var TaskList = require('./TaskList'); var f_config = { functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED resetOnRetryAll: true, toLog: ['all'], desc: 'Test taskList', maxRetries: { all: 2 } }; TaskList = f_.augment(TaskList, f_config); var runSingle = function (){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.start(); }(); var runMultiple = function (){ var startTime = Date.now(); for(var i=0; i<10000; i+=1){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i; taskListInstance.start(); } var endTime = Date.now(), timeTaken = endTime - startTime; console.log(timeTaken); };
var f_ = require('../index.js'); var TaskList = require('./TaskList'); var f_config = { /** * `start` method is not given here, since we call it manualy * This is just a matter of personal taste, I do not like auto starts! */ functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED resetOnRetryAll: true, toLog: ['all'], desc: 'Test taskList', maxRetries: { all: 2 } }; TaskList = f_.augment(TaskList, f_config); var runSingle = function (){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.start(); }(); var runMultiple = function (){ var startTime = Date.now(); for(var i=0; i<10000; i+=1){ var taskListInstance = new TaskList(); taskListInstance = f_.setup(taskListInstance); taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i; taskListInstance.start(); } var endTime = Date.now(), timeTaken = endTime - startTime; console.log(timeTaken); };
Comment about start method not being present in functionFlow
Comment about start method not being present in functionFlow
JavaScript
mit
opensoars/f_
e34ec4cde226f760dc21926e9f2fb504fdb7fdb5
src/Drivers/Cache/index.js
src/Drivers/Cache/index.js
'use strict' /** * Abstract base class that ensures required public methods are implemented by * inheriting classes. * * @example * * class BloomFilterCache extends Cache { * constructor() { * super() * } * * get(key) {} * put(key, value, milliseconds) {} * increment(key) {} * incrementExpiration(key, seconds) {} * } * */ class Cache { /** * Do not call this constructor directly. */ constructor() { if (new.target === Cache) { throw new TypeError('Cannot instantiate abstract base class: Cache') } const abstractMethods = [ 'get', 'put', 'increment', 'incrementExpiration' ].map(name => { const implemented = typeof this[name] === 'function' return { name, implemented } }) if (!abstractMethods.every(method => method.implemented)) { const message = 'Implementing class does not override abstract methods: ' const unimplemented = abstractMethods .filter(method => !method.implemented) .map(method => method.name) .join(', ') throw new TypeError(message + unimplemented) } } } module.exports = Cache
'use strict' /** * Abstract base class that ensures required public methods are implemented by * inheriting classes. * * @example * * class BloomFilterCache extends Cache { * constructor() { * super() * } * * get(key) {} * put(key, value, milliseconds) {} * increment(key) {} * incrementExpiration(key, seconds) {} * } * */ class Cache { /** * Do not call this constructor directly. */ constructor() { if (new.target === Cache) { throw new TypeError('Cannot instantiate abstract base class: Cache') } const abstractMethods = [ 'get', 'put', 'increment', 'incrementExpiration', 'secondsToExpiration' ].map(name => { const implemented = typeof this[name] === 'function' return { name, implemented } }) if (!abstractMethods.every(method => method.implemented)) { const message = 'Implementing class does not override abstract methods: ' const unimplemented = abstractMethods .filter(method => !method.implemented) .map(method => method.name) .join(', ') throw new TypeError(message + unimplemented) } } } module.exports = Cache
Mark secondsToExpiration as abstract method
Mark secondsToExpiration as abstract method
JavaScript
mit
masasron/adonis-throttle,masasron/adonis-throttle
3f5e236d5a23f13e8f683a550d31ff44080ecb01
transforms.js
transforms.js
/** * Module dependencies */ var accounting = require('accounting') , util = require('util') , currency = require('currency-symbol-map'); /** * formatPrice - format currency code and price nicely * @param {Object} value * @returns {String} formatted price * @note Value is expected to be of the form: * { * CurrencyCode: [ 'EUR' ], * Amount: [ '130' ] // Cents * } */ module.exports.formatPrice = function (val) { var code = val && val.CurrencyCode && val.CurrencyCode[0] , amount = val && val.Amount && val.Amount[0]; if (!code || !amount) return null; return accounting.formatMoney(amount / 100, currency(code)); };
/** * Module dependencies */ var accounting = require('accounting') , util = require('util') , currency = require('currency-symbol-map'); /** * formatPrice - format currency code and price nicely * @param {Object} value * @returns {String} formatted price * @note Value is expected to be of the form: * { * CurrencyCode: [ 'EUR' ], * Amount: [ '130' ] // Cents * } */ module.exports.formatPrice = function (val) { var code = val && val.CurrencyCode && val.CurrencyCode[0] , amount = val && val.Amount && val.Amount[0] , decimal, thousand; if (!code || !amount) return null; // Set separator if (~['DE'].indexOf(this.country)) { decimal = ','; thousand = '.'; } else { decimal = '.'; thousand = ','; } return accounting.formatMoney(amount / 100, currency(code), 2, thousand, decimal); };
Format prices differently for germany
Format prices differently for germany
JavaScript
mit
urgeiolabs/aws-price
351e1eb2093ff4cfb87f17f6bcfccb95f0f589f0
source/assets/javascripts/locastyle/_toggle-text.js
source/assets/javascripts/locastyle/_toggle-text.js
var locastyle = locastyle || {}; locastyle.toggleText = (function() { 'use strict'; var config = { trigger: '[data-ls-module=toggleText]', triggerChange: 'toggleText:change' }; function eventHandler(el, target, text) { el.trigger(config.triggerChange, [target, text]); } function bindToggle(el) { var $target = el.data('target-text') ? $(el.data('target-text')) : el; var textChange = el.data('toggle-text'); var textOriginal = $target.text(); el.data('toggle-text', textOriginal); $target.text(textChange); eventHandler(el, $target, textChange); } function bindEventOnClick() { $(config.trigger).on('click.ls', function(event) { event.preventDefault(); bindToggle($(this)); event.stopPropagation(); }); } function unbind() { $(config.trigger).off('click.ls'); } function init() { unbind(); bindEventOnClick(); } return { init: init }; }());
var locastyle = locastyle || {}; locastyle.toggleText = (function() { 'use strict'; var config = { trigger: '[data-ls-module=toggleText]', triggerChange: 'toggleText:change' }; function eventHandler(el, target, text) { el.trigger(config.triggerChange, [target, text]); } function bindToggle(el) { var $target = el.data('target-text') ? $(el.data('target-text')) : el; var textChange = el.data('toggle-text'); var textOriginal = $target.text(); el.data('toggle-text', textOriginal); $target.text(textChange); eventHandler(el, $target, textChange); } function bindEventOnClick() { $(config.trigger).on('click.ls', function(event) { event.preventDefault(); bindToggle($(this)); }); } function unbind() { $(config.trigger).off('click.ls'); } function init() { unbind(); bindEventOnClick(); } return { init: init }; }());
Remove stop propagation from toggle text module
Remove stop propagation from toggle text module
JavaScript
mit
locaweb/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,locaweb/locawebstyle,locaweb/locawebstyle
c090cf03c81639622df3f7d3b0414aea926d95a3
bonfires/sum-all-odd-fibonacci-numbers/logic.js
bonfires/sum-all-odd-fibonacci-numbers/logic.js
/* Bonfire: Sum All Odd Fibonacci Numbers */ function sumFibs(num) { var f1 = 1; var f2 = 1; function fib(){ } return num; } sumFibs(4);
/* Bonfire: Sum All Odd Fibonacci Numbers */ function sumFibs(num) { var tmp = num; while (num > 2){ } return num; } sumFibs(4);
Edit Fibonacci project in Bonfires Directory
Edit Fibonacci project in Bonfires Directory
JavaScript
mit
witblacktype/freeCodeCamp_projects,witblacktype/freeCodeCamp_projects
069d6ac19107f126cc71b37dad5d8d0821d3c249
app/controllers/stream.js
app/controllers/stream.js
import Ember from 'ember'; import ENV from 'plenario-explorer/config/environment'; export default Ember.Controller.extend({ modelArrived: Ember.observer('model', function() { const nodeList = this.get('model.nodes'); const nodeTuples = nodeList.map(node => { return [node.properties.id, node.properties]; }); const nodeMap = new Map(nodeTuples); this.set('nodeMap', nodeMap); // TODO: Move magic node id to environment config this.set('selectedNode', nodeMap.get(ENV.defaultNode)); }), actions: { onSelect(nodeId) { const newNode = this.get('nodeMap').get(nodeId); this.set('selectedNode', newNode); } } });
import Ember from 'ember'; // import ENV from 'plenario-explorer/config/environment'; export default Ember.Controller.extend({ modelArrived: Ember.observer('model', function() { const nodeList = this.get('model.nodes'); const nodeTuples = nodeList.map(node => { return [node.properties.id, node.properties]; }); const nodeMap = new Map(nodeTuples); this.set('nodeMap', nodeMap); this.set('selectedNode', nodeList[0].properties); }), actions: { onSelect(nodeId) { const newNode = this.get('nodeMap').get(nodeId); this.set('selectedNode', newNode); } } });
Set default node as first returned from API
Set default node as first returned from API
JavaScript
mit
UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer
c8edf1a27fe1a9142793a071b079d079138c6851
schema/sorts/fair_sorts.js
schema/sorts/fair_sorts.js
import { GraphQLEnumType } from 'graphql'; export default { type: new GraphQLEnumType({ name: 'FairSorts', values: { created_at_asc: { value: 'created_at', }, created_at_desc: { value: '-created_at', }, start_at_asc: { value: 'start_at', }, start_at_desc: { value: '-start_at', }, name_asc: { value: 'name', }, name_desc: { value: '-name', }, }, }), };
import { GraphQLEnumType } from 'graphql'; export default { type: new GraphQLEnumType({ name: 'FairSorts', values: { CREATED_AT_ASC: { value: 'created_at', }, CREATED_AT_DESC: { value: '-created_at', }, START_AT_ASC: { value: 'start_at', }, START_AT_DESC: { value: '-start_at', }, NAME_ASC: { value: 'name', }, NAME_DESC: { value: '-name', }, }, }), };
Use uppercase for fair sort enum
Use uppercase for fair sort enum
JavaScript
mit
artsy/metaphysics,broskoski/metaphysics,artsy/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,craigspaeth/metaphysics,1aurabrown/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,artsy/metaphysics,craigspaeth/metaphysics
50b994a3873b14b50a28660547ea7d4a36e4d429
config/pathresolver.js
config/pathresolver.js
/*jslint node: true */ const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver; const path = require('path'); pathresolver.baseDir = function(req) { if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) { throw new Error("No valid user!"); } // Admin users can see all the directories if(req.user.global_roles.indexOf('admin') >= 0) { return process.env.DATA_DIR; } // Other users can only see their own directory return path.join(process.env.DATA_DIR, req.user.username); };
/*jslint node: true */ const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver; const path = require('path'); const fs = require('fs.extra'); pathresolver.baseDir = function(req) { if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) { throw new Error("No valid user!"); } // Admin users can see all the directories if(req.user.global_roles.indexOf('admin') >= 0) { return process.env.DATA_DIR; } // Other users can only see their own directory var baseDir = path.join(process.env.DATA_DIR, req.user.username); // Create the directory if it does not exist already fs.mkdirpSync(baseDir); return baseDir; };
Create user directories if they do not exist
Create user directories if they do not exist
JavaScript
agpl-3.0
fkoester/purring-flamingo,fkoester/purring-flamingo
c8ac6f48aae5a473f712231bbad389f9b788cfc7
discord-client/src/bot.js
discord-client/src/bot.js
const Discord = require('discord.js'); const { ChannelProcessor } = require('./channelProcessor'); const {discordApiToken } = require('./secrets.js'); const client = new Discord.Client(); const channelProcessorMap = {}; client.on('ready', () => { console.log('Bot is ready'); }); client.on('message', (message) => { const channel = message.channel; const channelID = message.channel.id; if(channelProcessorMap[channelID] == null) { const newChannelProcessor = new ChannelProcessor(channelID); newChannelProcessor.setOnHaikuFunction((haiku) => { channel.send( `${haiku.author} has created a beautiful Haiku! ${haiku.lines[0]} ${haiku.lines[1]} ${haiku.lines[2]}`); }); channelProcessorMap[channelID] = newChannelProcessor; } channelProcessorMap[channelID].processMessage(message); }); client.login(discordApiToken);
const Discord = require('discord.js'); const { ChannelProcessor } = require('./channelProcessor'); const {discordApiToken } = require('./secrets.js'); const client = new Discord.Client(); const channelProcessorMap = {}; client.on('ready', () => { console.log('Bot is ready'); }); client.on('message', (message) => { const channel = message.channel; const channelID = message.channel.id; if(channelProcessorMap[channelID] == null) { const newChannelProcessor = new ChannelProcessor(channelID); newChannelProcessor.setOnHaikuFunction((haiku) => { console.log( `Haiku triggered: author: ${haiku.author} lines: ${haiku.lines}`); channel.send( `${haiku.author} has created a beautiful Haiku! ${haiku.lines[0]} ${haiku.lines[1]} ${haiku.lines[2]}`); }); channelProcessorMap[channelID] = newChannelProcessor; } channelProcessorMap[channelID].processMessage(message); }); client.login(discordApiToken);
Add console logging upon haiku trigger
Add console logging upon haiku trigger
JavaScript
mit
bumblepie/haikubot
cc472a3d07b2803c9e3b4cb80624d1c312d519f7
test/fetch.js
test/fetch.js
'use strict'; var http = require('http'); var assert = require('assertive'); var fetch = require('../lib/fetch'); describe('fetch', function() { var server; before('start echo server', function(done) { server = http.createServer(function(req, res) { res.writeHead(200, { 'Content-Type': 'application/json', }); res.end(JSON.stringify({ method: req.method, url: req.url, headers: req.headers, })); }); server.on('error', done); server.listen(3000, function() { done(); }); }); after('close echo server', function(done) { server.close(done); }); it('can fetch stuff', function() { var headers = { 'x-Fancy': 'stuff' }; headers['X-Fancy'] = 'other stuff'; return fetch('http://localhost:3000/foo', { headers: headers }) .json() .then(function(echo) { assert.equal('GET', echo.method); assert.equal('/foo', echo.url); assert.equal('overriding headers works thanks to key ordering', 'other stuff', echo.headers['x-fancy']); }); }); });
'use strict'; var http = require('http'); var assert = require('assertive'); var fetch = require('../lib/fetch'); describe('fetch', function() { var server; before('start echo server', function(done) { server = http.createServer(function(req, res) { var chunks = []; req.on('data', function(chunk) { chunks.push(chunk); }); req.on('end', function() { res.writeHead(200, { 'Content-Type': 'application/json', }); res.end(JSON.stringify({ method: req.method, url: req.url, headers: req.headers, body: Buffer.concat(chunks).toString() })); }); }); server.on('error', done); server.listen(3000, function() { done(); }); }); after('close echo server', function(done) { server.close(done); }); it('can fetch stuff', function() { var headers = { 'x-Fancy': 'stuff' }; headers['X-Fancy'] = 'other stuff'; return fetch('http://localhost:3000/foo', { headers: headers }) .json() .then(function(echo) { assert.equal('GET', echo.method); assert.equal('/foo', echo.url); assert.equal('', echo.body); assert.equal('overriding headers works thanks to key ordering', 'other stuff', echo.headers['x-fancy']); }); }); });
Add test for empty body
Add test for empty body
JavaScript
bsd-3-clause
jkrems/srv-gofer
f8339c53d8b89ebb913088be19954ad8d0c44517
src/providers/sh/index.js
src/providers/sh/index.js
module.exports = { title: 'now.sh', subcommands: new Set([ 'login', 'deploy', 'ls', 'list', 'alias', 'scale', 'certs', 'dns', 'domains', 'rm', 'remove', 'whoami', 'secrets', 'logs', 'upgrade', 'teams', 'switch' ]), get deploy() { return require('./deploy') }, get login() { return require('./login') }, get ls() { return require('./commands/bin/list') }, get list() { return require('./commands/bin/list') }, get alias() { return require('./commands/bin/alias') }, get scale() { return require('./commands/bin/scale') }, get certs() { return require('./commands/bin/certs') }, get dns() { return require('./commands/bin/dns') }, get domains() { return require('./commands/bin/domains') }, get rm() { return require('./commands/bin/remove') }, get remove() { return require('./commands/bin/remove') }, get whoami() { return require('./commands/bin/whoami') }, get secrets() { return require('./commands/bin/secrets') }, get logs() { return require('./commands/bin/logs') }, get upgrade() { return require('./commands/bin/upgrade') }, get teams() { return require('./commands/bin/teams') }, get switch() { return require('./commands/bin/teams') } }
const mainCommands = new Set([ 'help', 'list', 'remove', 'alias', 'domains', 'dns', 'certs', 'secrets', 'billing', 'upgrade', 'teams', 'logs', 'scale', 'logout', 'whoami' ]) const aliases = { list: ['ls'], remove: ['rm'], alias: ['ln', 'aliases'], domains: ['domain'], certs: ['cert'], secrets: ['secret'], billing: ['cc'], upgrade: ['downgrade'], teams: ['team', 'switch'], logs: ['log'] } const subcommands = new Set(mainCommands) // Add aliases to available sub commands for (const alias in aliases) { const items = aliases[alias] for (const item of items) { subcommands.add(item) } } const list = { title: 'now.sh', subcommands, get deploy() { return require('./deploy') }, get login() { return require('./login') } } for (const subcommand of mainCommands) { let handlers = [subcommand] if (aliases[subcommand]) { handlers = handlers.concat(aliases[subcommand]) } for (const handler of handlers) { Object.defineProperty(list, handler, { get() { return require(`./commands/bin/${subcommand}`) } }) } } module.exports = list
Support for all aliases added
Support for all aliases added
JavaScript
apache-2.0
zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli
d1709007440080cc4b1ced6dbebe0096164f15fb
model/file.js
model/file.js
'use strict'; var memoize = require('memoizee/plain') , validDb = require('dbjs/valid-dbjs') , defineFile = require('dbjs-ext/object/file') , defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file') , docMimeTypes = require('../utils/microsoft-word-doc-mime-types'); module.exports = memoize(function (db) { var File, JpegFile; validDb(db); File = defineFile(db); File.prototype.url = function () { return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null; }; JpegFile = defineJpegFile(db); File.prototype.defineProperties({ preview: { type: File, value: function () { return this.isPreviewGenerated ? this.generatedPreview : this; } }, isPreviewGenerated: { type: db.Boolean, value: true }, generatedPreview: { type: File, nested: true }, thumb: { type: JpegFile, nested: true } }); File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes); return File; }, { normalizer: require('memoizee/normalizers/get-1')() });
'use strict'; var memoize = require('memoizee/plain') , validDb = require('dbjs/valid-dbjs') , defineFile = require('dbjs-ext/object/file') , defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file') , docMimeTypes = require('../utils/microsoft-word-doc-mime-types'); module.exports = memoize(function (db) { var File, JpegFile; validDb(db); File = defineFile(db); File.prototype.url = function () { return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null; }; JpegFile = defineJpegFile(db); File.prototype.defineProperties({ preview: { type: File, value: function () { return this.isPreviewGenerated ? this.generatedPreview : this; } }, isPreviewGenerated: { type: db.Boolean, value: true }, generatedPreview: { type: File, nested: true }, thumb: { type: JpegFile, nested: true }, toJSON: { value: function (descriptor) { return { kind: 'file', url: this.url, thumbUrl: this.thumb.url }; } }, isEmpty: { value: function (ignore) { return !this.path; } } }); File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes); return File; }, { normalizer: require('memoizee/normalizers/get-1')() });
Add File methods for proper JSON snapshots
Add File methods for proper JSON snapshots
JavaScript
mit
egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations
85db50188bcf660bdf83fc09c0c50eed9f0433c4
test/index.js
test/index.js
'use strict'; var assert = require('assert'); var chromedriver = require('chromedriver'); var browser = require('../'); chromedriver.start(); browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('20s'); after(function () { chromedriver.stop(); }); var getHeadingText = browser.async(function* (browser) { var heading = yield browser.elementByTagName('h1').text(); return heading; }); describe('www.example.com', function () { it('Has a header that reads "Example Domain"', browser(function* (browser) { yield browser.get('http://www.example.com'); var heading = yield getHeadingText(browser); assert(heading.trim() == 'Example Domain'); })); });
'use strict'; var assert = require('assert'); var chromedriver = require('chromedriver'); var browser = require('../'); var LOCAL = !process.env.CI; if (LOCAL) { chromedriver.start(); browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('5s'); after(function () { chromedriver.stop(); }); } else { browser.remote('ondemand.saucelabs.com', 80, 'sauce-runner', 'c71a5c75-7c28-483f-9053-56da13b40bc2').timeout('240s').operationTimeout('30s'); } var getHeadingText = browser.async(function* (browser) { var heading = yield browser.elementByTagName('h1').text(); return heading; }); describe('www.example.com', function () { it('Has a header that reads "Example Domain"', browser(function* (browser) { console.log('getting url'); yield browser.get('http://www.example.com'); console.log('getting heading text'); var heading = yield getHeadingText(browser); console.log('checking heading text'); assert(heading.trim() == 'Example Domain'); })); });
Support CI using sauce labs
Support CI using sauce labs
JavaScript
mit
ForbesLindesay/selenium-mocha
67ad246f902b2c04a426d16d5fe877ffa1fee5d0
tests/integration/angular-meteor-session-spec.js
tests/integration/angular-meteor-session-spec.js
describe('$meteorSession service', function () { var $meteorSession, $rootScope, $scope; beforeEach(angular.mock.module('angular-meteor')); beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) { $meteorSession = _$meteorSession_; $rootScope = _$rootScope_; $scope = $rootScope.$new(); })); it('should update the scope variable when session variable changes', function () { Session.set('myVar', 3); $meteorSession('myVar').bind($scope, 'myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.myVar).toEqual(4); }); it('should update the session variable when the scope variable changes', function() { $scope.myVar = 3; $meteorSession('myVar').bind($scope, 'myVar'); $scope.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); });
describe('$meteorSession service', function () { var $meteorSession, $rootScope, $scope; beforeEach(angular.mock.module('angular-meteor')); beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) { $meteorSession = _$meteorSession_; $rootScope = _$rootScope_; $scope = $rootScope.$new(); })); it('should update the scope variable when session variable changes', function () { Session.set('myVar', 3); $meteorSession('myVar').bind($scope, 'myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.myVar).toEqual(4); }); it('should update the session variable when the scope variable changes', function() { $scope.myVar = 3; $meteorSession('myVar').bind($scope, 'myVar'); $scope.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); it('should update the scope variable nested property when session variable changes', function () { Session.set('myVar', 3); $scope.a ={ b:{ myVar: 3 } }; $meteorSession('myVar').bind($scope, 'a.b.myVar'); Session.set('myVar', 4); Tracker.flush(); // get the computations to run expect($scope.a.b.myVar).toEqual(4); }); it('should update the session variable when the scope variable nested property changes', function() { $scope.a ={ b:{ myVar: 3 } }; $meteorSession('myVar').bind($scope, 'a.b.myVar'); $scope.a.b.myVar = 4; $rootScope.$apply(); expect(Session.get('myVar')).toEqual(4); }); });
Add test for $meteorSession service to support scope variable nested property
Add test for $meteorSession service to support scope variable nested property
JavaScript
mit
IgorMinar/angular-meteor,omer72/angular-meteor,IgorMinar/angular-meteor,zhoulvming/angular-meteor,dszczyt/angular-meteor,craigmcdonald/angular-meteor,divramod/angular-meteor,aleksander351/angular-meteor,thomkaufmann/angular-meteor,Urigo/angular-meteor,Unavi/angular-meteor,manhtuongbkhn/angular-meteor,dszczyt/angular-meteor,michelalbers/angular-meteor,dj0nes/angular-meteor,kamilkisiela/angular-meteor,kyroskoh/angular-meteor,DAB0mB/angular-meteor,pbastowski/angular-meteor,aleksander351/angular-meteor,ccortezia/angular-meteor,idanwe/angular-meteor,efosao12/angular-meteor,gonengar/angular-meteor,dszczyt/angular-meteor,DAB0mB/angular-meteor,okland/angular-meteor,kyroskoh/angular-meteor,Wanderfalke/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,DAB0mB/angular-meteor,ccortezia/angular-meteor,okland/angular-meteor,mauricionr/angular-meteor,michelalbers/angular-meteor,dszczyt/angular-meteor,Tallyb/angular-meteor,omer72/angular-meteor,klenis/angular-meteor,barbatus/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,pbastowski/angular-meteor,barbatus/angular-meteor,ahmedshuhel/angular-meteor,thomkaufmann/angular-meteor,okland/angular-meteor,omer72/angular-meteor,MarkPhillips7/angular-meteor,simonv3/angular-meteor,divramod/angular-meteor,gonengar/angular-meteor,Unavi/angular-meteor,sebakerckhof/angular-meteor,michelalbers/angular-meteor,cuitianze/angular-meteor,ShMcK/angular-meteor,tgienger/angular-meteor,kyroskoh/angular-meteor,ahmedshuhel/angular-meteor,zhoulvming/angular-meteor,tgienger/angular-meteor,evanliomain/angular-meteor,alexandr2110pro/angular-meteor,nhducit/angular-meteor,efosao12/angular-meteor,ajbarry/angular-meteor,Unavi/angular-meteor,ahmedshuhel/angular-meteor,davidyaha/angular-meteor,mauricionr/angular-meteor,cuitianze/angular-meteor,dtruel/angular-meteor,idanwe/angular-meteor,evanliomain/angular-meteor,manhtuongbkhn/angular-meteor,gonengar/angular-meteor,gonengar/angular-meteor,efosao12/angular-meteor,mauricionr/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,zhoulvming/angular-meteor,IgorMinar/angular-meteor,klenis/angular-meteor,dj0nes/angular-meteor,evanliomain/angular-meteor,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,jonmc12/angular-meteor,alexandr2110pro/angular-meteor,ShMcK/angular-meteor,ahmedshuhel/angular-meteor,revspringjake/angular-meteor-tutorial,ajbarry/angular-meteor,craigmcdonald/angular-meteor,Urigo/angular-meteor-legacy,efosao12/angular-meteor,pbastowski/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,jonmc12/angular-meteor,Wanderfalke/angular-meteor,sebakerckhof/angular-meteor,zhoulvming/angular-meteor,kyroskoh/angular-meteor,evanliomain/angular-meteor,Wanderfalke/angular-meteor,revspringjake/angular-meteor-tutorial,nhducit/angular-meteor,michelalbers/angular-meteor,kamilkisiela/angular-meteor,divramod/angular-meteor,jonmc12/angular-meteor,barbatus/angular-meteor,dtruel/angular-meteor,mauricionr/angular-meteor,sebakerckhof/angular-meteor,okland/angular-meteor,kamilkisiela/angular-meteor,omer72/angular-meteor,simonv3/angular-meteor,mushkab/angular-meteor,mushkab/angular-meteor,Tallyb/angular-meteor,nhducit/angular-meteor,aleksander351/angular-meteor,tgienger/angular-meteor,tgienger/angular-meteor,pbastowski/angular-meteor,jonmc12/angular-meteor,Unavi/angular-meteor,dtruel/angular-meteor,alexandr2110pro/angular-meteor,mushkab/angular-meteor,darkbasic/angular-meteor,klenis/angular-meteor,divramod/angular-meteor,mushkab/angular-meteor,dj0nes/angular-meteor,alexandr2110pro/angular-meteor,dj0nes/angular-meteor,ajbarry/angular-meteor,nhducit/angular-meteor,thomkaufmann/angular-meteor,dtruel/angular-meteor,Wanderfalke/angular-meteor,klenis/angular-meteor,IgorMinar/angular-meteor,aleksander351/angular-meteor,ajbarry/angular-meteor,thomkaufmann/angular-meteor,MarkPhillips7/angular-meteor
67567c4809789b1896b470c621085125450cf845
src/renderer/ui/components/generic/PlatformSpecific.js
src/renderer/ui/components/generic/PlatformSpecific.js
import { Component, PropTypes } from 'react'; import os from 'os'; import semver from 'semver'; export const semverValidator = (props, propName, componentName) => { if (props[propName]) { return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`); } return null; }; export default class PlatformSpecific extends Component { static propTypes = { children: PropTypes.object, platform: PropTypes.string.isRequired, versionRange: semverValidator, }; render() { if (process.platform === this.props.platform) { if (!this.props.versionRange) return this.props.children; if (semver.validRange(this.props.versionRange) && semver.satisfies(os.release(), this.props.versionRange)) { return this.props.children; } } return null; } }
import { Component, PropTypes } from 'react'; import os from 'os'; import semver from 'semver'; const parsedOSVersion = semver.parse(os.release()); const osVersion = `${parsedOSVersion.major}.${parsedOSVersion.minor}.${parsedOSVersion.patch}`; export const semverValidator = (props, propName, componentName) => { if (props[propName]) { return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`); } return null; }; export default class PlatformSpecific extends Component { static propTypes = { children: PropTypes.object, platform: PropTypes.string.isRequired, versionRange: semverValidator, }; render() { if (process.platform === this.props.platform) { if (!this.props.versionRange) return this.props.children; if (semver.validRange(this.props.versionRange) && semver.satisfies(osVersion, this.props.versionRange)) { return this.props.children; } } return null; } }
Fix version tests on linux
Fix version tests on linux
JavaScript
mit
petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-
0aad07073773a20898d950c649a7fa74b22497fc
Emix.Web/ngApp/emixApp.js
Emix.Web/ngApp/emixApp.js
angular.module('emixApp', ['ngRoute', 'emixApp.controllers', 'emixApp.directives', 'emixApp.services', 'mgcrea.ngStrap', 'ngMorris', //'ngGoogleMap' 'pascalprecht.translate' ]) .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/dashboard', { controller: 'dashboard_index', templateUrl: 'ngApp/pages/dashboard/index.html' }) .when('/section', { controller: 'section_index', templateUrl: 'ngApp/pages/section/index.html' }) .otherwise({ redirectTo: '/dashboard' }); }]) .config(['$translateProvider', function ($translateProvider) { $translateProvider.useStaticFilesLoader({ prefix: Emix.Web.translationsFolder, suffix: '.json' }); $translateProvider.preferredLanguage('it_IT'); $translateProvider.storageKey('lang'); $translateProvider.storagePrefix('emix'); // $translateProvider.useLocalStorage(); }]); angular.module('emixApp.services', []); angular.module('emixApp.controllers', []); angular.module('emixApp.directives', []);
angular.module('emixApp', ['ngRoute', 'ngCookies', 'emixApp.controllers', 'emixApp.directives', 'emixApp.services', 'mgcrea.ngStrap', 'ngMorris', 'pascalprecht.translate' ]) .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/dashboard', { controller: 'dashboard_index', templateUrl: 'ngApp/pages/dashboard/index.html' }) .when('/section', { controller: 'section_index', templateUrl: 'ngApp/pages/section/index.html' }) .otherwise({ redirectTo: '/dashboard' }); }]) .config(['$translateProvider', function ($translateProvider) { $translateProvider.useStaticFilesLoader({ prefix: Emix.Web.translationsFolder, suffix: '.json' }); $translateProvider.preferredLanguage('it_IT'); $translateProvider.storageKey('lang'); $translateProvider.storagePrefix('emix'); $translateProvider.useLocalStorage(); }]); angular.module('emixApp.services', []); angular.module('emixApp.controllers', []); angular.module('emixApp.directives', []);
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
JavaScript
mit
sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed
05975f56e6561e789dfb8fedaf4954cc751c787c
src/common.js
src/common.js
function findByIds(items, ids) { return ids .map((id) => { return items.find((item) => item.id === id) }) .filter((item) => item) } function findOneById(items, id) { return items.find((item) => item.id === id) } function findOneByAliases(items, aliases) { if (Array.isArray(aliases)) { return items.find((item) => { let { name, alias } = item return aliases.find((n) => n === name || (alias && alias.includes(n))) }) } return items.find((item) => { return item.name === aliases || (item.alias && item.alias.includes(aliases)) }) } module.exports = { findByIds, findOneById, findOneByAliases, }
function findByIds(items, ids) { return ids .map((id) => { return items.find((item) => item.id === id) }) .filter((item) => item) } function findOneById(items, id) { return items.find((item) => item.id === id) } function findOneByAliases(items, aliases) { if (Array.isArray(aliases)) { return items.find((item) => { let { name, alias } = item return aliases.find((n) => n === name || (alias && alias.includes(n))) }) } return items.find((item) => { return item.name === aliases || (item.alias && item.alias.includes(aliases)) }) } function findOneByName(items, field, name) { if (arguments.length === 2) { return findOneByAliases(items, field) } else if (typeof name === 'string') { return findOneByAliases(items, name) } let result for (let i = 0; i < name.length && items.length; i++) { result = findOneByName(items, name[i]) if (result) { items = findByIds(items, result[field]) } } return result } module.exports = { findByIds, findOneById, findOneByAliases, findOneByName, }
Add findOneByName for usage with nested names
Add findOneByName for usage with nested names
JavaScript
isc
alex-shnayder/comanche
10c8e31cfd598b8f736ba7cdc9d280b607b30042
src/config.js
src/config.js
import * as FrontendPrefsOptions from './utils/frontend-preferences-options'; const config = { api:{ host: 'http://localhost:3000', sentinel: null // keep always last }, auth: { cookieDomain: 'localhost', tokenPrefix: 'freefeed_', userStorageKey: 'USER_KEY', sentinel: null // keep always last }, captcha: { siteKey: '', sentinel: null // keep always last }, search: { searchEngine: null, sentinel: null // keep always last }, siteDomains: [ // for transform links in the posts, comments, etc. 'freefeed.net', 'gamma.freefeed.net' ], sentry: { publicDSN: null, sentinel: null // keep always last }, frontendPreferences: { clientId: 'net.freefeed', defaultValues: { displayNames: { displayOption: FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME, useYou: true }, realtimeActive: false, comments: { omitRepeatedBubbles: true, highlightComments: true, hiddenTypes: [] }, allowLinksPreview: false, readMoreStyle: 'modern', homefeed: { hideUsers: [] } } } }; export default config;
import * as FrontendPrefsOptions from './utils/frontend-preferences-options'; const config = { api:{ host: 'http://localhost:3000', sentinel: null // keep always last }, auth: { cookieDomain: 'localhost', tokenPrefix: 'freefeed_', userStorageKey: 'USER_KEY', sentinel: null // keep always last }, captcha: { siteKey: '', sentinel: null // keep always last }, search: { searchEngine: null, sentinel: null // keep always last }, siteDomains: [ // for transform links in the posts, comments, etc. 'freefeed.net', 'gamma.freefeed.net' ], sentry: { publicDSN: null, sentinel: null // keep always last }, frontendPreferences: { clientId: 'net.freefeed', defaultValues: { displayNames: { displayOption: FrontendPrefsOptions.DISPLAYNAMES_BOTH, useYou: true }, realtimeActive: false, comments: { omitRepeatedBubbles: true, highlightComments: true, hiddenTypes: [] }, allowLinksPreview: false, readMoreStyle: 'modern', homefeed: { hideUsers: [] } } } }; export default config;
Change default value of displayname setting
Change default value of displayname setting New default is: "Display name + username"
JavaScript
mit
davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client
6d22dabca3b69a06fb8f3fdc11469b6da7641bfd
src/config.js
src/config.js
// = Server config ============================================================= export const port = 3000 export const enableGraphiQL = true; export const logFile = 'store.log' // = App config ================================================================
// = Server config ============================================================= export const port = process.env.PORT || 3000 export const enableGraphiQL = true; export const logFile = 'store.log' // = App config ================================================================
Add ability to define port as environment variable
Add ability to define port as environment variable
JavaScript
mit
jukkah/comicstor
30f2923409e548ccc4626278509ae158bae6d5e0
web_clients/javascript_mvc/www/js/test/test-main.js
web_clients/javascript_mvc/www/js/test/test-main.js
var allTestFiles = []; var TEST_REGEXP = /_test\.js$/i; var pathToModule = function(path) { return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); }; Object.keys(window.__karma__.files).forEach(function(file) { if (TEST_REGEXP.test(file)) { // Normalize paths to RequireJS module names. allTestFiles.push(pathToModule(file)); } }); require.config({ baseUrl: '/base/js/vendor', paths: { jquery: 'jquery/jquery-2.1.1.min', squire: 'squire/Squire', client: '../client' } }); // Kick off Jasmine // NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. require( allTestFiles, window.__karma__.start );
(function() { 'use strict'; var test_files, coverage_files; function pathToModule(path) { return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, ''); }; // Configure require's paths require.config({ baseUrl: '/base/js/vendor', paths: { jquery: 'jquery/jquery-2.1.1.min', squire: 'squire/Squire', client: '../client' } }); // Ensure all client files are included for code coverage coverage_files = []; Object.keys(window.__karma__.files).forEach(function(file) { var regex; // Only pick up client files regex = /^\/base\/js\/client\//; if( !regex.test(file) ) { return; } // Don't pick up main.js - we only want the modules, not to actually start anything up. if( file === '/base/js/client/main.js' ) { return; } // Convert to a require path coverage_files.push(pathToModule(file)); }); // Actually get coverage to see the files require(coverage_files, function() {}); // Find all test files to run in Jasmine test_files = []; Object.keys(window.__karma__.files).forEach(function(file) { var regex; regex = /_test\.js$/i; if (regex.test(file)) { // Normalize paths to RequireJS module names. test_files.push(pathToModule(file)); } }); // Kick off Jasmine // NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times. require( test_files, window.__karma__.start ); })();
Include all client files for coverage reporting
Include all client files for coverage reporting Also: clean up test-main a bit from its original copypasta.
JavaScript
mit
xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz
84e2ef62b1faff132d69ad3384be68fb364d86c9
src/string.js
src/string.js
// ================================================================================================= // Core.js | String Functions // (c) 2014 Mathigon / Philipp Legner // ================================================================================================= (function() { M.extend(String.prototype, { endsWith: function(search) { var end = this.length; var start = end - search.length; return (this.substring(start, end) === search); }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, collapse: function() { return this.trim().replace(/\s+/g, ' '); }, toTitleCase: function() { return this.replace(/\S+/g, function(a){ return a.charAt(0).toUpperCase() + a.slice(1); }); }, words: function() { return this.strip().split(/\s+/); } }, true); if ( !String.prototype.contains ) { M.extend(String.prototype, { contains: function() { return String.prototype.indexOf.apply( this, arguments ) !== -1; } }, true); } })();
// ================================================================================================= // Core.js | String Functions // (c) 2014 Mathigon / Philipp Legner // ================================================================================================= (function() { M.extend(String.prototype, { strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, collapse: function() { return this.trim().replace(/\s+/g, ' '); }, toTitleCase: function() { return this.replace(/\S+/g, function(a){ return a.charAt(0).toUpperCase() + a.slice(1); }); }, words: function() { return this.strip().split(/\s+/); } }, true); if (!String.prototype.endsWith) { M.extend(String.prototype, { endsWith: function(search) { var end = this.length; var start = end - search.length; return (this.substring(start, end) === search); } }, true); } if (!String.prototype.contains) { M.extend(String.prototype, { contains: function() { return String.prototype.indexOf.apply( this, arguments ) !== -1; } }, true); } })();
Fix String endsWith prototype shadowing
Fix String endsWith prototype shadowing
JavaScript
mit
Mathigon/core.js
a8d74088d41f2bb83336dc242d512193e743385a
components/home/events.js
components/home/events.js
import React from 'react' import PropTypes from 'prop-types' import Link from 'next/link' import { translate } from 'react-i18next' import Section from './section' const Events = ({ t }) => ( <Section title={t('eventsSectionTitle')}> <Link href='/events'> <a>{t('eventsLink')}</a> </Link> <style jsx>{` @import 'colors'; a { color: $darkgrey; display: block; margin-top: 1em; &:focus, &:hover { color: $black; } } `}</style> </Section> ) Events.propTypes = { t: PropTypes.func.isRequired } export default translate('home')(Events)
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import Link from '../link' import Section from './section' const Events = ({ t }) => ( <Section title={t('eventsSectionTitle')}> <Link href='/events'> <a>{t('eventsLink')}</a> </Link> <style jsx>{` @import 'colors'; a { color: $darkgrey; display: block; margin-top: 1em; &:focus, &:hover { color: $black; } } `}</style> </Section> ) Events.propTypes = { t: PropTypes.func.isRequired } export default translate('home')(Events)
Fix link to event page
Fix link to event page
JavaScript
mit
sgmap/inspire,sgmap/inspire
cf4e0ba45bb8da2f44ea3eccee25f38b69479f45
controllers/submission.js
controllers/submission.js
const Submission = require('../models/Submission'); const moment = require('moment'); /** * GET /submissions */ exports.getSubmissions = (req, res) => { const page = parseInt(req.query && req.query.page) || 0; Submission .find() .sort({ _id: -1 }) .populate('user') .populate('language') .skip(500 * page) .limit(500) .exec((err, submissions) => { res.render('submissions', { title: 'Submissions', submissions, moment, }); }); }; /** * GET /submissions/:submission */ exports.getSubmission = (req, res) => { const _id = req.params.submission; Submission .findOne({ _id }) .populate('user') .populate('language') .exec() .then((submission) => { if (submission === null) { return res.sendStatus(404); } res.render('submission', { title: 'Submission', submission, selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team, }); }); };
const Submission = require('../models/Submission'); const User = require('../models/User'); const moment = require('moment'); const Promise = require('bluebird'); /** * GET /submissions */ exports.getSubmissions = (req, res) => { Promise.try(() => { if (req.query.author) { return User.findOne({ email: `${req.query.author}@twitter.com` }); } return null; }).then((author) => { const page = parseInt(req.query && req.query.page) || 0; const query = {}; if (author) { query.user = author._id; } if (req.query.status) { query.status = req.query.status; } return Submission.find(query) .sort({ _id: -1 }) .populate('user') .populate('language') .skip(500 * page) .limit(500) .exec(); }).then((submissions) => { res.render('submissions', { title: 'Submissions', submissions, moment, }); }); }; /** * GET /submissions/:submission */ exports.getSubmission = (req, res) => { const _id = req.params.submission; Submission .findOne({ _id }) .populate('user') .populate('language') .exec() .then((submission) => { if (submission === null) { return res.sendStatus(404); } res.render('submission', { title: 'Submission', submission, selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team, }); }); };
Add author and status parameter
Add author and status parameter
JavaScript
mit
hakatashi/esolang-battle,hakatashi/esolang-battle,hakatashi/esolang-battle
221ed0e89bf69a169d1110788e0be3e2d10c49f0
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
'use strict'; /** * Allocate a buffer using an octet array. * * @module @stdlib/buffer/from-array * * @example * var array2buffer = require( '@stdlib/type/buffer/from-array' ); * * var buf = array2buffer( [ 1, 2, 3, 4 ] ); * // returns <Buffer> */ // MODULES // var hasFrom = require( './has_from.js' ); // MAIN // var array2buffer; if ( hasFrom ) { array2buffer = require( './main.js' ); } else { array2buffer = require( './polyfill.js' ); } // EXPORTS // module.exports = array2buffer;
'use strict'; /** * Allocate a buffer using an octet array. * * @module @stdlib/buffer/from-array * * @example * var array2buffer = require( '@stdlib/type/buffer/from-array' ); * * var buf = array2buffer( [ 1, 2, 3, 4 ] ); * // returns <Buffer> */ // MODULES // var hasFrom = require( './has_from.js' ); var main = require( './main.js' ); var polyfill = require( './polyfill.js' ); // MAIN // var array2buffer; if ( hasFrom ) { array2buffer = main; } else { array2buffer = polyfill; } // EXPORTS // module.exports = array2buffer;
Refactor to avoid dynamic module resolution
Refactor to avoid dynamic module resolution
JavaScript
apache-2.0
stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib
3ac7f2a8044ad8febe16541e9b3683cf00fd1ae0
components/search/result/thumbnail.js
components/search/result/thumbnail.js
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import { GEODATA_API_URL } from '@env' const Thumbnail = ({ recordId, thumbnails, t }) => { const hasThumbnail = thumbnails && thumbnails.length > 0 const thumbnail = hasThumbnail ? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}` : '/static/images/datasets/default-thumbnail.svg' return ( <div> <img src={thumbnail} alt='' /> <style jsx>{` div { display: flex; justify-content: center; align-items: center; flex-shrink: 0; overflow: hidden; height: 180px; width: 180px; @media (max-width: 767px) { width: 100%; ${!hasThumbnail && (` display: none; `)} } } img { display: flex; height: 100%; @media (max-width: 767px) { max-width: 100%; height: auto; margin: auto; } } `}</style> </div> ) } Thumbnail.propTypes = { thumbnails: PropTypes.arrayOf(PropTypes.shape({ originalUrlHash: PropTypes.isRequired })), recordId: PropTypes.string.isRequired, t: PropTypes.func.isRequired } export default translate('search')(Thumbnail)
import React from 'react' import PropTypes from 'prop-types' import { translate } from 'react-i18next' import { GEODATA_API_URL } from '@env' const Thumbnail = ({ recordId, thumbnails, t }) => { const hasThumbnail = thumbnails && thumbnails.length > 0 const thumbnail = hasThumbnail ? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}` : '/static/images/datasets/default-thumbnail.svg' return ( <div> <img src={thumbnail} alt='' /> <style jsx>{` div { display: flex; justify-content: center; align-items: center; flex-shrink: 0; overflow: hidden; height: 180px; width: 180px; @media (max-width: 767px) { width: 100%; ${!hasThumbnail && (` display: none; `)} } } img { display: flex; max-height: 100%; @media (max-width: 767px) { max-width: 100%; max-height: none; height: auto; margin: auto; } } `}</style> </div> ) } Thumbnail.propTypes = { thumbnails: PropTypes.arrayOf(PropTypes.shape({ originalUrlHash: PropTypes.isRequired })), recordId: PropTypes.string.isRequired, t: PropTypes.func.isRequired } export default translate('search')(Thumbnail)
Fix search result image sizes
Fix search result image sizes
JavaScript
mit
sgmap/inspire,sgmap/inspire
5591b4615ec9e88f448ad2a9f777c85e659bd0a0
server/helpers/helpers.js
server/helpers/helpers.js
const handleError = (err, res) => { switch (err.code) { case 401: return res.status(401).send(err.message); case 404: return res.status(404).send(err.message); default: return res.status(400).send(err); } }; const handleSuccess = (code, body, res) => { switch (code) { case 201: return res.status(201).send(body); default: return res.status(200).send(body); } }; module.exports = { handleError, handleSuccess };
const handleError = (err, res) => { switch (err.code) { case 401: return res.status(401).json(err.message); case 404: return res.status(404).json(err.message); default: return res.status(400).json(err); } }; const handleSuccess = (code, body, res) => { switch (code) { case 201: return res.status(201).json(body); default: return res.status(200).json(body); } }; module.exports = { handleError, handleSuccess };
Refactor the helper methods to use json method instead of send method
Refactor the helper methods to use json method instead of send method
JavaScript
mit
johadi10/PostIt,johadi10/PostIt
c6335c604a1495d2526f6f395e429e065f9317af
test/endpoints/account.js
test/endpoints/account.js
'use strict'; var assert = require('assert'); var sinon = require('sinon'); var Account = require('../../lib/endpoints/account'); var Request = require('../../lib/request'); describe('endpoints/account', function () { describe('changePassword', function () { it('should set the request URL', function () { var request = new Request(); var account; var stub; stub = sinon.stub(request, 'post', function (url) { assert.strictEqual(url, '/account/changepassword'); }); account = new Account(request); account.changePassword(); assert.ok(stub.called); }); it('should set the request body', function () { var request = new Request(); var account; var stub; var expected = { password: 'password', }; stub = sinon.stub(request, 'post', function (url, data) { assert.deepEqual(data, expected); }); account = new Account(request); account.changePassword(expected); assert.ok(stub.called); }); }); describe('info', function () { it('should set the request URL', function () { var request = new Request(); var account; var stub; stub = sinon.stub(request, 'get', function (url) { assert.strictEqual(url, '/account/info'); }); account = new Account(request); account.info(); assert.ok(stub.called); }); }); });
'use strict'; const assert = require('assert'); const sinon = require('sinon'); const Account = require('../../lib/endpoints/account'); const Request = require('../../lib/request'); describe('endpoints/account', () => { describe('changePassword', () => { it('should set the request URL', () => { const request = new Request(); const account = new Account(request); const stub = sinon.stub(request, 'post', (url) => { assert.strictEqual(url, '/account/changepassword'); }); account.changePassword(); assert.ok(stub.called); }); it('should set the request body', () => { const request = new Request(); const account = new Account(request); const expected = { password: 'password', }; const stub = sinon.stub(request, 'post', (url, data) => { assert.deepEqual(data, expected); }); account.changePassword(expected); assert.ok(stub.called); }); }); describe('info', () => { it('should set the request URL', () => { const request = new Request(); const account = new Account(request); const stub = sinon.stub(request, 'get', (url) => { assert.strictEqual(url, '/account/info'); }); account.info(); assert.ok(stub.called); }); }); });
Rewrite Account tests to ES2015
Rewrite Account tests to ES2015
JavaScript
mit
jwilsson/glesys-api-node
a151d88b94ee726f0450b93df5ede04124a81ded
packages/rendering/addon/-private/meta-for-field.js
packages/rendering/addon/-private/meta-for-field.js
export default function metaForField(content, fieldName) { if (!content) { return; } try { return content.constructor.metaForProperty(fieldName); } catch (err) { return; } }
import { camelize } from "@ember/string"; export default function metaForField(content, fieldName) { if (!content) { return; } fieldName = camelize(fieldName); try { return content.constructor.metaForProperty(fieldName); } catch (err) { return; } }
Fix field editors not appearing for field names that contain dashes
Fix field editors not appearing for field names that contain dashes
JavaScript
mit
cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack
8c8c3ef0efabbcf07ead714b3fb79f1f7ed81a41
test/spec/test_captcha.js
test/spec/test_captcha.js
defaultConf = { height: 100, width: 300, fingerprintLength: 20 }; describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); var captcha = new Captcha(); it("Captcha object is not null", function(){ expect(captcha).not.toBeNull(); }); it('captcha object should be an instance of Captcha class', function(){ expect(captcha instanceof Captcha).toBeTruthy(); }); it('the height of the svg should be set to the configured height', function(){ expect(Number(captcha.height)).toEqual(defaultConf.height); }); it('the width of the svg should be set to the configured width', function(){ expect(Number(captcha.width)).toEqual(defaultConf.width); }); });
defaultConf = { height: 100, width: 300, fingerprintLength: 20 }; describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); var captcha = new Captcha(); it("Captcha object is not null", function(){ expect(captcha).not.toBeNull(); }); it('captcha object should be an instance of Captcha class', function(){ expect(captcha instanceof Captcha).toBeTruthy(); }); it('the height of the svg should be set to the configured height', function(){ expect(Number(captcha.height)).toEqual(defaultConf.height); }); it('the width of the svg should be set to the configured width', function(){ expect(Number(captcha.width)).toEqual(defaultConf.width); }); it('the length of the fingerprint should be set to the configured fingerprintLength', function(){ expect(Number(captcha.fingerprintLength)).toEqual(defaultConf.fingerprintLength); }); });
Add one more test and it fails
Add one more test and it fails
JavaScript
mit
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
02ee190d7383336953c7dde6d3e4f50285a7d113
src/interface/common/Ad.js
src/interface/common/Ad.js
import React from 'react'; import PropTypes from 'prop-types'; class Ad extends React.PureComponent { static propTypes = { style: PropTypes.object, }; componentDidMount() { (window.adsbygoogle = window.adsbygoogle || []).push({}); } render() { const { style, ...others } = this.props; const props = {}; if (!others['data-ad-slot']) { // Default to responsive props['data-ad-slot'] = '5976455458'; props['data-ad-format'] = 'auto'; props['data-full-width-responsive'] = 'true'; } return ( <ins className="adsbygoogle" style={style ? { display: 'block', ...style } : { display: 'block' }} data-ad-client="ca-pub-8048055232081854" {...props} {...others} /> ); } } export default Ad;
import React from 'react'; import PropTypes from 'prop-types'; class Ad extends React.PureComponent { static propTypes = { style: PropTypes.object, }; componentDidMount() { try { (window.adsbygoogle = window.adsbygoogle || []).push({}); } catch (err) { // "adsbygoogle.push() error: No slot size for availableWidth=0" error that I can't explain console.error(err); } } render() { const { style, ...others } = this.props; const props = {}; if (!others['data-ad-slot']) { // Default to responsive props['data-ad-slot'] = '5976455458'; props['data-ad-format'] = 'auto'; props['data-full-width-responsive'] = 'true'; } return ( <ins className="adsbygoogle" style={style ? { display: 'block', ...style } : { display: 'block' }} data-ad-client="ca-pub-8048055232081854" {...props} {...others} /> ); } } export default Ad;
Fix crash caused by google adsense
Fix crash caused by google adsense
JavaScript
agpl-3.0
WoWAnalyzer/WoWAnalyzer,anom0ly/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,fyruna/WoWAnalyzer,fyruna/WoWAnalyzer,ronaldpereira/WoWAnalyzer,anom0ly/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer,ronaldpereira/WoWAnalyzer,yajinni/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,Juko8/WoWAnalyzer,ronaldpereira/WoWAnalyzer,sMteX/WoWAnalyzer,fyruna/WoWAnalyzer,yajinni/WoWAnalyzer,sMteX/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,Juko8/WoWAnalyzer
a96f3a13dc3a80d18ca7bc2fec5268c453c24533
src/react-chayns-personfinder/utils/normalizeOutput.js
src/react-chayns-personfinder/utils/normalizeOutput.js
export default function normalizeOutput(type, value) { return { type, name: value.name, firstName: value.firstName, lastName: value.lastName, personId: value.personId, userId: value.userId, siteId: value.siteId, locationId: value.locationId, isFriend: value.isFriend, }; }
import { FRIEND_RELATION, LOCATION_RELATION, PERSON_RELATION, PERSON_UNRELATED, } from '../constants/relationTypes'; export default function normalizeOutput(type, value) { const newType = (type === PERSON_RELATION || type === PERSON_UNRELATED || type === FRIEND_RELATION) ? PERSON_RELATION : LOCATION_RELATION; return { type: newType, name: value.name, firstName: value.firstName, lastName: value.lastName, personId: value.personId, userId: value.userId, siteId: value.siteId, locationId: value.locationId, isFriend: value.isFriend, }; }
Add normalization of type to prevent wrong types
:bug: Add normalization of type to prevent wrong types
JavaScript
mit
TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components
046b77894ef1df26a411ae2ca808936d920632c9
to.etc.domui/src/resources/themes/domui/style.props.js
to.etc.domui/src/resources/themes/domui/style.props.js
/* * "domui" stylesheet properties. */ font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; font_size="11px"; hdr_font_size="14px"; fixed_font_family='Courier New, Courier, monospace'; fixed_font_size="11px"; defaultbutton_height=23; window_title_font_size='15px';
/* * "blue" stylesheet properties. */ font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; //font_family='Verdana, Tahoma, helvetica, sans-serif'; font_size="11px"; hdr_font_size="14px"; fixed_font_family='Courier New, Courier, monospace'; fixed_font_size="11px"; //special_font = "Verdana, Tahoma, helvetica, sans-serif"; special_font = "Arial, Helvetica, sans-serif"; //special_font = "Biolinum2, Courier, serif"; special_font_size = "13px"; button_font_family='Verdana, Geneva, "DejaVu Sans", sans-serif'; button_font_size="11px"; defaultbutton_height=23; window_title_font_size='15px';
Make both style properties equal
Make both style properties equal
JavaScript
lgpl-2.1
fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui,fjalvingh/domui
f5484310a9e52d1c7786d111486882dd94959a98
src/website/app/demos/Flex/components/Flex.js
src/website/app/demos/Flex/components/Flex.js
/* @flow */ import { createStyledComponent, pxToEm } from '../../../../../library/styles'; import _Flex from '../../../../../library/Flex'; type Props = { gutterWidth?: number | string, theme: Object }; export const containerStyles = ({ gutterWidth: propGutterSize, theme }: Props) => { const gutterWidth = propGutterSize === undefined ? 'md' : propGutterSize; const gutter = typeof gutterWidth === 'number' ? pxToEm(gutterWidth / 2) : `${parseFloat(theme[`space_inline_${gutterWidth}`] || gutterWidth) / 2}em`; const offset = gutterWidth ? `calc(${gutter} - 4px)` : -4; return { position: 'relative', '&::before': { border: `1px dotted ${theme.color_theme_30}`, bottom: -4, content: '""', left: offset, position: 'absolute', right: offset, top: -4, zIndex: -1 } }; }; export default createStyledComponent(_Flex, (props) => ({ ...containerStyles(props) }));
/* @flow */ import { createStyledComponent, pxToEm } from '../../../../../library/styles'; import _Flex from '../../../../../library/Flex'; type Props = { gutterWidth?: number | string, theme: Object }; export const containerStyles = ({ gutterWidth: propGutterSize, theme }: Props) => { const gutterWidth = propGutterSize === undefined ? 'md' : propGutterSize; const gutter = typeof gutterWidth === 'number' ? pxToEm(gutterWidth / 2) : `${parseFloat(theme[`space_inline_${gutterWidth}`] || gutterWidth) / 2}em`; const offset = gutterWidth ? `calc(${gutter} - 4px)` : -4; return { position: 'relative', zIndex: 1, '&::before': { border: `1px dotted ${theme.color_theme_30}`, bottom: -4, content: '""', left: offset, position: 'absolute', right: offset, top: -4, zIndex: -1 } }; }; export default createStyledComponent(_Flex, (props) => ({ ...containerStyles(props) }));
Fix display issue with Layout examples
chore(website): Fix display issue with Layout examples
JavaScript
apache-2.0
mineral-ui/mineral-ui,mineral-ui/mineral-ui
979bf24a28e95f6975fde020b002426eafe5f3e6
static/js/activity-23andme-complete-import.js
static/js/activity-23andme-complete-import.js
$(function () { var params = {'data_type': '23andme_names'}; $.ajax({ 'type': 'GET', 'url': '/json-data/', 'data': params, 'success': function(data) { if (data.profiles && data.profiles.length > 0) { for (var i = 0; i < data.profiles.length; i++) { var radioElem = $('<input />'); radioElem.attr({'type' : 'radio', 'name' : 'profile_id', 'value' : data.profiles[i].id}); if (data.profiles.length == 1) { radioElem.attr('checked', true); } var labelElem = $('<label></label>'); labelElem.append(radioElem); labelElem.append(data.profiles[i].first_name + ' ' + data.profiles[i].last_name); var divElem = $('<div></div>'); divElem.attr('class', 'radio'); divElem.append(labelElem); $("#23andme-list-profiles").append(divElem); } $("#load-23andme-waiting").hide(); $("#23andme-complete-submit").css('visibility', 'visible'); } } }); });
$(function () { var params = {'data_type': '23andme_names'}; $.ajax({ 'type': 'GET', 'url': '/json-data/', 'data': params, 'success': function(data) { if (data.profiles && data.profiles.length > 0) { for (var i = 0; i < data.profiles.length; i++) { var radioElem = $('<input />'); radioElem.attr({'type' : 'radio', 'name' : 'profile_id', 'value' : data.profiles[i].id}); if (data.profiles.length == 1) { radioElem.attr('checked', true); } var labelElem = $('<label></label>'); labelElem.append(radioElem); labelElem.append(data.profiles[i].first_name + ' ' + data.profiles[i].last_name); var divElem = $('<div></div>'); divElem.attr('class', 'radio'); divElem.append(labelElem); $("#23andme-list-profiles").append(divElem); } $("#load-23andme-waiting").hide(); $("#23andme-complete-submit").css('visibility', 'visible'); } } }); });
Fix JS to use 2-space tabs
Fix JS to use 2-space tabs
JavaScript
mit
PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans
0100ebf9a24675a16ec200caf894af862196589c
d3/js/wgaPipeline.js
d3/js/wgaPipeline.js
/** * Creates an object of type wgaPipeline for drawing whole genome alignment visualizations * @author Markus Ankenbrand <markus.ankenbrand@uni-wuerzburg.de> * @constructor * @param {Object} svg - jQuery object containing a svg DOM element. Visualizations will be drawn on this svg. Size may be changed by object methods. Previous content will be deleted. * @example * // initializes an wgaPipeline object (wga) on the svg element with id 'canvas' * var svg = $('#canvas'); * var wga = new wgaPipeline(svg); */ function WgaPipeline(svg) { this.svg = svg; this.data = {}; }
/** * Creates an object of type wgaPipeline for drawing whole genome alignment visualizations * @author Markus Ankenbrand <markus.ankenbrand@uni-wuerzburg.de> * @constructor * @param {Object} svg - jQuery object containing a svg DOM element. Visualizations will be drawn on this svg. Size may be changed by object methods. Previous content will be deleted. * @example * // initializes an wgaPipeline object (wga) on the svg element with id 'canvas' * var svg = $('#canvas'); * var wga = new wgaPipeline(svg); */ function WgaPipeline(svg) { this.svg = svg; this.data = {}; } WgaPipeline.prototype.setData = function() { };
Test for existence of setData method passes
Test for existence of setData method passes
JavaScript
mit
BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,AliTVTeam/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,BioInf-Wuerzburg/AliTV,AliTVTeam/AliTV
c74647dae08d8d5f55a3d68de956a37b1fccec0e
assets/main.js
assets/main.js
function do_command(item, command, val) { var data = {}; data[item] = command; if (val != undefined) { data["value"] = val; } $.get("/CMD", data); } function do_scene(scene, action) { $.get("/api/scene/" + scene + "/command/" + (action?action:"")); } $(function() { $(".command").each(function() { var elm = $(this); elm.on(elm.data("event"), function() { if (elm.data("use-val") == "true") { do_command(elm.data("item"), elm.data("command"), elm.val()); } else { do_command(elm.data("item"), elm.data("command")); } }); }); $(".scene-control").each(function() { var elm = $(this); elm.click(function(evt) { do_scene(elm.data("scene"), elm.data("action")); }); }); });
function do_command(item, command, val) { var data = {}; if (val != undefined) { data["val"] = val; } $.get("/api/item/" + item + "/command/" + command, data); } function do_scene(scene, action) { $.get("/api/scene/" + scene + "/command/" + (action?action:"")); } $(function() { $(".command").each(function() { var elm = $(this); elm.on(elm.data("event"), function() { if (elm.data("use-val")) { do_command(elm.data("item"), elm.data("command"), elm.val()); } else { do_command(elm.data("item"), elm.data("command")); } }); }); $(".scene-control").each(function() { var elm = $(this); elm.click(function(evt) { do_scene(elm.data("scene"), elm.data("action")); }); }); });
Update javascript to use native API
Update javascript to use native API
JavaScript
mit
idiotic/idiotic-webui,idiotic/idiotic-webui,idiotic/idiotic-webui
3bc142f44ebd589227eec3660c72640fdfa7a238
bl/pipeline.js
bl/pipeline.js
var TaskScheduler = require("./task").TaskScheduler; var colors = require("colors"); exports.execute = function(initialStep, context, cb) { var completedSteps = 0; var estimatedSteps = initialStep.remaining; var scheduler = new TaskScheduler({ maxConcurrency: 5, mode: "lifo" }, cb); scheduler.schedule(execute_step, initialStep.weight, initialStep.name, [initialStep, null]); function execute_step(step, item, cb) { step.handler(item, step.args, context, step_complete); function step_complete(err, items) { ++completedSteps; if(step.next) { if(err == null) { if(items == null) { items = []; } else if(items.length == undefined) { items = [items]; } estimatedSteps += (items.length - 1) * step.next.remaining; } else { estimatedSteps -= step.next.remaining; } } console.log("Completed %d steps of %d".green, completedSteps, estimatedSteps); if(step.next && err == null) { items.forEach(function(i) { scheduler.schedule(execute_step, step.next.weight, step.next.name, [step.next, i]); }); } cb(err); } } }
var TaskScheduler = require("./task").TaskScheduler; var colors = require("colors"); exports.execute = function(initialStep, context, cb) { var completedSteps = 0; var estimatedSteps = initialStep.remaining; var scheduler = new TaskScheduler({ maxConcurrency: 5, mode: "lifo" }, cb); scheduler.schedule(execute_step, initialStep.weight, initialStep.name, [initialStep, null]); function execute_step(step, item, cb) { step.handler(item, step.args, context, step_complete); function step_complete(err, items) { ++completedSteps; if(step.next) { if(err == null) { if(items == null) { items = []; } else if(items.length == undefined) { items = [items]; } estimatedSteps += (items.length - 1) * step.next.remaining; } else { estimatedSteps -= step.next.remaining; } } console.log("%s Completed %d steps of %d".green, new Date(), completedSteps, estimatedSteps); if(step.next && err == null) { items.forEach(function(i) { scheduler.schedule(execute_step, step.next.weight, step.next.name, [step.next, i]); }); } cb(err); } } }
Add current date to polling log messages.
Add current date to polling log messages.
JavaScript
mit
aaubry/feed-reader,aaubry/feed-reader
56e784e7e966ccff9ba29b658ebd31406a868987
lib/paymaya/core/HttpConnection.js
lib/paymaya/core/HttpConnection.js
module.exports = HttpConnection; var request = require('requestretry'); var HttpConfig = require("./HttpConfig"); var PaymayaApiError = require("./PaymayaApiError"); function HttpConnection(httpConfig) { this._httpConfig = httpConfig; }; HttpConnection.prototype = { /* PUBLIC FUNCTIONS */ execute: function(data, callback) { var httpOptions = { url: this._httpConfig.getUrl(), method: this._httpConfig.getMethod(), headers: this._httpConfig.getHeaders(), maxAttempts: this._httpConfig.getMaximumRequestAttempt() }; if(data) { httpOptions['body'] = JSON.stringify(data); } request(httpOptions, function(err, response, body) { if(err) { return callback(err); } if(!body && response.statusCode >= 400) { var err = new PaymayaApiError(response.statusCode); return callback(err); } if(typeof body != 'object') { body = JSON.parse(body); } if(body.error) { var err = new PaymayaApiError(response.statusCode, body.error); return callback(err.message); } if(body.message) { return callback(body.message); } callback(null, body); }); } };
module.exports = HttpConnection; var request = require('requestretry'); var HttpConfig = require("./HttpConfig"); var PaymayaApiError = require("./PaymayaApiError"); function HttpConnection(httpConfig) { this._httpConfig = httpConfig; }; HttpConnection.prototype = { /* PUBLIC FUNCTIONS */ execute: function(data, callback) { var httpOptions = { url: this._httpConfig.getUrl(), method: this._httpConfig.getMethod(), headers: this._httpConfig.getHeaders(), maxAttempts: this._httpConfig.getMaximumRequestAttempt() }; if(data) { httpOptions['body'] = JSON.stringify(data); } request(httpOptions, function(err, response, body) { if(err) { return callback(err); } if(!body && response.statusCode >= 400) { var err = new PaymayaApiError(response.statusCode); return callback(err); } if(typeof body != 'object') { body = JSON.parse(body); } if(body.error) { var err = new PaymayaApiError(response.statusCode, body.error); return callback(err.message); } if(body.message && response.statusCode != 200) { return callback(body.message); } callback(null, body); }); } };
Modify displaying of error message
Modify displaying of error message
JavaScript
mit
PayMaya/PayMaya-Node-SDK
bb85a90b6941c8f6d20b2cc6e15359d7daf9b461
src/authentication/sessions.js
src/authentication/sessions.js
'use strict'; export default { setup, }; /** * Module dependencies. */ import SequelizeStore from 'koa-generic-session-sequelize'; import session from 'koa-generic-session'; /** * Prepares session middleware and methods without attaching to the stack * * @param {Object} router * @param {Object} settings * @param {Object} database * @param {Object} [store] Store for `koa-generic-sessions`. Uses the database if a store is not provided * @return {Object} */ function setup(router, settings, database, store) { // attach pre-authenticator middleware router.use(function(ctx, next) { // set the secret keys for Keygrip ctx.app.keys = settings.session.keys; // attach session methods ctx.identityDesk = { get(key) { if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { return ctx.session.identityDesk[key]; } else { return undefined; } }, set(values) { ctx.session = ctx.session || { identityDesk: { values } }; ctx.session.identityDesk = ctx.session.identityDesk || { values }; Object.assign(ctx.session.identityDesk, values); }, }; next(); }); // return the session middleware for later use return session({ key: 'identityDesk.sid', store: store || new SequelizeStore(database), }); }
'use strict'; export default { setup, }; /** * Module dependencies. */ import SequelizeStore from 'koa-generic-session-sequelize'; import convert from 'koa-convert'; import session from 'koa-generic-session'; /** * Prepares session middleware and methods without attaching to the stack * * @param {Object} settings * @param {Object} database * @param {Object} [store] Store for `koa-generic-sessions`. Uses the database if a store is not provided * @return {Object} */ function setup(settings, database, store) { return { // session middleware session: convert(session({ key: 'identityDesk.sid', store: store || new SequelizeStore(database), })), sessionMethods: function(ctx, next) { // set the secret keys for Keygrip ctx.app.keys = settings.session.keys; // attach session methods ctx.identityDesk = { get(key) { if (ctx.session && ctx.session.identityDesk && ctx.session.identityDesk[key] !== undefined) { return ctx.session.identityDesk[key]; } else { return undefined; } }, set(values) { ctx.session = ctx.session || { identityDesk: { values } }; ctx.session.identityDesk = ctx.session.identityDesk || { values }; Object.assign(ctx.session.identityDesk, values); }, }; next(); }, }; }
Add missing file from last commit
Add missing file from last commit
JavaScript
mit
HiFaraz/identity-desk
1e2aa246a558447455dba80c4f49e5f9cdbb00c7
test/read-only-parallel.js
test/read-only-parallel.js
const test = require('tape') const BorrowState = require('../lib/module.js') const sleep50ms = require('./sleep.js') const countTo = require('./count-to.js') ;[true, false].forEach((unsafe) => { test(`read-only-parallel (${unsafe ? 'un' : ''}safe)`, (t) => { t.plan(3) t.timeoutAfter(100) let myState = new BorrowState() countTo(3).forEach(() => { myState.block('r') .then(sleep50ms) .then((state) => { t.ok(true) state.unblock() }) }) }) })
const test = require('tape') const BorrowState = require('../lib/module.js') const sleep50ms = require('./sleep.js') const countTo = require('./count-to.js') ;[true, false].forEach((unsafe) => { test(`read-only-parallel (${unsafe ? 'un' : ''}safe)`, (t) => { t.plan(6) t.timeoutAfter(100) let myState = new BorrowState() countTo(3).forEach(() => { t.ok(true) myState.block('r') .then(sleep50ms) .then((state) => { t.ok(true) state.unblock() }) }) }) })
Make sure to count up test additions
Make sure to count up test additions
JavaScript
isc
jamescostian/borrow-state
b948a9b149394932a0d3bf8a957a8792e23510ae
front_end/.eslintrc.js
front_end/.eslintrc.js
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. const path = require('path'); const rulesDirPlugin = require('eslint-plugin-rulesdir'); rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib'); module.exports = { 'overrides': [{ 'files': ['*.ts'], 'rules': { '@typescript-eslint/explicit-function-return-type': 2, 'rulesdir/kebab_case_events': 2, 'rulesdir/set_data_type_reference': 2, 'rulesdir/lit_html_data_as_type': 2, 'rulesdir/lit_no_style_interpolation': 2, } }] };
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. const path = require('path'); const rulesDirPlugin = require('eslint-plugin-rulesdir'); rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib'); module.exports = { 'overrides': [{ 'files': ['*.ts'], 'rules': { '@typescript-eslint/explicit-function-return-type': 2, 'rulesdir/kebab_case_events': 2, 'rulesdir/set_data_type_reference': 2, 'rulesdir/lit_html_data_as_type': 2, 'rulesdir/lit_no_style_interpolation': 2, '@typescript-eslint/naming-convention': [ 'error', { 'selector': 'property', 'modifiers': ['private', 'protected'], 'format': ['camelCase'], }, { 'selector': 'method', 'modifiers': ['private', 'protected'], 'format': ['camelCase'], } ] } }] };
Enforce camelCase for private and protected class members
Enforce camelCase for private and protected class members This encodes some of the TypeScript style guides about identifiers https://google.github.io/styleguide/tsguide.html#identifiers (in particular the rules our codebase already adheres to). The automatic enforcement will save time during code reviews. The current TypeScript migration produces a lot of public class properties and methods with leading underscores, so this CL only enforces the rule for protected and private class members; the rule can be enforced for public variables as well at a later point in time. Bug: chromium:1057042 Change-Id: Ic63b0a9b128f8b560020c015a0f91bbf72a9dd6d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2672026 Commit-Queue: Sigurd Schneider <f04d242e109628a27a0f75fd49a87722bcf291fd@chromium.org> Reviewed-by: Tim van der Lippe <dba8716ee7f8d16236046f74d2167cb94410f6ed@chromium.org>
JavaScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
c7329c1c5347ca2f453c41aeb0f479edc4050187
app/assets/javascripts/hyrax/browse_everything.js
app/assets/javascripts/hyrax/browse_everything.js
//= require jquery.treetable //= require browse_everything/behavior // Show the files in the queue Blacklight.onLoad( function() { // We need to check this because https://github.com/samvera/browse-everything/issues/169 if ($('#browse-btn').length > 0) { $('#browse-btn').browseEverything() .done(function(data) { var evt = { isDefaultPrevented: function() { return false; } }; var files = $.map(data, function(d) { return { name: d.file_name, size: d.file_size, id: d.url } }); $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }}); }) } });
//= require jquery.treetable //= require browse_everything/behavior // Show the files in the queue function showBrowseEverythingFiles() { // We need to check this because https://github.com/samvera/browse-everything/issues/169 if ($('#browse-btn').length > 0) { $('#browse-btn').browseEverything() .done(function(data) { var evt = { isDefaultPrevented: function() { return false; } }; var files = $.map(data, function(d) { return { name: d.file_name, size: d.file_size, id: d.url } }); $.blueimp.fileupload.prototype.options.done.call($('#fileupload').fileupload(), evt, { result: { files: files }}); }) } } $(document).on('click', '#browse-btn', showBrowseEverythingFiles);
Fix loading of browse-everything done event
Fix loading of browse-everything done event Avoids situations where the prototype browseEverything() function has not been defined yet.
JavaScript
apache-2.0
samvera/hyrax,samvera/hyrax,samvera/hyrax,samvera/hyrax
443a4ae12198f757370e95cf9e2de12aae9f710f
app/assets/javascripts/pages/new/new.component.js
app/assets/javascripts/pages/new/new.component.js
(function(){ 'use strict' const New = { templateUrl: 'pages/new/new.html' // templateUrl: 'components/bookmarks/bookmark-search.html', // controller: 'NewController' // controllerAs: 'model' } angular .module("shareMark") .component("new", New); }());
(function(){ 'use strict' const New = { templateUrl: 'pages/new/new.html', controller: 'NewController', controllerAs: 'model' } angular .module("shareMark") .component("new", New); }());
Update NewComponent to use NewController
Update NewComponent to use NewController
JavaScript
mit
Dom-Mc/shareMark,Dom-Mc/shareMark,Dom-Mc/shareMark
17e546f1a58744f7fe2f4e80147f6df2a203a2ee
esbuild/frappe-html.js
esbuild/frappe-html.js
module.exports = { name: "frappe-html", setup(build) { let path = require("path"); let fs = require("fs/promises"); build.onResolve({ filter: /\.html$/ }, (args) => { return { path: path.join(args.resolveDir, args.path), namespace: "frappe-html", }; }); build.onLoad({ filter: /.*/, namespace: "frappe-html" }, (args) => { let filepath = args.path; let filename = path.basename(filepath).split(".")[0]; return fs .readFile(filepath, "utf-8") .then((content) => { content = JSON.stringify(scrub_html_template(content)); return { contents: `\n\tfrappe.templates['${filename}'] = ${content};\n`, watchFiles: [filepath], }; }) .catch(() => { return { contents: "", warnings: [ { text: `There was an error importing ${filepath}`, }, ], }; }); }); }, }; function scrub_html_template(content) { content = content.replace(/`/g, "\\`"); return content; }
module.exports = { name: "frappe-html", setup(build) { let path = require("path"); let fs = require("fs/promises"); build.onResolve({ filter: /\.html$/ }, (args) => { return { path: path.join(args.resolveDir, args.path), namespace: "frappe-html", }; }); build.onLoad({ filter: /.*/, namespace: "frappe-html" }, (args) => { let filepath = args.path; let filename = path.basename(filepath).split(".")[0]; return fs .readFile(filepath, "utf-8") .then((content) => { content = scrub_html_template(content); return { contents: `\n\tfrappe.templates['${filename}'] = \`${content}\`;\n`, watchFiles: [filepath], }; }) .catch(() => { return { contents: "", warnings: [ { text: `There was an error importing ${filepath}`, }, ], }; }); }); }, }; function scrub_html_template(content) { content = content.replace(/`/g, "\\`"); return content; }
Revert "fix: allow backtick in HTML templates as well"
Revert "fix: allow backtick in HTML templates as well" This reverts commit 2f96458bcb6dfe8b8db4ef0101036b09bfa7c5f5.
JavaScript
mit
StrellaGroup/frappe,StrellaGroup/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe
7f009627bc82b67f34f93430152da71767be0029
packages/rear-system-package/config/app-paths.js
packages/rear-system-package/config/app-paths.js
const fs = require('fs'); const path = require('path'); const resolveApp = require('rear-core/resolve-app'); const ownNodeModules = fs.realpathSync( path.join(__dirname, '..', 'node_modules') ); const AppPaths = { ownNodeModules, root: resolveApp('src'), appIndexJs: resolveApp('src', 'index.js'), // TODO: rename to appBuild ? dest: resolveApp('lib'), eslintConfig: path.join(ownNodeModules, 'eslint-config-rear', 'index.js'), flowBin: path.join(ownNodeModules, 'flow-bin'), eslintBin: path.join(ownNodeModules, 'eslint'), appNodeModules: resolveApp('node_modules'), } module.exports = AppPaths;
const fs = require('fs'); const path = require('path'); const resolveApp = require('rear-core/resolve-app'); let ownNodeModules; try { // Since this package is also used to build other packages // in this repo, we need to make sure its dependencies // are available when is symlinked by lerna. // Normally, modules are resolved from the app's node_modules. ownNodeModules = fs.realpathSync( path.join(__dirname, '..', 'node_modules') ); } catch (err) { ownNodeModules = resolveApp('node_modules'); } const AppPaths = { ownNodeModules, root: resolveApp('src'), appIndexJs: resolveApp('src', 'index.js'), dest: resolveApp('lib'), eslintConfig: path.join(ownNodeModules, 'eslint-config-rear', 'index.js'), flowBin: path.join(ownNodeModules, 'flow-bin'), eslintBin: path.join(ownNodeModules, 'eslint'), appNodeModules: resolveApp('node_modules'), } module.exports = AppPaths;
Fix an issue that prevented modules to be resolved
Fix an issue that prevented modules to be resolved rear-system-package's config/app-paths.js was trying to resolve node_modules from inside the dependency. This is needed when rear-system-package is symlinked. Normally node_modules paths should be resolved from the app's node_modules.
JavaScript
mit
erremauro/rear,rearjs/rear
314b2f1b8350b64e29824257cef48f142d4c152f
test/index.js
test/index.js
'use strict'; const chai = require('chai'); const plate = require('../index'); const expect = chai.expect; describe('Those postal codes', function() { it('should be valid', function() { expect(plate.validate('10188')).to.be.true; expect(plate.validate('49080')).to.be.true; }); }); describe('Those postal codes', function() { it('should be invalid', function() { expect(plate.validate('90000')).to.be.false; expect(plate.validate('00000')).to.be.false; expect(plate.validate('1abcd')).to.be.false; expect(plate.validate('123456')).to.be.false; expect(plate.validate('1234')).to.be.false; expect(plate.validate('1 2 3 4')).to.be.false; }); }); describe('Those dirty postal codes', function() { it('should be cleaned', function() { expect(plate.clean(' 123 45 ')).to.equal('12345'); }); });
'use strict'; const chai = require('chai'); const postalCode = require('../index'); const expect = chai.expect; describe('Those postal codes', function() { it('should be valid', function() { expect(postalCode.validate('10188')).to.be.true; expect(postalCode.validate('49080')).to.be.true; }); }); describe('Those postal codes', function() { it('should be invalid', function() { expect(postalCode.validate('90000')).to.be.false; expect(postalCode.validate('00000')).to.be.false; expect(postalCode.validate('1abcd')).to.be.false; expect(postalCode.validate('123456')).to.be.false; expect(postalCode.validate('1234')).to.be.false; expect(postalCode.validate('1 2 3 4')).to.be.false; }); }); describe('Those dirty postal codes', function() { it('should be cleaned', function() { expect(postalCode.clean(' 123 45 ')).to.equal('12345'); }); });
Fix wrong naming in tests
Fix wrong naming in tests
JavaScript
mit
alefteris/greece-postal-code
b77fd67ee02329bd25fe224689dcd8434262c282
src/finders/JumpPointFinder.js
src/finders/JumpPointFinder.js
/** * @author aniero / https://github.com/aniero */ var DiagonalMovement = require('../core/DiagonalMovement'); var JPFNeverMoveDiagonally = require('./JPFNeverMoveDiagonally'); var JPFAlwaysMoveDiagonally = require('./JPFAlwaysMoveDiagonally'); var JPFMoveDiagonallyIfNoObstacles = require('./JPFMoveDiagonallyIfNoObstacles'); var JPFMoveDiagonallyIfAtMostOneObstacle = require('./JPFMoveDiagonallyIfAtMostOneObstacle'); /** * Path finder using the Jump Point Search algorithm * @param {object} opt * @param {function} opt.heuristic Heuristic function to estimate the distance * (defaults to manhattan). * @param {DiagonalMovement} opt.diagonalMovement Condition under which diagonal * movement will be allowed. */ function JumpPointFinder(opt) { if (opt.diagonalMovement === DiagonalMovement.Never) { return new JPFNeverMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.Always) { return new JPFAlwaysMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.OnlyWhenNoObstacles) { return new JPFMoveDiagonallyIfNoObstacles(opt); } else { return new JPFMoveDiagonallyIfAtMostOneObstacle(opt); } } module.exports = JumpPointFinder;
/** * @author aniero / https://github.com/aniero */ var DiagonalMovement = require('../core/DiagonalMovement'); var JPFNeverMoveDiagonally = require('./JPFNeverMoveDiagonally'); var JPFAlwaysMoveDiagonally = require('./JPFAlwaysMoveDiagonally'); var JPFMoveDiagonallyIfNoObstacles = require('./JPFMoveDiagonallyIfNoObstacles'); var JPFMoveDiagonallyIfAtMostOneObstacle = require('./JPFMoveDiagonallyIfAtMostOneObstacle'); /** * Path finder using the Jump Point Search algorithm * @param {object} opt * @param {function} opt.heuristic Heuristic function to estimate the distance * (defaults to manhattan). * @param {DiagonalMovement} opt.diagonalMovement Condition under which diagonal * movement will be allowed. */ function JumpPointFinder(opt) { opt = opt || {}; if (opt.diagonalMovement === DiagonalMovement.Never) { return new JPFNeverMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.Always) { return new JPFAlwaysMoveDiagonally(opt); } else if (opt.diagonalMovement === DiagonalMovement.OnlyWhenNoObstacles) { return new JPFMoveDiagonallyIfNoObstacles(opt); } else { return new JPFMoveDiagonallyIfAtMostOneObstacle(opt); } } module.exports = JumpPointFinder;
Fix exception on missing options object
Fix exception on missing options object If the JumpPointFinder constructor was not passed the options object there was a ReferenceError.
JavaScript
bsd-3-clause
radify/PathFinding.js,radify/PathFinding.js
9edb7717b460685efaff9b2974daa9b776bd2921
share/spice/urban_dictionary/urban_dictionary.js
share/spice/urban_dictionary/urban_dictionary.js
// `ddg_spice_urban_dictionary` is a callback function that gets // "urban dictionary cool" or "urban dictionary ROTFL." // Note: This plugin can display adult content and profanity. function ddg_spice_urban_dictionary(response) { "use strict"; if (!(response || response.response.result_type === "exact" || response.list || response.list[0])) { return; } var word = response.list[0].word; var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); Spice.render({ data : { 'definition' : definition }, header1 : word + " (Urban Dictionary)", source_url : 'http://www.urbandictionary.com/define.php?term=' + word, source_name : 'Urban Dictionary', template_normal : 'urban_dictionary', force_big_header : true, }); }
// `ddg_spice_urban_dictionary` is a callback function that gets // "urban dictionary cool" or "urban dictionary ROTFL." // Note: This plugin can display adult content and profanity. function ddg_spice_urban_dictionary(response) { "use strict"; if (!(response || response.response.result_type === "exact" || response.list || response.list[0])) { return; } var word = response.list[0].word; var definition = response.list[0].definition.replace(/(\r?\n)+/gi, '<br>'); Spice.render({ data : { 'definition' : definition }, header1 : word + " (Urban Dictionary)", source_url : 'http://www.urbandictionary.com/define.php?term=' + word, source_name : 'Urban Dictionary', template_normal : 'urban_dictionary', force_big_header : true, }); }
Fix whitespace tabs-versus-spaces conflict in Urban_dictionary Spice.
Fix whitespace tabs-versus-spaces conflict in Urban_dictionary Spice.
JavaScript
apache-2.0
alexandernext/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,ppant/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,deserted/zeroclickinfo-spice,ppant/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,levaly/zeroclickinfo-spice,ppant/zeroclickinfo-spice,echosa/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,lerna/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,loganom/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lernae/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,ppant/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,echosa/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,lernae/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,echosa/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,imwally/zeroclickinfo-spice,levaly/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lernae/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,sevki/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,soleo/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,P71/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,lernae/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,claytonspinner/zeroclickinfo-spice,lerna/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,deserted/zeroclickinfo-spice,echosa/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,sevki/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,stennie/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,mayo/zeroclickinfo-spice,ScreapDK/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,levaly/zeroclickinfo-spice,Queeniebee/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,evejweinberg/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,levaly/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,toenu23/zeroclickinfo-spice,imwally/zeroclickinfo-spice,navjotahuja92/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,deserted/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,stennie/zeroclickinfo-spice,deserted/zeroclickinfo-spice,iambibhas/zeroclickinfo-spice,loganom/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,stennie/zeroclickinfo-spice,imwally/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,loganom/zeroclickinfo-spice,mayo/zeroclickinfo-spice,bdjnk/zeroclickinfo-spice,soleo/zeroclickinfo-spice,Retrobottega/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,soleo/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,mayo/zeroclickinfo-spice,alexandernext/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,TomBebbington/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,lernae/zeroclickinfo-spice,samskeller/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,levaly/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,mayo/zeroclickinfo-spice,lerna/zeroclickinfo-spice,sagarhani/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,GrandpaCardigan/zeroclickinfo-spice,stennie/zeroclickinfo-spice,mohan08p/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,brianrisk/zeroclickinfo-spice,mr-karan/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,dachinzo/zeroclickinfo-spice,deserted/zeroclickinfo-spice,digit4lfa1l/zeroclickinfo-spice,loganom/zeroclickinfo-spice,tagawa/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,Kakkoroid/zeroclickinfo-spice,rubinovitz/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,Kr1tya3/zeroclickinfo-spice,sevki/zeroclickinfo-spice,stevenmg/zeroclickinfo-spice,sevki/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,andrey-p/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,Dwaligon/zeroclickinfo-spice,shyamalschandra/zeroclickinfo-spice,jyounker/zeroclickinfo-spice,dogomedia/zeroclickinfo-spice,rmad17/zeroclickinfo-spice,imwally/zeroclickinfo-spice,timeanddate/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,dheeraj143/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,lerna/zeroclickinfo-spice,P71/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,bigcurl/zeroclickinfo-spice,whalenrp/zeroclickinfo-spice,bibliotechy/zeroclickinfo-spice,lw7360/zeroclickinfo-spice,kevintab95/zeroclickinfo-spice,lernae/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,Faiz7412/zeroclickinfo-spice,cylgom/zeroclickinfo-spice,deserted/zeroclickinfo-spice,marianosimone/zeroclickinfo-spice,imwally/zeroclickinfo-spice,soleo/zeroclickinfo-spice,xaviervalarino/zeroclickinfo-spice,hshackathons/zeroclickinfo-spice,ColasBroux/zeroclickinfo-spice,soleo/zeroclickinfo-spice,P71/zeroclickinfo-spice,AcriCAA/zeroclickinfo-spice,MoriTanosuke/zeroclickinfo-spice,gautamkrishnar/zeroclickinfo-spice,levaly/zeroclickinfo-spice,echosa/zeroclickinfo-spice
7888270cc70a99be1c0fc20945a9684d66a69134
examples/client/app.js
examples/client/app.js
angular.module('MyApp', ['ngResource', 'ngMessages', 'ngRoute', 'ngAuth', 'mgcrea.ngStrap']) .config(['$routeProvider', function($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeCtrl' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginCtrl' }) .when('/signup', { templateUrl: 'views/signup.html', controller: 'SignupCtrl' }) .when('/logout', { template: null, controller: 'LogoutCtrl' }) .when('/protected', { templateUrl: 'views/protected.html', controller: 'ProtectedCtrl' }) .otherwise({ redirectTo: '/' }); }]) .config(['AuthProvider', function(AuthProvider) { AuthProvider.configure({ apiUrl: '/api' }); }]);
angular.module('MyApp', ['ngResource', 'ngMessages', 'ngRoute', 'ngAuth', 'mgcrea.ngStrap']) .config(['$routeProvider', 'AuthProvider', function($routeProvider, AuthProvider) { $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeCtrl' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginCtrl' }) .when('/signup', { templateUrl: 'views/signup.html', controller: 'SignupCtrl' }) .when('/logout', { template: null, controller: 'LogoutCtrl' }) .when('/protected', { templateUrl: 'views/protected.html', controller: 'ProtectedCtrl' }) .otherwise({ redirectTo: '/' }); AuthProvider.configure({ apiUrl: '/api' }); }]);
Move AuthProvider into first config block
Move AuthProvider into first config block
JavaScript
mit
hsr-ba-fs15-dat/satellizer,gshireesh/satellizer,bnicart/satellizer,jskrzypek/satellizer,jskrzypek/satellizer,johan--/satellizer,vebin/satellizer,TechyTimo/CoderHunt,celrenheit/satellizer,maciekrb/satellizer,maciekrb/satellizer,david300/satellizer,ELAPAKAHARI/satellizer,gregoriusxu/satellizer,maciekrb/satellizer,rick4470/satellizer,peterkim-ijet/satellizer,m-kostira/satellizer,redwood-strategic/satellizer,jskrzypek/satellizer,redwood-strategic/satellizer,david300/satellizer,hsr-ba-fs15-dat/satellizer,ELAPAKAHARI/satellizer,NikolayGalkin/satellizer,maciekrb/satellizer,gshireesh/satellizer,dgoguerra/satellizer,ezzaouia/satellizer,jonbgallant/satellizer,peterkim-ijet/satellizer,redwood-strategic/satellizer,ELAPAKAHARI/satellizer,ELAPAKAHARI/satellizer,redwood-strategic/satellizer,bartekmis/satellizer,gshireesh/satellizer,suratpyari/satellizer,amitport/satellizer,jskrzypek/satellizer,eduardomb/satellizer,xxryan1234/satellizer,Manumental32/satellizer,maciekrb/satellizer,david300/satellizer,eduardomb/satellizer,redwood-strategic/satellizer,eduardomb/satellizer,jskrzypek/satellizer,celrenheit/satellizer,xxryan1234/satellizer,eduardomb/satellizer,sahat/satellizer,ABPFrameWorkGroup/satellizer,zawmyolatt/satellizer,amitport/satellizer,peterkim-ijet/satellizer,xxryan1234/satellizer,redwood-strategic/satellizer,celrenheit/satellizer,romcyncynatus/satellizer,ELAPAKAHARI/satellizer,elanperach/satellizer,redwood-strategic/satellizer,marfarma/satellizer,maciekrb/satellizer,18098924759/satellizer,jayzeng/satellizer,celrenheit/satellizer,david300/satellizer,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,marceldiass/satellizer,xscharlie/satellizer,xxryan1234/satellizer,amitport/satellizer,amitport/satellizer,gshireesh/satellizer,ELAPAKAHARI/satellizer,xxryan1234/satellizer,AmreeshTyagi/satellizer,peterkim-ijet/satellizer,celrenheit/satellizer,NikolayGalkin/satellizer,david300/satellizer,IRlyDontKnow/satellizer,manojpm/satellizer,TheOneTheOnlyDavidBrown/satellizer,raycoding/satellizer,hsr-ba-fs15-dat/satellizer,NikolayGalkin/satellizer,shikhardb/satellizer,baratheraja/satellizer,celrenheit/satellizer,peterkim-ijet/satellizer,andyskw/satellizer,maciekrb/satellizer,peterkim-ijet/satellizer,eduardomb/satellizer,gshireesh/satellizer,amitport/satellizer,gshireesh/satellizer,viniciusferreira/satellizer,jskrzypek/satellizer,TechyTimo/CoderHunt,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,NikolayGalkin/satellizer,johan--/satellizer,eduardomb/satellizer,celrenheit/satellizer,eduardomb/satellizer,gshireesh/satellizer,david300/satellizer,jskrzypek/satellizer,maciekrb/satellizer,NikolayGalkin/satellizer,burasu/satellizer,NikolayGalkin/satellizer,david300/satellizer,celrenheit/satellizer,ELAPAKAHARI/satellizer,hsr-ba-fs15-dat/satellizer,TechyTimo/carbon,NikolayGalkin/satellizer,jskrzypek/satellizer,redwood-strategic/satellizer,david300/satellizer,SkydiverFL/satellizer,ELAPAKAHARI/satellizer,memezilla/satellizer,romcyncynatus/satellizer,hsr-ba-fs15-dat/satellizer,TechyTimo/carbon,peterkim-ijet/satellizer,shubham13jain/satellizer,hsr-ba-fs15-dat/satellizer,xxryan1234/satellizer,xxryan1234/satellizer,thiagofesta/satellizer,heinbez/satellizer,sahat/satellizer,gshireesh/satellizer,eduardomb/satellizer,amitport/satellizer,eduardomb/satellizer,redwood-strategic/satellizer,NikolayGalkin/satellizer,amitport/satellizer,gshireesh/satellizer,themifycloud/satellizer,jianwang195823/satellizer,peterkim-ijet/satellizer,jskrzypek/satellizer,thandaanda/satellizer,david300/satellizer,expertmaksud/satellizer
1771ab50f1a5d3dbe06871a26bdfa31882e393ac
test/setup.js
test/setup.js
// From https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md var jsdom = require('jsdom').jsdom; var exposedProperties = ['window', 'navigator', 'document']; global.document = jsdom(''); global.window = document.defaultView; Object.keys(document.defaultView).forEach((property) => { if (typeof global[property] === 'undefined') { exposedProperties.push(property); global[property] = document.defaultView[property]; } }); // For some reason, this property does not get set above. global.Image = global.window.Image; global.navigator = { userAgent: 'node.js' }; // HACK: Polyfil that allows codemirror to render in a JSDOM env. global.window.document.createRange = function createRange() { return { setEnd: () => {}, setStart: () => {}, getBoundingClientRect: () => { return { right: 0 }; }, getClientRects: () => { return [] } } }; var mock = require('mock-require'); mock('electron-json-storage', { 'get': function(key, callback){ callback(null, { theme: 'light' }); }, 'set': function(key, json, callback) { callback(null); }, }) mock('electron', { 'shell': { 'openExternal': function(url) { }, }, })
// From https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md var jsdom = require('jsdom').jsdom; var exposedProperties = ['window', 'navigator', 'document']; global.document = jsdom(''); global.window = document.defaultView; Object.keys(document.defaultView).forEach((property) => { if (typeof global[property] === 'undefined') { exposedProperties.push(property); global[property] = document.defaultView[property]; } }); // For some reason, this property does not get set above. global.Image = global.window.Image; global.navigator = { userAgent: 'node.js' }; // HACK: Polyfil that allows codemirror to render in a JSDOM env. global.window.document.createRange = function createRange() { return { setEnd: () => {}, setStart: () => {}, getBoundingClientRect: () => { return { right: 0 }; }, getClientRects: () => { return [] } } }; var mock = require('mock-require'); mock('electron-json-storage', { 'get': function(key, callback){ callback(null, { theme: 'light' }); }, 'set': function(key, json, callback) { callback(null); }, }) mock('electron', { 'shell': { 'openExternal': function(url) { }, }, 'remote': { 'require': function(module) { if (module === 'electron') { return { 'dialog': function() { }, }; } }, }, })
Add mocks for menu tests
Add mocks for menu tests
JavaScript
bsd-3-clause
jdetle/nteract,jdfreder/nteract,jdetle/nteract,nteract/nteract,0u812/nteract,0u812/nteract,nteract/nteract,captainsafia/nteract,temogen/nteract,jdetle/nteract,nteract/composition,rgbkrk/nteract,nteract/nteract,0u812/nteract,captainsafia/nteract,nteract/composition,temogen/nteract,rgbkrk/nteract,rgbkrk/nteract,captainsafia/nteract,jdetle/nteract,captainsafia/nteract,jdfreder/nteract,nteract/composition,0u812/nteract,temogen/nteract,nteract/nteract,rgbkrk/nteract,jdfreder/nteract,nteract/nteract,jdfreder/nteract,rgbkrk/nteract
662828ef56046bc7830718ef897a4ebbefd50278
examples/utils/embedly.js
examples/utils/embedly.js
// @flow const getJSON = ( endpoint: string, data: ?{}, successCallback: ({ url: string, title: string, author_name: string, thumbnail_url: string, }) => void, ) => { const request = new XMLHttpRequest(); request.open("GET", endpoint, true); request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); request.onload = () => { if (request.status >= 200 && request.status < 400) { successCallback(JSON.parse(request.responseText)); } }; request.send(data); }; /* global EMBEDLY_API_KEY */ const key = typeof EMBEDLY_API_KEY === "undefined" ? "key" : EMBEDLY_API_KEY; const EMBEDLY_ENDPOINT = `https://api.embedly.com/1/oembed?key=${key}`; const get = ( url: string, callback: ({ url: string, title: string, author_name: string, thumbnail_url: string, }) => void, ) => { getJSON(`${EMBEDLY_ENDPOINT}&url=${encodeURIComponent(url)}`, null, callback); }; export default { get, };
// @flow type Embed = { url: string, title: string, author_name: string, thumbnail_url: string, html: string, }; const getJSON = ( endpoint: string, data: ?{}, successCallback: (embed: Embed) => void, ) => { const request = new XMLHttpRequest(); request.open("GET", endpoint, true); request.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); request.onload = () => { if (request.status >= 200 && request.status < 400) { successCallback(JSON.parse(request.responseText)); } }; request.send(data); }; /* global EMBEDLY_API_KEY */ const key = typeof EMBEDLY_API_KEY === "undefined" ? "key" : EMBEDLY_API_KEY; const EMBEDLY_ENDPOINT = `https://api.embedly.com/1/oembed?key=${key}`; const get = (url: string, callback: (embed: Embed) => void) => { getJSON(`${EMBEDLY_ENDPOINT}&url=${encodeURIComponent(url)}`, null, callback); }; export default { get, };
Support retrieving embed HTML in Embedly integration
Support retrieving embed HTML in Embedly integration
JavaScript
mit
springload/draftail,springload/draftail,springload/draftail,springload/draftail
05c19987d3f569aa892d50755c757a6356e4a9f1
environments/react/v15.js
environments/react/v15.js
/** * Js-coding-standards * * @author Robert Rossmann <rr.rossmann@me.com> * @copyright 2016 STRV * @license http://choosealicense.com/licenses/bsd-3-clause BSD-3-Clause License */ 'use strict' module.exports = { extends: [ './recommended.js', './accessibility.js', ], rules: { 'operator-linebreak': 0, 'require-jsdoc': 0, // Disallow Use of console // Turned off for React apps, console is quite useful in browsers 'no-console': 0, }, plugins: [ 'react', ], // Configures the react plugin to treat some rules with regard to this specific React.js version settings: { react: { version: '15.5', }, }, }
/** * Js-coding-standards * * @author Robert Rossmann <rr.rossmann@me.com> * @copyright 2016 STRV * @license http://choosealicense.com/licenses/bsd-3-clause BSD-3-Clause License */ 'use strict' module.exports = { extends: [ './recommended.js', './accessibility.js', ], rules: { 'operator-linebreak': 0, 'require-jsdoc': 0, }, plugins: [ 'react', ], // Configures the react plugin to treat some rules with regard to this specific React.js version settings: { react: { version: '15.5', }, }, }
Fix console still being turned off for react env
Fix console still being turned off for react env
JavaScript
bsd-3-clause
strvcom/js-coding-standards,strvcom/eslint-config-javascript,strvcom/eslint-config-javascript
d607447c7a4ee04fd559ba44f4fbb07ad42b8453
src/components/Counter.js
src/components/Counter.js
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as counterActions from '../actions/counterActions'; import { dispatch } from '../store'; @connect(state => ({ counter: state.counter, })) export class Counter extends Component { static propTypes = { counter: PropTypes.number, }; constructor(props) { super(props); } render() { return ( <div> <h2>Counter: {this.props.counter}</h2> <button onClick={() => dispatch(counterActions.decrement())}>-</button> <button onClick={() => dispatch(counterActions.increment())}>+</button> </div> ); } }
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import * as counterActions from '../actions/counterActions'; import { dispatch } from '../store'; @connect(state => ({ counter: state.counter, })) export class Counter extends Component { static propTypes = { counter: PropTypes.number, }; static defaultProps = { counter: 0, }; state = {}; constructor(props) { super(props); } render() { return ( <div> <h2>Counter: {this.props.counter}</h2> <button onClick={() => dispatch(counterActions.decrement())}>-</button> <button onClick={() => dispatch(counterActions.increment())}>+</button> </div> ); } }
Add defaultProps and initial state.
Add defaultProps and initial state.
JavaScript
mit
autozimu/react-hot-boilerplate,autozimu/react-hot-boilerplate
8999a66c88e56bc769bded0fe1ec17e0360682b5
src/core/cb.main/main.js
src/core/cb.main/main.js
function setup(options, imports, register) { // Import var server = imports.server.http; var port = imports.server.port; var watch = imports.watch; var workspace = imports.workspace; var logger = imports.logger.namespace("codebox"); // Start server server.listen(port); server.on('listening', function() { logger.log("Server is listening on ", port); watch.init(workspace.root) .then(function() { logger.log("Started Watch"); }) .fail(function(err) { logger.error("Failed to start Watch because of:"); logger.exception(err, false); }).fin(function() { // Register register(null, {}); }); }) } // Exports module.exports = setup;
function setup(options, imports, register) { // Import var server = imports.server.http; var port = imports.server.port; var watch = imports.watch; var workspace = imports.workspace; var logger = imports.logger.namespace("codebox"); // Start server server.listen(port); server.on('listening', function() { logger.log("Server is listening on ", port); }); watch.init(workspace.root) .then(function() { logger.log("Started Watch"); }) .fail(function(err) { logger.error("Failed to start Watch because of:"); logger.exception(err, false); }).fin(function() { // Register register(null, {}); }); } // Exports module.exports = setup;
Change init of watch and server
Change init of watch and server
JavaScript
apache-2.0
rajthilakmca/codebox,code-box/codebox,code-box/codebox,fly19890211/codebox,etopian/codebox,nobutakaoshiro/codebox,indykish/codebox,Ckai1991/codebox,fly19890211/codebox,CodeboxIDE/codebox,lcamilo15/codebox,kustomzone/codebox,lcamilo15/codebox,ronoaldo/codebox,ronoaldo/codebox,listepo/codebox,rajthilakmca/codebox,indykish/codebox,ahmadassaf/Codebox,Ckai1991/codebox,ahmadassaf/Codebox,etopian/codebox,quietdog/codebox,LogeshEswar/codebox,CodeboxIDE/codebox,quietdog/codebox,nobutakaoshiro/codebox,kustomzone/codebox,LogeshEswar/codebox,smallbal/codebox,blubrackets/codebox,listepo/codebox,rodrigues-daniel/codebox,blubrackets/codebox,smallbal/codebox,rodrigues-daniel/codebox
68bb8489b6fe7b2466159b2e5b9e08c21c466588
src/button.js
src/button.js
const React = require('react'); const classNames = require('classnames'); class Button extends React.Component { render() { const { className, children, type, ...props } = this.props; const buttonClassNames = classNames({ btn: true, 'btn-sm': this.props.size === 'small', 'btn-xs': this.props.size === 'extra-small', 'btn-lg': this.props.size === 'large', [`btn-${this.props.type}`]: true, }, className); return <button type="button" {...props} className={buttonClassNames} > {children} </button>; } } Button.propTypes = { size: React.PropTypes.oneOf([ 'small', 'extra-small', 'large', ]), type: React.PropTypes.oneOf([ 'default', 'danger', 'success', 'info' ]), className: React.PropTypes.string, children: React.PropTypes.node, }; Button.defaultProps = { type: 'default' }; module.exports = Button;
const React = require('react'); const classNames = require('classnames'); class Button extends React.Component { render() { const { className, children, theme, ...props } = this.props; const buttonClassNames = classNames({ btn: true, 'btn-sm': this.props.size === 'small', 'btn-xs': this.props.size === 'extra-small', 'btn-lg': this.props.size === 'large', [`btn-${this.props.theme}`]: true, }, className); return ( <button {...props} className={buttonClassNames}> {children} </button> ); } } Button.propTypes = { size: React.PropTypes.oneOf([ 'small', 'extra-small', 'large', ]), type: React.PropTypes.oneOf([ 'button', 'submit', ]), theme: React.PropTypes.oneOf([ 'default', 'danger', 'success', 'info' ]), className: React.PropTypes.string, children: React.PropTypes.node, }; Button.defaultProps = { type: 'button', theme: 'default' }; module.exports = Button;
Change `type` prop to `theme`
Change `type` prop to `theme`
JavaScript
mit
Opstarts/opstarts-ui
b41e1a78f7ac0fa996b290391273cd70d6375193
test/components/control.js
test/components/control.js
import React from 'react/addons'; let find = React.addons.TestUtils.findRenderedDOMComponentWithTag; let render = React.addons.TestUtils.renderIntoDocument; let Control = reqmod('components/control'); /** * Control components are those little icon based buttons, which can be toggled * active. */ describe('components/control', () => { it('should render correctly', () => { // First we render the actual 'control' component into our 'document'. let controlComponent = render( <Control icon="book" onClick={() => {}} /> ); // Next we check that it has the correct class... It should not be // toggled 'active' by default. controlComponent.getDOMNode().className.should.equal('control'); // Retrieve the actual 'icon' component from inside the 'control'. let iconComponent = find(controlComponent, 'span'); // Make sure the 'book' icon is reflected in the CSS classes. iconComponent.getDOMNode().className.should.endWith('fa-book'); }); it('should be able to be toggled active', () => { let controlComponent = render( <Control icon="book" onClick={() => {}} active={true} /> ); controlComponent.getDOMNode().className.should.endWith('active'); }); });
import React from 'react/addons'; let find = React.addons.TestUtils.findRenderedDOMComponentWithTag; let render = React.addons.TestUtils.renderIntoDocument; let Control = reqmod('components/control'); // Since we don't want React warnings about some deprecated stuff being spammed // in our test run, we disable the warnings with this... console.warn = () => { } /** * Control components are those little icon based buttons, which can be toggled * active. */ describe('components/control', () => { it('should render correctly', () => { // First we render the actual 'control' component into our 'document'. let controlComponent = render( <Control icon="book" onClick={() => {}} /> ); // Next we check that it has the correct class... It should not be // toggled 'active' by default. controlComponent.getDOMNode().className.should.equal('control'); // Retrieve the actual 'icon' component from inside the 'control'. let iconComponent = find(controlComponent, 'span'); // Make sure the 'book' icon is reflected in the CSS classes. iconComponent.getDOMNode().className.should.endWith('fa-book'); }); it('should be able to be toggled active', () => { let controlComponent = render( <Control icon="book" onClick={() => {}} active={true} /> ); controlComponent.getDOMNode().className.should.endWith('active'); }); });
Add an override to console.warn for testing to suppress React warnings.
Add an override to console.warn for testing to suppress React warnings.
JavaScript
mit
melonmanchan/teamboard-client-react,JanKuukkanen/Oauth-client-react,JanKuukkanen/Oauth-client-react,N4SJAMK/teamboard-client-react,tanelih/teamboard-client-react,melonmanchan/teamboard-client-react,santtusulander/teamboard-client-react,N4SJAMK/teamboard-client-react,santtusulander/teamboard-client-react,nikolauska/teamboard-client-react,AatuPitkanen/teamboard-client-react,AatuPitkanen/teamboard-client-react,JanKuukkanen/teamboard-client-react,nikolauska/teamboard-client-react,tanelih/teamboard-client-react,JanKuukkanen/teamboard-client-react
fd876469738834dc91e5ce179e2ccd9bc18ab37a
ui/app/serializers/node.js
ui/app/serializers/node.js
import { assign } from '@ember/polyfills'; import { inject as service } from '@ember/service'; import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ config: service(), attrs: { isDraining: 'Drain', httpAddr: 'HTTPAddr', }, normalize(modelClass, hash) { // Transform map-based objects into an array-based fragment lists const drivers = hash.Drivers || {}; hash.Drivers = Object.keys(drivers).map(key => { return assign({}, drivers[key], { Name: key }); }); const hostVolumes = hash.HostVolumes || {}; hash.HostVolumes = Object.keys(hostVolumes).map(key => hostVolumes[key]); return this._super(modelClass, hash); }, extractRelationships(modelClass, hash) { const { modelName } = modelClass; const nodeURL = this.store .adapterFor(modelName) .buildURL(modelName, this.extractId(modelClass, hash), hash, 'findRecord'); return { allocations: { links: { related: `${nodeURL}/allocations`, }, }, }; }, });
import { assign } from '@ember/polyfills'; import { inject as service } from '@ember/service'; import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ config: service(), attrs: { isDraining: 'Drain', httpAddr: 'HTTPAddr', }, normalize(modelClass, hash) { // Transform map-based objects into an array-based fragment lists const drivers = hash.Drivers || {}; hash.Drivers = Object.keys(drivers).map(key => { return assign({}, drivers[key], { Name: key }); }); if (hash.HostVolumes) { const hostVolumes = hash.HostVolumes; hash.HostVolumes = Object.keys(hostVolumes).map(key => hostVolumes[key]); } return this._super(modelClass, hash); }, extractRelationships(modelClass, hash) { const { modelName } = modelClass; const nodeURL = this.store .adapterFor(modelName) .buildURL(modelName, this.extractId(modelClass, hash), hash, 'findRecord'); return { allocations: { links: { related: `${nodeURL}/allocations`, }, }, }; }, });
Fix a bug where the NodeListStub API response would override existing HostVolumes in the store
Fix a bug where the NodeListStub API response would override existing HostVolumes in the store
JavaScript
mpl-2.0
hashicorp/nomad,hashicorp/nomad,dvusboy/nomad,burdandrei/nomad,burdandrei/nomad,dvusboy/nomad,hashicorp/nomad,hashicorp/nomad,hashicorp/nomad,hashicorp/nomad,burdandrei/nomad,burdandrei/nomad,burdandrei/nomad,dvusboy/nomad,dvusboy/nomad,dvusboy/nomad,dvusboy/nomad,burdandrei/nomad,dvusboy/nomad,burdandrei/nomad
0b9bed076bac3f942e904a5e8388880af515ced0
api/db/user.js
api/db/user.js
'use strict' module.exports = function (sequelize, DataTypes) { let User = sequelize.define('User', { id: { type: DataTypes.UUID, primaryKey: true, defaultValue: DataTypes.UUIDV4 }, email: { type: DataTypes.STRING, allowNull: false }, password: { type: DataTypes.STRING(1024), allowNull: false }, salt: { type: DataTypes.STRING, allowNull: true }, nicknames: { type: 'citext[]', allowNull: true, defaultValue: 'ARRAY[]::citext[]' }, drilled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, drilledDispatch: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, group: { type: DataTypes.ENUM('normal', 'overseer', 'moderator', 'admin'), allowNull: false, defaultValue: 'normal' }, dispatch: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null, unique: true } }, { paranoid: true, classMethods: { associate: function (models) { User.hasMany(models.Rat, { as: 'rats' }) } } }) return User }
'use strict' module.exports = function (sequelize, DataTypes) { let User = sequelize.define('User', { id: { type: DataTypes.UUID, primaryKey: true, defaultValue: DataTypes.UUIDV4 }, email: { type: DataTypes.STRING, allowNull: false }, password: { type: DataTypes.STRING(1024), allowNull: false }, salt: { type: DataTypes.STRING, allowNull: true }, nicknames: { type: 'citext[]', allowNull: true, defaultValue: sequelize.literal('ARRAY[]::citext[]') }, drilled: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, drilledDispatch: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false }, group: { type: DataTypes.ENUM('normal', 'overseer', 'moderator', 'admin'), allowNull: false, defaultValue: 'normal' }, dispatch: { type: DataTypes.BOOLEAN, allowNull: true, defaultValue: null, unique: true } }, { paranoid: true, classMethods: { associate: function (models) { User.hasMany(models.Rat, { as: 'rats' }) } } }) return User }
Use literal function for citext array default value, not string
Use literal function for citext array default value, not string
JavaScript
bsd-3-clause
FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com
ed6eed2c1f589c179cb57d9386f29cbfdbf1fc37
packages/rocketchat-ui-sidenav/client/sidebarItem.js
packages/rocketchat-ui-sidenav/client/sidebarItem.js
/* globals menu */ Template.sidebarItem.helpers({ canLeave() { const roomData = Session.get(`roomData${ this.rid }`); if (!roomData) { return false; } if (((roomData.cl != null) && !roomData.cl) || (roomData.t === 'd')) { return false; } else { return true; } } }); Template.sidebarItem.events({ 'click [data-id], click .sidebar-item__link'() { return menu.close(); } }); Template.sidebarItem.onCreated(function() { // console.log('sidebarItem', this.data); });
/* globals menu popover */ Template.sidebarItem.helpers({ canLeave() { const roomData = Session.get(`roomData${ this.rid }`); if (!roomData) { return false; } if (((roomData.cl != null) && !roomData.cl) || (roomData.t === 'd')) { return false; } else { return true; } } }); Template.sidebarItem.events({ 'click [data-id], click .sidebar-item__link'() { return menu.close(); }, 'click .sidebar-item__menu'(e) { const config = { popoverClass: 'sidebar-item', columns: [ { groups: [ { items: [ { icon: 'eye-off', name: t('Hide_room'), type: 'sidebar-item', id: 'hide' }, { icon: 'sign-out', name: t('Leave_room'), type: 'sidebar-item', id: 'leave' } ] } ] } ], mousePosition: { x: e.clientX, y: e.clientY }, data: { template: this.t, rid: this.rid, name: this.name } }; popover.open(config); } }); Template.sidebarItem.onCreated(function() { // console.log('sidebarItem', this.data); });
Add leave and hide buttons again
Add leave and hide buttons again
JavaScript
mit
NexFive/DrustChat,NexFive/DrustChat,NexFive/DrustChat,NexFive/DrustChat
461893aac3ec8cd55caa2946b015891a9daff0cc
lib/engine/buildDigest.js
lib/engine/buildDigest.js
const _ = require('lodash'), fstate = require('../util/fstate'), digest = require('../util/digest'), hashcache = require('../util/hashcache'), log = require('../util/log') ; function buildDigest(buildDir, cb) { fstate(buildDir, { includeDirectories: true }, (err, files) => { if (err) return cb(err); const buildId = digest(_.map( _.sortBy(files, 'relPath'), fileInfo => hashcache(fileInfo.absPath)).join(' '), 'base64'); log.verbose(`Current build-digest for ${buildDir} is "${buildId}"`); return cb(null, buildId); }); } module.exports = _.debounce(buildDigest, 300);
const _ = require('lodash'), fstate = require('../util/fstate'), digest = require('../util/digest'), hashcache = require('../util/hashcache'), log = require('../util/log') ; function buildDigest(buildDir, cb) { fstate(buildDir, (err, files) => { if (err) return cb(err); const buildId = digest(_.map( _.sortBy(files, 'relPath'), fileInfo => hashcache(fileInfo.absPath)).join(' '), 'base64'); log.verbose(`Current build-digest for ${buildDir} is "${buildId}"`); return cb(null, buildId); }); } module.exports = _.debounce(buildDigest, 300);
Exclude directories from build digest.
Exclude directories from build digest.
JavaScript
mit
Iceroad/martinet,Iceroad/martinet,Iceroad/martinet
de04f9e1f50dc38e70cb4b47271829042dc9b301
client/reducers/index.js
client/reducers/index.js
import { combineReducers } from 'redux'; import { routerReducer } from 'react-router-redux'; import { reducer as formReducer } from 'redux-form'; import auth from './userSignUp'; import login from './login'; import book from './book'; import favorites from './favorites'; import profile from './profile'; import { books, mostUpvotedBooks } from './books'; const rootReducer = combineReducers({ form: formReducer, auth, login, books, book, mostUpvotedBooks, favorites, profile, routing: routerReducer, }); export default rootReducer;
import { combineReducers } from 'redux'; import { routerReducer } from 'react-router-redux'; import { reducer as formReducer } from 'redux-form'; import auth from './userSignUp'; import login from './login'; import book from './book'; import favorites from './favorites'; import profile from './profile'; import addBook from './addBook'; import { books, mostUpvotedBooks } from './books'; const rootReducer = combineReducers({ form: formReducer, auth, login, books, book, addBook, mostUpvotedBooks, favorites, profile, routing: routerReducer, }); export default rootReducer;
Add addBook reducer to root reducer
Add addBook reducer to root reducer
JavaScript
mit
amarachukwu-agbo/hello-books,amarachukwu-agbo/hello-books
a7af375c66552df8a73f945679b1ff01f95c6f36
client/webpack.common.js
client/webpack.common.js
const path = require('path'); const cleanWebPackPlugin = require('clean-webpack-plugin'); module.exports = { output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/static/', }, plugins: [ new cleanWebPackPlugin(['dist']), ], module: { rules: [ { test: /\.js$/, use: { loader: 'babel-loader', }, exclude: /node_modules/, }, { test: /\.scss$/, use: [ { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" }, ] }, { test: /\.(png|svg|gif|jpg)$/, use: { loader: 'file-loader', }, }, ], }, };
const path = require('path'); const cleanWebPackPlugin = require('clean-webpack-plugin'); module.exports = { output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/static/', }, plugins: [ new cleanWebPackPlugin(['dist']), ], module: { rules: [ { test: /\.js$/, loader: 'babel-loader', options: { cacheDirectory: true, plugins: ['react-hot-loader/babel'], }, exclude: /node_modules/, }, { test: /\.scss$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }, ] }, { test: /\.(png|svg|gif|jpg)$/, use: { loader: 'file-loader', }, }, ], }, };
Set up hot module replacement for react components
Set up hot module replacement for react components
JavaScript
mit
amarachukwu-agbo/hello-books,amarachukwu-agbo/hello-books