commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
f9f8f7103cef43417a246414c311b2bcdad686c3
src/framework/util/util.js
src/framework/util/util.js
export function attemptChangeName(obj, name) { if (!canRedefineValue(obj, 'name')) { return; } Object.defineProperty(obj, 'name', { value: name, }); } export function canRedefineValue(obj, property) { const descriptor = Object.getOwnPropertyDescriptor(obj, property); return descriptor.configurable || descriptor.writable; } function suicide() { throw new TypeError('This method does not generate any actions. It cannot be called.'); } export function killMethod(providerClass, propertyName) { replaceMethod(providerClass, propertyName, suicide); } export function replaceMethod(clazz, propertyName, replacement) { if (!canRedefineValue(clazz, propertyName)) { throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`); } Object.defineProperty(clazz, propertyName, { value: replacement }); attemptChangeName(replacement, propertyName); }
export function attemptChangeName(obj, name) { if (!canRedefineValue(obj, 'name')) { return; } Object.defineProperty(obj, 'name', { value: name, }); } export function canRedefineValue(obj, property) { const descriptor = Object.getOwnPropertyDescriptor(obj, property); return descriptor.configurable || descriptor.writable; } function suicide() { throw new TypeError('This method cannot be called.'); } Object.freeze(suicide); export function killMethod(Class, propertyName) { replaceMethod(Class, propertyName, suicide); } export function replaceMethod(clazz, propertyName, replacement) { if (!canRedefineValue(clazz, propertyName)) { throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`); } Object.defineProperty(clazz, propertyName, { value: replacement }); attemptChangeName(replacement, propertyName); }
Rename generic methods to use generic names
Rename generic methods to use generic names
JavaScript
mit
foobarhq/reworkjs,reworkjs/reworkjs,reworkjs/reworkjs,reworkjs/reworkjs,foobarhq/reworkjs
--- +++ @@ -1,4 +1,3 @@ - export function attemptChangeName(obj, name) { if (!canRedefineValue(obj, 'name')) { return; @@ -15,11 +14,13 @@ } function suicide() { - throw new TypeError('This method does not generate any actions. It cannot be called.'); + throw new TypeError('This method cannot be called.'); } -export function killMethod(providerClass, propertyName) { - replaceMethod(providerClass, propertyName, suicide); +Object.freeze(suicide); + +export function killMethod(Class, propertyName) { + replaceMethod(Class, propertyName, suicide); } export function replaceMethod(clazz, propertyName, replacement) {
9c2f44c60b714ac83ba3a1ca38c0898d4d37e07a
src/helpers.js
src/helpers.js
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; // I know, not technically correct... if (filesize >= 1000000) { size = (filesize / 1000000) + ' megabytes'; } else if (filesize >= 1000) { size = (filesize / 1000) + ' kilobytes'; } else { size = filesize + ' bytes'; } return size; } export async function createFileFromUrl(url) { const response = await fetch(url); const data = await response.blob(); const metadata = {type: data.type}; const filename = url.replace(/\?.+/, '').split('/').pop(); return new File([data], filename, metadata); } export function readFile(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = (event) => { resolve(event?.target?.result); }; reader.onerror = (event) => { reader.abort(); reject(event); }; reader.readAsDataURL(file); }); }
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; if (filesize >= 1048576) { size = (filesize / 1048576) + ' megabytes'; } else if (filesize >= 1024) { size = (filesize / 1024) + ' kilobytes'; } else { size = filesize + ' bytes'; } return size; } export async function createFileFromUrl(url) { const response = await fetch(url); const data = await response.blob(); const metadata = {type: data.type}; const filename = url.replace(/\?.+/, '').split('/').pop(); return new File([data], filename, metadata); } export function readFile(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = (event) => { resolve(event?.target?.result); }; reader.onerror = (event) => { reader.abort(); reject(event); }; reader.readAsDataURL(file); }); }
Use binary system instead of decimal for size error
:bug: Use binary system instead of decimal for size error
JavaScript
mit
Yuvaleros/material-ui-dropzone
--- +++ @@ -6,11 +6,10 @@ export function convertBytesToMbsOrKbs(filesize) { let size = ''; - // I know, not technically correct... - if (filesize >= 1000000) { - size = (filesize / 1000000) + ' megabytes'; - } else if (filesize >= 1000) { - size = (filesize / 1000) + ' kilobytes'; + if (filesize >= 1048576) { + size = (filesize / 1048576) + ' megabytes'; + } else if (filesize >= 1024) { + size = (filesize / 1024) + ' kilobytes'; } else { size = filesize + ' bytes'; }
594b03ceb00f0ac76ad015a7380a4c9f23903f50
lib/__tests__/ActionCable-test.js
lib/__tests__/ActionCable-test.js
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import { ActionCableProvider, ActionCable } from '../index'; test('ActionCable render without children', () => { const node = shallow( <ActionCableProvider> <ActionCable /> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); }); test('ActionCable render with children', () => { const node = shallow( <ActionCableProvider> <ActionCable> <div>Hello</div> </ActionCable> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); const div = node.find('div') expect(div).to.have.length(1); });
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import Provider, { ActionCableProvider, ActionCable } from '../index'; test('ActionCable render without children', () => { const node = shallow( <ActionCableProvider> <ActionCable /> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); }); test('ActionCable render with children', () => { const node = shallow( <ActionCableProvider> <ActionCable> <div>Hello</div> </ActionCable> </ActionCableProvider> ); expect(node.find(ActionCable)).to.have.length(1); const div = node.find('div') expect(div).to.have.length(1); }); test('Default exporting ActionCableProvider works', () => { const node = shallow( <Provider> <ActionCable /> </Provider> ); expect(node.find(ActionCable)).to.have.length(1); });
Add test for default exporting ActionCableProvider
Add test for default exporting ActionCableProvider
JavaScript
mit
cpunion/react-actioncable-provider
--- +++ @@ -1,7 +1,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; -import { ActionCableProvider, ActionCable } from '../index'; +import Provider, { ActionCableProvider, ActionCable } from '../index'; test('ActionCable render without children', () => { const node = shallow( @@ -26,3 +26,13 @@ const div = node.find('div') expect(div).to.have.length(1); }); + +test('Default exporting ActionCableProvider works', () => { + const node = shallow( + <Provider> + <ActionCable /> + </Provider> + ); + + expect(node.find(ActionCable)).to.have.length(1); +});
6f9dcc82d086a79e173338007f984570cfdc3185
webpack.rules.js
webpack.rules.js
module.exports = [ { test: /\.jsx?/, exclude: /node_modules/, loader: 'babel-loader', }, { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, ];
module.exports = [ { test: /\.jsx?/, exclude: /node_modules/, loader: 'babel-loader', }, { test: /\.css$/, use: [ { loader: 'style-loader', }, { loader: 'css-loader', options: { localIdentName: 'rat-[name]_[local]', }, }, ] }, ];
Use more descriptive class names
Use more descriptive class names This will make it easier to add custom styling on top of the default one.
JavaScript
mit
trotzig/react-available-times,trotzig/react-available-times
--- +++ @@ -6,7 +6,17 @@ }, { test: /\.css$/, - use: [ 'style-loader', 'css-loader' ] + use: [ + { + loader: 'style-loader', + }, + { + loader: 'css-loader', + options: { + localIdentName: 'rat-[name]_[local]', + }, + }, + ] }, ];
8067e9fc0de92888653237558213ab8c9298a99b
lib/constants.js
lib/constants.js
'use strict'; var path = require('path'); // #ARCHIVE:0 Eliminate unused config options id:1203 var DEFAULT_EXCLUDE_PATTERN = "^(node_modules|bower_components|\\.imdone|target|build|dist|logs)[\\/\\\\]?|\\.(git|svn|hg|npmignore)|\\~$|\\.(jpg|png|gif|swp|ttf|otf)$"; var CONFIG_DIR = ".imdone"; module.exports = { CONFIG_DIR: CONFIG_DIR, CONFIG_FILE: path.join(CONFIG_DIR,"config.json"), IGNORE_FILE: '.imdoneignore', DEFAULT_FILE_PATTERN: "^(readme\\.md|home\\.md)$", DEFAULT_EXCLUDE_PATTERN: DEFAULT_EXCLUDE_PATTERN, DEFAULT_CONFIG: { exclude: [DEFAULT_EXCLUDE_PATTERN], watcher: true, keepEmptyPriority: false, code: { include_lists:[ "TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE", "HACK", "CHANGED", "XXX", "IDEA", "NOTE", "REVIEW" ] }, lists: [], marked : { gfm: true, tables: true, breaks: false, pedantic: false, smartLists: true, langPrefix: 'language-' } }, ERRORS: { NOT_A_FILE: "file must be of type File", CALLBACK_REQUIRED: "Last paramter must be a callback function" } };
'use strict'; var path = require('path'); // #ARCHIVE:0 Eliminate unused config options id:1203 var DEFAULT_EXCLUDE_PATTERN = "^(node_modules|bower_components|\\.imdone|target|build|dist|logs)[\\/\\\\]?|\\.(git|svn|hg|npmignore)|\\~$|\\.(jpg|png|gif|swp|ttf|otf)$"; var CONFIG_DIR = ".imdone"; module.exports = { CONFIG_DIR: CONFIG_DIR, CONFIG_FILE: path.join(CONFIG_DIR,"config.json"), IGNORE_FILE: '.imdoneignore', DEFAULT_FILE_PATTERN: "^(readme\\.md|home\\.md)$", DEFAULT_EXCLUDE_PATTERN: DEFAULT_EXCLUDE_PATTERN, DEFAULT_CONFIG: { exclude: [DEFAULT_EXCLUDE_PATTERN], watcher: true, keepEmptyPriority: true, code: { include_lists:[ "TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE", "HACK", "CHANGED", "XXX", "IDEA", "NOTE", "REVIEW" ] }, lists: [], marked : { gfm: true, tables: true, breaks: false, pedantic: false, smartLists: true, langPrefix: 'language-' } }, ERRORS: { NOT_A_FILE: "file must be of type File", CALLBACK_REQUIRED: "Last paramter must be a callback function" } };
Change keepEmptyPriority default to true
Change keepEmptyPriority default to true
JavaScript
mit
imdone/imdone-core,imdone/imdone-core
--- +++ @@ -13,7 +13,7 @@ DEFAULT_CONFIG: { exclude: [DEFAULT_EXCLUDE_PATTERN], watcher: true, - keepEmptyPriority: false, + keepEmptyPriority: true, code: { include_lists:[ "TODO", "DOING", "DONE", "PLANNING", "FIXME", "ARCHIVE", "HACK", "CHANGED", "XXX", "IDEA", "NOTE", "REVIEW"
4accf166520646369b2f3e2b2ecf7ee3a158ff0a
client/react/src/App.js
client/react/src/App.js
import React, { Component } from 'react'; import './App.css'; import Table from './Table'; class App extends Component { constructor () { super(); const ws = new WebSocket('ws://localhost:42745/websocket') this.state = { ws: ws } ws.onopen = () => console.log("OPENED") }; login = (event) => { let name = this.nameInput.value if (!name) { console.log("No name supplied"); return } console.log("Logging in as " + name); let msg = { method: "login", name: name } this.state.ws.send(JSON.stringify(msg)) } render() { return ( <div> <div className="App"> <div className="App-header"> <h2>Welcome to Tarabish Online</h2> </div> <div> <input type="text" placeholder="Name" ref={(ref) => this.nameInput = ref} /> <input type="button" value="Login" onClick={this.login} /> </div> <div><Table name="Test Table 1"/></div> </div> </div> ); } } export default App;
import React, { Component } from 'react'; import './App.css'; import Table from './Table'; class App extends Component { constructor () { super(); let ws_url = process.env.REACT_APP_WS_URL if (!ws_url) { const proto = (location.protocol === "https:")? "wss://" : "ws://" ws_url = proto + location.host + "/websocket" } this.ws = new WebSocket(ws_url) this.ws.onopen = () => console.log("OPENED") }; login = (event) => { let name = this.nameInput.value if (!name) { console.log("No name supplied"); return } console.log("Logging in as " + name); let msg = { method: "login", name: name } this.ws.send(JSON.stringify(msg)) } render() { return ( <div> <div className="App"> <div className="App-header"> <h2>Welcome to Tarabish Online</h2> </div> <div> <input type="text" placeholder="Name" ref={(ref) => this.nameInput = ref} /> <input type="button" value="Login" onClick={this.login} /> </div> <div><Table name="Test Table 1"/></div> </div> </div> ); } } export default App;
Make the WS URL configurable
Make the WS URL configurable Also store it outside of the state.
JavaScript
mit
KenMacD/tarabish,KenMacD/tarabish,KenMacD/tarabish,KenMacD/tarabish
--- +++ @@ -2,14 +2,18 @@ import './App.css'; import Table from './Table'; + class App extends Component { constructor () { super(); - const ws = new WebSocket('ws://localhost:42745/websocket') - this.state = { - ws: ws + + let ws_url = process.env.REACT_APP_WS_URL + if (!ws_url) { + const proto = (location.protocol === "https:")? "wss://" : "ws://" + ws_url = proto + location.host + "/websocket" } - ws.onopen = () => console.log("OPENED") + this.ws = new WebSocket(ws_url) + this.ws.onopen = () => console.log("OPENED") }; login = (event) => { @@ -23,7 +27,7 @@ method: "login", name: name } - this.state.ws.send(JSON.stringify(msg)) + this.ws.send(JSON.stringify(msg)) } render() {
ef05e8d694820d3638a01139320d447deb335918
resources/assets/js/util/url.js
resources/assets/js/util/url.js
import { router, stringifyQuery, parseQuery } from '../router'; const defaultQuery = { 'x-access-from': 'ui' }; function normalize(url) { const urlLocation = new URL(url, /^\//.test(url) ? location.origin : undefined); const query = { ...parseQuery(urlLocation.search), ...defaultQuery, }; return urlLocation.pathname + stringifyQuery(query); } function routeUrl(location) { const { href } = router().resolve(location); return href; } export function getBackUrl(breadcrumb) { const item = breadcrumb[breadcrumb.length - 2]; return item ? normalize(item.url) : null; } export function getListBackUrl(breadcrumb) { const listItem = breadcrumb.find(item => item.type === 'entityList'); return normalize(listItem.url); } export function formUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'form', params: { entityKey, instanceId }, })); } export function listUrl(entityKey) { return normalize(routeUrl({ name: 'entity-list', params: { id: entityKey }, })); } export function showUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'show', params: { entityKey, instanceId } })); }
import { router, stringifyQuery, parseQuery } from '../router'; const defaultQuery = { 'x-access-from': 'ui' }; function normalize(url) { const urlLocation = /^\//.test(url) ? new URL(url, location.origin) : new URL(url); const query = { ...parseQuery(urlLocation.search), ...defaultQuery, }; return urlLocation.pathname + stringifyQuery(query); } function routeUrl(location) { const { href } = router().resolve(location); return href; } export function getBackUrl(breadcrumb) { const item = breadcrumb[breadcrumb.length - 2]; return item ? normalize(item.url) : null; } export function getListBackUrl(breadcrumb) { const listItem = breadcrumb.find(item => item.type === 'entityList'); return normalize(listItem.url); } export function formUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'form', params: { entityKey, instanceId }, })); } export function listUrl(entityKey) { return normalize(routeUrl({ name: 'entity-list', params: { id: entityKey }, })); } export function showUrl({ entityKey, instanceId }) { return normalize(routeUrl({ name: 'show', params: { entityKey, instanceId } })); }
Fix URL type error on safari
Fix URL type error on safari
JavaScript
mit
code16/sharp,code16/sharp,code16/sharp
--- +++ @@ -5,7 +5,9 @@ }; function normalize(url) { - const urlLocation = new URL(url, /^\//.test(url) ? location.origin : undefined); + const urlLocation = /^\//.test(url) + ? new URL(url, location.origin) + : new URL(url); const query = { ...parseQuery(urlLocation.search), ...defaultQuery,
2a4ec61b2b04c3a548c30a2fb993964aaeff7c34
lib/run-sagas.js
lib/run-sagas.js
module.exports = function runSagas(routes, dispatch, props, sagaMiddleware) { return Promise.all( routes .filter(function(route) { var sagasToRun; return route.component && (sagasToRun = route.component.sagasToRun) && typeof sagasToRun === 'function'; }) .map(function(route) { var sagasToRun = route.component.sagasToRun(dispatch, props); if (sagasToRun == null || !(sagasToRun instanceof Array) || sagasToRun.some( s => !(s instanceof Array) )) { return Promise.reject( new Error(`\`sagasToRun()\` must return an array of arrays, in route component ${route.component.displayName}`)); } return Promise.all( sagasToRun.map(function(args) { // Run each Saga // http://yelouafi.github.io/redux-saga/docs/api/index.html#middlewarerunsaga-args // …returning the Task descriptor's Promise // http://yelouafi.github.io/redux-saga/docs/api/index.html#task-descriptor return sagaMiddleware.run.apply(null, args).done; }) ) }) ) }
module.exports = function runSagas(routes, dispatch, props, sagaMiddleware) { return Promise.all( routes .filter(function(route) { var sagasToRun; return route.component && (sagasToRun = route.component.sagasToRun) && typeof sagasToRun === 'function'; }) .map(function(route) { var sagasToRun = route.component.sagasToRun(dispatch, props); if (sagasToRun == null || !(sagasToRun instanceof Array) || sagasToRun.some(function(s) { return !(s instanceof Array) })) { return Promise.reject( new Error(`\`sagasToRun()\` must return an array of arrays, in route component ${route.component.displayName}`)); } return Promise.all( sagasToRun.map(function(args) { // Run each Saga // http://yelouafi.github.io/redux-saga/docs/api/index.html#middlewarerunsaga-args // …returning the Task descriptor's Promise // http://yelouafi.github.io/redux-saga/docs/api/index.html#task-descriptor return sagaMiddleware.run.apply(null, args).done; }) ) }) ) }
Fix to use vanilla JS.
Fix to use vanilla JS.
JavaScript
mit
heroku/create-render-4r
--- +++ @@ -11,7 +11,7 @@ var sagasToRun = route.component.sagasToRun(dispatch, props); if (sagasToRun == null || !(sagasToRun instanceof Array) || - sagasToRun.some( s => !(s instanceof Array) )) { + sagasToRun.some(function(s) { return !(s instanceof Array) })) { return Promise.reject( new Error(`\`sagasToRun()\` must return an array of arrays, in route component ${route.component.displayName}`)); }
67fc0a2b92f49250b14562a04539b775f0d55cc4
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
spec/javascripts/ci_variable_list/native_form_variable_list_spec.js
import $ from 'jquery'; import setupNativeFormVariableList from '~/ci_variable_list/native_form_variable_list'; describe('NativeFormVariableList', () => { preloadFixtures('pipeline_schedules/edit.html.raw'); let $wrapper; beforeEach(() => { loadFixtures('pipeline_schedules/edit.html.raw'); $wrapper = $('.js-ci-variable-list-section'); setupNativeFormVariableList({ container: $wrapper, formField: 'schedule', }); }); describe('onFormSubmit', () => { it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => { const $row = $wrapper.find('.js-row'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][key]'); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][value]'); $wrapper.closest('form').trigger('trigger-submit'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe(''); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe(''); }); }); });
import $ from 'jquery'; import setupNativeFormVariableList from '~/ci_variable_list/native_form_variable_list'; describe('NativeFormVariableList', () => { preloadFixtures('pipeline_schedules/edit.html.raw'); let $wrapper; beforeEach(() => { loadFixtures('pipeline_schedules/edit.html.raw'); $wrapper = $('.js-ci-variable-list-section'); setupNativeFormVariableList({ container: $wrapper, formField: 'schedule', }); }); describe('onFormSubmit', () => { it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => { const $row = $wrapper.find('.js-row'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][secret_key]'); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][secret_value]'); $wrapper.closest('form').trigger('trigger-submit'); expect($row.find('.js-ci-variable-input-key').attr('name')).toBe(''); expect($row.find('.js-ci-variable-input-value').attr('name')).toBe(''); }); }); });
Check for secret_key and secret_value in CI Variable native list js spec
Check for secret_key and secret_value in CI Variable native list js spec
JavaScript
mit
iiet/iiet-git,jirutka/gitlabhq,jirutka/gitlabhq,axilleas/gitlabhq,iiet/iiet-git,dreampet/gitlab,axilleas/gitlabhq,dreampet/gitlab,dreampet/gitlab,jirutka/gitlabhq,mmkassem/gitlabhq,iiet/iiet-git,stoplightio/gitlabhq,iiet/iiet-git,axilleas/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,mmkassem/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,jirutka/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq
--- +++ @@ -19,8 +19,8 @@ describe('onFormSubmit', () => { it('should clear out the `name` attribute on the inputs for the last empty row on form submission (avoid BE validation)', () => { const $row = $wrapper.find('.js-row'); - expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][key]'); - expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][value]'); + expect($row.find('.js-ci-variable-input-key').attr('name')).toBe('schedule[variables_attributes][][secret_key]'); + expect($row.find('.js-ci-variable-input-value').attr('name')).toBe('schedule[variables_attributes][][secret_value]'); $wrapper.closest('form').trigger('trigger-submit');
683e4c5056eacf561e69835c5531b5411df3fb66
prolific.tcp/tcp.argv.js
prolific.tcp/tcp.argv.js
/* ___ usage ___ en_US ___ usage: prolific tcp <options> -u, --url <string> The URL of the logging destination. -r, --rotate <number> Reopen TCP connection after specified number of bytes. --help Display this message. ___ $ ___ en_US ___ ___ . ___ */ require('arguable')(module, require('cadence')(function (async, program) { program.helpIf(program.command.params.help) var response = { moduleName: 'prolific.tcp/tcp.processor', parameters: { params: program.command.param }, argv: program.argv, terminal: program.command.terminal } if (process.mainModule == module) { console.log(response) } return response }))
/* ___ usage ___ en_US ___ usage: prolific tcp <options> -u, --url <string> The URL of the logging destination. -r, --rotate <number> Reopen TCP connection after specified number of bytes. --help Display this message. ___ $ ___ en_US ___ ___ . ___ */ require('arguable')(module, require('cadence')(function (async, program) { program.helpIf(program.command.params.help) var response = { moduleName: 'prolific.tcp/tcp.processor', parameters: { params: program.command.param }, argv: program.argv, terminal: program.command.terminal } if (process.mainModule == module) { console.log(response) } return response })) module.exports.isProlific = true
Add flag for new module loader.
Add flag for new module loader.
JavaScript
mit
bigeasy/prolific,bigeasy/prolific
--- +++ @@ -29,3 +29,5 @@ } return response })) + +module.exports.isProlific = true
f24f92487abf2529faea31622f33c8a656530f24
src/utilities/NumbersHelper.js
src/utilities/NumbersHelper.js
/** * Formats a number to the American `1,000.00` format * * @param {number|string} number The value to format * @return {string} The formatted number */ export default function numberWithCommas(number) { const parts = number.toString().split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); return parts.join('.'); }
/** * Formats numbers */ export default class NumbersHelper { /** * Formats a number to the American `1,000.00` format * @param {number|string} number The value to format * @return {string} The formatted number */ static numberWithCommas = (number, hideRemainderIfZero) => { const parts = number.toString().split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); // Remove the decimal place if it is empty if (hideRemainderIfZero && parts.length > 1 && /^0*$/.test(parts[1])) { parts.splice(1, 1); } return parts.join('.'); } /** * Formats a number to a short format with: * K = thousands * M = millions * B = billions * T = trillions * It also supports fractional formats. So a number like 1050 can be turned * into 1.05K by providing 2 or more for the decimals param. * * @param {number} number The value to format * @param {integer} decimals The amount of decimal places after the operator * @return {string} The formatted number */ static formatToShortNumber = (number, decimals = 1) => { let mult = 1.0; let sym = ''; const decimalMult = 10 ** decimals; if (number >= 1000 && number < 1000000) { sym = 'K'; mult = 1000.0; } else if (number >= 1000000 && number < 1000000000) { sym = 'M'; mult = 1000000.0; } else if (number >= 1000000000 && number < 1000000000000) { sym = 'B'; mult = 1000000000.0; } else if (number >= 1000000000000 && number < 1000000000000000) { sym = 'T'; mult = 1000000000000.0; } const total = (Math.floor((number * decimalMult) / mult) / decimalMult); return total + sym; } }
Format the new numbers helper
Format the new numbers helper
JavaScript
mit
HarvestProfit/harvest-profit-ui
--- +++ @@ -1,11 +1,56 @@ /** - * Formats a number to the American `1,000.00` format - * - * @param {number|string} number The value to format - * @return {string} The formatted number + * Formats numbers */ -export default function numberWithCommas(number) { - const parts = number.toString().split('.'); - parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); - return parts.join('.'); +export default class NumbersHelper { + /** + * Formats a number to the American `1,000.00` format + * @param {number|string} number The value to format + * @return {string} The formatted number + */ + static numberWithCommas = (number, hideRemainderIfZero) => { + const parts = number.toString().split('.'); + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); + + // Remove the decimal place if it is empty + if (hideRemainderIfZero && parts.length > 1 && /^0*$/.test(parts[1])) { + parts.splice(1, 1); + } + return parts.join('.'); + } + + + /** + * Formats a number to a short format with: + * K = thousands + * M = millions + * B = billions + * T = trillions + * It also supports fractional formats. So a number like 1050 can be turned + * into 1.05K by providing 2 or more for the decimals param. + * + * @param {number} number The value to format + * @param {integer} decimals The amount of decimal places after the operator + * @return {string} The formatted number + */ + static formatToShortNumber = (number, decimals = 1) => { + let mult = 1.0; + let sym = ''; + const decimalMult = 10 ** decimals; + if (number >= 1000 && number < 1000000) { + sym = 'K'; + mult = 1000.0; + } else if (number >= 1000000 && number < 1000000000) { + sym = 'M'; + mult = 1000000.0; + } else if (number >= 1000000000 && number < 1000000000000) { + sym = 'B'; + mult = 1000000000.0; + } else if (number >= 1000000000000 && number < 1000000000000000) { + sym = 'T'; + mult = 1000000000000.0; + } + + const total = (Math.floor((number * decimalMult) / mult) / decimalMult); + return total + sym; + } }
b268949468a4f32677dfeca0d1a8da19f8ad39a9
lib/index.js
lib/index.js
import apiClient from 'api-client'; import loader from 'loader'; const init = (apikey, security) => { const client = apiClient.init(apikey, security); return { getSecurity() { return client.getSecurity(); }, setSecurity(sec) { return client.setSecurity(sec); }, pick(options) { return loader.loadModule(ENV.picker) .then((pickerConstructor) => { return pickerConstructor(client, options); }); }, storeURL(url, options) { return client.storeURL(url, options); }, transform(url, options) { return client.transform(url, options); }, upload(file, uploadOptions, storeOptions, token) { return client.upload(file, uploadOptions, storeOptions, token); }, retrieve(handle, options) { return client.retrieve(handle, options); }, remove(handle) { return client.remove(handle); }, metadata(handle, options) { return client.metadata(handle, options); }, }; }; export default { version: '@{VERSION}', init, };
import apiClient from 'api-client'; import loader from 'loader'; const init = (apikey, security, cname) => { const client = apiClient.init(apikey, security, cname); return { getSecurity() { return client.getSecurity(); }, setSecurity(sec) { return client.setSecurity(sec); }, pick(options) { return loader.loadModule(ENV.picker) .then((pickerConstructor) => { return pickerConstructor(client, options); }); }, storeURL(url, options) { return client.storeURL(url, options); }, transform(url, options) { return client.transform(url, options); }, upload(file, uploadOptions, storeOptions, token) { return client.upload(file, uploadOptions, storeOptions, token); }, retrieve(handle, options) { return client.retrieve(handle, options); }, remove(handle) { return client.remove(handle); }, metadata(handle, options) { return client.metadata(handle, options); }, }; }; export default { version: '@{VERSION}', init, };
Add cname option to init wrapper
Add cname option to init wrapper
JavaScript
mit
filestack/filestack-js,filestack/filestack-js
--- +++ @@ -1,8 +1,8 @@ import apiClient from 'api-client'; import loader from 'loader'; -const init = (apikey, security) => { - const client = apiClient.init(apikey, security); +const init = (apikey, security, cname) => { + const client = apiClient.init(apikey, security, cname); return { getSecurity() { return client.getSecurity();
802d6bb7174eb2d444246ffb0523e7c6c45a83c3
lib/index.js
lib/index.js
"use strict"; const path = require("path"); const rollup = require("rollup"); function createPreprocessor(options, preconfig, basePath, logger) { const cache = new Map(); const log = logger.create("preprocessor.rollup"); return async function preprocess(original, file, done) { try { const config = Object.assign({}, options, preconfig.options, { input: file.path, cache: cache.get(file.path) }); const bundle = await rollup.rollup(config); cache.set(file.path, bundle.cache); const { output } = await bundle.generate(config); for (const result of output) { if (!result.isAsset) { const { code, map } = result; const { sourcemap } = config.output; file.sourceMap = map; const processed = sourcemap === "inline" ? code + `\n//# sourceMappingURL=${map.toUrl()}\n` : code; return done(null, processed); } } log.warn("Nothing was processed."); done(null, original); } catch (error) { const location = path.relative(basePath, file.path); log.error("Failed to process ./%s\n\n%s\n", location, error.stack); done(error, null); } }; } createPreprocessor.$inject = [ "config.rollupPreprocessor", "args", "config.basePath", "logger" ]; module.exports = { "preprocessor:rollup": ["factory", createPreprocessor] };
"use strict"; const path = require("path"); const rollup = require("rollup"); function createPreprocessor(options, preconfig, basePath, logger) { const cache = new Map(); const log = logger.create("preprocessor.rollup"); return async function preprocess(original, file, done) { const location = path.relative(basePath, file.path); try { const config = Object.assign({}, options, preconfig.options, { input: file.path, cache: cache.get(file.path) }); const bundle = await rollup.rollup(config); cache.set(file.path, bundle.cache); log.info("Generating bundle for ./%s", location); const { output } = await bundle.generate(config); for (const result of output) { if (!result.isAsset) { const { code, map } = result; const { sourcemap } = config.output; file.sourceMap = map; const processed = sourcemap === "inline" ? code + `\n//# sourceMappingURL=${map.toUrl()}\n` : code; return done(null, processed); } } log.warn("Nothing was processed."); done(null, original); } catch (error) { log.error("Failed to process ./%s\n\n%s\n", location, error.stack); done(error, null); } }; } createPreprocessor.$inject = [ "config.rollupPreprocessor", "args", "config.basePath", "logger" ]; module.exports = { "preprocessor:rollup": ["factory", createPreprocessor] };
Add more info log output
Add more info log output Partial reimplementation of #39
JavaScript
mit
showpad/karma-rollup-preprocessor,jlmakes/karma-rollup-preprocessor,jlmakes/karma-rollup-preprocessor
--- +++ @@ -8,6 +8,7 @@ const log = logger.create("preprocessor.rollup"); return async function preprocess(original, file, done) { + const location = path.relative(basePath, file.path); try { const config = Object.assign({}, options, preconfig.options, { input: file.path, @@ -17,6 +18,7 @@ const bundle = await rollup.rollup(config); cache.set(file.path, bundle.cache); + log.info("Generating bundle for ./%s", location); const { output } = await bundle.generate(config); for (const result of output) { @@ -37,7 +39,6 @@ log.warn("Nothing was processed."); done(null, original); } catch (error) { - const location = path.relative(basePath, file.path); log.error("Failed to process ./%s\n\n%s\n", location, error.stack); done(error, null); }
7b9e2f1fc757c941b87ad9f3107b09796f4fac21
src/utils/init-autoplay.js
src/utils/init-autoplay.js
/** * handle autoplay * * @param {element} slideTo slide to frame function * @param {element} options slider options */ export default function initAutoplay (slide, options) { let autoplayTime = (typeof options.autoplay === 'number') ? options.autoplay : 3000; let onAutoplayStart = window.setInterval(() => { slide(false, true); }, autoplayTime); return onAutoplayStart; }
/** * handle autoplay * * @param {element} slideTo slide to frame function * @param {element} options slider options */ export default function initAutoplay (slide, options) { let autoplayTime = (typeof options.autoplay === 'number') ? options.autoplay : 3000; let onAutoplayStart = window.setInterval(() => { slide(false, options.direction === 'ltr' ? true : false); }, autoplayTime); return onAutoplayStart; }
Fix Autoplay diretion in case of RTL
Fix Autoplay diretion in case of RTL
JavaScript
mit
AmitM30/basic-swiper,AmitM30/basic-swiper
--- +++ @@ -8,7 +8,7 @@ export default function initAutoplay (slide, options) { let autoplayTime = (typeof options.autoplay === 'number') ? options.autoplay : 3000; let onAutoplayStart = window.setInterval(() => { - slide(false, true); + slide(false, options.direction === 'ltr' ? true : false); }, autoplayTime); return onAutoplayStart;
1af1be4cad8db37e096724d0f2c666bd860b330f
local-cli/runMacOS/findXcodeProject.js
local-cli/runMacOS/findXcodeProject.js
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; const path = require('path'); type ProjectInfo = { name: string; isWorkspace: boolean; } function findXcodeProject(files: Array<string>): ?ProjectInfo { const sortedFiles = files.sort(); for (let i = sortedFiles.length - 1; i >= 0; i--) { const fileName = files[i]; const ext = path.extname(fileName); if (ext === '.xcworkspace') { return { name: fileName, isWorkspace: true, }; } if (ext === '.xcodeproj') { return { name: fileName, isWorkspace: false, }; } } return null; } module.exports = findXcodeProject;
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow */ 'use strict'; const path = require('path'); function findXcodeProject(files) { const sortedFiles = files.sort(); for (let i = sortedFiles.length - 1; i >= 0; i--) { const fileName = files[i]; const ext = path.extname(fileName); if (ext === '.xcworkspace') { return { name: fileName, isWorkspace: true, }; } if (ext === '.xcodeproj') { return { name: fileName, isWorkspace: false, }; } } return null; } module.exports = findXcodeProject;
Remove typescript, as it is not compiled by rnpm
Remove typescript, as it is not compiled by rnpm
JavaScript
mit
ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos,ptmt/react-native-macos
--- +++ @@ -12,12 +12,7 @@ const path = require('path'); -type ProjectInfo = { - name: string; - isWorkspace: boolean; -} - -function findXcodeProject(files: Array<string>): ?ProjectInfo { +function findXcodeProject(files) { const sortedFiles = files.sort(); for (let i = sortedFiles.length - 1; i >= 0; i--) { const fileName = files[i];
0d67458b71a5cbb7127d455bcc993fd1a0b2e969
test/crypto.js
test/crypto.js
const assert = require('assert'); const { crypto, config } = require('./config'); describe("WebCrypto", () => { it("get random values", () => { var buf = new Uint8Array(16); var check = new Buffer(buf).toString("base64"); assert.notEqual(new Buffer(crypto.getRandomValues(buf)).toString("base64"), check, "Has no random values"); }) it("get random values with large buffer", () => { var buf = new Uint8Array(65600); assert.throws(() => { crypto.getRandomValues(buf); }, Error); }) it("reset", (done) => { var WebCrypto = require("../").WebCrypto; const crypto = new WebCrypto(config); const currentHandle = crypto.session.handle.toString("hex"); crypto.reset() .then(() => { const newHandle = crypto.session.handle.toString("hex"); assert(currentHandle !== newHandle, true, "handle of session wasn't changed"); }) .then(done, done); }) })
const assert = require('assert'); const { crypto, config } = require('./config'); describe("WebCrypto", () => { it("get random values", () => { var buf = new Uint8Array(16); var check = new Buffer(buf).toString("base64"); assert.notEqual(new Buffer(crypto.getRandomValues(buf)).toString("base64"), check, "Has no random values"); }) it("get random values with large buffer", () => { var buf = new Uint8Array(65600); assert.throws(() => { crypto.getRandomValues(buf); }, Error); }) it("reset", (done) => { const currentHandle = crypto.session.handle.toString("hex"); crypto.reset() .then(() => { crypto.login(config.pin); const newHandle = crypto.session.handle.toString("hex"); assert(currentHandle !== newHandle, true, "handle of session wasn't changed"); }) .then(done, done); }) })
Update - cannot open 2 session
Update - cannot open 2 session
JavaScript
mit
PeculiarVentures/node-webcrypto-p11,PeculiarVentures/node-webcrypto-p11
--- +++ @@ -17,12 +17,10 @@ }) it("reset", (done) => { - var WebCrypto = require("../").WebCrypto; - - const crypto = new WebCrypto(config); const currentHandle = crypto.session.handle.toString("hex"); crypto.reset() .then(() => { + crypto.login(config.pin); const newHandle = crypto.session.handle.toString("hex"); assert(currentHandle !== newHandle, true, "handle of session wasn't changed"); })
8487e1f2ae9532bfc58d1aceaf27aaf95b37fb72
website/app/application/core/projects/project/files/file-edit-controller.js
website/app/application/core/projects/project/files/file-edit-controller.js
(function (module) { module.controller("FilesEditController", FilesEditController); FilesEditController.$inject = ['file']; /* @ngInject */ function FilesEditController(file) { var ctrl = this; ctrl.file = file; } }(angular.module('materialscommons')));
(function (module) { module.controller("FileEditController", FileEditController); FileEditController.$inject = ['file']; /* @ngInject */ function FileEditController(file) { var ctrl = this; ctrl.file = file; } }(angular.module('materialscommons')));
Change name of controller to match file.
Change name of controller to match file.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -1,10 +1,10 @@ (function (module) { - module.controller("FilesEditController", FilesEditController); + module.controller("FileEditController", FileEditController); - FilesEditController.$inject = ['file']; + FileEditController.$inject = ['file']; /* @ngInject */ - function FilesEditController(file) { + function FileEditController(file) { var ctrl = this; ctrl.file = file; }
e746455d849e06f7c8b59bf097631a78da53a2ff
spec/paths/approved_invoice.js
spec/paths/approved_invoice.js
'use strict'; module.exports = { 'get': { 'description': 'This endpoint returns information about invoices that have been approved. The response includes basic details of each invoice, such as sender and receiver information.', 'responses': { '200': { 'description': 'An array of approved invoices', 'schema': { '$ref': '#/definitions/InvoiceApproved' } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } }, 'post': { 'description': 'This endpoint allows you to send approved invoices.', 'parameters': [ { 'name': 'body', 'in': 'body', 'description': 'The Invoice JSON you want to POST', 'schema': { 'pendingInvoices': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'required': true } ], 'responses': { '200': { 'description': 'Ids of the approved invoices', 'schema': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } } };
'use strict'; module.exports = { 'get': { 'description': 'This endpoint returns information about invoices that have been approved. The response includes basic details of each invoice, such as sender and receiver information.', 'responses': { '200': { 'description': 'An array of approved invoices', 'schema': { '$ref': '#/definitions/InvoiceApproved' } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } }, // XXXXX: figure out proper semantics for approving (separate resource?) /* 'post': { 'description': 'This endpoint allows you to send approved invoices.', 'parameters': [ { 'name': 'body', 'in': 'body', 'description': 'The Invoice JSON you want to POST', 'schema': { 'approvedInvoices': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'required': true } ], 'responses': { '200': { 'description': 'Ids of the approved invoices', 'schema': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' } } }, 'default': { 'description': 'Unexpected error', 'schema': { '$ref': '#/definitions/Error' } } } } */ };
Disable POST approved invoice for now
Disable POST approved invoice for now Need to rethink this. Looks like some dependency change (swagger-tools) broke this. Anyway, there should be a way to transform drafts into approved into paid. Maybe single endpoint would do.
JavaScript
mit
bebraw/react-crm-backend,koodilehto/koodilehto-crm-backend
--- +++ @@ -19,6 +19,8 @@ } } }, + // XXXXX: figure out proper semantics for approving (separate resource?) + /* 'post': { 'description': 'This endpoint allows you to send approved invoices.', 'parameters': [ @@ -27,7 +29,7 @@ 'in': 'body', 'description': 'The Invoice JSON you want to POST', 'schema': { - 'pendingInvoices': { + 'approvedInvoices': { 'type': 'array', 'items': { '$ref': '#/definitions/Id' @@ -55,4 +57,5 @@ } } } + */ };
474163478d11e839b493417b584e16a80a1559d1
src/routes/user/component/indexRoute/__tests__/WrapperUserIndexPage-test.js
src/routes/user/component/indexRoute/__tests__/WrapperUserIndexPage-test.js
import chai, { expect } from 'chai'; import mockery from 'mockery'; import dirtyChai from 'dirty-chai'; chai.use(dirtyChai); import { shallow } from 'enzyme'; import React from 'react'; describe('WrapperUserIndexPage', () => { beforeEach(() => { mockery.enable({ warnOnReplace: false, warnOnUnregistered: false, useCleanCache: true, }); mockery.registerMock( 'decorators', require('helpers/test/decoratorsMock') ); }); afterEach(() => { mockery.deregisterMock('decorators'); mockery.disable(); }); it('should exists', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper).to.have.length(1); }); it('should render inner components', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper.find('div')).to.have.length(1); }); });
import chai, { expect } from 'chai'; import mockery from 'mockery'; import dirtyChai from 'dirty-chai'; chai.use(dirtyChai); import { shallow } from 'enzyme'; import React from 'react'; describe('WrapperUserIndexPage', () => { beforeEach(() => { mockery.enable({ warnOnReplace: false, warnOnUnregistered: false, useCleanCache: true, }); mockery.registerMock( 'decorators', require('helpers/test/decoratorsMock') ); mockery.registerMock( 'components/CardsList', require('helpers/test/componentsMock').CardsList ); mockery.registerMock( 'components/WelcomeCard', require('helpers/test/componentsMock').WelcomeCard ); }); afterEach(() => { mockery.deregisterMock('decorators'); mockery.deregisterMock('components/CardsList'); mockery.deregisterMock('components/WelcomeCard'); mockery.disable(); }); it('should exists', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper).to.have.length(1); }); it('should render inner components', () => { const WrapperUserIndexPage = require('../WrapperUserIndexPage'); const wrapper = shallow(( <WrapperUserIndexPage /> )); expect(wrapper.find('CardsList')).to.have.length(1); expect(wrapper.find('WelcomeCard')).to.have.length(1); expect(wrapper.find('div')).to.have.length(1); }); });
Update wrapper user index route tests.
Update wrapper user index route tests.
JavaScript
mit
retaxJS/retax-seed
--- +++ @@ -18,10 +18,20 @@ 'decorators', require('helpers/test/decoratorsMock') ); + mockery.registerMock( + 'components/CardsList', + require('helpers/test/componentsMock').CardsList + ); + mockery.registerMock( + 'components/WelcomeCard', + require('helpers/test/componentsMock').WelcomeCard + ); }); afterEach(() => { mockery.deregisterMock('decorators'); + mockery.deregisterMock('components/CardsList'); + mockery.deregisterMock('components/WelcomeCard'); mockery.disable(); }); @@ -42,6 +52,8 @@ <WrapperUserIndexPage /> )); + expect(wrapper.find('CardsList')).to.have.length(1); + expect(wrapper.find('WelcomeCard')).to.have.length(1); expect(wrapper.find('div')).to.have.length(1); }); });
c1221144279bffcfd8f21b1cd3116dd40ac6253d
server/updaters/mainUpdater.js
server/updaters/mainUpdater.js
'use strict'; var tablesUpdater = require('./tablesUpdater'); var resultsUpdater = require('./resultsUpdater'); var tournamentsUpdater = require('./tournamentsUpdater'); var groupsUpdater = require('./groupsUpdater'); var scorersUpdater = require('./scorersUpdater'); var assistsUpdater = require('./assistsUpdater'); // Updates league data function updateLeague(leagueArg) { leagueArg = leagueArg || true; tablesUpdater.update(leagueArg); resultsUpdater.update(leagueArg); scorersUpdater.update(leagueArg, null); assistsUpdater.update(leagueArg, null); } // Updates competition data function updateCompetition(competitionArg) { competitionArg = competitionArg || true; tournamentsUpdater.update(competitionArg); groupsUpdater.update(competitionArg); scorersUpdater.update(null, competitionArg); assistsUpdater.update(null, competitionArg); } module.exports = { updateLeague: updateLeague, updateCompetition: updateCompetition };
'use strict'; var tablesUpdater = require('./tablesUpdater'); var resultsUpdater = require('./resultsUpdater'); var tournamentsUpdater = require('./tournamentsUpdater'); // var groupsUpdater = require('./groupsUpdater'); var scorersUpdater = require('./scorersUpdater'); var assistsUpdater = require('./assistsUpdater'); // Updates league data function updateLeague(leagueArg) { leagueArg = leagueArg || true; tablesUpdater.update(leagueArg); resultsUpdater.update(leagueArg); scorersUpdater.update(leagueArg, null); assistsUpdater.update(leagueArg, null); } // Updates competition data function updateCompetition(competitionArg) { competitionArg = competitionArg || true; tournamentsUpdater.update(competitionArg); // groupsUpdater.update(competitionArg); Disable groups update until next year scorersUpdater.update(null, competitionArg); assistsUpdater.update(null, competitionArg); } module.exports = { updateLeague: updateLeague, updateCompetition: updateCompetition };
Disable groups update until next year
Disable groups update until next year
JavaScript
apache-2.0
Softcadbury/FootballDashboard,Softcadbury/DashboardFootball,Softcadbury/DashboardFootball,Softcadbury/football-peek,Softcadbury/FootballDashboard
--- +++ @@ -3,7 +3,7 @@ var tablesUpdater = require('./tablesUpdater'); var resultsUpdater = require('./resultsUpdater'); var tournamentsUpdater = require('./tournamentsUpdater'); -var groupsUpdater = require('./groupsUpdater'); +// var groupsUpdater = require('./groupsUpdater'); var scorersUpdater = require('./scorersUpdater'); var assistsUpdater = require('./assistsUpdater'); @@ -22,7 +22,7 @@ competitionArg = competitionArg || true; tournamentsUpdater.update(competitionArg); - groupsUpdater.update(competitionArg); + // groupsUpdater.update(competitionArg); Disable groups update until next year scorersUpdater.update(null, competitionArg); assistsUpdater.update(null, competitionArg); }
ccddceeef4ca5bf1208c2873b4775aac0994f00e
aura-components/src/test/components/lockerTest/secureNavigatorTest/secureNavigatorTestController.js
aura-components/src/test/components/lockerTest/secureNavigatorTest/secureNavigatorTestController.js
({ testPropertiesExposed: function(cmp) { var testUtils = cmp.get("v.testUtils"); ["appCodeName", "appName", "appVersion", "cookieEnabled", "geolocation", "language", "onLine", "platform", "product", "userAgent"].forEach(function(name) { testUtils.assertTrue(name in window.navigator, "Expected window.navigator." + name + " to be exposed as a property"); }); }, testLanguage: function(cmp) { var testUtils = cmp.get("v.testUtils"); testUtils.assertEquals(window.navigator.language, "en-US", "Expect window.navigator.language to be 'en-US'"); } })
({ testPropertiesExposed: function(cmp) { var testUtils = cmp.get("v.testUtils"); ["appCodeName", "appName", "appVersion", "cookieEnabled", "geolocation", "language", "onLine", "platform", "product", "userAgent"].forEach(function(name) { testUtils.assertTrue(name in window.navigator, "Expected window.navigator." + name + " to be exposed as a property"); }); }, testLanguage: function(cmp) { var testUtils = cmp.get("v.testUtils"); testUtils.assertEquals("en-us", window.navigator.language.toLowerCase(), "Unexpected window.navigator.language value"); } })
Fix case sensitivity issue in test
Fix case sensitivity issue in test @bug W-3021252@ @rev cheng@
JavaScript
apache-2.0
badlogicmanpreet/aura,madmax983/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,badlogicmanpreet/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,badlogicmanpreet/aura,badlogicmanpreet/aura,badlogicmanpreet/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,badlogicmanpreet/aura
--- +++ @@ -10,6 +10,6 @@ testLanguage: function(cmp) { var testUtils = cmp.get("v.testUtils"); - testUtils.assertEquals(window.navigator.language, "en-US", "Expect window.navigator.language to be 'en-US'"); + testUtils.assertEquals("en-us", window.navigator.language.toLowerCase(), "Unexpected window.navigator.language value"); } })
acedb6440d409145dce37b61a9dea76eebb05172
src/Oro/Bundle/UIBundle/Resources/public/js/extend/bootstrap/bootstrap-typeahead.js
src/Oro/Bundle/UIBundle/Resources/public/js/extend/bootstrap/bootstrap-typeahead.js
define(function(require) { 'use strict'; var $ = require('jquery'); require('bootstrap'); /** * This customization allows to define own focus, click, render, show, lookup functions for Typeahead */ var Typeahead; var origTypeahead = $.fn.typeahead.Constructor; var origFnTypeahead = $.fn.typeahead; Typeahead = function(element, options) { var opts = $.extend({}, $.fn.typeahead.defaults, options); this.focus = opts.focus || this.focus; this.render = opts.render || this.render; this.show = opts.show || this.show; this.lookup = opts.lookup || this.lookup; origTypeahead.apply(this, arguments); }; Typeahead.prototype = origTypeahead.prototype; Typeahead.prototype.constructor = Typeahead; $.fn.typeahead = function(option) { return this.each(function() { var $this = $(this); var data = $this.data('typeahead'); var options = typeof option === 'object' && option; if (!data) { $this.data('typeahead', (data = new Typeahead(this, options))); } if (typeof option === 'string') { data[option](); } }); }; $.fn.typeahead.defaults = origFnTypeahead.defaults; $.fn.typeahead.Constructor = Typeahead; $.fn.typeahead.noConflict = origFnTypeahead.noConflict; });
define(function(require) { 'use strict'; var $ = require('jquery'); require('bootstrap'); /** * This customization allows to define own functions for Typeahead */ var Typeahead; var origTypeahead = $.fn.typeahead.Constructor; var origFnTypeahead = $.fn.typeahead; Typeahead = function(element, options) { var _this = this; var opts = $.extend({}, $.fn.typeahead.defaults, options); _.each(opts, function(value, name) { _this[name] = value || _this[name]; }); origTypeahead.apply(this, arguments); }; Typeahead.prototype = origTypeahead.prototype; Typeahead.prototype.constructor = Typeahead; $.fn.typeahead = function(option) { return this.each(function() { var $this = $(this); var data = $this.data('typeahead'); var options = typeof option === 'object' && option; if (!data) { $this.data('typeahead', (data = new Typeahead(this, options))); } if (typeof option === 'string') { data[option](); } }); }; $.fn.typeahead.defaults = origFnTypeahead.defaults; $.fn.typeahead.Constructor = Typeahead; $.fn.typeahead.noConflict = origFnTypeahead.noConflict; });
Add validation functionality to RuleEditorComponent - temp commit (polish of suggestion output)
BB-4210: Add validation functionality to RuleEditorComponent - temp commit (polish of suggestion output)
JavaScript
mit
orocrm/platform,orocrm/platform,orocrm/platform
--- +++ @@ -5,18 +5,20 @@ require('bootstrap'); /** - * This customization allows to define own focus, click, render, show, lookup functions for Typeahead + * This customization allows to define own functions for Typeahead */ var Typeahead; var origTypeahead = $.fn.typeahead.Constructor; var origFnTypeahead = $.fn.typeahead; Typeahead = function(element, options) { + var _this = this; var opts = $.extend({}, $.fn.typeahead.defaults, options); - this.focus = opts.focus || this.focus; - this.render = opts.render || this.render; - this.show = opts.show || this.show; - this.lookup = opts.lookup || this.lookup; + + _.each(opts, function(value, name) { + _this[name] = value || _this[name]; + }); + origTypeahead.apply(this, arguments); };
c594979d9be6b93542095108b04a723501ca9e12
tests/index.js
tests/index.js
const assert = require('assert') const Application = require('spectron').Application describe('application launch', function () { this.timeout(10000) beforeEach(function () { this.app = new Application({ path: __dirname + '/../node_modules/.bin/electron', args: [__dirname + '/../app/main/index.js'] }) return this.app.start() }) afterEach(function () { if (this.app && this.app.isRunning()) { return this.app.stop() } }) it('shows an initial window', function () { return this.app.client.getWindowCount().then(function (count) { assert.equal(count, 1) }) }) })
const assert = require('assert') const Application = require('spectron').Application describe('application launch', function () { this.timeout(10000) beforeEach(function () { this.app = new Application({ path: require('electron'), args: [__dirname + '/../app/main/index.js'] }) return this.app.start() }) afterEach(function () { if (this.app && this.app.isRunning()) { return this.app.stop() } }) it('shows an initial window', function () { return this.app.client.getWindowCount().then(function (count) { assert.equal(count, 1) }) }) })
Use the standard method to get the electron app location
Use the standard method to get the electron app location As per the guidance at https://github.com/electron-userland/electron-prebuilt programmatic usage acquires the path to electron by require('electron')
JavaScript
apache-2.0
brainwane/zulip-electron,steele/zulip-electron,zulip/zulip-desktop,brainwane/zulip-electron,zulip/zulip-electron,zulip/zulip-electron,zulip/zulip-electron,brainwane/zulip-electron,steele/zulip-electron,zulip/zulip-desktop,steele/zulip-electron,zulip/zulip-desktop,zulip/zulip-desktop
--- +++ @@ -6,7 +6,7 @@ beforeEach(function () { this.app = new Application({ - path: __dirname + '/../node_modules/.bin/electron', + path: require('electron'), args: [__dirname + '/../app/main/index.js'] }) return this.app.start()
fc6cb30f7323e35be709e3ad591bbb136f0ef5df
webpack.config.babel.js
webpack.config.babel.js
import path from 'path'; import HtmlWebpackPlugin from 'webpack-html-plugin'; import webpack from 'webpack'; const array = (target) => target.filter((item) => item); export default ({dev, prod}) => ({ entry: array([ dev && 'react-hot-loader/patch', 'babel-polyfill', './src/', ]), output: { path: path.resolve(__dirname, 'dist'), publicPath: '/', filename: 'bundle.js', }, plugins: array([ new HtmlWebpackPlugin({ template: 'src/index.html', inject: true, }), dev && new webpack.NoErrorsPlugin(), ]), module: { rules: [ { test: /\.js$/, use: 'babel-loader', exclude: '/node_modules/', options: { presets: ['es2015', 'react'], modules: false, }, }, { test: /\.less$/, use: [ {loader: 'style-loader'}, {loader: 'css-loader'}, {loader: 'less-loader'}, ], }, ], }, });
import path from 'path'; import HtmlWebpackPlugin from 'webpack-html-plugin'; import webpack from 'webpack'; /** removes empty items from array */ const array = (target) => target.filter((item) => item); /** removes empty properties from object */ const object = (target) => Object.keys(target).filter((key) => target[key]).reduce((result, key) => Object.assign({[key]: target[key]}, result), {}); export default ({dev, prod}) => ({ entry: array([ dev && 'react-hot-loader/patch', 'babel-polyfill', './src/', ]), output: { path: path.resolve(__dirname, 'dist'), publicPath: '/', filename: 'bundle.js', }, plugins: array([ new HtmlWebpackPlugin({ template: 'src/index.html', inject: true, }), dev && new webpack.NoErrorsPlugin(), ]), module: { rules: [ { test: /\.js$/, use: 'babel-loader', exclude: '/node_modules/', options: { presets: ['es2015', 'react'], modules: false, }, }, { test: /\.less$/, use: [ {loader: 'style-loader'}, {loader: 'css-loader'}, {loader: 'less-loader'}, ], }, ], }, });
Remove empty properties from object
Remove empty properties from object
JavaScript
mit
tomvej/redux-starter,tomvej/redux-starter
--- +++ @@ -2,7 +2,11 @@ import HtmlWebpackPlugin from 'webpack-html-plugin'; import webpack from 'webpack'; +/** removes empty items from array */ const array = (target) => target.filter((item) => item); + +/** removes empty properties from object */ +const object = (target) => Object.keys(target).filter((key) => target[key]).reduce((result, key) => Object.assign({[key]: target[key]}, result), {}); export default ({dev, prod}) => ({ entry: array([
47f7ac51444b54d4790586950832632fbdf30612
build/connect.js
build/connect.js
const rewrite = require('connect-modrewrite'); const serveIndex = require('serve-index'); const serveStatic = require('serve-static'); module.exports = function (grunt) { return { livereload: { options: { hostname : '127.0.0.1', port : 443, protocol : 'https', base : 'dist', open : 'https://localhost.localdomain', middleware: (connect, options) => { const middlewares = [ require('connect-livereload')(), ]; const rules = [ '^/binary-static/(.*)$ /$1', ]; middlewares.push(rewrite(rules)); if (!Array.isArray(options.base)) { options.base = [options.base]; } options.base.forEach((base) => { middlewares.push(serveStatic(base)); }); const directory = options.directory || options.base[options.base.length - 1]; middlewares.push(serveIndex(directory)); middlewares.push((req, res) => { const path_404 = `${options.base[0]}/404.html`; if (grunt.file.exists(path_404)) { require('fs').createReadStream(path_404).pipe(res); return; } res.statusCode(404); // 404.html not found res.end(); }); return middlewares; } } }, }; };
const rewrite = require('connect-modrewrite'); const serveIndex = require('serve-index'); const serveStatic = require('serve-static'); module.exports = function (grunt) { return { livereload: { options: { hostname : '0.0.0.0', port : 443, protocol : 'https', base : 'dist', open : 'https://localhost.localdomain', middleware: (connect, options) => { const middlewares = [ require('connect-livereload')(), ]; const rules = [ '^/binary-static/(.*)$ /$1', ]; middlewares.push(rewrite(rules)); if (!Array.isArray(options.base)) { options.base = [options.base]; } options.base.forEach((base) => { middlewares.push(serveStatic(base)); }); const directory = options.directory || options.base[options.base.length - 1]; middlewares.push(serveIndex(directory)); middlewares.push((req, res) => { const path_404 = `${options.base[0]}/404.html`; if (grunt.file.exists(path_404)) { require('fs').createReadStream(path_404).pipe(res); return; } res.statusCode(404); // 404.html not found res.end(); }); return middlewares; } } }, }; };
Allow Local LAN devices to access the livereload machine
Allow Local LAN devices to access the livereload machine
JavaScript
apache-2.0
binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,ashkanx/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,negar-binary/binary-static,ashkanx/binary-static,ashkanx/binary-static,binary-com/binary-static,negar-binary/binary-static,negar-binary/binary-static,binary-com/binary-static,4p00rv/binary-static
--- +++ @@ -6,7 +6,7 @@ return { livereload: { options: { - hostname : '127.0.0.1', + hostname : '0.0.0.0', port : 443, protocol : 'https', base : 'dist',
911ba266f0f5fd01c9c66948dad967af27edbc1b
website/src/app/global.services/store/state-store.service.js
website/src/app/global.services/store/state-store.service.js
import MCStoreBus from './mcstorebus'; class StateStoreService { /*@ngInject*/ constructor() { this.states = {}; this.bus = new MCStoreBus(); } updateState(key, value) { this.states[key] = angular.copy(value); let val = angular.copy(this.states[key]); this.bus.fireEvent(key, val); } getState(key) { if (_.has(this.states, key)) { return angular.copy(this.states[key]); } return null; } subscribe(state, fn) { return this.bus.subscribe(state, fn); } } angular.module('materialscommons').service('mcStateStore', StateStoreService);
import MCStoreBus from './mcstorebus'; class StateStoreService { /*@ngInject*/ constructor() { this.states = {}; this.bus = new MCStoreBus(); } updateState(key, value) { this.states[key] = angular.copy(value); let val = this.states[key]; this.bus.fireEvent(key, val); } getState(key) { if (_.has(this.states, key)) { return angular.copy(this.states[key]); } return null; } subscribe(state, fn) { return this.bus.subscribe(state, fn); } } angular.module('materialscommons').service('mcStateStore', StateStoreService);
Make contract that client needs to copy or not change value
Make contract that client needs to copy or not change value
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -9,7 +9,7 @@ updateState(key, value) { this.states[key] = angular.copy(value); - let val = angular.copy(this.states[key]); + let val = this.states[key]; this.bus.fireEvent(key, val); }
aeab0f4207efb2c2880552d7994077bf453f8099
bin/sass-lint.js
bin/sass-lint.js
#!/usr/bin/env node 'use strict'; var program = require('commander'), meta = require('../package.json'), lint = require('../index'); var detects, formatted, configPath, ignores, configOptions = {}; program .version(meta.version) .usage('[options] <pattern>') .option('-c, --config [path]', 'path to custom config file') .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `') .option('-q, --no-exit', 'do not exit on errors') .option('-v, --verbose', 'verbose output') .parse(process.argv); if (program.config && program.config !== true) { configPath = program.config; } if (program.ignore && program.ignore !== true) { ignores = program.ignore.split(', '); configOptions = { 'files': { 'ignore': ignores } }; } detects = lint.lintFiles(program.args[0], configOptions, configPath); formatted = lint.format(detects); if (program.verbose) { lint.outputResults(formatted); } if (program.exit) { lint.failOnError(detects); }
#!/usr/bin/env node 'use strict'; var program = require('commander'), meta = require('../package.json'), lint = require('../index'); var configPath, ignores, configOptions = {}; var detectPattern = function (pattern) { var detects, formatted; detects = lint.lintFiles(pattern, configOptions, configPath); formatted = lint.format(detects); if (program.verbose) { lint.outputResults(formatted); } if (program.exit) { lint.failOnError(detects); } }; program .version(meta.version) .usage('[options] <pattern>') .option('-c, --config [path]', 'path to custom config file') .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `') .option('-q, --no-exit', 'do not exit on errors') .option('-v, --verbose', 'verbose output') .parse(process.argv); if (program.config && program.config !== true) { configPath = program.config; } if (program.ignore && program.ignore !== true) { ignores = program.ignore.split(', '); configOptions = { 'files': { 'ignore': ignores } }; } if (program.args.length === 0) { detectPattern(null); } else { program.args.forEach(function (path) { detectPattern(path); }); }
Allow multiple paths for CLI
Allow multiple paths for CLI Resolves #60
JavaScript
mit
skovhus/sass-lint,DanPurdy/sass-lint,srowhani/sass-lint,flacerdk/sass-lint,Snugug/sass-lint,joshuacc/sass-lint,Dru89/sass-lint,MethodGrab/sass-lint,sasstools/sass-lint,bgriffith/sass-lint,sktt/sass-lint,alansouzati/sass-lint,ngryman/sass-lint,zallek/sass-lint,sasstools/sass-lint,benthemonkey/sass-lint,carsonmcdonald/sass-lint,donabrams/sass-lint,srowhani/sass-lint,zaplab/sass-lint
--- +++ @@ -5,11 +5,27 @@ meta = require('../package.json'), lint = require('../index'); -var detects, - formatted, - configPath, +var configPath, ignores, configOptions = {}; + +var detectPattern = function (pattern) { + var detects, + formatted; + + detects = lint.lintFiles(pattern, configOptions, configPath); + formatted = lint.format(detects); + + + if (program.verbose) { + lint.outputResults(formatted); + } + + + if (program.exit) { + lint.failOnError(detects); + } +}; program .version(meta.version) @@ -34,15 +50,11 @@ }; } -detects = lint.lintFiles(program.args[0], configOptions, configPath); -formatted = lint.format(detects); - - -if (program.verbose) { - lint.outputResults(formatted); +if (program.args.length === 0) { + detectPattern(null); } - - -if (program.exit) { - lint.failOnError(detects); +else { + program.args.forEach(function (path) { + detectPattern(path); + }); }
edb1532478facc1b121c52d1bad2ed361d669232
plugins/ember.js
plugins/ember.js
/** * Ember.js plugin * * Patches event handler callbacks and ajax callbacks. */ ;(function(window, Raven, Ember) { 'use strict'; // quit if Ember isn't on the page if (!Ember) { return; } var _oldOnError = Ember.onerror; Ember.onerror = function EmberOnError(error) { Raven.captureException(error); if (typeof _oldOnError === 'function') { _oldOnError.call(this, error); } }; Ember.RSVP.on('error', function (reason) { if (reason instanceof Error) { Raven.captureException(reason); } else { try { throw new Error('Unhandled Promise error detected'); } catch (err) { Raven.captureException(err, {extra: {reason: reason}}); } } }); }(window, window.Raven, window.Ember));
/** * Ember.js plugin * * Patches event handler callbacks and ajax callbacks. */ ;(function(window, Raven, Ember) { 'use strict'; // quit if Ember isn't on the page if (!Ember) { return; } var _oldOnError = Ember.onerror; Ember.onerror = function EmberOnError(error) { Raven.captureException(error); if (typeof _oldOnError === 'function') { _oldOnError.call(this, error); } }; Ember.RSVP.on('error', function (reason) { if (reason instanceof Error) { Raven.captureException(reason, {extra: {context: 'Unhandled RSVP error'}}); } else { try { throw new Error('Unhandled Promise error detected'); } catch (err) { Raven.captureException(err, {extra: {reason: reason}}); } } }); }(window, window.Raven, window.Ember));
Include context in RSVP handler.
Include context in RSVP handler.
JavaScript
bsd-3-clause
iodine/raven-js,clara-labs/raven-js,grelas/raven-js,malandrew/raven-js,chrisirhc/raven-js,eaglesjava/raven-js,hussfelt/raven-js,getsentry/raven-js,Mappy/raven-js,getsentry/raven-js,eaglesjava/raven-js,housinghq/main-raven-js,danse/raven-js,getsentry/raven-js,iodine/raven-js,getsentry/raven-js,benoitg/raven-js,grelas/raven-js,benoitg/raven-js,housinghq/main-raven-js,Mappy/raven-js,danse/raven-js,PureBilling/raven-js,hussfelt/raven-js,Mappy/raven-js,PureBilling/raven-js,clara-labs/raven-js,chrisirhc/raven-js,housinghq/main-raven-js,malandrew/raven-js
--- +++ @@ -20,7 +20,7 @@ }; Ember.RSVP.on('error', function (reason) { if (reason instanceof Error) { - Raven.captureException(reason); + Raven.captureException(reason, {extra: {context: 'Unhandled RSVP error'}}); } else { try { throw new Error('Unhandled Promise error detected');
8f4a856c5f8fb1fd6c90dbf64a73760b7f5e5016
ember/ember-cli-build.js
ember/ember-cli-build.js
/* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { var vendorFiles = {}; if (EmberApp.env() !== 'test') { vendorFiles['jquery.js'] = null; } var app = new EmberApp(defaults, { storeConfigInMeta: false, fingerprint: { enabled: false, }, vendorFiles: vendorFiles, gzip: { keepUncompressed: true, }, }); // Use `app.import` to add additional libraries to the generated // output files. // // If you need to use different assets in different // environments, specify an object as the first parameter. That // object's keys should be the environment name and the values // should be the asset to use in that environment. // // If the library that you are including contains AMD or ES6 // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. app.import('vendor/shims/openlayers.js'); app.import('vendor/shims/ol3-cesium.js'); app.import('bower_components/remarkable/dist/remarkable.js'); app.import('vendor/shims/remarkable.js'); return app.toTree(); };
/* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { var vendorFiles = {}; if (EmberApp.env() !== 'test') { vendorFiles['jquery.js'] = null; } var app = new EmberApp(defaults, { storeConfigInMeta: false, fingerprint: { enabled: false, }, vendorFiles: vendorFiles, gzip: { keepUncompressed: true, }, }); // Use `app.import` to add additional libraries to the generated // output files. // // If you need to use different assets in different // environments, specify an object as the first parameter. That // object's keys should be the environment name and the values // should be the asset to use in that environment. // // If the library that you are including contains AMD or ES6 // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. app.import('vendor/shims/openlayers.js'); app.import('vendor/shims/ol3-cesium.js'); app.import({ development: 'bower_components/remarkable/dist/remarkable.js', production: 'bower_components/remarkable/dist/remarkable.min.js', }); app.import('vendor/shims/remarkable.js'); return app.toTree(); };
Use minified "remarkable" version in production
Use minified "remarkable" version in production
JavaScript
agpl-3.0
skylines-project/skylines,Harry-R/skylines,kerel-fs/skylines,Harry-R/skylines,Harry-R/skylines,Turbo87/skylines,Turbo87/skylines,skylines-project/skylines,shadowoneau/skylines,kerel-fs/skylines,kerel-fs/skylines,RBE-Avionik/skylines,skylines-project/skylines,RBE-Avionik/skylines,shadowoneau/skylines,RBE-Avionik/skylines,Harry-R/skylines,shadowoneau/skylines,Turbo87/skylines,skylines-project/skylines,Turbo87/skylines,shadowoneau/skylines,RBE-Avionik/skylines
--- +++ @@ -38,7 +38,10 @@ app.import('vendor/shims/openlayers.js'); app.import('vendor/shims/ol3-cesium.js'); - app.import('bower_components/remarkable/dist/remarkable.js'); + app.import({ + development: 'bower_components/remarkable/dist/remarkable.js', + production: 'bower_components/remarkable/dist/remarkable.min.js', + }); app.import('vendor/shims/remarkable.js'); return app.toTree();
ba19c41de3da74bf26f76a435bc412f43b5631d5
migrations/20161117225616_index.js
migrations/20161117225616_index.js
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTable('users', table => { table.uuid('id') .primary() .defaultTo(knex.raw('uuid_generate_v4()')); table.string('username', 20) .unique(); table.string('password'); table.float('saldo') .defaultTo(0); }), knex.schema.createTable('transactionTypes', table => { table.increments('id') .primary(); table.string('typename'); }), knex.schema.createTable('transactions', table => { table.increments('id') .primary(); table.integer('typeId') .unsigned() .references('id') .inTable('transactionTypes') .onDelete('SET NULL'); table.uuid('userId') .references('id') .inTable('users') .onDelete('SET NULL'); table.timestamp('timestamp') .defaultTo(knex.raw('now()')); table.float('oldSaldo'); table.float('newSaldo'); table.string('comment'); }) ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('transactions'), knex.schema.dropTable('users'), knex.schema.dropTable('transactionTypes') ]);
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTable('users', table => { table.uuid('id') .primary() .defaultTo(knex.raw('uuid_generate_v4()')); table.string('username', 20) .notNullable() .unique(); table.string('password') .notNullable(); table.float('saldo') .notNullable() .defaultTo(0); }), knex.schema.createTable('transactions', table => { table.increments('id') .primary(); table.uuid('userId') .notNullable() .references('id') .inTable('users') .onDelete('SET NULL'); table.timestamp('timestamp') .defaultTo(knex.raw('now()')); table.float('oldSaldo') .notNullable(); table.float('newSaldo') .notNullable(); table.string('comment') .nullable(); }) ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('transactions'), knex.schema.dropTable('users') ]);
Remove transactionTypes table and specify column nullablility
Remove transactionTypes table and specify column nullablility
JavaScript
mit
majori/piikki
--- +++ @@ -5,41 +5,35 @@ .primary() .defaultTo(knex.raw('uuid_generate_v4()')); table.string('username', 20) + .notNullable() .unique(); - table.string('password'); + table.string('password') + .notNullable(); table.float('saldo') + .notNullable() .defaultTo(0); - }), - - - knex.schema.createTable('transactionTypes', table => { - table.increments('id') - .primary(); - table.string('typename'); }), knex.schema.createTable('transactions', table => { table.increments('id') .primary(); - table.integer('typeId') - .unsigned() - .references('id') - .inTable('transactionTypes') - .onDelete('SET NULL'); table.uuid('userId') + .notNullable() .references('id') .inTable('users') .onDelete('SET NULL'); table.timestamp('timestamp') .defaultTo(knex.raw('now()')); - table.float('oldSaldo'); - table.float('newSaldo'); - table.string('comment'); + table.float('oldSaldo') + .notNullable(); + table.float('newSaldo') + .notNullable(); + table.string('comment') + .nullable(); }) ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('transactions'), - knex.schema.dropTable('users'), - knex.schema.dropTable('transactionTypes') + knex.schema.dropTable('users') ]);
e583d332d04d6fa45e387525793d6f120ee7dcd4
packages/@sanity/default-layout/src/components/DefaultLayoutRouter.js
packages/@sanity/default-layout/src/components/DefaultLayoutRouter.js
import React from 'react' import DefaultLayout from './DefaultLayout' import {Router, Route, NotFound, Redirect} from 'router:@sanity/base/router' import locationStore from 'datastore:@sanity/base/location' import SanityIntlProvider from 'component:@sanity/base/sanity-intl-provider' class DefaultLayoutRouter extends React.Component { constructor() { super() this.state = {} this.handleNavigate = this.handleNavigate.bind(this) } componentWillMount() { this.pathSubscription = locationStore .state .subscribe({next: event => this.setState({location: event.location})}) } componentWillUnmount() { this.pathSubscription.unsubscribe() } handleNavigate(newUrl, options) { locationStore.actions.navigate(newUrl) } render() { const {location} = this.state if (!location) { return null } return ( <SanityIntlProvider> <Router location={location} navigate={this.handleNavigate}> <Route path="/:site/*" component={DefaultLayout} /> <Redirect path="/" to="/some-site" /> <NotFound component={() => <div>Not found</div>} /> </Router> </SanityIntlProvider> ) } } export default DefaultLayoutRouter
import React from 'react' import DefaultLayout from './DefaultLayout' import {Router, Route, NotFound, Redirect} from 'router:@sanity/base/router' import locationStore from 'datastore:@sanity/base/location' import SanityIntlProvider from 'component:@sanity/base/sanity-intl-provider' import LoginWrapper from 'component:@sanity/base/login-wrapper' class DefaultLayoutRouter extends React.Component { constructor() { super() this.state = {} this.handleNavigate = this.handleNavigate.bind(this) } componentWillMount() { this.pathSubscription = locationStore .state .subscribe({next: event => this.setState({location: event.location})}) } componentWillUnmount() { this.pathSubscription.unsubscribe() } handleNavigate(newUrl, options) { locationStore.actions.navigate(newUrl) } render() { const {location} = this.state if (!location) { return null } return ( <SanityIntlProvider> <LoginWrapper> <Router location={location} navigate={this.handleNavigate}> <Route path="/:site/*" component={DefaultLayout} /> <Redirect path="/" to="/some-site" /> <NotFound component={() => <div>Not found</div>} /> </Router> </LoginWrapper> </SanityIntlProvider> ) } } export default DefaultLayoutRouter
Put loginwrapper inside main router
Put loginwrapper inside main router
JavaScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -3,6 +3,7 @@ import {Router, Route, NotFound, Redirect} from 'router:@sanity/base/router' import locationStore from 'datastore:@sanity/base/location' import SanityIntlProvider from 'component:@sanity/base/sanity-intl-provider' +import LoginWrapper from 'component:@sanity/base/login-wrapper' class DefaultLayoutRouter extends React.Component { constructor() { @@ -33,11 +34,13 @@ return ( <SanityIntlProvider> - <Router location={location} navigate={this.handleNavigate}> - <Route path="/:site/*" component={DefaultLayout} /> - <Redirect path="/" to="/some-site" /> - <NotFound component={() => <div>Not found</div>} /> - </Router> + <LoginWrapper> + <Router location={location} navigate={this.handleNavigate}> + <Route path="/:site/*" component={DefaultLayout} /> + <Redirect path="/" to="/some-site" /> + <NotFound component={() => <div>Not found</div>} /> + </Router> + </LoginWrapper> </SanityIntlProvider> ) }
d69c40a6ced3b25a582b093dae6ab07d738947f4
public/scripts/ui.js
public/scripts/ui.js
define(['views/user/login', 'views/user/signup', 'views/header', 'views/order/vl_orders'], function (UserLogin, UserSignup, HeaderView, OrdersView) { var Ui = {}; var loginView = new UserLogin() var signupView = new UserSignup() var headerView = new HeaderView({el: '#header'}) var ordersView = new OrdersView(); Ui.initialize = function () { headerView.setUserData(window.localStorage.getItem('User') || {}); }; Ui.showHome = function () { loginView.render(); }; Ui.showSignup = function () { signupView.render(); } Ui.showOrders = function() { ordersView.render(); } // This always receive a JSON object with a standard API error Ui.error = function (err) { alert("Error: " + err.message); } // This always receive a jQuery error object from an API call Ui.errorAPI = function (res) { alert("Error: " + res.responseJSON.error.message); } // Event subscription Backbone.on('api:login:error', function (data, res) { Ui.error(res.responseJSON.error); }); Backbone.on('api:signup:error', function (data, res) { Ui.error(res.responseJSON.error); }); return Ui; });
define([ 'backbone', 'api', 'collections/c_orders', 'views/user/login', 'views/user/signup', 'views/header', 'views/order/vl_orders'], function (Backbone, Api, CollectionOrder, UserLogin, UserSignup, HeaderView, OrdersView) { var Ui = {}; var loginView = new UserLogin() var signupView = new UserSignup() var headerView = new HeaderView({el: '#header'}) var ordersView = new OrdersView(); Ui.initialize = function () { headerView.setUserData(Backbone.localStorage.getItem('user')); }; Ui.showHome = function () { loginView.render(); }; Ui.showSignup = function () { signupView.render(); } Ui.showOrders = function () { var orders = new CollectionOrder(); orders.fetch({ success: ordersView.render.bind(ordersView), error: Ui.errorBackbone }); } Ui.errorBackbone = function (data, res) { alert("Error: " + res.responseJSON.error.message); } // This always receive a JSON object with a standard API error Ui.error = function (err, err2) { alert("Error: " + err.message); } // This always receive a jQuery error object from an API call Ui.errorAPI = function (res) { alert("Error: " + res.responseJSON.error.message); } // Event subscription Backbone.on('api:login:error', function (res) { Ui.error(res.responseJSON.error); }); Backbone.on('api:signup:error', function (res) { Ui.error(res.responseJSON.error); }); return Ui; });
Use convenience localStorage functions from Backbone Use Backbone collection to fetch orders Added new error function to Ui Fix parameters for event callbacks
Use convenience localStorage functions from Backbone Use Backbone collection to fetch orders Added new error function to Ui Fix parameters for event callbacks
JavaScript
apache-2.0
neich/nodebb,neich/nodebb,neich/nodebb
--- +++ @@ -1,5 +1,12 @@ -define(['views/user/login', 'views/user/signup', 'views/header', 'views/order/vl_orders'], - function (UserLogin, UserSignup, HeaderView, OrdersView) { +define([ + 'backbone', + 'api', + 'collections/c_orders', + 'views/user/login', + 'views/user/signup', + 'views/header', + 'views/order/vl_orders'], + function (Backbone, Api, CollectionOrder, UserLogin, UserSignup, HeaderView, OrdersView) { var Ui = {}; @@ -9,7 +16,7 @@ var ordersView = new OrdersView(); Ui.initialize = function () { - headerView.setUserData(window.localStorage.getItem('User') || {}); + headerView.setUserData(Backbone.localStorage.getItem('user')); }; Ui.showHome = function () { @@ -20,12 +27,20 @@ signupView.render(); } - Ui.showOrders = function() { - ordersView.render(); + Ui.showOrders = function () { + var orders = new CollectionOrder(); + orders.fetch({ + success: ordersView.render.bind(ordersView), + error: Ui.errorBackbone + }); + } + + Ui.errorBackbone = function (data, res) { + alert("Error: " + res.responseJSON.error.message); } // This always receive a JSON object with a standard API error - Ui.error = function (err) { + Ui.error = function (err, err2) { alert("Error: " + err.message); } @@ -36,11 +51,11 @@ // Event subscription - Backbone.on('api:login:error', function (data, res) { + Backbone.on('api:login:error', function (res) { Ui.error(res.responseJSON.error); }); - Backbone.on('api:signup:error', function (data, res) { + Backbone.on('api:signup:error', function (res) { Ui.error(res.responseJSON.error); });
9a46fd4a6a7bbc408f258a23b141f44297b853d0
packages/zent/src/design/stripUUID.js
packages/zent/src/design/stripUUID.js
import has from 'lodash/has'; import isPlainObject from 'lodash/isPlainObject'; import isArray from 'lodash/isArray'; const UUID_KEY_PATTERN = /__.+uuid__/i; export default function stripUUID(value) { if (isPlainObject(value)) { // eslint-disable-next-line for (const key in value) { if (has(value, key)) { if (UUID_KEY_PATTERN.test(key)) { delete value[key]; } else { const oldValue = value[key]; const newValue = stripUUID(oldValue); if (newValue !== oldValue) { value[key] = newValue; } } } } } else if (isArray(value)) { value.forEach(v => stripUUID(v)); } return value; }
import has from 'lodash/has'; import isPlainObject from 'lodash/isPlainObject'; import isArray from 'lodash/isArray'; const UUID_KEY_PATTERN = /__.+uuid__/i; const OLD_KEY = 'zent-design-uuid'; export default function stripUUID(value) { if (isPlainObject(value)) { // eslint-disable-next-line for (const key in value) { if (has(value, key)) { if (OLD_KEY === key || UUID_KEY_PATTERN.test(key)) { delete value[key]; } else { const oldValue = value[key]; const newValue = stripUUID(oldValue); if (newValue !== oldValue) { value[key] = newValue; } } } } } else if (isArray(value)) { value.forEach(v => stripUUID(v)); } return value; }
Add compatibility to old uuid key
Add compatibility to old uuid key
JavaScript
mit
youzan/zent,youzan/zent,youzan/zent,youzan/zent
--- +++ @@ -3,13 +3,14 @@ import isArray from 'lodash/isArray'; const UUID_KEY_PATTERN = /__.+uuid__/i; +const OLD_KEY = 'zent-design-uuid'; export default function stripUUID(value) { if (isPlainObject(value)) { // eslint-disable-next-line for (const key in value) { if (has(value, key)) { - if (UUID_KEY_PATTERN.test(key)) { + if (OLD_KEY === key || UUID_KEY_PATTERN.test(key)) { delete value[key]; } else { const oldValue = value[key];
5caa4281c7f5e1bace711f95fe91d8edbb2fb194
test/js/fixtures/common.js
test/js/fixtures/common.js
// We use factories for the models we want to test so just set // empty fixtures here to keep the DS.FixtureAdapter quiet App.CurrentUser.FIXTURES = []; App.WallPost.FIXTURES = []; App.ProjectPhase.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Organization.FIXTURES = []; App.Project.FIXTURES = []; App.TaskFile.FIXTURES = []; App.TaskMember.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Task.FIXTURES = []; App.Page.FIXTURES = []; App.PartnerOrganization.FIXTURES = []; App.Quote.FIXTURES = []; App.Project.FIXTURES = []; App.WallPost.FIXTURES = [];
// We use factories for the models we want to test so just set // empty fixtures here to keep the DS.FixtureAdapter quiet App.CurrentUser.FIXTURES = []; App.WallPost.FIXTURES = []; App.ProjectPhase.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Organization.FIXTURES = []; App.Project.FIXTURES = []; App.TaskFile.FIXTURES = []; App.TaskMember.FIXTURES = []; App.TaskSearch.FIXTURES = []; App.Task.FIXTURES = []; App.Page.FIXTURES = []; App.Quote.FIXTURES = []; App.Project.FIXTURES = []; App.WallPost.FIXTURES = [];
Remove PartnerOrg Fixture from tests.
Remove PartnerOrg Fixture from tests. PartenrOrg are moved to 1%
JavaScript
bsd-3-clause
onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle
--- +++ @@ -11,7 +11,6 @@ App.TaskSearch.FIXTURES = []; App.Task.FIXTURES = []; App.Page.FIXTURES = []; -App.PartnerOrganization.FIXTURES = []; App.Quote.FIXTURES = []; App.Project.FIXTURES = []; App.WallPost.FIXTURES = [];
6359226476d6724133863ec9a806d70c2ceaadb1
routes/socket.js
routes/socket.js
/* * Socket.io Communication */ // module dependencies var crypto = require('crypto'); // variable declarations var socketCodes = {}; module.exports = function(socket) { // establish connection socket.emit('pair:init', {}); // receive device type socket.on('pair:deviceType', function(data) { // if deviceType is 'pc', generate a unique code and send to PC if(data.deviceType == 'pc') { // generate a code var code = crypto.randomBytes(3).toString('hex'); // ensure uniqueness while(code in socketCodes) { code = crypto.randomBytes(3).toString('hex'); } // store pairing code / socket assocation socketCodes[code] = this; socket.code = code; // show code on PC socket.emit('pair:sendCode', { code: code }); } // if deviceType is 'mobile', check if submitted code is valid and pair else if(data.deviceType == 'mobile') { socket.on('pair:getCode', function(data) { if(data.code in socketCodes) { // save the code for controller commands socket.code = data.code; // initialize the controller socket.emit('pair:connected', {}); // start the PC socketCodes[data.code].emit('pair:connected', {}); } else { socket.emit('pair:fail', {}); socket.disconnect(); } }); } }); };
/* * Socket.io Communication */ // module dependencies var crypto = require('crypto'); // variable declarations var socketCodes = {}; module.exports = function(socket) { // establish connection socket.emit('pair:init', {}); // pair mobile and PC // Reference: http://blog.artlogic.com/2013/06/21/phone-to-browser-html5-gaming-using-node-js-and-socket-io/ socket.on('pair:deviceType', function(data) { // if deviceType is 'pc', generate a unique code and send to PC if(data.deviceType == 'pc') { // generate a code var code = crypto.randomBytes(3).toString('hex'); // ensure code is unique while(code in socketCodes) { code = crypto.randomBytes(3).toString('hex'); } // store code / socket assocation socketCodes[code] = this; socket.code = code; // show code on PC socket.emit('pair:sendCode', { code: code }); } // if deviceType is 'mobile', check if submitted code is valid and pair else if(data.deviceType == 'mobile') { socket.on('pair:getCode', function(data) { if(data.code in socketCodes) { // save the code for mobile commands socket.code = data.code; // start mobile connection socket.emit('pair:connected', {}); // start PC connection socketCodes[data.code].emit('pair:connected', {}); } else { socket.emit('pair:fail', {}); socket.disconnect(); } }); } }); };
Add comments to pairing section
Add comments to pairing section
JavaScript
mit
drejkim/multi-screen-demo,drejkim/multi-screen-demo,drejkim/multi-screen-demo
--- +++ @@ -12,19 +12,20 @@ // establish connection socket.emit('pair:init', {}); - // receive device type + // pair mobile and PC + // Reference: http://blog.artlogic.com/2013/06/21/phone-to-browser-html5-gaming-using-node-js-and-socket-io/ socket.on('pair:deviceType', function(data) { // if deviceType is 'pc', generate a unique code and send to PC if(data.deviceType == 'pc') { // generate a code var code = crypto.randomBytes(3).toString('hex'); - // ensure uniqueness + // ensure code is unique while(code in socketCodes) { code = crypto.randomBytes(3).toString('hex'); } - // store pairing code / socket assocation + // store code / socket assocation socketCodes[code] = this; socket.code = code; @@ -35,13 +36,13 @@ else if(data.deviceType == 'mobile') { socket.on('pair:getCode', function(data) { if(data.code in socketCodes) { - // save the code for controller commands + // save the code for mobile commands socket.code = data.code; - // initialize the controller + // start mobile connection socket.emit('pair:connected', {}); - // start the PC + // start PC connection socketCodes[data.code].emit('pair:connected', {}); } else {
dfaf7349385de1877225c2662b3a6fe83a7b2e23
public/script.js
public/script.js
'use strict'; /* * Tanura demo app. * * This is the main script of the app demonstrating Tanura's features. */ /** * Bootstrapping routine. */ window.onload = () => { console.log("Tanura demo."); }
'use strict'; /* * Tanura demo app. * * This is the main script of the app demonstrating Tanura's features. */ /** * Bootstrapping routine. */ window.onload = () => { console.log("Initializing Tanura..."); tanura.init({audio: true, video: true}); }
Update the demo to use tanura.init().
Update the demo to use tanura.init().
JavaScript
agpl-3.0
theOtherNuvanda/Tanura,theOtherNuvanda/Tanura,theOtherNuvanda/Tanura
--- +++ @@ -10,6 +10,7 @@ * Bootstrapping routine. */ window.onload = () => { - console.log("Tanura demo."); + console.log("Initializing Tanura..."); + tanura.init({audio: true, video: true}); }
e1795c6888e4a26bb563623da18217b5c6096e0d
website/src/app/project/experiments/experiment/components/tasks/mc-experiment-task-details.component.js
website/src/app/project/experiments/experiment/components/tasks/mc-experiment-task-details.component.js
angular.module('materialscommons').component('mcExperimentTaskDetails', { templateUrl: 'app/project/experiments/experiment/components/tasks/mc-experiment-task-details.html', controller: MCExperimentTaskDetailsComponentController, bindings: { task: '=' } }); /*@ngInject*/ function MCExperimentTaskDetailsComponentController($scope, editorOpts, currentTask, templates, template, experimentsService, $stateParams, toast) { let ctrl = this; ctrl.currentTask = currentTask.get(); var t = templates.getTemplate('As Received'); template.set(t); $scope.editorOptions = editorOpts({height: 25, width: 20}); ctrl.selectedTemplate = (templateId, processId) => { console.log('selectedTemplate', templateId, processId); }; ctrl.updateTaskNote = () => { console.log('updateTaskNote'); if (ctrl.task.note === null) { ctrl.task.note = ""; } experimentsService.updateTask($stateParams.project_id, $stateParams.experiment_id, ctrl.task.id, {note: ctrl.task.note}) .then( () => null, () => toast.error('Unable to update task note.') ); }; }
angular.module('materialscommons').component('mcExperimentTaskDetails', { templateUrl: 'app/project/experiments/experiment/components/tasks/mc-experiment-task-details.html', controller: MCExperimentTaskDetailsComponentController, bindings: { task: '=' } }); /*@ngInject*/ function MCExperimentTaskDetailsComponentController($scope, editorOpts, currentTask, templates, template, experimentsService, $stateParams, toast) { let ctrl = this; ctrl.currentTask = currentTask.get(); var t = templates.getTemplate('As Received'); template.set(t); $scope.editorOptions = editorOpts({height: 25, width: 20}); ctrl.selectedTemplate = (templateId, processId) => { console.log('selectedTemplate', templateId, processId); }; ctrl.updateTaskNote = () => { if (ctrl.task.note === null) { return; } experimentsService.updateTask($stateParams.project_id, $stateParams.experiment_id, ctrl.task.id, {note: ctrl.task.note}) .then( () => null, () => toast.error('Unable to update task note.') ); }; }
Return if note is null.
Return if note is null.
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -21,9 +21,8 @@ }; ctrl.updateTaskNote = () => { - console.log('updateTaskNote'); if (ctrl.task.note === null) { - ctrl.task.note = ""; + return; } experimentsService.updateTask($stateParams.project_id, $stateParams.experiment_id, ctrl.task.id,
2bb4efab77c87ffd6c395c77d00b7890542d0630
test/editor.js
test/editor.js
var confy = require('../index'); var testCase = require('nodeunit').testCase; confy.configFile = __dirname + '/.confy'; confy.clean(); process.ENV.EDITOR = __dirname + '/editorcmd'; module.exports = testCase({ setUp: function (callback) { confy.clean(); callback(); }, tearDown: function (callback) { confy.clean(); callback(); }, editor: function(t) { confy.get('foo', { require: { foo: "" } }, function(err, res) { t.ok(!err, 'error is null'); t.deepEqual(res, { foo: 'bar' }, 'editor write file'); t.done(); }); } });
var confy = require('../index'); var testCase = require('nodeunit').testCase; confy.configFile = __dirname + '/.confy'; confy.clean(); process.env.EDITOR = __dirname + '/editorcmd'; module.exports = testCase({ setUp: function (callback) { confy.clean(); callback(); }, tearDown: function (callback) { confy.clean(); callback(); }, editor: function(t) { confy.get('foo', { require: { foo: "" } }, function(err, res) { t.ok(!err, 'error is null'); t.deepEqual(res, { foo: 'bar' }, 'editor write file'); t.done(); }); } });
Fix process.ENV is not supported v0.6.x
Fix process.ENV is not supported v0.6.x
JavaScript
mit
hokaccha/node-confy
--- +++ @@ -3,7 +3,7 @@ confy.configFile = __dirname + '/.confy'; confy.clean(); -process.ENV.EDITOR = __dirname + '/editorcmd'; +process.env.EDITOR = __dirname + '/editorcmd'; module.exports = testCase({ setUp: function (callback) {
be3e67e981125cb4e835abedc87df3c693152a2c
src/query/NicknameQuery.js
src/query/NicknameQuery.js
import { db, Rat } from '../db' import Query from './index' /** * A class representing a rat query */ class NicknameQuery extends Query { /** * Create a sequelize rat query from a set of parameters * @constructor * @param params * @param connection */ constructor (params, connection) { super(params, connection) if (params.nickname) { let formattedNickname = params.nickname.replace(/\[(.*?)]$/g, '') this._query.where.nicknames = { $overlap: db.literal(`ARRAY[${db.escape(params.nickname)}, ${db.escape(formattedNickname)}]::citext[]`) } delete this._query.where.nickname } this._query.attributes = [ 'id', 'createdAt', 'updatedAt', 'email', 'displayRatId', [db.cast(db.col('nicknames'), 'text[]'), 'nicknames'] ] this._query.include = [{ model: Rat, as: 'rats', required: false, attributes: { exclude: [ 'deletedAt' ] } }] } } module.exports = NicknameQuery
import { db, Rat } from '../db' import Query from './index' /** * A class representing a rat query */ class NicknameQuery extends Query { /** * Create a sequelize rat query from a set of parameters * @constructor * @param params * @param connection */ constructor (params, connection) { super(params, connection) if (params.nickname) { let formattedNickname = params.nickname.replace(/\[(.*?)]$/g, '') this._query.where.nicknames = { $overlap: [params.nickname, formattedNickname] } delete this._query.where.nickname } this._query.attributes = [ 'id', 'createdAt', 'updatedAt', 'email', 'displayRatId', 'nicknames' ] this._query.include = [{ model: Rat, as: 'rats', required: false, attributes: { exclude: [ 'deletedAt' ] } }] } } module.exports = NicknameQuery
Remove some lingering citext stuff from nickname query
Remove some lingering citext stuff from nickname query
JavaScript
bsd-3-clause
FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com
--- +++ @@ -18,7 +18,7 @@ if (params.nickname) { let formattedNickname = params.nickname.replace(/\[(.*?)]$/g, '') this._query.where.nicknames = { - $overlap: db.literal(`ARRAY[${db.escape(params.nickname)}, ${db.escape(formattedNickname)}]::citext[]`) + $overlap: [params.nickname, formattedNickname] } delete this._query.where.nickname } @@ -30,7 +30,7 @@ 'updatedAt', 'email', 'displayRatId', - [db.cast(db.col('nicknames'), 'text[]'), 'nicknames'] + 'nicknames' ] this._query.include = [{
d2dde55619473b30dd16fd2276e81977dffd5593
src/rar-file/rar-stream.js
src/rar-file/rar-stream.js
//@flow import {Readable} from 'stream'; import RarFileChunk from './rar-file-chunk'; export default class RarStream extends Readable { _rarFileChunks: RarFileChunk[]; _byteOffset: number = 0; constructor(...rarFileChunks: RarFileChunk[]){ super(); this._next(rarFileChunks); } pushData(stream: Readable, chunk: ?(Buffer | string)) : ?boolean { if (!super.push(chunk)){ stream.pause(); } } _next(rarFileChunks: RarFileChunk[]) { const chunk = rarFileChunks.shift(); if(!chunk){ this.push(null); } else { chunk.getStream().then((stream) => { stream.on('data', (data) => this.pushData(stream, data)); stream.on('end', () => this._next(rarFileChunks)); }); } } _read (){ this.resume(); } }
//@flow import {Readable} from 'stream'; import RarFileChunk from './rar-file-chunk'; export default class RarStream extends Readable { constructor(...rarFileChunks: RarFileChunk[]){ super(); this._next(rarFileChunks); } pushData(stream: Readable, chunk: ?(Buffer | string)) : ?boolean { if (!super.push(chunk)){ stream.pause(); } } _next(rarFileChunks: RarFileChunk[]) { const chunk = rarFileChunks.shift(); if(!chunk){ this.push(null); } else { chunk.getStream().then((stream) => { stream.on('data', (data) => this.pushData(stream, data)); stream.on('end', () => this._next(rarFileChunks)); }); } } _read (){ this.resume(); } }
Remove class state from RarStream
Remove class state from RarStream
JavaScript
mit
1313/rar-stream
--- +++ @@ -2,14 +2,11 @@ import {Readable} from 'stream'; import RarFileChunk from './rar-file-chunk'; export default class RarStream extends Readable { - _rarFileChunks: RarFileChunk[]; - _byteOffset: number = 0; - constructor(...rarFileChunks: RarFileChunk[]){ super(); this._next(rarFileChunks); } - + pushData(stream: Readable, chunk: ?(Buffer | string)) : ?boolean { if (!super.push(chunk)){ stream.pause(); @@ -27,6 +24,7 @@ }); } } + _read (){ this.resume(); }
6e2d7b798504d57c549e3e3750d88e0785f70f71
src/components/WeaveElement.js
src/components/WeaveElement.js
import React, { Component } from 'react'; import '../styles/WeaveElement.css'; class WeaveElement extends Component { constructor() { super(); this.state = {red: false}; this.handleClick = this.handleClick.bind(this); } render() { const style = this.state.red ? "WeaveElement redWeaveElement" : "WeaveElement whiteWeaveElement"; return (<div onClick={this.handleClick} className={style}></div>); } handleClick(e) { if (this.state.red) this.setState({'red': false}); else this.setState({'red': true}); } } export default WeaveElement;
import React, { Component } from 'react'; import '../styles/WeaveElement.css'; class WeaveElement extends Component { constructor() { super(); this.handleClick = this.handleClick.bind(this); } componentState() { const row = this.props.row; const col = this.props.col; const weaves = this.props.currentState.weaves; if (weaves[row]) { if (weaves[row][col] === undefined || weaves[row][col] === false) { return false; } else { return true; } } else { return false; } } render() { const style = this.componentState() ? "WeaveElement redWeaveElement" : "WeaveElement whiteWeaveElement"; return (<div onClick={this.handleClick} className={style}></div>); } handleClick(e) { if (this.componentState()) this.props.offClick(this.props.row, this.props.col); else this.props.onClick(this.props.row, this.props.col); } } export default WeaveElement;
Add method componentState and remove inner state
Add method componentState and remove inner state
JavaScript
mit
nobus/weaver,nobus/weaver
--- +++ @@ -4,13 +4,27 @@ class WeaveElement extends Component { constructor() { super(); - - this.state = {red: false}; this.handleClick = this.handleClick.bind(this); } + componentState() { + const row = this.props.row; + const col = this.props.col; + const weaves = this.props.currentState.weaves; + + if (weaves[row]) { + if (weaves[row][col] === undefined || weaves[row][col] === false) { + return false; + } else { + return true; + } + } else { + return false; + } + } + render() { - const style = this.state.red + const style = this.componentState() ? "WeaveElement redWeaveElement" : "WeaveElement whiteWeaveElement"; @@ -18,8 +32,8 @@ } handleClick(e) { - if (this.state.red) this.setState({'red': false}); - else this.setState({'red': true}); + if (this.componentState()) this.props.offClick(this.props.row, this.props.col); + else this.props.onClick(this.props.row, this.props.col); } }
7fd8521156a34ddee04f150548e00838561aa97c
src/components/common/index.js
src/components/common/index.js
export { Avatar } from './Avatar'; export Button from './Button'; export FloatingAction from './FloatingAction'; export FullScreenTextArea from './FullScreenTextArea'; export Icon from './Icon'; export User from './User';
export { Avatar } from './Avatar'; export Button from './Button'; export FullScreenTextArea from './FullScreenTextArea'; export Icon from './Icon'; export User from './User';
Remove floating action from export
Remove floating action from export
JavaScript
mit
tobycyanide/felony,tobycyanide/felony,henryboldi/felony,henryboldi/felony
--- +++ @@ -1,6 +1,5 @@ export { Avatar } from './Avatar'; export Button from './Button'; -export FloatingAction from './FloatingAction'; export FullScreenTextArea from './FullScreenTextArea'; export Icon from './Icon'; export User from './User';
6ca61608e8bed65e03d59b224af62e312dcd1626
generators/gulp/index.js
generators/gulp/index.js
'use strict'; var yeoman = require('yeoman-generator'); module.exports = yeoman.generators.Base.extend({ initializing: function() { this.option('gh_page_type', { type: String, required: true, desc: 'Github page type (user or project)' }); this._set_branch_option(); }, _set_branch_option: function() { this.options.branch_name = this.options.gh_page_type === 'user' ? 'master' : 'gh-pages'; }, writing: function() { this.fs.copyTpl( this.templatePath('gulpfile.js'), this.destinationPath('gulpfile.js'), this.options ); } });
'use strict'; var yeoman = require('yeoman-generator'); module.exports = yeoman.generators.Base.extend({ initializing: function() { this.option('gh_page_type', { type: String, required: true, desc: 'Github page type (user, organization, or project)' }); this._set_branch_option(); }, _set_branch_option: function() { var is_user_or_org = (/user|organization/i).test(this.options.gh_page_type); this.options.branch_name = is_user_or_org ? 'master' : 'gh-pages'; }, writing: function() { this.fs.copyTpl( this.templatePath('gulpfile.js'), this.destinationPath('gulpfile.js'), this.options ); } });
Adjust gulp generator to support github orgs
Adjust gulp generator to support github orgs
JavaScript
mit
gjeck/generator-jekyll-ghpages,gjeck/generator-jekyll-ghpages,gjeck/generator-jekyll-ghpages
--- +++ @@ -6,13 +6,14 @@ this.option('gh_page_type', { type: String, required: true, - desc: 'Github page type (user or project)' + desc: 'Github page type (user, organization, or project)' }); this._set_branch_option(); }, _set_branch_option: function() { - this.options.branch_name = this.options.gh_page_type === 'user' ? 'master' : 'gh-pages'; + var is_user_or_org = (/user|organization/i).test(this.options.gh_page_type); + this.options.branch_name = is_user_or_org ? 'master' : 'gh-pages'; }, writing: function() {
297a346983d1353b4eaa82ca25cfae88a2eed208
app/js/directives/morph_form.js
app/js/directives/morph_form.js
annotationApp.directive('morphForm', function() { return { restrict: 'E', scope: true, templateUrl: 'templates/morph_form.html' }; });
"use strict"; annotationApp.directive('morphForm', function() { return { restrict: 'E', scope: true, templateUrl: 'templates/morph_form.html' }; });
Use strict in morphForm directive
Use strict in morphForm directive
JavaScript
mit
PonteIneptique/arethusa,latin-language-toolkit/arethusa,Masoumeh/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,alpheios-project/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,latin-language-toolkit/arethusa,PonteIneptique/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa
--- +++ @@ -1,3 +1,5 @@ +"use strict"; + annotationApp.directive('morphForm', function() { return { restrict: 'E',
1646d23736e1f9fb7125136ed2ed934556d197d0
Build/Config.js
Build/Config.js
// Project configuration. var pkg = require("../package"); module.exports = { "package" : pkg, "paths" : { "private": "Resources/Private", "public": "Resources/Public", }, "Sass" : { "sassDir" : "Resources/Private/Sass", "cssDir" : "Resources/Public/Stylesheets" }, "JavaScripts" : { "devDir" : "Resources/Private/Javascripts", "distDir" : "Resources/Public/Javascripts", "config" : "Resources/Private/Javascripts/Main.js", "requireJS" : "Resources/Private/Javascripts/Libaries/RequireJS/require", "compileDistFile" : "Resources/Public/Javascripts/Main.min.js" }, "Images" : { "devDir" : "Resources/Private/Images", "distDir" : "Resources/Public/Images", "optimizationLevel" : 5 }, "packageIsDefault" : (pkg.name === "t3b_template") ? true : false // Check if the defaults in 'package.json' are customized. };
// Project configuration. var pkg = require("../package"); module.exports = { "package" : pkg, "paths" : { "private": "Resources/Private", "public": "Resources/Public", }, "Sass" : { "sassDir" : "Resources/Private/Sass", "cssDir" : "Resources/Public/Stylesheets" }, "JavaScripts" : { "devDir" : "Resources/Private/Javascripts", "distDir" : "Resources/Public/Javascripts", "config" : "Resources/Private/Javascripts/Main.js", "requireJS" : "Resources/Private/Javascripts/Libaries/RequireJS/require", "compileDistFile" : "Resources/Public/Javascripts/Main.min.js" }, "Images" : { "devDir" : "Resources/Private/Images", "distDir" : "Resources/Public/Images", "optimizationLevel" : 5 }, "packageIsDefault" : pkg.name === "t3b_template" // Check if the defaults in 'package.json' are customized. };
Simplify the grunt 'packageIsDefault' check
[MISC] Simplify the grunt 'packageIsDefault' check
JavaScript
mit
t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template
--- +++ @@ -24,5 +24,5 @@ "distDir" : "Resources/Public/Images", "optimizationLevel" : 5 }, - "packageIsDefault" : (pkg.name === "t3b_template") ? true : false // Check if the defaults in 'package.json' are customized. + "packageIsDefault" : pkg.name === "t3b_template" // Check if the defaults in 'package.json' are customized. };
ca1b5aa9ad844425fe7efae1d1cf03ff97125a5b
server/database/index.js
server/database/index.js
import Sequelize from 'sequelize' import logger from '../helpers/logger' import config from './config' const { url, dialect } = config[process.env.NODE_ENV] export default new Sequelize(url, { logging: msg => { logger.debug(msg) }, dialect, operatorsAliases: false, // @TODO Remove this option in sequelize@>=5.0 })
import Sequelize from 'sequelize' import config from './config' import logger from '../helpers/logger' const { url, dialect } = config[process.env.NODE_ENV] export default new Sequelize(url, { dialect, logging: msg => { logger.debug(msg) }, })
Remove unneded database options after upgrading to Sequelize 5
Remove unneded database options after upgrading to Sequelize 5
JavaScript
agpl-3.0
adzialocha/hoffnung3000,adzialocha/hoffnung3000
--- +++ @@ -1,14 +1,13 @@ import Sequelize from 'sequelize' +import config from './config' import logger from '../helpers/logger' -import config from './config' const { url, dialect } = config[process.env.NODE_ENV] export default new Sequelize(url, { + dialect, logging: msg => { logger.debug(msg) }, - dialect, - operatorsAliases: false, // @TODO Remove this option in sequelize@>=5.0 })
85acc479edf0d08bd3216b4a0b36748117670dc1
source/popup/js/index.js
source/popup/js/index.js
import { placeStylesheet } from "../../common/styles"; window.Buttercup = { fetchArchives: function() { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out getting archive list")), 200); chrome.runtime.sendMessage({ command: "get-archive-states" }, function(response) { clearTimeout(timeout); resolve(response); }); }); }, lockArchive: function(name) { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 200); chrome.runtime.sendMessage({ command: "lock-archive", name }, function(response) { clearTimeout(timeout); if (response && response.ok) { resolve(response); } else { reject(new Error(response.error)); } }); }); } }; placeStylesheet();
import { placeStylesheet } from "../../common/styles"; window.Buttercup = { fetchArchives: function() { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out getting archive list")), 200); chrome.runtime.sendMessage({ command: "get-archive-states" }, function(response) { clearTimeout(timeout); resolve(response); }); }); }, lockArchive: function(name) { return new Promise(function(resolve, reject) { let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 4000); chrome.runtime.sendMessage({ command: "lock-archive", name }, function(response) { clearTimeout(timeout); if (response && response.ok) { resolve(response); } else { reject(new Error(response.error)); } }); }); } }; placeStylesheet();
Increase timeout for locking archives
Increase timeout for locking archives
JavaScript
mit
perry-mitchell/buttercup-chrome,perry-mitchell/buttercup-chrome,buttercup-pw/buttercup-browser-extension,buttercup-pw/buttercup-browser-extension
--- +++ @@ -14,7 +14,7 @@ lockArchive: function(name) { return new Promise(function(resolve, reject) { - let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 200); + let timeout = setTimeout(() => reject(new Error("Timed-out locking archive")), 4000); chrome.runtime.sendMessage({ command: "lock-archive", name }, function(response) { clearTimeout(timeout); if (response && response.ok) {
58d921e92620f220dc73d49792f791add873caaf
packages/test-in-browser/package.js
packages/test-in-browser/package.js
Package.describe({ summary: "Run tests interactively in the browser", version: '1.0.6' }); Package.onUse(function (api) { // XXX this should go away, and there should be a clean interface // that tinytest and the driver both implement? api.use('tinytest'); api.use('bootstrap@1.0.1'); api.use('underscore'); api.use('session'); api.use('reload'); api.use(['blaze', 'templating', 'spacebars', 'ddp', 'tracker'], 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles([ 'driver.css', 'driver.html', 'driver.js' ], "client"); api.use('autoupdate', 'server', {weak: true}); api.use('random', 'server'); api.addFiles('autoupdate.js', 'server'); });
Package.describe({ summary: "Run tests interactively in the browser", version: '1.0.6', documentation: null }); Package.onUse(function (api) { // XXX this should go away, and there should be a clean interface // that tinytest and the driver both implement? api.use('tinytest'); api.use('bootstrap@1.0.1'); api.use('underscore'); api.use('session'); api.use('reload'); api.use(['blaze', 'templating', 'spacebars', 'ddp', 'tracker'], 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles('diff_match_patch_uncompressed.js', 'client'); api.addFiles([ 'driver.css', 'driver.html', 'driver.js' ], "client"); api.use('autoupdate', 'server', {weak: true}); api.use('random', 'server'); api.addFiles('autoupdate.js', 'server'); });
Test in browser doesn't need docs right now
Test in browser doesn't need docs right now Conflicts: packages/test-in-browser/package.js
JavaScript
mit
mauricionr/meteor,jenalgit/meteor,shmiko/meteor,vacjaliu/meteor,iman-mafi/meteor,papimomi/meteor,chasertech/meteor,jagi/meteor,vjau/meteor,framewr/meteor,vacjaliu/meteor,daltonrenaldo/meteor,chengxiaole/meteor,dev-bobsong/meteor,EduShareOntario/meteor,stevenliuit/meteor,allanalexandre/meteor,shrop/meteor,Prithvi-A/meteor,deanius/meteor,devgrok/meteor,AnjirHossain/meteor,zdd910/meteor,cbonami/meteor,cherbst/meteor,chasertech/meteor,TribeMedia/meteor,henrypan/meteor,daslicht/meteor,Jonekee/meteor,codingang/meteor,youprofit/meteor,lpinto93/meteor,lassombra/meteor,AnthonyAstige/meteor,4commerce-technologies-AG/meteor,karlito40/meteor,steedos/meteor,yanisIk/meteor,yanisIk/meteor,Eynaliyev/meteor,chmac/meteor,yinhe007/meteor,HugoRLopes/meteor,LWHTarena/meteor,mirstan/meteor,michielvanoeffelen/meteor,karlito40/meteor,brdtrpp/meteor,lorensr/meteor,lieuwex/meteor,aldeed/meteor,codedogfish/meteor,guazipi/meteor,EduShareOntario/meteor,Hansoft/meteor,daslicht/meteor,sdeveloper/meteor,chasertech/meteor,yiliaofan/meteor,GrimDerp/meteor,planet-training/meteor,meteor-velocity/meteor,namho102/meteor,qscripter/meteor,allanalexandre/meteor,codedogfish/meteor,ashwathgovind/meteor,iman-mafi/meteor,Prithvi-A/meteor,sitexa/meteor,Profab/meteor,newswim/meteor,williambr/meteor,fashionsun/meteor,Jonekee/meteor,l0rd0fwar/meteor,udhayam/meteor,neotim/meteor,Ken-Liu/meteor,juansgaitan/meteor,alexbeletsky/meteor,AnthonyAstige/meteor,arunoda/meteor,guazipi/meteor,shrop/meteor,emmerge/meteor,queso/meteor,tdamsma/meteor,evilemon/meteor,neotim/meteor,DAB0mB/meteor,pandeysoni/meteor,planet-training/meteor,kengchau/meteor,Jeremy017/meteor,benstoltz/meteor,eluck/meteor,jagi/meteor,nuvipannu/meteor,yalexx/meteor,fashionsun/meteor,rozzzly/meteor,jirengu/meteor,johnthepink/meteor,vacjaliu/meteor,elkingtonmcb/meteor,guazipi/meteor,baysao/meteor,yonas/meteor-freebsd,jg3526/meteor,skarekrow/meteor,Eynaliyev/meteor,rabbyalone/meteor,daslicht/meteor,brettle/meteor,katopz/meteor,justintung/meteor,kengchau/meteor,PatrickMcGuinness/meteor,TribeMedia/meteor,jirengu/meteor,jirengu/meteor,ndarilek/meteor,rabbyalone/meteor,lassombra/meteor,ljack/meteor,akintoey/meteor,yiliaofan/meteor,yonglehou/meteor,msavin/meteor,D1no/meteor,henrypan/meteor,chengxiaole/meteor,LWHTarena/meteor,wmkcc/meteor,henrypan/meteor,benstoltz/meteor,shmiko/meteor,eluck/meteor,cog-64/meteor,hristaki/meteor,kencheung/meteor,ashwathgovind/meteor,zdd910/meteor,shadedprofit/meteor,meteor-velocity/meteor,rozzzly/meteor,Eynaliyev/meteor,ljack/meteor,bhargav175/meteor,sclausen/meteor,iman-mafi/meteor,AlexR1712/meteor,imanmafi/meteor,jagi/meteor,lpinto93/meteor,chmac/meteor,lassombra/meteor,evilemon/meteor,mjmasn/meteor,bhargav175/meteor,ashwathgovind/meteor,benstoltz/meteor,h200863057/meteor,Paulyoufu/meteor-1,Hansoft/meteor,cherbst/meteor,yyx990803/meteor,Urigo/meteor,aldeed/meteor,Ken-Liu/meteor,sunny-g/meteor,karlito40/meteor,mjmasn/meteor,fashionsun/meteor,Ken-Liu/meteor,paul-barry-kenzan/meteor,guazipi/meteor,fashionsun/meteor,daltonrenaldo/meteor,jrudio/meteor,luohuazju/meteor,PatrickMcGuinness/meteor,4commerce-technologies-AG/meteor,pjump/meteor,EduShareOntario/meteor,modulexcite/meteor,esteedqueen/meteor,qscripter/meteor,Urigo/meteor,youprofit/meteor,qscripter/meteor,baiyunping333/meteor,HugoRLopes/meteor,Profab/meteor,saisai/meteor,sitexa/meteor,oceanzou123/meteor,newswim/meteor,cbonami/meteor,D1no/meteor,somallg/meteor,namho102/meteor,oceanzou123/meteor,newswim/meteor,brdtrpp/meteor,wmkcc/meteor,lassombra/meteor,alexbeletsky/meteor,ndarilek/meteor,yanisIk/meteor,meteor-velocity/meteor,JesseQin/meteor,brdtrpp/meteor,shmiko/meteor,brettle/meteor,meonkeys/meteor,framewr/meteor,somallg/meteor,DAB0mB/meteor,elkingtonmcb/meteor,queso/meteor,planet-training/meteor,somallg/meteor,AlexR1712/meteor,lieuwex/meteor,kengchau/meteor,Quicksteve/meteor,yyx990803/meteor,Eynaliyev/meteor,elkingtonmcb/meteor,udhayam/meteor,pjump/meteor,GrimDerp/meteor,youprofit/meteor,h200863057/meteor,planet-training/meteor,DCKT/meteor,papimomi/meteor,ericterpstra/meteor,alphanso/meteor,shrop/meteor,h200863057/meteor,mjmasn/meteor,DAB0mB/meteor,baiyunping333/meteor,TribeMedia/meteor,rabbyalone/meteor,jirengu/meteor,somallg/meteor,colinligertwood/meteor,aldeed/meteor,sdeveloper/meteor,ljack/meteor,joannekoong/meteor,hristaki/meteor,calvintychan/meteor,mauricionr/meteor,daltonrenaldo/meteor,lpinto93/meteor,TechplexEngineer/meteor,lpinto93/meteor,emmerge/meteor,cbonami/meteor,somallg/meteor,vacjaliu/meteor,dev-bobsong/meteor,sclausen/meteor,alexbeletsky/meteor,HugoRLopes/meteor,justintung/meteor,yinhe007/meteor,Theviajerock/meteor,daltonrenaldo/meteor,kidaa/meteor,HugoRLopes/meteor,joannekoong/meteor,vacjaliu/meteor,katopz/meteor,Ken-Liu/meteor,codingang/meteor,mubassirhayat/meteor,Theviajerock/meteor,benjamn/meteor,colinligertwood/meteor,aldeed/meteor,elkingtonmcb/meteor,calvintychan/meteor,Jeremy017/meteor,yalexx/meteor,steedos/meteor,hristaki/meteor,Theviajerock/meteor,jrudio/meteor,AnthonyAstige/meteor,rozzzly/meteor,tdamsma/meteor,Profab/meteor,Eynaliyev/meteor,meonkeys/meteor,hristaki/meteor,kencheung/meteor,Urigo/meteor,jrudio/meteor,codedogfish/meteor,daltonrenaldo/meteor,jdivy/meteor,PatrickMcGuinness/meteor,emmerge/meteor,DAB0mB/meteor,TechplexEngineer/meteor,Urigo/meteor,Urigo/meteor,vacjaliu/meteor,pandeysoni/meteor,shadedprofit/meteor,somallg/meteor,esteedqueen/meteor,lawrenceAIO/meteor,whip112/meteor,bhargav175/meteor,williambr/meteor,dfischer/meteor,dfischer/meteor,emmerge/meteor,deanius/meteor,jdivy/meteor,DCKT/meteor,HugoRLopes/meteor,vjau/meteor,ndarilek/meteor,akintoey/meteor,rabbyalone/meteor,Eynaliyev/meteor,Quicksteve/meteor,jeblister/meteor,johnthepink/meteor,zdd910/meteor,brettle/meteor,Jonekee/meteor,chmac/meteor,sitexa/meteor,modulexcite/meteor,SeanOceanHu/meteor,chiefninew/meteor,pjump/meteor,guazipi/meteor,yonglehou/meteor,codedogfish/meteor,brettle/meteor,msavin/meteor,yalexx/meteor,michielvanoeffelen/meteor,Hansoft/meteor,alexbeletsky/meteor,l0rd0fwar/meteor,kengchau/meteor,paul-barry-kenzan/meteor,papimomi/meteor,chengxiaole/meteor,ndarilek/meteor,shadedprofit/meteor,saisai/meteor,lawrenceAIO/meteor,allanalexandre/meteor,sunny-g/meteor,SeanOceanHu/meteor,joannekoong/meteor,dandv/meteor,shmiko/meteor,vjau/meteor,vjau/meteor,aldeed/meteor,Theviajerock/meteor,codingang/meteor,cog-64/meteor,msavin/meteor,ericterpstra/meteor,saisai/meteor,wmkcc/meteor,colinligertwood/meteor,jg3526/meteor,imanmafi/meteor,lorensr/meteor,fashionsun/meteor,judsonbsilva/meteor,whip112/meteor,mubassirhayat/meteor,ericterpstra/meteor,SeanOceanHu/meteor,JesseQin/meteor,dfischer/meteor,michielvanoeffelen/meteor,servel333/meteor,Prithvi-A/meteor,AnthonyAstige/meteor,judsonbsilva/meteor,imanmafi/meteor,framewr/meteor,alphanso/meteor,katopz/meteor,ndarilek/meteor,bhargav175/meteor,esteedqueen/meteor,mubassirhayat/meteor,lorensr/meteor,DAB0mB/meteor,stevenliuit/meteor,queso/meteor,juansgaitan/meteor,arunoda/meteor,youprofit/meteor,udhayam/meteor,whip112/meteor,nuvipannu/meteor,rabbyalone/meteor,Jonekee/meteor,Paulyoufu/meteor-1,Prithvi-A/meteor,planet-training/meteor,rozzzly/meteor,kidaa/meteor,brettle/meteor,yinhe007/meteor,jagi/meteor,rozzzly/meteor,dboyliao/meteor,mirstan/meteor,sitexa/meteor,kidaa/meteor,ericterpstra/meteor,deanius/meteor,chinasb/meteor,benjamn/meteor,judsonbsilva/meteor,oceanzou123/meteor,aldeed/meteor,neotim/meteor,williambr/meteor,meteor-velocity/meteor,papimomi/meteor,deanius/meteor,chiefninew/meteor,aleclarson/meteor,dboyliao/meteor,framewr/meteor,lorensr/meteor,kencheung/meteor,chmac/meteor,yalexx/meteor,tdamsma/meteor,SeanOceanHu/meteor,aramk/meteor,yyx990803/meteor,namho102/meteor,yyx990803/meteor,mirstan/meteor,kidaa/meteor,framewr/meteor,msavin/meteor,katopz/meteor,DAB0mB/meteor,chasertech/meteor,dboyliao/meteor,johnthepink/meteor,JesseQin/meteor,colinligertwood/meteor,vjau/meteor,LWHTarena/meteor,chinasb/meteor,jagi/meteor,meonkeys/meteor,shadedprofit/meteor,lieuwex/meteor,AnjirHossain/meteor,sunny-g/meteor,skarekrow/meteor,mirstan/meteor,mauricionr/meteor,chiefninew/meteor,ashwathgovind/meteor,namho102/meteor,elkingtonmcb/meteor,shrop/meteor,l0rd0fwar/meteor,cherbst/meteor,AnthonyAstige/meteor,colinligertwood/meteor,whip112/meteor,IveWong/meteor,hristaki/meteor,allanalexandre/meteor,lieuwex/meteor,chiefninew/meteor,allanalexandre/meteor,ljack/meteor,sclausen/meteor,Theviajerock/meteor,chasertech/meteor,sdeveloper/meteor,jg3526/meteor,akintoey/meteor,meonkeys/meteor,chiefninew/meteor,TechplexEngineer/meteor,ljack/meteor,luohuazju/meteor,Hansoft/meteor,IveWong/meteor,lieuwex/meteor,fashionsun/meteor,brdtrpp/meteor,juansgaitan/meteor,qscripter/meteor,yonas/meteor-freebsd,Ken-Liu/meteor,saisai/meteor,allanalexandre/meteor,yiliaofan/meteor,yonas/meteor-freebsd,rabbyalone/meteor,aramk/meteor,GrimDerp/meteor,calvintychan/meteor,michielvanoeffelen/meteor,jdivy/meteor,aleclarson/meteor,AnthonyAstige/meteor,kencheung/meteor,dev-bobsong/meteor,Urigo/meteor,cog-64/meteor,baiyunping333/meteor,paul-barry-kenzan/meteor,williambr/meteor,pandeysoni/meteor,fashionsun/meteor,Quicksteve/meteor,lpinto93/meteor,oceanzou123/meteor,baiyunping333/meteor,nuvipannu/meteor,pandeysoni/meteor,yiliaofan/meteor,nuvipannu/meteor,baysao/meteor,yonglehou/meteor,jeblister/meteor,hristaki/meteor,iman-mafi/meteor,4commerce-technologies-AG/meteor,AlexR1712/meteor,Eynaliyev/meteor,chengxiaole/meteor,alphanso/meteor,benjamn/meteor,justintung/meteor,jirengu/meteor,chasertech/meteor,Puena/meteor,justintung/meteor,johnthepink/meteor,Ken-Liu/meteor,h200863057/meteor,steedos/meteor,lassombra/meteor,jenalgit/meteor,codedogfish/meteor,chmac/meteor,wmkcc/meteor,skarekrow/meteor,AnthonyAstige/meteor,mjmasn/meteor,dfischer/meteor,joannekoong/meteor,yonas/meteor-freebsd,allanalexandre/meteor,johnthepink/meteor,devgrok/meteor,cherbst/meteor,servel333/meteor,tdamsma/meteor,steedos/meteor,JesseQin/meteor,brdtrpp/meteor,jeblister/meteor,udhayam/meteor,Puena/meteor,kidaa/meteor,SeanOceanHu/meteor,dandv/meteor,devgrok/meteor,steedos/meteor,Prithvi-A/meteor,yanisIk/meteor,eluck/meteor,karlito40/meteor,codingang/meteor,codingang/meteor,baysao/meteor,steedos/meteor,chengxiaole/meteor,evilemon/meteor,ericterpstra/meteor,msavin/meteor,EduShareOntario/meteor,cbonami/meteor,tdamsma/meteor,AnjirHossain/meteor,Jeremy017/meteor,arunoda/meteor,evilemon/meteor,newswim/meteor,mirstan/meteor,evilemon/meteor,mjmasn/meteor,codedogfish/meteor,Jeremy017/meteor,dandv/meteor,queso/meteor,Theviajerock/meteor,lpinto93/meteor,namho102/meteor,codedogfish/meteor,HugoRLopes/meteor,jg3526/meteor,lawrenceAIO/meteor,JesseQin/meteor,brdtrpp/meteor,D1no/meteor,jenalgit/meteor,cog-64/meteor,meteor-velocity/meteor,queso/meteor,colinligertwood/meteor,paul-barry-kenzan/meteor,shadedprofit/meteor,yiliaofan/meteor,Puena/meteor,cbonami/meteor,EduShareOntario/meteor,yinhe007/meteor,qscripter/meteor,yanisIk/meteor,meonkeys/meteor,alexbeletsky/meteor,queso/meteor,jdivy/meteor,calvintychan/meteor,luohuazju/meteor,Hansoft/meteor,somallg/meteor,sdeveloper/meteor,youprofit/meteor,benjamn/meteor,Paulyoufu/meteor-1,vacjaliu/meteor,dboyliao/meteor,joannekoong/meteor,daltonrenaldo/meteor,aleclarson/meteor,Jonekee/meteor,jdivy/meteor,esteedqueen/meteor,framewr/meteor,elkingtonmcb/meteor,modulexcite/meteor,TechplexEngineer/meteor,LWHTarena/meteor,devgrok/meteor,deanius/meteor,calvintychan/meteor,daslicht/meteor,kencheung/meteor,jenalgit/meteor,baysao/meteor,kengchau/meteor,iman-mafi/meteor,nuvipannu/meteor,udhayam/meteor,jrudio/meteor,sitexa/meteor,evilemon/meteor,akintoey/meteor,skarekrow/meteor,daslicht/meteor,guazipi/meteor,katopz/meteor,lawrenceAIO/meteor,Ken-Liu/meteor,pjump/meteor,jirengu/meteor,sunny-g/meteor,TechplexEngineer/meteor,PatrickMcGuinness/meteor,saisai/meteor,kencheung/meteor,eluck/meteor,neotim/meteor,arunoda/meteor,oceanzou123/meteor,PatrickMcGuinness/meteor,alphanso/meteor,zdd910/meteor,emmerge/meteor,allanalexandre/meteor,Quicksteve/meteor,baysao/meteor,IveWong/meteor,pandeysoni/meteor,h200863057/meteor,AnjirHossain/meteor,dboyliao/meteor,eluck/meteor,DCKT/meteor,arunoda/meteor,DAB0mB/meteor,msavin/meteor,Puena/meteor,dev-bobsong/meteor,cog-64/meteor,karlito40/meteor,steedos/meteor,yalexx/meteor,johnthepink/meteor,sdeveloper/meteor,shmiko/meteor,luohuazju/meteor,whip112/meteor,4commerce-technologies-AG/meteor,sdeveloper/meteor,luohuazju/meteor,justintung/meteor,ericterpstra/meteor,newswim/meteor,jenalgit/meteor,GrimDerp/meteor,shmiko/meteor,daslicht/meteor,namho102/meteor,Puena/meteor,HugoRLopes/meteor,youprofit/meteor,AlexR1712/meteor,Profab/meteor,baysao/meteor,planet-training/meteor,LWHTarena/meteor,alphanso/meteor,D1no/meteor,paul-barry-kenzan/meteor,katopz/meteor,lieuwex/meteor,benjamn/meteor,DCKT/meteor,D1no/meteor,kengchau/meteor,saisai/meteor,dandv/meteor,imanmafi/meteor,baiyunping333/meteor,yanisIk/meteor,lassombra/meteor,udhayam/meteor,devgrok/meteor,ericterpstra/meteor,dboyliao/meteor,rozzzly/meteor,GrimDerp/meteor,luohuazju/meteor,skarekrow/meteor,imanmafi/meteor,GrimDerp/meteor,kencheung/meteor,lieuwex/meteor,SeanOceanHu/meteor,emmerge/meteor,dboyliao/meteor,sclausen/meteor,henrypan/meteor,jg3526/meteor,mubassirhayat/meteor,DCKT/meteor,imanmafi/meteor,sunny-g/meteor,saisai/meteor,TechplexEngineer/meteor,lpinto93/meteor,servel333/meteor,williambr/meteor,PatrickMcGuinness/meteor,shadedprofit/meteor,Quicksteve/meteor,D1no/meteor,ashwathgovind/meteor,pjump/meteor,jrudio/meteor,johnthepink/meteor,yinhe007/meteor,AlexR1712/meteor,jagi/meteor,williambr/meteor,ashwathgovind/meteor,esteedqueen/meteor,oceanzou123/meteor,joannekoong/meteor,namho102/meteor,chmac/meteor,cherbst/meteor,codingang/meteor,servel333/meteor,papimomi/meteor,aramk/meteor,alphanso/meteor,jg3526/meteor,sunny-g/meteor,JesseQin/meteor,yyx990803/meteor,jrudio/meteor,EduShareOntario/meteor,SeanOceanHu/meteor,judsonbsilva/meteor,rabbyalone/meteor,bhargav175/meteor,yalexx/meteor,stevenliuit/meteor,cherbst/meteor,chengxiaole/meteor,Eynaliyev/meteor,judsonbsilva/meteor,sclausen/meteor,chengxiaole/meteor,Jonekee/meteor,mubassirhayat/meteor,whip112/meteor,wmkcc/meteor,akintoey/meteor,shrop/meteor,tdamsma/meteor,ndarilek/meteor,yonglehou/meteor,nuvipannu/meteor,kidaa/meteor,sunny-g/meteor,sunny-g/meteor,chmac/meteor,meteor-velocity/meteor,neotim/meteor,benstoltz/meteor,stevenliuit/meteor,jirengu/meteor,Jeremy017/meteor,4commerce-technologies-AG/meteor,lorensr/meteor,juansgaitan/meteor,akintoey/meteor,karlito40/meteor,msavin/meteor,youprofit/meteor,udhayam/meteor,yinhe007/meteor,l0rd0fwar/meteor,dev-bobsong/meteor,papimomi/meteor,henrypan/meteor,qscripter/meteor,codingang/meteor,eluck/meteor,vjau/meteor,sclausen/meteor,rozzzly/meteor,yonglehou/meteor,lawrenceAIO/meteor,yonas/meteor-freebsd,benstoltz/meteor,jenalgit/meteor,dev-bobsong/meteor,mauricionr/meteor,michielvanoeffelen/meteor,arunoda/meteor,bhargav175/meteor,yiliaofan/meteor,modulexcite/meteor,oceanzou123/meteor,DCKT/meteor,mauricionr/meteor,Prithvi-A/meteor,wmkcc/meteor,IveWong/meteor,cbonami/meteor,justintung/meteor,henrypan/meteor,stevenliuit/meteor,Hansoft/meteor,juansgaitan/meteor,TribeMedia/meteor,lawrenceAIO/meteor,ashwathgovind/meteor,AnjirHossain/meteor,neotim/meteor,ljack/meteor,pjump/meteor,jeblister/meteor,TechplexEngineer/meteor,kidaa/meteor,yonglehou/meteor,dandv/meteor,sitexa/meteor,sitexa/meteor,karlito40/meteor,4commerce-technologies-AG/meteor,servel333/meteor,yonas/meteor-freebsd,mauricionr/meteor,bhargav175/meteor,chinasb/meteor,judsonbsilva/meteor,neotim/meteor,chinasb/meteor,pandeysoni/meteor,brettle/meteor,yonglehou/meteor,shadedprofit/meteor,l0rd0fwar/meteor,akintoey/meteor,ndarilek/meteor,luohuazju/meteor,Theviajerock/meteor,dev-bobsong/meteor,Urigo/meteor,juansgaitan/meteor,mirstan/meteor,vjau/meteor,dfischer/meteor,paul-barry-kenzan/meteor,LWHTarena/meteor,benstoltz/meteor,Hansoft/meteor,servel333/meteor,benjamn/meteor,cherbst/meteor,alexbeletsky/meteor,GrimDerp/meteor,AnjirHossain/meteor,brdtrpp/meteor,baiyunping333/meteor,elkingtonmcb/meteor,jeblister/meteor,jg3526/meteor,lorensr/meteor,yiliaofan/meteor,chiefninew/meteor,shrop/meteor,EduShareOntario/meteor,Paulyoufu/meteor-1,modulexcite/meteor,TribeMedia/meteor,chinasb/meteor,chinasb/meteor,mubassirhayat/meteor,planet-training/meteor,sclausen/meteor,ljack/meteor,lassombra/meteor,michielvanoeffelen/meteor,l0rd0fwar/meteor,Paulyoufu/meteor-1,deanius/meteor,jagi/meteor,henrypan/meteor,Paulyoufu/meteor-1,jdivy/meteor,esteedqueen/meteor,AlexR1712/meteor,meonkeys/meteor,kengchau/meteor,Jeremy017/meteor,DCKT/meteor,aramk/meteor,Jeremy017/meteor,aramk/meteor,skarekrow/meteor,qscripter/meteor,zdd910/meteor,aldeed/meteor,Profab/meteor,brdtrpp/meteor,brettle/meteor,calvintychan/meteor,dandv/meteor,colinligertwood/meteor,planet-training/meteor,whip112/meteor,yanisIk/meteor,jdivy/meteor,jenalgit/meteor,framewr/meteor,pjump/meteor,AnthonyAstige/meteor,TribeMedia/meteor,zdd910/meteor,iman-mafi/meteor,LWHTarena/meteor,servel333/meteor,Quicksteve/meteor,SeanOceanHu/meteor,cog-64/meteor,emmerge/meteor,mirstan/meteor,shmiko/meteor,mauricionr/meteor,yyx990803/meteor,HugoRLopes/meteor,zdd910/meteor,judsonbsilva/meteor,evilemon/meteor,arunoda/meteor,modulexcite/meteor,somallg/meteor,daltonrenaldo/meteor,meteor-velocity/meteor,stevenliuit/meteor,baysao/meteor,queso/meteor,paul-barry-kenzan/meteor,yanisIk/meteor,esteedqueen/meteor,servel333/meteor,Puena/meteor,devgrok/meteor,Quicksteve/meteor,skarekrow/meteor,pandeysoni/meteor,michielvanoeffelen/meteor,yinhe007/meteor,IveWong/meteor,stevenliuit/meteor,D1no/meteor,alexbeletsky/meteor,hristaki/meteor,aramk/meteor,l0rd0fwar/meteor,dfischer/meteor,TribeMedia/meteor,ljack/meteor,mubassirhayat/meteor,Jonekee/meteor,tdamsma/meteor,chiefninew/meteor,AnjirHossain/meteor,Puena/meteor,Prithvi-A/meteor,AlexR1712/meteor,Profab/meteor,williambr/meteor,imanmafi/meteor,IveWong/meteor,Paulyoufu/meteor-1,mubassirhayat/meteor,cog-64/meteor,alphanso/meteor,chiefninew/meteor,chasertech/meteor,meonkeys/meteor,IveWong/meteor,karlito40/meteor,deanius/meteor,Profab/meteor,devgrok/meteor,dboyliao/meteor,joannekoong/meteor,shrop/meteor,PatrickMcGuinness/meteor,justintung/meteor,tdamsma/meteor,papimomi/meteor,nuvipannu/meteor,yalexx/meteor,wmkcc/meteor,yonas/meteor-freebsd,guazipi/meteor,newswim/meteor,mjmasn/meteor,benjamn/meteor,h200863057/meteor,modulexcite/meteor,dandv/meteor,daslicht/meteor,ndarilek/meteor,katopz/meteor,jeblister/meteor,calvintychan/meteor,chinasb/meteor,lawrenceAIO/meteor,4commerce-technologies-AG/meteor,jeblister/meteor,lorensr/meteor,iman-mafi/meteor,baiyunping333/meteor,eluck/meteor,yyx990803/meteor,alexbeletsky/meteor,D1no/meteor,JesseQin/meteor,juansgaitan/meteor,daltonrenaldo/meteor,newswim/meteor,mjmasn/meteor,benstoltz/meteor,eluck/meteor,sdeveloper/meteor,aramk/meteor,dfischer/meteor,h200863057/meteor,cbonami/meteor
--- +++ @@ -1,6 +1,7 @@ Package.describe({ summary: "Run tests interactively in the browser", - version: '1.0.6' + version: '1.0.6', + documentation: null }); Package.onUse(function (api) {
47e48049229d5393c024c0b742bd8511693d5e09
static/js/share-buttons.js
static/js/share-buttons.js
// https://github.com/kni-labs/rrssb var popupCenter = function(url, title, w, h) { // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = width / 2 - w / 2 + dualScreenLeft; var top = height / 3 - h / 3 + dualScreenTop; var newWindow = window.open( url, title, "scrollbars=yes, width=" + w + ", height=" + h + ", top=" + top + ", left=" + left ); // Puts focus on the newWindow if (newWindow && newWindow.focus) { newWindow.focus(); } }; document.querySelectorAll(".popup").forEach(function(el) { el.addEventListener("click", function(e) { popupCenter(el.getAttribute("href"), "TODO", 580, 470); e.preventDefault(); }); });
// https://github.com/kni-labs/rrssb var popupCenter = function(url) { var w = 580; var h = 470; // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = width / 2 - w / 2 + dualScreenLeft; var top = height / 3 - h / 3 + dualScreenTop; var newWindow = window.open( url, "share-popup", "scrollbars=yes, width=" + w + ", height=" + h + ", top=" + top + ", left=" + left ); // Puts focus on the newWindow if (newWindow && newWindow.focus) { newWindow.focus(); } }; document.querySelectorAll(".popup").forEach(function(el) { el.addEventListener("click", function(e) { popupCenter(el.getAttribute("href")); e.preventDefault(); }); });
Remove title w and h params in popupCenter
Remove title w and h params in popupCenter
JavaScript
mit
DeveloperDavo/learnitmyway,DeveloperDavo/learnitmyway
--- +++ @@ -1,5 +1,7 @@ // https://github.com/kni-labs/rrssb -var popupCenter = function(url, title, w, h) { +var popupCenter = function(url) { + var w = 580; + var h = 470; // Fixes dual-screen position Most browsers Firefox var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; @@ -22,7 +24,7 @@ var newWindow = window.open( url, - title, + "share-popup", "scrollbars=yes, width=" + w + ", height=" + @@ -42,7 +44,7 @@ document.querySelectorAll(".popup").forEach(function(el) { el.addEventListener("click", function(e) { - popupCenter(el.getAttribute("href"), "TODO", 580, 470); + popupCenter(el.getAttribute("href")); e.preventDefault(); }); });
875e1aa44952cd946e739b9ffa52cae074ded129
documentation/more/classes.js
documentation/more/classes.js
noUiSlider.create(slider, { start: 80, range: { min: 0, max: 100 }, cssPrefix: 'noUi-', // defaults to 'noUi-', cssClasses: { // Full list of classnames to override. // Does NOT extend the default classes. // Have a look at the source for the full, current list: // https://github.com/leongersen/noUiSlider/blob/master/src/js/options.js#L398 } });
noUiSlider.create(slider, { start: 80, range: { min: 0, max: 100 }, cssPrefix: 'noUi-', // defaults to 'noUi-', cssClasses: { // Full list of classnames to override. // Does NOT extend the default classes. // Have a look at the source for the full, current list: // https://github.com/leongersen/noUiSlider/blob/master/src/nouislider.js#L880 } });
Remove dead link to full list of class names
Remove dead link to full list of class names
JavaScript
mit
leongersen/noUiSlider,leongersen/noUiSlider,leongersen/noUiSlider,leongersen/noUiSlider
--- +++ @@ -9,6 +9,6 @@ // Full list of classnames to override. // Does NOT extend the default classes. // Have a look at the source for the full, current list: - // https://github.com/leongersen/noUiSlider/blob/master/src/js/options.js#L398 + // https://github.com/leongersen/noUiSlider/blob/master/src/nouislider.js#L880 } });
2e66a868619fd017b1e409da3b60c750ac7e4960
providers/oauth/oauth.identity.js
providers/oauth/oauth.identity.js
/*globals chrome,console */ /*jslint indent:2,browser:true, node:true */ var PromiseCompat = require('es6-promise').Promise; var oAuthRedirectId = "freedom.oauth.redirect.handler"; var ChromeIdentityAuth = function() { "use strict"; }; ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuation) { "use strict"; var i; if (typeof chrome !== 'undefined' && typeof chrome.permissions !== 'undefined' && //cca doesn't support chrome.permissions yet typeof chrome.identity !== 'undefined') { for (i = 0; i < redirectURIs.length; i += 1) { if (redirectURIs[i].indexOf('https://') === 0 && redirectURIs[i].indexOf('.chromiumapp.org') > 0) { continuation({ redirect: redirectURIs[i], state: oAuthRedirectId + Math.random() }); return true; } } } return false; }; ChromeIdentityAuth.prototype.launchAuthFlow = function(authUrl, stateObj, continuation) { chrome.identity.launchWebAuthFlow({ url: authUrl, interactive: true }, function(stateObj, continuation, responseUrl) { continuation(responseUrl); }.bind({}, stateObj, continuation)); }; /** * If we have access to chrome.identity, use the built-in support for oAuth flows * chrome.identity exposes a very similar interface to core.oauth. */ module.exports = ChromeIdentityAuth;
/*globals chrome,console */ /*jslint indent:2,browser:true, node:true */ var PromiseCompat = require('es6-promise').Promise; var oAuthRedirectId = "freedom.oauth.redirect.handler"; var ChromeIdentityAuth = function() { "use strict"; }; ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuation) { "use strict"; var i; if (typeof chrome !== 'undefined' && typeof chrome.identity !== 'undefined') { for (i = 0; i < redirectURIs.length; i += 1) { if (redirectURIs[i].indexOf('https://') === 0 && redirectURIs[i].indexOf('.chromiumapp.org') > 0) { continuation({ redirect: redirectURIs[i], state: oAuthRedirectId + Math.random() }); return true; } } } return false; }; ChromeIdentityAuth.prototype.launchAuthFlow = function(authUrl, stateObj, continuation) { chrome.identity.launchWebAuthFlow({ url: authUrl, interactive: true }, function(stateObj, continuation, responseUrl) { continuation(responseUrl); }.bind({}, stateObj, continuation)); }; /** * If we have access to chrome.identity, use the built-in support for oAuth flows * chrome.identity exposes a very similar interface to core.oauth. */ module.exports = ChromeIdentityAuth;
Remove superfluous check in core.oauth
Remove superfluous check in core.oauth
JavaScript
apache-2.0
freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome,freedomjs/freedom-for-chrome
--- +++ @@ -12,7 +12,6 @@ "use strict"; var i; if (typeof chrome !== 'undefined' && - typeof chrome.permissions !== 'undefined' && //cca doesn't support chrome.permissions yet typeof chrome.identity !== 'undefined') { for (i = 0; i < redirectURIs.length; i += 1) { if (redirectURIs[i].indexOf('https://') === 0 &&
1b273af40df9a093271b2d21cebcc545f2f55dce
string/palindrome-check.js
string/palindrome-check.js
// Program to determine if string is a palindrome function checkPalindrome(str) { // identify non-alphanumeric characters through regular expression var regEx = /[^A-Za-z0-9]/g; // lower case all characters in string and remove all non-alphanumeric characters var lowCaseReg = str.toLowerCase().replace(regEx, ''); // check for palindrome with loop for (var i = 0; i < (str.length)/2; i++) { if (str[i] !== str[(str.length) - 1 - i]) { // loop will go on as long as characters match return false; } } return true; // string is palindrome }
// Program to determine if string is a palindrome function checkPalindrome(str) { // identify non-alphanumeric characters through regular expression var regEx = /[^A-Za-z0-9]/g; // lower case all characters in string and remove all non-alphanumeric characters var lowCaseReg = str.toLowerCase().replace(regEx, ''); // check for palindrome with loop for (var i = 0; i < (lowCaseReg.length)/2; i++) { if (lowCaseReg[i] !== lowCaseReg[(lowCaseReg.length) - 1 - i]) { // loop will go on as long as characters match return false; } } return true; // string is palindrome } // test cases checkPalindrome("racecar"); // expect true checkPalindrome("race car"); // expect true checkPalindrome("nope"); // expect false checkPalindrome("not palindrome"); // expect false checkPalindrome("A man, a plan, a canal. Panama"); // expect true checkPalindrome("0_0 (: /-\ :) 0_0"); // expect true
Add test cases to check for palindrome in string function
Add test cases to check for palindrome in string function
JavaScript
mit
derekmpham/interview-prep,derekmpham/interview-prep
--- +++ @@ -9,10 +9,18 @@ var lowCaseReg = str.toLowerCase().replace(regEx, ''); // check for palindrome with loop - for (var i = 0; i < (str.length)/2; i++) { - if (str[i] !== str[(str.length) - 1 - i]) { // loop will go on as long as characters match + for (var i = 0; i < (lowCaseReg.length)/2; i++) { + if (lowCaseReg[i] !== lowCaseReg[(lowCaseReg.length) - 1 - i]) { // loop will go on as long as characters match return false; } } return true; // string is palindrome } + +// test cases +checkPalindrome("racecar"); // expect true +checkPalindrome("race car"); // expect true +checkPalindrome("nope"); // expect false +checkPalindrome("not palindrome"); // expect false +checkPalindrome("A man, a plan, a canal. Panama"); // expect true +checkPalindrome("0_0 (: /-\ :) 0_0"); // expect true
e91dc89930431c8c79a02d3adb1a136ea55b4665
client/app/services/services.js
client/app/services/services.js
angular.module('cat-buddy.services', []) .factory('Animals', function($http) { var getAllFromInternetByZipCode = function(animalName, zipCode, offset) { offset = offset || 0; return $http({ method: 'GET', url: 'http://api.petfinder.com/pet.find', data: { key: PETFINDER_API_KEY, //to fix animal: animalName, count: 20, offset: offset, location: zipCode, format: 'json' } }) .then(function(resp){ return resp.petfinder.pets; }); }; var getAllFromSaved = function() { return $http({ method: 'GET', url: '/api/' + animalName }); }; var addOneToSaved = function(animal) { return $http({ method: 'POST', url: '/api/' + animalName, data: animal }); }; return { getAllFromInternetByZipCode: getAllFromInternetByZipCode, getAllFromSaved: getAllFromSaved, addOneToSaved: addOneToSaved }; });
angular.module('cat-buddy.services', []) .factory('Animals', function($http) { var getAllFromInternetByZipCode = function(animalName, zipCode, count, offset) { offset = offset || 0; return $http({ method: 'GET', url: 'http://api.petfinder.com/pet.find', data: { key: PETFINDER_API_KEY, animal: animalName, count: count, offset: offset, location: zipCode, format: 'json' } }) .then(function(resp){ return resp.petfinder.pets; }); }; var getAllFromSaved = function() { return $http({ method: 'GET', url: '/api/' + animalName }); }; var addOneToSaved = function(animal) { return $http({ method: 'POST', url: '/api/' + animalName, data: animal }); }; return { getAllFromInternetByZipCode: getAllFromInternetByZipCode, getAllFromSaved: getAllFromSaved, addOneToSaved: addOneToSaved }; });
Remove magic number for "count" in get requests
Remove magic number for "count" in get requests
JavaScript
mit
reinaisnothere/mvp,reinaisnothere/mvp
--- +++ @@ -1,14 +1,14 @@ angular.module('cat-buddy.services', []) .factory('Animals', function($http) { - var getAllFromInternetByZipCode = function(animalName, zipCode, offset) { + var getAllFromInternetByZipCode = function(animalName, zipCode, count, offset) { offset = offset || 0; return $http({ method: 'GET', url: 'http://api.petfinder.com/pet.find', data: { - key: PETFINDER_API_KEY, //to fix + key: PETFINDER_API_KEY, animal: animalName, - count: 20, + count: count, offset: offset, location: zipCode, format: 'json'
c53adcb912b3a370556f6e078968d954d46b1f7f
modules/orders/client/controllers/recipt.client.controller.js
modules/orders/client/controllers/recipt.client.controller.js
(function() { 'use strict'; angular .module('orders') .controller('ReciptController', ReciptController); ReciptController.$inject = ['$scope', 'OrdersService', '$stateParams', '$location']; function ReciptController($scope, OrdersService, $stateParams, $location) { var vm = this; vm.order = {}; // Recipt controller logic // ... $scope.date = new Date(); $scope.recipt = function(){ console.log($stateParams.orderId); var getorder = OrdersService.get({ orderId: $stateParams.orderId }, function() { vm.order = getorder; console.log(getorder); }); }; $scope.print = function(){ /*window.print();*/ var bdhtml=window.document.body.innerHTML; var sprnstr="<!--startprint-->"; var eprnstr="<!--endprint-->"; var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); console.log(prnhtml); window.document.body.innerHTML=prnhtml; window.print(); }; $scope.close = function(){ // $state.go('home',{}); $location.path('/'); }; } })();
(function() { 'use strict'; angular .module('orders') .controller('ReciptController', ReciptController); ReciptController.$inject = ['$timeout', '$state', '$scope', 'OrdersService', '$stateParams', '$location']; function ReciptController($timeout, $state,$scope, OrdersService, $stateParams, $location) { var vm = this; vm.order = {}; // Recipt controller logic // ... $scope.date = new Date(); $scope.recipt = function(){ console.log($stateParams.orderId); var getorder = OrdersService.get({ orderId: $stateParams.orderId }, function() { vm.order = getorder; console.log(getorder); }); }; $scope.print = function(){ /*window.print();*/ var bdhtml=window.document.body.innerHTML; var sprnstr="<!--startprint-->"; var eprnstr="<!--endprint-->"; var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); window.document.body.innerHTML=prnhtml; window.print(); // window.close(); // $timeout(function () { window.close(); }, 40); // $state.go('recipt',{ orderId: $stateParams.orderId }); }; /* $scope.onPrintFinished = function(print){ window.close(); };*/ $scope.close = function(){ // $state.go('home',{}); $location.path('/'); }; } })();
Add method to go back after print in the recipt page
Add method to go back after print in the recipt page
JavaScript
mit
JavaScriptAcademy/oneStep,JavaScriptAcademy/oneStep,JavaScriptAcademy/oneStep
--- +++ @@ -5,9 +5,9 @@ .module('orders') .controller('ReciptController', ReciptController); - ReciptController.$inject = ['$scope', 'OrdersService', '$stateParams', '$location']; + ReciptController.$inject = ['$timeout', '$state', '$scope', 'OrdersService', '$stateParams', '$location']; - function ReciptController($scope, OrdersService, $stateParams, $location) { + function ReciptController($timeout, $state,$scope, OrdersService, $stateParams, $location) { var vm = this; vm.order = {}; @@ -29,10 +29,16 @@ var eprnstr="<!--endprint-->"; var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); - console.log(prnhtml); window.document.body.innerHTML=prnhtml; window.print(); + // window.close(); + // $timeout(function () { window.close(); }, 40); + // $state.go('recipt',{ orderId: $stateParams.orderId }); }; +/* + $scope.onPrintFinished = function(print){ + window.close(); + };*/ $scope.close = function(){ // $state.go('home',{});
c9a809bbc3edc47377a42b10efdfbf32158268dd
gulp/download-locales.js
gulp/download-locales.js
var downloadLocales = require('webmaker-download-locales'); var glob = require('glob'); var fs = require('fs-extra'); // Which languages should we pull down? // Don't include en-US because that's committed into git already var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN']; module.exports = function (callback) { glob('!./locale/!(en_US)/**.json', function (err, files) { files.forEach(function (file) { fs.removeSync(file); }); downloadLocales({ app: 'webmaker-app', dir: 'locale', languages: supportedLanguages }, callback); }); };
var downloadLocales = require('webmaker-download-locales'); var glob = require('glob'); var fs = require('fs-extra'); // Which languages should we pull down? // Don't include en-US because that's committed into git already var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN', 'es', 'el', 'pt', 'es_AR', 'zh_TW', 'pt_BR', 'zh_CN', 'tr_TR', 'da_DK', 'fi', 'ru', 'sq', 'es_MX']; module.exports = function (callback) { glob('!./locale/!(en_US)/**.json', function (err, files) { files.forEach(function (file) { fs.removeSync(file); }); downloadLocales({ app: 'webmaker-app', dir: 'locale', languages: supportedLanguages }, callback); }); };
Enable other locales that fully translated on Transifex
Enable other locales that fully translated on Transifex
JavaScript
mpl-2.0
k88hudson/webmaker-android,gvn/webmaker-android,mozilla/webmaker-android,secretrobotron/webmaker-android,adamlofting/webmaker-android,j796160836/webmaker-android,alicoding/webmaker-android,secretrobotron/webmaker-android,vazquez/webmaker-android,alanmoo/webmaker-android,bolaram/webmaker-android,bolaram/webmaker-android,j796160836/webmaker-android,gvn/webmaker-android,vazquez/webmaker-android,alanmoo/webmaker-android,mozilla/webmaker-android,rodmoreno/webmaker-android,alicoding/webmaker-android,rodmoreno/webmaker-android,k88hudson/webmaker-android
--- +++ @@ -4,7 +4,8 @@ // Which languages should we pull down? // Don't include en-US because that's committed into git already -var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN']; +var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD', 'sw', 'hi_IN', + 'es', 'el', 'pt', 'es_AR', 'zh_TW', 'pt_BR', 'zh_CN', 'tr_TR', 'da_DK', 'fi', 'ru', 'sq', 'es_MX']; module.exports = function (callback) {
21fe3174410756b25281bed5a446516f2c053016
node_modules/hotCoreErrorProtocol/lib/hotCoreErrorProtocol.js
node_modules/hotCoreErrorProtocol/lib/hotCoreErrorProtocol.js
"use strict"; var dummy , hotplate = require('hotplate') , path = require('path') ; // exports.sendResponse = function(method, res, obj){ exports.sendResponse = function(res, obj, status){ var status; var isOK; status = status || 200; isOK = (status >= 200 && status < 300) || // allow any 2XX error code status === 304; // or, get it out of the cache if( isOK ){ res.json( status, obj ); } else { obj = typeof(obj) == 'object' ? obj : { }; var error = {}; // Assign "legal" keys if( obj.message ) error.message = obj.message; if( obj.errors ) error.errors = obj.errors; if( obj.data ) error.data = obj.data; if( obj.emit ) error.emit = obj.emit; res.json(status, error); } } hotplate.hotEvents.on( 'pageElements', 'hotCoreErrorProtocol', function( done ){ done( null, { jses: [ 'hotFixErrorResponse.js'] }); }); hotplate.hotEvents.on( 'clientPath', 'hotCoreErrorProtocol', function( done ){ done( null, path.join(__dirname, '../client') ); })
"use strict"; var dummy , hotplate = require('hotplate') , path = require('path') ; // exports.sendResponse = function(method, res, obj){ exports.sendResponse = function(res, obj, status){ var status; var isOK; status = status || 200; isOK = (status >= 200 && status < 300) || // allow any 2XX error code status === 304; // or, get it out of the cache if( isOK ){ res.status( status ).json( obj ); } else { obj = typeof(obj) == 'object' ? obj : { }; var error = {}; // Assign "legal" keys if( obj.message ) error.message = obj.message; if( obj.errors ) error.errors = obj.errors; if( obj.data ) error.data = obj.data; if( obj.emit ) error.emit = obj.emit; res.status( status ).json( error ); } } hotplate.hotEvents.on( 'pageElements', 'hotCoreErrorProtocol', function( done ){ done( null, { jses: [ 'hotFixErrorResponse.js'] }); }); hotplate.hotEvents.on( 'clientPath', 'hotCoreErrorProtocol', function( done ){ done( null, path.join(__dirname, '../client') ); })
Update to latest Express API
Update to latest Express API
JavaScript
mit
shelsonjava/hotplate,mercmobily/hotplate,mercmobily/hotplate,shelsonjava/hotplate
--- +++ @@ -18,7 +18,7 @@ status === 304; // or, get it out of the cache if( isOK ){ - res.json( status, obj ); + res.status( status ).json( obj ); } else { obj = typeof(obj) == 'object' ? obj : { }; @@ -31,7 +31,7 @@ if( obj.data ) error.data = obj.data; if( obj.emit ) error.emit = obj.emit; - res.json(status, error); + res.status( status ).json( error ); } }
3b0492386a595331d147c2a1e5f3748c1e0963c3
src/index.js
src/index.js
import { join } from 'path' import buildWebpackConfig from './config/build-webpack-config' import buildKarmaConfig from './config/build-karma-config' import startDevelop from './action/start-develop' import runTest from './action/run-test' import install from './action/install' import json from './util/json' export default { develop (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) startDevelop(webpackConfig) }, test (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) const karmaConfig = buildKarmaConfig(env, options, webpackConfig) runTest(karmaConfig) }, install (env, options) { check(env) install(env.projectPath) } } function check ({ projectPath }) { const packagePath = join(projectPath, 'package.json') const packageJSON = json.read(packagePath) if (packageJSON.name === 'sagui') throw new InvalidUsage() } export class InvalidUsage extends Error { constructor () { super() this.name = 'InvalidUsage' } }
import { join } from 'path' import { statSync } from 'fs' import buildWebpackConfig from './config/build-webpack-config' import buildKarmaConfig from './config/build-karma-config' import startDevelop from './action/start-develop' import runTest from './action/run-test' import install from './action/install' import json from './util/json' export default { develop (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) startDevelop(webpackConfig) }, test (env, options) { check(env) const webpackConfig = buildWebpackConfig(env, options) const karmaConfig = buildKarmaConfig(env, options, webpackConfig) runTest(karmaConfig) }, install (env, options) { check(env) install(env.projectPath) } } function check ({ projectPath }) { const packagePath = join(projectPath, 'package.json') if (!fileExists(packagePath)) throw new InvalidUsage() const packageJSON = json.read(packagePath) if (packageJSON.name === 'sagui') throw new InvalidUsage() } function fileExists (file) { try { statSync(file) return true } catch (e) { return false } } export class InvalidUsage extends Error { constructor () { super() this.name = 'InvalidUsage' } }
Fix check that would crash if folder didn’t contain a package.json file
Fix check that would crash if folder didn’t contain a package.json file
JavaScript
mit
saguijs/sagui,saguijs/sagui
--- +++ @@ -1,4 +1,5 @@ import { join } from 'path' +import { statSync } from 'fs' import buildWebpackConfig from './config/build-webpack-config' import buildKarmaConfig from './config/build-karma-config' import startDevelop from './action/start-develop' @@ -33,8 +34,20 @@ function check ({ projectPath }) { const packagePath = join(projectPath, 'package.json') + if (!fileExists(packagePath)) throw new InvalidUsage() + const packageJSON = json.read(packagePath) if (packageJSON.name === 'sagui') throw new InvalidUsage() +} + + +function fileExists (file) { + try { + statSync(file) + return true + } catch (e) { + return false + } }
f4955e86bb284b7111c71f8a9f270da7c8818c15
src/index.js
src/index.js
export default class UserLocation { constructor({ apiKey, cacheTtl = 604800, // 7 days fallback = 'exact', // If IP-based geolocation fails specificity = 'general', }) { let coordsLoaded = false; const coords = { latitude: null, longitude: null, accuracy: null, }; const promise = new Promise((resolve, reject) => { if (coordsLoaded) { resolve(coords); } else if (specificity === 'exact') { navigator.geolocation.getCurrentPosition( (pos) => { coordsLoaded = true; coords.latitude = pos.coords.latitude; coords.longitude = pos.coords.longitude; coords.accuracy = pos.coords.accuracy; resolve(coords); }, (err) => { reject(`${err.message} (error code: ${err.code})`); } ); } else if (specificity === 'general') { // Use GeoIP lookup to get general area } else { throw new Error('Invalid configuration value for location specificity.'); } }); console.log(apiKey, cacheTtl, fallback); return promise; } }
export default class UserLocation { constructor({ apiKey = null, cacheTtl = 604800, // 7 days fallback = 'exact', // If IP-based geolocation fails specificity = 'general', }) { let coordsLoaded = false; const coords = { latitude: null, longitude: null, accuracy: null, }; if (apiKey === null && (specificity === 'general' || fallback === 'general')) { throw new Error('An API key must be included when using GeoCarrot\'s GeoIP lookup.'); } const promise = new Promise((resolve, reject) => { if (coordsLoaded) { resolve(coords); } else if (specificity === 'exact') { navigator.geolocation.getCurrentPosition( (pos) => { coordsLoaded = true; coords.latitude = pos.coords.latitude; coords.longitude = pos.coords.longitude; coords.accuracy = pos.coords.accuracy; resolve(coords); }, (err) => { reject(`${err.message} (error code: ${err.code})`); } ); } else if (specificity === 'general') { // Use GeoIP lookup to get general area } else { throw new Error('Invalid configuration value for location specificity.'); } }); console.log(apiKey, cacheTtl, fallback); return promise; } }
Add a check to ensure apiKey is included in config when using GeoCarrot’s GeoIP lookup.
Add a check to ensure apiKey is included in config when using GeoCarrot’s GeoIP lookup.
JavaScript
apache-2.0
kevinsmith/user-location
--- +++ @@ -1,6 +1,6 @@ export default class UserLocation { constructor({ - apiKey, + apiKey = null, cacheTtl = 604800, // 7 days fallback = 'exact', // If IP-based geolocation fails specificity = 'general', @@ -12,6 +12,10 @@ longitude: null, accuracy: null, }; + + if (apiKey === null && (specificity === 'general' || fallback === 'general')) { + throw new Error('An API key must be included when using GeoCarrot\'s GeoIP lookup.'); + } const promise = new Promise((resolve, reject) => { if (coordsLoaded) {
7ce25e9c841a98ac2d428a6d7e1a70015e890349
src/index.js
src/index.js
'use strict'; import backbone from 'backbone'; import _ from 'underscore'; class Person extends backbone.Model { getFullName() { return this.get('firstName') + ' ' + this.get('lastName'); } } // Using benmccormick's suggestion // for decorators to apply properties to class // before instantiation // https://github.com/jashkenas/backbone/issues/3560#issuecomment-113709224 function props(value) { return function decorator(target) { _.extend(target.prototype, value); } } @props({ events: { 'click': function() { console.log('clicked!'); } } }) class Hello extends backbone.View { initialize() { this.person = new Person({ firstName: 'George', lastName: 'Washington' }); } render() { this.$el.html('Hello, ' + this.person.getFullName() + '.'); } } var myView = new Hello({el: document.getElementById('root')}); myView.render();
'use strict'; import backbone from 'backbone'; import _ from 'underscore'; class Person extends backbone.Model { getFullName() { return this.get('firstName') + ' ' + this.get('lastName'); } } // Using benmccormick's suggestion // for decorators to apply properties to class // before instantiation // https://github.com/jashkenas/backbone/issues/3560#issuecomment-113709224 function props(value) { return function decorator(target) { _.extend(target.prototype, value); } } @props({ events: { 'click': function() { console.log('clicked!'); } } }) class Hello extends backbone.View { render() { this.$el.html('Hello, ' + this.model.getFullName() + '.'); } } var myView = new Hello({el: document.getElementById('root'), model: new Person({ firstName: 'George', lastName: 'Washington' })}); myView.render();
Move model to this.model in constructor
Move model to this.model in constructor
JavaScript
mit
andrewrota/backbone-with-es6-classes,andrewrota/backbone-with-es6-classes
--- +++ @@ -22,16 +22,13 @@ } }) class Hello extends backbone.View { - initialize() { - this.person = new Person({ - firstName: 'George', - lastName: 'Washington' - }); - } render() { - this.$el.html('Hello, ' + this.person.getFullName() + '.'); + this.$el.html('Hello, ' + this.model.getFullName() + '.'); } } -var myView = new Hello({el: document.getElementById('root')}); +var myView = new Hello({el: document.getElementById('root'), model: new Person({ + firstName: 'George', + lastName: 'Washington' +})}); myView.render();
c45f77f19e84ad54d70574b019198dd9a9fc43f8
test/vue-countdown.spec.js
test/vue-countdown.spec.js
import Vue from 'vue'; import Countdown from '../src/vue-countdown'; import {getVM} from './helpers'; describe('Vue countdown component', () => { it('sets passed label correctly', () => { const vm = getVM(Countdown, { propsData: { message: 'Boom' } }); expect(vm.$data.label).toBe('Boom'); }); it('initializes timer properly', () => { const vm = getVM(Countdown, { propsData: { seconds: 5 } }); expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('00:00:05'); }); it('counts to zero', (done) => { const vm = getVM(Countdown, { propsData: { seconds: 1 } }); setTimeout(() => { expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('Time\'s up!'); done(); }, 1000); }); });
import Vue from 'vue'; import Countdown from '../src/vue-countdown'; import {getVM} from './helpers'; describe('Vue countdown component', () => { it('sets passed label correctly', () => { const vm = getVM(Countdown, { propsData: { message: 'Boom' } }); expect(vm.$data.label).toBe('Boom'); }); it('initializes timer properly', () => { const vm = getVM(Countdown, { propsData: { seconds: 5 } }); expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('00:00:05'); }); it('counts to zero', (done) => { const vm = getVM(Countdown, { propsData: { seconds: 1 } }); setTimeout(() => { expect(vm.$el.querySelector('.vue-countdown--time').textContent.trim()).toBe('Time\'s up!'); done(); }, 1000); }); it('triggers an event when timer has finished', (done) => { const vm = new Vue({ methods: { handleTimeExpire() { // should be called } }, render: h => h(Countdown, { props: { seconds: 1 }, on: { 'time-expire': vm.handleTimeExpire } }) }) spyOn(vm, 'handleTimeExpire'); vm.$mount(); setTimeout(() => { expect(vm.handleTimeExpire).toHaveBeenCalled(); done(); }, 1000); }); });
Add test for time-expire event when timer finishes
Add test for time-expire event when timer finishes
JavaScript
mit
maksimovicdanijel/vue-countdown,maksimovicdanijel/vue-countdown
--- +++ @@ -36,4 +36,32 @@ done(); }, 1000); }); + + it('triggers an event when timer has finished', (done) => { + const vm = new Vue({ + methods: { + handleTimeExpire() { + // should be called + } + }, + render: h => h(Countdown, { + props: { + seconds: 1 + }, + on: { + 'time-expire': vm.handleTimeExpire + } + }) + }) + + spyOn(vm, 'handleTimeExpire'); + + vm.$mount(); + + setTimeout(() => { + expect(vm.handleTimeExpire).toHaveBeenCalled(); + + done(); + }, 1000); + }); });
39430a54cdcac3cae01fb49c54b4e81f66303522
commands/kill.js
commands/kill.js
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { return (args, player) => { const room = rooms.getAt(player.getLocation()); const npc = CommandUtil.findNpcInRoom(npcs, args, room, player, true); if (!npc) { return player.warn(`Kill ${args}? If you can find them, maybe.`); } if (!npc.isPacifist) { console.log('fucked up ', npc); } if (npc.isPacifist()) { return player.warn(`${npc.getShortDesc()} radiates a calming aura.`); } if (!player.hasEnergy(5)) { return player.noEnergy(); } util.log(player.getName() + ' is on the offensive...'); const fightingPlayer = _.has(npc.getInCombat(), player); if (fightingPlayer) { player.say('You are already fighting them!'); return; } else if (npc.isInCombat()) { player.say('They are busy fighting someone else, no fair!'); return; } npc.emit('combat', player, room, players, npcs, rooms, cleanup); function cleanup(success) { // cleanup here... } }; };
'use strict'; const CommandUtil = require('../src/command_util').CommandUtil; const l10nFile = __dirname + '/../l10n/commands/kill.yml'; const _ = require('../src/helpers'); const l10n = require('../src/l10n')(l10nFile); const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => { return (args, player) => { const room = rooms.getAt(player.getLocation()); const npc = CommandUtil.findNpcInRoom(npcs, args, room, player, true); if (!npc) { return player.warn(`Kill ${args}? If you can find them, maybe.`); } if (npc.isPacifist()) { return player.warn(`${npc.getShortDesc()} radiates a calming aura.`); } if (!player.hasEnergy(5)) { return player.noEnergy(); } util.log(player.getName() + ' is on the offensive...'); const fightingPlayer = _.has(npc.getInCombat(), player); if (fightingPlayer) { return player.say(`You are already fighting that ${npc.getShortDesc()}!`); } else if (npc.isInCombat()) { return player.say('That ${npc.getShortDesc()} is busy fighting someone else, no fair!'); } npc.emit('combat', player, room, players, npcs, rooms, cleanup); function cleanup(success) { // cleanup here... } }; };
Remove unneeded console logs, improve messaging to player.
Remove unneeded console logs, improve messaging to player.
JavaScript
mit
seanohue/ranviermud,seanohue/ranviermud,shawncplus/ranviermud
--- +++ @@ -13,7 +13,7 @@ if (!npc) { return player.warn(`Kill ${args}? If you can find them, maybe.`); } - if (!npc.isPacifist) { console.log('fucked up ', npc); } + if (npc.isPacifist()) { return player.warn(`${npc.getShortDesc()} radiates a calming aura.`); } @@ -25,11 +25,9 @@ const fightingPlayer = _.has(npc.getInCombat(), player); if (fightingPlayer) { - player.say('You are already fighting them!'); - return; + return player.say(`You are already fighting that ${npc.getShortDesc()}!`); } else if (npc.isInCombat()) { - player.say('They are busy fighting someone else, no fair!'); - return; + return player.say('That ${npc.getShortDesc()} is busy fighting someone else, no fair!'); } npc.emit('combat', player, room, players, npcs, rooms, cleanup);
959b28ea1da440d8c71e9d739c2ea099721f5de4
app/routes/seq.js
app/routes/seq.js
import Ember from 'ember'; export default Ember.Route.extend({ model(params) { return this.store.find('seq', params.lang + "-" + params.seq).then( (model) => model, (error) => null); }, afterModel(model) { this._super(model); if(Ember.isEmpty(model)) { this.notifier.error("No such word found!"); this.transitionTo("application"); } else { this.tracker.log("word", "viewed"); Ember.$(document).attr('title', 'What does \"' + model.get("text") + '\" mean?'); } }, });
import Ember from 'ember'; import ENV from '../config/environment'; export default Ember.Route.extend({ model(params) { const key = params.lang + "-" + params.seq; const _this = this; return Ember.$.getJSON(ENV.api + "/seqs/" + key).then( (data) => { _this.store.pushPayload('wordset', data); return _this.store.getById('seq', key); } ) }, afterModel(model) { this._super(model); if(Ember.isEmpty(model)) { this.notifier.error("No such word found!"); this.transitionTo("application"); } else { this.tracker.log("word", "viewed"); Ember.$(document).attr('title', 'What does \"' + model.get("text") + '\" mean?'); } }, setupController(controller, model) { this._super(controller, model); console.log("Setup controller", controller) controller.set("isEditing", false); } });
Set up the controller after a route change wrt editing
Set up the controller after a route change wrt editing
JavaScript
mit
wordset/wordset-ui,BryanCode/wordset-ui,wordset/wordset-ui,wordset/wordset-ui,BryanCode/wordset-ui,BryanCode/wordset-ui
--- +++ @@ -1,10 +1,16 @@ import Ember from 'ember'; +import ENV from '../config/environment'; export default Ember.Route.extend({ model(params) { - return this.store.find('seq', params.lang + "-" + params.seq).then( - (model) => model, - (error) => null); + const key = params.lang + "-" + params.seq; + const _this = this; + return Ember.$.getJSON(ENV.api + "/seqs/" + key).then( + (data) => { + _this.store.pushPayload('wordset', data); + return _this.store.getById('seq', key); + } + ) }, afterModel(model) { this._super(model); @@ -15,6 +21,10 @@ this.tracker.log("word", "viewed"); Ember.$(document).attr('title', 'What does \"' + model.get("text") + '\" mean?'); } - }, + setupController(controller, model) { + this._super(controller, model); + console.log("Setup controller", controller) + controller.set("isEditing", false); + } });
af52d32fe73ba180ef6975edff4ef04c42e5149b
scripts/cd-server.js
scripts/cd-server.js
// Continuous delivery server const { spawn } = require('child_process') const { resolve } = require('path') const { createServer } = require('http') const { urlencoded } = require('body-parser') const hostname = '127.0.0.1' const port = 80 const server = createServer((req, res) => { const { headers, method, url } = request // When a successful build has happened, kill the process, triggering a restart if (req.method === 'POST' && req.url === '/webhook') { // Send response res.statusCode = 200 res.end() let body = [] request .on('error', err => { console.error(err) }) .on('data', chunk => { body.push(chunk) }) .on('end', () => { body = Buffer.concat(body).toString() const data = urlencoded(body) console.log(data) }) } res.statusCode = 404 res.end() }).listen(port)
// Continuous delivery server const { spawn } = require('child_process') const { resolve } = require('path') const { createServer } = require('http') const { urlencoded } = require('body-parser') const hostname = '127.0.0.1' const port = 80 const server = createServer((req, res) => { const { headers, method, url } = req // When a successful build has happened, kill the process, triggering a restart if (req.method === 'POST' && req.url === '/webhook') { // Send response res.statusCode = 200 res.end() let body = [] request .on('error', err => { console.error(err) }) .on('data', chunk => { body.push(chunk) }) .on('end', () => { body = Buffer.concat(body).toString() const data = urlencoded(body) console.log(data) }) } res.statusCode = 404 res.end() }).listen(port)
Fix typo in CD server.
Fix typo in CD server.
JavaScript
mit
jsonnull/jsonnull.com,jsonnull/jsonnull.com,jsonnull/jsonnull.com
--- +++ @@ -7,7 +7,7 @@ const hostname = '127.0.0.1' const port = 80 const server = createServer((req, res) => { - const { headers, method, url } = request + const { headers, method, url } = req // When a successful build has happened, kill the process, triggering a restart if (req.method === 'POST' && req.url === '/webhook') {
3c71fc5e7e9c146b0ac59eb792bca74a0c52a0d0
app/views/room.js
app/views/room.js
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('form', {method: 'post', action: `/${gameID}`}, [ h('button', {type: 'button', id: 'min'}, '-'), h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'button', id: 'max'}, '+'), h('button', {type: 'submit'}, 'Start') ]), h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, dataPlayerId: playerID }, 'Score: ' + player.score) })) ]) ]); };
const h = require('virtual-dom/h'); module.exports = function (data) { const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('form', {method: 'post', action: `/${gameID}`}, [ h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), h('button', {type: 'submit'}, 'Start') ]), h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'), h('div', {id: 'players'}, [ h('ul', Object.keys(game.players).map(playerID => { const player = game.players[playerID]; return h('li', { style: { backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})` }, dataPlayerId: playerID }, 'Score: ' + player.score) })) ]) ]); };
Remove + / - buttons
Remove + / - buttons
JavaScript
mit
rijkvanzanten/luaus
--- +++ @@ -4,9 +4,7 @@ const {gameID, game} = data; return h('div', {className: 'room'}, [ game.playing ? null : h('form', {method: 'post', action: `/${gameID}`}, [ - h('button', {type: 'button', id: 'min'}, '-'), h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}), - h('button', {type: 'button', id: 'max'}, '+'), h('button', {type: 'submit'}, 'Start') ]), h('a', {href: '/new-player/' + gameID}, 'Wanna play along?'),
9c0c8362aeb27327a1c5747d51e9e87a7497e73f
src/browser_app_skeleton/src/js/app.js
src/browser_app_skeleton/src/js/app.js
/* eslint no-console:0 */ // RailsUjs is *required* for links in Lucky that use DELETE, POST and PUT. import RailsUjs from "rails-ujs"; // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/ import Turbolinks from "turbolinks"; RailsUjs.start(); Turbolinks.start();
/* eslint no-console:0 */ // RailsUjs is *required* for links in Lucky that use DELETE, POST and PUT. // Though it says "Rails" it actually works with any framework. import RailsUjs from "rails-ujs"; // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/ import Turbolinks from "turbolinks"; RailsUjs.start(); Turbolinks.start(); // If using Turbolinks, you can attach events to page load like this: // // document.addEventListener("turbolinks:load", function() { // ... // })
Clarify how to attach events and RailsUjs
Clarify how to attach events and RailsUjs
JavaScript
mit
luckyframework/cli,luckyframework/cli,luckyframework/cli
--- +++ @@ -1,6 +1,7 @@ /* eslint no-console:0 */ // RailsUjs is *required* for links in Lucky that use DELETE, POST and PUT. +// Though it says "Rails" it actually works with any framework. import RailsUjs from "rails-ujs"; // Turbolinks is optional. Learn more: https://github.com/turbolinks/turbolinks/ @@ -8,3 +9,9 @@ RailsUjs.start(); Turbolinks.start(); + +// If using Turbolinks, you can attach events to page load like this: +// +// document.addEventListener("turbolinks:load", function() { +// ... +// })
14d808a9e369fc38fff1975ea0e6225b788b12d9
client/app/serializers/cabin.js
client/app/serializers/cabin.js
import DS from 'ember-data'; import ApplicationSerializer from '../serializers/application'; export default ApplicationSerializer.extend({ normalize: function (modelClass, resourceHash, prop) { var normalizedHash = resourceHash; var normalizedFasiliteter = []; // Maps `fasiliteter` object to an array of objects with the key as `type` and value as `kommentar` if (resourceHash.fasiliteter) { for (var key in resourceHash.fasiliteter) { normalizedFasiliteter.push({type: key, kommentar: resourceHash.fasiliteter[key]}); } normalizedHash.fasiliteter = normalizedFasiliteter; } return this._super(modelClass, normalizedHash, prop); }, serialize: function(snapshot, options) { var json = this._super(snapshot, options); // Maps `fasiliteter` array back to object if (json.fasiliteter && json.fasiliteter.length) { var serializedFasiliteter = {}; for (var i = 0; i < json.fasiliteter.length; i++) { serializedFasiliteter[json.fasiliteter[i]['type']] = json.fasiliteter[i]['kommentar'] || ''; } json.fasiliteter = serializedFasiliteter; } return json; } });
import DS from 'ember-data'; import ApplicationSerializer from '../serializers/application'; export default ApplicationSerializer.extend({ normalize: function (modelClass, resourceHash, prop) { var normalizedHash = resourceHash; var normalizedFasiliteter = []; // Maps `fasiliteter` object to an array of objects with the key as `type` and value as `kommentar` if (resourceHash.fasiliteter) { for (var key in resourceHash.fasiliteter) { normalizedFasiliteter.push({type: key, kommentar: resourceHash.fasiliteter[key]}); } normalizedHash.fasiliteter = normalizedFasiliteter; } return this._super(modelClass, normalizedHash, prop); }, serialize: function(snapshot, options) { var json = this._super(snapshot, options); // Maps `fasiliteter` array back to object if (json.fasiliteter && json.fasiliteter.length) { var serializedFasiliteter = {}; for (var i = 0; i < json.fasiliteter.length; i++) { serializedFasiliteter[json.fasiliteter[i]['type']] = json.fasiliteter[i]['kommentar'] || ''; } json.fasiliteter = serializedFasiliteter; } // Update `tilrettelagt_for` with types from `tilrettelegginger` if (json.tilrettelegginger && json.tilrettelegginger.length) { json.tilrettelagt_for = json.tilrettelegginger.mapBy('type'); } return json; } });
Update tilrettelagt_for array with types from tilrettelegginger on save
Update tilrettelagt_for array with types from tilrettelegginger on save
JavaScript
mit
Turistforeningen/Hytteadmin,Turistforeningen/Hytteadmin
--- +++ @@ -30,6 +30,11 @@ json.fasiliteter = serializedFasiliteter; } + // Update `tilrettelagt_for` with types from `tilrettelegginger` + if (json.tilrettelegginger && json.tilrettelegginger.length) { + json.tilrettelagt_for = json.tilrettelegginger.mapBy('type'); + } + return json; }
d88b60ddc0bbea880011b48a4d5e9a1374b7b67a
babel-defaults.js
babel-defaults.js
/* eslint-disable object-shorthand */ module.exports = { // We need to make sure that the transpiler hit the linoleum source since we are // not building to npm or simliar. ignore: function(filename) { return ((/node_modules/.test(filename)) && !(/linoleum(-[^/]*)?\/electron/.test(filename)) && !(/linoleum(-[^/]*)?\/src/.test(filename)) && !(/linoleum(-[^/]*)?\/tasks/.test(filename))) || (/\$.*\$/.test(filename)); }, sourceMap: 'inline', auxiliaryCommentBefore: 'istanbul ignore start', auxiliaryCommentAfter: 'istanbul ignore end', presets: [ require.resolve('babel-preset-react'), require.resolve('babel-preset-es2015'), require.resolve('babel-preset-stage-0') ] };
/* eslint-disable object-shorthand */ module.exports = { // We need to make sure that the transpiler hit the linoleum source since we are // not building to npm or simliar. ignore: function(filename) { return ((/node_modules/.test(filename)) && !(/linoleum(-[^/]*)?\/(electron|src|tasks|Gulpfile)/.test(filename))) || (/\$.*\$/.test(filename)); }, sourceMap: 'inline', auxiliaryCommentBefore: 'istanbul ignore start', auxiliaryCommentAfter: 'istanbul ignore end', presets: [ require.resolve('babel-preset-react'), require.resolve('babel-preset-es2015'), require.resolve('babel-preset-stage-0') ] };
Simplify bable includes and add Gulpfiles
Simplify bable includes and add Gulpfiles
JavaScript
mit
kpdecker/linoleum
--- +++ @@ -4,9 +4,7 @@ // not building to npm or simliar. ignore: function(filename) { return ((/node_modules/.test(filename)) - && !(/linoleum(-[^/]*)?\/electron/.test(filename)) - && !(/linoleum(-[^/]*)?\/src/.test(filename)) - && !(/linoleum(-[^/]*)?\/tasks/.test(filename))) + && !(/linoleum(-[^/]*)?\/(electron|src|tasks|Gulpfile)/.test(filename))) || (/\$.*\$/.test(filename)); }, sourceMap: 'inline',
b8ebb9207195e23afa6c0ce3f943c6908abee740
rollup.config.js
rollup.config.js
import buble from '@rollup/plugin-buble' export default { input: 'src/commands.js', output: { dir: 'dist', format: 'cjs', sourcemap: true }, plugins: [buble()], external(id) { return !/^[\.\/]/.test(id) } }
import buble from '@rollup/plugin-buble' export default { input: './src/commands.js', output: { dir: 'dist', format: 'cjs', sourcemap: true }, plugins: [buble()], external(id) { return !/^[\.\/]/.test(id) } }
Add missing ./ prefix in rollup input
Add missing ./ prefix in rollup input
JavaScript
mit
ProseMirror/prosemirror-commands
--- +++ @@ -1,7 +1,7 @@ import buble from '@rollup/plugin-buble' export default { - input: 'src/commands.js', + input: './src/commands.js', output: { dir: 'dist', format: 'cjs',
1f2587a913a987fa0eae03bfa4b4dd1cffb8a5e1
controllers/users/collection.js
controllers/users/collection.js
module.exports = (function(){ // GET /users/:id/media?lat=<LAT>&lng=<LNG>&time=<TIME> return function* collection(id) { // Twitter Requests var twitterDef = require('q').defer() var TwitterManager = require('../media/twitter'); var twitterGranuals = twitterDef.promise.then(TwitterManager.search); // var twitterDef = require('q').defer() // var instagramDef = require('q').defer() var InstagramManager = require('../media/instagram'); // var instagramGranuals = instagramDef.promise.then(InstagramManager.search); var instagramGranuals = InstagramManager.search(this.request.url); // Flickr Requests // var FlickrManager = require('../media/flickr'); // var flickrGranuals = yield FlickrManager.search(this.request.url); // Creating a universal capsul object var capsul = { "user_id": id, "latitude": require('../../helpers').paramsForUrl(this.request.url).lat, "longitude": require('../../helpers').paramsForUrl(this.request.url).lng, "timestamp": require('../../helpers').paramsForUrl(this.request.url).time, "data": [] } // def.resolve(this.request.url) // var instaGranuals = def.promise.then(InstagramManager.search); // capsul.data.push(instagramGranuals) twitterDef.resolve(this.request.url) // instagramDef.resolve(this.request.url) capsul.data.push(twitterGranuals); capsul.data.push(instagramGranuals) this.body = yield capsul; } })();
module.exports = (function(){ // GET /users/:id/media?lat=<LAT>&lng=<LNG>&time=<TIME> return function* collection(id) { var Q = require('q'); var TwitterManager = require('../media/twitter'); var InstagramManager = require('../media/instagram'); // Twitter Requests var twitterDef = Q.defer(); var twitterGranuals = twitterDef.promise .then(TwitterManager.search); // Instagram Requests var instagramDef = Q.defer(); var instagramGranuals = instagramDef.promise .then(InstagramManager.search); // Flickr Requests // var FlickrManager = require('../media/flickr'); // var flickrGranuals = yield FlickrManager.search(this.request.url); // Creating a universal capsul object var capsul = { "user_id": id, "latitude": require('../../helpers').paramsForUrl(this.request.url).lat, "longitude": require('../../helpers').paramsForUrl(this.request.url).lng, "timestamp": require('../../helpers').paramsForUrl(this.request.url).time, "data": [] } twitterDef.resolve(this.request.url) instagramDef.resolve(this.request.url) capsul.data.push(twitterGranuals); capsul.data.push(instagramGranuals); this.body = yield capsul; } })();
Refactor to use promises for social media service responses.
Refactor to use promises for social media service responses.
JavaScript
mit
capsul/capsul-api
--- +++ @@ -2,18 +2,20 @@ // GET /users/:id/media?lat=<LAT>&lng=<LNG>&time=<TIME> return function* collection(id) { + var Q = require('q'); + var TwitterManager = require('../media/twitter'); + var InstagramManager = require('../media/instagram'); + + // Twitter Requests + var twitterDef = Q.defer(); + var twitterGranuals = twitterDef.promise + .then(TwitterManager.search); + + // Instagram Requests + var instagramDef = Q.defer(); + var instagramGranuals = instagramDef.promise + .then(InstagramManager.search); - // Twitter Requests - var twitterDef = require('q').defer() - var TwitterManager = require('../media/twitter'); - var twitterGranuals = twitterDef.promise.then(TwitterManager.search); - // var twitterDef = require('q').defer() - - // var instagramDef = require('q').defer() - var InstagramManager = require('../media/instagram'); - // var instagramGranuals = instagramDef.promise.then(InstagramManager.search); - var instagramGranuals = InstagramManager.search(this.request.url); - // Flickr Requests // var FlickrManager = require('../media/flickr'); // var flickrGranuals = yield FlickrManager.search(this.request.url); @@ -27,15 +29,11 @@ "data": [] } - // def.resolve(this.request.url) - // var instaGranuals = def.promise.then(InstagramManager.search); - // capsul.data.push(instagramGranuals) + twitterDef.resolve(this.request.url) + instagramDef.resolve(this.request.url) - twitterDef.resolve(this.request.url) - // instagramDef.resolve(this.request.url) - capsul.data.push(twitterGranuals); - capsul.data.push(instagramGranuals) + capsul.data.push(instagramGranuals); this.body = yield capsul; }
4e35bbcc85351ff97aeacd3674d16612c94e78be
routes/routes.js
routes/routes.js
var artistController = require('../controllers/artist-controller'); var genreController = require('../controllers/genre-controller'); module.exports = function(app, passport) { app.get('/auth/facebook', passport.authenticate('facebook', { scope : 'email' })); app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect : '/' }), function(req, res) { return res.status(200).send(req.user); }); app.get('/profile', function(req, res) { return res.send(200); }); app.post('/api/artist/:id/like', artistController.likeArtist); app.get('/api/artist/recommendation', artistController.getArtistRecommendations); app.get('/api/genre', genreController.getGenres); app.get('/api/genre/artists', genreController.getArtistsByGenre); app.get('*', function(req, res) { return res.render('index.html'); }); };
var artistController = require('../controllers/artist-controller'); var genreController = require('../controllers/genre-controller'); module.exports = function(app, passport) { app.get('/auth/facebook', passport.authenticate('facebook', { scope : 'email' })); app.get('/auth/facebook/callback', passport.authenticate('facebook', { failureRedirect : '/', successRedirect : '/' })); app.get('/profile', function(req, res) { return res.send(200); }); app.post('/api/artist/:id/like', artistController.likeArtist); app.get('/api/artist/recommendation', artistController.getArtistRecommendations); app.get('/api/genre', genreController.getGenres); app.get('/api/genre/artists', genreController.getArtistsByGenre); app.get('*', function(req, res) { return res.render('index.html'); }); };
Change route file to be used later
Change route file to be used later
JavaScript
mit
kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender
--- +++ @@ -6,10 +6,9 @@ app.get('/auth/facebook/callback', passport.authenticate('facebook', { - failureRedirect : '/' - }), function(req, res) { - return res.status(200).send(req.user); - }); + failureRedirect : '/', + successRedirect : '/' + })); app.get('/profile', function(req, res) { return res.send(200);
d7c0f286914c260f545b5c9c095a19daed918ff1
cms/static/cms/js/user/index.js
cms/static/cms/js/user/index.js
$.extend( true, $.fn.dataTable.defaults, { "autoWidth": false, "columnDefs": [ { width: '10%', targets: 0 }, { width: '15%', targets: 1 }, { width: '10%', targets: 2 }, { width: '10%', targets: 3 }, { width: '25%', targets: 4 }, { width: '10%', targets: 5 }, { width: '10%', targets: 6 }, ], "order": [[ 0, "asc" ]] } ); $(document).ready(function() { $('#items').DataTable(); // Breadcum $('#breadcrumb-home').append(en.cms.breadcrumb.home); $('#breadcrumb-user').append(en.cms.breadcrumb.user); // Table headers $('#header-username').append(en.cms.header.username); $('#header-email').append(en.cms.header.email); $('#header-firstname').append(en.cms.header.firstname); $('#header-lastname').append(en.cms.header.lastname); $('#header-lastlogin').append(en.cms.header.lastlogin); $('#header-isstaff').append(en.cms.header.isstaff); $('#header-isactive').append(en.cms.header.isactive); $('#main-title').append(en.cms.breadcrumb.user); $('#add').append(en.cms.action.add_user); } );
$.extend( true, $.fn.dataTable.defaults, { "autoWidth": false, "columnDefs": [ { width: '10%', targets: 0 }, { width: '10%', targets: 1 }, { width: '10%', targets: 2 }, { width: '10%', targets: 3 }, { width: '20%', targets: 4 }, { width: '10%', targets: 5 }, { width: '10%', targets: 6 }, { width: '20%', targets: 7 }, ], "order": [[ 0, "asc" ]] } ); $(document).ready(function() { $('#items').DataTable(); // Breadcum $('#breadcrumb-home').append(en.cms.breadcrumb.home); $('#breadcrumb-user').append(en.cms.breadcrumb.user); // Table headers $('#header-username').append(en.cms.header.username); $('#header-email').append(en.cms.header.email); $('#header-firstname').append(en.cms.header.firstname); $('#header-lastname').append(en.cms.header.lastname); $('#header-lastlogin').append(en.cms.header.lastlogin); $('#header-isstaff').append(en.cms.header.isstaff); $('#header-isactive').append(en.cms.header.isactive); $('#main-title').append(en.cms.breadcrumb.user); $('#add').append(en.cms.action.add_user); } );
Fix DataTable in User page
[Release_0.0.1] Fix DataTable in User page
JavaScript
apache-2.0
deka108/mathqa-server,deka108/mathqa-server,deka108/mathqa-server,deka108/mathqa-server,deka108/meas_deka,deka108/meas_deka,deka108/meas_deka,deka108/meas_deka
--- +++ @@ -2,12 +2,13 @@ "autoWidth": false, "columnDefs": [ { width: '10%', targets: 0 }, - { width: '15%', targets: 1 }, + { width: '10%', targets: 1 }, { width: '10%', targets: 2 }, { width: '10%', targets: 3 }, - { width: '25%', targets: 4 }, + { width: '20%', targets: 4 }, { width: '10%', targets: 5 }, { width: '10%', targets: 6 }, + { width: '20%', targets: 7 }, ], "order": [[ 0, "asc" ]] } );
745633dabd3e695a30edc5fbd1625bb7f09aa26d
server/config.js
server/config.js
const productionConfig = { apiBase: 'http://api.storypalette.net/v1/', socketBase: 'http://api.storypalette.net/', environment: 'production', port: 8882, }; const developmentConfig = { apiBase: 'http://localhost:8880/v1/', socketBase: 'http://localhost:8880/', environment: 'local', port: 8882, } const config = (process.env.NODE_ENV === 'development') ? developmentConfig : productionConfig; module.exports = config;
const productionConfig = { //apiBase: 'http://api.storypalette.net/v1/', //socketBase: 'http://api.storypalette.net/', apiBase: 'http://storypalette-server.herokuapp.com/v1/', socketBase: 'http://storypalette-server.herokuapp.com/', environment: 'production', port: 8882, }; const developmentConfig = { apiBase: 'http://localhost:8880/v1/', socketBase: 'http://localhost:8880/', environment: 'local', port: 8882, } const config = (process.env.NODE_ENV === 'development') ? developmentConfig : productionConfig; module.exports = config;
Use heroku api base for now
Use heroku api base for now
JavaScript
isc
storypalette/storypalette-performer-touch,storypalette/storypalette-performer-touch
--- +++ @@ -1,6 +1,8 @@ const productionConfig = { - apiBase: 'http://api.storypalette.net/v1/', - socketBase: 'http://api.storypalette.net/', + //apiBase: 'http://api.storypalette.net/v1/', + //socketBase: 'http://api.storypalette.net/', + apiBase: 'http://storypalette-server.herokuapp.com/v1/', + socketBase: 'http://storypalette-server.herokuapp.com/', environment: 'production', port: 8882, };
10290106b9a075685852699cb8bbaf5bb3a012ca
tutorials/customProjectors/customProjectors.js
tutorials/customProjectors/customProjectors.js
window.onload = function() { var xScale = new Plottable.LinearScale(); var yScale = new Plottable.LinearScale(); var xAxis = new Plottable.XAxis(xScale, "bottom"); var yAxis = new Plottable.YAxis(yScale, "left"); // A DataSource is a Plottable object that maintains data and metadata, and updates dependents when it changes // In the previous example, we implicitly created a DataSource by putting the data directly into the Renderer constructor var gitDataSource = new Plottable.DataSource(gitData); var renderer = new Plottable.LineRenderer(gitDataSource, xScale, yScale); // We define an accessor function that the renderer will use to access a "Perspective" into the DataSource function dayAccessor(d) { return d.day; } // By calling renderer.project, we tell the renderer to set the "x" attribute using the dayAccessor function // and to project it through the xScale. This creates a binding between the data and the scale, so that the // scale automatically sets its domain, and will update its domain if the data changes renderer.project("x", dayAccessor, xScale); // If Plottable gets a string as an accessor argument, it will automatically turn it into a key function, as follows: // project(attr, "total_commits", scale) == project(attr, function(d) {return d.total_commits}, scale) renderer.project("y", "total_commits", yScale); // This accessor is somewhat more sophisticated - it performs some data aggregation on-the-fly for renderering function linesAddedAccessor(d) { var total = 0; d.changes.forEach(function(c) { total += c.additions; }); return total; } // Make a LogScale. Since the range doesn't correspond to the layout bounds of a renderer, we need to set the range ourselves. var radiusScale = new Plottable.LogScale().range([1, 10]); renderer.project("r", linesAddedAccessor, radiusScale) var chart = new Plottable.Table([ [yAxis, renderer], [null, xAxis ] ]); chart.renderTo("#chart"); }
window.onload = function() { var xScale = new Plottable.LinearScale(); var yScale = new Plottable.LinearScale(); var xAxis = new Plottable.XAxis(xScale, "bottom"); var yAxis = new Plottable.YAxis(yScale, "left"); var renderer = new Plottable.LineRenderer(gitData, xScale, yScale); function getXDataValue(d) { return d.day; } renderer.project("x", getXDataValue, xScale); function getYDataValue(d) { return d.total_commits; } renderer.project("y", getYDataValue, yScale); var chart = new Plottable.Table([ [yAxis, renderer], [null, xAxis ] ]); chart.renderTo("#chart"); }
Revert "Update customProjector example to use a scale. Doesn't work yet (pending merge to gh-pages)"
Revert "Update customProjector example to use a scale. Doesn't work yet (pending merge to gh-pages)" This reverts commit df014cfaed10a0eba602ebb0355ef83452faf133. Modified example instead of copying.
JavaScript
mit
RobertoMalatesta/plottable,jacqt/plottable,NextTuesday/plottable,NextTuesday/plottable,gdseller/plottable,jacqt/plottable,palantir/plottable,NextTuesday/plottable,alyssaq/plottable,iobeam/plottable,alyssaq/plottable,jacqt/plottable,palantir/plottable,RobertoMalatesta/plottable,palantir/plottable,danmane/plottable,danmane/plottable,softwords/plottable,softwords/plottable,onaio/plottable,danmane/plottable,gdseller/plottable,iobeam/plottable,alyssaq/plottable,onaio/plottable,onaio/plottable,palantir/plottable,iobeam/plottable,softwords/plottable,gdseller/plottable,RobertoMalatesta/plottable
--- +++ @@ -4,38 +4,17 @@ var xAxis = new Plottable.XAxis(xScale, "bottom"); var yAxis = new Plottable.YAxis(yScale, "left"); + var renderer = new Plottable.LineRenderer(gitData, xScale, yScale); - // A DataSource is a Plottable object that maintains data and metadata, and updates dependents when it changes - // In the previous example, we implicitly created a DataSource by putting the data directly into the Renderer constructor - var gitDataSource = new Plottable.DataSource(gitData); - var renderer = new Plottable.LineRenderer(gitDataSource, xScale, yScale); - - // We define an accessor function that the renderer will use to access a "Perspective" into the DataSource - function dayAccessor(d) { + function getXDataValue(d) { return d.day; } - // By calling renderer.project, we tell the renderer to set the "x" attribute using the dayAccessor function - // and to project it through the xScale. This creates a binding between the data and the scale, so that the - // scale automatically sets its domain, and will update its domain if the data changes - renderer.project("x", dayAccessor, xScale); + renderer.project("x", getXDataValue, xScale); - // If Plottable gets a string as an accessor argument, it will automatically turn it into a key function, as follows: - // project(attr, "total_commits", scale) == project(attr, function(d) {return d.total_commits}, scale) - renderer.project("y", "total_commits", yScale); - - // This accessor is somewhat more sophisticated - it performs some data aggregation on-the-fly for renderering - function linesAddedAccessor(d) { - var total = 0; - d.changes.forEach(function(c) { - total += c.additions; - }); - return total; + function getYDataValue(d) { + return d.total_commits; } - - // Make a LogScale. Since the range doesn't correspond to the layout bounds of a renderer, we need to set the range ourselves. - var radiusScale = new Plottable.LogScale().range([1, 10]); - - renderer.project("r", linesAddedAccessor, radiusScale) + renderer.project("y", getYDataValue, yScale); var chart = new Plottable.Table([ [yAxis, renderer],
04cc01275c74084ad1d01180ae6a7cf4f3438875
shared/shared.js
shared/shared.js
import { $assign, $fetch, $replaceAll } from 'domose'; /* Dispatch an Custom Event with a detail /* ========================================================================== */ function $dispatch(target, type, detail) { // an event const event = document.createEvent('CustomEvent'); event.initCustomEvent(type, true, true, detail); target.dispatchEvent(event); } export { $assign, $dispatch, $fetch, $replaceAll };
import { $assign, $fetch, $replaceAll } from 'domose'; /* Dispatch an Custom Event with a detail /* ========================================================================== */ function $dispatch(target, type, detail) { // an event const event = document.createEvent('CustomEvent'); event.initCustomEvent(type, true, true, detail); target.dispatchEvent(event); } function $enableFocusRing(target) { // retooled from https://github.com/jonathantneal/js-focus-ring let keyboardThrottleTimeoutID; const activeElements = []; target.addEventListener('blur', () => { activeElements.forEach((activeElement) => { activeElement.removeAttribute('js-focus'); activeElement.removeAttribute('js-focus-ring'); }); }, true); target.addEventListener('focus', () => { const activeElement = document.activeElement; if (activeElement instanceof Element) { activeElement.setAttribute('js-focus', ''); if (keyboardThrottleTimeoutID) { activeElement.setAttribute('js-focus-ring', ''); } activeElements.push(activeElement); } }, true); target.addEventListener('keydown', () => { keyboardThrottleTimeoutID = clearTimeout(keyboardThrottleTimeoutID) || setTimeout(() => { keyboardThrottleTimeoutID = 0; }, 100); }, true); } export { $assign, $dispatch, $enableFocusRing, $fetch, $replaceAll };
Add method to selectively enable focus ring
Add method to selectively enable focus ring
JavaScript
apache-2.0
gschnall/global-nav,gschnall/global-nav
--- +++ @@ -12,9 +12,45 @@ target.dispatchEvent(event); } +function $enableFocusRing(target) { + // retooled from https://github.com/jonathantneal/js-focus-ring + + let keyboardThrottleTimeoutID; + + const activeElements = []; + + target.addEventListener('blur', () => { + activeElements.forEach((activeElement) => { + activeElement.removeAttribute('js-focus'); + activeElement.removeAttribute('js-focus-ring'); + }); + }, true); + + target.addEventListener('focus', () => { + const activeElement = document.activeElement; + + if (activeElement instanceof Element) { + activeElement.setAttribute('js-focus', ''); + + if (keyboardThrottleTimeoutID) { + activeElement.setAttribute('js-focus-ring', ''); + } + + activeElements.push(activeElement); + } + }, true); + + target.addEventListener('keydown', () => { + keyboardThrottleTimeoutID = clearTimeout(keyboardThrottleTimeoutID) || setTimeout(() => { + keyboardThrottleTimeoutID = 0; + }, 100); + }, true); +} + export { $assign, $dispatch, + $enableFocusRing, $fetch, $replaceAll };
e8dac4b099ea892d8953eedcb035cd802414600b
js/lib/externs.js
js/lib/externs.js
/* * externs.js - define externs for the google closure compiler * * Copyright © 2012-2015, JEDLSoft * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ // !dependencies: false function console(str){}; function JSON(str){}; console.log = function (str){}; var PalmSystem, process, require, module, environment, exports, global, Intl, Qt;
/* * externs.js - define externs for the google closure compiler * * Copyright © 2012-2015, JEDLSoft * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * limitations under the License. */ // !dependencies: false function console(str){}; function JSON(str){}; console.log = function (str){}; var PalmSystem, require, module, environment, exports, global, Intl, Qt; var process = {env: {LANG: "", LANGUAGE: "", LC_ALL:""}};
Fix closure compiler warnings for process.env.*
Fix closure compiler warnings for process.env.* git-svn-id: 9171c9e75a46cbc9e9e8eb6adca0da07872ad553@1885 5ac057f5-ce63-4fb3-acd1-ab13b794ca36
JavaScript
apache-2.0
iLib-js/iLib,iLib-js/iLib,iLib-js/iLib,iLib-js/iLib,iLib-js/iLib
--- +++ @@ -22,4 +22,5 @@ function console(str){}; function JSON(str){}; console.log = function (str){}; -var PalmSystem, process, require, module, environment, exports, global, Intl, Qt; +var PalmSystem, require, module, environment, exports, global, Intl, Qt; +var process = {env: {LANG: "", LANGUAGE: "", LC_ALL:""}};
c38995393eb051f0430d6241725c673aa40db704
tests/integration/components/pulse-settings/component-test.js
tests/integration/components/pulse-settings/component-test.js
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('pulse-settings', 'Integration | Component | pulse settings', { integration: true }); test('it renders', function(assert) { // Set any properties with this.set('myProperty', 'value'); // Handle any actions with this.on('myAction', function(val) { ... }); this.render(hbs`{{pulse-settings}}`); assert.equal(this.$().text().trim(), ''); // Template block usage: this.render(hbs` {{#pulse-settings}} template block text {{/pulse-settings}} `); assert.equal(this.$().text().trim(), 'template block text'); });
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('pulse-settings', 'Integration | Component | pulse settings', { integration: true }); test('it renders', function(assert) { this.render(hbs`{{pulse-settings}}`); assert.ok(/Set Up/.test(this.$().text())); });
Fix tests for pulse-settings component
Fix tests for pulse-settings component
JavaScript
apache-2.0
usecanvas/web-v2,usecanvas/web-v2,usecanvas/web-v2
--- +++ @@ -1,25 +1,12 @@ import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; -moduleForComponent('pulse-settings', 'Integration | Component | pulse settings', { +moduleForComponent('pulse-settings', + 'Integration | Component | pulse settings', { integration: true }); test('it renders', function(assert) { - - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... }); - this.render(hbs`{{pulse-settings}}`); - - assert.equal(this.$().text().trim(), ''); - - // Template block usage: - this.render(hbs` - {{#pulse-settings}} - template block text - {{/pulse-settings}} - `); - - assert.equal(this.$().text().trim(), 'template block text'); + assert.ok(/Set Up/.test(this.$().text())); });
9772f857d22a68912b96d113f7953b89e733e33c
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { grunt.loadNpmTasks('grunt-bower-concat'); var taskConfig = { pkg: grunt.file.readJSON('package.json'), bower_concat: { all: { dest: 'build/_bower.js', cssDest: 'build/_bower.css', include: [ 'underscore', 'jquery-mousewheel', 'jquery', 'bootstrap' ], dependencies: { 'underscore': 'jquery', 'jquery-mousewheel': 'jquery', 'bootstrap': 'jquery' }, bowerOptions: { relative: false } } } } grunt.initConfig(grunt.util._.extend(taskConfig)); };
module.exports = function(grunt) { grunt.loadNpmTasks('grunt-bower-concat'); var taskConfig = { pkg: grunt.file.readJSON('package.json'), bower_concat: { all: { dest: 'build/_bower.js', cssDest: 'build/_bower.css', include: [ 'underscore', 'jquery-mousewheel', 'jquery', 'bootstrap' ], mainFiles: { bootstrap: ['dist/css/bootstrap.css','dist/js/bootstrap.js'] }, dependencies: { 'underscore': 'jquery', 'jquery-mousewheel': 'jquery', 'bootstrap': 'jquery' }, bowerOptions: { relative: false } } } } grunt.initConfig(grunt.util._.extend(taskConfig)); };
Add Bootstrap CSS file reference in grunt task
Add Bootstrap CSS file reference in grunt task
JavaScript
mit
pra85/grunt-bower-concat-example
--- +++ @@ -12,6 +12,9 @@ 'jquery', 'bootstrap' ], + mainFiles: { + bootstrap: ['dist/css/bootstrap.css','dist/js/bootstrap.js'] + }, dependencies: { 'underscore': 'jquery', 'jquery-mousewheel': 'jquery',
7f79b3c28a91e28548fb93ffdf63164707f60a1f
app/index-load-script.js
app/index-load-script.js
var baseHref = `http://localhost: ${process.env.npm_package_config_port}` var appEntry = `${baseHref} /gen/app.entry.js` var baseNode = document.createElement('base') baseNode.href = baseHref document.getElementsByTagName('head')[0].appendChild(baseNode) const createScript = function (scriptPath) { return new Promise((resolve, reject) => { var script = document.createElement('script') script.type = 'text/javascript' script.src = scriptPath script.async = true script.onload = resolve script.onerror = reject document.body.appendChild(script) }) } document.querySelector('#webpackLoading').style.display = 'block' createScript(appEntry).catch(() => { document.querySelector('#webpackLoading').style.display = 'none' document.querySelector('#setupError').style.display = 'block' })
var baseHref = 'http://localhost:' + process.env.npm_package_config_port var appEntry = baseHref + '/gen/app.entry.js' var baseNode = document.createElement('base') baseNode.href = baseHref document.getElementsByTagName('head')[0].appendChild(baseNode) const createScript = function (scriptPath) { return new Promise(function (resolve, reject) { var script = document.createElement('script') script.type = 'text/javascript' script.src = scriptPath script.async = true script.onload = resolve script.onerror = reject document.body.appendChild(script) }) } document.querySelector('#webpackLoading').style.display = 'block' createScript(appEntry).catch(function () { document.querySelector('#webpackLoading').style.display = 'none' document.querySelector('#setupError').style.display = 'block' })
Fix loading bug with last merge
Fix loading bug with last merge
JavaScript
mpl-2.0
jonathansampson/browser-laptop,jonathansampson/browser-laptop,MKuenzi/browser-laptop,dcposch/browser-laptop,Sh1d0w/browser-laptop,luixxiul/browser-laptop,diasdavid/browser-laptop,willy-b/browser-laptop,diasdavid/browser-laptop,dcposch/browser-laptop,darkdh/browser-laptop,willy-b/browser-laptop,manninglucas/browser-laptop,Sh1d0w/browser-laptop,darkdh/browser-laptop,MKuenzi/browser-laptop,Sh1d0w/browser-laptop,MKuenzi/browser-laptop,jonathansampson/browser-laptop,luixxiul/browser-laptop,darkdh/browser-laptop,MKuenzi/browser-laptop,manninglucas/browser-laptop,pmkary/braver,manninglucas/browser-laptop,timborden/browser-laptop,Sh1d0w/browser-laptop,timborden/browser-laptop,timborden/browser-laptop,dcposch/browser-laptop,darkdh/browser-laptop,pmkary/braver,dcposch/browser-laptop,jonathansampson/browser-laptop,luixxiul/browser-laptop,diasdavid/browser-laptop,timborden/browser-laptop,willy-b/browser-laptop,luixxiul/browser-laptop,pmkary/braver,pmkary/braver,diasdavid/browser-laptop,manninglucas/browser-laptop,willy-b/browser-laptop
--- +++ @@ -1,12 +1,12 @@ -var baseHref = `http://localhost: ${process.env.npm_package_config_port}` -var appEntry = `${baseHref} /gen/app.entry.js` +var baseHref = 'http://localhost:' + process.env.npm_package_config_port +var appEntry = baseHref + '/gen/app.entry.js' var baseNode = document.createElement('base') baseNode.href = baseHref document.getElementsByTagName('head')[0].appendChild(baseNode) const createScript = function (scriptPath) { - return new Promise((resolve, reject) => { + return new Promise(function (resolve, reject) { var script = document.createElement('script') script.type = 'text/javascript' script.src = scriptPath @@ -18,7 +18,7 @@ } document.querySelector('#webpackLoading').style.display = 'block' -createScript(appEntry).catch(() => { +createScript(appEntry).catch(function () { document.querySelector('#webpackLoading').style.display = 'none' document.querySelector('#setupError').style.display = 'block' })
20d13a2f21c00968cd9c749dc1527c0ed43a3a34
wp-content/themes/template/src/scripts/main.js
wp-content/themes/template/src/scripts/main.js
$(document).ready(function () { $('#primaryPostForm').validate() // Image preview in upload input $('.form__input--upload').on('change', function () { var label = $(this).data('label'); var image = (window.URL ? URL : webkitURL).createObjectURL(this.files[0]); $(label).css('background-image', 'url(' + image + ')'); $('.remover').css('display', 'block'); }) $('.remover').on('click', function () { var input = $(this).data('for'); var label = $(input).data('label'); $(input).wrap('<form>').closest('form').get(0).reset(); $(input).unwrap(); $(label).css('background-image', 'none'); $('.remover').css('display', 'none'); }) $('.color-switcher-button').on('click', function() { $('body').fadeOut('fast').siblings('head').find('link#stylesheet').attr('href', $(this).data('stylesheet')).closest('head').siblings('body').fadeIn('fast'); }) });
$(document).ready(function () { $('#primaryPostForm').validate() // Image preview in upload input $('.form__input--upload').on('change', function () { var label = $(this).data('label'); var image = (window.URL ? URL : webkitURL).createObjectURL(this.files[0]); $(label).css('background-image', 'url(' + image + ')'); $('.remover').css('display', 'block'); }) $('.remover').on('click', function () { var input = $(this).data('for'); var label = $(input).data('label'); $(input).wrap('<form>').closest('form').get(0).reset(); $(input).unwrap(); $(label).css('background-image', 'none'); $('.remover').css('display', 'none'); }) $('.color-switcher-button').on('click', function() { $('link#stylesheet').attr('href', $(this).data('stylesheet')); }) });
Remove color switcher fade effect
Remove color switcher fade effect
JavaScript
mit
DNepovim/kraj-praha,DNepovim/kraj-praha,DNepovim/kraj-praha
--- +++ @@ -26,7 +26,7 @@ }) $('.color-switcher-button').on('click', function() { - $('body').fadeOut('fast').siblings('head').find('link#stylesheet').attr('href', $(this).data('stylesheet')).closest('head').siblings('body').fadeIn('fast'); + $('link#stylesheet').attr('href', $(this).data('stylesheet')); }) });
cc1a92e941a68df9f0f606c1b399e83a013a9aca
aura-components/src/main/components/auradocs/search/searchController.js
aura-components/src/main/components/auradocs/search/searchController.js
/* * Copyright (C) 2012 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ { handleSearch : function(cmp,event){ var searchTerm = event.getParam('searchTerm') || (event.getSource() && event.getSource().getElement().value); if (searchTerm.length > 0) { var results_location = "#help?topic=searchResults&searchTerm=" + escape(searchTerm); window.location = results_location; } } }
/* * Copyright (C) 2012 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ { handleSearch : function(cmp,event){ var searchTerm = event.getParam('searchTerm') || event.getSource().getElement().value; if (searchTerm.length > 0) { var results_location = "#help?topic=searchResults&searchTerm=" + escape(searchTerm); window.location = results_location; } } }
Revert "Fix for possible deref of cleaned up source component"
Revert "Fix for possible deref of cleaned up source component" This reverts commit 2b35e47816edb0f655fca21d108d651a6a218b2c.
JavaScript
apache-2.0
madmax983/aura,badlogicmanpreet/aura,lcnbala/aura,badlogicmanpreet/aura,madmax983/aura,forcedotcom/aura,SalesforceSFDC/aura,forcedotcom/aura,DebalinaDey/AuraDevelopDeb,madmax983/aura,DebalinaDey/AuraDevelopDeb,navyliu/aura,forcedotcom/aura,SalesforceSFDC/aura,madmax983/aura,igor-sfdc/aura,lhong375/aura,navyliu/aura,forcedotcom/aura,igor-sfdc/aura,lcnbala/aura,DebalinaDey/AuraDevelopDeb,badlogicmanpreet/aura,lhong375/aura,lcnbala/aura,navyliu/aura,TribeMedia/aura,navyliu/aura,TribeMedia/aura,TribeMedia/aura,lcnbala/aura,SalesforceSFDC/aura,TribeMedia/aura,igor-sfdc/aura,madmax983/aura,lhong375/aura,badlogicmanpreet/aura,DebalinaDey/AuraDevelopDeb,lhong375/aura,SalesforceSFDC/aura,navyliu/aura,madmax983/aura,lcnbala/aura,navyliu/aura,SalesforceSFDC/aura,badlogicmanpreet/aura,DebalinaDey/AuraDevelopDeb,badlogicmanpreet/aura,igor-sfdc/aura,SalesforceSFDC/aura,forcedotcom/aura,DebalinaDey/AuraDevelopDeb,TribeMedia/aura,igor-sfdc/aura,lcnbala/aura,TribeMedia/aura
--- +++ @@ -16,7 +16,8 @@ { handleSearch : function(cmp,event){ - var searchTerm = event.getParam('searchTerm') || (event.getSource() && event.getSource().getElement().value); + var searchTerm = event.getParam('searchTerm') || event.getSource().getElement().value; + if (searchTerm.length > 0) { var results_location = "#help?topic=searchResults&searchTerm=" + escape(searchTerm); window.location = results_location;
d12eeb4944e9414b1f0543fda462fff3656b9970
application/bar/index.js
application/bar/index.js
var builder = require('focus').component.builder; var React = require('react'); var applicationStore = require('focus').application.builtInStore(); var barMixin = { getDefaultProps: function getCartridgeDefaultProps(){ return { appName: "", style: {} }; }, /** @inheriteddoc */ getInitialState: function getCartridgeInitialState() { return this._getStateFromStore(); }, /** @inheriteddoc */ componentWillMount: function cartridgeWillMount() { applicationStore.addSummaryComponentChangeListener(this._handleComponentChange); }, /** @inheriteddoc */ componentWillUnMount: function cartridgeWillUnMount(){ applicationStore.removeSummaryComponentChangeListener(this._onComponentChange); }, _getStateFromStore: function getCartridgeStateFromStore(){ return {summaryComponent: applicationStore.getSummaryComponent() || {component: 'div', props: {}}}; }, _handleComponentChange: function _handleComponentChangeBarSummary(){ this.setState(this._getStateFromStore()); }, /** @inheriteddoc */ render: function renderBar() { var className = `bar ${this.props.style.className}`; return ( <div className={className} data-focus='bar'> <div className='applicationName'>{this.props.appName}</div> <this.state.summaryComponent.component {...this.state.summaryComponent.props}/> </div> ); } }; module.exports = builder(barMixin);
Add summary inside the bar.
[bar] Add summary inside the bar.
JavaScript
mit
KleeGroup/focus-components,Bernardstanislas/focus-components,anisgh/focus-components,Bernardstanislas/focus-components,KleeGroup/focus-components,asimsir/focus-components,JabX/focus-components,sebez/focus-components,Ephrame/focus-components,JabX/focus-components,sebez/focus-components,anisgh/focus-components,Ephrame/focus-components,Jerom138/focus-components,Jerom138/focus-components,anisgh/focus-components,Bernardstanislas/focus-components,Jerom138/focus-components,JRLK/focus-components,get-focus/focus-components,Ephrame/focus-components,JRLK/focus-components,asimsir/focus-components,JRLK/focus-components
--- +++ @@ -0,0 +1,42 @@ +var builder = require('focus').component.builder; +var React = require('react'); +var applicationStore = require('focus').application.builtInStore(); + +var barMixin = { + getDefaultProps: function getCartridgeDefaultProps(){ + return { + appName: "", + style: {} + }; + }, + /** @inheriteddoc */ + getInitialState: function getCartridgeInitialState() { + return this._getStateFromStore(); + }, + /** @inheriteddoc */ + componentWillMount: function cartridgeWillMount() { + applicationStore.addSummaryComponentChangeListener(this._handleComponentChange); + }, + /** @inheriteddoc */ + componentWillUnMount: function cartridgeWillUnMount(){ + applicationStore.removeSummaryComponentChangeListener(this._onComponentChange); + }, + _getStateFromStore: function getCartridgeStateFromStore(){ + return {summaryComponent: applicationStore.getSummaryComponent() || {component: 'div', props: {}}}; + }, + _handleComponentChange: function _handleComponentChangeBarSummary(){ + this.setState(this._getStateFromStore()); + }, + /** @inheriteddoc */ + render: function renderBar() { + var className = `bar ${this.props.style.className}`; + return ( + <div className={className} data-focus='bar'> + <div className='applicationName'>{this.props.appName}</div> + <this.state.summaryComponent.component {...this.state.summaryComponent.props}/> + </div> + ); + } +}; + +module.exports = builder(barMixin);
a8836a562b1a7d1f0d4a4f59f9c30c3b46ca7318
grid-packages/ag-grid-docs/src/javascript-charts-axis/axis-tick-count/main.js
grid-packages/ag-grid-docs/src/javascript-charts-axis/axis-tick-count/main.js
var options = { container: document.getElementById('myChart'), data: generateSpiralData(), series: [{ type: 'line', xKey: 'x', yKey: 'y', marker: { enabled: false } }], axes: [ { type: 'number', position: 'bottom', tick: { count: 10, }, }, { type: 'number', position: 'left', tick: { count: 10, }, } ], legend: { enabled: false } }; var chart = agCharts.AgChart.create(options); function setTickCountTo5() { chart.axes[0].tick.count = 5; chart.axes[1].tick.count = 5; chart.performLayout(); } function setTickCountTo10() { chart.axes[0].tick.count = 10; chart.axes[1].tick.count = 10; chart.performLayout(); } function generateSpiralData() { var a = 1; var b = 1; var data = []; var step = 0.1; for (var th = 1; th < 50; th += step) { var r = a + b * th; var datum = { x: r * Math.cos(th), y: r * Math.sin(th) }; data.push(datum); } return data; }
var options = { container: document.getElementById('myChart'), data: generateSpiralData(), series: [{ type: 'line', xKey: 'x', yKey: 'y', marker: { enabled: false } }], axes: [ { type: 'number', position: 'bottom', tick: { count: 10, }, }, { type: 'number', position: 'left', tick: { count: 10, }, } ], legend: { enabled: false } }; var chart = agCharts.AgChart.create(options); function setTickCountTo5() { options.axes[0].tick.count = 5; options.axes[1].tick.count = 5; agCharts.AgChart.update(chart, options); } function setTickCountTo10() { options.axes[0].tick.count = 10; options.axes[1].tick.count = 10; agCharts.AgChart.update(chart, options); } function generateSpiralData() { var a = 1; var b = 1; var data = []; var step = 0.1; for (var th = 1; th < 50; th += step) { var r = a + b * th; var datum = { x: r * Math.cos(th), y: r * Math.sin(th) }; data.push(datum); } return data; }
Fix "Axis Tick Styling" example.
Fix "Axis Tick Styling" example.
JavaScript
mit
ceolter/ag-grid,ceolter/ag-grid,ceolter/angular-grid,ceolter/angular-grid
--- +++ @@ -32,15 +32,15 @@ var chart = agCharts.AgChart.create(options); function setTickCountTo5() { - chart.axes[0].tick.count = 5; - chart.axes[1].tick.count = 5; - chart.performLayout(); + options.axes[0].tick.count = 5; + options.axes[1].tick.count = 5; + agCharts.AgChart.update(chart, options); } function setTickCountTo10() { - chart.axes[0].tick.count = 10; - chart.axes[1].tick.count = 10; - chart.performLayout(); + options.axes[0].tick.count = 10; + options.axes[1].tick.count = 10; + agCharts.AgChart.update(chart, options); } function generateSpiralData() {
87888fd4f68dc0c34fb84e3b13cdc420befe7b9a
app/assets/javascripts/express_admin/utility.js
app/assets/javascripts/express_admin/utility.js
$(function() { // toggle on/off switch $(document).on('click', '[data-toggle]', function() { targetHide = $(this).data('toggle-hide') targetShow = $(this).data('toggle-show') $('[data-toggle-name="' + targetHide + '"]').addClass('hide') $('[data-toggle-name="' + targetShow + '"]').removeClass('hide') .find('input:text, textarea').first().focus() }); // AJAX request utility AJAXRequest = function(url, method, data, success, error) { return $.ajax({ url : url, type : method, data : data, dataType : 'JSON', cache : false, success : function(json) { success(json) }, error : function() { error() } }); } });
$(function() { // toggle on/off switch $(document).on('click', '[data-toggle]', function() { targetHide = $(this).data('toggle-hide') targetShow = $(this).data('toggle-show') $('[data-toggle-name="' + targetHide + '"]').addClass('hide') $('[data-toggle-name="' + targetShow + '"]').removeClass('hide') }); // AJAX request utility AJAXRequest = function(url, method, data, success, error) { return $.ajax({ url : url, type : method, data : data, dataType : 'JSON', cache : false, success : function(json) { success(json) }, error : function() { error() } }); } });
Remove the auto focus on element toggle feature
Remove the auto focus on element toggle feature
JavaScript
mit
aelogica/express_admin,aelogica/express_admin,aelogica/express_admin,aelogica/express_admin
--- +++ @@ -6,7 +6,6 @@ targetShow = $(this).data('toggle-show') $('[data-toggle-name="' + targetHide + '"]').addClass('hide') $('[data-toggle-name="' + targetShow + '"]').removeClass('hide') - .find('input:text, textarea').first().focus() }); // AJAX request utility
071ac08d6ef28b1dd39224a4bf4df24140203056
backend/app/assets/javascripts/spree/backend/product_picker.js
backend/app/assets/javascripts/spree/backend/product_picker.js
$.fn.productAutocomplete = function (options) { 'use strict' // Default options options = options || {} var multiple = typeof (options.multiple) !== 'undefined' ? options.multiple : true function formatProduct (product) { return Select2.util.escapeMarkup(product.name) } function formatProductList(products) { var formatted_data = $.map(products, function (obj) { var item = { id: obj.id, text: obj.name } return item }); return formatted_data } this.select2({ multiple: true, minimumInputLength: 3, ajax: { url: Spree.routes.products_api, dataType: 'json', data: function (params) { var query = { q: { name_or_master_sku_cont: params.term }, m: 'OR', token: Spree.api_key } return query; }, processResults: function(data) { var products = data.products ? data.products : [] var results = formatProductList(products) return { results: results } } }, templateSelection: function(data, container) { return data.text } }) } $(document).ready(function () { $('.product_picker').productAutocomplete() })
$.fn.productAutocomplete = function (options) { 'use strict' // Default options options = options || {} var multiple = typeof (options.multiple) !== 'undefined' ? options.multiple : true function formatProduct (product) { return Select2.util.escapeMarkup(product.name) } function formatProductList(products) { var formatted_data = $.map(products, function (obj) { var item = { id: obj.id, text: obj.name } return item }); return formatted_data } this.select2({ multiple: true, minimumInputLength: 3, ajax: { url: Spree.routes.products_api, dataType: 'json', data: function (params) { return { q: { name_or_master_sku_cont: params.term }, m: 'OR', token: Spree.api_key } }, processResults: function(data) { var products = data.products ? data.products : [] var results = formatProductList(products) return { results: results } } }, templateSelection: function(data, container) { return data.text } }).on("select2:unselect", function (e) { if($(this).select2('data').length == 0) { $('<input>').attr({ type: 'hidden', name: this.name, value: '', id: this.id }).appendTo('form.edit_promotion') } }).on('select2:select', function(e) { $('input#'+this.id).remove() }) } $(document).ready(function () { $('.product_picker').productAutocomplete() })
Fix remove last element from select box
Fix remove last element from select box
JavaScript
bsd-3-clause
imella/spree,imella/spree,imella/spree
--- +++ @@ -25,15 +25,13 @@ url: Spree.routes.products_api, dataType: 'json', data: function (params) { - var query = { + return { q: { name_or_master_sku_cont: params.term }, m: 'OR', token: Spree.api_key } - - return query; }, processResults: function(data) { var products = data.products ? data.products : [] @@ -47,8 +45,13 @@ templateSelection: function(data, container) { return data.text } + }).on("select2:unselect", function (e) { + if($(this).select2('data').length == 0) { + $('<input>').attr({ type: 'hidden', name: this.name, value: '', id: this.id }).appendTo('form.edit_promotion') + } + }).on('select2:select', function(e) { + $('input#'+this.id).remove() }) - } $(document).ready(function () {
f0ecaecbe12972301e5c8044d9613f1b46b8a4ec
src/components/navigation/Navbar.js
src/components/navigation/Navbar.js
import React from 'react' import { Link } from 'react-router' import { ElloMark } from '../iconography/ElloIcons' class Navbar extends React.Component { render() { return ( <nav className="Navbar" role="navigation"> <Link to="/"> <ElloMark /> </Link> <div className="NavbarLinks"> <Link to="/discover">Discover</Link> <Link to="/search">Search</Link> <Link to="/onboarding/channels">Onboarding</Link> </div> </nav> ) } } export default Navbar
import React from 'react' import Mousetrap from 'mousetrap' import { Link } from 'react-router' import { ElloMark } from '../iconography/ElloIcons' import { SHORTCUT_KEYS } from '../../constants/action_types' const shortcuts = { [SHORTCUT_KEYS.SEARCH]: '/search', [SHORTCUT_KEYS.DISCOVER]: '/discover', [SHORTCUT_KEYS.ONBOARDING]: '/onboarding/channels', } class Navbar extends React.Component { componentDidMount() { Mousetrap.bind(Object.keys(shortcuts), (event, shortcut) => { const { router } = this.context router.transitionTo(shortcuts[shortcut]) }) } componentWillUnmount() { Mousetrap.unbind(Object.keys(shortcuts)) } render() { return ( <nav className="Navbar" role="navigation"> <Link to="/"> <ElloMark /> </Link> <div className="NavbarLinks"> <Link to="/discover">Discover</Link> <Link to="/search">Search</Link> <Link to="/onboarding/channels">Onboarding</Link> </div> </nav> ) } } Navbar.contextTypes = { router: React.PropTypes.object.isRequired, } export default Navbar
Add shortcut keys for the main navigation
Add shortcut keys for the main navigation
JavaScript
mit
ello/webapp,ello/webapp,ello/webapp
--- +++ @@ -1,8 +1,28 @@ import React from 'react' +import Mousetrap from 'mousetrap' import { Link } from 'react-router' import { ElloMark } from '../iconography/ElloIcons' +import { SHORTCUT_KEYS } from '../../constants/action_types' + + +const shortcuts = { + [SHORTCUT_KEYS.SEARCH]: '/search', + [SHORTCUT_KEYS.DISCOVER]: '/discover', + [SHORTCUT_KEYS.ONBOARDING]: '/onboarding/channels', +} class Navbar extends React.Component { + componentDidMount() { + Mousetrap.bind(Object.keys(shortcuts), (event, shortcut) => { + const { router } = this.context + router.transitionTo(shortcuts[shortcut]) + }) + } + + componentWillUnmount() { + Mousetrap.unbind(Object.keys(shortcuts)) + } + render() { return ( <nav className="Navbar" role="navigation"> @@ -19,5 +39,9 @@ } } +Navbar.contextTypes = { + router: React.PropTypes.object.isRequired, +} + export default Navbar
1af5312c5a4f8e3561e052525480d6ce6cde07b9
src/platforms/electron/startSandbox.js
src/platforms/electron/startSandbox.js
import express from 'express'; import unpackByOutpoint from './unpackByOutpoint'; // Polyfills and `lbry-redux` global.fetch = require('node-fetch'); global.window = global; if (typeof global.fetch === 'object') { global.fetch = global.fetch.default; } const { Lbry } = require('lbry-redux'); delete global.window; export default async function startSandbox() { const port = 5278; const sandbox = express(); sandbox.get('/set/:outpoint', async (req, res) => { const { outpoint } = req.params; const resolvedPath = await unpackByOutpoint(Lbry, outpoint); sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath)); res.send(`/sandbox/${outpoint}/`); }); sandbox .listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`)) .on('error', err => { if (err.code === 'EADDRINUSE') { console.log( 'Server already listening at localhost://5278: This is probably another LBRY app running. If not, games in the app will not work.' ); } }); }
import express from 'express'; import unpackByOutpoint from './unpackByOutpoint'; // Polyfills and `lbry-redux` global.fetch = require('node-fetch'); global.window = global; if (typeof global.fetch === 'object') { global.fetch = global.fetch.default; } const { Lbry } = require('lbry-redux'); delete global.window; export default async function startSandbox() { const port = 5278; const sandbox = express(); sandbox.get('/set/:outpoint', async (req, res) => { const { outpoint } = req.params; const resolvedPath = await unpackByOutpoint(Lbry, outpoint); sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath)); res.send(`/sandbox/${outpoint}/`); }); sandbox .listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`)) .on('error', err => { if (err.code === 'EADDRINUSE') { console.log( `Server already listening at localhost:${port}. This is probably another LBRY app running. If not, games in the app will not work.` ); } }); }
Use port from variable instead of hard coding
Use port from variable instead of hard coding ### Changes 1. Edited error description to add port's value from variable instead of hard coding. Also removed redundant `//` between localhost and port.
JavaScript
mit
lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron
--- +++ @@ -31,7 +31,7 @@ .on('error', err => { if (err.code === 'EADDRINUSE') { console.log( - 'Server already listening at localhost://5278: This is probably another LBRY app running. If not, games in the app will not work.' + `Server already listening at localhost:${port}. This is probably another LBRY app running. If not, games in the app will not work.` ); } });
8527c947f131b9c430041943b3596b46d65b54ec
src/controllers/post-controller.js
src/controllers/post-controller.js
import BlogPost from '../database/models/blog-post'; import log from '../log'; const PUBLIC_API_ATTRIBUTES = [ 'id', 'title', 'link', 'description', 'date_updated', 'date_published', 'author_id' ]; const DEFAULT_ORDER = [ ['date_published', 'DESC'] ]; export function getAll() { return new Promise((resolve, reject) => { BlogPost.findAll({ attributes: PUBLIC_API_ATTRIBUTES, order: DEFAULT_ORDER, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting list of all posts'); reject(error); }); }); } export function getById(id) { return new Promise((resolve, reject) => { BlogPost.findOne({ attributes: PUBLIC_API_ATTRIBUTES, where: { id }, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting blog post by id'); reject(error); }); }); } export function getPage(pageNumber, pageSize) { return new Promise((resolve, reject) => { BlogPost.findAll({ attributes: PUBLIC_API_ATTRIBUTES, order: DEFAULT_ORDER, offset: pageNumber * pageSize, limit: pageSize, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting page of posts'); reject(error); }); }); }
import BlogPost from '../database/models/blog-post'; import log from '../log'; const PUBLIC_API_ATTRIBUTES = [ 'id', 'title', 'link', 'image_uri', 'description', 'date_updated', 'date_published', 'author_id' ]; const DEFAULT_ORDER = [ ['date_published', 'DESC'] ]; export function getAll() { return new Promise((resolve, reject) => { BlogPost.findAll({ attributes: PUBLIC_API_ATTRIBUTES, order: DEFAULT_ORDER, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting list of all posts'); reject(error); }); }); } export function getById(id) { return new Promise((resolve, reject) => { BlogPost.findOne({ attributes: PUBLIC_API_ATTRIBUTES, where: { id }, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting blog post by id'); reject(error); }); }); } export function getPage(pageNumber, pageSize) { return new Promise((resolve, reject) => { BlogPost.findAll({ attributes: PUBLIC_API_ATTRIBUTES, order: DEFAULT_ORDER, offset: pageNumber * pageSize, limit: pageSize, raw: true }) .then(resolve) .catch(error => { log.error({ error }, 'Error getting page of posts'); reject(error); }); }); }
Allow image_uri to be part of the public API
Allow image_uri to be part of the public API
JavaScript
mit
csblogs/api-server,csblogs/api-server
--- +++ @@ -5,6 +5,7 @@ 'id', 'title', 'link', + 'image_uri', 'description', 'date_updated', 'date_published',
ad6916c838d96bc3b2a29678aca4b60dc098d9a7
client/app/components/graph/graph.controller.js
client/app/components/graph/graph.controller.js
import _ from 'lodash' class GraphController { constructor() { this.prepareData(); } prepareData() { // I am assuming the reference object is always sent // at position 0 so I will not be figuring that out let series = []; let labels = []; this.demodata.map(function (item) { let indexes = item.variables.indexes; labels = _.keys(indexes); series.push(_.values(indexes)); }); this.series = series; this.labels = labels; } } export default GraphController;
import _ from 'lodash' class GraphController { constructor() { this.prepareData(); } capitalize(string) { return string.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); } prepareData() { // I am assuming the reference object is always sent // at position 0 so I will not be figuring that out let series = []; let labels = []; this.demodata.map(function (item) { let indexes = item.variables.indexes; labels = _.keys(indexes); series.push(_.values(indexes)); }); this.series = series; this.labels = this.prettyLabels(labels); } prettyLabels(labels) { return labels.map((label) => { return this.capitalize(label.replace('_', ' ')); }) } } export default GraphController;
Make the graph labels nicer
Make the graph labels nicer
JavaScript
apache-2.0
wojtekgalaj/webpack-interview-exercise,wojtekgalaj/webpack-interview-exercise
--- +++ @@ -3,6 +3,10 @@ class GraphController { constructor() { this.prepareData(); + } + + capitalize(string) { + return string.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); } prepareData() { @@ -18,7 +22,13 @@ }); this.series = series; - this.labels = labels; + this.labels = this.prettyLabels(labels); + } + + prettyLabels(labels) { + return labels.map((label) => { + return this.capitalize(label.replace('_', ' ')); + }) } }
2be8ae444d43d27c5e7e8eaadc6fb0998cde65a8
src/components/navbar/SearchMixin.js
src/components/navbar/SearchMixin.js
/* By default the search is hidden. When you add a component on the page that wants to use the search, * then add this as a mixin. It will use CSS to activate the search while the component is shown. * * WARNING: this assumes that it is called within a <keep-alive> tag, therefore it listens * at activated/deactivated lifecycle hooks. */ export default { data () { return { searchTerm: '' } }, activated: function () { this.eventbus.$emit('search.visible', true) }, deactivated: function () { this.eventbus.$emit('search.visible', false) }, created () { this.eventbus.$on('search.term', this.searchEventReceived) this.eventbus.$emit('search.init') }, beforeDestroy: function () { this.eventbus.$off('search.term', this.searchEventReceived) }, methods: { searchEventReceived (term) { this.searchTerm = term } } }
/* By default the search is hidden. When you add a component on the page that wants to use the search, * then add this as a mixin. It will use CSS to activate the search while the component is shown. * * WARNING: this assumes that it is called within a <keep-alive> tag, therefore it listens * at activated/deactivated lifecycle hooks. */ export default { data () { return { searchTerm: '' } }, activated: function () { this.eventbus.$emit('search.reset') this.eventbus.$emit('search.visible', true) }, deactivated: function () { this.eventbus.$emit('search.visible', false) }, created () { this.eventbus.$on('search.term', this.searchEventReceived) this.eventbus.$emit('search.init') }, beforeDestroy: function () { this.eventbus.$off('search.term', this.searchEventReceived) }, methods: { searchEventReceived (term) { this.searchTerm = term } } }
Reset search on page change
Reset search on page change
JavaScript
mit
dukecon/dukecon_pwa,dukecon/dukecon_pwa,dukecon/dukecon_pwa
--- +++ @@ -11,6 +11,7 @@ } }, activated: function () { + this.eventbus.$emit('search.reset') this.eventbus.$emit('search.visible', true) }, deactivated: function () {
8091c80faced7df102973a726179662a7fd3f2c9
src/zeit/content/cp/browser/resources/area.js
src/zeit/content/cp/browser/resources/area.js
(function ($) { var FIELDS = { 'centerpage': 'referenced_cp', 'channel': 'query', 'query': 'raw_query' }; var show_matching_field = function(container, current_type) { $(['referenced_cp', 'query', 'raw_query']).each(function(i, field) { var method = field == FIELDS[current_type] ? 'show' : 'hide'; var target = $('.fieldname-' + field, container).closest('fieldset'); target[method](); }); }; $(document).bind('fragment-ready', function(event) { var type_select = $('.fieldname-automatic_type select', event.__target); show_matching_field(event.__target, type_select.val()); type_select.on( 'change', function() { show_matching_field(event.__target, $(this).val()); }); }); }(jQuery));
(function ($) { var FIELDS = { 'centerpage': 'referenced_cp', 'channel': 'query', 'query': 'raw_query' }; var show_matching_field = function(container, current_type) { $(['referenced_cp', 'query', 'raw_query']).each(function(i, field) { var method = field == FIELDS[current_type] ? 'show' : 'hide'; var target = $('.fieldname-' + field, container).closest('fieldset'); target[method](); }); }; $(document).bind('fragment-ready', function(event) { var type_select = $('.fieldname-automatic_type select', event.__target); if (! type_select.length) { return; } show_matching_field(event.__target, type_select.val()); type_select.on( 'change', function() { show_matching_field(event.__target, $(this).val()); }); }); }(jQuery));
Exit fragment-ready event handler when it's from a non-applicable fragment
Exit fragment-ready event handler when it's from a non-applicable fragment
JavaScript
bsd-3-clause
ZeitOnline/zeit.content.cp,ZeitOnline/zeit.content.cp
--- +++ @@ -18,6 +18,9 @@ $(document).bind('fragment-ready', function(event) { var type_select = $('.fieldname-automatic_type select', event.__target); + if (! type_select.length) { + return; + } show_matching_field(event.__target, type_select.val()); type_select.on( 'change', function() {
0442b430be43b04580abcdcc7cdbbbaed5540c44
src/lights/DirectionalLightShadow.js
src/lights/DirectionalLightShadow.js
import { LightShadow } from './LightShadow.js'; import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; /** * @author mrdoob / http://mrdoob.com/ */ function DirectionalLightShadow( ) { LightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); } DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { constructor: DirectionalLightShadow } ); export { DirectionalLightShadow };
import { LightShadow } from './LightShadow.js'; import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; /** * @author mrdoob / http://mrdoob.com/ */ function DirectionalLightShadow() { LightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); } DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { constructor: DirectionalLightShadow, isDirectionalLightShadow: true, updateMatrices: function ( light, viewCamera, viewportIndex ) { var camera = this.camera, lightPositionWorld = this._lightPositionWorld, lookTarget = this._lookTarget; lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); camera.position.copy( lightPositionWorld ); lookTarget.setFromMatrixPosition( light.target.matrixWorld ); camera.lookAt( lookTarget ); camera.updateMatrixWorld(); LightShadow.prototype.updateMatrices.call( this, light, viewCamera, viewportIndex ); } } ); export { DirectionalLightShadow };
Add matrix calcs to direction shadow class
Add matrix calcs to direction shadow class
JavaScript
mit
Liuer/three.js,greggman/three.js,TristanVALCKE/three.js,zhoushijie163/three.js,Samsy/three.js,donmccurdy/three.js,jpweeks/three.js,mrdoob/three.js,SpinVR/three.js,greggman/three.js,stanford-gfx/three.js,TristanVALCKE/three.js,looeee/three.js,Itee/three.js,Samsy/three.js,aardgoose/three.js,TristanVALCKE/three.js,looeee/three.js,donmccurdy/three.js,fraguada/three.js,Samsy/three.js,TristanVALCKE/three.js,fraguada/three.js,fraguada/three.js,TristanVALCKE/three.js,Itee/three.js,WestLangley/three.js,Liuer/three.js,fraguada/three.js,makc/three.js.fork,mrdoob/three.js,Samsy/three.js,kaisalmen/three.js,WestLangley/three.js,jpweeks/three.js,Samsy/three.js,gero3/three.js,TristanVALCKE/three.js,fraguada/three.js,06wj/three.js,zhoushijie163/three.js,SpinVR/three.js,aardgoose/three.js,fyoudine/three.js,gero3/three.js,QingchaoHu/three.js,QingchaoHu/three.js,fraguada/three.js,makc/three.js.fork,fyoudine/three.js,stanford-gfx/three.js,Samsy/three.js,06wj/three.js,kaisalmen/three.js
--- +++ @@ -5,7 +5,7 @@ * @author mrdoob / http://mrdoob.com/ */ -function DirectionalLightShadow( ) { +function DirectionalLightShadow() { LightShadow.call( this, new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) ); @@ -13,7 +13,26 @@ DirectionalLightShadow.prototype = Object.assign( Object.create( LightShadow.prototype ), { - constructor: DirectionalLightShadow + constructor: DirectionalLightShadow, + + isDirectionalLightShadow: true, + + updateMatrices: function ( light, viewCamera, viewportIndex ) { + + var camera = this.camera, + lightPositionWorld = this._lightPositionWorld, + lookTarget = this._lookTarget; + + lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); + camera.position.copy( lightPositionWorld ); + + lookTarget.setFromMatrixPosition( light.target.matrixWorld ); + camera.lookAt( lookTarget ); + camera.updateMatrixWorld(); + + LightShadow.prototype.updateMatrices.call( this, light, viewCamera, viewportIndex ); + + } } );
5c4cae3e2e64e35e41dd3a210592846f130f3171
chrome/background.js
chrome/background.js
// this idea borrowed from // https://www.planbox.com/blog/development/coding/bypassing-githubs-content-security-policy-chrome-extension.html chrome.webRequest.onHeadersReceived.addListener(function(details) { for (i = 0; i < details.responseHeaders.length; i++) { if (isCSPHeader(details.responseHeaders[i].name.toUpperCase())) { var csp = details.responseHeaders[i].value; csp = csp.replace("media-src 'none'", "media-src 'self' blob:"); details.responseHeaders[i].value = csp; } } return { // Return the new HTTP header responseHeaders: details.responseHeaders }; }, { urls: ["*://github.com/*"], types: ["main_frame"] }, ["blocking", "responseHeaders"]); function isCSPHeader(headerName) { return (headerName == 'CONTENT-SECURITY-POLICY') || (headerName == 'X-WEBKIT-CSP'); }
// this idea borrowed from // https://www.planbox.com/blog/development/coding/bypassing-githubs-content-security-policy-chrome-extension.html chrome.webRequest.onHeadersReceived.addListener(function(details) { for (i = 0; i < details.responseHeaders.length; i++) { if (isCSPHeader(details.responseHeaders[i].name.toUpperCase())) { var csp = details.responseHeaders[i].value; csp = csp.replace("media-src 'none'", "media-src 'self' blob:"); csp = csp.replace("connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com", "connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com api.imgur.com"); details.responseHeaders[i].value = csp; } } return { // Return the new HTTP header responseHeaders: details.responseHeaders }; }, { urls: ["*://github.com/*"], types: ["main_frame"] }, ["blocking", "responseHeaders"]); function isCSPHeader(headerName) { return (headerName == 'CONTENT-SECURITY-POLICY') || (headerName == 'X-WEBKIT-CSP'); }
Handle GitHub's updated Content Security Policy
Handle GitHub's updated Content Security Policy It looks like GitHub changed their CSP recently. This extension didn't work for me until I added this code.
JavaScript
mit
thieman/github-selfies,thieman/github-selfies
--- +++ @@ -7,6 +7,8 @@ if (isCSPHeader(details.responseHeaders[i].name.toUpperCase())) { var csp = details.responseHeaders[i].value; csp = csp.replace("media-src 'none'", "media-src 'self' blob:"); + csp = csp.replace("connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com", + "connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com api.imgur.com"); details.responseHeaders[i].value = csp; }
9f143c518269d8a14b9c40964dda586aa27a6d37
client/src/app.js
client/src/app.js
import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import MonthDetail from './components/pages/History/MonthDetail'; import HomePage from './components/pages/Home'; import SignupPage from './components/pages/Signup'; import LoginPage from './components/pages/Login'; import StopWatchPage from './components/pages/StopWatch'; import HistoryPage from './components/pages/History'; import PrivateRoute from './components/PrivateRoute'; import NotFoundPage from './components/NotFoundPage'; import NavBar from './components/NavBar'; import './styles.css'; class App extends Component { render () { return ( <Router> <div> <NavBar /> <Switch> <Route exact path="/" component={HomePage} /> <Route path="/signup" component={SignupPage} /> <Route path="/login" component={LoginPage} /> <Route path="/stopwatch" component={StopWatchPage} /> <PrivateRoute exact path="/history" component={HistoryPage} /> <PrivateRoute path="/history/:month" component={MonthDetail} /> <Route component={NotFoundPage} /> </Switch> </div> </Router> ); } } export default App;
import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import MonthDetail from './components/pages/History/MonthDetail'; import HomePage from './components/pages/Home'; import SignupPage from './components/pages/Signup'; import LoginPage from './components/pages/Login'; import StopWatchPage from './components/pages/StopWatch'; import HistoryPage from './components/pages/History'; import PrivateRoute from './components/PrivateRoute'; import NotFoundPage from './components/NotFoundPage'; import NavBar from './components/NavBar'; import './styles.css'; class App extends Component { render () { return ( <Router> <div> <NavBar /> <Switch> <Route exact path="/" component={HomePage} /> <Route path="/signup" component={SignupPage} /> <Route path="/login" component={LoginPage} /> <PrivateRoute path="/stopwatch" component={StopWatchPage} /> <PrivateRoute exact path="/history" component={HistoryPage} /> <PrivateRoute path="/history/:month" component={MonthDetail} /> <Route component={NotFoundPage} /> </Switch> </div> </Router> ); } } export default App;
Add stopwatch as auth protected route
Add stopwatch as auth protected route
JavaScript
mit
mbchoa/presence,mbchoa/presence
--- +++ @@ -27,7 +27,7 @@ <Route exact path="/" component={HomePage} /> <Route path="/signup" component={SignupPage} /> <Route path="/login" component={LoginPage} /> - <Route path="/stopwatch" component={StopWatchPage} /> + <PrivateRoute path="/stopwatch" component={StopWatchPage} /> <PrivateRoute exact path="/history" component={HistoryPage} /> <PrivateRoute path="/history/:month" component={MonthDetail} /> <Route component={NotFoundPage} />
26f51f95a8547f8a6e7067856b432183ef9908ef
draft-js-image-plugin/src/modifiers/addImage.js
draft-js-image-plugin/src/modifiers/addImage.js
import { EditorState, AtomicBlockUtils, } from 'draft-js'; export default (editorState, url, extraData) => { const urlType = 'image'; const contentState = editorState.getCurrentContent(); const contentStateWithEntity = contentState.createEntity(urlType, 'IMMUTABLE', { ...extraData, src: url }); const entityKey = contentStateWithEntity.getLastCreatedEntityKey(); const newEditorState = AtomicBlockUtils.insertAtomicBlock( editorState, entityKey, ' ' ); return EditorState.forceSelection( newEditorState, editorState.getCurrentContent().getSelectionAfter() ); };
import { EditorState, AtomicBlockUtils, } from 'draft-js'; export default (editorState, url, extraData) => { const urlType = 'image'; const contentState = editorState.getCurrentContent(); const contentStateWithEntity = contentState.createEntity(urlType, 'IMMUTABLE', { ...extraData, src: url }); const entityKey = contentStateWithEntity.getLastCreatedEntityKey(); const newEditorState = AtomicBlockUtils.insertAtomicBlock( editorState, entityKey, ' ' ); return EditorState.forceSelection( newEditorState, newEditorState.getCurrentContent().getSelectionAfter() ); };
Move cursor after image when inserting
Move cursor after image when inserting
JavaScript
mit
nikgraf/draft-js-plugin-editor,draft-js-plugins/draft-js-plugins,nikgraf/draft-js-plugin-editor,nikgraf/draft-js-plugin-editor,draft-js-plugins/draft-js-plugins,draft-js-plugins/draft-js-plugins,draft-js-plugins/draft-js-plugins
--- +++ @@ -15,6 +15,6 @@ ); return EditorState.forceSelection( newEditorState, - editorState.getCurrentContent().getSelectionAfter() + newEditorState.getCurrentContent().getSelectionAfter() ); };
7f80989cb19f31de01fffcc2976939bf095b0c0d
apps/jsdoc/actions.js
apps/jsdoc/actions.js
include('helma/webapp/response'); include('helma/engine'); include('helma/jsdoc'); require('core/array'); exports.index = function index(req, module) { var repo = new ScriptRepository(getRepositories()[1]); if (module && module != "/") { var jsdoc = []; res = repo.getScriptResource(module); var currentDoc; parseScriptResource(res, function(node) { if (node.jsDoc) { currentDoc = extractTags(node.jsDoc) print(currentDoc[0][1]); jsdoc.push(currentDoc); } else { print(getTypeName(node) + " // " + getName(node)); if (isName(node) && getName(node) != "exports" && currentDoc && !currentDoc.name) { Object.defineProperty(currentDoc, 'name', {value: getName(node)}); } } return true; }); return new SkinnedResponse(getResource('./skins/module.html'), { title: "Module " + res.moduleName, jsdoc: jsdoc }); } else { var modules = repo.getScriptResources(true).sort(function(a, b) {return a.relativePath > b.relativePath}); return new SkinnedResponse(getResource('./skins/index.html'), { title: "API Documentation", modules: modules }); } }
include('helma/webapp/response'); include('helma/engine'); include('helma/jsdoc'); require('core/array'); exports.index = function index(req, module) { var repo = new ScriptRepository(getRepositories()[1]); if (module && module != "/") { var jsdoc = []; var res = repo.getScriptResource(module); var currentDoc; parseScriptResource(res, function(node) { if (node.jsDoc) { currentDoc = extractTags(node.jsDoc) // print(currentDoc[0][1]); jsdoc.push(currentDoc); } else { // print(getTypeName(node) + " // " + getName(node)); if (isName(node) && getName(node) != "exports" && currentDoc && !currentDoc.name) { Object.defineProperty(currentDoc, 'name', {value: getName(node)}); } } return true; }); return new SkinnedResponse(getResource('./skins/module.html'), { title: "Module " + res.moduleName, jsdoc: jsdoc }); } else { var modules = repo.getScriptResources(true).sort(function(a, b) {return a.relativePath > b.relativePath}); return new SkinnedResponse(getResource('./skins/index.html'), { title: "API Documentation", modules: modules }); } }
Disable debug output, add missing var
Disable debug output, add missing var
JavaScript
apache-2.0
ringo/ringojs,ashwinrayaprolu1984/ringojs,ringo/ringojs,ashwinrayaprolu1984/ringojs,oberhamsi/ringojs,ashwinrayaprolu1984/ringojs,Transcordia/ringojs,Transcordia/ringojs,oberhamsi/ringojs,ashwinrayaprolu1984/ringojs,ringo/ringojs,oberhamsi/ringojs,Transcordia/ringojs,ringo/ringojs,Transcordia/ringojs
--- +++ @@ -7,15 +7,15 @@ var repo = new ScriptRepository(getRepositories()[1]); if (module && module != "/") { var jsdoc = []; - res = repo.getScriptResource(module); + var res = repo.getScriptResource(module); var currentDoc; parseScriptResource(res, function(node) { if (node.jsDoc) { currentDoc = extractTags(node.jsDoc) - print(currentDoc[0][1]); + // print(currentDoc[0][1]); jsdoc.push(currentDoc); } else { - print(getTypeName(node) + " // " + getName(node)); + // print(getTypeName(node) + " // " + getName(node)); if (isName(node) && getName(node) != "exports" && currentDoc && !currentDoc.name) { Object.defineProperty(currentDoc, 'name', {value: getName(node)}); }
ca2c3bf7d57284eaaf8e9be69c6c15746fcd5bde
src/components/ComponentizeContent.js
src/components/ComponentizeContent.js
import { node, object, oneOfType, string } from 'prop-types' import Bit from './Bit' import Code from './Code' import HTML from 'html-parse-stringify' import React from 'react' import reactify from '../util/reactify' import Image from './Image' import Rule from './Rule' import Paragraph from './Paragraph' const DEFAULT_MAPPINGS = { // TODO: Add stemcell components and add API endpoint for end-user mappings code: Code, hr: Rule, img: Image, p: Paragraph } // TODO: Move this to optional package? const ComponentizeContent = ({ children, ...props }) => { if (!children || typeof children !== 'string') { return children } const ast = HTML.parse(`<div>${children}</div>`) const reparsedAst = reactify(ast, { mappings: DEFAULT_MAPPINGS }) return ( <Bit {...props}> {reparsedAst} </Bit> ) } ComponentizeContent.propTypes = { children: node, className: oneOfType([object, string]) } export default ComponentizeContent
import { node, object, oneOfType, string } from 'prop-types' import Bit from './Bit' import Code from './Code' import HTML from 'html-parse-stringify' import React from 'react' import reactify from '../util/reactify' import Image from './Image' import Rule from './Rule' import Paragraph from './Paragraph' const DEFAULT_MAPPINGS = { // TODO: Add stemcell components and add API endpoint for end-user mappings code: Code, hr: Rule, img: Image, p: Paragraph } // TODO: Move this to optional package? const ComponentizeContent = ({ children, ...props }) => { if (!children) { return null } if (typeof children !== 'string') { return children } const ast = HTML.parse(`<div>${children}</div>`) const reparsedAst = reactify(ast, { mappings: DEFAULT_MAPPINGS }) return ( <Bit {...props}> {reparsedAst} </Bit> ) } ComponentizeContent.propTypes = { children: node, className: oneOfType([object, string]) } export default ComponentizeContent
Add better fix for handling invalid markdown inputs
Add better fix for handling invalid markdown inputs
JavaScript
mit
dlindahl/stemcell,dlindahl/stemcell
--- +++ @@ -18,7 +18,10 @@ // TODO: Move this to optional package? const ComponentizeContent = ({ children, ...props }) => { - if (!children || typeof children !== 'string') { + if (!children) { + return null + } + if (typeof children !== 'string') { return children } const ast = HTML.parse(`<div>${children}</div>`)
ce3ee6f2131314d395734ef0e69b89a5f62cf51d
gulp/continuous-integration.js
gulp/continuous-integration.js
'use strict'; var gulp = require('gulp'); gulp.task( 'ci', ['coding-standards', 'test', 'protractor', 'protractor:dist'] );
'use strict'; var gulp = require('gulp'); gulp.task( 'ci', ['coding-standards', 'test', 'protractor'] );
Remove protractor:dist from the ci task (gulp).
Remove protractor:dist from the ci task (gulp).
JavaScript
mit
algotech/angular-boilerplate,OroianRares/stock-prices,OroianRares/BrowserChatApp,OroianRares/angular-boilerplate,OroianRares/stock-prices,OroianRares/BrowserChatApp,algotech/angular-boilerplate,OroianRares/angular-boilerplate
--- +++ @@ -4,5 +4,5 @@ gulp.task( 'ci', - ['coding-standards', 'test', 'protractor', 'protractor:dist'] + ['coding-standards', 'test', 'protractor'] );
86abbdef8290ab8dda9553e1981f92382321a602
EdityMcEditface/wwwroot/edity/layouts/editComponents/source.js
EdityMcEditface/wwwroot/edity/layouts/editComponents/source.js
"use strict"; jsns.run([ "htmlrest.domquery", "htmlrest.storage", "htmlrest.rest", "htmlrest.controller", "htmlrest.widgets.navmenu", "edity.pageSourceSync" ], function (exports, module, domQuery, storage, rest, controller, navmenu, sourceSync) { function EditSourceController(bindings) { var editSourceDialog = bindings.getToggle('dialog'); var codemirrorElement = domQuery.first('#editSourceTextarea'); var cm = CodeMirror.fromTextArea(codemirrorElement, { lineNumbers: true, mode: "htmlmixed", theme: "edity" }); function apply(evt) { evt.preventDefault(); editSourceDialog.off(); sourceSync.setHtml(cm.getValue()); } this.apply = apply; function NavItemController() { function edit() { editSourceDialog.on(); cm.setValue(sourceSync.getHtml()); setTimeout(function () { cm.refresh(); }, 500); } this.edit = edit; } var editMenu = navmenu.getNavMenu("edit-nav-menu-items"); editMenu.add("EditSourceNavItem", NavItemController); } controller.create("editSource", EditSourceController); });
"use strict"; jsns.run([ "htmlrest.domquery", "htmlrest.storage", "htmlrest.rest", "htmlrest.controller", "htmlrest.widgets.navmenu", "edity.pageSourceSync" ], function (exports, module, domQuery, storage, rest, controller, navmenu, sourceSync) { function EditSourceController(bindings) { var editSourceDialog = bindings.getToggle('dialog'); var codemirrorElement = domQuery.first('#editSourceTextarea'); var cm = CodeMirror.fromTextArea(codemirrorElement, { lineNumbers: true, mode: "htmlmixed", theme: "edity" }); function apply(evt) { evt.preventDefault(); editSourceDialog.off(); sourceSync.setHtml(cm.getValue()); } this.apply = apply; function NavItemController() { function edit() { editSourceDialog.on(); cm.setSize(null, window.innerHeight - 250); cm.setValue(sourceSync.getHtml()); setTimeout(function () { cm.refresh(); }, 500); } this.edit = edit; } var editMenu = navmenu.getNavMenu("edit-nav-menu-items"); editMenu.add("EditSourceNavItem", NavItemController); } controller.create("editSource", EditSourceController); });
Set codemirror size when opening modal.
Set codemirror size when opening modal.
JavaScript
mit
threax/EdityMcEditface,threax/EdityMcEditface,threax/EdityMcEditface
--- +++ @@ -29,6 +29,7 @@ function NavItemController() { function edit() { editSourceDialog.on(); + cm.setSize(null, window.innerHeight - 250); cm.setValue(sourceSync.getHtml()); setTimeout(function () { cm.refresh();
8110d5ddc810886ca3bb7c72ac2908d05ec6176b
troposphere/static/js/controllers/projects.js
troposphere/static/js/controllers/projects.js
define(['react', 'collections/projects', 'models/project', 'rsvp'], function(React, Collection, Model, RSVP) { var projects = new Collection(); var getProjects = function() { return new RSVP.Promise(function(resolve, reject) { projects.fetch({ success: resolve, error: reject }); }); }; var createProject = function(name, description) { console.log(name, description); return new RSVP.Promise(function(resolve, reject) { var model = new Model(); model.save({name: name, description: description}, { success: function(model) { resolve(model); }, error: function(model, response) { reject(response); } }); }); }; return { create: createProject, get: getProjects }; });
define(['react', 'collections/projects', 'models/project', 'rsvp', 'controllers/notifications'], function(React, Collection, Model, RSVP, Notifications) { var projects = new Collection(); var getProjects = function() { return new RSVP.Promise(function(resolve, reject) { projects.fetch({ success: resolve, error: reject }); }); }; var createProject = function(name, description) { console.log(name, description); return new RSVP.Promise(function(resolve, reject) { var model = new Model(); model.save({name: name, description: description}, { success: function(model) { Notifications.success('Success', 'Created new project "' + model.get('name') + '"'); resolve(model); }, error: function(model, response) { reject(response); } }); }); }; return { create: createProject, get: getProjects }; });
Add success notifcation for project creation
Add success notifcation for project creation
JavaScript
apache-2.0
CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend
--- +++ @@ -1,4 +1,4 @@ -define(['react', 'collections/projects', 'models/project', 'rsvp'], function(React, Collection, Model, RSVP) { +define(['react', 'collections/projects', 'models/project', 'rsvp', 'controllers/notifications'], function(React, Collection, Model, RSVP, Notifications) { var projects = new Collection(); @@ -17,6 +17,7 @@ var model = new Model(); model.save({name: name, description: description}, { success: function(model) { + Notifications.success('Success', 'Created new project "' + model.get('name') + '"'); resolve(model); }, error: function(model, response) {
86e6616397397d0cdcda5aa0d89ee872429769b6
src/shared/components/login/login.js
src/shared/components/login/login.js
import React, { Component } from 'react'; import Modal from 'shared/components/modal/modal'; import Form from 'shared/components/form/form'; import FormEmail from 'shared/components/form/formEmail/formEmail'; import FormPassword from 'shared/components/form/formPassword/formPassword'; class Login extends Component { render() { return ( <div> <Modal> <Form> <FormEmail displayName="Username" /> <FormPassword displayName="Password" /> </Form> </Modal> </div> ); } } export default Login;
import React, { Component } from 'react'; import Modal from 'shared/components/modal/modal'; import Form from 'shared/components/form/form'; import { Redirect } from 'react-router-dom'; import axios from 'axios'; import config from 'config/environment'; import _ from 'lodash'; import FormEmail from 'shared/components/form/formEmail/formEmail'; import FormPassword from 'shared/components/form/formPassword/formPassword'; import FormButton from 'shared/components/form/formButton/formButton'; class Login extends Component { state = { email: '', emailValid: false, password: '', passwordValid: false, authenticated: false, error: '' } onEmailChange = (value, valid) => { this.setState({ email: value, emailValid: valid }); } onPasswordChange = (value, valid) => { this.setState({ password: value, passwordValid: valid }); } isFormValid = () => this.state.emailValid && this.state.passwordValid handleOnClick = (e) => { e.preventDefault = true; if (this.isFormValid()) { axios.post(`${config.backendUrl}/sessions`, { user: { email: this.state.email, password: this.state.password } }).then(({ data }) => { document.cookie = `token=${data.token}`; this.setState({ authenticated: true }); }).catch((response) => { const error = _.get(response, 'response.data.error'); this.setState({ error }); }); } } render() { const { error } = this.state; return ( <div> <Modal> <Form autoComplete> <FormEmail displayName="Email" label="Email" onChange={this.onEmailChange} /> <FormPassword displayName="Password" label="Password" onChange={this.onPasswordChange} /> {error && <h2>{error}</h2>} <FormButton className="Login-btn" text="login" onClick={this.handleOnClick} /> </Form> </Modal> {this.state.authenticated && <Redirect to="/mentor-request" />} </div> ); } } export default Login;
Handle user signing and redirect
Handle user signing and redirect
JavaScript
mit
hollomancer/operationcode_frontend,miaket/operationcode_frontend,NestorSegura/operationcode_frontend,sethbergman/operationcode_frontend,tskuse/operationcode_frontend,NestorSegura/operationcode_frontend,alexspence/operationcode_frontend,OperationCode/operationcode_frontend,tskuse/operationcode_frontend,sethbergman/operationcode_frontend,OperationCode/operationcode_frontend,hollomancer/operationcode_frontend,miaket/operationcode_frontend,hollomancer/operationcode_frontend,miaket/operationcode_frontend,tskuse/operationcode_frontend,tal87/operationcode_frontend,tal87/operationcode_frontend,NestorSegura/operationcode_frontend,alexspence/operationcode_frontend,alexspence/operationcode_frontend,tal87/operationcode_frontend,sethbergman/operationcode_frontend,OperationCode/operationcode_frontend
--- +++ @@ -1,19 +1,66 @@ import React, { Component } from 'react'; import Modal from 'shared/components/modal/modal'; import Form from 'shared/components/form/form'; +import { Redirect } from 'react-router-dom'; +import axios from 'axios'; +import config from 'config/environment'; +import _ from 'lodash'; import FormEmail from 'shared/components/form/formEmail/formEmail'; import FormPassword from 'shared/components/form/formPassword/formPassword'; +import FormButton from 'shared/components/form/formButton/formButton'; class Login extends Component { + + state = { + email: '', + emailValid: false, + password: '', + passwordValid: false, + authenticated: false, + error: '' + } + + onEmailChange = (value, valid) => { + this.setState({ email: value, emailValid: valid }); + } + + onPasswordChange = (value, valid) => { + this.setState({ password: value, passwordValid: valid }); + } + + isFormValid = () => this.state.emailValid && this.state.passwordValid + + handleOnClick = (e) => { + e.preventDefault = true; + if (this.isFormValid()) { + axios.post(`${config.backendUrl}/sessions`, { + user: { + email: this.state.email, + password: this.state.password + } + }).then(({ data }) => { + document.cookie = `token=${data.token}`; + this.setState({ authenticated: true }); + }).catch((response) => { + const error = _.get(response, 'response.data.error'); + this.setState({ error }); + }); + } + } + render() { + const { error } = this.state; return ( <div> <Modal> - <Form> - <FormEmail displayName="Username" /> - <FormPassword displayName="Password" /> + <Form autoComplete> + <FormEmail displayName="Email" label="Email" onChange={this.onEmailChange} /> + <FormPassword displayName="Password" label="Password" onChange={this.onPasswordChange} /> + {error && <h2>{error}</h2>} + <FormButton className="Login-btn" text="login" onClick={this.handleOnClick} /> </Form> </Modal> + {this.state.authenticated && <Redirect to="/mentor-request" />} </div> ); }