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
2b8b8b78926aae2dc3c4a2140893f81a1ce9fb46
test/sapi.js
test/sapi.js
var bag = require('bagofholding'), sandbox = require('sandboxed-module'), should = require('should'), checks, mocks, sapi; describe('sapi', function () { function create(checks, mocks) { return sandbox.require('../lib/sapi', { requires: mocks ? mocks.requires : {}, globals: {} }); } beforeEach(function () { checks = {}; mocks = {}; }); describe('bar', function () { it('should foo when bar', function () { }); }); });
var bag = require('bagofholding'), sandbox = require('sandboxed-module'), should = require('should'), checks, mocks, sapi; describe('sapi', function () { function create(checks, mocks) { return sandbox.require('../lib/sapi', { requires: mocks ? mocks.requires : {}, globals: {} }); } beforeEach(function () { checks = {}; mocks = {}; }); describe('sapi', function () { it('should set key and default url when url is not provided', function () { sapi = new (create(checks, mocks))('somekey'); sapi.params.key.should.equal('somekey'); sapi.url.should.equal('http://api.sensis.com.au/ob-20110511/test'); }); it('should set specified key and url when provided', function () { sapi = new (create(checks, mocks))('somekey', 'http://someurl'); sapi.params.key.should.equal('somekey'); sapi.url.should.equal('http://someurl'); }); it('should pass error to callback when an error occurs while sending request', function (done) { mocks.request_err = new Error('someerror'); mocks.requires = { request: bag.mock.request(checks, mocks) }; sapi = new (create(checks, mocks))(); sapi.search(function cb(err, result) { checks.sapi_search_err = err; checks.sapi_search_result = result; done(); }); checks.sapi_search_err.message.should.equal('someerror'); should.not.exist(checks.sapi_search_result); }); }); describe('proxy', function () { it('should set proxy', function () { sapi = new (create(checks, mocks))('somekey'); sapi.proxy('http://someproxy'); sapi._proxy.should.equal('http://someproxy'); }); it('should allow chainable proxy setting', function () { sapi = new (create(checks, mocks))('somekey').proxy('http://someproxy'); sapi._proxy.should.equal('http://someproxy'); }); }); });
Add constructor and error callback tests.
Add constructor and error callback tests.
JavaScript
mit
cliffano/sapi
d7024ba7638a738d8e730a8663c5b474c16b2b00
components/typography/Text.js
components/typography/Text.js
import React, { PureComponent } from 'react'; import Box from '../box'; import PropTypes from 'prop-types'; import cx from 'classnames'; import theme from './theme.css'; const factory = (baseType, type, defaultElement) => { class Text extends PureComponent { render() { const { children, className, color, element, ...others } = this.props; const classNames = cx(theme[baseType], theme[type], theme[color], className); const Element = element || defaultElement; return ( <Box className={classNames} data-teamleader-ui={baseType} element={Element} {...others}> {children} </Box> ); } } Text.propTypes = { children: PropTypes.node, className: PropTypes.string, color: PropTypes.oneOf(['white', 'neutral', 'mint', 'teal', 'violet', 'ruby', 'gold', 'aqua']), element: PropTypes.node, }; Text.defaultProps = { color: 'teal', element: null, }; return Text; }; export { factory as textFactory };
import React, { PureComponent } from 'react'; import Box from '../box'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { COLORS } from '../../constants'; import theme from './theme.css'; const factory = (baseType, type, defaultElement) => { class Text extends PureComponent { render() { const { children, className, color, element, ...others } = this.props; const classNames = cx(theme[baseType], theme[type], theme[color], className); const Element = element || defaultElement; return ( <Box className={classNames} data-teamleader-ui={baseType} element={Element} {...others}> {children} </Box> ); } } Text.propTypes = { children: PropTypes.node, className: PropTypes.string, color: PropTypes.oneOf(COLORS), element: PropTypes.node, }; Text.defaultProps = { color: 'teal', element: null, }; return Text; }; export { factory as textFactory };
Use our new colors constant for the 'color' prop type
Use our new colors constant for the 'color' prop type
JavaScript
mit
teamleadercrm/teamleader-ui
f19d140732d9ab951849efdcd51b1fd3c3446226
models/index.js
models/index.js
var Sequelize = require('sequelize'); var inflection = require('inflection'); $config.database.logging = $config.database.log ? console.log : false; var sequelize = new Sequelize($config.database.name, $config.database.user, $config.database.pass, $config.database); var self = module.exports = {}; var models = require('node-require-directory')(__dirname); Object.keys(models).forEach(function(key) { var modelName = inflection.classify(key); var modelInstance = sequelize.import(modelName , function(sequelize, DataTypes) { var definition = [modelName].concat(models[key](DataTypes)); return sequelize.define.apply(sequelize, definition); }); self[modelName] = modelInstance; }); self.User.hasMany(self.Team); self.Team.hasMany(self.User); self.Project.hasMany(self.Team, { through: self.ProjectTeam }); self.Team.hasMany(self.Project, { through: self.ProjectTeam }); self.sequelize = self.DB = sequelize;
var Sequelize = require('sequelize'); var inflection = require('inflection'); $config.database.logging = $config.database.log ? console.log : false; var sequelize = new Sequelize($config.database.name, $config.database.user, $config.database.pass, $config.database); var self = module.exports = {}; var models = require('node-require-directory')(__dirname); Object.keys(models).forEach(function(key) { var modelName = inflection.classify(key); var modelInstance = sequelize.import(modelName , function(sequelize, DataTypes) { var definition = [modelName].concat(models[key](DataTypes)); if (sequelize.options.dialect === 'mysql') { DataTypes.LONGTEXT = 'LONGTEXT'; } else { DataTypes.LONGTEXT = 'TEXT'; } return sequelize.define.apply(sequelize, definition); }); self[modelName] = modelInstance; }); self.User.hasMany(self.Team); self.Team.hasMany(self.User); self.Project.hasMany(self.Team, { through: self.ProjectTeam }); self.Team.hasMany(self.Project, { through: self.ProjectTeam }); self.sequelize = self.DB = sequelize;
Add LONGTEXT type for MySQL
Add LONGTEXT type for MySQL
JavaScript
mit
wikilab/wikilab-api
d1adefd5d3b4dd86afff010c3199864e61275bdb
app/js/arethusa.morph/directives/form_selector.js
app/js/arethusa.morph/directives/form_selector.js
'use strict'; angular.module('arethusa.morph').directive('formSelector', function () { return { restrict: 'A', link: function(scope, element, attrs) { var id = scope.id; function action(event) { event.stopPropagation(); scope.$apply(function() { if (scope.form.selected) { scope.plugin.unsetState(id); } else { scope.plugin.setState(id, scope.form); } }); } scope.$watch('form.selected', function(newVal, oldVal) { scope.text = newVal ? 'D' : 'S'; }); element.bind('click', action); }, template: '\ <span\ class="button micro radius"\ ng-class="{ success: form.selected }">\ {{ text }}\ </span>\ ' }; });
'use strict'; angular.module('arethusa.morph').directive('formSelector', function () { return { restrict: 'A', link: function(scope, element, attrs) { var id = scope.id; function action(event) { event.stopPropagation(); scope.$apply(function() { if (scope.form.selected) { scope.plugin.unsetState(id); } else { scope.plugin.setState(id, scope.form); } }); } scope.$watch('form.selected', function(newVal, oldVal) { scope.iconClass = newVal ? 'minus' : 'plus'; scope.title = newVal ? 'deselect' : 'select'; }); element.bind('click', action); }, template: '\ <span\ class="button micro radius"\ title="{{ title }}"\ ng-class="{ success: form.selected }">\ <i class="fi-{{ iconClass }}"></i>\ </span>\ ' }; });
Use icons and titles in formSelector
Use icons and titles in formSelector
JavaScript
mit
Masoumeh/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa,PonteIneptique/arethusa,latin-language-toolkit/arethusa,latin-language-toolkit/arethusa,fbaumgardt/arethusa,Masoumeh/arethusa,PonteIneptique/arethusa,alpheios-project/arethusa
7d5e3d2f00c57856c5f1364d238e2ab7c3fe81dd
test/package.js
test/package.js
import fs from 'fs'; import test from 'ava'; import pify from 'pify'; import index from '../'; test('every rule should defined in the index file and recommended settings', async t => { const files = await pify(fs.readdir, Promise)('../rules/'); const rules = files.filter(file => file.indexOf('.js') === file.length - 3); rules.forEach(file => { const name = file.slice(0, -3); t.truthy(index.rules[name], `'${name}' is not exported in 'index.js'`); t.truthy(index.configs.recommended.rules[`fp/${name}`], `'${name}' is not set in the recommended config`); }); t.is(Object.keys(index.rules).length, rules.length, 'There are more exported rules than rule files.'); }); test('no-var should be turned on in the recommended settings', async t => { t.true(index.configs.recommended.rules['no-var'] === 'error'); });
import fs from 'fs'; import test from 'ava'; import pify from 'pify'; import index from '../'; test('every rule should defined in the index file and recommended settings', async t => { const files = await pify(fs.readdir, Promise)('../rules/'); const rules = files.filter(file => file.indexOf('.js') === file.length - 3); rules.forEach(file => { const name = file.slice(0, -3); t.truthy(index.rules[name], `'${name}' is not exported in 'index.js'`); t.truthy(index.rules[name].meta.docs.description, `'${name}' does not have a description`); t.truthy(index.rules[name].meta.docs.recommended, `'${name}' does not have a recommended setting`); t.truthy(index.configs.recommended.rules[`fp/${name}`], `'${name}' is not set in the recommended config`); }); t.is(Object.keys(index.rules).length, rules.length, 'There are more exported rules than rule files.'); }); test('no-var should be turned on in the recommended settings', async t => { t.true(index.configs.recommended.rules['no-var'] === 'error'); });
Add tests to make sure each rule has a recommended setting and a description
Add tests to make sure each rule has a recommended setting and a description
JavaScript
mit
eslint-plugin-cleanjs/eslint-plugin-cleanjs,jfmengels/eslint-plugin-fp
89ee84da83644dbdf1984da6f728ac549170d604
src/node/cable.js
src/node/cable.js
import EventEmitter from 'events'; const cable = { __proto__: EventEmitter.prototype, init(websocket) { if (this._websocket) { this._websocket.terminate(); } this._websocket = websocket; this.emit('ready'); }, get websocket() { return new Promise((resolve, reject) => { if (this._websocket) { resolve(this._websocket); } else { this.on('ready', () => resolve(this._websocket)); } }); } }; const cp = async (msg, comment, opts) => (await cable.websocket). send(JSON.stringify({msg, comment, opts})); export { cable, cp };
import EventEmitter from 'events'; const cable = { __proto__: EventEmitter.prototype, // Call as early as possible on new client connecting /* e.g. in a pre-routing http get middleware httpRouter.get('/', (ctx, next) => { peek42.cable.init0(); next(); }); */ init0() { this.init(null); }, // Between init0 and init calls, any cp call will // wait for the websocket promise to resolve. // (If init0 is not called, there will be a dead zone during // which cp calls will use the previous (probably stale) // peek42 websocket) // Call as soon as peek42 websocket is available /* e.g. in the peek42 websocket get middleware wsRouter.get('/peek42', ctx => { peek42.cable.init(ctx.websocket); }); */ init(websocket) { if (this._websocket) { this._websocket.terminate(); } if (!websocket) { this._websocket = null; } else { this._websocket = websocket; this.emit('ready'); } }, get websocket() { return new Promise((resolve, reject) => { if (this._websocket) { resolve(this._websocket); } else { this.on('ready', () => resolve(this._websocket)); } }); } }; const cp = async (msg, comment, opts) => (await cable.websocket). send(JSON.stringify({msg, comment, opts})); export { cable, cp };
Tweak peek42 websocket node init code
Tweak peek42 websocket node init code
JavaScript
mit
rpeev/konsole,rpeev/konsole
97929daf840393df65574980362f235af4946545
src/main.js
src/main.js
/* ---------- Electron init ------------------------------------------------- */ import { app, BrowserWindow } from 'electron' /* ---------- Requires ------------------------------------------------------ */ import { host, port } from '../scripts/config' import { isDev } from '../scripts/env' import path from 'path' /* ---------- Refs for garbage collection ----------------------------------- */ let window /* -------------------------------------------------------------------------- */ if (isDev()) require('electron-reload')(__dirname) function createBrowserWindow () { // Init Window window = new BrowserWindow({ width: 1024, height: 700, frame: true, }) // Load template file window.loadURL(`http://${host}:${port}`) // Open the DevTools. if (isDev()) window.webContents.openDevTools() // Emitted when the window is closed. window.on('closed', () => { process.exit(0) window = null }) } app.on('ready', createBrowserWindow) // Quit when all windows are closed. app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { if (window === null) { createBrowserWindow() } })
/* ---------- Electron init ------------------------------------------------- */ import { app, BrowserWindow } from 'electron' /* ---------- Requires ------------------------------------------------------ */ import { host, port } from '../scripts/config' import { isDev } from '../scripts/env' import path from 'path' /* ---------- Refs for garbage collection ----------------------------------- */ let window /* -------------------------------------------------------------------------- */ if (isDev()) require('electron-reload')(__dirname) function createBrowserWindow () { // Init Window window = new BrowserWindow({ width: 1024, height: 700, frame: true, }) // Load template file window.loadURL(`http://${host}:${port}`) // Open the DevTools. if (isDev()) window.webContents.openDevTools() // Emitted when the window is closed. window.on('closed', () => { window = null }) } app.on('ready', createBrowserWindow) // Quit when all windows are closed. app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { if (window === null) { createBrowserWindow() } })
Remove process.exit(0) when windows is closed
Remove process.exit(0) when windows is closed
JavaScript
mit
guillaumearm/react-redux-functional-boilerplate,guillaumearm/react-redux-functional-boilerplate
324cffb9348053a54a5572fb008a38a934ab5aac
src/snake-case.js
src/snake-case.js
import R from 'ramda'; import spaceCase from './space-case.js'; import uncapitalize from './uncapitalize.js'; // a -> a const snakeCase = R.compose( uncapitalize, R.join('_'), R.split(' '), spaceCase ); export default snakeCase;
import R from 'ramda'; import compose from './util/compose.js'; import spaceCase from './space-case.js'; import uncapitalize from './uncapitalize.js'; // a -> a const snakeCase = compose( uncapitalize, R.join('_'), R.split(' '), spaceCase ); export default snakeCase;
Refactor snakeCase function to use custom compose function
Refactor snakeCase function to use custom compose function
JavaScript
mit
restrung/restrung-js
e426e9d0073b6e6fc0a79aacb9147bcb30bb3016
src/components/buttons/AuiButton.js
src/components/buttons/AuiButton.js
export default { render(createComponent) { const attrs = { disabled: this.disabled, href: this.href }; const elementType = this.href ? 'a' : 'button' return createComponent(elementType, { class: this.classObject, attrs }, this.$slots.default) }, props: { compact: Boolean, disabled: Boolean, href: String, light: Boolean, subtle: Boolean, type: { type: String, validator(value) { return 'primary' === value || 'link' === value } }, }, computed: { classObject() { return { 'aui-button': true, 'aui-button-primary': this.type === 'primary', 'aui-button-link': this.type === 'link', 'aui-button-light': this.light, 'aui-button-subtle': this.subtle, 'aui-button-compact': this.compact, } } }, }
export default { render(createComponent) { const attrs = { disabled: this.disabled, href: this.href, target: this.target }; const elementType = this.href ? 'a' : 'button' return createComponent(elementType, { class: this.classObject, attrs }, this.$slots.default) }, props: { compact: Boolean, disabled: Boolean, href: String, light: Boolean, subtle: Boolean, target: String, type: { type: String, validator(value) { return 'primary' === value || 'link' === value } }, }, computed: { classObject() { return { 'aui-button': true, 'aui-button-primary': this.type === 'primary', 'aui-button-link': this.type === 'link', 'aui-button-light': this.light, 'aui-button-subtle': this.subtle, 'aui-button-compact': this.compact, } } }, }
Add target to aui-button links
Add target to aui-button links
JavaScript
mit
spartez/vue-aui,spartez/vue-aui
fb93c3f778bb021d2047138091082c6a0788398d
webapplication/indexing/transformations/split-tags.js
webapplication/indexing/transformations/split-tags.js
'use strict'; const fields = [ 'tags', 'tags_vision', 'tags_verified' ] module.exports = metadata => { fields.forEach(field => { const value = metadata[field]; if(typeof(value) === 'string' && value !== '') { metadata[field] = value.split(','); } else { metadata[field] = []; } }); return metadata; };
'use strict'; const fields = [ 'tags', 'tags_verified' ] module.exports = metadata => { fields.forEach(field => { const value = metadata[field]; if(typeof(value) === 'string' && value !== '') { metadata[field] = value.split(','); } else { metadata[field] = []; } }); return metadata; };
Remove tags_vision field from splitting of tags -- as it is empty it will have no effect
Remove tags_vision field from splitting of tags -- as it is empty it will have no effect
JavaScript
mit
CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder
2f36d03cda77a74fda5bd1883c0e7a2a7cb2ab36
api/services/formatter-service.js
api/services/formatter-service.js
let Config = require('../../config'); let url = require('url'); let webHook = url.resolve(Config.app.url, '/codeship/'); class FormatterService { format(type, build) { return defaultFormat(build) } getStartMessage(chatId) { let hook = this.getWebHook(chatId); return `${FormatterService.EMOJI.ship} Hi! I see you want to receive Codeship notifications. Just add this URL as a Webhook to your Codeship notification settings to receive notifications in this conversation. To receive <b>only failing builds</b> (and the recovering builds) ${hook} To receive <b>all builds</b> (succeeding and failing) ${hook}?mode=all @codeship_bot by @dominic0`; } getWebHook(chatId) { return url.resolve(webHook, `${chatId}`); } } FormatterService.EMOJI = { ship: '\u{1F6A2}', success: '\u{2705}', error: '\u{274C}' }; function defaultFormat(build) { return `${FormatterService.EMOJI.ship} <b>${build.project_name}</b> - <code>${build.branch}</code> ${FormatterService.EMOJI[build.status] || ''} <b>${build.committer}</b>: ${build.message} <a href="${build.build_url}">Open on Codeship</a>`; } module.exports = new FormatterService();
let Config = require('../../config'); let url = require('url'); let webHook = url.resolve(Config.app.url, '/codeship/'); class FormatterService { format(type, build) { return defaultFormat(build) } getStartMessage(chatId) { let hook = this.getWebHook(chatId); return `${FormatterService.EMOJI.ship} Hi! I see you want to receive Codeship notifications. Just add this URL as a Webhook to your Codeship notification settings to receive notifications in this conversation. To receive <b>only failing builds</b> (and the recovering builds) ${hook} To receive <b>all builds</b> (succeeding and failing) ${hook}?mode=all @codeship_bot by @dominic0`; } getWebHook(chatId) { return url.resolve(webHook, `${chatId}`); } } FormatterService.EMOJI = { ship: '\u{1F6A2}', success: '\u{2705}', error: '\u{274C}' }; function defaultFormat(build) { return `${FormatterService.EMOJI[build.status] || ''} <b>${build.project_name}</b> - <code>${build.branch}</code> <b>${build.committer}</b>: ${build.message} <a href="${build.build_url}">Open on Codeship</a>`; } module.exports = new FormatterService();
Move build status to beginning of message
Move build status to beginning of message
JavaScript
mit
freshfox/codeship-telegram-bot,freshfox/codeship-telegram-bot
7f8ac834b5ac9e07f1624883cc399d62974b7226
website/src/app/models/api/public-tags-api.service.js
website/src/app/models/api/public-tags-api.service.js
class PublicTagsAPIService { constructor(publicAPIRoute) { this.publicAPIRoute = publicAPIRoute; } getPopularTags() { return this.publicAPIRoute('tags').one('popular').getList().then( (tags) => tags.plain() ); } } angular.module('materialscommons').service('publicTagsAPI', PublicTagsAPIService);
class PublicTagsAPIService { constructor(Restangular) { this.Restangular = Restangular; } getPopularTags() { return this.Restangular.one('v3').one('getPopularTagsForPublishedDatasets').customPOST().then( (tags) => tags.plain().data ); } } angular.module('materialscommons').service('publicTagsAPI', PublicTagsAPIService);
Switch to actionhero based API
Switch to actionhero based API
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
cd365cca6365d2f3aea0f244d3276c0d5f8a6df1
syntax/index.js
syntax/index.js
var assign = require('lodash.assign'); var testrunner = require('../lib/testrunner').testRunner; var es2015 = require('./es2015.json'); var es2016 = require('./es2016.json'); var es2017 = require('./es2017.json'); function syntax() { var es2015Test = testrunner(es2015, 'es2015'); var es2016Test = testrunner(es2016, 'es2015'); var es2017Test = testrunner(es2017, 'es2015'); var result = assign({ es2015: es2015Test, es2016: es2016Test, es2017: es2017Test }, es2015Test, es2016Test, es2017Test); result.__all = es2015Test.__all && es2016Test.__all && es2017Test.__all; return result; } module.exports = { syntax: syntax };
var testrunner = require('../lib/testrunner').testRunner; var assign = require('../lib/assign'); var es2015 = require('./es2015.json'); var es2016 = require('./es2016.json'); var es2017 = require('./es2017.json'); function syntax() { var es2015Test = testrunner(es2015, 'es2015'); var es2016Test = testrunner(es2016, 'es2015'); var es2017Test = testrunner(es2017, 'es2015'); var result = assign({ es2015: es2015Test, es2016: es2016Test, es2017: es2017Test }, es2015Test, es2016Test, es2017Test); result.__all = es2015Test.__all && es2016Test.__all && es2017Test.__all; return result; } module.exports = { syntax: syntax };
Use new assign method instead of lodash
Syntax: Use new assign method instead of lodash
JavaScript
mit
Tokimon/es-feature-detection,Tokimon/es-feature-detection,Tokimon/es-feature-detection
be3bd7187ed33c14b590107198da71e6fba7aeef
app/presenters/taxon-presenter.js
app/presenters/taxon-presenter.js
var taxonHelpers = require('../helpers/taxon-helpers.js'); var filterHelpers = require('../helpers/filter-helpers.js'); function TaxonPresenter (taxonSlug, request) { this.taxonSlug = taxonSlug; // the slug of the taxon in the Content Store this.selectedTab = request.query.tab; if (this.selectedTab == undefined) { this.selectedTab = 'guidance' }; //default view this.pageTitle = taxonHelpers.fetchCurrentTaxonTitle(this.taxonSlug); // Fetch appropriate taxonomy data this.childTaxons = taxonHelpers.fetchChildTaxons(this.taxonSlug); this.parentTaxon = taxonHelpers.fetchParentTaxon(this.taxonSlug); this.allContent = taxonHelpers.fetchTaggedItems(this.taxonSlug); this.determineContentList = function () { switch (this.selectedTab) { case 'all': return this.allContent; break; default: return filterHelpers.sectionFilter(this.allContent, this.selectedTab); } }; this.contentListToRender = this.determineContentList(); this.curatedContent = this.contentListToRender.slice(0,6); this.latestContent = this.contentListToRender.slice(0,3); } module.exports = TaxonPresenter;
var taxonHelpers = require('../helpers/taxon-helpers.js'); var filterHelpers = require('../helpers/filter-helpers.js'); function TaxonPresenter (taxonSlug, request) { this.taxonSlug = taxonSlug; // the slug of the taxon in the Content Store this.selectedTab = request.query.tab; if (this.selectedTab == undefined) { this.selectedTab = 'guidance' }; //default view this.pageTitle = taxonHelpers.fetchCurrentTaxonTitle(this.taxonSlug); // Fetch appropriate taxonomy data this.childTaxons = taxonHelpers.fetchChildTaxons(this.taxonSlug); this.parentTaxon = taxonHelpers.fetchParentTaxon(this.taxonSlug); this.allContent = taxonHelpers.fetchTaggedItems(this.taxonSlug); this.determineContentList = function () { switch (this.selectedTab) { case 'all': return this.allContent; break; default: return filterHelpers.sectionFilter(this.allContent, this.selectedTab); } }; this.contentListToRender = this.determineContentList(); this.curatedContent = this.contentListToRender.slice(0,6); this.latestContent = this.contentListToRender.slice(0,3); this.resolveViewTemplateName = function () { return request.path.replace(this.taxonSlug, '').replace(/^\//, '') + this.selectedTab; }; this.viewTemplateName = this.resolveViewTemplateName(); } module.exports = TaxonPresenter;
Add function to TaxonPresenter to resolve view template path from request
Add function to TaxonPresenter to resolve view template path from request Still uses the selected tab for the template name, but now looks for the template in a directory names after the base path. e.g. - '/taxons/:taxonSlug' will render templates from 'app/views/taxons'
JavaScript
mit
alphagov/govuk-navigation-prototype,alphagov/govuk-navigation-prototype,alphagov/govuk-navigation-prototype,alphagov/govuk-navigation-prototype
29e565d176c2a2cff221909fdb4c1fd566a0ddf3
test/spec/test_captcha.js
test/spec/test_captcha.js
/** * Created by sonja on 10/29/16. */
describe("The constructor is supposed a proper Captcha object", function() { it('Constructor Captcha exists', function(){ expect(Captcha).toBeDefined(); }); });
Add first javascript test and make the test pass
Add first javascript test and make the test pass
JavaScript
mit
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
ccdb86e55c3dbfb673344e141bc068b83056c782
test/spec/test_captcha.js
test/spec/test_captcha.js
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(); }); });
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(); }); });
Add test if captcha is instance of Captcha class
Add test if captcha is instance of Captcha class
JavaScript
mit
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
c60b623bc4941fce71c1594db7a554d5ba42a5d4
webapp/src/components/molecules/highcharts/themes.js
webapp/src/components/molecules/highcharts/themes.js
export default { standard: { credits: { enabled: false }, chart: { style: { fontFamily: "'proxima', 'Helvetica', sans-serif' " } }, title: '' } }
export default { standard: { credits: { enabled: false }, chart: { style: { fontFamily: "'proxima', 'Helvetica', sans-serif' ", paddingTop: '20px' // Make room for buttons } }, exporting: { buttons: { contextButton: { symbol: null, text: 'Export', x: -20, y: -30, theme: { style: { color: '#039', textDecoration: 'underline' } } } } }, title: '' } }
Move export button in all Highcharts
Move export button in all Highcharts
JavaScript
agpl-3.0
unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome
f92a511cd9e63e66bb92a1b68c9882ce567e5d11
src/reducers/PrescriptionReducer.js
src/reducers/PrescriptionReducer.js
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ import { ROUTES } from '../navigation/constants'; import { UIDatabase } from '../database'; import { PRESCRIPTION_ACTIONS } from '../actions/PrescriptionActions'; const initialState = () => ({ currentTab: 0, transaction: null, items: UIDatabase.objects('Item'), itemSearchTerm: '', commentModalOpen: false, }); export const PrescriptionReducer = (state = initialState(), action) => { const { type } = action; switch (type) { case 'Navigation/NAVIGATE': { const { routeName, params } = action; if (routeName !== ROUTES.PRESCRIPTION) return state; const { transaction } = params; return { ...state, transaction }; } case PRESCRIPTION_ACTIONS.REFRESH: { return { ...state }; } case PRESCRIPTION_ACTIONS.FILTER: { const { payload } = action; const { itemSearchTerm } = payload; return { ...state, itemSearchTerm }; } case PRESCRIPTION_ACTIONS.OPEN_COMMENT_MODAL: { return { ...state, commentModalOpen: true }; } case PRESCRIPTION_ACTIONS.CLOSE_COMMENT_MODAL: { return { ...state, commentModalOpen: false }; } case PRESCRIPTION_ACTIONS.DELETE: return { ...state, transaction: null }; default: { return state; } } };
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ import { ROUTES } from '../navigation/constants'; import { UIDatabase } from '../database'; import { PRESCRIPTION_ACTIONS } from '../actions/PrescriptionActions'; const initialState = () => ({ currentTab: 0, transaction: null, items: UIDatabase.objects('Item').filtered('isVaccine != true'), itemSearchTerm: '', commentModalOpen: false, }); export const PrescriptionReducer = (state = initialState(), action) => { const { type } = action; switch (type) { case 'Navigation/NAVIGATE': { const { routeName, params } = action; if (routeName !== ROUTES.PRESCRIPTION) return state; const { transaction } = params; return { ...state, transaction }; } case PRESCRIPTION_ACTIONS.REFRESH: { return { ...state }; } case PRESCRIPTION_ACTIONS.FILTER: { const { payload } = action; const { itemSearchTerm } = payload; return { ...state, itemSearchTerm }; } case PRESCRIPTION_ACTIONS.OPEN_COMMENT_MODAL: { return { ...state, commentModalOpen: true }; } case PRESCRIPTION_ACTIONS.CLOSE_COMMENT_MODAL: { return { ...state, commentModalOpen: false }; } case PRESCRIPTION_ACTIONS.DELETE: return { ...state, transaction: null }; default: { return state; } } };
Remove vaccines from normal dispensing window
Remove vaccines from normal dispensing window
JavaScript
mit
sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile
ed781120958633b55223525533b287964393dc49
plugins/wired.js
plugins/wired.js
var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name:'Wired', version:'0.1', prepareImgLinks:function (callback) { var res = []; hoverZoom.urlReplace(res, 'img', /-\d+x\d+\./, '.' ); hoverZoom.urlReplace(res, 'img[src*="/thumbs/"]', 'thumbs/thumbs_', '' ); hoverZoom.urlReplace(res, 'img[src*="_w"]', /_wd?\./, '_bg.' ); callback($(res)); } });
var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name:'Wired', version:'0.2', prepareImgLinks:function (callback) { var res = []; hoverZoom.urlReplace(res, 'img', /-\d+x\d+\./, '.' ); hoverZoom.urlReplace(res, 'img[src*="/thumbs/"]', 'thumbs/thumbs_', '' ); hoverZoom.urlReplace(res, 'img[src*="_w"]', /_wd?\./, '_bg.' ); $('img[src]').each(function() { var url = this.src; try { // decode ASCII characters, for instance: '%2C' -> ',' // NB: this operation mustbe try/catched because url might not be well-formed var fullsizeUrl = decodeURIComponent(url); fullsizeUrl = fullsizeUrl.replace(/\/1:1(,.*?)?\//, '/').replace(/\/16:9(,.*?)?\//, '/').replace(/\/[wW]_?\d+(,.*?)?\//, '/').replace(/\/[hH]_?\d+(,.*?)?\//, '/').replace(/\/[qQ]_?\d+(,.*?)?\//, '/').replace(/\/q_auto(,.*?)?\//, '/').replace(/\/c_limit(,.*?)?\//, '/').replace(/\/c_scale(,.*?)?\//, '/').replace(/\/c_fill(,.*?)?\//, '/').replace(/\/f_auto(,.*?)?\//, '/'); if (fullsizeUrl != url) { var link = $(this); if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] } if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) { link.data().hoverZoomSrc.unshift(fullsizeUrl); res.push(link); } } } catch(e) {} }); callback($(res), this.name); } });
Update for plug-in : WiReD
Update for plug-in : WiReD
JavaScript
mit
extesy/hoverzoom,extesy/hoverzoom
f22843697d00cc4bf1c660b9a89fc8f136845d5c
src/views/loggedin/loggedin-view.js
src/views/loggedin/loggedin-view.js
import { View, __, Sidebar, ViewManager, NavBar } from 'erste'; import MainView from '../main-view'; class LoggedInView extends View { constructor() { super(); this.navBar = new NavBar({ title: __('Welcome to beveteran'), hasMenuButton: true, hasBackButton: true }); } onActivation() { if (cfg.PLATFORM == 'device') StatusBar.styleDefault(); } finderButtonTap(e) { var finderView = new FinderView(); finderView.vm = this.vm; this.vm.pull(finderView, true); }; hiderButtonTap(e) { var hinderView = new HinderView(); hinderView.vm = this.vm; this.vm.pull(hinderView, true); }; get events() { return { 'tap': { '.finder': this.finderButtonTap, '.hider': this.hiderButtonTap, } } } template() { return ` <view> ${this.navBar} <div class="logedin"> <div class="imgcontainer"> <img src="static/img/logo.png" alt="Avatar" class="logo"> </div> <div class="buttons"> <button type="button" class="hider"> be a hider verteran</button> <button type="button" class="finder"> be a finder verteran</button> </div> </div> </view> `; } } module.exports = LoggedInView;
import { View, __, Sidebar, ViewManager, NavBar } from 'erste'; import MainView from '../main-view'; class LoggedInView extends View { constructor() { super(); this.navBar = new NavBar({ title: __('Welcome to beveteran'), hasMenuButton: true, hasBackButton: true }); this.hasSidebar = true; } onActivation() { if (cfg.PLATFORM == 'device') StatusBar.styleDefault(); } finderButtonTap(e) { var finderView = new FinderView(); finderView.vm = this.vm; this.vm.pull(finderView, true); }; hiderButtonTap(e) { var hinderView = new HinderView(); hinderView.vm = this.vm; this.vm.pull(hinderView, true); }; get events() { return { 'tap': { '.finder': this.finderButtonTap, '.hider': this.hiderButtonTap, } } } template() { return ` <view> ${this.navBar} <div class="logedin"> <div class="imgcontainer"> <img src="static/img/logo.png" alt="Avatar" class="logo"> </div> <div class="buttons"> <button type="button" class="hider"> be a hider verteran</button> <button type="button" class="finder"> be a finder verteran</button> </div> </div> </view> `; } } module.exports = LoggedInView;
Add hasSidebar to LoggedInView to use the drag gesture to reveal the menu
Add hasSidebar to LoggedInView to use the drag gesture to reveal the menu
JavaScript
mit
korayguney/veteranteam_project,zekicelik/veteranteam_project,zekicelik/veteranteam_project,korayguney/veteranteam_project
9733b718f083bf0d82ea0c75d957b81301ea8666
test/drag/drag.js
test/drag/drag.js
steal("../../browser/jquery", "jquerypp/index.js", function($){ window.jQuery = $; var hoveredOnce = false; $(".over").bind('mouseover',function(){ if (!hoveredOnce) { $(this).addClass('hover') $(document.body).append("<input type='text' id='typer' />") hoveredOnce = true; } }) $('#drag') .on("draginit", function(){}) $('#drop') .on("dropover", function(){ $(document.body).append("<a href='#' id='clicker'>click</a>") $("#clicker").click(function(){ $(".status").html("dragged") }) }) })
steal("jquerypp/index.js", function($){ window.jQuery = $; var hoveredOnce = false; $(".over").bind('mouseover',function(){ if (!hoveredOnce) { $(this).addClass('hover') $(document.body).append("<input type='text' id='typer' />") hoveredOnce = true; } }) $('#drag') .on("draginit", function(){}) $('#drop') .on("dropover", function(){ $(document.body).append("<a href='#' id='clicker'>click</a>") $("#clicker").click(function(){ $(".status").html("dragged") }) }) })
Fix the funcunit-syn integration “Drag To” test
Fix the funcunit-syn integration “Drag To” test Dragging & dropping works because of jQuery++, so its version of jQuery had to be referenced instead of the `browser/jquery` import.
JavaScript
mit
bitovi/funcunit,bitovi/funcunit,bitovi/funcunit
44e38454ad1412a798f1e25a56155458f788c953
test/lint-test.js
test/lint-test.js
import 'lint-tests'; // eslint-disable-line
import 'lint-tests'; // eslint-disable-line import assert from 'assert'; import Client from '../src/client'; suite('manual-lint-test', () => { const config = { domain: 'sendmecats.myshopify.com', storefrontAccessToken: 'abc123' }; test('it ensures that all Connections include pageInfo', () => { const client = Client.buildClient(config); const objectTypes = client.graphQLClient.typeBundle.types; for (const key in objectTypes) { if (objectTypes.hasOwnProperty(key) && key.includes('Connection')) { assert.equal(objectTypes[key].fieldBaseTypes.pageInfo, 'PageInfo'); } } }); });
Validate that all Connections include PageInfo
Validate that all Connections include PageInfo
JavaScript
mit
Shopify/js-buy-sdk,Shopify/js-buy-sdk
6ebf3b012f41bc222ef96b22cb55b8398db313d5
route/index.js
route/index.js
'use strict'; module.exports = defineRoute; // Define the route function defineRoute (server, opts) { server.route({ method: 'GET', path: '/', handler: handler, config: { jsonp: 'callback', validate: { query: {}, payload: false } } }); function handler (req) { req.reply({ endpoints: [ { method: 'GET', endpoint: '/' + opts.plural, description: 'Get all ' + opts.plural }, { method: 'GET', endpoint: '/' + opts.plural + '/{id}', description: 'Get a single ' + opts.singular + ' by id' }, { method: 'GET', endpoint: '/random', description: 'Get a random ' + opts.singular }, { method: 'GET', endpoint: '/bomb?count={n}', description: 'Get multiple random ' + opts.plural } ] }); } }
'use strict'; module.exports = defineRoute; // Define the route function defineRoute (server, opts) { server.route({ method: 'GET', path: '/', handler: handler, config: { jsonp: 'callback', validate: { query: {}, payload: false } } }); function handler (req) { var host = req.info.host; var exampleId = (opts.things[0] ? opts.things[0].id : 1); req.reply({ endpoints: [ { method: 'GET', endpoint: '/' + opts.plural, description: 'Get all ' + opts.plural, example: 'http://' + host + '/' + opts.plural }, { method: 'GET', endpoint: '/' + opts.plural + '/{id}', description: 'Get a single ' + opts.singular + ' by id', example: 'http://' + host + '/' + opts.plural + '/' + exampleId }, { method: 'GET', endpoint: '/random', description: 'Get a random ' + opts.singular, example: 'http://' + host + '/random' }, { method: 'GET', endpoint: '/bomb?count={n}', description: 'Get multiple random ' + opts.plural, example: 'http://' + host + '/bomb?count=3' } ] }); } }
Add examples to the endpoint documentation
Add examples to the endpoint documentation
JavaScript
mit
rowanmanning/thingme
1bbd54e1fbedeb337fd33610ead89d81e6ecf2c9
text/boolean.js
text/boolean.js
'use strict'; var d = require('es5-ext/lib/Object/descriptor') , Db = require('dbjs') , DOMText = require('./_text') , getValue = Object.getOwnPropertyDescriptor(DOMText.prototype, 'value').get , Base = Db.Base , Text; Text = function (document, ns) { this.document = document; this.ns = ns; this.text = new DOMText(document, Base); this.dom = this.text.dom; }; Text.prototype = Object.create(DOMText.prototype, { constructor: d(Text), value: d.gs(getValue, function (value) { if (value == null) { this.text.dismiss(); this.text.value = value; return; } this.ns[value.valueOf() ? '_trueLabel' : '_falseLabel'] .assignDOMText(this.text); }) }); module.exports = Object.defineProperty(Db.Boolean, 'DOMText', d(Text));
'use strict'; var d = require('es5-ext/lib/Object/descriptor') , Db = require('dbjs') , DOMText = require('./_text') , getValue = Object.getOwnPropertyDescriptor(DOMText.prototype, 'value').get , Base = Db.Base , Text; Text = function (document, ns, options) { this.document = document; this.ns = ns; this.relation = options && options.relation; this.text = new DOMText(document, Base); this.dom = this.text.dom; }; Text.prototype = Object.create(DOMText.prototype, { constructor: d(Text), value: d.gs(getValue, function (value) { var rel; if (value == null) { this.text.dismiss(); this.text.value = value; return; } if (value.valueOf()) { rel = (this.relation && this.relation.__trueLabel.__value) ? this.relation._trueLabel : this.ns._trueLabel; } else { rel = (this.relation && this.relation.__falseLabel.__value) ? this.relation._falseLabel : this.ns._falseLabel; } rel.assignDOMText(this.text); }) }); module.exports = Object.defineProperty(Db.Boolean, 'DOMText', d(Text));
Use labels definied on relation if available
Use labels definied on relation if available
JavaScript
mit
medikoo/dbjs-dom
21c51b43e81696fd90510a8690b0d86d2e03999f
app/users/user-links.directive.js
app/users/user-links.directive.js
{ angular .module('meganote.users') .directive('userLinks', [ 'CurrentUser', (CurrentUser) => { class UserLinksController { user() { return CurrentUser.get(); } signedIn() { return CurrentUser.signedIn(); } } return { scope: {}, controller: UserLinksController, controllerAs: 'vm', bindToController: true, template: ` <div class="user-links" ng-show="vm.signedIn()"> Signed in as {{ vm.user().name }} </div>`, }; }]); }
{ angular .module('meganote.users') .directive('userLinks', [ 'CurrentUser', (CurrentUser) => { class UserLinksController { user() { return CurrentUser.get(); } signedIn() { return CurrentUser.signedIn(); } } return { scope: {}, controller: UserLinksController, controllerAs: 'vm', bindToController: true, template: ` <div class="user-links"> <span ng-show="vm.signedIn()"> Signed in as {{ vm.user().name }} </span> <span ng-hide="vm.signedIn()"> <a ui-sref="sign-up">Sign up for Meganote today!</a> </span> </div>`, }; }]); }
Add sign up link that shows if no user is signed in
Add sign up link that shows if no user is signed in
JavaScript
mit
sbaughman/meganote,sbaughman/meganote
2ab9cc689d2c32c15565ea8a46d5ad8841ea5942
tests/plugins/markdown.js
tests/plugins/markdown.js
import test from 'ava'; import {fromString} from '../helpers/pipe'; import markdown from '../../lib/plugins/markdown'; test('Compiles Markdown - .md', t => { const input = '# Hello World'; const expected = '<h1>Hello World</h1>\n'; return fromString(input, 'markdown/hello.md', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('Compiles Markdown - .markdown', t => { const input = '# Hello World'; const expected = '<h1>Hello World</h1>\n'; return fromString(input, 'markdown/hello.markdown', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('No Compile - .html', t => { const input = '# Hello World'; const expected = '# Hello World'; return fromString(input, 'markdown/hello.html', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); });
import test from 'ava'; import {fromString, fromNull, fromStream} from '../helpers/pipe'; import markdown from '../../lib/plugins/markdown'; test('Compiles Markdown - .md', t => { const input = '# Hello World'; const expected = '<h1>Hello World</h1>\n'; return fromString(input, 'markdown/hello.md', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('Compiles Markdown - .markdown', t => { const input = '# Hello World'; const expected = '<h1>Hello World</h1>\n'; return fromString(input, 'markdown/hello.markdown', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('Compiles Markdown with Custom Plugin', t => { const input = '@[Taylor Swift - Shake it Off](https://www.youtube.com/watch?v=nfWlot6h_JM)'; const expected = `<p><div class=\"flexible-video\"><iframe src=\"https://www.youtube.com/embed/nfWlot6h_JM\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen></iframe></div></p>\n`; return fromString(input, 'shake/it/off.md', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('No Compile - .html', t => { const input = '# Hello World'; const expected = '# Hello World'; return fromString(input, 'markdown/hello.html', markdown) .then(output => { t.is(output, expected, 'Markdown compiles as expected'); }); }); test('No Compile - null', t => { return fromNull(markdown) .then(output => { t.is(output, '', 'No output'); }); }); test('Error - is stream', t => { t.throws(fromStream(markdown)); });
Add Custom Plugin and No Compile
:white_check_mark: Add Custom Plugin and No Compile * Make sure custom plugins are used when rendering Markdown * Add test for null file * Add test for streams that throw errors
JavaScript
mit
kellychurchill/gulp-armadillo,Snugug/gulp-armadillo
468fb779830bd727aef77d55e85942ee288fd0d9
src/components/Badge/index.js
src/components/Badge/index.js
import { h, Component } from 'preact'; import style from './style'; import Icon from '../Icon'; export default class Badge extends Component { render() { const { artist, event, small } = this.props; if (!event && !artist) { return; } if (artist && artist.onTourUntil) { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeOnTour}`}> <Icon name="calendar" /> On tour </span> ); } if (event.cancelled) { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeCancelled}`}> <Icon name="close" /> Cancelled </span> ); } if (event.reason.attendance) { if (event.reason.attendance === 'im_going') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeGoing}`}> <Icon name="check" /> Going </span> ); } else if (event.reason.attendance === 'i_might_go') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeMaybe}`}> <Icon name="bookmark" /> Maybe </span> ); } } else if (event.type && event.type === 'festival') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeFestival}`}> <Icon name="star" /> Festival </span> ); } return; } }
import { h, Component } from 'preact'; import style from './style'; import Icon from '../Icon'; export default class Badge extends Component { render() { const { event, small } = this.props; if (!event) { return; } if (event.cancelled) { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeCancelled}`}> <Icon name="close" /> Cancelled </span> ); } if (event.reason.attendance) { if (event.reason.attendance === 'im_going') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeGoing}`}> <Icon name="check" /> Going </span> ); } else if (event.reason.attendance === 'i_might_go') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeMaybe}`}> <Icon name="bookmark" /> Maybe </span> ); } } else if (event.type && event.type === 'festival') { return ( <span class={`${style.badge} ${small ? style.badgeSmall : {}} ${style.badgeFestival}`}> <Icon name="star" /> Festival </span> ); } return; } }
Remove some artist code in Badge component
Remove some artist code in Badge component
JavaScript
mit
zaccolley/songkick.pink,zaccolley/songkick.pink
fc03f5f65d40405c6b322c19114479bcc3e3cf12
website/addons/dropbox/static/dropboxFangornConfig.js
website/addons/dropbox/static/dropboxFangornConfig.js
'use strict'; var m = require('mithril'); var Fangorn = require('js/fangorn'); function _fangornLazyLoadError (item) { item.notify.update('Dropbox couldn\'t load, please try again later.', 'deleting', undefined, 3000); return true; } Fangorn.config.dropbox = { lazyLoadError : _fangornLazyLoadError };
'use strict'; var m = require('mithril'); var Fangorn = require('js/fangorn'); Fangorn.config.dropbox = {};
Remove notify from dropbox fangorn
Remove notify from dropbox fangorn [skip ci]
JavaScript
apache-2.0
KAsante95/osf.io,jmcarp/osf.io,reinaH/osf.io,cldershem/osf.io,ZobairAlijan/osf.io,abought/osf.io,danielneis/osf.io,wearpants/osf.io,cldershem/osf.io,emetsger/osf.io,brandonPurvis/osf.io,sloria/osf.io,ticklemepierce/osf.io,samchrisinger/osf.io,brandonPurvis/osf.io,icereval/osf.io,ticklemepierce/osf.io,haoyuchen1992/osf.io,cslzchen/osf.io,abought/osf.io,mfraezz/osf.io,binoculars/osf.io,danielneis/osf.io,caseyrygt/osf.io,rdhyee/osf.io,brianjgeiger/osf.io,laurenrevere/osf.io,cldershem/osf.io,adlius/osf.io,doublebits/osf.io,ZobairAlijan/osf.io,chennan47/osf.io,sloria/osf.io,amyshi188/osf.io,Nesiehr/osf.io,aaxelb/osf.io,emetsger/osf.io,mattclark/osf.io,HarryRybacki/osf.io,jnayak1/osf.io,MerlinZhang/osf.io,binoculars/osf.io,brandonPurvis/osf.io,jolene-esposito/osf.io,wearpants/osf.io,haoyuchen1992/osf.io,zachjanicki/osf.io,TomBaxter/osf.io,doublebits/osf.io,HalcyonChimera/osf.io,reinaH/osf.io,doublebits/osf.io,acshi/osf.io,chrisseto/osf.io,jolene-esposito/osf.io,amyshi188/osf.io,GageGaskins/osf.io,mattclark/osf.io,danielneis/osf.io,brianjgeiger/osf.io,cldershem/osf.io,crcresearch/osf.io,ZobairAlijan/osf.io,caneruguz/osf.io,mluke93/osf.io,jmcarp/osf.io,icereval/osf.io,rdhyee/osf.io,sloria/osf.io,brianjgeiger/osf.io,wearpants/osf.io,arpitar/osf.io,erinspace/osf.io,brianjgeiger/osf.io,billyhunt/osf.io,billyhunt/osf.io,acshi/osf.io,hmoco/osf.io,arpitar/osf.io,lyndsysimon/osf.io,kwierman/osf.io,HarryRybacki/osf.io,mluo613/osf.io,arpitar/osf.io,abought/osf.io,DanielSBrown/osf.io,caseyrollins/osf.io,mluke93/osf.io,amyshi188/osf.io,arpitar/osf.io,SSJohns/osf.io,acshi/osf.io,chennan47/osf.io,mluke93/osf.io,njantrania/osf.io,MerlinZhang/osf.io,kch8qx/osf.io,cwisecarver/osf.io,dplorimer/osf,cwisecarver/osf.io,HarryRybacki/osf.io,Nesiehr/osf.io,brandonPurvis/osf.io,alexschiller/osf.io,asanfilippo7/osf.io,aaxelb/osf.io,RomanZWang/osf.io,pattisdr/osf.io,samchrisinger/osf.io,caseyrygt/osf.io,lyndsysimon/osf.io,caneruguz/osf.io,wearpants/osf.io,petermalcolm/osf.io,petermalcolm/osf.io,monikagrabowska/osf.io,monikagrabowska/osf.io,mfraezz/osf.io,cslzchen/osf.io,abought/osf.io,cwisecarver/osf.io,billyhunt/osf.io,Nesiehr/osf.io,jnayak1/osf.io,RomanZWang/osf.io,cslzchen/osf.io,HalcyonChimera/osf.io,lyndsysimon/osf.io,crcresearch/osf.io,samanehsan/osf.io,hmoco/osf.io,SSJohns/osf.io,zamattiac/osf.io,sbt9uc/osf.io,ckc6cz/osf.io,TomBaxter/osf.io,RomanZWang/osf.io,samanehsan/osf.io,saradbowman/osf.io,alexschiller/osf.io,felliott/osf.io,Nesiehr/osf.io,KAsante95/osf.io,ckc6cz/osf.io,Ghalko/osf.io,cosenal/osf.io,reinaH/osf.io,haoyuchen1992/osf.io,GageGaskins/osf.io,TomBaxter/osf.io,danielneis/osf.io,mfraezz/osf.io,acshi/osf.io,Ghalko/osf.io,cslzchen/osf.io,mluo613/osf.io,zamattiac/osf.io,dplorimer/osf,laurenrevere/osf.io,mluo613/osf.io,cwisecarver/osf.io,kwierman/osf.io,CenterForOpenScience/osf.io,reinaH/osf.io,SSJohns/osf.io,ticklemepierce/osf.io,TomHeatwole/osf.io,SSJohns/osf.io,alexschiller/osf.io,jmcarp/osf.io,DanielSBrown/osf.io,mluo613/osf.io,monikagrabowska/osf.io,TomHeatwole/osf.io,samanehsan/osf.io,crcresearch/osf.io,hmoco/osf.io,billyhunt/osf.io,emetsger/osf.io,jnayak1/osf.io,leb2dg/osf.io,baylee-d/osf.io,chrisseto/osf.io,Johnetordoff/osf.io,TomHeatwole/osf.io,samchrisinger/osf.io,GageGaskins/osf.io,cosenal/osf.io,sbt9uc/osf.io,zamattiac/osf.io,Johnetordoff/osf.io,chennan47/osf.io,aaxelb/osf.io,binoculars/osf.io,chrisseto/osf.io,haoyuchen1992/osf.io,leb2dg/osf.io,RomanZWang/osf.io,laurenrevere/osf.io,jolene-esposito/osf.io,caseyrollins/osf.io,felliott/osf.io,monikagrabowska/osf.io,TomHeatwole/osf.io,dplorimer/osf,hmoco/osf.io,samchrisinger/osf.io,amyshi188/osf.io,dplorimer/osf,kch8qx/osf.io,Ghalko/osf.io,asanfilippo7/osf.io,baylee-d/osf.io,kwierman/osf.io,DanielSBrown/osf.io,ckc6cz/osf.io,zachjanicki/osf.io,CenterForOpenScience/osf.io,KAsante95/osf.io,CenterForOpenScience/osf.io,sbt9uc/osf.io,adlius/osf.io,adlius/osf.io,aaxelb/osf.io,zachjanicki/osf.io,njantrania/osf.io,HarryRybacki/osf.io,GageGaskins/osf.io,mfraezz/osf.io,KAsante95/osf.io,kch8qx/osf.io,njantrania/osf.io,rdhyee/osf.io,samanehsan/osf.io,DanielSBrown/osf.io,jolene-esposito/osf.io,njantrania/osf.io,ckc6cz/osf.io,Ghalko/osf.io,RomanZWang/osf.io,KAsante95/osf.io,HalcyonChimera/osf.io,billyhunt/osf.io,petermalcolm/osf.io,petermalcolm/osf.io,HalcyonChimera/osf.io,zachjanicki/osf.io,ZobairAlijan/osf.io,asanfilippo7/osf.io,caseyrygt/osf.io,monikagrabowska/osf.io,Johnetordoff/osf.io,Johnetordoff/osf.io,ticklemepierce/osf.io,chrisseto/osf.io,cosenal/osf.io,pattisdr/osf.io,saradbowman/osf.io,alexschiller/osf.io,leb2dg/osf.io,pattisdr/osf.io,leb2dg/osf.io,jmcarp/osf.io,caneruguz/osf.io,sbt9uc/osf.io,caseyrygt/osf.io,kch8qx/osf.io,asanfilippo7/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,doublebits/osf.io,mattclark/osf.io,jnayak1/osf.io,rdhyee/osf.io,brandonPurvis/osf.io,emetsger/osf.io,acshi/osf.io,mluo613/osf.io,erinspace/osf.io,doublebits/osf.io,kch8qx/osf.io,cosenal/osf.io,icereval/osf.io,erinspace/osf.io,caneruguz/osf.io,felliott/osf.io,mluke93/osf.io,lyndsysimon/osf.io,kwierman/osf.io,felliott/osf.io,caseyrollins/osf.io,GageGaskins/osf.io,MerlinZhang/osf.io,zamattiac/osf.io,MerlinZhang/osf.io,baylee-d/osf.io,alexschiller/osf.io
e7364f42d49f0e5cccef7da49d109418fe8b5c89
chrome-extension/mooch.js
chrome-extension/mooch.js
var MoochSentinel = { render: function(status) { document.getElementById("status").innerText = status.okay? "Okay!" : "Blocked"; }, requestStatus: function() { var user = localStorage['moochLogin']; if (!user) { document.getElementById("status").innerText = "Please, set user login on options page"; return; } var xhr = new XMLHttpRequest(); xhr.open("GET", "http://mooch.co.vu:5000/status/" + user, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { var status = JSON.parse(xhr.responseText); MoochSentinel.render(status); } } xhr.send(); } } document.addEventListener("DOMContentLoaded", function() { MoochSentinel.requestStatus(); });
var MoochSentinel = { render: function(status) { if (status.okay) { var msg = "Okay"; var color = [255, 0, 0, 0]; } else { var msg = "Blocked"; var color = [0, 255, 0, 0]; } document.getElementById("status").innerText = msg; chrome.browserAction.setBadgeText({text: msg}); chrome.browserAction.setBadgeColor({color: color}); }, requestStatus: function() { var user = localStorage['moochLogin']; if (!user) { document.getElementById("status").innerText = "Please, set user login on options page"; return; } var xhr = new XMLHttpRequest(); xhr.open("GET", "http://mooch.co.vu:5000/status/" + user, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { var status = JSON.parse(xhr.responseText); MoochSentinel.render(status); } } xhr.send(); } } document.addEventListener("DOMContentLoaded", function() { MoochSentinel.requestStatus(); });
Print status at the extension's badge
Print status at the extension's badge
JavaScript
mit
asivokon/mooch-sentinel,asivokon/mooch-sentinel,asivokon/mooch-sentinel,asivokon/mooch-sentinel
8be3fbee9a972a580058973ec7860d10492db38e
lib/asset.js
lib/asset.js
var fs = require('fs'), __bind = require('./helpers').bindFunctionToScope, escapeRegExp = require('./helpers').escapeRegExp, AssetDirectives = require('./asset_directives').AssetDirectives; /* * @class Asset */ exports.Asset = (function () { function Asset ( file_path, directory ) { /* * Initialize instance variables */ if ( !fs.existsSync( file_path ) || !fs.statSync( file_path ).isFile() ) { throw new Error( "Invalid file path: " + JSON.stringify( file_path ) ); } this.directory = directory; this.dir_path = directory.path; this.path = file_path; // `name` is the path relative to the asset root minus the file extension relative_path = file_path.replace(new RegExp("^" + escapeRegExp( directory.root.path ) + "/?"), '') this.name = relative_path.replace(/(\/?[^.]+)\..*$/, "$1") this.directives = new AssetDirectives( this ); /* * Bind scope of instance methods */ this.isAssetDirectory = __bind( this.isAssetDirectory, this ); /* * Return instance */ return this; } Asset.prototype.isAssetDirectory = function () { return false; } return Asset; })();
var fs = require('fs'), __bind = require('./helpers').bindFunctionToScope, escapeRegExp = require('./helpers').escapeRegExp, AssetDirectives = require('./asset_directives').AssetDirectives; /* * @class Asset */ exports.Asset = (function () { function Asset ( file_path, directory ) { /* * Initialize instance variables */ if ( !fs.existsSync( file_path ) || !fs.statSync( file_path ).isFile() ) { throw new Error( "Invalid file path: " + JSON.stringify( file_path ) ); } this.directory = directory; this.dir_path = directory.path; this.path = file_path; // `name` is the path relative to the asset root minus the file extension relative_path = file_path.replace(new RegExp("^" + escapeRegExp( directory.root.path ) + "/?"), '') this.name = relative_path.replace(/(\/?[^.]+)\..*$/, "$1") this.mapping = directory.mapping; this.directives = new AssetDirectives( this ); /* * Bind scope of instance methods */ this.isAssetDirectory = __bind( this.isAssetDirectory, this ); /* * Return instance */ return this; } Asset.prototype.isAssetDirectory = function () { return false; } return Asset; })();
Add Asset mapping property (inherits from directory.mapping)
Add Asset mapping property (inherits from directory.mapping)
JavaScript
bsd-3-clause
jvatic/node-assets
87122e3056721999402f8b7cc9408b86de4719b1
client/src/utils/index.js
client/src/utils/index.js
export function diffObjects(prev, cur) { let newValues = Object.assign({}, prev, cur); let diff = {}; for (const [key, value] of Object.entries(newValues)) { if (prev[key] !== value) { diff[key] = value; } } return diff; } export function cloneObject(obj) { return Object.assign({}, obj); }
import React from 'react'; import { FormGroup, ControlLabel, FormControl, Col } from 'react-bootstrap'; export function diffObjects(prev, cur) { let newValues = Object.assign({}, prev, cur); let diff = {}; for (const [key, value] of Object.entries(newValues)) { if (prev[key] !== value) { diff[key] = value; } } return diff; } export function cloneObject(obj) { return Object.assign({}, obj); } export function FieldGroup({ id, label, ...props }) { return ( <FormGroup controlId={id}> <Col componentClass={ControlLabel} md={4}>{label}</Col> <Col md={6}><FormControl {...props} /></Col> </FormGroup> ); }
Add method to render label + input
Add method to render label + input
JavaScript
mit
DjLeChuck/recalbox-manager,DjLeChuck/recalbox-manager,DjLeChuck/recalbox-manager
8b172631f2960b85d936f3b2c6b6e0c05b476830
lib/index.js
lib/index.js
var fs = require('fs') var documents = {} module.exports = { init: (config, callback) => { var directories = fs.readdirSync('.') if (directories.indexOf(config.directory) === -1) { fs.mkdirSync(config.directory) config.documents.forEach(document => { fs.writeFileSync(`${config.directory}/${document}.db`, '{}') documents[document] = {} }) return true } config.documents.forEach(document => { if (!fs.existsSync(`${config.directory}/${document}.db`)) { fs.writeFileSync(`${config.directory}/${document}.db`, '{}') } var file = fs.readFileSync(`${config.directory}/${document}.db`) documents[document] = JSON.parse(file.toString()) }) var keys = Object.keys(documents) setInterval(() => { keys.forEach((key) => { fs.writeFile(`${config.directory}/${key}.db`, JSON.stringify(documents[key]), (err) => { if (err) console.log(err) }) }) }, 10000) return true }, get: (document, key) => { return documents[document][key] }, set: (document, key, value) => { documents[document][key] = value return true }, test: () => { // console.log('test') } }
var fs = require('fs') var documents = {} module.exports = { init: (config, callback) => { var directories = fs.readdirSync('.') if (directories.indexOf(config.directory) === -1) { fs.mkdirSync(config.directory) config.documents.forEach(document => { fs.writeFileSync(`${config.directory}/${document}.db`, '{}') documents[document] = {} }) return true } config.documents.forEach(document => { if (!fs.existsSync(`${config.directory}/${document}.db`)) { fs.writeFileSync(`${config.directory}/${document}.db`, '{}') } var file = fs.readFileSync(`${config.directory}/${document}.db`) documents[document] = JSON.parse(file.toString()) }) if (config.save !== false) { var keys = Object.keys(documents) setInterval(() => { keys.forEach((key) => { fs.writeFile(`${config.directory}/${key}.db`, JSON.stringify(documents[key]), (err) => { if (err) console.log(err) }) }) }, config.save) } return true }, get: (document, key) => { return documents[document][key] }, set: (document, key, value) => { documents[document][key] = value return true }, test: () => { // console.log('test') } }
Save parameter in init function
Save parameter in init function
JavaScript
mit
ItsJimi/store-data
edcb529531029187b2a3a001fa2c631fd9693316
lib/index.js
lib/index.js
"use strict"; var sass = require("node-sass"); var through = require("through"); var path = require("path"); var extend = require('util')._extend; module.exports = function (fileName, globalOptions) { if (!/(\.scss|\.css)$/i.test(fileName)) { return through(); } var inputString = ""; return through( function (chunk) { inputString += chunk; }, function () { var options, css, moduleBody; // new copy of globalOptions for each file options = extend({}, globalOptions || {}); options.includePaths = extend([], (globalOptions ? globalOptions.includePaths : {}) || []); options.data = inputString; options.includePaths.unshift(path.dirname(fileName)); try { css = sass.renderSync(options); } catch (err) { this.emit('error', err); return; } var escapedCSS = JSON.stringify(css) moduleBody = "var css = " + escapedCSS + ";" + "(require('sassify'))(css); module.exports = css;"; this.queue(moduleBody); this.queue(null); } ); };
"use strict"; var sass = require("node-sass"); var through = require("through"); var path = require("path"); var extend = require('util')._extend; module.exports = function (fileName, globalOptions) { if (!/(\.scss|\.css)$/i.test(fileName)) { return through(); } var inputString = ""; return through( function (chunk) { inputString += chunk; }, function () { var options, css, moduleBody; // new copy of globalOptions for each file options = extend({}, globalOptions || {}); options.includePaths = extend([], (globalOptions ? globalOptions.includePaths : {}) || []); // Resolve include paths to baseDir if(options.baseDir) { options.includePaths = options.includePaths.map(function (p) { return path.dirname(path.resolve(options.baseDir, p)); }); } options.data = inputString; options.includePaths.unshift(path.dirname(fileName)); try { css = sass.renderSync(options); } catch (err) { this.emit('error', err); return; } var escapedCSS = JSON.stringify(css) moduleBody = "var css = " + escapedCSS + ";" + "(require('sassify'))(css); module.exports = css;"; this.queue(moduleBody); this.queue(null); } ); };
Handle baseDir option to resolve include paths before rendering;
Handle baseDir option to resolve include paths before rendering;
JavaScript
mit
davidguttman/sassify,oncletom/sassify
9d098f474ea4b39133d4ce422e725519498339c6
js/menu.js
js/menu.js
(function() { 'use strict'; program.prompt([ 'Hello—I\'m Prompt.' ]); }());
(function() { 'use strict'; const stdin = document.getElementById('stdin'); let lastKey; program.scrollBottom(); setTimeout(() => { program.prompt([ 'Hello—I\'m Prompt.' ]); setTimeout(() => { program.prompt([ 'I don\'t do anything yet, so you can send me messages and I won\'t reply to you!' ]); }, 1500); }, 1000); function finalMsg () { const e = event; const code = e.keyCode || e.which; if (lastKey !== 13) { if (code === 13) { // Enter keycode setTimeout(() => { if (program.history.length === 1) { setTimeout(() => { program.prompt([ 'Actually, I do keep scrolling when you return things, but that\'s it.' ]); }, 600); } else if (program.history.length === 2) { setTimeout(() => { program.prompt([ 'Have fun typing to no one.' ]); }, 600); } }, 50); } } lastKey = code; } stdin.addEventListener('keyup', finalMsg ); }());
Add personality (like a homepage)
Add personality (like a homepage)
JavaScript
mit
jsejcksn/prompt,jsejcksn/prompt
a73231ebed92a3f5409d033e59e9af20816e35b2
Gruntfile.js
Gruntfile.js
var path = require("path"); module.exports = function (grunt) { grunt.loadNpmTasks('grunt-gitbook'); grunt.loadNpmTasks('grunt-gh-pages'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.initConfig({ 'gitbook': { development: { input: "./", github: "daikeren/django_tutorial" } }, 'gh-pages': { options: { base: '_book', silent: true }, src: ['**'] }, 'clean': { files: '.grunt' } }); grunt.registerTask('publish', [ 'gitbook', 'gh-pages', 'clean' ]); grunt.registerTask('default', 'gitbook'); };
var path = require("path"); module.exports = function (grunt) { grunt.loadNpmTasks('grunt-gitbook'); grunt.loadNpmTasks('grunt-gh-pages'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.initConfig({ 'gitbook': { development: { input: "./", github: "daikeren/django_tutorial" } }, 'gh-pages': { options: { base: '_book' }, src: ['**'] }, 'clean': { files: '.grunt' } }); grunt.registerTask('publish', [ 'gitbook', 'gh-pages', 'clean' ]); grunt.registerTask('default', 'gitbook'); };
Remove silence to see what happen...
Remove silence to see what happen...
JavaScript
mit
daikeren/django_tutorial
c21952e22109bc466cadf821bad3e3988b5653e7
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { var allSassFiles = []; var path = require('path'); grunt.file.recurse( "./stylesheets/", function(abspath, rootdir, subdir, filename) { if (filename.match(/\.scss/)) { allSassFiles.push("@import '" + abspath + "';"); } } ); grunt.file.write( "./spec/stylesheets/test.scss", allSassFiles.join("\n") ); grunt.initConfig({ clean: { sass: ["spec/stylesheets/test*css"] }, jasmine: { javascripts: { src: [ 'node_modules/jquery-browser/lib/jquery.js', 'javascripts/**/*.js' ], options: { specs: 'spec/unit/*Spec.js', helpers: 'spec/unit/*Helper.js' } } }, sass: { development: { files: { './spec/stylesheets/test-out.css': './spec/stylesheets/test.scss' }, options: { loadPath: [ './stylesheets' ], style: 'nested', } }, } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.registerTask('test', ['sass', 'clean', 'jasmine']); grunt.registerTask('default', ['test']); };
module.exports = function(grunt) { var allSassFiles = []; var path = require('path'); grunt.file.recurse( "./stylesheets/", function(abspath, rootdir, subdir, filename) { if(typeof subdir !== 'undefined'){ var relpath = subdir + '/' + filename; } else { var relpath = filename; } if (filename.match(/\.scss/)) { allSassFiles.push("@import '" + relpath + "';"); } } ); grunt.file.write( "./spec/stylesheets/test.scss", allSassFiles.join("\n") ); grunt.initConfig({ clean: { sass: ["spec/stylesheets/test*css"] }, jasmine: { javascripts: { src: [ 'node_modules/jquery-browser/lib/jquery.js', 'javascripts/**/*.js' ], options: { specs: 'spec/unit/*Spec.js', helpers: 'spec/unit/*Helper.js' } } }, sass: { development: { files: { './spec/stylesheets/test-out.css': './spec/stylesheets/test.scss' }, options: { loadPath: [ './stylesheets' ], style: 'nested', } }, } }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.registerTask('test', ['sass', 'clean', 'jasmine']); grunt.registerTask('default', ['test']); };
Make `@import` paths relative to `./stylesheets`
Make `@import` paths relative to `./stylesheets` The Load path is set to `govuk_frontend_toolkit/stylesheets` so having the `@import` paths relative to `govuk_frontend_toolkit` is breaking the tests.
JavaScript
mit
quis/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,quis/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit,TFOH/govuk_frontend_toolkit,alphagov/govuk_frontend_toolkit
c4273c8ba589e57a36e1023229b229ee79c66e92
lib/App.js
lib/App.js
/* * boilerplate-redux-react * * Copyright(c) 2015 André König <andre.koenig@posteo.de> * MIT Licensed * */ /** * @author André König <andre.koenig@posteo.de> * */ import React, {Component} from 'react'; import {Provider} from 'react-redux'; import {createStore} from './store'; import {Welcome} from './containers'; const store = createStore(); class App extends Component { render() { return ( <Provider store={store}> <Welcome /> </Provider> ); } } export default App;
/* * boilerplate-redux-react * * Copyright(c) 2015 André König <andre.koenig@posteo.de> * MIT Licensed * */ /** * @author André König <andre.koenig@posteo.de> * */ import React from 'react'; import {Provider} from 'react-redux'; import {createStore} from './store'; import {Welcome} from './containers'; const store = createStore(); export default () => <Provider store={store}> <Welcome /> </Provider>;
Convert app component to function
[TASK] Convert app component to function
JavaScript
mit
akoenig/boilerplate-redux-react,akoenig/boilerplate-redux-react
028d511f2f663685999c8d6a7bbcb9ff5af865e9
library.js
library.js
"use strict"; var user = module.parent.require('./user'), db = module.parent.require('./database'), plugin = {}; plugin.init = function(params, callback) { var app = params.router, middleware = params.middleware, controllers = params.controllers; app.get('/admin/custom-topics', middleware.admin.buildHeader, renderAdmin); app.get('/api/admin/custom-topics', renderAdmin); callback(); }; plugin.addAdminNavigation = function(header, callback) { header.plugins.push({ route: '/custom-topics', icon: 'fa-tint', name: 'Custom Topics' }); callback(null, header); }; plugin.onTopicCreate = function(data, callback) { console.log("Topic created!"); // data.topic, this is the topic that will be saved to the database // data.data, this is the data that is submitted from the client side // Now all you have to do is validate `data.myCustomField` and set it in data.topic. if (data.data.age) { data.topic.age = data.data.age; } console.dir(data); callback(null, data); }; function renderAdmin(req, res, next) { res.render('admin/custom-topics', {}); } module.exports = plugin;
"use strict"; var user = module.parent.require('./user'), db = module.parent.require('./database'), plugin = {}; plugin.init = function(params, callback) { var app = params.router, middleware = params.middleware, controllers = params.controllers; app.get('/admin/custom-topics', middleware.admin.buildHeader, renderAdmin); app.get('/api/admin/custom-topics', renderAdmin); callback(); }; plugin.addAdminNavigation = function(header, callback) { header.plugins.push({ route: '/custom-topics', icon: 'fa-tint', name: 'Custom Topics' }); callback(null, header); }; plugin.onTopicCreate = function(data, callback) { console.log("Topic created!"); // data.topic, this is the topic that will be saved to the database // data.data, this is the data that is submitted from the client side // Now all you have to do is validate `data.myCustomField` and set it in data.topic. if (data.data.age) { data.data.content += '<b>Age: </b>' + data.data.age + '</br>'; } console.dir(data); callback(null, data); }; function renderAdmin(req, res, next) { res.render('admin/custom-topics', {}); } module.exports = plugin;
Add ‘age’ to post content
Add ‘age’ to post content
JavaScript
bsd-2-clause
btw6391/nodebb-plugin-custom-topics
86d0647a7daece3a28919b60ce71ea25bba6da4c
src/js/main.js
src/js/main.js
import * as Backbone from 'backbone'; import AppRouter from './routers/app-router'; let router = new AppRouter(); Backbone.history.start({pushState: true});
import * as Backbone from 'backbone'; import AppRouter from './routers/app-router'; new AppRouter(); Backbone.history.start({pushState: true});
Remove unused variable name for router
Remove unused variable name for router
JavaScript
mit
trevormunoz/katherine-anne,trevormunoz/katherine-anne,trevormunoz/katherine-anne
2b5eaa2603849fb41838621fdc274e9c22f11dad
webpack.config.js
webpack.config.js
var path = require('path'); module.exports = { entry: './index.js', output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" } ] } };
var path = require('path'); module.exports = { entry: './index.js', output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.scss$/, loaders: ['style', 'css', 'sass'], } ] }, sassLoader: { includePath: [path.resolve(__dirname, './styles')] } };
Add scss loader to webpack
Add scss loader to webpack
JavaScript
mit
dotKom/glowing-fortnight,dotKom/glowing-fortnight
2b245f47e110f4191cd394e32a7933ffc991152f
assets/javascripts/toc.js
assets/javascripts/toc.js
$(document).ready(function() { var $toc = $('#toc'); function format (title) { var $title = $(title), txt = $title.text(), id = $title.attr('id'); return "<li> <a href=#" + id + ">" + txt + "</a></li>"; } // return; if($toc.length) { var $h3s = $('.container .col-md-9 :header'); var titles = $h3s.map(function () { return format(this); }).get().join(''); $toc.html(titles); } $("#toc").affix(); });
$(document).ready(function() { var $toc = $('#toc'); function format (item) { if (item.children && item.children.length > 0) { return "<li> <a href=#" + item.id + ">" + item.title + "</a><ul class='nav'>" + item.children.map(format).join('') + "</ul></li>"; } else { return "<li> <a href=#" + item.id + ">" + item.title + "</a></li>"; } } // return; if($toc.length) { var $h3s = $('.container .col-md-9 :header'); var tocTree = []; var lastRoot; $h3s.each(function(i, el) { var $el = $(el); var id = $el.attr('id'); var title = $el.text(); var depth = parseInt($el.prop("tagName")[1]); if(depth > 3) return; if (lastRoot && depth > lastRoot.depth) { lastRoot.children.push({id: id, title: title }); } else { lastRoot = {depth: depth, title: title, id: id, children: []}; tocTree.push(lastRoot); } }); var titles = tocTree.map(format).join(''); $toc.html(titles); } $("#toc").affix(); $('#side-navigation').on('activate.bs.scrollspy', function (e) { var parent = $(e.target).parent().parent()[0]; if (parent.tagName == "LI") { $(parent).addClass("active") } }) });
Fix problem with TOC and nested tags
Fix problem with TOC and nested tags
JavaScript
epl-1.0
jbtv/sparkling,chrisbetz/sparkling,cswaroop/sparkling,cswaroop/sparkling,gorillalabs/sparkling,chrisbetz/sparkling,antonoal/sparkling,chrisbetz/sparkling,cswaroop/sparkling,jbtv/sparkling,gorillalabs/sparkling,gorillalabs/sparkling,antonoal/sparkling,jbtv/sparkling,gorillalabs/sparkling,antonoal/sparkling,chrisbetz/sparkling,jbtv/sparkling,gorillalabs/sparkling,cswaroop/sparkling,antonoal/sparkling
4f906a4c1713ec52e27f3b499d7893642e51af02
analytics_dashboard/static/apps/learners/app/router.js
analytics_dashboard/static/apps/learners/app/router.js
define(function (require) { 'use strict'; var Marionette = require('marionette'), LearnersRouter; LearnersRouter = Marionette.AppRouter.extend({ // Routes intended to show a page in the app should map to method names // beginning with "show", e.g. 'showLearnerRosterPage'. appRoutes: { '(/)(?*queryString)': 'showLearnerRosterPage', ':username(/)(?*queryString)': 'showLearnerDetailPage', '*notFound': 'showNotFoundPage' }, onRoute: function (routeName) { if (routeName.indexOf('show') === 0) { this.options.controller.triggerMethod('showPage'); } }, initialize: function (options) { this.options = options || {}; this.learnerCollection = options.controller.options.learnerCollection; this.listenTo(this.learnerCollection, 'sync', this.updateUrl); Marionette.AppRouter.prototype.initialize.call(this, options); }, // Called on LearnerCollection update. Converts the state of the collection (including any filters, searchers, // sorts, or page numbers) into a url and then navigates the router to that url. updateUrl: function () { this.navigate(this.learnerCollection.getQueryString()); }, }); return LearnersRouter; });
define(function (require) { 'use strict'; var Marionette = require('marionette'), LearnersRouter; LearnersRouter = Marionette.AppRouter.extend({ // Routes intended to show a page in the app should map to method names // beginning with "show", e.g. 'showLearnerRosterPage'. appRoutes: { '(/)(?*queryString)': 'showLearnerRosterPage', ':username(/)(?*queryString)': 'showLearnerDetailPage', '*notFound': 'showNotFoundPage' }, onRoute: function (routeName) { if (routeName.indexOf('show') === 0) { this.options.controller.triggerMethod('showPage'); } }, initialize: function (options) { this.options = options || {}; this.learnerCollection = options.controller.options.learnerCollection; this.listenTo(this.learnerCollection, 'sync', this.updateUrl); Marionette.AppRouter.prototype.initialize.call(this, options); }, // Called on LearnerCollection update. Converts the state of the collection (including any filters, searchers, // sorts, or page numbers) into a url and then navigates the router to that url. updateUrl: function () { this.navigate(this.learnerCollection.getQueryString(), {replace: true}); }, }); return LearnersRouter; });
Replace browser history on roster filter update
Replace browser history on roster filter update
JavaScript
agpl-3.0
edx/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard
850d0f710336b0bdc91ca5d3440aaa8d499dc7ac
src/plugins.js
src/plugins.js
if (process.env.NODE_ENV !== 'production') { // we're importing script and styles from given plugin // this method should be only used in development // for production specify your plugin in package.json require('epl-plugin/dev'); require('epl-plugin/dev/style.css'); // add plugins in development mode here // require('epl-plugin/dev'); // require('epl-plugin/dev/style.css'); } // plugin handlers const plugins = Object.keys(window) .filter(key => { return key.match(/^__EPL_/); }) .map(key => console.log('Loaded:', key.replace('__EPL_', '')) || window[key]); console.log(plugins); export default plugins;
if (process.env.NODE_ENV !== 'production') { // we're importing script and styles from given plugin // this method should be only used in development // for production specify your plugin in package.json // require('epl-plugin/dev'); // require('epl-plugin/dev/style.css'); } // plugin handlers const plugins = Object.keys(window) .filter(key => { return key.match(/^__EPL_/); }) .map(key => console.log('Loaded:', key.replace('__EPL_', '')) || window[key]); console.log(plugins); export default plugins;
Remove epl-plugin in development mode
Remove epl-plugin in development mode
JavaScript
apache-2.0
mkacper/erlangpl,Baransu/erlangpl,erlanglab/erlangpl-ui,Hajto/erlangpl,erlanglab/erlangpl,Baransu/erlangpl,erlanglab/erlangpl,Hajto/erlangpl,Hajto/erlangpl,mkacper/erlangpl,erlanglab/erlangpl-ui,erlanglab/erlangpl,Baransu/erlangpl,mkacper/erlangpl
dbcec2cbd00580ac81a3c3b9340da7cafb895928
next.config.js
next.config.js
const { join } = require('path') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') module.exports = { webpack: function (config, { dev }) { if (!dev) { config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false, reportFilename: join(__dirname, 'reports/bundles.html'), defaultSizes: 'gzip' })) } return config } }
const webpack = require('webpack') const { join } = require('path') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') module.exports = { webpack: function (config, { dev }) { config.plugins.push( new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /fr/) ) if (!dev) { config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false, reportFilename: join(__dirname, 'reports/bundles.html'), defaultSizes: 'gzip' })) } return config } }
Remove useless locales from moment
Remove useless locales from moment
JavaScript
mit
sgmap/inspire,sgmap/inspire
6b9bfebcb7dd5759b19451a2f99a816388c86dfc
vector_2d.js
vector_2d.js
// Copyright 2013, odanielson@github.com // MIT-license var Norm = function(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); } var Normalize = function(v) { var norm = Norm(v); return [v[0] / norm, v[1] / norm]; } var Subtract = function(a, b) { return [a[0] - b[0], a[1] - b[1]]; } var Add = function(a, b) { return [a[0] + b[0], a[1] + b[1]]; } var Multiply = function(v, k) { return [v[0] * k, v[1] * k]; } var ComplexMultiply = function(v1, v2) { return [ (v1[0] * v2[0]) - (v1[1] * v2[1]), (v1[0] * v2[1]) + (v2[0] * v1[1]) ]; } var RotateLeft = function(v) { return ComplexMultiply(v, [0,-1]); }
// https://github.com/odanielson/vector_2d.js // Copyright 2013, odanielson@github.com // MIT-license var Norm = function(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); } var Normalize = function(v) { var norm = Norm(v); return [v[0] / norm, v[1] / norm]; } var Subtract = function(a, b) { return [a[0] - b[0], a[1] - b[1]]; } var Add = function(a, b) { return [a[0] + b[0], a[1] + b[1]]; } var Multiply = function(v, k) { return [v[0] * k, v[1] * k]; } var ComplexMultiply = function(v1, v2) { return [ (v1[0] * v2[0]) - (v1[1] * v2[1]), (v1[0] * v2[1]) + (v2[0] * v1[1]) ]; } var RotateLeft = function(v) { return ComplexMultiply(v, [0,-1]); }
Add git src at top.
Add git src at top.
JavaScript
mit
odanielson/vector_2d.js
d383cf564507d9b6c166f56321527e46b2fd732e
routes/index.js
routes/index.js
var express = require('express'), router = express.Router(), bcrypt = require('bcrypt'), db = require('../models/db'), index = {}; index.all = function(oauth){ /* GET home page. */ router.get('/', oauth.authorise(), function(req, res) { res.render('index', { title: 'Express' }); }); return router; }; module.exports = index;
var express = require('express'), router = express.Router(), bcrypt = require('bcrypt'), db = require('../models/db'), index = {}; index.all = function(oauth){ /* GET home page. */ router.get('/', oauth.authorise(), function(req, res) { res.render('index', { title: 'Express' }); }); /* GET Register new user redirects to users/new. */ router.get('/register', function(req, res) { res.redirect('/users/new'); }); return router; }; module.exports = index;
Add /register route to redirect to users/new
Add /register route to redirect to users/new
JavaScript
apache-2.0
tessel/oauth,tessel/oauth,tessel/oauth
75aabb93187c47d412f415f50671d72ea54ecbd6
app/views/lib/Charts/CanvasChart/__tests__/CanvasChart.spec.js
app/views/lib/Charts/CanvasChart/__tests__/CanvasChart.spec.js
import expect from 'expect'; import I from 'immutable'; import {Note} from '../../../../../reducers/chart'; import {NOTE_HEIGHT} from '../..//constants'; import { WIDTH, HEIGHT, renderNotes, } from '../'; class MockContext { constructor() { this.canvas = { width: WIDTH, height: HEIGHT, }; this.fillRect = expect.createSpy(); this.strokeRect = expect.createSpy(); } } describe('<CanvasChart>', () => { it('renders notes on the judgement line when the scroll offset matches the note offset', () => { const offsetPositionYPercent = 0.9; const offset = 20 * 24 + 12; const note = new Note({ col: 0, totalOffset: offset, }); const ctx = new MockContext(); const offsetBarY = (1 - offsetPositionYPercent) * HEIGHT; renderNotes(ctx, { notes: I.Set([note]), beatSpacing: 160, offset, offsetBarY, }); expect(ctx.fillRect.calls.length).toEqual(1); expect(ctx.fillRect.calls[0].arguments[1]).toEqual(offsetBarY - (NOTE_HEIGHT / 2)); }); });
import expect from 'expect'; import I from 'immutable'; import {Note} from '../../../../../reducers/chart'; import {NOTE_HEIGHT} from '../../constants'; import {playerColors} from '../../../../../config/constants'; import { WIDTH, HEIGHT, renderNotes, } from '../'; class MockContext { constructor() { this.canvas = { width: WIDTH, height: HEIGHT, }; this.fillRect = expect.createSpy(); this.strokeRect = expect.createSpy(); } } describe('<CanvasChart>', () => { it('renders notes on the judgement line when the scroll offset matches the note offset', () => { const offsetPositionYPercent = 0.9; const offset = 20 * 24 + 12; const note = new Note({ col: 0, totalOffset: offset, }); const ctx = new MockContext(); const offsetBarY = (1 - offsetPositionYPercent) * HEIGHT; renderNotes(ctx, { colors: playerColors, notes: I.Set([note]), beatSpacing: 160, offset, offsetBarY, }); expect(ctx.fillRect.calls.length).toEqual(1); expect(ctx.fillRect.calls[0].arguments[1]).toEqual(offsetBarY - (NOTE_HEIGHT / 2)); }); });
Fix canvas chart test missing colors
Fix canvas chart test missing colors
JavaScript
mit
thomasboyt/bipp,thomasboyt/bipp
1e2295629b93eb5a3fec43541afe31dfeca417b2
public/script.js
public/script.js
function init() { test(); } function test() { const divObject = document.getElementById('content'); // create database reference const dbRefObject = firebase.database().ref().child('object'); // sync object data dbRefObject.on('value', snap => console.log(snap.val())); }
function init() { test(); } function test() { const divObject = document.getElementById('content'); // create database reference const dbRefObject = firebase.database().ref().child('object'); // sync object data dbRefObject.on('value', snap => { divObject.innerHTML = JSON.stringify(snap.val(), null, 3); }); }
Write object data to div element as a JSON string.
Write object data to div element as a JSON string.
JavaScript
apache-2.0
googleinterns/step14-2020,googleinterns/step14-2020,googleinterns/step14-2020,googleinterns/step14-2020
36e5b580ba633a978ee24c92b70b170deee83d5c
client/templates/bookmark/bookmarks_list.js
client/templates/bookmark/bookmarks_list.js
Template.bookmarksList.helpers({ bookmarks: function() { if (Meteor.user()) { var searchTags = document.getElementById("tagSearch").value; if (searchTags != undefined) { return Bookmarks.find({ tags: searchTags }, { sort: { dateCreated: -1 } }) } else { return (Bookmarks.find({ userId: Meteor.user()._id })) } } } });
Template.bookmarksList.helpers({ bookmarks: function() { if (Meteor.user()) { return (Bookmarks.find({ userId: Meteor.user()._id })) } } });
Fix bug of the last commit
Fix bug of the last commit
JavaScript
mit
blumug/georges,blumug/georges,blumug/georges
83442c6ae8861702fdc49e286dd0afd4f8e86cf5
species-explorer/app/services/species.service.js
species-explorer/app/services/species.service.js
/* global angular */ angular .module('speciesApp') .factory('SpeciesService', [ 'API_BASE_URL', '$resource', SpeciesService ]) function SpeciesService (API_BASE_URL, $resource) { return $resource( API_BASE_URL, null, { getKingdoms: { method: 'GET', isArray: false, params: { op: 'getkingdomnames' } }, getClasses: { method: 'GET', isArray: false, params: { op: 'getclassnames' } } } ) }
/* global angular */ angular .module('speciesApp') .factory('SpeciesService', [ 'API_BASE_URL', '$resource', SpeciesService ]) function SpeciesService (API_BASE_URL, $resource) { return $resource( API_BASE_URL, null, { getKingdoms: { method: 'GET', isArray: false, params: { op: 'getkingdomnames' } }, getClasses: { method: 'GET', isArray: false, params: { op: 'getclassnames' } }, getFamilies: { method: 'GET', isArray: false, params: { op: 'getfamilynames' } } } ) }
Add an action to get family names by class and kingdom
Add an action to get family names by class and kingdom
JavaScript
mit
stivaliserna/scripts,stivaliserna/scripts
237db234a37b364a4271b9d87687985af0a11acc
server/index.js
server/index.js
// Main starting point of the application const express = require('express'); const path = require('path') const http = require('http'); const bodyParser = require('body-parser'); const morgan = require('morgan'); const app = express(); const router = require('./router'); const mongoose = require('mongoose'); const cors = require('cors'); // DB Setup mongoose.connect('mongodb://localhost:auth/auth'); // App Setup app.use(morgan('combined')); app.use(cors()); app.use(express.static(path.resolve(__dirname, '..', 'build'))); app.use(bodyParser.json({ limit: '5mb' })); app.use(bodyParser.urlencoded({ limit: '5mb', extended: true })); router(app); // Server Setup const port = process.env.PORT || 3090; const server = http.createServer(app); server.listen(port); console.log('Server listening on:', port);
// Main starting point of the application const express = require('express'); const path = require('path') const http = require('http'); const bodyParser = require('body-parser'); const morgan = require('morgan'); const app = express(); const router = require('./router'); const mongoose = require('mongoose'); const cors = require('cors'); // DB Setup mongoose.connect(process.env.MONGODB_URI); // App Setup app.use(morgan('combined')); app.use(cors()); app.use(express.static(path.resolve(__dirname, '..', 'build'))); app.use(bodyParser.json({ limit: '5mb' })); app.use(bodyParser.urlencoded({ limit: '5mb', extended: true })); router(app); // Server Setup const port = process.env.PORT || 3090; const server = http.createServer(app); server.listen(port); console.log('Server listening on:', port);
Change mongodb uri to be an env var.
Change mongodb uri to be an env var.
JavaScript
apache-2.0
ryanthomas30/AudioNimbus,ryanthomas30/AudioNimbus
00cbe3a1649cb06d07157384ec5e9fbd52dfc2aa
server/index.js
server/index.js
require('babel-core/register'); require('dotenv').load(); const serverConfig = require('./config'); // To ignore webpack custom loaders on server. serverConfig.webpackStylesExtensions.forEach((ext) => { require.extensions[`.${ext}`] = () => {}; }); require('./main');
require('babel-core/register'); const path = require('path'); require('dotenv').load({ path: path.resolve(__dirname, '../.env') }); const serverConfig = require('./config'); // To ignore webpack custom loaders on server. serverConfig.webpackStylesExtensions.forEach((ext) => { require.extensions[`.${ext}`] = () => {}; }); require('./main');
Use absolute path to .env file just in case
Use absolute path to .env file just in case
JavaScript
mit
fastmonkeys/respa-ui
a363aecf61ea49d67c3e3f74baa949e7e3e9f458
src/plots/frame_attributes.js
src/plots/frame_attributes.js
/** * Copyright 2012-2021, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; module.exports = { _isLinkedToArray: 'frames_entry', group: { valType: 'string', description: [ 'An identifier that specifies the group to which the frame belongs,', 'used by animate to select a subset of frames.' ].join(' ') }, name: { valType: 'string', description: 'A label by which to identify the frame' }, traces: { valType: 'any', description: [ 'A list of trace indices that identify the respective traces in the', 'data attribute' ].join(' ') }, baseframe: { valType: 'string', description: [ 'The name of the frame into which this frame\'s properties are merged', 'before applying. This is used to unify properties and avoid needing', 'to specify the same values for the same properties in multiple frames.' ].join(' ') }, data: { valType: 'any', role: 'object', description: [ 'A list of traces this frame modifies. The format is identical to the', 'normal trace definition.' ].join(' ') }, layout: { valType: 'any', role: 'object', description: [ 'Layout properties which this frame modifies. The format is identical', 'to the normal layout definition.' ].join(' ') } };
/** * Copyright 2012-2021, Plotly, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; module.exports = { _isLinkedToArray: 'frames_entry', group: { valType: 'string', description: [ 'An identifier that specifies the group to which the frame belongs,', 'used by animate to select a subset of frames.' ].join(' ') }, name: { valType: 'string', description: 'A label by which to identify the frame' }, traces: { valType: 'any', description: [ 'A list of trace indices that identify the respective traces in the', 'data attribute' ].join(' ') }, baseframe: { valType: 'string', description: [ 'The name of the frame into which this frame\'s properties are merged', 'before applying. This is used to unify properties and avoid needing', 'to specify the same values for the same properties in multiple frames.' ].join(' ') }, data: { valType: 'any', description: [ 'A list of traces this frame modifies. The format is identical to the', 'normal trace definition.' ].join(' ') }, layout: { valType: 'any', description: [ 'Layout properties which this frame modifies. The format is identical', 'to the normal layout definition.' ].join(' ') } };
Revert "revert data and layout role to be object"
Revert "revert data and layout role to be object" This reverts commit 655508a7309da2bd89265c1ab469bae7034a56a4.
JavaScript
mit
plotly/plotly.js,plotly/plotly.js,plotly/plotly.js,etpinard/plotly.js,etpinard/plotly.js,plotly/plotly.js,etpinard/plotly.js
28a1190d8232a73ada8da4f4b6d25658d71c74e0
update.local.js
update.local.js
var fs = require('fs'); var moment = require('moment'); var rank = require('librank').rank; // data backup path var data_path = "./data/talks/"; // read all files in the database var res = fs.readdirSync(data_path); // current timestamp var now = moment(); // calculate difference of hours between two timestamps function countHours(start, end) { var duration = moment.duration(end.diff(start)); var hours = duration.asHours(); return hours; } // calculate ranking for all elements in the database res.forEach(function(element) { // full fs file path var talk_path = data_path + element; // get its data var talk = require(talk_path); // points var points = talk.voteCount + 1; // hours var hours = countHours(talk.created, now); // gravity var gravity = 1.8; // ranking calculation var score = rank.rank(points, hours, gravity); console.log(score, " - ", talk.title); });
var fs = require('fs'); var moment = require('moment'); var rank = require('librank').rank; // data backup path var data_path = "./data/talks/"; // read all files in the database var res = fs.readdirSync(data_path); // current timestamp var now = moment(); // calculate difference of hours between two timestamps function countHours(start, end) { var duration = moment.duration(end.diff(start)); var hours = duration.asHours(); return hours; } // calculate ranking for all elements in the database res.forEach(function(element) { /* // full fs file path var talk_path = data_path + element; // get its data var talk = require(talk_path); // points var points = talk.voteCount + 1; // hours var hours = countHours(talk.created, now); // gravity var gravity = 1.8; // ranking calculation var score = rank.rank(points, hours, gravity); console.log(score, " - ", talk.title); */ });
Remove logic on update remote
Remove logic on update remote
JavaScript
mit
tlksio/db
262c982ce8734ce52df072a0ad536365d6f68924
js/copy.js
js/copy.js
$(function () { ZeroClipboard.config({swfPath: $('[data-swf-path]').data('swf-path')}); $('pre').each(function () { if (!$(this).find('code').length) { var code = $(this).html(); $(this).html(''); $('<code></code>').html(code).appendTo($(this)); } }).append('<div class="plugin-zclip" title="Click to copy me.">Copy</div>'); $('.plugin-zclip').each(function () { var $this = $(this), client = new ZeroClipboard($this[0]); client.on( "ready", function() { client.on('copy', function () { ZeroClipboard.clearData(); var $code = $this.parent().find('code').clone(); $code.find('.line-numbers').remove(); ZeroClipboard.setData('text/plain', $code.text()); $this.text('Copied!'); }); }); }); });
(function ($) { $(function () { ZeroClipboard.config({swfPath: $('[data-swf-path]').data('swf-path')}); $('pre').each(function () { if (!$(this).find('code').length) { var code = $(this).html(); $(this).html(''); $('<code></code>').html(code).appendTo($(this)); } }).append('<div class="plugin-zclip" title="Click to copy me.">Copy</div>'); $('.plugin-zclip').each(function () { var $this = $(this), client = new ZeroClipboard($this[0]); client.on( "ready", function() { client.on('copy', function () { ZeroClipboard.clearData(); var $code = $this.parent().find('code').clone(); $code.find('.line-numbers').remove(); ZeroClipboard.setData('text/plain', $code.text()); $this.text('Copied!'); }); }); }); }); })(jQuery.noConflict());
Fix conflict with jQuery and prototype
Fix conflict with jQuery and prototype
JavaScript
mit
wenzhixin/redmine-chrome,wenzhixin/redmine-chrome,wenzhixin/redmine-chrome
0141c2d96b8aa65dc58e739ffe90dcf3b73f964f
ember/app/components/plane-label-overlay.js
ember/app/components/plane-label-overlay.js
import Component from '@ember/component'; import $ from 'jquery'; import ol from 'openlayers'; export default class PlaneLabelOverlay extends Component { tagName = ''; map = null; flight = null; position = null; overlay = null; init() { super.init(...arguments); let badgeStyle = `display: inline-block; text-align: center; background: ${this.get('flight.color')}`; let id = this.getWithDefault('flight.competition_id', '') || this.getWithDefault('flight.registration', ''); let badge = $(`<span class="badge plane_marker" style="${badgeStyle}"> ${id} </span>`); this.set( 'overlay', new ol.Overlay({ element: badge.get(0), }), ); } didReceiveAttrs() { super.didReceiveAttrs(...arguments); this.overlay.setPosition(this.position); } didInsertElement() { super.didInsertElement(...arguments); let overlay = this.overlay; this.map.addOverlay(overlay); let width = $(overlay.getElement()).width(); overlay.setOffset([-width / 2, -40]); } willDestroyElement() { super.willDestroyElement(...arguments); let overlay = this.overlay; this.map.removeOverlay(overlay); } }
import Component from '@ember/component'; import $ from 'jquery'; import ol from 'openlayers'; export default class PlaneLabelOverlay extends Component { tagName = ''; map = null; flight = null; position = null; overlay = null; init() { super.init(...arguments); let badgeStyle = `display: inline-block; text-align: center; background: ${this.get('flight.color')}`; let id = this.getWithDefault('flight.competition_id', '') || this.getWithDefault('flight.registration', ''); let badge = $(`<span class="badge plane_marker" style="${badgeStyle}"> ${id} </span>`); this.set( 'overlay', new ol.Overlay({ element: badge.get(0), }), ); } didReceiveAttrs() { super.didReceiveAttrs(...arguments); this.overlay.setPosition(this.position); } didInsertElement() { super.didInsertElement(...arguments); let overlay = this.overlay; this.map.addOverlay(overlay); let width = overlay.getElement().offsetWidth; overlay.setOffset([-width / 2, -40]); } willDestroyElement() { super.willDestroyElement(...arguments); let overlay = this.overlay; this.map.removeOverlay(overlay); } }
Use `offsetWidth` instead of jQuery
PlaneLabelOverlay: Use `offsetWidth` instead of jQuery
JavaScript
agpl-3.0
skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines
1dd85270c63f069d6ef2e1e36213df1d148e5ff2
tests/lib/randoport-test.js
tests/lib/randoport-test.js
"use strict"; const test = require('tape'); const randoPort = require('../../lib/randoport'); const _ = require('lodash'); test('empty object', t => { t.plan(1); const emptyObject = {}; const r = randoPort(emptyObject); t.equal(typeof r.port, 'number'); }); test('object with other properties', t => { t.plan(4); const obj = { a: false, b: 'test', c: 99 }; const r = randoPort(obj); t.equal(obj.a, false); t.equal(obj.b, 'test'); t.equal(obj.c, 99); t.equal(typeof r.port, 'number'); }); test('randoPort returns new object', t => { t.plan(1); const o = {}; t.notEqual(o, randoPort(o)); }); test('object with existing port', t => { t.plan(5000); let i = 0; for(i; i < 5000; i +=1) { const o = { "port": _.random(4000, 4999) }; t.notEqual(o.port, randoPort(o).port); } }); // test('when 4200 is generated as port', t => {});
"use strict"; const test = require('tape'); const randoPort = require('../../lib/randoport'); const _ = require('lodash'); test('empty object', t => { t.plan(1); const emptyObject = {}; const r = randoPort(emptyObject); t.equal(typeof r.port, 'number'); }); test('object with other properties', t => { t.plan(4); const obj = { a: false, b: 'test', c: 99 }; const r = randoPort(obj); t.equal(obj.a, false); t.equal(obj.b, 'test'); t.equal(obj.c, 99); t.equal(typeof r.port, 'number'); }); test('randoPort returns new object', t => { t.plan(1); const o = {}; t.notEqual(o, randoPort(o)); }); test('object with existing port or blacklisted port', t => { t.plan(10000); let i = 0; for(i; i < 5000; i +=1) { const o = { "port": _.random(4000, 4999) }; const r = randoPort(o); t.notEqual(o.port, r.port); t.notEqual(4200, r.port); } }); // test('when 4200 is generated as port', t => {});
Test against testting as default ember port.
Test against testting as default ember port.
JavaScript
mit
ryanlabouve/ember-cli-randoport,ryanlabouve/ember-cli-randoport
c5d16b8a771a186d6bfabe536636b7425cad8fc8
js/main.js
js/main.js
document.getElementById('generate').onclick = genPassword; function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function genPassword() { var passLength = document.getElementById('length').value; var pass=""; for (i = 0; i < passLength; i++) { var a = []; if (document.getElementById('d').checked) { a.push([48, 57]); } if (document.getElementById('u').checked) { a.push([65, 90]); } if (document.getElementById('l').checked) { a.push([97, 122]); } if (document.getElementById('un').checked) { a.push([161, 9999]); } if (document.getElementById('s').checked) { a.push([33, 47]); } if (document.getElementById('sp').checked) { a.push([32, 32]); } var length = a.length; var type = getRandomInt(0, length - 1); console.log("a: "+(a[type][0])); var min = a[type][0]; var max = a[type][1]; var randUnicode = String.fromCharCode(getRandomInt(min, max)); pass+=randUnicode; } document.getElementById('password').value = pass.toString(); }
document.getElementById('generate').onclick = genPassword; function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function genPassword() { var pass = ""; for (i = 0; i < document.getElementById('length').value; i++) { var a = []; if (document.getElementById('d').checked) { a.push([48, 57]); } if (document.getElementById('u').checked) { a.push([65, 90]); } if (document.getElementById('l').checked) { a.push([97, 122]); } if (document.getElementById('un').checked) { a.push([161, 9999]); } if (document.getElementById('s').checked) { a.push([33, 47]); } if (document.getElementById('sp').checked) { a.push([32, 32]); } var type = getRandomInt(0, a.length - 1); var min = a[type][0]; var max = a[type][1]; var randUnicode = String.fromCharCode(getRandomInt(min, max)); pass += randUnicode; } document.getElementById('password').value = pass.toString(); }
Remove console log and rework vars.
Remove console log and rework vars.
JavaScript
mit
Carlgo11/password,Carlgo11/password
d11f5f7a893051771fcee1d84fe4b4a1d79a296b
gulp/core/templates/browser-sync-snippet.js
gulp/core/templates/browser-sync-snippet.js
module.exports = [ '\n\n\n', '/**', ' * DEVELOPMENT MODE ONLY', ' *', ' * Browser-sync script loader', ' * to enable script/style injection', ' *', ' * Run "gulp build" to generate the theme', ' * for production before deploying!', ' *', ' */', 'add_action( \'wp_head\', function () { ?>', '\t<script type="text/javascript" id="__bs_script__">//<![CDATA[', '\t\tdocument.write("<script async src=\'http://HOST:3000/browser-sync/browser-sync-client.js\'><\\/script>".replace("HOST", location.hostname));', '\t//]]></script>', '<?php }, 999);' ].join('\n');
var bsConfig = require('../config/browser-sync'); var port = bsConfig.port || 3000; module.exports = [ '\n\n\n', '/**', ' * DEVELOPMENT MODE ONLY', ' *', ' * Browser-sync script loader', ' * to enable script/style injection', ' *', ' * Run "gulp build" to generate the theme', ' * for production before deploying!', ' *', ' */', 'add_action( \'wp_head\', function () { ?>', '\t<script type="text/javascript" id="__bs_script__">//<![CDATA[', '\t\tdocument.write("<script async src=\'http://HOST:' + port + '/browser-sync/browser-sync-client.js\'><\\/script>".replace("HOST", location.hostname));', '\t//]]></script>', '<?php }, 999);' ].join('\n');
Allow bs snippet to read the port from config
Allow bs snippet to read the port from config
JavaScript
mit
tylershuster/wp-theme-starter,tylershuster/wp-theme-starter
779efe4ae9a6af8bf0ef8280e2e3968ed18f51f3
public/js/app.js
public/js/app.js
var CommentBox = React.createClass({ render: function() { return ( <div className="commentBox"> Hello, world! I am a CommentBox. </div> ); } }); React.render( <CommentBox />, document.getElementById('content') );
/* CommentBox */ var CommentBox = React.createClass({ render: function() { return ( <div className="commentBox"> <h1>Comments</h1> <CommentList /> <CommentForm /> </div> ); } }); /* CommentList */ var CommentList = React.createClass({ render: function() { return ( <div className="commentList"> Hello, world! I am a CommentList. </div> ); } }); /* CommentForm */ var CommentForm = React.createClass({ render: function() { return ( <div className="commentForm"> Hello, world! I am a CommentForm. </div> ); } }); /* Initialize the app */ React.render( <CommentBox />, document.getElementById('content') );
Build CommentList and CommentForm components
Build CommentList and CommentForm components
JavaScript
mit
thinkswan/react-comments,thinkswan/react-comments
9e1cf07dba6e93f0e397a0c6005b38867fb0c569
lib/user-support-helper.js
lib/user-support-helper.js
'use babel'; let InteractiveConfigurationPanel = null; export default { initialize() { if (InteractiveConfigurationPanel !== null) return ; InteractiveConfigurationPanel = require('./interactive-configuration-panel'); this.configurationPanel = new InteractiveConfigurationPanel(); }, activate(state) { }, provideUserSupportHelper() { return this; }, deactivate() { if (this.configurationPanel !== null) { this.configurationPanel.destroy(); } }, serialize() { return { }; }, getInteractiveConfigurationPanel() { this.initialize(); return this.configurationPanel; } };
'use babel'; let InteractiveConfigurationPanel = null; let RandomTipPanel = null; export default { tips: [], initializeInteractiveConfiguration() { if (InteractiveConfigurationPanel !== null) return ; InteractiveConfigurationPanel = require('./interactive-configuration-panel'); this.configurationPanel = new InteractiveConfigurationPanel(); }, initializeRandomTips() { if (RandomTipPanel !== null) return; RandomTipPanel = require('./random-tip-panel'); }, activate(state) { }, provideUserSupportHelper() { return this; }, deactivate() { if (this.configurationPanel !== null) { this.configurationPanel.destroy(); } for (const tip of tips) tip.destory() }, serialize() { return { }; }, getInteractiveConfigurationPanel() { this.initializeInteractiveConfiguration(); return this.configurationPanel; }, createRandomTipPanel(configurationPrefix, words) { this.initializeRandomTips(); const panel = new RandomTipPanel(configurationPrefix, words); this.tips.push(panel) return panel; } };
Enable other packages to use random tips feature
Enable other packages to use random tips feature ref #6
JavaScript
mit
HiroakiMikami/atom-user-support-helper
2791f5415e74395067d5251991c7b347386a6aab
project/frontend/src/components/HeaderBar/HeaderBar.js
project/frontend/src/components/HeaderBar/HeaderBar.js
import React from "react" import classes from "./HeaderBar.module.css" import Logo from "../../assets/sGonksLogo.png" import { Link, NavLink } from "react-router-dom" import LinkButton from "../UI/LinkButton/LinkButton" import LoginButtonSet from "../UI/LoginButtonSet/LoginButtonSet"; const HeaderBar = (props) => { let innerNavLinks = [ { linkTo: "/", display: "My sGonks" }, { linkTo: "/", display: "Competition" }, { linkTo: "/", display: "Marketplace" }, ] let innerNav = props.innerNav ? ( <nav className={classes.Navigation}> <ul> {innerNavLinks.map((link) => { return ( <li> <NavLink to={link.linkTo} activeClassName={classes.active}> {link.display} </NavLink> </li> ) })} </ul> </nav> ) : null return ( <header className={classes.HeaderBar}> <Link to="/"> <img src={Logo} className={classes.Logo} /> </Link> <div className={classes.NavigationContainer}> {innerNav} </div> <div className={classes.ButtonsContainer}> <LoginButtonSet></LoginButtonSet> </div> </header> ) } export default HeaderBar
import React from "react" import classes from "./HeaderBar.module.css" import Logo from "../../assets/sGonksLogo.png" import { Link, NavLink } from "react-router-dom" import LinkButton from "../UI/LinkButton/LinkButton" import LoginButtonSet from "../UI/LoginButtonSet/LoginButtonSet"; const HeaderBar = (props) => { let innerNavLinks = [ { linkTo: "/", display: "My sGonks", key: "mysgonks"}, { linkTo: "/", display: "Competition", key: "competition" }, { linkTo: "/", display: "Marketplace", key: "marketplace" }, ] let innerNav = props.innerNav ? ( <nav className={classes.Navigation}> <ul> {innerNavLinks.map((link) => { return ( <li key={link.key}> <NavLink to={link.linkTo} activeClassName={classes.active}> {link.display} </NavLink> </li> ) })} </ul> </nav> ) : null return ( <header className={classes.HeaderBar}> <Link to="/"> <img src={Logo} className={classes.Logo} /> </Link> <div className={classes.NavigationContainer}> {innerNav} </div> <div className={classes.ButtonsContainer}> <LoginButtonSet></LoginButtonSet> </div> </header> ) } export default HeaderBar
Add key to list to optimise rendering
Add key to list to optimise rendering
JavaScript
apache-2.0
googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks
b89730069ce4a894305f37d19dbf88de486b4bea
lib/dom.js
lib/dom.js
var $ = require('jquery'); module.exports = { $doc: $(document), setupDom: function () { this.$el = $(this.element); this.$el.addClass(this.options.classes.originalSelect); // Setup wrapper this.$wrapper = $('<div />', { 'class': this.options.classes.wrapper }); // Setup select this.$select = $('<button />', { 'class': this.options.classes.select }); // Setup option list this.$optionList = $('<ul />', { 'class': [this.options.classes.optionList, this.options.classes.isHidden].join(' ') }); this.renderOptions(); this.renderSelect(this.getContent()); this.setActiveOption(this.getValue(), true); // Go! this.$wrapper .insertBefore(this.$el) .append(this.$el, this.$select, this.$optionList); }, destroyDom: function () { this.$el .removeClass(this.options.classes.originalSelect) .insertBefore(this.$wrapper); this.$wrapper.remove(); } };
var $ = require('jquery'); module.exports = { $doc: $(document), setupDom: function () { this.$el = $(this.element); this.$el.addClass(this.options.classes.originalSelect); // Setup wrapper this.$wrapper = $('<div />', { 'class': this.options.classes.wrapper }); // Setup select this.$select = $('<button />', { type: 'button', 'class': this.options.classes.select }); // Setup option list this.$optionList = $('<ul />', { 'class': [this.options.classes.optionList, this.options.classes.isHidden].join(' ') }); this.renderOptions(); this.renderSelect(this.getContent()); this.setActiveOption(this.getValue(), true); // Go! this.$wrapper .insertBefore(this.$el) .append(this.$el, this.$select, this.$optionList); }, destroyDom: function () { this.$el .removeClass(this.options.classes.originalSelect) .insertBefore(this.$wrapper); this.$wrapper.remove(); } };
Add button type to select
Add button type to select
JavaScript
mit
niksy/kist-selectdown,niksy/kist-selectdown
8516e9394955de86c7e46bc39a94c0afe50ab258
mac/filetypes/open_MMSD.js
mac/filetypes/open_MMSD.js
define(['itemObjectModel'], function(itemOM) { 'use strict'; function open(item) { function onSubitem(subitem) { switch(subitem.dataset.resourceType) { case 'STR ': subitem.getDataObject() .then(function(names) { names = names.split(/;/g); }); for (var i = 0; i < names.length; i++) { var namedItem = itemOM.createItem(names[i]); item.addItem(namedItem); } break; case 'CSND': break; } } var subitems = item.subitemsElement && item.subitemsElement.children; if (subitems) { for (var i = 0; i < subitems.length; i++) { onSubitem(subitems[i]); } } item.addEventListener(itemOM.EVT_ITEM_ADDED, function(e) { onSubitem(e.detail.item); }); return Promise.resolve(item); } return open; });
define(['itemObjectModel'], function(itemOM) { 'use strict'; function open(item) { function onSubitem(subitem) { switch(subitem.dataset.resourceType) { case 'STR ': subitem.getDataObject() .then(function(names) { names = names.split(/;/g); for (var i = 0; i < names.length; i++) { var namedItem = itemOM.createItem(names[i]); item.addItem(namedItem); } }); break; case 'CSND': break; } } var subitems = item.subitemsElement && item.subitemsElement.children; if (subitems) { for (var i = 0; i < subitems.length; i++) { onSubitem(subitems[i]); } } item.addEventListener(itemOM.EVT_ITEM_ADDED, function(e) { onSubitem(e.detail.item); }); return Promise.resolve(item); } return open; });
Move named item loop to the right scope
Move named item loop to the right scope
JavaScript
mit
radishengine/drowsy,radishengine/drowsy
16145e3e2d5d8599201187638181802c4c503be5
app/http/resources/protected/appointment-items.js
app/http/resources/protected/appointment-items.js
// Module dependencies. var express = require('express'); var router = express.Router(); var api = {}; // ALL api.appointmentItems = function(req) { return req.store.recordCollection('AppointmentItem'); }; // GET api.appointmentItem = function(req) { return req.store.recordItemById('AppointmentItem', req.params.id); }; // POST api.addAppointmentItem = function(req) { return req.store.createRecord('AppointmentItem', { beforeSave(model, save) { model.client = req.user; save(); }, }); }; // PUT api.editAppointmentItem = function(req) { return req.store.updateRecord('AppointmentItem', req.params.id); }; // DELETE api.deleteAppointmentItem = function(req) { return req.store.destroyRecord('AppointmentItem', req.params.id); }; router.get('/appointmentItems', api.appointmentItems); router.post('/appointmentItems', api.addAppointmentItem); router.route('/appointmentItems/:id') .get(api.appointmentItem) .put(api.editAppointmentItem) .delete(api.deleteAppointmentItem); module.exports = router;
// Module dependencies. var express = require('express'); var router = express.Router(); var api = {}; // ALL api.appointmentItems = function(req) { return req.store.recordCollection('AppointmentItem', {include: ['service']}); }; // GET api.appointmentItem = function(req) { return req.store.recordItemById('AppointmentItem', req.params.id, {include: ['service']}); }; // POST api.addAppointmentItem = function(req) { return req.store.createRecord('AppointmentItem', { include: ['service'], beforeSave(model, save) { model.client = req.user; save(); }, }); }; // PUT api.editAppointmentItem = function(req) { return req.store.updateRecord('AppointmentItem', req.params.id, {include: ['service']}); }; // DELETE api.deleteAppointmentItem = function(req) { return req.store.destroyRecord('AppointmentItem', req.params.id); }; router.get('/appointmentItems', api.appointmentItems); router.post('/appointmentItems', api.addAppointmentItem); router.route('/appointmentItems/:id') .get(api.appointmentItem) .put(api.editAppointmentItem) .delete(api.deleteAppointmentItem); module.exports = router;
Load service w/ apt items
Load service w/ apt items
JavaScript
mit
pixiestix826/schedule-me-api,pixiestix826/schedule-me-api
22df5bce43549e73744220fb1ef40f1d0f7b00ff
corehq/apps/toggle_ui/static/toggle_ui/js/flags.js
corehq/apps/toggle_ui/static/toggle_ui/js/flags.js
hqDefine('toggle_ui/js/flags', [ 'jquery', 'knockout', 'reports/js/config.dataTables.bootstrap', 'hqwebapp/js/components.ko', // select toggle widget ], function ( $, ko, datatablesConfig ) { var dataTableElem = '.datatable'; var viewModel = { tagFilter: ko.observable(null), }; $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { if (viewModel.tagFilter() === 'all') { return true; } var tag = aData[0].replace(/\n/g," ").replace(/<.*?>/g, ""); if (viewModel.tagFilter() === "Solutions" && tag.includes("Solutions")) { return true; } return tag === viewModel.tagFilter(); } ); $('#table-filters').koApplyBindings(viewModel); var table = datatablesConfig.HQReportDataTables({ dataTableElem: dataTableElem, showAllRowsOption: true, includeFilter: true, }); table.render(); viewModel.tagFilter.subscribe(function (value) { table.datatable.fnDraw(); }); });
hqDefine('toggle_ui/js/flags', [ 'jquery', 'knockout', 'reports/js/config.dataTables.bootstrap', 'hqwebapp/js/components.ko', // select toggle widget ], function ( $, ko, datatablesConfig ) { var dataTableElem = '.datatable'; var viewModel = { tagFilter: ko.observable(null), }; $.fn.dataTableExt.afnFiltering.push( function (oSettings, aData, iDataIndex) { if (viewModel.tagFilter() === 'all') { return true; } var tag = aData[0].replace(/\s+/g," ").replace(/<.*?>/g, "").replace(/^\d+ /, ""); if (viewModel.tagFilter() === "Solutions" && tag.includes("Solutions")) { return true; } return tag === viewModel.tagFilter(); } ); $('#table-filters').koApplyBindings(viewModel); var table = datatablesConfig.HQReportDataTables({ dataTableElem: dataTableElem, showAllRowsOption: true, includeFilter: true, }); table.render(); viewModel.tagFilter.subscribe(function (value) { table.datatable.fnDraw(); }); });
Fix UI filters on Feature Flags page
Fix UI filters on Feature Flags page
JavaScript
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
80b2f631edd3c5a62859b4df1da087e94ee13da5
blueprints/ember-web-app/files/config/manifest.js
blueprints/ember-web-app/files/config/manifest.js
/*jshint node:true*/ 'use strict'; module.exports = function(/* environment, appConfig */) { return { name: "<%= name %>", short_name: "<%= name %>", description: "", start_url: "/", display: "standalone", background_color: "#fff", theme_color: "#fff", icons: [ ] }; }
/*jshint node:true*/ 'use strict'; module.exports = function(/* environment, appConfig */) { // See https://github.com/san650/ember-web-app#documentation for a list of // supported properties return { name: "<%= name %>", short_name: "<%= name %>", description: "", start_url: "/", display: "standalone", background_color: "#fff", theme_color: "#fff", icons: [ ] }; }
Add link to documentation in blueprint
Add link to documentation in blueprint
JavaScript
mit
san650/ember-web-app,san650/ember-web-app
e92c57af03c2319b5e313faa8df9c5969a2c2164
commands/builds/output.js
commands/builds/output.js
'use strict'; let cli = require('heroku-cli-util'); let request = require('request'); module.exports = { topic: 'builds', command: 'output', needsAuth: true, needsApp: true, description: 'show build output', help: 'Show build output for a Heroku app', variableArgs: true, run: cli.command(showOutput) }; function showOutput(context, heroku) { let id = context.args[0]; if (!id) { cli.error("Usage: heroku builds:output <id> -a <app>") return } return heroku.request({ path: `/apps/${context.app}/builds/${id}`, method: 'GET', headers: { 'Accept': 'application/vnd.heroku+json; version=3.streaming-build-output' }, parseJSON: true }).then(function (build) { request(build.output_stream_url).pipe(process.stdout); }); }
'use strict'; let cli = require('heroku-cli-util'); let request = require('request'); module.exports = { topic: 'builds', command: 'output', needsAuth: true, needsApp: true, description: 'show build output', help: 'Show build output for a Heroku app', args: [ { name: 'id', optional: false, hidden: false } ], run: cli.command(showOutput) }; function showOutput(context, heroku) { let id = context.args.id; return heroku.request({ path: `/apps/${context.app}/builds/${id}`, method: 'GET', headers: { 'Accept': 'application/vnd.heroku+json; version=3.streaming-build-output' }, parseJSON: true }).then(function (build) { request(build.output_stream_url).pipe(process.stdout); }); }
Leverage command line validation via @dickeyxxx
Leverage command line validation via @dickeyxxx
JavaScript
isc
heroku/heroku-builds
ab1b26745e10b897b8f556db35688b8fce61c47b
test/config.js
test/config.js
import mix from '../src/index'; import test from 'ava'; test('that it can merge config', t => { Config.merge({ versioning: true, foo: 'bar' }); t.is('bar', Config.foo); t.true(Config.versioning); }); test('that it intelligently builds the Babel config', t => { // Given the user has a custom .babelrc file... new File('.babelrc').write({ 'plugins': ['transform-object-rest-spread'] }); // And we construct the Babel config for Mix... let options = Config.babel(); // Then it should smartly merge the user's .babelrc with Mix's. t.deepEqual(['transform-object-rest-spread'], options.plugins) t.is('env', options.presets[0][0]); // Clean up. File.find('.babelrc').delete(); });
import mix from '../src/index'; import test from 'ava'; test('that it can merge config', t => { Config.merge({ versioning: true, foo: 'bar' }); t.is('bar', Config.foo); t.true(Config.versioning); }); test('that it intelligently builds the Babel config', t => { // Given the user has a custom .babelrc file... new File('.babelrc').write({ 'plugins': ['arbitrary-plugin'] }); // And we construct the Babel config for Mix... let options = Config.babel(); // Then it should smartly merge the user's .babelrc with Mix's. t.deepEqual(['transform-object-rest-spread', 'arbitrary-plugin'], options.plugins) t.is('env', options.presets[0][0]); // Clean up. File.find('.babelrc').delete(); });
Fix failing test by adapting it to new conditions
Fix failing test by adapting it to new conditions The test failed, because there were two entries 'transform-object-rest-spread' in the options.plugins array. This has most likely to do with src/config.js which declares 'transform-object-rest-spread' as a default plugin.
JavaScript
mit
JeffreyWay/laravel-mix
04fe6402efb63c476ce24b86bab60b1a1e218903
rollup.config.js
rollup.config.js
import babel from 'rollup-plugin-babel' import resolve from '@rollup/plugin-node-resolve' import json from '@rollup/plugin-json' import autoExternal from 'rollup-plugin-auto-external' import pkg from './package.json' import fs from 'fs' import gitrev from 'git-rev-promises' Promise.all([ gitrev.long(), gitrev.branch(), gitrev.tags(), gitrev.date() ]).then(([hash, branch, tags, date]) => { const buildJson = JSON.stringify({ version: pkg.version, hash, branch, tags, date }) fs.writeFile('build.json', buildJson, 'utf8', () => { console.info('Build information saved') }) }) const config = { input: 'src/index.mjs', output: { dir: 'dist', format: 'esm', entryFileNames: '[name].mjs', sourcemap: true }, preserveModules: true, plugins: [autoExternal(), json(), resolve(), babel({ externalHelpers: true })] } export default config
/* eslint-disable no-console */ import json from '@rollup/plugin-json' import resolve from '@rollup/plugin-node-resolve' import fs from 'fs' import gitrev from 'git-rev-promises' import autoExternal from 'rollup-plugin-auto-external' import babel from 'rollup-plugin-babel' import pkg from './package.json' Promise.all([ gitrev.long(), gitrev.branch(), gitrev.tags(), gitrev.date(), ]).then(([hash, branch, tags, date]) => { const buildJson = JSON.stringify({ version: pkg.version, hash, branch, tags, date, }) fs.writeFile('build.json', buildJson, 'utf8', () => { console.info('Build information saved') }) }) const config = { input: 'src/index.mjs', output: { dir: 'dist', format: 'esm', entryFileNames: '[name].mjs', sourcemap: true, }, external: ['nanoid/async'], preserveModules: true, plugins: [autoExternal(), json(), resolve(), babel({ externalHelpers: true })], } export default config
Fix issue caused by Rollup.js having a nervous breakdown if an import from a dependency includes a forward flash.
Fix issue caused by Rollup.js having a nervous breakdown if an import from a dependency includes a forward flash.
JavaScript
bsd-3-clause
FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com
33934113874f74b65232045e7a5bb764aea85c00
test/string.js
test/string.js
describe('String#trim', function () { it('should be defined', function () { assert('Some text').should(respondTo, 'trim'); }); it('should remove spaces at end and start of string', function () { var strings = ['Some text', ' Some text', 'Some text ', ' Some text ']; for (var i = 0; i < strings.length; i += 1) { assert(strings[0].trim()).should(eql, 'Some text'); } }); });
describe('String.prototype.trim ( )', function () { it('should be defined', function () { assert('Some text').should(respondTo, 'trim'); }); it('should remove whitespace from both ends of the string', function () { var strings = ['Some text', ' Some text', 'Some text ', ' Some text ']; for (var i = 0; i < strings.length; i += 1) { assert(strings[0].trim()).should(eql, 'Some text'); } }); });
Fix describtion of String.prototype.trim examples
Fix describtion of String.prototype.trim examples
JavaScript
mit
shuaiyunzhang/es5-shim,shuaiyunzhang/es5-shim,lewisje/es5-shim,fashionsun/es5-shim,ljharb/es5-shim,imsun/es5-shim,goodbedford/es5-shim,lewisje/es5-shim,sky-uk/es5-shim,meteor/es5-shim,sky-uk/es5-shim,ljharb/es5-shim,meteor/es5-shim,es-shims/es5-shim,9040044/es5-shim,matthewjh/es5-shim,es-shims/es5-shim,9040044/es5-shim,imsun/es5-shim,laomu1988/es5-shim,fashionsun/es5-shim,matthewjh/es5-shim,jefferydutra/es5-shim,Xotic750/es5-shim,olemis/es5-shim,olemis/es5-shim,briandipalma/es5-shim,goodbedford/es5-shim,laomu1988/es5-shim,briandipalma/es5-shim,jefferydutra/es5-shim,npmcomponent/code42day-es5-shim,Xotic750/es5-shim,rwaldron/es5-shim
4d6d8d46257be9b507aa5fd739b0c9a8332bbc1f
rollup.config.js
rollup.config.js
import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; import pug from 'rollup-plugin-pug'; import babel from 'rollup-plugin-babel'; export default { entry: 'src/index.js', format: 'umd', moduleName: 'XpClient', plugins: [resolve(), commonjs(), pug(), babel({ exclude: 'node_modules/**' // only transpile our source code })], external: ['unfetch', 'javascript-state-machine'], dest: 'lib/xpclient.js', sourceMap: true, globals: { 'javascript-state-machine': 'StateMachine', unfetch: 'unfetch' } };
import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; import pug from 'rollup-plugin-pug'; import babel from 'rollup-plugin-babel'; export default { entry: 'src/index.js', format: 'umd', moduleName: 'XpClient', plugins: [resolve(), commonjs(), pug(), babel({ exclude: 'node_modules/**' // only transpile our source code })], external: ['unfetch', 'javascript-state-machine', 'spin'], dest: 'lib/xpclient.js', sourceMap: true, globals: { 'javascript-state-machine': 'StateMachine', unfetch: 'unfetch', spin: 'Spinner' } };
Add spin to rollup's externals.
Add spin to rollup's externals.
JavaScript
mit
QuentinRoy/lightmill-js,QuentinRoy/lightmill-js
a1245fe762cefd1b0e144624fe7e1c54a8c39438
Code/src/src/components/LetterComponent.js
Code/src/src/components/LetterComponent.js
import React, { Component } from 'react'; class Letters extends Component { constructor(props) { super(props); this.state = { type: props.statement }; } render() { return ( <div className="userInput"> <button className="entry row1 col1">a</button> <button className="entry row1 col2">b</button> <button className="entry row1 col3">c</button> <button className="entry row1 col4">d</button> <button className="entry row1 col5">e</button> <button className="entry row1 col6">f</button> <br /> <button className="entry row2 col1">g</button> <button className="entry row2 col2">h</button> <button className="entry row2 col3">i</button> <button className="entry row2 col4">j</button> <button className="entry row2 col5">k</button> <button className="entry row2 col6">l</button> <br /> <button className="entry row3 col1">m</button> <button className="entry row3 col2">n</button> <button className="entry row3 col3">o</button> <button className="entry row3 col4">p</button> <button className="entry row3 col5">q</button> <button className="entry row3 col6">r</button> <br /> <button className="entry row4 col1">s</button> <button className="entry row4 col2">t</button> <button className="entry row4 col3">u</button> <button className="entry row4 col4">v</button> <button className="entry row4 col5">w</button> <button className="entry row4 col6">x</button> <br /> <button className="entry-extra-wide row5 col1">____</button> <button className="entry row5 col3">y</button> <button className="entry row5 col4">z</button> <button className="entry-extra-wide row5 col6">&uarr;</button> </div> ) } } export default Letters;
import React, { Component } from 'react'; class Letters extends Component { constructor(props) { super(props); this.state = { type: props.statement }; this.createButtons = this.createButtons.bind(this); } createButtons() { let buttons = []; for (let i = 0; i < 26; i++) { var rowNum = i / 6 + 1; var colNum = i % 6 + 1; var letter = (i + 10).toString(36); var className = "entry row" + rowNum + " col" + colNum; buttons.push(<button className={className}>{letter}</button>); if (i !== 0 && (i+1) % 6 === 0) { buttons.push(<br />) } } return buttons; } render() { return ( <div className="userInput"> {this.createButtons()} </div> ) } } export default Letters;
Refactor creating buttons for letters
Refactor creating buttons for letters
JavaScript
agpl-3.0
neurotechuoft/MindType,neurotechuoft/MindType,neurotechuoft/MindType,neurotechuoft/MindType,neurotechuoft/MindType,neurotechuoft/MindType
fc83f0e13b2cc7bfefad70b127875fff00b24ef1
cd/src/pipeline-events-handler/etc/execution-emoji.js
cd/src/pipeline-events-handler/etc/execution-emoji.js
// These should be easily identifiable and both visually and conceptually unique // Don't include symbols that could be misconstrued to have some actual meaning // (like a warning sign) const emojis = '🦊🐸🦉🦄🐙🐳🌵🍀🍁🍄🌍⭐️🔥🌈🍎🥯🌽🥞🥨🍕🌮🍦🎂🍿🏈🛼🏆🎧🎺🎲🚚✈️🚀⛵️⛺️📻💰💎🧲🔭🪣🧸'; module.exports = { emoji(executionId) { // Create a simple hash of the execution ID const hash = [...executionId].reduce( (prev, curr) => prev + curr.charCodeAt(0), 0, ); // Return an emoji based on the hash. This is hopefully significantly // random that deploys near to each other in time don't get the same // symbol return [...emojis][hash % [...emojis].length]; }, };
// These should be easily identifiable and both visually and conceptually unique // Don't include symbols that could be misconstrued to have some actual meaning // (like a warning sign) const emojis = [ '🦊', '🐸', '🦉', '🦄', '🐙', '🐳', '🌵', '🍀', '🍁', '🍄', '🌍', '⭐️', '🔥', '🌈', '🍎', '🥯', '🌽', '🥞', '🥨', '🍕', '🌮', '🍦', '🎂', '🍿', '🏈', '🛼', '🏆', '🎧', '🎺', '🎲', '🚚', '✈️', '🚀', '⛵️', '⛺️', '📻', '💰', '💎', '🧲', '🔭', '🪣', '🧸', ]; module.exports = { emoji(executionId) { // Create a simple hash of the execution ID const hash = [...executionId].reduce( (prev, curr) => prev + curr.charCodeAt(0), 0, ); // Return an emoji based on the hash. This is hopefully significantly // random that deploys near to each other in time don't get the same // symbol return emojis[hash % emojis.length]; }, };
Fix emoji byte length issue
Fix emoji byte length issue
JavaScript
mit
PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure,PRX/Infrastructure
f81ecc0d6d05b9e10d80da70a193cf9601b5f069
script/stageprompt.js
script/stageprompt.js
var GOVUK = GOVUK || {}; GOVUK.performance = GOVUK.performance || {}; GOVUK.performance.stageprompt = (function () { var setup, setupForGoogleAnalytics, splitAction; splitAction = function (action) { var parts = action.split(':'); if (parts.length <= 3) return parts; return [parts.shift(), parts.shift(), parts.join(':')]; }; setup = function (analyticsCallback) { var journeyStage = $('[data-journey]').attr('data-journey'), journeyHelpers = $('[data-journey-click]'); if (journeyStage) { analyticsCallback.apply(null, splitAction(journeyStage)); } journeyHelpers.on('click', function (event) { analyticsCallback.apply(null, splitAction($(this).data('journey-click'))); }); }; setupForGoogleAnalytics = function () { setup(GOVUK.performance.sendGoogleAnalyticsEvent); }; return { setup: setup, setupForGoogleAnalytics: setupForGoogleAnalytics }; }()); GOVUK.performance.sendGoogleAnalyticsEvent = function (category, event, label) { _gaq.push(['_trackEvent', category, event, label, undefined, true]); };
/* Stageprompt 2.0.1 * ================= * * What is it? Stageprompt is code for wiring up an analytics service to a user journey * How does it work? The user journey is described by adding data-journey attributes to tags in the html * the attribute values are then parsed and use to fire a callback sending data to * Google Analytics or some other provider. * Why use it? Seperates the concerns of instumenting your user journey and sending that data * to your analytics provider. * * SEE HERE FOR MORE INFORMATION - https://github.com/alphagov/stageprompt */ var GOVUK = GOVUK || {}; GOVUK.performance = GOVUK.performance || {}; GOVUK.performance.stageprompt = (function () { var setup, setupForGoogleAnalytics, splitAction; splitAction = function (action) { var parts = action.split(':'); if (parts.length <= 3) return parts; return [parts.shift(), parts.shift(), parts.join(':')]; }; setup = function (analyticsCallback) { var journeyStage = $('[data-journey]').attr('data-journey'), journeyHelpers = $('[data-journey-click]'); if (journeyStage) { analyticsCallback.apply(null, splitAction(journeyStage)); } journeyHelpers.on('click', function (event) { analyticsCallback.apply(null, splitAction($(this).data('journey-click'))); }); }; setupForGoogleAnalytics = function () { setup(GOVUK.performance.sendGoogleAnalyticsEvent); }; return { setup: setup, setupForGoogleAnalytics: setupForGoogleAnalytics }; }()); GOVUK.performance.sendGoogleAnalyticsEvent = function (category, event, label) { _gaq.push(['_trackEvent', category, event, label, undefined, true]); };
Add documentation comment at top of file
Add documentation comment at top of file
JavaScript
mit
alphagov/stageprompt,alphagov/stageprompt
c92368448bc56cff32f747927c315eeaa32706fb
scripts/ariaCurrent.js
scripts/ariaCurrent.js
function setAriaCurrent() { var title = document.title; if title== "Comunidad hispanohablante de NVDA " { var id = "inicio" } document.getElementById(id).removeAttribute("accesskey"); document.getElementById(id).setAttribute("aria-current", "page"); } setAriaCurrent();
function setAriaCurrent() { var title = document.title.trim(); if title === "Comunidad hispanohablante de NVDA") { document.getElementById("inicio".setAttribute("aria-current", "page"); } else if title.includes("- Ayuda y descarga") { document.getElementById("ayuda").setAttribute("aria-current", "page") } } setAriaCurrent();
Use trim method in javascript
Use trim method in javascript
JavaScript
mit
nvdaes/nvdaes.github.io,nvdaes/nvdaes.github.io
1daa9dd1c6d29178fcbbdbfdb4e1e024b9fb6428
lib/odd-even-sort.js
lib/odd-even-sort.js
/** * @license * js-sorting <http://github.com/Tyriar/js-sorting> * Copyright 2014-2015 Daniel Imms <http://www.growingwiththeweb.com> * Released under the MIT license <http://github.com/Tyriar/js-sorting/blob/master/LICENSE> */ 'use strict'; var defaultCompare = require('./common/default-compare'); var defaultSwap = require('./common/default-swap'); function sort(array, compare, swap) { var i; var sorted = false; while(!sorted) { sorted = true; for (i = 1; i < array.length - 1; i += 2) { if (compare(array[i], array[i + 1]) > 0) { swap(array, i, i + 1); sorted = false; } } for (i = 0; i < array.length - 1; i += 2) { if (compare(array[i], array[i + 1]) > 0) { swap(array, i, i + 1); sorted = false; } } } return array; } module.exports = function (array, customCompare, customSwap) { var compare = customCompare || defaultCompare; var swap = customSwap || defaultSwap; return sort(array, compare, swap); };
/** * @license * js-sorting <http://github.com/Tyriar/js-sorting> * Copyright 2014-2015 Daniel Imms <http://www.growingwiththeweb.com> * Released under the MIT license <http://github.com/Tyriar/js-sorting/blob/master/LICENSE> */ 'use strict'; var defaultCompare = require('./common/default-compare'); var defaultSwap = require('./common/default-swap'); function innerSort(array, i, compare, swap) { var sorted = true; for (; i < array.length - 1; i += 2) { if (compare(array[i], array[i + 1]) > 0) { swap(array, i, i + 1); sorted = false; } } return sorted; } function sort(array, compare, swap) { var sorted = false; while (!sorted) { sorted = innerSort(array, 1, compare, swap); sorted = sorted && innerSort(array, 0, compare, swap); } return array; } module.exports = function (array, customCompare, customSwap) { var compare = customCompare || defaultCompare; var swap = customSwap || defaultSwap; return sort(array, compare, swap); };
Refactor odd even sort to reduce duplication
Refactor odd even sort to reduce duplication
JavaScript
mit
Tyriar/js-sorting
b68c4d6afe2b6d081a6afe47f3a3fd97db2b2f22
lib/uglify-worker.js
lib/uglify-worker.js
var uglify; try { uglify = require('uglify-js'); } catch (err) { /* NOP */ } process.on('message', function(msg) { var outputFile = msg.output, data = msg.data, sourceMap = msg.sourceMap, warnings = []; try { var warnFunction; try { warnFunction = uglify.AST_Node.warn_function; uglify.AST_Node.warn_function = function(msg) { warnings.push(msg); }; var ast = uglify.parse(data), compressor = uglify.Compressor(), outputOptions = {}; if (sourceMap) { sourceMap = uglify.SourceMap({ file: outputFile, orig: sourceMap }); outputOptions.source_map = sourceMap; } ast.figure_out_scope(); ast = ast.transform(compressor); ast.figure_out_scope(); ast.compute_char_frequency(); ast.mangle_names(); data = ast.print_to_string(outputOptions); process.send({ data: { data: data, warnings: warnings, sourceMap: sourceMap && sourceMap.toString() } }); } finally { uglify.AST_Node.warn_function = warnFunction; } } catch (err) { process.send({err: err.toString()}); } });
var uglify; try { uglify = require('uglify-js'); } catch (err) { /* NOP */ } process.on('message', function(msg) { var outputFile = msg.output, data = msg.data, sourceMap = msg.sourceMap, warnings = []; try { var warnFunction; try { warnFunction = uglify.AST_Node.warn_function; uglify.AST_Node.warn_function = function(msg) { warnings.push(msg); }; var ast = uglify.parse(data), compressor = uglify.Compressor(), outputOptions = {}; if (sourceMap) { sourceMap = uglify.SourceMap({ file: outputFile, orig: sourceMap }); outputOptions.source_map = sourceMap; } ast.figure_out_scope(); ast = ast.transform(compressor); ast.figure_out_scope(); ast.compute_char_frequency(); ast.mangle_names(); data = ast.print_to_string(outputOptions); process.send({ data: { data: data, warnings: warnings, sourceMap: sourceMap && sourceMap.toString() } }); } finally { uglify.AST_Node.warn_function = warnFunction; } } catch (err) { process.send({err: err.stack || err.msg || err.toString()}); } });
Improve error logging in uglify worker
Improve error logging in uglify worker
JavaScript
mit
walmartlabs/lumbar
62319bbf125884872143583d2ff79d317936b7e4
scripts/index.js
scripts/index.js
/** @jsx React.DOM */ 'use strict'; var React = require('react'), App = require('./App'); React.renderComponent(<App />, document.body);
/** @jsx React.DOM */ 'use strict'; var React = require('react'), App = require('./App'); if ('production' !== process.env.NODE_ENV) { // Enable React devtools window['React'] = React; } React.renderComponent(<App />, document.body);
Add code to enable React devtools
Add code to enable React devtools
JavaScript
mit
msikma/react-hot-boilerplate,amysimmons/mememe,mikeastock/LonelyKnight,JulianSamarjiev/redux-friendlist,jonboerner/flipturn,nataly87s/follow-mouse,fatrossy/color_palette,gonardfreeman/moviesDB,prathamesh-sonpatki/openlib-react,gordon2012/friendlist,saitodisse/react-for-idiots,OlehHappy/oleh_011-DnD_React_Native_Box,chasemc67/Unlimited-Image-Compression,gustavoguichard/react-copy-to-clipboard,schutterp/hotreactdux-fullstack-starter,nguoihocnghe/react-workshop-basic,seanpharvey/react-hot-boilerplate,alexqeo/react-redux-todos,ZucchiniZe/flux-people,znation/react-hot-boilerplate,hidden4003/react-hot-boilerplate,ePak/react-datepicker-csp,g8extended/Character-Generator,szhangpitt/react-hot-es6,bedrich/gimme-react,DelvarWorld/cats-react,yang-wei/resit,cmelion/react-hot-boilerplate,Alkamenos/friendlist,thadiggitystank/react-hot-boilerplate,Narasimman/ReactTrials,mdkalish/json_selector,postazure/redux-helloworld,bcbcb/react-hot-boilerplate,tongcx/gantt.js,OlehHappy/oleh_007-DnD_React_tests,lelandlee/FoodFates,josebalius/react-hot-boilerplate,rikukissa/knockout-reflux,aboutscript/react-tutorial-ninputs,cruiz07/react-hot-boilerplate,znation/react-hot-boilerplate,sljuka/bizflow-ui,hedgerh/thinkful-reflux-async,klik1301/ex7_repos_baobal,meta-meta/react-synonym-game,thadiggitystank/react-hot-boilerplate,dhrp/react-overlay-popup,prathamesh-sonpatki/openlib-react,taskworld/react-overlay-popup,buttercomponents/butter-base-components,henryhedges/react-hot-template,phosphene/react-d3-hotload-test-demo,Florenz23/wifi_signals,hedgerh/thinkful-react-style-guide,mjxm/loadingscreen,dbatten4/chessboard-react,nahkar/react_cms,triqi/react-snake,alejodiazg/alejodiazg.github.io,csmalin/reduxchat,cdaringe/square-dance,SalvaCarsi/Geometric,MirekSz/tic-tac-toe-gui,robsquires/react-audio-examples,Barakar/FriendList,talldan/hex-demo-motion,joshlevy89/pinclone,roytang121/phaser-game-demo,dindonus/react-hot-boilerplate,OlehHappy/oleh_006-DnD_Native_Boxes,reactabular/reactabular,meta-meta/react-synonym-game,mikeastock/LonelyKnight,saeedmahani/rt-fullscreen-search,eduardopoleo/blog-fe,xaiki/react-popcorn,vire/resit,ijones16/react-hot-boilerplate,esoman/eli-dnd,talldan/hex-demo-motion,GovWizely/trade-event-search-app,barcicki/react-hot-gulp-boilerplate,roycejewell/flux-ui-example,vsuperator/simple-shop,IoanAlexandru/React-Redux-with-Hot-Loading-and-tcomb-forms,lelandlee/FoodFates,bedrich/gimme-react,danielwerthen/react-hot-boilerplate,OlehHappy/oleh_012-DnD_React_Native_CustomElement,ViniciusAtaide/reduxchat,anara123/udemy-react-todo-app,natstar93/React_train_timings,OlehHappy/oleh_007-DnD_React_tests,rahul14m93/GenerationProject,henryhedges/react-hot-template,barock19/react-hot-boilerplate,npverni/react-hot-boilerplate,weilidai2001/react-radium-playground,OlehHappy/oleh_010-DnD_React_transhand01_bind,ftorre104/todolist-redux,agualbbus/fibmaps,taggartbg/connectjs2015,amysimmons/a-guide-to-the-care-and-feeding-of-new-devs,eric-wood/playlist,kylefdoherty/redux-todo,hoodwink73/react-hello-world,rikukissa/dogfight-dodgers,ZigGreen/matrix-calc--test-task,ivmarcos/react-hot-boilerplate,MirekSz/tic-tac-toe-gui,OAGr/guesstimate,npverni/react-hot-boilerplate,InSuperposition/react-hot-boilerplate,hedgerh/thinkful-react-hoc,nadee013/react,lyhoanglong/react-hot-boilerplate,bthj/chain-reaction-board,buttercomponents/butter-component,pcdv/react-explorer,roth1002/react-hot-boilerplate,Marcoga/react-dnd-test,andrevvalle/redux-lab,SwordSoul/swordsoul.github.com,bedrich/gimme-react,colevoss/react-hot-boilerplate,rikukissa/dogfight-dodgers,davidminor/password-supply,jakewisse/layout-dependent-rendering,w01fgang/react-hot-boilerplate,nahkar/react_cms,addi90/redux-todo,roycejewell/flux-ui-example,chandlera/react-hot-boilerplate,danielwerthen/react-hot-boilerplate,OlehHappy/oleh_008-DnD_React_transhand01,mattcav/airline-interface-prototype,alexravs/midgar,weixing2014/redux-todo,thisishuey/react-hot-boilerplate,vicai/MusicMoodzon,OlehHappy/oleh_009-DnD_React_transhand01_changed-forneeds,morgante/deceptachat,IoanAlexandru/React-Redux-with-Hot-Loading-and-tcomb-forms,Yangani/friendlist,joshlevy89/the-book-thing,megawidget/reactabular,future-ui/basics,JulianSamarjiev/redux-friendlist,buttercomponents/butter-component-builder,marg51/uto,bofa/demography-portal,phosphene/react-d3-hotload-test-demo,nataly87s/follow-mouse,ecastano/generation-take-home,dvshur/react-components-inject,vnguyen94/react-commute,VictorBjelkholm/webpack-node-ipfs-api-demo,amysimmons/a-guide-to-the-care-and-feeding-of-new-devs,bcbcb/react-hot-boilerplate,rahul14m93/GenerationProject,dindonus/react-hot-boilerplate,jxnblk/react-basscss-hot-boilerplate,adjohnson916/reactabular,gustavoguichard/react-copy-to-clipboard,taymoork2/react-hot-boilerplate,DelvarWorld/cats-react,ViniciusAtaide/chatflux,thisishuey/react-hot-boilerplate,gustavoguichard/react-tiltshift,nguoihocnghe/react-workshop-basic,gilbox/elegant-react-hot-demo,triqi/react-snake,blaqbern/intro-to-react,Ehesp/react-flux-webpack-boilerplate,reactabular/reactabular,samlawrencejones/react-starter,vire/resit,ransanjeev/react-hot-boilerplate,tomenden/webpack-react,Marcoga/react-dnd-test,alejodiazg/alejodiazg.github.io,alex-cory/sf-hacks-react-starter,OlehHappy/oleh_012-DnD_React_Native_CustomElement,taymoork2/react-hot-boilerplate,buttercomponents/butter-component-stars,alex-cory/sf-hacks-react-starter,gustavoguichard/react-image-uploader,Ladex/reactSVG,betoesquivel/hackmtyaug16_LSystemsUI,eric-wood/playlist,AndrewZures/ixora,kylefdoherty/redux-todo,ePak/react-datepicker-csp,j-der/pickmeup-ui,lyhoanglong/react-hot-boilerplate,colevoss/react-hot-boilerplate,hedgerh/thinkful-react-blog,Marcoga/react-timeslider-filter,chasemc67/Unlimited-Image-Compression,taggartbg/connectjs2015,gonardfreeman/moviesDB,joshlevy89/pinclone,SiAdcock/bg-prototype,ivmarcos/react-hot-boilerplate,atlonis/teach-react,kostya9116/expense-app,zeljkoX/e-learning,samlawrencejones/react-starter,rahulpyd/react-dnd-sort-example,miknonny/github-notetaker,ifunk/audiovisual-react,OlehHappy/oleh_005-DnD_Chess_React,rikukissa/knockout-reflux,taskworld/react-overlay-popup,Florenz23/wifi_signals,weixing2014/react-hot-boilerplate,betoesquivel/hackmtyaug16_LSystemsUI,rodfernandez/react-hot-boilerplate,mjxm/loadingscreen,atlonis/teach-react,bryaneaton13/discussion-comments,joshlevy89/stock-market-app,joshlevy89/stock-market-app,rodolfo2488/butter-component-builder,buttercomponents/butter-component-show-detail,adjohnson916/reactabular,AlexKVal/react-hot-boilerplate,vnguyen94/react-commute,neerajdotname/react-counter,barock19/react-hot-boilerplate,Nek/Signerbox,ohlsont/commutable-homes,eduardopoleo/blog-fe,tongcx/gantt.js,hoodwink73/react-hello-world,hedgerh/thinkful-react-blog,weixing2014/react-hot-boilerplate,ScholtenSeb/react-hot-boilerplate,morgante/deceptachat,rikukissa/flappy-bird,cmelion/react-hot-boilerplate,SiAdcock/bg-prototype,gilbox/elegant-react-hot-demo,michaelBenin/react-hot-boilerplate,vire/resit,xaiki/react-popcorn,deluxe-pig/cloud-farmer,revivek/hackdays-chat-client,morgante/react-starter,SwordSoul/swordsoul.github.com,ZucchiniZe/flux-people,batmanimal/react-hot-boilerplate,lassecapel/friendlist-app,robsquires/react-audio-examples,ifunk/audiovisual-react,LinkedList/react-hot-boilerplate,bthj/chain-reaction-board,megawidget/reactabular,CookPete/react-hot-boilerplate,buttercomponents/butter-component-builder,jnwng/calendar,esoman/eli-dnd,buttercomponents/butter-component-show-header,michaelBenin/react-hot-boilerplate,txgruppi/react-hot-boilerplate,autozimu/react-hot-boilerplate,r0m4/reactWebpack,nadee013/react-router,Ligerlilly/redo,rodolfo2488/butter-component-builder,ncuillery/react-hot-boilerplate,buttercomponents/butter-component,surikaterna/formr,IanBarkerDev/pinterest,Youpinadi/load-monitor,hugihlynsson/hver-er-leigan,sljuka/bizflow-ui,Alkamenos/friendlist,SalvaCarsi/Geometric,kaushik94/reactabular,yatish27/react-hot-boilerplate,Youpinadi/load-monitor,jakewisse/layout-dependent-rendering,jnwng/calendar,JasonStoltz/test-runner-demo,ghostsnstuff/byte,batmanimal/react-hot-boilerplate,schutterp/hotreactdux-fullstack-starter,rikukissa/flappy-bird,jptconiconde/react-happy-starter,SwordSoul/swordsoul.github.com,cpachomski/Lines,hidden4003/react-hot-boilerplate,kaushik94/reactabular,joeyfigaro/migrated,dvshur/react-components-inject,barcicki/react-hot-gulp-boilerplate,davidminor/password-supply,halochou/react-playground,bofa/demography-portal,edwinwright/react-project,Eol217/redux-course,ntwcklng/react-hot-boilerplate,future-ui/basics,seanpharvey/react-hot-boilerplate,ntwcklng/react-hot-boilerplate,CatDaVinci/wiser-react-redux,cdaringe/square-dance,cpachomski/Lines,debarshri/react-logger,Ehesp/react-flux-webpack-boilerplate,jptconiconde/react-happy-starter,CatDaVinci/wiser-react-redux,nadee013/react,msikma/react-hot-boilerplate,nrobin24/react-sidescroller,mattcav/airline-interface-prototype,johatl/react-hot-boilerplate3,pcdv/react-explorer,tomenden/webpack-react,roytang121/phaser-game-demo,blaqbern/intro-to-react,natstar93/React_train_timings,jonboerner/flipturn,InSuperposition/react-hot-boilerplate,thrawny/hscards,dhrp/react-overlay-popup,anara123/udemy-react-todo-app,postazure/redux-helloworld,marg51/uto,lassecapel/friendlist-app,morgante/laughbot,jxnblk/react-basscss-hot-boilerplate,skainth/500px-React,vsuperator/todomvc-redux,happypeter/sketch-with-css,nrobin24/react-sidescroller,alexqeo/react-redux-todos,dbatten4/chessboard-react,Ladex/reactSVG,marcello3d/react-hotplate,yanhua365/react-hot-boilerplate,masonforest/stellar.dance,miknonny/github-notetaker,weilidai2001/react-radium-playground,mattlewis92/react-imgur,ncuillery/react-hot-boilerplate,AlexKVal/react-hot-boilerplate,ecastano/generation-take-home,mboperator/fractalTodoExample,happypeter/sketch-with-css,alphanumeric0101/pomodo-it,Florenz23/wifi_signals,g8extended/Character-Generator,ZigGreen/matrix-calc--test-task,rodfernandez/react-hot-boilerplate,AndrewZures/ixora,vsuperator/simple-shop,hidden4003/react-hot-boilerplate,gustavoguichard/react-image-uploader,rahulpyd/react-dnd-sort-example,kylefdoherty/ipsum-generator,morgante/deceptachat,addi90/redux-todo,cruiz07/react-hot-boilerplate,Narasimman/ReactTrials,OlehHappy/oleh_006-DnD_Native_Boxes,Eol217/redux-course,ryanflorence/react-hot-boilerplate,Marcoga/react-timeslider-filter,revivek/hackdays-chat-client,OlehHappy/oleh_011-DnD_React_Native_Box,OlehHappy/oleh_010-DnD_React_transhand01_bind,autozimu/react-hot-boilerplate,hedgerh/thinkful-reflux-async,joeyfigaro/migrated,mdanie2/stanford-prereq-graph,debarshri/react-logger,GovWizely/trade-event-search-app,szhangpitt/react-hot-es6,skainth/500px-React,gordon2012/friendlist,ohlsont/commutable-homes,josebalius/react-hot-boilerplate,morgante/laughbot,jaredbrookswhite/barebones_react_hot_loading_boilerplate,deluxe-pig/cloud-farmer,OlehHappy/oleh_009-DnD_React_transhand01_changed-forneeds,aboutscript/react-tutorial-ninputs,ryanflorence/react-hot-boilerplate,alphanumeric0101/pomodo-it,thrawny/hscards,nadee013/react-router,agualbbus/fibmaps,andrevvalle/redux-lab,kylefdoherty/ipsum-generator,ViniciusAtaide/reduxchat,LinkedList/react-hot-boilerplate,ransanjeev/react-hot-boilerplate,j-der/pickmeup-ui,rikukissa/dogfight-dodgers,miknonny/reflux_stores,gaearon/react-hot-boilerplate,paragonbliss/ReduxTut,mboperator/fractalTodoExample,w01fgang/react-hot-boilerplate,vicai/MusicMoodzon,fatrossy/color_palette,masonforest/stellar.dance,miknonny/reflux_stores,rdoh/reactabular,txgruppi/react-hot-boilerplate,OlehHappy/oleh_008-DnD_React_transhand01,mattlewis92/react-imgur,yang-wei/resit,csmalin/reduxchat,roth1002/react-hot-boilerplate,mdkalish/json_selector,pebie/ecodex,bryaneaton13/discussion-comments,neerajdotname/react-counter,buttercomponents/butter-component-builder,amysimmons/mememe,Yangani/friendlist,yang-wei/resit,OlehHappy/oleh_005-DnD_Chess_React,edwinwright/react-project,dixitc/react-hot-boilerplate,davesnx/wpbase.com,Barakar/FriendList,johatl/react-hot-boilerplate3,alexravs/midgar,klik1301/ex7_repos_baobal,CookPete/react-hot-boilerplate,dixitc/react-hot-boilerplate,hedgerh/thinkful-react-hoc,yatish27/react-hot-boilerplate,Ligerlilly/redo,joshlevy89/the-book-thing,pebie/ecodex,yanhua365/react-hot-boilerplate,ViniciusAtaide/chatflux,ghostsnstuff/byte,ftorre104/todolist-redux,chandlera/react-hot-boilerplate,jaredbrookswhite/barebones_react_hot_loading_boilerplate,morgante/react-starter,hedgerh/thinkful-react-style-guide,buttercomponents/butter-component-settings,saeedmahani/rt-fullscreen-search,VictorBjelkholm/webpack-node-ipfs-api-demo,weixing2014/redux-todo,halochou/react-playground,gaearon/react-hot-boilerplate,mdanie2/stanford-prereq-graph,ScholtenSeb/react-hot-boilerplate,IanBarkerDev/pinterest,kostya9116/expense-app,zeljkoX/e-learning,paragonbliss/ReduxTut,davesnx/wpbase.com,JasonStoltz/test-runner-demo,vsuperator/todomvc-redux,ijones16/react-hot-boilerplate,surikaterna/formr,r0m4/reactWebpack
f81347d9fb7f1ea6c75aaf17bc6f8d5bf5851236
package.js
package.js
Package.describe({ summary: "A meteorite package that makes building dynamic two way forms easy", version: '0.2.1', name: "joshowens:simple-form", git: 'https://github.com/MeteorClub/simple-form' }); Package.onUse(function(api) { api.versionsFrom("METEOR@0.9.0"); api.use(['ui', 'templating', 'underscore', 'mrt:underscore-string-latest@2.3.3'], 'client'); api.addFiles(['fileField.html', 'fileField.js', 'helper.js', 'simpleform.js'], 'client'); api.export('SimpleForm', 'client'); });
Package.describe({ summary: "A meteorite package that makes building dynamic two way forms easy", version: '0.2.2', name: "joshowens:simple-form", git: 'https://github.com/MeteorClub/simple-form' }); Package.onUse(function(api) { api.versionsFrom("METEOR@0.9.0"); api.use(['ui', 'templating', 'underscore', 'schnie:uploader', 'mrt:underscore-string-latest@2.3.3'], 'client'); api.addFiles(['fileField.html', 'fileField.js', 'helper.js', 'simpleform.js'], 'client'); api.export('SimpleForm', 'client'); });
Add uploaded as a dep.
Add uploaded as a dep.
JavaScript
mit
meteorclub/simple-form
3e4891edc2982234affe74f36e1b16062b8a72d5
packages/mjml-cli/src/commands/outputToConsole.js
packages/mjml-cli/src/commands/outputToConsole.js
export default ({ compiled: { html }, file }) => new Promise(resolve => { // eslint-disable-next-line console.log(`<!-- FILE: ${file} -->\n${html}`) resolve() })
export default ({ compiled: { html }, file }) => new Promise(resolve => { process.stdout.write(`<!-- FILE: ${file} -->\n${html}\n`, resolve); })
Use `process.stdout.write()` instead of `console.log()` so output is flushed.
Use `process.stdout.write()` instead of `console.log()` so output is flushed.
JavaScript
mit
mjmlio/mjml
ebdcf420ff5ddbded791456f7e5f17f8bc328ea3
src/app/router/handlers/ToggleSubredditSubscription.js
src/app/router/handlers/ToggleSubredditSubscription.js
import { BaseHandler, METHODS } from '@r/platform/router'; import * as subredditActions from 'app/actions/subreddits'; export default class ToggleSubredditSubscription extends BaseHandler { async [METHODS.POST](dispatch) { dispatch(subredditActions.toggleSubscription(this.bodyParams)); } }
import { BaseHandler, METHODS } from '@r/platform/router'; import * as subscriptionActions from 'app/actions/subscribedSubreddits'; export default class ToggleSubredditSubscription extends BaseHandler { async [METHODS.POST](dispatch) { dispatch(subscriptionActions.toggleSubscription(this.bodyParams)); } }
Fix subscription handler from refactor
Fix subscription handler from refactor
JavaScript
mit
ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile,ajacksified/reddit-mobile
ba4738a3246f53c944e84a37ce3ba2f5bc30f20c
www/discography/js/models/artist.js
www/discography/js/models/artist.js
Artist = (function(){ // Artist constructor. Given an object describing an artist, copy // all of its local properties into `this'. var Artist = function(record) { }; Artist.prototype = { // Create a new record if the `id' property is `undefined', // otherwise update an existing record. Return a promise from the // Ajax library. save: function() { }, // Optional: Write a `destroy' method that deletes the artist. // Return a promise. destroy: function() { }, }; // Should fetch a single artist via Ajax. Return a promise that // resolves to an instance of the Artist function. var fetchOne = function(id) { }; // Should fetch all artists via Ajax. Return a promise that // resolves to an array of Artist objects. }; // Public interface: return { fetchOne: fetchOne, fetchAll: fetchAll, create: function(record) { return new Artist(record); }, }; })();
Artist = (function(){ // Artist constructor. Given an object describing an artist, copy // all of its local properties into `this'. var Artist = function(record) { }; Artist.prototype = { // Create a new record if the `id' property is `undefined', // otherwise update an existing record. Return a promise from the // Ajax library. save: function() { }, // Optional: Write a `destroy' method that deletes the artist. // Return a promise. destroy: function() { }, }; // Should fetch a single artist via Ajax. Return a promise that // resolves to an instance of the Artist function. var fetchOne = function(id) { }; // Should fetch all artists via Ajax. Return a promise that // resolves to an array of Artist objects. var fetchAll = function() { }; // Public interface: return { fetchOne: fetchOne, fetchAll: fetchAll, create: function(record) { return new Artist(record); }, }; })();
Fix code after a bad rebase/merge
Fix code after a bad rebase/merge
JavaScript
bsd-2-clause
rm-training/advanced-js,rm-training/advanced-js
e6acbd0c0e537061373cc8f877264681c5b9b476
test/locales.js
test/locales.js
import test from "ava"; const fs = require("fs"); const path = require("path"); const localesPath = path.join(__dirname, "..", "locales"); fs.readdir(localesPath, (err, filenames) => { if (err) throw err; const filenameRegex = /^[a-z][a-z](_[A-Z]+)*\.json$/; filenames.forEach(filename => { test(`locale filename "${filename}" is valid`, t => { t.true(filenameRegex.test(filename)); }); }); filenames.forEach(filename => { const content = fs.readFileSync(path.join(localesPath, filename), { encoding: "utf8" }); let valid = false; try { JSON.parse(content); valid = true; } catch (e) {} test(`locale file "${filename}" is valid`, t => t.true(valid)); }); });
import test from "ava"; const fs = require("fs"); const path = require("path"); const localesPath = path.join(__dirname, "..", "locales"); const filenameRegex = /^[a-z][a-z](_[A-Z]+)*\.json$/; test("locale files are valid", t => { const filenames = fs.readdirSync(localesPath); filenames.forEach(filename => { /* test filename */ if (!filenameRegex.test(filename)) t.fail(`locale filename "${filename}" is invalid`); /* test file json */ const content = fs.readFileSync(path.join(localesPath, filename), { encoding: "utf8" }); let valid = false; try { JSON.parse(content); valid = true; } catch (e) {} if (!valid) t.fail(`locale file "${filename}" is invalid`); }); t.pass(); // if nothing has failed so far });
Make locale tests into one test
Make locale tests into one test
JavaScript
apache-2.0
z-------------/cumulonimbus,z-------------/cumulonimbus,z-------------/cumulonimbus
1d28b0b58b0dca8aeb81afc182a53686e09b211b
app/components/Footer/messages.js
app/components/Footer/messages.js
/* * Footer Messages * * This contains all the text for the Footer component. */ import { defineMessages } from 'react-intl'; export default defineMessages({ header: { id: 'app.components.Footer.header', defaultMessage: 'This is the Footer component !', }, });
/* * Footer Messages * * This contains all the text for the Footer component. */ import { defineMessages } from 'react-intl'; export default defineMessages({ header: { id: 'app.components.Footer.header', defaultMessage: 'made by Tim Arioto', }, });
Add name to footer message
Add name to footer message
JavaScript
mit
tarioto/Portfolio,tarioto/Portfolio
d9cc135578fe736adb5fc3d407ae3ea94a76b066
tests/router.js
tests/router.js
"use strict"; var Router = require("../router"); exports.testValidAcceptHeader = function (test) { var results = Router.prototype._parseAcceptHeader("application/json"); test.deepEqual([{ "type": "application", "subtype": "json", "params": {} }], results); test.done(); };
"use strict"; var Router = require("../router"); exports.testValidAcceptHeader = function (test) { var results = Router.prototype._parseAcceptHeader("application/json"); test.deepEqual([{ "type": "application", "subtype": "json", "params": {} }], results); test.done(); }; exports.testValidAcceptHeaderWithParams = function (test) { var results = Router.prototype._parseAcceptHeader("application/json;q=3;v=1"); test.deepEqual([{ "type": "application", "subtype": "json", "params": { "q": "3", "v": "1" } }], results); test.done(); };
Add test for media type w/ params
Add test for media type w/ params
JavaScript
isc
whymarrh/mattress
eb45903f169d27dc361488556a3b508ed98cbf86
src/icon.js
src/icon.js
/** * Simple component to display a font icon (i.e. glyphicon or fontawesome) */ const React = require('react'); const classNames = require('classnames'); class Icon extends React.Component { render() { const cx = classNames({ [this.props.type]: true, [`${this.props.type}-${this.props.name}`]: true }); return <i className={cx} />; } } Icon.propTypes = { type: React.PropTypes.oneOf(['fa', 'glyphicon']), name: React.PropTypes.string.isRequired }; Icon.defaultProps = { type: 'fa' }; module.exports = Icon;
/** * Simple component to display a font icon (i.e. glyphicon or fontawesome) */ const React = require('react'); const classNames = require('classnames'); class Icon extends React.Component { render() { const cx = classNames( this.props.type, `${this.props.type}-${this.props.name}` ); return <i className={cx} />; } } Icon.propTypes = { type: React.PropTypes.oneOf(['fa', 'glyphicon']), name: React.PropTypes.string.isRequired }; Icon.defaultProps = { type: 'fa' }; module.exports = Icon;
Fix computed properties were causing some issues with duplicated data props
Fix computed properties were causing some issues with duplicated data props
JavaScript
mit
Opstarts/opstarts-ui
915030ff1fa7c525dee93488d8adcf76cc53dea1
src/sync.js
src/sync.js
import { createTransform } from 'redux-persist'; import CryptoJSCore from 'crypto-js/core'; import AES from 'crypto-js/aes'; import { makeEncryptor, makeDecryptor } from './helpers'; const makeSyncEncryptor = secretKey => makeEncryptor(state => AES.encrypt(state, secretKey).toString()); const makeSyncDecryptor = (secretKey, onError) => makeDecryptor(state => { const bytes = AES.decrypt(state, secretKey); const decryptedString = bytes.toString(CryptoJSCore.enc.Utf8); if (!decryptedString) { throw new Error( 'Could not decrypt state. Please verify that you are using the correct secret key.' ); } return JSON.parse(decryptedString); }, onError); export default config => { const inbound = makeSyncEncryptor(config.secretKey); const outbound = makeSyncDecryptor(config.secretKey, config.onError); return createTransform(inbound, outbound, config); };
import { createTransform } from 'redux-persist'; import CryptoJSCore from 'crypto-js/core'; import AES from 'crypto-js/aes'; import { makeEncryptor, makeDecryptor } from './helpers'; const makeSyncEncryptor = secretKey => makeEncryptor(state => AES.encrypt(state, secretKey).toString()); const makeSyncDecryptor = (secretKey, onError) => makeDecryptor(state => { try { const bytes = AES.decrypt(state, secretKey); const decryptedString = bytes.toString(CryptoJSCore.enc.Utf8); return JSON.parse(decryptedString); } catch (err) { throw new Error( 'Could not decrypt state. Please verify that you are using the correct secret key.' ); } }, onError); export default config => { const inbound = makeSyncEncryptor(config.secretKey); const outbound = makeSyncDecryptor(config.secretKey, config.onError); return createTransform(inbound, outbound, config); };
Use try/catch to handle cases where the decryption could fail
Use try/catch to handle cases where the decryption could fail
JavaScript
mit
maxdeviant/redux-persist-transform-encrypt,maxdeviant/redux-persist-transform-encrypt
77f8b1e5e48505856f1a3729a0067cc0673d5016
app/scripts/components/resource/resource-breadcrumbs.js
app/scripts/components/resource/resource-breadcrumbs.js
export const resourceBreadcrumbs = { template: '<breadcrumbs items="$ctrl.items" active-item="$ctrl.activeItem"/>', bindings: { resource: '<' }, controller: class ResourceBreadcrumbsController { constructor(ResourceBreadcrumbsService) { this.ResourceBreadcrumbsService = ResourceBreadcrumbsService; } $onInit() { this.items = [ { label: 'Project dashboard', state: 'project.details', params: { uuid: this.resource.project_uuid } }, ...this.ResourceBreadcrumbsService.get(this.resource), ]; this.activeItem = this.resource.name; } } };
export const resourceBreadcrumbs = { template: '<breadcrumbs items="$ctrl.items" active-item="$ctrl.activeItem"/>', bindings: { resource: '<' }, controller: class ResourceBreadcrumbsController { constructor(ResourceBreadcrumbsService) { this.ResourceBreadcrumbsService = ResourceBreadcrumbsService; } $onInit() { this.items = [ { label: 'Project dashboard', state: 'project.details', params: { uuid: this.resource.project_uuid } }, ...this.ResourceBreadcrumbsService.get(this.resource), ]; this.activeItem = this.resource.name; } $doCheck() { if (this.activeItem !== this.resource.name) { this.activeItem = this.resource.name; } } } };
Update resource name in breadcrumbs if it has been changed (WAL-347)
Update resource name in breadcrumbs if it has been changed (WAL-347)
JavaScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
39c3c82c0c07df59d05b3b07c5d711d7274696a1
rollup.config.js
rollup.config.js
import commonjs from '@rollup/plugin-commonjs'; import glslify from 'rollup-plugin-glslify'; import resolve from '@rollup/plugin-node-resolve'; import copy from "rollup-plugin-copy"; export default { input: ['source/gltf-sample-viewer.js'], output: [ { file: 'dist/gltf-viewer.js', format: 'cjs', sourcemap: true }, { file: 'dist/gltf-viewer.module.js', format: 'esm', sourcemap: true, } ], plugins: [ glslify(), copy({ targets: [ { src: [ "assets/images/lut_charlie.png", "assets/images/lut_ggx.png", "assets/images/lut_sheen_E.png", ], dest: "dist/assets" }, { src: ["source/libs/*", "!source/libs/hdrpng.js"], dest: "dist/libs" } ] }), ] };
import commonjs from '@rollup/plugin-commonjs'; import glslify from 'rollup-plugin-glslify'; import resolve from '@rollup/plugin-node-resolve'; import copy from "rollup-plugin-copy"; export default { input: ['source/gltf-sample-viewer.js'], output: [ { file: 'dist/gltf-viewer.js', format: 'cjs', sourcemap: true }, { file: 'dist/gltf-viewer.module.js', format: 'esm', sourcemap: true, } ], plugins: [ glslify(), copy({ targets: [ { src: [ "assets/images/lut_charlie.png", "assets/images/lut_ggx.png", "assets/images/lut_sheen_E.png", ], dest: "dist/assets" }, { src: ["source/libs/*", "!source/libs/hdrpng.js"], dest: "dist/libs" } ] }), commonjs(), ] };
Revert "Remove commonjs in top level"
Revert "Remove commonjs in top level" This reverts commit a2690e601c457d27966adc6d074b9966f906e1b7.
JavaScript
apache-2.0
KhronosGroup/glTF-Sample-Viewer,KhronosGroup/glTF-Sample-Viewer
ac129d269eea79c21f763c2060a663513d5d9043
rollup.config.js
rollup.config.js
import { terser } from "rollup-plugin-terser"; import filesize from "rollup-plugin-filesize"; import license from "rollup-plugin-license"; export default [ { input: "src/js.cookie.mjs", output: [ // config for <script type="module"> { dir: "dist", entryFileNames: "[name].mjs", format: "esm" }, // config for <script nomodule> { dir: "dist", name: "Cookies", entryFileNames: "[name].js", format: "umd" } ] }, { input: "src/js.cookie.mjs", output: [ // config for <script type="module"> { dir: "dist", entryFileNames: "[name].min.mjs", format: "esm" }, // config for <script nomodule> { dir: "dist", name: "Cookies", entryFileNames: "[name].min.js", format: "umd" } ], plugins: [ terser(), license({ banner: { content: "/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */", commentStyle: "none" } }), filesize() ] } ];
import { terser } from "rollup-plugin-terser"; import filesize from "rollup-plugin-filesize"; import license from "rollup-plugin-license"; export default [ { input: "src/js.cookie.mjs", output: [ // config for <script type="module"> { dir: "dist", entryFileNames: "[name].mjs", format: "esm" }, // config for <script nomodule> { dir: "dist", name: "Cookies", entryFileNames: "[name].js", format: "umd", noConflict: true } ] }, { input: "src/js.cookie.mjs", output: [ // config for <script type="module"> { dir: "dist", entryFileNames: "[name].min.mjs", format: "esm" }, // config for <script nomodule> { dir: "dist", name: "Cookies", entryFileNames: "[name].min.js", format: "umd", noConflict: true } ], plugins: [ terser(), license({ banner: { content: "/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */", commentStyle: "none" } }), filesize() ] } ];
Bring back noConflict functionality for umd module
Bring back noConflict functionality for umd module Rollup provides an out-of-the-box option for this, thus not going to test (generated).
JavaScript
mit
carhartl/js-cookie,js-cookie/js-cookie,carhartl/js-cookie,js-cookie/js-cookie
b017d2d324a5c0ad8b116eee2ff09c48a4925491
spec/api-global-shortcut-spec.js
spec/api-global-shortcut-spec.js
const {globalShortcut} = require('electron').remote const assert = require('assert') describe('globalShortcut module', () => { beforeEach(() => { globalShortcut.unregisterAll() }) it('can register and unregister accelerators', () => { const accelerator = 'CommandOrControl+A+B+C' assert.equal(globalShortcut.isRegistered(accelerator), false) globalShortcut.register(accelerator, () => {}) assert.equal(globalShortcut.isRegistered(accelerator), true) globalShortcut.unregister(accelerator) assert.equal(globalShortcut.isRegistered(accelerator), false) assert.equal(globalShortcut.isRegistered(accelerator), false) globalShortcut.register(accelerator, () => {}) assert.equal(globalShortcut.isRegistered(accelerator), true) globalShortcut.unregisterAll() assert.equal(globalShortcut.isRegistered(accelerator), false) }) })
const {globalShortcut} = require('electron').remote const assert = require('assert') const isCI = require('electron').remote.getGlobal('isCi') describe('globalShortcut module', () => { if (isCI && process.platform === 'win32') { return } beforeEach(() => { globalShortcut.unregisterAll() }) it('can register and unregister accelerators', () => { const accelerator = 'CommandOrControl+A+B+C' assert.equal(globalShortcut.isRegistered(accelerator), false) globalShortcut.register(accelerator, () => {}) assert.equal(globalShortcut.isRegistered(accelerator), true) globalShortcut.unregister(accelerator) assert.equal(globalShortcut.isRegistered(accelerator), false) assert.equal(globalShortcut.isRegistered(accelerator), false) globalShortcut.register(accelerator, () => {}) assert.equal(globalShortcut.isRegistered(accelerator), true) globalShortcut.unregisterAll() assert.equal(globalShortcut.isRegistered(accelerator), false) }) })
Disable globalShortcut spec on Windows CI
Disable globalShortcut spec on Windows CI
JavaScript
mit
wan-qy/electron,kokdemo/electron,deed02392/electron,miniak/electron,thomsonreuters/electron,electron/electron,rreimann/electron,biblerule/UMCTelnetHub,noikiy/electron,leethomas/electron,miniak/electron,leethomas/electron,gerhardberger/electron,deed02392/electron,tinydew4/electron,dongjoon-hyun/electron,tonyganch/electron,shiftkey/electron,thompsonemerson/electron,shiftkey/electron,Gerhut/electron,gabriel/electron,posix4e/electron,miniak/electron,rajatsingla28/electron,noikiy/electron,bpasero/electron,brave/electron,minggo/electron,dongjoon-hyun/electron,MaxWhere/electron,noikiy/electron,miniak/electron,posix4e/electron,renaesop/electron,bpasero/electron,shiftkey/electron,MaxWhere/electron,electron/electron,thompsonemerson/electron,gabriel/electron,Gerhut/electron,wan-qy/electron,biblerule/UMCTelnetHub,joaomoreno/atom-shell,tonyganch/electron,aichingm/electron,voidbridge/electron,aliib/electron,Floato/electron,thomsonreuters/electron,gerhardberger/electron,shiftkey/electron,Floato/electron,voidbridge/electron,miniak/electron,aichingm/electron,gabriel/electron,minggo/electron,MaxWhere/electron,posix4e/electron,shiftkey/electron,dongjoon-hyun/electron,wan-qy/electron,miniak/electron,minggo/electron,thomsonreuters/electron,leethomas/electron,MaxWhere/electron,twolfson/electron,aliib/electron,joaomoreno/atom-shell,gabriel/electron,tonyganch/electron,kokdemo/electron,joaomoreno/atom-shell,electron/electron,gabriel/electron,Floato/electron,twolfson/electron,aliib/electron,electron/electron,leethomas/electron,seanchas116/electron,biblerule/UMCTelnetHub,Gerhut/electron,brenca/electron,joaomoreno/atom-shell,aichingm/electron,joaomoreno/atom-shell,wan-qy/electron,the-ress/electron,noikiy/electron,deed02392/electron,noikiy/electron,brave/electron,wan-qy/electron,brave/muon,the-ress/electron,leethomas/electron,dongjoon-hyun/electron,thompsonemerson/electron,electron/electron,Gerhut/electron,renaesop/electron,minggo/electron,tonyganch/electron,wan-qy/electron,brave/electron,renaesop/electron,brave/muon,bpasero/electron,brenca/electron,voidbridge/electron,seanchas116/electron,thomsonreuters/electron,voidbridge/electron,renaesop/electron,aliib/electron,electron/electron,posix4e/electron,aichingm/electron,kokdemo/electron,aliib/electron,Floato/electron,renaesop/electron,seanchas116/electron,rreimann/electron,gerhardberger/electron,bpasero/electron,gerhardberger/electron,thomsonreuters/electron,posix4e/electron,rreimann/electron,voidbridge/electron,deed02392/electron,aichingm/electron,Gerhut/electron,twolfson/electron,joaomoreno/atom-shell,kokdemo/electron,rajatsingla28/electron,Gerhut/electron,minggo/electron,tinydew4/electron,brenca/electron,tinydew4/electron,dongjoon-hyun/electron,gerhardberger/electron,rajatsingla28/electron,rajatsingla28/electron,tinydew4/electron,MaxWhere/electron,electron/electron,gerhardberger/electron,brave/muon,kokdemo/electron,tinydew4/electron,gerhardberger/electron,brenca/electron,rreimann/electron,gabriel/electron,biblerule/UMCTelnetHub,brave/muon,the-ress/electron,the-ress/electron,brave/muon,brave/muon,brave/electron,aliib/electron,biblerule/UMCTelnetHub,posix4e/electron,deed02392/electron,thompsonemerson/electron,seanchas116/electron,deed02392/electron,seanchas116/electron,renaesop/electron,voidbridge/electron,Floato/electron,thomsonreuters/electron,rajatsingla28/electron,twolfson/electron,noikiy/electron,seanchas116/electron,brenca/electron,brave/electron,rreimann/electron,bpasero/electron,brenca/electron,rreimann/electron,brave/electron,kokdemo/electron,the-ress/electron,shiftkey/electron,thompsonemerson/electron,aichingm/electron,Floato/electron,the-ress/electron,bpasero/electron,tinydew4/electron,rajatsingla28/electron,MaxWhere/electron,tonyganch/electron,the-ress/electron,dongjoon-hyun/electron,leethomas/electron,twolfson/electron,biblerule/UMCTelnetHub,minggo/electron,thompsonemerson/electron,twolfson/electron,tonyganch/electron,bpasero/electron
b69f528b0251817b8a4349b7ddccdf9bf29adb39
source/Button.js
source/Button.js
/** _moon.Button_ is an <a href="#enyo.Button">enyo.Button</a> with Moonstone styling applied. The color of the button may be customized by specifying a background color. For more information, see the documentation on <a href='https://github.com/enyojs/enyo/wiki/Buttons'>Buttons</a> in the Enyo Developer Guide. */ enyo.kind({ name : 'moon.Button', kind : 'enyo.Button', publiched : { /** _small_ is a parameter to indicates the size of button. If it has true value, diameter of this button is 60px. However, the tap-target for button still has 78px, so it has invisible DOM which wrap this small button to provide wider tap zone. */ small : false, }, classes : 'moon-button enyo-unselectable', spotlight : true, handlers: { onSpotlightSelect : 'depress', onSpotlightKeyUp : 'undepress' }, depress: function() { this.addClass('pressed'); }, undepress: function() { this.removeClass('pressed'); }, smallChanged: function() { this.addRemoveClass(this.small, 'small'); } });
/** _moon.Button_ is an <a href="#enyo.Button">enyo.Button</a> with Moonstone styling applied. The color of the button may be customized by specifying a background color. For more information, see the documentation on <a href='https://github.com/enyojs/enyo/wiki/Buttons'>Buttons</a> in the Enyo Developer Guide. */ enyo.kind({ name : 'moon.Button', kind : 'enyo.Button', publiched : { /** _small_ is a parameter to indicates the size of button. If it has true value, diameter of this button is 60px. However, the tap-target for button still has 78px, so it has invisible DOM which wrap this small button to provide wider tap zone. */ small : false, }, classes : 'moon-button enyo-unselectable', spotlight : true, handlers: { onSpotlightSelect : 'depress', onSpotlightKeyUp : 'undepress' }, create: function() { this.inherited(arguments); this.smallChanged(); }, depress: function() { this.addClass('pressed'); }, undepress: function() { this.removeClass('pressed'); }, smallChanged: function() { this.addRemoveClass('small', this.small); } });
Add a call for changed method in create time
GF-5039: Add a call for changed method in create time Enyo-DCO-1.1-Signed-off-by: David Um <david.um@lge.com>
JavaScript
apache-2.0
mcanthony/moonstone,enyojs/moonstone,mcanthony/moonstone,mcanthony/moonstone
334f2cfdded8f73ea4647e3c115d357403fa1299
i18n/jquery.spectrum-pt-br.js
i18n/jquery.spectrum-pt-br.js
// Spectrum Colorpicker // Brazilian (pt-br) localization // https://github.com/bgrins/spectrum (function ( $ ) { var localization = $.spectrum.localization["pt-br"] = { cancelText: "Cancelar", chooseText: "Escolher" }; $.extend($.fn.spectrum.defaults, localization); })( jQuery );
// Spectrum Colorpicker // Brazilian (pt-br) localization // https://github.com/bgrins/spectrum (function ( $ ) { var localization = $.spectrum.localization["pt-br"] = { cancelText: "Cancelar", chooseText: "Escolher", clearText: "Limpar cor selecionada", noColorSelectedText: "Nenhuma cor selecionada", togglePaletteMoreText: "Mais", togglePaletteLessText: "Menos" }; $.extend($.fn.spectrum.defaults, localization); })( jQuery );
Update Brazilian Portuguese language file.
Update Brazilian Portuguese language file.
JavaScript
mit
GerHobbelt/spectrum,liitii/spectrum,ajssd/spectrum,armanforghani/spectrum,GerHobbelt/spectrum,armanforghani/spectrum,safareli/spectrum,maurojs25/spectrum,shawinder/spectrum,kotmatpockuh/spectrum,ginlime/spectrum,ginlime/spectrum,liitii/spectrum,shawinder/spectrum,maurojs25/spectrum,safareli/spectrum,c9s/spectrum,kotmatpockuh/spectrum,ajssd/spectrum,bgrins/spectrum,bgrins/spectrum
cb8df8f1f2eaf047f21421bbbf53a95d6e162d12
shared/model/status.js
shared/model/status.js
/* * Copyright (c) 2017 Bonnie Schulkin. All Rights Reserved. * * This file is part of BoxCharter. * * BoxCharter is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * BoxCharter is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License * for more details. * * You should have received a copy of the GNU Affero General Public License * along with BoxCharter. If not, see <http://www.gnu.org/licenses/>. * */ class Status { constructor(type, msg) { this.alertType = type this.text = msg this.clrAlertClosed = false // for ui } } const adminEmail = 'admin@boxcharter.com' const contactAdmin = `Please report this error to ${adminEmail}` const statusStrings = { success: 'alert-success', warning: 'alert-warning', danger: 'alert-danger', contactAdmin: contactAdmin, badRequest: `The server did not understand this request. ${contactAdmin}` } module.exports = { Status: Status, statusStrings: statusStrings }
/* * Copyright (c) 2017 Bonnie Schulkin. All Rights Reserved. * * This file is part of BoxCharter. * * BoxCharter is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * * BoxCharter is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License * for more details. * * You should have received a copy of the GNU Affero General Public License * along with BoxCharter. If not, see <http://www.gnu.org/licenses/>. * */ /** * Class for status passed from server to client. * @module status */ const adminEmail = 'admin@boxcharter.com' const contactAdmin = `Please report this error to ${adminEmail}` const statusStrings = { success: 'alert-success', warning: 'alert-warning', danger: 'alert-danger', badRequest: `The server did not understand this request. ${contactAdmin}`, contactAdmin, } /** * Status object. * @class */ class Status { /** * User constructor * @constructor * @param {string} type - type of alert for front end * @param {string} msg - message for the allert */ constructor(type, msg) { this.alertType = type this.text = msg this.clrAlertClosed = false // used by client } } module.exports = { Status, statusStrings, }
Clean up syntax for JSDoc and ESLint
Clean up syntax for JSDoc and ESLint
JavaScript
agpl-3.0
flyrightsister/boxcharter,flyrightsister/boxcharter
7c4b3a088e9ccd1d6378010887e7ae795589cb0d
source/mapKeys/test.js
source/mapKeys/test.js
/* eslint-disable flowtype/require-parameter-type, flowtype/require-return-type */ import {same} from "tap" import {replace} from "ramda" import mapKeys from "./" same( mapKeys(replace(/new/, ""))({ newLabel: "1", newValue: "2", }), { Label: "1", Value: "2", } )
/* eslint-disable flowtype/require-parameter-type, flowtype/require-return-type */ import {same} from "tap" import {replace} from "ramda" import mapKeys from "./" same( mapKeys( replace(/new/)("") )({ newLabel: "1", newValue: "2", }), { Label: "1", Value: "2", } )
Test is a little bit cleaner
Test is a little bit cleaner
JavaScript
isc
krainboltgreene/ramda-extra.js,krainboltgreene/unction.js
ee95e86ea6b836b13fb3c512997aa5c5d5f377e2
addon/mixpanel.js
addon/mixpanel.js
import Ember from 'ember'; var mixpanel = window.mixpanel; export default Ember.Mixin.create({ content: mixpanel, people: function() { return Ember.ObjectProxy.extend({ content: function() { if (mixpanel) { return mixpanel.people; } }.property(), set: function() { if (!this.get('content')) { return; } return this.get('content')['set'](arguments); }, unknownProperty: function(key) { if (!this.get('content')) { return function() {}; } return this.get('content')[key].bind(this.get('content')); } }).create(); }.property(), unknownProperty: function(key) { if (!this.content) { return function() {}; } var f = this._super(key); if (f) { return f.bind(this.content); } return f; } });
import Ember from 'ember'; var mixpanel = window.mixpanel; export default Ember.Mixin.create({ content: mixpanel, people: function() { return Ember.ObjectProxy.extend({ content: function() { if (mixpanel) { return mixpanel.people; } }.property(), set: function() { if (!this.get('content')) { return; } return this.get('content')['set'](arguments); }, unknownProperty: function(key) { if (!this.get('content')) { return Ember.K; } return this.get('content')[key].bind(this.get('content')); } }).create(); }.property(), unknownProperty: function(key) { if (!this.content) { return Ember.K; } var f = this._super(key); if (f) { return f.bind(this.content); } return f; } });
Use Ember.K instead of defining our own empty function
Use Ember.K instead of defining our own empty function
JavaScript
mit
minichate/ember-mixpanel
ebd8a166cecbdb0945fb18008a8becc17f22358d
cla_public/static-src/javascripts/modules/currencyInputValidation.js
cla_public/static-src/javascripts/modules/currencyInputValidation.js
// ($(this).val() && Number($(this).val()) > 0) function isValidAmount(input) { var maxVal = 100000000 var minVal = 0 var value = input.split('.') var pounds = value[0] var pence = value[1] pounds = pounds.replaceAll(/^£|[\s,]+/g, "") if(pence) { var lengthOfPence = pence.length if(lengthOfPence > 2) { return false } } var amount = Number(pounds * 100) if(pence) { amount += Number(pence) } if(amount) { console.log('Amount: ' + amount) if(amount > maxVal || amount < minVal) { return false } } else { return false } return true } exports.isValidAmount = isValidAmount
// ($(this).val() && Number($(this).val()) > 0) function isValidAmount(input) { var maxVal = 100000000 var minVal = 0 var pounds; var pence; var trimmedInput = input.trim() var decimalPointPosition = trimmedInput.indexOf('.') if(decimalPointPosition === -1) { pounds = trimmedInput } else { pounds = trimmedInput.slice(0, decimalPointPosition) pence = trimmedInput.slice(decimalPointPosition + 1) } pounds = pounds.replace(/^£|[\s,]+/g, "") if(pence) { if(pence.length > 2) { return false } } var amount = Number(pounds * 100) if(pence) { amount += Number(pence) } if(amount) { if(amount > maxVal || amount < minVal) { return false } } else { return false } return true } exports.isValidAmount = isValidAmount
Refactor and split input amount into pounds and pence
Refactor and split input amount into pounds and pence
JavaScript
mit
ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public
39c89de8dc47d3e66c33e74d8c28c32cde002cc6
packages/test-studio/src/dashboardConfig.js
packages/test-studio/src/dashboardConfig.js
export default { widgets: [ {name: 'sanity-tutorials', layout: {width: 'full'}}, {name: 'document-list'}, {name: 'document-count'}, // {name: 'cats', layout: {width: 'medium'}, options: {imageWidth: 50}}, // {name: 'cats', layout: {width: 'medium'}, options: {imageWidth: 150}}, { name: 'project-info', layout: { width: 'medium' }, options: { data: [ {title: 'Frontend', value: 'https://asdf.heroku.com/greedy-goblin', category: 'apps'}, {title: 'Strange endpoint', value: 'https://example.com/v1/strange', category: 'apis'}, {title: 'With strawberry jam?', value: 'Yes', category: 'Waffles'} ] } }, // {name: 'cats', options: {imageWidth: 90}}, {name: 'stack-overview', layout: {width: 'full'}} ] }
export default { widgets: [ {name: 'sanity-tutorials', layout: {width: 'full'}}, {name: 'document-list'}, {name: 'document-count'}, {name: 'project-users'}, { name: 'project-info', layout: { width: 'medium' }, options: { data: [ {title: 'Frontend', value: 'https://asdf.heroku.com/greedy-goblin', category: 'apps'}, {title: 'Strange endpoint', value: 'https://example.com/v1/strange', category: 'apis'}, {title: 'With strawberry jam?', value: 'Yes', category: 'Waffles'} ] } }, // {name: 'cats', options: {imageWidth: 90}}, {name: 'stack-overview', layout: {width: 'full'}} ] }
Add project-users widget to test-studio dashboard config
[test-studio] Add project-users widget to test-studio dashboard config
JavaScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
23e2b3915bcd6fcbcac715742c8cf87ec3e84263
lib/botUtils.js
lib/botUtils.js
/* * Copyright (c) 2014-2020 Bjoern Kimminich. * SPDX-License-Identifier: MIT */ const models = require('../models/index') const fuzz = require('fuzzball') async function productPrice (query, user) { const [products] = await models.sequelize.query('SELECT * FROM Products') const queriedProducts = products .filter((product) => fuzz.partial_ratio(query, product.name) > 75) .map((product) => `${product.name}: ${product.price}¤`) return { action: 'response', body: queriedProducts.length > 0 ? queriedProducts.join(` `) : 'Sorry I couldn\'t find any products with that name' } } function testFunction (query, user) { return { action: 'response', body: '3be2e438b7f3d04c89d7749f727bb3bd' } } module.exports = { productPrice, testFunction }
/* * Copyright (c) 2014-2020 Bjoern Kimminich. * SPDX-License-Identifier: MIT */ const models = require('../models/index') const fuzz = require('fuzzball') async function productPrice (query, user) { const [products] = await models.sequelize.query('SELECT * FROM Products') const queriedProducts = products .filter((product) => fuzz.partial_ratio(query, product.name) > 75) .map((product) => `${product.name} costs ${product.price}¤`) return { action: 'response', body: queriedProducts.length > 0 ? queriedProducts.join(`, `) : 'Sorry I couldn\'t find any products with that name' } } function testFunction (query, user) { return { action: 'response', body: '3be2e438b7f3d04c89d7749f727bb3bd' } } module.exports = { productPrice, testFunction }
Use more natural language for price information
Use more natural language for price information
JavaScript
mit
bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop