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
1e928e64d6ea914870e2240a12bf33b8b2cf09b0
src/openfisca-proptypes.js
src/openfisca-proptypes.js
import PropTypes from 'prop-types' const valuesShape = PropTypes.objectOf(PropTypes.oneOfType([ PropTypes.bool, PropTypes.number, PropTypes.string, ])) export const parameterShape = PropTypes.shape({ id: PropTypes.string, description: PropTypes.string, normalizedDescription: PropTypes.string, values: valuesShape, brackets: PropTypes.objectOf(valuesShape), }) export const variableShape = PropTypes.shape({ id: PropTypes.string, description: PropTypes.string, definitionPeriod: PropTypes.string, entity: PropTypes.string, formulas: PropTypes.object, normalizedDescription: PropTypes.string, source: PropTypes.string, })
import PropTypes from 'prop-types' const valuesShape = PropTypes.objectOf(PropTypes.oneOfType([ PropTypes.bool, PropTypes.number, PropTypes.string, ])) export const parameterShape = PropTypes.shape({ id: PropTypes.string, description: PropTypes.string, documentation: PropTypes.string, normalizedDescription: PropTypes.string, values: valuesShape, brackets: PropTypes.objectOf(valuesShape), }) export const variableShape = PropTypes.shape({ id: PropTypes.string, description: PropTypes.string, definitionPeriod: PropTypes.string, documentation: PropTypes.string, entity: PropTypes.string, formulas: PropTypes.object, normalizedDescription: PropTypes.string, source: PropTypes.string, })
Update parameters and variables shapes
Update parameters and variables shapes
JavaScript
agpl-3.0
openfisca/legislation-explorer
--- +++ @@ -10,6 +10,7 @@ export const parameterShape = PropTypes.shape({ id: PropTypes.string, description: PropTypes.string, + documentation: PropTypes.string, normalizedDescription: PropTypes.string, values: valuesShape, brackets: PropTypes.objectOf(valuesShape), @@ -19,6 +20,7 @@ id: PropTypes.string, description: PropTypes.string, definitionPeriod: PropTypes.string, + documentation: PropTypes.string, entity: PropTypes.string, formulas: PropTypes.object, normalizedDescription: PropTypes.string,
b24727fabb21448e8771e072f8be6ec2716e52ad
deploy/electron/Gruntfile.js
deploy/electron/Gruntfile.js
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), "download-electron": { version: "1.8.8", outputDir: "./electron", rebuild: true } }); grunt.loadNpmTasks('grunt-download-electron'); };
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), "download-electron": { version: "2.0.18", outputDir: "./electron", rebuild: true } }); grunt.loadNpmTasks('grunt-download-electron'); };
Update electron version fixing security issues
Update electron version fixing security issues
JavaScript
mit
LightTable/LightTable,LightTable/LightTable,LightTable/LightTable
--- +++ @@ -4,7 +4,7 @@ grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), "download-electron": { - version: "1.8.8", + version: "2.0.18", outputDir: "./electron", rebuild: true }
d0d13e5feea4aa2c3d7f35be31dcbd0299f9a4d3
client/components/App/App.js
client/components/App/App.js
// @flow import React from 'react' import 'normalize.css/normalize.css' import Footer from 'components/Footer/Footer' import Nav from '../Nav/Nav' import MobileFooterToolbar from '../Nav/MobileFooterToolbar/MobileFooterToolbar' import styles from './App.scss' import '../../styles/global.scss' import Content from 'react-mdc-web/lib/Content/Content' const title = 'Reango' type AppPropsType = { viewer: Object, children: Object } let App = (props: AppPropsType) => <div className={styles.root} > <Nav title={title} viewer={props.viewer} /> <Content className={`${styles.wrap}`} > <div className={styles.content} > {props.children} </div> </Content> {props.viewer.isAuthenticated ? <div className={styles.mobile_footer_wrap} > <MobileFooterToolbar /> </div> : null} <div className={`${styles.footer_wrap} ${!props.viewer.isAuthenticated ? styles.hidden_mobile_footer_wrap: null}`} > <div className={styles.footer} > <Footer title={title} /> </div> </div> </div> export default App
// @flow import React from 'react' import 'normalize.css/normalize.css' import Footer from 'components/Footer/Footer' import Nav from '../Nav/Nav' import MobileFooterToolbar from '../Nav/MobileFooterNav/MobileFooterNav' import styles from './App.scss' import '../../styles/global.scss' import Content from 'react-mdc-web/lib/Content/Content' const title = 'Reango' type AppPropsType = { viewer: Object, children: Object } let App = (props: AppPropsType) => <div className={styles.root} > <Nav title={title} viewer={props.viewer} /> <Content className={`${styles.wrap}`} > <div className={styles.content} > {props.children} </div> </Content> {props.viewer.isAuthenticated ? <div className={styles.mobile_footer_wrap} > <MobileFooterToolbar /> </div> : null} <div className={`${styles.footer_wrap} ${!props.viewer.isAuthenticated ? styles.hidden_mobile_footer_wrap: null}`} > <div className={styles.footer} > <Footer title={title} /> </div> </div> </div> export default App
Fix mobile footer toolbar import rename
Fix mobile footer toolbar import rename
JavaScript
mit
ncrmro/reango,ncrmro/ango,ncrmro/reango,ncrmro/ango,ncrmro/ango,ncrmro/reango
--- +++ @@ -3,7 +3,7 @@ import 'normalize.css/normalize.css' import Footer from 'components/Footer/Footer' import Nav from '../Nav/Nav' -import MobileFooterToolbar from '../Nav/MobileFooterToolbar/MobileFooterToolbar' +import MobileFooterToolbar from '../Nav/MobileFooterNav/MobileFooterNav' import styles from './App.scss' import '../../styles/global.scss' import Content from 'react-mdc-web/lib/Content/Content'
edd29b9bcb894ed1fd6511f2e748a87a14d792f3
assets/site.js
assets/site.js
(function(){ "use strict"; var d = document, inits = []; window.initializers = inits; // initializer to manipulate all hyperlinks inits.push(function(){ var x, h = location.host; for (var xs = d.links, i = xs.length; i--; ){ var x = xs[i], m = x.getAttribute('data-m'); if (m) { // de-obfuscate e-mail hyperlink m = m.replace(/[\/]/g, '@').replace(/,/g, '.'); x.href = 'mailto:' + m; if ((x = x.firstChild) && x.nodeType == 3){ x.data = m; } } else if (x.host != h){ // set target to _blank for all external hyperlinks x.target = '_blank'; } } }); // initializer to set current year in copyright footer inits.push(function(){ if (d.querySelector){ var x = d.querySelector('body>footer>time'); if (x){ x.innerHTML = (new Date()).getFullYear(); } } }); function initPage(){ // call all initializers for(var i = 0, n = inits.length; i < n; i++){ inits[i](); } } initPage(); }())
(function(){ "use strict"; var d = document, inits = []; window.initializers = inits; // initializer to manipulate all hyperlinks inits.push(function(){ var x, h = location.host; for (var xs = d.links, i = xs.length; i--; ){ var x = xs[i], m = x.getAttribute('data-m'); if (m) { // de-obfuscate e-mail hyperlink m = m.replace(/[\/]/g, '@').replace(/,/g, '.'); x.href = 'mailto:' + m; if ((x = x.firstChild) && x.nodeType == 3){ x.data = m; } } else if (x.host != h){ // set target to _blank for all external hyperlinks x.target = '_blank'; } } }); // initializer to set active tab in page header inits.push(function(){ if (d.querySelectorAll){ var xs = d.querySelectorAll('body>header>nav>a'), href = location.href; for(var i = 1, n = xs.length; i < n; i++){ var x = xs[i]; if (href.startsWith(x.href)){ x.classList.add('active'); } else { x.classList.remove('active'); } } } }); // initializer to set current year in copyright footer inits.push(function(){ if (d.querySelector){ var x = d.querySelector('body>footer>time'); if (x){ x.innerHTML = (new Date()).getFullYear(); } } }); function initPage(){ // call all initializers for(var i = 0, n = inits.length; i < n; i++){ inits[i](); } } initPage(); }())
Add initializer to set active tab in page header
Add initializer to set active tab in page header
JavaScript
mit
tommy-carlier/www.tcx.be,tommy-carlier/www.tcx.be,tommy-carlier/www.tcx.be
--- +++ @@ -23,6 +23,21 @@ } } }); + + // initializer to set active tab in page header + inits.push(function(){ + if (d.querySelectorAll){ + var xs = d.querySelectorAll('body>header>nav>a'), href = location.href; + for(var i = 1, n = xs.length; i < n; i++){ + var x = xs[i]; + if (href.startsWith(x.href)){ + x.classList.add('active'); + } else { + x.classList.remove('active'); + } + } + } + }); // initializer to set current year in copyright footer inits.push(function(){ @@ -34,7 +49,6 @@ } }); - function initPage(){ // call all initializers for(var i = 0, n = inits.length; i < n; i++){
fd360a1315640847c249b3422790ce0bbd57d0d9
lib/package/plugins/checkConditionTruth.js
lib/package/plugins/checkConditionTruth.js
/* Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ //checkConditionTruth.js var plugin = { ruleId: "CC006", name: "Detect Logical Absurdities", message: "Conditions should not have internal logic conflicts.", fatal: false, severity: 2, //error nodeType: "Condition", enabled: true }; var onCondition = function(condition, cb) { var truthTable = condition.getTruthTable(), hadErr = false; //truthTable will be null if no condition was present if (truthTable && truthTable.getEvaluation() !== "valid") { condition.addMessage({ source: condition.getExpression(), line: condition.getElement().lineNumber, column: condition.getElement().columnNumber, plugin, message: "Condition may be a logical absuridty." }); hadErr = true; } if (typeof cb == "function") { cb(null, hadErr); } }; module.exports = { plugin, onCondition };
/* Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ //checkConditionTruth.js var plugin = { ruleId: "CC006", name: "Detect Logical Absurdities", message: "Conditions should not have internal logic conflicts.", fatal: false, severity: 2, //error nodeType: "Condition", enabled: true }; var onCondition = function(condition, cb) { var truthTable = condition.getTruthTable(), hadErr = false; //truthTable will be null if no condition was present if (truthTable && truthTable.getEvaluation() !== "valid") { condition.addMessage({ source: condition.getExpression(), line: condition.getElement().lineNumber, column: condition.getElement().columnNumber, plugin, message: "Condition may be a logical absurdity." }); hadErr = true; } if (typeof cb == "function") { cb(null, hadErr); } }; module.exports = { plugin, onCondition };
Fix a typing mistake in 'logical absurdity' message
Fix a typing mistake in 'logical absurdity' message
JavaScript
apache-2.0
apigee/apigeelint,apigeecs/bundle-linter
--- +++ @@ -36,7 +36,7 @@ line: condition.getElement().lineNumber, column: condition.getElement().columnNumber, plugin, - message: "Condition may be a logical absuridty." + message: "Condition may be a logical absurdity." }); hadErr = true; }
d1293e868ed3d7187423a56717f406e052da41a2
config/index.js
config/index.js
import defaults from 'defaults' const API_GLOBAL = '_IMDIKATOR' const env = process.env.NODE_ENV || 'development' const DEFAULTS = { port: 3000, reduxDevTools: false } const globalConfig = (typeof window !== 'undefined' && window[API_GLOBAL] || {}) export default defaults({ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', nodeApiHost: 'https://atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS), showDebug: process.env.DEBUG }, DEFAULTS)
import defaults from 'defaults' const API_GLOBAL = '_IMDIKATOR' const env = process.env.NODE_ENV || 'development' const DEFAULTS = { port: 3000, reduxDevTools: false } const globalConfig = (typeof window !== 'undefined' && window[API_GLOBAL] || {}) export default defaults({ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', nodeApiHost: 'atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS), showDebug: process.env.DEBUG }, DEFAULTS)
FIX - changed node api to https
FIX - changed node api to https
JavaScript
mit
bengler/imdikator,bengler/imdikator
--- +++ @@ -15,7 +15,7 @@ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', - nodeApiHost: 'https://atindikatornode.azurewebsites.net', + nodeApiHost: 'atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS),
110e1871555cece764e2dcbfdf3ab7c14c7c164e
bin/gut-cli.js
bin/gut-cli.js
var gut = require('../'); if (process.argv.length > 2 && process.argv[2] === 'status') { console.log("\n\tGut status: %s", gut.getStatus()); } console.log('\nI think you meant "git"');
#!/usr/bin/env node var gut = require('../'); if (process.argv.length > 2 && process.argv[2] === 'status') { console.log("\n\tGut status: %s", gut.getStatus()); } console.log('\nI think you meant "git"');
Add shabang to bin file
Add shabang to bin file
JavaScript
mit
itsananderson/gut-status
--- +++ @@ -1,3 +1,5 @@ +#!/usr/bin/env node + var gut = require('../'); if (process.argv.length > 2 && process.argv[2] === 'status') {
c025d9457aa000d0f23252e07ce6f2e2c3c5d971
releaf-core/app/assets/config/releaf_core_manifest.js
releaf-core/app/assets/config/releaf_core_manifest.js
//= link_tree ../images //= link releaf/application.css //= link releaf/application.js
//= link_tree ../images //= link_tree ../javascripts/ckeditor //= link releaf/application.css //= link releaf/application.js
Fix releaf ckeditor assets copying
Fix releaf ckeditor assets copying
JavaScript
mit
cubesystems/releaf,cubesystems/releaf,cubesystems/releaf
--- +++ @@ -1,3 +1,4 @@ //= link_tree ../images +//= link_tree ../javascripts/ckeditor //= link releaf/application.css //= link releaf/application.js
7a3062a02c2e676704ecad75def38d322c45a5d0
lib/resources/console/scripts/content-editor/plaintext.js
lib/resources/console/scripts/content-editor/plaintext.js
pw.component.register('content-editor-plaintext', function (view, config) { var self = this; var mock = document.createElement('DIV'); mock.classList.add('console-content-plaintext-mock') mock.style.position = 'absolute'; mock.style.top = '-100px'; mock.style.opacity = '0'; mock.style.width = view.node.clientWidth + 'px'; document.body.appendChild(mock); view.node.addEventListener('keypress', function (evt) { var value = this.value + String.fromCharCode(evt.keyCode); if (evt.keyCode == 13) { value += '<br>'; } self.update(value); }); view.node.addEventListener('keyup', function (evt) { self.update(this.value); }); view.node.addEventListener('blur', function () { pw.component.broadcast('content-editor:changed'); }); this.update = function (value) { value = value.replace(/\n/g, '<br>'); if (value.trim() == '') { value = '&nbsp;'; } // add an extra line break to push the content down if (value.substring(value.length - 4, value.length) == '<br>') { value += '<br>'; } mock.innerHTML = value; view.node.style.height = mock.offsetHeight + 'px'; }; });
pw.component.register('content-editor-plaintext', function (view, config) { var self = this; var mock = document.createElement('DIV'); mock.classList.add('console-content-plaintext-mock') mock.style.position = 'absolute'; mock.style.top = '-100px'; mock.style.opacity = '0'; mock.style.width = view.node.clientWidth + 'px'; pw.node.after(view.node, mock); view.node.addEventListener('keypress', function (evt) { var value = this.value + String.fromCharCode(evt.keyCode); if (evt.keyCode == 13) { value += '<br>'; } self.update(value); }); view.node.addEventListener('keyup', function (evt) { self.update(this.value); }); view.node.addEventListener('blur', function () { pw.component.broadcast('content-editor:changed'); }); this.update = function (value) { value = value.replace(/\n/g, '<br>'); if (value.trim() == '') { value = '&nbsp;'; } // add an extra line break to push the content down if (value.substring(value.length - 4, value.length) == '<br>') { value += '<br>'; } mock.innerHTML = value; view.node.style.height = mock.offsetHeight + 'px'; }; });
Fix text editor wrapping when floating
Fix text editor wrapping when floating
JavaScript
mit
metabahn/console,metabahn/console,metabahn/console
--- +++ @@ -8,7 +8,7 @@ mock.style.opacity = '0'; mock.style.width = view.node.clientWidth + 'px'; - document.body.appendChild(mock); + pw.node.after(view.node, mock); view.node.addEventListener('keypress', function (evt) { var value = this.value + String.fromCharCode(evt.keyCode);
a6d0373ea7ca897721d691089567af8e13bab61b
mac/filetypes/open_STAK.js
mac/filetypes/open_STAK.js
define(['itemObjectModel', 'mac/roman'], function(itemOM, macRoman) { 'use strict'; function open(item) { function onBlock(item, byteSource) { return byteSource.slice(0, 12).getBytes().then(function(headerBytes) { var dv = new DataView(headerBytes.buffer, headerBytes.byteOffset, 4); var length = dv.getUint32(0, false); var name = macRoman(headerBytes, 4, 4); var id = dv.getInt32(8, false); var blockItem = itemOM.createItem(name + " " + id); item.addItem(blockItem); if (length > 8) { blockItem.byteSource = byteSource.slice(12, length); } if (byteSource.byteLength >= (length + 12)) { return onBlock(item, byteSource.slice(length)); } }); } return onBlock(item, item.byteSource); } return open; });
define(['itemObjectModel', 'mac/roman'], function(itemOM, macRoman) { 'use strict'; function open(item) { function onBlock(item, byteSource) { return byteSource.slice(0, 12).getBytes().then(function(headerBytes) { var dv = new DataView( headerBytes.buffer, headerBytes.byteOffset, headerBytes.byteLength); var length = dv.getUint32(0, false); var name = macRoman(headerBytes, 4, 4); var id = dv.getInt32(8, false); var blockItem = itemOM.createItem(name + " " + id); item.addItem(blockItem); if (length > 8) { blockItem.byteSource = byteSource.slice(12, length); } if (byteSource.byteLength >= (length + 12)) { return onBlock(item, byteSource.slice(length)); } }); } return onBlock(item, item.byteSource); } return open; });
Use right length of header
Use right length of header
JavaScript
mit
radishengine/drowsy,radishengine/drowsy
--- +++ @@ -5,7 +5,8 @@ function open(item) { function onBlock(item, byteSource) { return byteSource.slice(0, 12).getBytes().then(function(headerBytes) { - var dv = new DataView(headerBytes.buffer, headerBytes.byteOffset, 4); + var dv = new DataView( + headerBytes.buffer, headerBytes.byteOffset, headerBytes.byteLength); var length = dv.getUint32(0, false); var name = macRoman(headerBytes, 4, 4); var id = dv.getInt32(8, false);
93bc928f2f19bba92ce178325f396c863f34c566
packages/client/.spinrc.js
packages/client/.spinrc.js
const url = require('url'); const config = { builders: { web: { entry: './src/index.tsx', stack: ['web'], openBrowser: true, dllExcludes: ['bootstrap'], defines: { __CLIENT__: true }, // Wait for backend to start prior to letting webpack load frontend page waitOn: ['tcp:localhost:8080'], enabled: true }, test: { stack: ['server'], roles: ['test'], defines: { __TEST__: true } } }, options: { stack: ['apollo', 'react', 'styled-components', 'css', 'sass', 'less', 'es6', 'ts', 'webpack', 'i18next'], cache: '../../.cache', ssr: true, webpackDll: true, reactHotLoader: false, frontendRefreshOnBackendChange: true, defines: { __DEV__: process.env.NODE_ENV !== 'production', __API_URL__: '"/graphql"' }, webpackConfig: { devServer: { disableHostCheck: true } } } }; config.options.devProxy = config.options.ssr; if (process.env.NODE_ENV === 'production') { // Generating source maps for production will slowdown compilation for roughly 25% config.options.sourceMap = false; } const extraDefines = { __SSR__: config.options.ssr }; config.options.defines = Object.assign(config.options.defines, extraDefines); module.exports = config;
const url = require('url'); const config = { builders: { web: { entry: './src/index.tsx', stack: ['web'], openBrowser: true, dllExcludes: ['bootstrap'], defines: { __CLIENT__: true }, // Wait for backend to start prior to letting webpack load frontend page waitOn: ['tcp:localhost:8080'], enabled: true }, test: { stack: ['server'], roles: ['test'], defines: { __TEST__: true } } }, options: { stack: ['apollo', 'react', 'styled-components', 'css', 'sass', 'less', 'es6', 'ts', 'webpack', 'i18next'], cache: '../../.cache', ssr: true, webpackDll: true, reactHotLoader: false, defines: { __DEV__: process.env.NODE_ENV !== 'production', __API_URL__: '"/graphql"' }, webpackConfig: { devServer: { disableHostCheck: true } } } }; config.options.devProxy = config.options.ssr; if (process.env.NODE_ENV === 'production') { // Generating source maps for production will slowdown compilation for roughly 25% config.options.sourceMap = false; } const extraDefines = { __SSR__: config.options.ssr }; config.options.defines = Object.assign(config.options.defines, extraDefines); module.exports = config;
Remove unused option for client-side bundle
Remove unused option for client-side bundle
JavaScript
mit
sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit
--- +++ @@ -28,7 +28,6 @@ ssr: true, webpackDll: true, reactHotLoader: false, - frontendRefreshOnBackendChange: true, defines: { __DEV__: process.env.NODE_ENV !== 'production', __API_URL__: '"/graphql"'
4f2ba69c7a4c2e5906d949fae1d0fc902c6f12df
data/wp/wp-content/plugins/epfl/menus/epfl-menus-admin.js
data/wp/wp-content/plugins/epfl/menus/epfl-menus-admin.js
// It seems that not much documentation exists for the JQuery // mini-Web-app that is the Wordpress admin menu editor. However, // insofar as Polylang's business in that mini-Web-app is similar // to ours, studying the js/nav-menu.js therefrom is helpful. function initNavMenus ($) { var $metabox = $('div.add-external-menu'); $('input.submit-add-to-menu', $metabox).click(function() { console.log("click"); // For inspiration regarding wpNavMenu, look at wp-admin/js/nav-menu.js wpNavMenu.addItemToMenu( {'-1': { 'menu-item-type': 'external-menu', 'menu-item-url': 'https://example.com/restapi/menu?lang=en_JP' }}, wpNavMenu.addMenuItemToBottom, function() { console.log('Added external menu to menu'); }); }); // submit button's .click() } function initExternalMenuList ($) { $('a.page-title-action').remove(); $('h1.wp-heading-inline').after('<button class="page-title-action">' + wp.translations.refresh_button + '</button>'); var $button = $('h1.wp-heading-inline').next(); var spinning = false; $button.click(function() { if (spinning) return; var $form = window.EPFLMenus.asWPAdminPostForm('refresh'); $form.submit(); var $spinner = $('<span class="ajax-spinner"></span>'); $button.append($spinner); spinning = true; }); } jQuery( document ).ready(function($) { if (window.wp.screen.base === 'nav-menus') { initNavMenus($); } if (window.wp.screen.base === 'edit' && window.wp.screen.post_type === 'epfl-external-menu' ) { initExternalMenuList($); } // If you see this, nothing threw or crashed (yet). console.log('epfl-menus-admin.js is on duty.'); });
function initExternalMenuList ($) { $('a.page-title-action').remove(); $('h1.wp-heading-inline').after('<button class="page-title-action">' + wp.translations.refresh_button + '</button>'); var $button = $('h1.wp-heading-inline').next(); var spinning = false; $button.click(function() { if (spinning) return; var $form = window.EPFLMenus.asWPAdminPostForm('refresh'); $form.submit(); var $spinner = $('<span class="ajax-spinner"></span>'); $button.append($spinner); spinning = true; }); } jQuery( document ).ready(function($) { if (window.wp.screen.base === 'edit' && window.wp.screen.post_type === 'epfl-external-menu' ) { initExternalMenuList($); } // If you see this, nothing threw or crashed (yet). console.log('epfl-menus-admin.js is on duty.'); });
Remove dead code in the JS app
Remove dead code in the JS app
JavaScript
mit
epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp,epfl-idevelop/jahia2wp
--- +++ @@ -1,27 +1,3 @@ -// It seems that not much documentation exists for the JQuery -// mini-Web-app that is the Wordpress admin menu editor. However, -// insofar as Polylang's business in that mini-Web-app is similar -// to ours, studying the js/nav-menu.js therefrom is helpful. - -function initNavMenus ($) { - var $metabox = $('div.add-external-menu'); - $('input.submit-add-to-menu', $metabox).click(function() { - console.log("click"); - - // For inspiration regarding wpNavMenu, look at wp-admin/js/nav-menu.js - wpNavMenu.addItemToMenu( - {'-1': { - 'menu-item-type': 'external-menu', - 'menu-item-url': 'https://example.com/restapi/menu?lang=en_JP' - }}, - wpNavMenu.addMenuItemToBottom, - function() { - console.log('Added external menu to menu'); - }); - - }); // submit button's .click() -} - function initExternalMenuList ($) { $('a.page-title-action').remove(); $('h1.wp-heading-inline').after('<button class="page-title-action">' + wp.translations.refresh_button + '</button>'); @@ -38,10 +14,6 @@ } jQuery( document ).ready(function($) { - if (window.wp.screen.base === 'nav-menus') { - initNavMenus($); - } - if (window.wp.screen.base === 'edit' && window.wp.screen.post_type === 'epfl-external-menu' ) { initExternalMenuList($); }
d94120cf7da438722c1bb60dfaa81ada4e48e724
src/helpers/menu_entry.js
src/helpers/menu_entry.js
const Handlebars = require('handlebars'); const templates = { active: Handlebars.compile('<li class="active">{{{content}}}</li>'), unactive: Handlebars.compile('<li><a href="{{link}}">{{{content}}}</a></li>') }; module.exports = function(entries, current_page) { const items = entries.map((entry) => { const context = entry.page === '/' ? {content: '<i class="fa fa-home"></i>', link: '/'} : {content: entry.page, link: `/pages/${entry.page}.html`}; return entry.page === current_page ? templates.active(context) : templates.unactive(context); }).join(''); return `<ul class="menu">${items}</ul>`; }
const Handlebars = require('handlebars'); const templates = { active: Handlebars.compile('<li class="active"><a>{{{content}}}</a></li>'), unactive: Handlebars.compile('<li><a href="{{link}}">{{{content}}}</a></li>') }; module.exports = function(entries, current_page) { const items = entries.map((entry) => { const context = entry.page === '/' ? {content: '<i class="fa fa-home"></i>', link: '/'} : {content: entry.page, link: `/pages/${entry.page}.html`}; return entry.page === current_page ? templates.active(context) : templates.unactive(context); }).join(''); return `<ul class="menu">${items}</ul>`; }
Fix active menu item content.
Fix active menu item content.
JavaScript
mit
NealRame/CV,NealRame/Blog,NealRame/Blog,NealRame/Blog,NealRame/CV
--- +++ @@ -1,7 +1,7 @@ const Handlebars = require('handlebars'); const templates = { - active: Handlebars.compile('<li class="active">{{{content}}}</li>'), + active: Handlebars.compile('<li class="active"><a>{{{content}}}</a></li>'), unactive: Handlebars.compile('<li><a href="{{link}}">{{{content}}}</a></li>') };
bc09b643a4763de17f5d6db6b926174667825ad2
client/app/instructor/newevent/newevent.controller.js
client/app/instructor/newevent/newevent.controller.js
'use strict'; export default class NewEventCtrl { /*@ngInject*/ constructor($scope) { $scope.event = {info:{}}; $scope.stage = { select: true, create: false, assign: false, done: false } $scope.doneSelect = function(create){ $scope.stage.select = false; if (create){ $scope.stage.create = true; } else{ $scope.stage.assign = true; } } $scope.doneCreate = function(){ $scope.stage.create = false; $scope.stage.assign = true; } $scope.doneAssign = function(){ $scope.stage.assign = false; $scope.stage.done = true; } } }
'use strict'; export default class NewEventCtrl { /*@ngInject*/ constructor($scope) { $scope.event = {info:{}}; $scope.stage = { select: false, create: true, assign: false, done: false } $scope.doneSelect = function(create){ $scope.stage.select = false; if (create){ $scope.stage.create = true; } else{ $scope.stage.assign = true; } } $scope.doneCreate = function(){ $scope.stage.create = false; $scope.stage.assign = true; } $scope.doneAssign = function(){ $scope.stage.assign = false; $scope.stage.done = true; } } }
Change to new event form instead of to selecting an event
Change to new event form instead of to selecting an event
JavaScript
mit
rcos/venue,rcos/venue,rcos/venue,rcos/venue
--- +++ @@ -5,8 +5,8 @@ constructor($scope) { $scope.event = {info:{}}; $scope.stage = { - select: true, - create: false, + select: false, + create: true, assign: false, done: false }
9c61fdff3cf4e40724f2565a5ab55f6d2b3aa0a9
stats-server/lib/server.js
stats-server/lib/server.js
var express = require('express'); var https = require('https'); var logger = require('./logger'); var security = require('./security'); var db = require('./db'); var app = configureExpressApp(); initializeMongo(initializeRoutes); startServer(security, app); function configureExpressApp() { var app = express(); app.use(express.json()); app.use(express.urlencoded()); app.use(genericErrorHandler); return app; function genericErrorHandler(err, req, res, next) { res.status(500); res.json({ error: "Please check if your request is correct" }); } } function initializeMongo(onSuccessCallback) { db.initialize(function(err, _db) { if(err) throw err; // interrupt when can't connect onSuccessCallback(_db); }); } function initializeRoutes(db) { ['./daily_stats_routes', './instance_run_routes'].forEach(function(routes) { require(routes)(app, logger, db); }); } function startServer(security, app) { var port = 3000; var httpsServer = https.createServer(security.credentials, app); httpsServer.listen(port); console.log("Codebrag stats server started on port", port); return httpsServer; }
var express = require('express'); var https = require('https'); var logger = require('./logger'); var security = require('./security'); var db = require('./db'); var app = configureExpressApp(); initializeMongo(initializeRoutes); startServer(security, app); function configureExpressApp() { var app = express(); app.use(express.json()); app.use(express.urlencoded()); app.use(genericErrorHandler); return app; function genericErrorHandler(err, req, res, next) { res.status(500); res.json({ error: "Please check if your request is correct" }); } } function initializeMongo(onSuccessCallback) { db.initialize(function(err, _db) { if(err) throw err; // interrupt when can't connect onSuccessCallback(_db); }); } function initializeRoutes(db) { ['./daily_stats_routes', './instance_run_routes'].forEach(function(routes) { require(routes)(app, logger, db); }); } function startServer(security, app) { var port = 6666; var httpsServer = https.createServer(security.credentials, app); httpsServer.listen(port); console.log("Codebrag stats server started on port", port); return httpsServer; }
Change port back to 6666
Change port back to 6666
JavaScript
agpl-3.0
cazacugmihai/codebrag,cazacugmihai/codebrag,softwaremill/codebrag,softwaremill/codebrag,cazacugmihai/codebrag,cazacugmihai/codebrag,softwaremill/codebrag,softwaremill/codebrag,cazacugmihai/codebrag
--- +++ @@ -36,7 +36,7 @@ } function startServer(security, app) { - var port = 3000; + var port = 6666; var httpsServer = https.createServer(security.credentials, app); httpsServer.listen(port); console.log("Codebrag stats server started on port", port);
7e580f82edfbe1b3ba4e6e7a365c216b2b81cb91
config/index.js
config/index.js
// see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: true, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report }, dev: { env: require('./dev.env'), port: 8080, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false } }
// see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: true, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report }, dev: { env: require('./dev.env'), port: 3000, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false } }
Change default dev port to 3000
Change default dev port to 3000
JavaScript
mit
adrielpdeguzman/vuelma,adrielpdeguzman/vuelma,vuelma/vuelma,vuelma/vuelma
--- +++ @@ -23,7 +23,7 @@ }, dev: { env: require('./dev.env'), - port: 8080, + port: 3000, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/',
87eebeaee3d2930e29f8b9aa7e3784f7f519f444
jquery.activeNavigation.js
jquery.activeNavigation.js
(function( $ ) { $.fn.activeNavigation = function(selector) { var pathname = window.location.pathname var hrefs = [] $(selector).find("a").each(function(){ if (pathname.indexOf($(this).attr("href")) > -1) hrefs.push($(this)) }) if (hrefs.length) { hrefs.sort(function(a,b){ return b.attr("href").length - a.attr("href").length }) hrefs[0].closest('li').addClass("active") } }; })(jQuery);
(function( $ ) { $.fn.activeNavigation = function(selector) { var pathname = window.location.pathname var extension_position; var href; var hrefs = [] $(selector).find("a").each(function(){ // Remove href file extension extension_position = $(this).attr("href").lastIndexOf('.'); href = (extension_position >= 0) ? $(this).attr("href").substr(0, extension_position) : $(this).attr("href"); if (pathname.indexOf(href) > -1) { hrefs.push($(this)); } }) if (hrefs.length) { hrefs.sort(function(a,b){ return b.attr("href").length - a.attr("href").length }) hrefs[0].closest('li').addClass("active") } }; })(jQuery);
Remove file extension from href's
Remove file extension from href's
JavaScript
mit
Vitaa/ActiveNavigation,Vitaa/ActiveNavigation
--- +++ @@ -1,10 +1,17 @@ (function( $ ) { $.fn.activeNavigation = function(selector) { var pathname = window.location.pathname + var extension_position; + var href; var hrefs = [] $(selector).find("a").each(function(){ - if (pathname.indexOf($(this).attr("href")) > -1) - hrefs.push($(this)) + // Remove href file extension + extension_position = $(this).attr("href").lastIndexOf('.'); + href = (extension_position >= 0) ? $(this).attr("href").substr(0, extension_position) : $(this).attr("href"); + + if (pathname.indexOf(href) > -1) { + hrefs.push($(this)); + } }) if (hrefs.length) { hrefs.sort(function(a,b){
26d0c3815f5bdcc23b25709167c1bcf96a8d14c2
examples/worker-semaphore.js
examples/worker-semaphore.js
var {Worker} = require("ringo/worker") var {Semaphore} = require("ringo/concurrent") var {setInterval, clearInterval} = require("ringo/scheduler"); function main() { // Create a new workers from this same module. Note that this will // create a new instance of this module as workers are isolated. var w = new Worker(module.id); var s = new Semaphore(); w.onmessage = function(e) { print("Got response from worker: " + e.data); s.signal(); }; // Calling worker.postMessage with true as second argument causes // callbacks from the worker to be executed synchronously in // the worker's own thread instead of in our own event loop thread, // allowing us to wait synchronously for replies. w.postMessage(1, true); // Wait until the semaphore gets 5 signals. s.wait(5); print("Got 5 responses, quitting."); } function onmessage(e) { print("Worker got message: " + e.data); var count = 1; // Send 5 responses back to the caller. var id = setInterval(function() { e.source.postMessage(count); if (count++ >= 5) clearInterval(id); }, 500); } if (require.main === module) { main(); }
var {Worker} = require("ringo/worker") var {Semaphore} = require("ringo/concurrent") var {setInterval, clearInterval} = require("ringo/scheduler"); function main() { // Create a new workers from this same module. Note that this will // create a new instance of this module as workers are isolated. var w = new Worker(module.id); var s = new Semaphore(); w.onmessage = function(e) { print(" Response from worker: " + e.data); s.signal(); }; // Calling worker.postMessage with true as second argument causes // callbacks from the worker to be executed synchronously in // the worker's own thread instead of in our own event loop thread, // allowing us to wait synchronously for replies. w.postMessage(1, true); // Wait until the semaphore gets 3 signals. s.wait(3); print("Got 3 responses from worker."); // Wait for 2 more responses. s.wait(2); print("Got 2 more responses, quitting."); } function onmessage(e) { print("Worker got message: " + e.data); var count = 1; // Send 5 responses back to the caller. var id = setInterval(function() { e.source.postMessage(count); if (count++ >= 5) clearInterval(id); }, 500); } if (require.main === module) { main(); }
Make single worker semaphore example slightly more interesting
Make single worker semaphore example slightly more interesting
JavaScript
apache-2.0
Transcordia/ringojs,ringo/ringojs,ringo/ringojs,oberhamsi/ringojs,Transcordia/ringojs,ringo/ringojs,oberhamsi/ringojs,ashwinrayaprolu1984/ringojs,Transcordia/ringojs,Transcordia/ringojs,oberhamsi/ringojs,ashwinrayaprolu1984/ringojs,ringo/ringojs,ashwinrayaprolu1984/ringojs,ashwinrayaprolu1984/ringojs
--- +++ @@ -9,7 +9,7 @@ var s = new Semaphore(); w.onmessage = function(e) { - print("Got response from worker: " + e.data); + print(" Response from worker: " + e.data); s.signal(); }; @@ -19,9 +19,12 @@ // allowing us to wait synchronously for replies. w.postMessage(1, true); - // Wait until the semaphore gets 5 signals. - s.wait(5); - print("Got 5 responses, quitting."); + // Wait until the semaphore gets 3 signals. + s.wait(3); + print("Got 3 responses from worker."); + // Wait for 2 more responses. + s.wait(2); + print("Got 2 more responses, quitting."); }
68a5a2ce778484bf94518ad3e1a2a895c76d25f4
app/imports/ui/components/form-fields/open-cloudinary-widget.js
app/imports/ui/components/form-fields/open-cloudinary-widget.js
import { Meteor } from 'meteor/meteor'; import { $ } from 'meteor/jquery'; /* global cloudinary */ /** * Opens the Cloudinary Upload widget and sets the value of the input field with name equal to nameAttribute to the * resulting URL of the uploaded picture. * @param nameAttribute The value of the associated input field's name attribute. * @memberOf ui/components/form-fields */ export function openCloudinaryWidget(nameAttribute) { cloudinary.openUploadWidget( { cloud_name: Meteor.settings.public.cloudinary.cloud_name, upload_preset: Meteor.settings.public.cloudinary.upload_preset, sources: ['local', 'url', 'camera'], cropping: 'server', cropping_aspect_ratio: 1, max_file_size: '500000', max_image_width: '500', max_image_height: '500', min_image_width: '300', min_image_height: '300', }, (error, result) => { if (error) { console.log('Error during image upload: ', error); return; } // Otherwise get the form elements // console.log('Cloudinary results: ', result); const url = result[0].url; $(`input[name=${nameAttribute}]`).val(url); }); }
import { Meteor } from 'meteor/meteor'; import { $ } from 'meteor/jquery'; /* global cloudinary */ /** * Opens the Cloudinary Upload widget and sets the value of the input field with name equal to nameAttribute to the * resulting URL of the uploaded picture. * @param nameAttribute The value of the associated input field's name attribute. * @memberOf ui/components/form-fields */ export function openCloudinaryWidget(nameAttribute) { cloudinary.openUploadWidget( { cloud_name: Meteor.settings.public.cloudinary.cloud_name, upload_preset: Meteor.settings.public.cloudinary.upload_preset, sources: ['local', 'url', 'camera'], cropping: 'server', cropping_aspect_ratio: 1, max_file_size: '500000', max_image_width: '500', max_image_height: '500', min_image_width: '200', min_image_height: '200', }, (error, result) => { if (error) { console.log('Error during image upload: ', error); return; } // Otherwise get the form elements // console.log('Cloudinary results: ', result); const url = result[0].url; $(`input[name=${nameAttribute}]`).val(url); }); }
Change min image size to 200x200
Change min image size to 200x200
JavaScript
apache-2.0
radgrad/radgrad,radgrad/radgrad,radgrad/radgrad
--- +++ @@ -20,8 +20,8 @@ max_file_size: '500000', max_image_width: '500', max_image_height: '500', - min_image_width: '300', - min_image_height: '300', + min_image_width: '200', + min_image_height: '200', }, (error, result) => { if (error) {
9bc7cfc00b0a0b96245af835995b39e8493f0a01
test_frontend/app/views/teacher/modules/assistance_request_list_module_spec.js
test_frontend/app/views/teacher/modules/assistance_request_list_module_spec.js
define((require) => { describe('requester_module', () => { beforeEach(() => { require('app/views/teacher/modules/assistance_request_list_module'); }); define('>RetrieveAssistanceRequests', () => { it('should be defined', () => { expect(RetrieveAssistanceRequests).toBeDefined(); }); [[], ['a'], ['a', 'b', 'random_course_id_42']].forEach(selectedCourseList => { it(`should request assistance requests for selected courses (${selectedCourseList})`, () => { const mock_socket = { emit: () => undefined }; const spy_emit = spyOn(mock_socket, 'emit').and.callThrough(); const spy_getSelectedClassIds = jasmine.createSpy('getSelectedClassIds').and.returnValue(selectedCourseList); selectedClassIds = spy_getSelectedClassIds; expect(RetrieveAssistanceRequests()).toBeUndefined(); expect(spy_emit.calls.count()).toEqual(1); expect(spy_emit.calls.argsFor(0)).toEqual([{cids: selectedCourseList, qty: 5}]); expect(spy_getSelectedClassIds.calls.count()).toEqual(1); expect(spy_emit.calls.argsFor(0)).toEqual([]); }); }); }); }); });
define((require) => { describe('requester_module', () => { beforeEach(() => { require('app/views/teacher/modules/assistance_request_list_module'); }); describe('>RetrieveAssistanceRequests', () => { it('should be defined', () => { expect(RetrieveAssistanceRequests).toBeDefined(); }); [[], ['a'], ['a', 'b', 'random_course_id_42']].forEach(selectedCourseList => { it(`should request assistance requests for selected courses (${selectedCourseList})`, () => { const mock_socket = { emit: () => undefined }; socket = mock_socket; const spy_emit = spyOn(mock_socket, 'emit').and.callThrough(); const spy_getSelectedClassIds = jasmine.createSpy('getSelectedClassIds').and.returnValue(selectedCourseList); getSelectedClassIds = spy_getSelectedClassIds; expect(RetrieveAssistanceRequests()).toBeUndefined(); expect(spy_emit.calls.count()).toEqual(1); expect(spy_emit.calls.argsFor(0)).toEqual(['Request_RetrieveAssistanceRequests', {cids: selectedCourseList, qty: 5}]); expect(spy_getSelectedClassIds.calls.count()).toEqual(1); expect(spy_getSelectedClassIds.calls.argsFor(0)).toEqual([]); }); }); }); }); });
Fix AR list module test
Fix AR list module test
JavaScript
mit
samg2014/VirtualHand,samg2014/VirtualHand
--- +++ @@ -5,7 +5,7 @@ require('app/views/teacher/modules/assistance_request_list_module'); }); - define('>RetrieveAssistanceRequests', () => { + describe('>RetrieveAssistanceRequests', () => { it('should be defined', () => { expect(RetrieveAssistanceRequests).toBeDefined(); }); @@ -15,18 +15,19 @@ const mock_socket = { emit: () => undefined }; + socket = mock_socket; const spy_emit = spyOn(mock_socket, 'emit').and.callThrough(); const spy_getSelectedClassIds = jasmine.createSpy('getSelectedClassIds').and.returnValue(selectedCourseList); - selectedClassIds = spy_getSelectedClassIds; + getSelectedClassIds = spy_getSelectedClassIds; expect(RetrieveAssistanceRequests()).toBeUndefined(); expect(spy_emit.calls.count()).toEqual(1); - expect(spy_emit.calls.argsFor(0)).toEqual([{cids: selectedCourseList, qty: 5}]); + expect(spy_emit.calls.argsFor(0)).toEqual(['Request_RetrieveAssistanceRequests', {cids: selectedCourseList, qty: 5}]); expect(spy_getSelectedClassIds.calls.count()).toEqual(1); - expect(spy_emit.calls.argsFor(0)).toEqual([]); + expect(spy_getSelectedClassIds.calls.argsFor(0)).toEqual([]); }); }); });
1b77aa7ecddf446637e1bfd14bd92d8d588dcb6d
app/gui/task_view.js
app/gui/task_view.js
define([ 'underscore', 'backbone' ], function(_, Backbone) { var TaskView = Backbone.View.extend({ tagName: 'li', className: 'task', events: { "dragstart" : "on_dragstart", "dragover" : "on_dragover", "drop" : "on_drop" }, initialize: function() { this.id = 'id-' + this.model.get('id'); this.$el.prop('draggable', true); }, render: function() { this.$el.html(this.model.get('name')); return this; }, on_dragstart: function(event) { var id = this.model.get('id'); var list_id = this.model.get('list_id'); var payload = [id, list_id].join(':'); event.originalEvent.dataTransfer.setData("text/plain", payload); }, on_dragover: function(event) { event.preventDefault(); }, on_drop: function(event) { event.preventDefault(); }, close: function() { this.off(); this.remove(); } }); return TaskView; });
define([ 'underscore', 'backbone' ], function(_, Backbone) { var TaskView = Backbone.View.extend({ tagName: 'li', className: 'task', events: { "dragstart" : "on_dragstart", "dragover" : "on_dragover", "drop" : "on_drop", "click .delete" : "delete" }, initialize: function() { this.id = 'id-' + this.model.get('id'); this.$el.prop('draggable', true); }, render: function() { this.$el.html(this.model.get('name') + this.delete_link()); return this; }, delete_link: function() { return('<a href="#" class="delete">x</a>'); }, on_dragstart: function(event) { var id = this.model.get('id'); var list_id = this.model.get('list_id'); var payload = [id, list_id].join(':'); event.originalEvent.dataTransfer.setData("text/plain", payload); }, on_dragover: function(event) { event.preventDefault(); }, on_drop: function(event) { event.preventDefault(); }, delete: function(event) { this.model.destroy(); }, close: function() { this.off(); this.remove(); } }); return TaskView; });
Add ability to delete a task
Add ability to delete a task
JavaScript
mit
lorenzoplanas/tasks,lorenzoplanas/tasks
--- +++ @@ -6,9 +6,10 @@ tagName: 'li', className: 'task', events: { - "dragstart" : "on_dragstart", - "dragover" : "on_dragover", - "drop" : "on_drop" + "dragstart" : "on_dragstart", + "dragover" : "on_dragover", + "drop" : "on_drop", + "click .delete" : "delete" }, initialize: function() { @@ -17,8 +18,12 @@ }, render: function() { - this.$el.html(this.model.get('name')); + this.$el.html(this.model.get('name') + this.delete_link()); return this; + }, + + delete_link: function() { + return('<a href="#" class="delete">x</a>'); }, on_dragstart: function(event) { @@ -36,6 +41,10 @@ event.preventDefault(); }, + delete: function(event) { + this.model.destroy(); + }, + close: function() { this.off(); this.remove();
edede8b53d19f628c566edf52d426b81d69af306
client/src/Requests/PanelIssue.js
client/src/Requests/PanelIssue.js
import React from 'react' import { Panel } from 'react-bootstrap' import MarkdownBlock from '../shared/MarkdownBlock' import { getCreator, getContent } from '../shared/requestUtils' const Issue = props => { return ( <Panel header={`${props.issue.title} by ${getCreator(props.issue).name || getCreator(props.issue).login}`} eventKey={props.issue.id}> <MarkdownBlock body={getContent(props.issue)} /> </Panel> ) } export default Issue
import React from 'react' import { Panel } from 'react-bootstrap' import MarkdownBlock from '../shared/MarkdownBlock' import { getCreator, getContent } from '../shared/requestUtils' const Issue = props => { if (!props.issue) return null return ( <Panel header={`${props.issue.title} by ${getCreator(props.issue).name || getCreator(props.issue).login}`} eventKey={props.issue.id}> <MarkdownBlock body={getContent(props.issue)} /> </Panel> ) } export default Issue
Work around react router bug
Work around react router bug <Miss /> sometimes renders even when it should not
JavaScript
mit
clembou/github-requests,clembou/github-requests,clembou/github-requests
--- +++ @@ -4,6 +4,9 @@ import { getCreator, getContent } from '../shared/requestUtils' const Issue = props => { + if (!props.issue) + return null + return ( <Panel header={`${props.issue.title} by ${getCreator(props.issue).name || getCreator(props.issue).login}`}
9c2086204891e1b78e8cc077272018238d0ae5c1
server/vote.js
server/vote.js
// TODO: should the baseScore be stored, and updated at vote time? // This interface should change and become more OO, this'll do for now var Scoring = { // re-run the scoring algorithm on a single object updateObject: function(object) { // just count the number of votes for now var baseScore = MyVotes.find({votedFor: object._id}).count(); // now multiply by 'age' exponentiated // FIXME: timezones <-- set by server or is getTime() ok? var ageInHours = (new Date().getTime() - object.submitted) / (60 * 60 * 1000); object.score = baseScore * Math.pow(ageInHours + 2, -0.1375); }, // rerun all the scoring updateScores: function() { Posts.find().forEach(function(post) { Scoring.updateObject(post); Posts.update(post._id, {$set: {score: post.score}}); }); } } Meteor.methods({ voteForPost: function(post){ var user = this.userId(); if(!user) return false; var myvote = MyVotes.findOne({votedFor: post._id, user: user}); if(myvote) return false; MyVotes.insert({votedFor: post._id, user: user, vote: 1}); Scoring.updateObject(post); Posts.update(post._id, {$set: {score: post.score}}); return true; } });
// TODO: should the baseScore be stored, and updated at vote time? // This interface should change and become more OO, this'll do for now var Scoring = { // re-run the scoring algorithm on a single object updateObject: function(object) { // just count the number of votes for now var baseScore = object.votes; // now multiply by 'age' exponentiated // FIXME: timezones <-- set by server or is getTime() ok? var ageInHours = (new Date().getTime() - object.submitted) / (60 * 60 * 1000); object.score = baseScore * Math.pow(ageInHours + 2, -0.1375); }, // rerun all the scoring updateScores: function() { Posts.find().forEach(function(post) { Scoring.updateObject(post); Posts.update(post._id, {$set: {score: post.score}}); }); } } Meteor.methods({ voteForPost: function(post){ var userId = this.userId(); if(!userId) return false; // atomically update the post's votes var query = {_id: post._id, voters: {$ne: userId}}; var update = {$push: {voters: userId}, $inc: {votes: 1}}; Posts.update(query, update); // now update the post's score post = Posts.findOne(post._id); Scoring.updateObject(post); Posts.update(post._id, {$set: {score: post.score}}); return true; } });
Use an atomic update operation
Use an atomic update operation
JavaScript
mit
mrn3/ldsdiscuss,delgermurun/Telescope,manriquef/Vulcan,SachaG/Gamba,geverit4/Telescope,TribeMedia/Screenings,IQ2022/Telescope,eruwinu/presto,caglarsayin/Telescope,rtluu/immersive,aozora/Telescope,zires/Telescope,cloudunicorn/fundandexit,Daz2345/Telescope,em0ney/Telescope,iraasta/quickformtest,covernal/Telescope,STANAPO/Telescope,KarimHmaissi/Codehunt,edjv711/presto,veerjainATgmail/Telescope,covernal/Telescope,jamesrhymer/iwishcitiescould,Bloc/Telescope,SachaG/swpsub,SachaG/bjjbot,TelescopeJS/Screenings,haribabuthilakar/fh,Daz2345/dhPulse,jkuruzovich/projecthunt,MallorcaJS/discuss.mallorcajs.com,elamotte/indieshunt,cloudunicorn/fundandexit,TribeMedia/Telescope,julienlapointe/telescope-nova-social-news,jparyani/Telescope,SachaG/swpsub,geoclicks/Telescope,vazco/Telescope,LuisHerranz/Telescope,ahmadassaf/Telescope,decent10/Telescope,lpatmo/cb-links,wangleihd/Telescope,dima7b/stewardsof,mandym-webdev/digitalnomadnews,okaysee/snackr,LuisHerranz/Telescope,McBainCO/telescope-apto-news,Eynaliyev/Screenings,robertoscaccia/Crafteria-webapp,eruwinu/presto,PaulAsjes/snackr,xamfoo/Telescope,nhlennox/gbjobs,georules/iwishcitiescould,baptistemac/Telescope,HelloMeets/HelloMakers,Leeibrah/telescope,neynah/Telescope,sophearak/Telescope,veerjainATgmail/Telescope,sdeveloper/Telescope,mandym-webdev/suggestanapp,cydoval/Telescope,samim23/GitXiv,automenta/sernyl,bharatjilledumudi/StockX,wojingdaile/Telescope,SwarnaKishore/TechTrendz,queso/Telescope,MeteorHudsonValley/Telescope,georules/iwishcitiescould,kakedis/Telescope,sophearak/Telescope,edjv711/presto,eruwinu/presto,NodeJSBarenko/Telescope,cloudunicorn/fundandexit,TodoTemplates/Telescope,chemceem/telescopeapp,Tobi2705/Telescope,tepk/Telescope,georules/iwishcitiescould,tommytwoeyes/Telescope,wduntak/tibetalk,WeAreWakanda/telescope,mandym-webdev/suggestanapp,neynah/Telescope,Discordius/Lesswrong2,codebuddiesdotorg/cb-v2,bengott/Telescope,wende/quickformtest,metstrike/Telescope,maxtor3569/Telescope,victorleungtw/AskMe,Healdb/Telescope,sing1ee/Telescope,opendataforgood/dataforgood_restyling,dominictracey/Telescope,SachaG/Gamba,sabon/great-balls-of-fire,maxtor3569/Telescope,pombredanne/Telescope,wooplaza/wpmob,Alekzanther/LawScope,Discordius/Telescope,Erwyn/Test-deploy-telescope,nishanbose/Telescope,almeidamarcell/AplicativoDoDia,Air2air/Telescope,NYUMusEdLab/fork-cb,aykutyaman/Telescope,lpatmo/cb-links,cdinnison/NPnews,tepk/Telescope,gzingraf/GreenLight-Pix,automenta/sernyl,crozzfire/hacky,nwabdou85/tagsira_,wende/quickformtest,guillaumj/Telescope,SachaG/bjjbot,mr1azl/Telescope,tepk/Telescope,wunderkraut/WunderShare,enginbodur/TelescopeLatest,weld-co/weld-telescope,mr1azl/Telescope,TribeMedia/Telescope,Discordius/Lesswrong2,jeehag/linkupp,nikhilno1/Telescope,jparyani/Telescope,Discordius/Lesswrong2,kakedis/Telescope,tupeloTS/telescopety,GitYong/Telescope,Leeibrah/telescope,bharatjilledumudi/StockX,alertdelta/asxbase,huaiyudavid/rentech,Code-for-Miami/miami-graph-telescope,theartsnetwork/artytrends,lewisnyman/Telescope,LocalFoodSupply/CrunchHunt,ryangum/telescope,datracka/dataforgood,metstrike/Telescope,theartsnetwork/artytrends,johndpark/Telescope,hoihei/Telescope,Healdb/Telescope,youprofit/Telescope,geverit4/Telescope,mr1azl/Telescope,Daz2345/Telescope,ryeskelton/Telescope,jrmedia/oilgas,arbfay/Telescope,GitYong/Telescope,basemm911/questionsociety,johndpark/Telescope,VulcanJS/Vulcan,Bloc/Telescope,codebuddiesdotorg/cb-v2,iraasta/quickformtest,lambtron/goodwillhunt.org,MeteorKorea/MeteorJS_KR,SachaG/Zensroom,weld-co/weld-telescope,wangleihd/Telescope,evilhei/itForum,Daz2345/Telescope,codebuddiesdotorg/cb-v2,kakedis/Telescope,tonyoconnell/nootropics,innesm4/strictly44,basemm911/questionsociety,rizakaynak/Telescope,silky/GitXiv,IanWhalen/Telescope,TribeMedia/Screenings,xamfoo/Telescope,UCSC-MedBook/MedBook-Telescope3,lpatmo/cb2,TribeMedia/Screenings,Code-for-Miami/miami-graph-telescope,aykutyaman/Telescope,tommytwoeyes/Telescope,arbfay/Telescope,braskinfvr/storytellers,lpatmo/cb-links,delgermurun/Telescope,IQ2022/Telescope,zires/Telescope,evilhei/itForum,Discordius/Lesswrong2,ryeskelton/Telescope,parkeasz/Telescope,rizakaynak/Telescope,JackAdams/meteorpad-index,dima7b/stewardsof,wduntak/tibetalk,SachaG/Zensroom,zires/Telescope,SachaG/fundandexit,lpatmo/cb2,sethbonnie/StartupNews,bshenk/projectIterate,dominictracey/Telescope,almogdesign/Telescope,fr0zen/viajavaga,adhikariaman01/Telescope,aichane/digigov,cmrberry/startup-stories,mavidser/Telescope,thinkxl/telescope-theme-mono,cydoval/Telescope,evilhei/itForum,fr0zen/viajavaga,faaez/Telescope,tupeloTS/grittynashville,yourcelf/Telescope,tylermalin/Screenings,meteorclub/crater.io,nickmke/decibel,SachaG/bjjbot,huaiyudavid/rentech,acidsound/Telescope,edjv711/presto,crozzfire/hacky,nishanbose/Telescope,bharatjilledumudi/StockX,braskinfvr/storytellers,julienlapointe/telescope-nova-social-news,NodeJSBarenko/Telescope,zandboxapp/zandbox,azukiapp/Telescope,maxtor3569/Telescope,jbschaff/StartupNews,HelloMeets/HelloMakers,nickmke/decibel,queso/Telescope,STANAPO/Telescope,jkuruzovich/projecthunt,Healdb/Telescope,danieltynerbryan/ProductNews,GeoffAbbott/easyLife,cydoval/Telescope,NYUMusEdLab/fork-cb,wunderkraut/WunderShare,SwarnaKishore/TechTrendz,capensisma/Asteroid,ibrahimcesar/Screenings,sungwoncho/Telescope,tupeloTS/grittynashville,gzingraf/GreenLight-Pix,nwabdou85/tagsira,TelescopeJS/Screenings,sdeveloper/Telescope,ahmadassaf/Telescope,Daz2345/dhPulse,almogdesign/Telescope,yourcelf/Telescope,TelescopeJS/CrunchHunt,wojingdaile/Telescope,nishanbose/Telescope,asm-products/discourse,gkovacs/Telescope,SSOCIETY/webpages,covernal/Telescope,sharakarasic/telescope-coderdojola,StEight/Telescope,sungwoncho/Telescope,higgsj/phunt,AdmitHub/Telescope,iraasta/quickformtest,jonmc12/heypsycho,ourcities/conectacao,Accentax/betanyheter,ourcities/conectacao,rafaecheve/startupstudygroup,theartsnetwork/artytrends,wunderkraut/WunderShare,zarkem/ironhacks,SachaG/fundandexit,Air2air/Telescope,empirical-org/codex-quill,capensisma/Asteroid,Code-for-Miami/miami-graph-telescope,msavin/Telescope,liamdarmody/telescope_app,em0ney/Telescope,JstnEdr/Telescope,tupeloTS/telescopety,Eynaliyev/Screenings,SachaG/swpsub,manriquef/Vulcan,TelescopeJS/CrunchHunt,nathanmelenbrink/theRecord,guilherme22/forum,zarkem/ironhacks,sabon/teleport-troubleshoot,bshenk/projectIterate,UCSC-MedBook/MedBook-Telescope3,youprofit/Telescope,geverit4/Telescope,elamotte/indieshunt,azukiapp/Telescope,SachaG/Zensroom,jrmedia/oilgas,huaiyudavid/rentech,parkeasz/Telescope,msavin/Telescope,baptistemac/Telescope,bharatjilledumudi/india-shop,simbird/Test,yourcelf/Telescope,aykutyaman/Telescope,sabon/great-balls-of-fire,STANAPO/Telescope,geoclicks/Telescope,tart2000/Telescope,ahmadassaf/Telescope,MeteorHudsonValley/Telescope,parkeasz/Telescope,bengott/Telescope,vazco/Telescope,jrmedia/oilgas,silky/GitXiv,acidsound/Telescope,TodoTemplates/Telescope,dominictracey/Telescope,tart2000/Telescope,innesm4/strictly44,ibrahimcesar/Screenings,veerjainATgmail/Telescope,meurio/conectacao,GeoffAbbott/dfl,enginbodur/TelescopeLatest,hudat/Behaviorally,rselk/telescope,jonmc12/heypsycho,azukiapp/Telescope,tylermalin/Screenings,cmrberry/startup-stories,aichane/digigov,Discordius/Telescope,filkuzmanovski/Telescope,gzingraf/GreenLight-Pix,msavin/Telescope,lewisnyman/Telescope,aozora/Telescope,PaulAsjes/snackr,nhlennox/gbjobs,Scalingo/Telescope,Air2air/Telescope,guillaumj/Telescope,danieltynerbryan/ProductNews,simbird/Test,aichane/digigov,meteorhacks/Telescope,Scalingo/Telescope,delgermurun/Telescope,flyghtdeck/beta,ibrahimcesar/Screenings,Tobi2705/telescopedeploy,KarimHmaissi/Codehunt,StEight/Telescope,StEight/Telescope,tupeloTS/telescopety,lpatmo/cb,JstnEdr/Telescope,HelloMeets/HelloMakers,nathanmelenbrink/theRecord,ryeskelton/Telescope,Heyho-letsgo/frenchmeteor,jonmc12/heypsycho,sdeveloper/Telescope,xamfoo/change-route-in-iron-router,simbird/Test,nwabdou85/tagsira_,wduntak/tibetalk,SSOCIETY/webpages,wende/quickformtest,basehaar/sumocollect,sing1ee/Telescope,TribeMedia/Telescope,TelescopeJS/Screenings,UCSC-MedBook/MedBook-Telescope2,mandym-webdev/digitalnomadnews,NodeJSBarenko/Telescope,johndpark/Telescope,faaez/Telescope,seanpat09/crebuzz,almogdesign/Telescope,Heyho-letsgo/frenchmeteor,youprofit/Telescope,Eynaliyev/Screenings,wilsonpeng8/growthintensive,basemm911/questionsociety,MeteorHudsonValley/Telescope,Discordius/Telescope,adhikariaman01/Telescope,geoclicks/Telescope,SachaG/fundandexit,guillaumj/Telescope,WeAreWakanda/telescope,tylermalin/Screenings,WeAreWakanda/telescope,lambtron/goodwillhunt.org,Alekzanther/LawScope,metstrike/Telescope,sing1ee/Telescope,Scalingo/Telescope,zarkem/ironhacks,enginbodur/TelescopeLatest,AdmitHub/Telescope,em0ney/Telescope,VulcanJS/Vulcan,flyghtdeck/beta,GeoffAbbott/dfl,bharatjilledumudi/india-shop,bshenk/projectIterate,nathanmelenbrink/theRecord,tonyoconnell/nootropics,silky/GitXiv,rafaecheve/startupstudygroup,faaez/Telescope,jamesrhymer/iwishcitiescould,lpatmo/cb2,adhikariaman01/Telescope,IQ2022/Telescope,mavidser/Telescope,GeoffAbbott/easyLife,jbschaff/StartupNews,bharatjilledumudi/india-shop,LocalFoodSupply/CrunchHunt,niranjans/Indostartups,acidsound/Telescope,automenta/sernyl,wrichman/tuleboxapp,liamdarmody/telescope_app,caglarsayin/Telescope,samim23/GitXiv,sethbonnie/StartupNews,bengott/Telescope,tupeloTS/grittynashville,aozora/Telescope,SSOCIETY/webpages,sabon/great-balls-of-fire,queso/Telescope,arunoda/Telescope,julienlapointe/telescope-nova-social-news,rtluu/immersive,wangleihd/Telescope,Daz2345/dhPulse,rtluu/immersive,lpatmo/cb,Leeibrah/telescope,tommytwoeyes/Telescope,LuisHerranz/Telescope,TelescopeJS/Meta,jbschaff/StartupNews,nikhilno1/Telescope,basehaar/sumocollect,SachaG/Gamba,dima7b/stewardsof,haribabuthilakar/fh,jamesrhymer/iwishcitiescould,samim23/GitXiv,capensisma/Asteroid,rizakaynak/Telescope,saadullahkhan/giteor,TodoTemplates/Telescope,Alekzanther/LawScope,netham91/Telescope,xamfoo/change-route-in-iron-router,sharakarasic/telescope-coderdojola,manriquef/Vulcan,UCSC-MedBook/MedBook-Telescope3,pombredanne/Telescope,hoihei/Telescope,danieltynerbryan/ProductNews,sophearak/Telescope,meteorhacks/Telescope,pombredanne/Telescope,nwabdou85/tagsira,wooplaza/wpmob,sungwoncho/Telescope,nhlennox/gbjobs,hoihei/Telescope,lpatmo/sibp,lewisnyman/Telescope,gkovacs/Telescope,meteorclub/crater.io,UCSC-MedBook/MedBook-Telescope2,filkuzmanovski/Telescope,meurio/conectacao,Discordius/Telescope,xamfoo/change-route-in-iron-router,caglarsayin/Telescope,JstnEdr/Telescope,sethbonnie/StartupNews,arbfay/Telescope,mavidser/Telescope
--- +++ @@ -6,7 +6,7 @@ updateObject: function(object) { // just count the number of votes for now - var baseScore = MyVotes.find({votedFor: object._id}).count(); + var baseScore = object.votes; // now multiply by 'age' exponentiated // FIXME: timezones <-- set by server or is getTime() ok? @@ -29,14 +29,16 @@ Meteor.methods({ voteForPost: function(post){ - var user = this.userId(); - if(!user) return false; - - var myvote = MyVotes.findOne({votedFor: post._id, user: user}); - if(myvote) return false; - - MyVotes.insert({votedFor: post._id, user: user, vote: 1}); + var userId = this.userId(); + if(!userId) return false; + // atomically update the post's votes + var query = {_id: post._id, voters: {$ne: userId}}; + var update = {$push: {voters: userId}, $inc: {votes: 1}}; + Posts.update(query, update); + + // now update the post's score + post = Posts.findOne(post._id); Scoring.updateObject(post); Posts.update(post._id, {$set: {score: post.score}});
d2d1d18134787a398511c60dccec4ee89f636edc
examples/cherry-pick/app/screens/application/index.js
examples/cherry-pick/app/screens/application/index.js
import './base.css'; import './application.css'; import 'suitcss-base'; import 'suitcss-utils-text'; import 'suitcss-components-arrange'; import React from 'react'; module.exports = React.createClass({ contextTypes: { router: React.PropTypes.object.isRequired }, link: function () { var router = this.context.router; return router.generate.apply(router, arguments); }, getInitialState() { var time = new Date().getTime(); // setInterval(this.updateTime, 1000); return { time }; }, updateTime() { var time = new Date().getTime(); this.setState({time}); }, render: function () { return ( <div className='Application'> <div className='Navbar'> <div className='Navbar-header'> <a className='Navbar-brand' href={this.link('index')}></a> </div> </div> <div className='Application-content'> {this.props.children} </div> <footer className='Footer'> <p className='u-textCenter'>Cherrytree Demo. · <a href='github.com/QubitProducts/cherrytree'>Cherrytree Repo</a> · <a href='github.com/KidkArolis/cherrypick'>Demo Source Code</a> </p> </footer> </div> ); } });
import './base.css'; import './application.css'; import 'suitcss-base'; import 'suitcss-utils-text'; import 'suitcss-components-arrange'; import React from 'react'; module.exports = React.createClass({ contextTypes: { router: React.PropTypes.object.isRequired }, link: function () { var router = this.context.router; return router.generate.apply(router, arguments); }, getInitialState() { var time = new Date().getTime(); // setInterval(this.updateTime, 1000); return { time }; }, updateTime() { var time = new Date().getTime(); this.setState({time}); }, render: function () { return ( <div className='Application'> <div className='Navbar'> <div className='Navbar-header'> <a className='Navbar-brand' href={this.link('index')}></a> </div> </div> <div className='Application-content'> {this.props.children} </div> <footer className='Footer'> <p className='u-textCenter'>Cherrytree Demo. · <a href='https://github.com/QubitProducts/cherrytree'>Cherrytree Repo</a> · <a href='https://github.com/QubitProducts/cherrytree/tree/master/examples/cherry-pick'>Demo Source Code</a> </p> </footer> </div> ); } });
Fix links in the cherry-pick demo
Fix links in the cherry-pick demo
JavaScript
mit
nathanboktae/cherrytree,QubitProducts/cherrytree,QubitProducts/cherrytree,nathanboktae/cherrytree
--- +++ @@ -41,8 +41,8 @@ <footer className='Footer'> <p className='u-textCenter'>Cherrytree Demo. · - <a href='github.com/QubitProducts/cherrytree'>Cherrytree Repo</a> · - <a href='github.com/KidkArolis/cherrypick'>Demo Source Code</a> + <a href='https://github.com/QubitProducts/cherrytree'>Cherrytree Repo</a> · + <a href='https://github.com/QubitProducts/cherrytree/tree/master/examples/cherry-pick'>Demo Source Code</a> </p> </footer> </div>
4a68f3869ab9af0c3b51bff223c36d49b58e5df3
app/views/wrapper.js
app/views/wrapper.js
module.exports = function (body) { return ` <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Minor WOT</title> <link rel="stylesheet" href="/style.css" /> <script src="/app.js" defer></script> ${body} `; }
module.exports = function (body) { return ` <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Minor WOT</title> <link rel="stylesheet" href="/style.css" /> <script src="/app.js" defer></script> <div data-root> ${body} </div> `; }
Add data-root div around main body for later use
Add data-root div around main body for later use
JavaScript
mit
rijkvanzanten/luaus
--- +++ @@ -5,6 +5,8 @@ <title>Minor WOT</title> <link rel="stylesheet" href="/style.css" /> <script src="/app.js" defer></script> - ${body} + <div data-root> + ${body} + </div> `; }
1fa073552fd0c806aae62e6b317199e46aabd085
src/ParseCliServer.js
src/ParseCliServer.js
import express from 'express'; import bodyParser from 'body-parser'; import AppCache from 'parse-server/lib/cache'; import ParseCliController from './ParseCliController'; import ParseCliRouter from './ParseCliRouter'; import VendorAdapter from './VendorAdapter'; class ParseCliServer { constructor({ config, vendorAdapter, cloud, public_html }) { if (config) { AppCache.put(config.applicationId, config); if (config.limit != undefined) { this.length_limit = limit; } else { this.length_limit = '500mb'; } } if (!vendorAdapter) { vendorAdapter = new VendorAdapter({ config: config, cloud: cloud, public_html: public_html }); } let controller = new ParseCliController(vendorAdapter); this.router = new ParseCliRouter(controller); } get app() { var app = express(); /* parse-cli always send json body but don't send a Content-Type header or in some cases send an unexpected value like application/octet-stream. express request length limit is very low. Change limit value for fix 'big' files deploy problems. */ app.use(bodyParser.json({type: function() { return true; }, limit: this.length_limit})); this.router.mountOnto(app); return app; } } export default ParseCliServer; export { ParseCliServer };
import express from 'express'; import bodyParser from 'body-parser'; import AppCache from 'parse-server/lib/cache'; import ParseCliController from './ParseCliController'; import ParseCliRouter from './ParseCliRouter'; import VendorAdapter from './VendorAdapter'; class ParseCliServer { constructor({ config, vendorAdapter, cloud, public_html }) { if (config) { AppCache.put(config.applicationId, config); if (config.limit != undefined) { this.length_limit = config.limit; } else { this.length_limit = '500mb'; } } if (!vendorAdapter) { vendorAdapter = new VendorAdapter({ config: config, cloud: cloud, public_html: public_html }); } let controller = new ParseCliController(vendorAdapter); this.router = new ParseCliRouter(controller); } get app() { var app = express(); /* parse-cli always send json body but don't send a Content-Type header or in some cases send an unexpected value like application/octet-stream. express request length limit is very low. Change limit value for fix 'big' files deploy problems. */ app.use(bodyParser.json({type: function() { return true; }, limit: this.length_limit})); this.router.mountOnto(app); return app; } } export default ParseCliServer; export { ParseCliServer };
Fix typo in limit configuration and remove bodyparser urlencoded middleware.
Fix typo in limit configuration and remove bodyparser urlencoded middleware.
JavaScript
mit
back4app/parse-cli-server,luisholanda/parse-cli-server
--- +++ @@ -17,7 +17,7 @@ if (config) { AppCache.put(config.applicationId, config); if (config.limit != undefined) { - this.length_limit = limit; + this.length_limit = config.limit; } else { this.length_limit = '500mb'; }
1f34969f216a7333a27fbd48b97293f3a22d0ec1
lib/Object/map-to-array.js
lib/Object/map-to-array.js
'use strict'; var callable = require('./valid-callable') , forEach = require('./for-each') , defaultCb = function (value, key) { return [key, value]; }; module.exports = function (obj, cb/*, thisArg*/) { var a = [], thisArg = arguments[2]; cb = (cb == null) ? defaultCb : callable(cb); forEach(obj, function (value, key) { a.push(cb.call(thisArg, value, key, this)); }, obj, arguments[3]); return a; };
'use strict'; var callable = require('./valid-callable') , forEach = require('./for-each') , call = Function.prototype.call , defaultCb = function (value, key) { return [key, value]; }; module.exports = function (obj, cb/*, thisArg*/) { var a = [], thisArg = arguments[2]; cb = (cb == null) ? defaultCb : callable(cb); forEach(obj, function (value, key) { a.push(call.call(cb, thisArg, value, key, this)); }, obj, arguments[3]); return a; };
Support any callable object as callback
Support any callable object as callback
JavaScript
isc
medikoo/es5-ext
--- +++ @@ -2,6 +2,8 @@ var callable = require('./valid-callable') , forEach = require('./for-each') + + , call = Function.prototype.call , defaultCb = function (value, key) { return [key, value]; }; @@ -10,7 +12,7 @@ cb = (cb == null) ? defaultCb : callable(cb); forEach(obj, function (value, key) { - a.push(cb.call(thisArg, value, key, this)); + a.push(call.call(cb, thisArg, value, key, this)); }, obj, arguments[3]); return a; };
f28118fe786bf4fea5b899ff27e185df532e884d
StringManipulation/ConsecutiveString/consecutivestring.js
StringManipulation/ConsecutiveString/consecutivestring.js
var ConsecutiveString = function(){}; /*validate k and length of the array. If the array length is 0 of less than k of k is less thatn or equal to 0 return an empty string. if k is 1, then return the longest string. else, loop through the string, */ ConsecutiveString.prototype.longestConsec = function(starr, k){ var out = "", concat = ""; if((k <= 0 || starr.length == 0) || k > starr.length){ return out; } else if(k === 1){ var s = starr.sort(function(b, a){ return a - b; }); out = s[s.length-1] }else{ for(var x = 0; x <= k; x++){ var f3 = starr[x] + starr[x+1] + starr[x+2]; var n3 = starr[x+1] + starr[x+2] + starr[x+3]; if(n3.length > f3.length){ starr[x] = null; } } } return out; }; module.exports = ConsecutiveString
var ConsecutiveString = function(){}; /*validate k and length of the array. If the array length is 0 of less than k of k is less thatn or equal to 0 return an empty string. if k is 1, then return the longest string. else, loop through the string, */ ConsecutiveString.prototype.longestConsec = function(starr, k){ var out = "", concat = ""; if((k <= 0 || starr.length == 0) || k > starr.length){ return out; } else if(k === 1){ var s = starr.sort(function(b, a){ return a - b; }); out = s[s.length-1] }else{ let lens = strarr.map( (_,i,arr) => arr.slice(i,i+k).join('').length ), i = lens.indexOf( Math.max(...lens) ); out = strarr.slice(i,i+k).join('') } } return out; }; module.exports = ConsecutiveString
Add Consectutive String Description solution
Add Consectutive String Description solution
JavaScript
mit
BrianLusina/JS-Snippets
--- +++ @@ -15,12 +15,9 @@ }); out = s[s.length-1] }else{ - for(var x = 0; x <= k; x++){ - var f3 = starr[x] + starr[x+1] + starr[x+2]; - var n3 = starr[x+1] + starr[x+2] + starr[x+3]; - if(n3.length > f3.length){ - starr[x] = null; - } + let lens = strarr.map( (_,i,arr) => arr.slice(i,i+k).join('').length ), + i = lens.indexOf( Math.max(...lens) ); + out = strarr.slice(i,i+k).join('') } }
a4d85bb42cf25879f154fba5b647778f503984a4
docs/client/lib/navigate.js
docs/client/lib/navigate.js
navigate = function (hash) { window.location.replace(Meteor.absoluteUrl(null, { secure: true }) + hash); };
navigate = function (hash) { window.location.replace(Meteor.absoluteUrl() + hash); };
Remove extra option to absoluteUrl
Remove extra option to absoluteUrl force-ssl already sets this option by default
JavaScript
mit
msavin/meteor,daslicht/meteor,dboyliao/meteor,colinligertwood/meteor,chinasb/meteor,yonglehou/meteor,sclausen/meteor,jdivy/meteor,ashwathgovind/meteor,cog-64/meteor,elkingtonmcb/meteor,l0rd0fwar/meteor,meteor-velocity/meteor,brettle/meteor,dfischer/meteor,HugoRLopes/meteor,kencheung/meteor,jdivy/meteor,chiefninew/meteor,sunny-g/meteor,Paulyoufu/meteor-1,AnthonyAstige/meteor,whip112/meteor,msavin/meteor,rozzzly/meteor,sclausen/meteor,luohuazju/meteor,joannekoong/meteor,dandv/meteor,Puena/meteor,yiliaofan/meteor,sitexa/meteor,jagi/meteor,saisai/meteor,4commerce-technologies-AG/meteor,williambr/meteor,GrimDerp/meteor,alexbeletsky/meteor,luohuazju/meteor,katopz/meteor,modulexcite/meteor,mauricionr/meteor,paul-barry-kenzan/meteor,stevenliuit/meteor,fashionsun/meteor,AnjirHossain/meteor,jdivy/meteor,Quicksteve/meteor,AnthonyAstige/meteor,vjau/meteor,yyx990803/meteor,sitexa/meteor,vacjaliu/meteor,cog-64/meteor,jirengu/meteor,baiyunping333/meteor,arunoda/meteor,sdeveloper/meteor,yanisIk/meteor,cog-64/meteor,ljack/meteor,eluck/meteor,jeblister/meteor,neotim/meteor,brdtrpp/meteor,mauricionr/meteor,youprofit/meteor,shadedprofit/meteor,yyx990803/meteor,joannekoong/meteor,AnjirHossain/meteor,lieuwex/meteor,benjamn/meteor,baiyunping333/meteor,katopz/meteor,rabbyalone/meteor,HugoRLopes/meteor,D1no/meteor,lassombra/meteor,pjump/meteor,DAB0mB/meteor,karlito40/meteor,shadedprofit/meteor,williambr/meteor,dboyliao/meteor,Theviajerock/meteor,chinasb/meteor,devgrok/meteor,lassombra/meteor,judsonbsilva/meteor,allanalexandre/meteor,saisai/meteor,justintung/meteor,Puena/meteor,benstoltz/meteor,chiefninew/meteor,Puena/meteor,sitexa/meteor,GrimDerp/meteor,benstoltz/meteor,modulexcite/meteor,aramk/meteor,jrudio/meteor,vjau/meteor,vacjaliu/meteor,benjamn/meteor,ljack/meteor,kengchau/meteor,lorensr/meteor,yalexx/meteor,meteor-velocity/meteor,Eynaliyev/meteor,HugoRLopes/meteor,johnthepink/meteor,alexbeletsky/meteor,ljack/meteor,codedogfish/meteor,stevenliuit/meteor,eluck/meteor,Ken-Liu/meteor,williambr/meteor,karlito40/meteor,henrypan/meteor,IveWong/meteor,queso/meteor,yinhe007/meteor,deanius/meteor,vacjaliu/meteor,HugoRLopes/meteor,zdd910/meteor,DCKT/meteor,benjamn/meteor,4commerce-technologies-AG/meteor,brdtrpp/meteor,newswim/meteor,framewr/meteor,lieuwex/meteor,lieuwex/meteor,udhayam/meteor,akintoey/meteor,rozzzly/meteor,ashwathgovind/meteor,judsonbsilva/meteor,mubassirhayat/meteor,TechplexEngineer/meteor,D1no/meteor,zdd910/meteor,ndarilek/meteor,evilemon/meteor,nuvipannu/meteor,youprofit/meteor,Hansoft/meteor,wmkcc/meteor,pandeysoni/meteor,chasertech/meteor,shrop/meteor,allanalexandre/meteor,namho102/meteor,DCKT/meteor,colinligertwood/meteor,imanmafi/meteor,jenalgit/meteor,PatrickMcGuinness/meteor,brdtrpp/meteor,chinasb/meteor,Jeremy017/meteor,DCKT/meteor,tdamsma/meteor,alphanso/meteor,lpinto93/meteor,devgrok/meteor,mubassirhayat/meteor,GrimDerp/meteor,modulexcite/meteor,TribeMedia/meteor,GrimDerp/meteor,planet-training/meteor,vacjaliu/meteor,allanalexandre/meteor,elkingtonmcb/meteor,Prithvi-A/meteor,kencheung/meteor,eluck/meteor,brdtrpp/meteor,mirstan/meteor,newswim/meteor,kengchau/meteor,katopz/meteor,benstoltz/meteor,Ken-Liu/meteor,deanius/meteor,tdamsma/meteor,colinligertwood/meteor,dfischer/meteor,brettle/meteor,bhargav175/meteor,skarekrow/meteor,jg3526/meteor,IveWong/meteor,skarekrow/meteor,shmiko/meteor,zdd910/meteor,joannekoong/meteor,LWHTarena/meteor,namho102/meteor,tdamsma/meteor,guazipi/meteor,Jonekee/meteor,guazipi/meteor,paul-barry-kenzan/meteor,michielvanoeffelen/meteor,dboyliao/meteor,cbonami/meteor,deanius/meteor,ericterpstra/meteor,hristaki/meteor,AlexR1712/meteor,meonkeys/meteor,jenalgit/meteor,jg3526/meteor,henrypan/meteor,benstoltz/meteor,emmerge/meteor,oceanzou123/meteor,Eynaliyev/meteor,sdeveloper/meteor,devgrok/meteor,akintoey/meteor,esteedqueen/meteor,meonkeys/meteor,Theviajerock/meteor,lorensr/meteor,somallg/meteor,elkingtonmcb/meteor,pjump/meteor,vjau/meteor,TechplexEngineer/meteor,yalexx/meteor,justintung/meteor,neotim/meteor,juansgaitan/meteor,Puena/meteor,neotim/meteor,Hansoft/meteor,mauricionr/meteor,HugoRLopes/meteor,D1no/meteor,DAB0mB/meteor,chengxiaole/meteor,IveWong/meteor,deanius/meteor,D1no/meteor,jenalgit/meteor,paul-barry-kenzan/meteor,DCKT/meteor,dfischer/meteor,newswim/meteor,Profab/meteor,Urigo/meteor,sunny-g/meteor,lieuwex/meteor,yalexx/meteor,qscripter/meteor,ericterpstra/meteor,johnthepink/meteor,guazipi/meteor,planet-training/meteor,allanalexandre/meteor,h200863057/meteor,modulexcite/meteor,lorensr/meteor,johnthepink/meteor,calvintychan/meteor,Ken-Liu/meteor,michielvanoeffelen/meteor,neotim/meteor,ndarilek/meteor,cog-64/meteor,daltonrenaldo/meteor,codingang/meteor,benjamn/meteor,Jonekee/meteor,shrop/meteor,baiyunping333/meteor,chasertech/meteor,mirstan/meteor,chinasb/meteor,chinasb/meteor,udhayam/meteor,cherbst/meteor,JesseQin/meteor,AnthonyAstige/meteor,AnjirHossain/meteor,alexbeletsky/meteor,Profab/meteor,evilemon/meteor,justintung/meteor,AlexR1712/meteor,AlexR1712/meteor,SeanOceanHu/meteor,deanius/meteor,mjmasn/meteor,PatrickMcGuinness/meteor,AlexR1712/meteor,newswim/meteor,aramk/meteor,iman-mafi/meteor,arunoda/meteor,jeblister/meteor,hristaki/meteor,dev-bobsong/meteor,arunoda/meteor,yiliaofan/meteor,steedos/meteor,yiliaofan/meteor,AnthonyAstige/meteor,pandeysoni/meteor,oceanzou123/meteor,aldeed/meteor,daltonrenaldo/meteor,chmac/meteor,chasertech/meteor,h200863057/meteor,PatrickMcGuinness/meteor,evilemon/meteor,baysao/meteor,ljack/meteor,alexbeletsky/meteor,qscripter/meteor,benjamn/meteor,mirstan/meteor,lassombra/meteor,Ken-Liu/meteor,rabbyalone/meteor,daslicht/meteor,DAB0mB/meteor,yonas/meteor-freebsd,whip112/meteor,kidaa/meteor,bhargav175/meteor,whip112/meteor,h200863057/meteor,planet-training/meteor,sunny-g/meteor,bhargav175/meteor,lawrenceAIO/meteor,rabbyalone/meteor,yanisIk/meteor,yonglehou/meteor,jagi/meteor,jeblister/meteor,akintoey/meteor,shmiko/meteor,colinligertwood/meteor,juansgaitan/meteor,karlito40/meteor,justintung/meteor,saisai/meteor,yonglehou/meteor,Theviajerock/meteor,udhayam/meteor,pjump/meteor,imanmafi/meteor,Paulyoufu/meteor-1,karlito40/meteor,dboyliao/meteor,shrop/meteor,kengchau/meteor,youprofit/meteor,JesseQin/meteor,Hansoft/meteor,aldeed/meteor,yonas/meteor-freebsd,nuvipannu/meteor,shrop/meteor,mirstan/meteor,cbonami/meteor,brettle/meteor,jdivy/meteor,jeblister/meteor,Eynaliyev/meteor,meteor-velocity/meteor,LWHTarena/meteor,Jeremy017/meteor,Jonekee/meteor,somallg/meteor,lpinto93/meteor,DCKT/meteor,namho102/meteor,emmerge/meteor,henrypan/meteor,paul-barry-kenzan/meteor,williambr/meteor,TribeMedia/meteor,lpinto93/meteor,sclausen/meteor,AnjirHossain/meteor,shadedprofit/meteor,jirengu/meteor,Hansoft/meteor,imanmafi/meteor,stevenliuit/meteor,yalexx/meteor,Urigo/meteor,kidaa/meteor,somallg/meteor,judsonbsilva/meteor,esteedqueen/meteor,lawrenceAIO/meteor,henrypan/meteor,Prithvi-A/meteor,akintoey/meteor,jrudio/meteor,cog-64/meteor,steedos/meteor,hristaki/meteor,baiyunping333/meteor,ashwathgovind/meteor,akintoey/meteor,pjump/meteor,bhargav175/meteor,iman-mafi/meteor,TechplexEngineer/meteor,cbonami/meteor,queso/meteor,zdd910/meteor,luohuazju/meteor,yanisIk/meteor,yinhe007/meteor,imanmafi/meteor,henrypan/meteor,shrop/meteor,vjau/meteor,jirengu/meteor,aldeed/meteor,brdtrpp/meteor,msavin/meteor,shmiko/meteor,imanmafi/meteor,msavin/meteor,IveWong/meteor,queso/meteor,framewr/meteor,chasertech/meteor,aramk/meteor,dev-bobsong/meteor,lawrenceAIO/meteor,wmkcc/meteor,cherbst/meteor,Puena/meteor,udhayam/meteor,brdtrpp/meteor,chiefninew/meteor,SeanOceanHu/meteor,IveWong/meteor,arunoda/meteor,sclausen/meteor,allanalexandre/meteor,aldeed/meteor,brettle/meteor,jenalgit/meteor,AnthonyAstige/meteor,esteedqueen/meteor,Theviajerock/meteor,4commerce-technologies-AG/meteor,iman-mafi/meteor,ashwathgovind/meteor,dboyliao/meteor,ericterpstra/meteor,dfischer/meteor,kidaa/meteor,oceanzou123/meteor,mauricionr/meteor,sunny-g/meteor,bhargav175/meteor,queso/meteor,luohuazju/meteor,neotim/meteor,emmerge/meteor,fashionsun/meteor,brettle/meteor,hristaki/meteor,yanisIk/meteor,eluck/meteor,akintoey/meteor,youprofit/meteor,jrudio/meteor,guazipi/meteor,joannekoong/meteor,daslicht/meteor,meteor-velocity/meteor,shadedprofit/meteor,planet-training/meteor,cherbst/meteor,arunoda/meteor,arunoda/meteor,Ken-Liu/meteor,tdamsma/meteor,williambr/meteor,alphanso/meteor,michielvanoeffelen/meteor,udhayam/meteor,lieuwex/meteor,yyx990803/meteor,Profab/meteor,LWHTarena/meteor,chmac/meteor,somallg/meteor,bhargav175/meteor,AnthonyAstige/meteor,alphanso/meteor,mjmasn/meteor,l0rd0fwar/meteor,baiyunping333/meteor,TribeMedia/meteor,brettle/meteor,rabbyalone/meteor,skarekrow/meteor,yinhe007/meteor,sunny-g/meteor,EduShareOntario/meteor,JesseQin/meteor,chinasb/meteor,jeblister/meteor,papimomi/meteor,juansgaitan/meteor,yiliaofan/meteor,youprofit/meteor,emmerge/meteor,Jeremy017/meteor,servel333/meteor,steedos/meteor,pjump/meteor,jeblister/meteor,wmkcc/meteor,iman-mafi/meteor,devgrok/meteor,ashwathgovind/meteor,mjmasn/meteor,cog-64/meteor,papimomi/meteor,codedogfish/meteor,meonkeys/meteor,lorensr/meteor,Prithvi-A/meteor,yiliaofan/meteor,katopz/meteor,codedogfish/meteor,l0rd0fwar/meteor,HugoRLopes/meteor,DCKT/meteor,benjamn/meteor,LWHTarena/meteor,msavin/meteor,mirstan/meteor,codingang/meteor,jagi/meteor,lorensr/meteor,Jonekee/meteor,steedos/meteor,PatrickMcGuinness/meteor,iman-mafi/meteor,iman-mafi/meteor,evilemon/meteor,esteedqueen/meteor,johnthepink/meteor,nuvipannu/meteor,henrypan/meteor,Eynaliyev/meteor,joannekoong/meteor,yanisIk/meteor,paul-barry-kenzan/meteor,jagi/meteor,yalexx/meteor,sdeveloper/meteor,oceanzou123/meteor,fashionsun/meteor,chengxiaole/meteor,servel333/meteor,justintung/meteor,mubassirhayat/meteor,mjmasn/meteor,Quicksteve/meteor,udhayam/meteor,iman-mafi/meteor,katopz/meteor,yanisIk/meteor,allanalexandre/meteor,hristaki/meteor,guazipi/meteor,Paulyoufu/meteor-1,servel333/meteor,alphanso/meteor,vacjaliu/meteor,colinligertwood/meteor,Profab/meteor,rabbyalone/meteor,neotim/meteor,Ken-Liu/meteor,cherbst/meteor,chengxiaole/meteor,l0rd0fwar/meteor,justintung/meteor,karlito40/meteor,yanisIk/meteor,yalexx/meteor,LWHTarena/meteor,codedogfish/meteor,lieuwex/meteor,TechplexEngineer/meteor,williambr/meteor,rabbyalone/meteor,Puena/meteor,elkingtonmcb/meteor,sclausen/meteor,youprofit/meteor,lpinto93/meteor,ericterpstra/meteor,meonkeys/meteor,rozzzly/meteor,kengchau/meteor,mubassirhayat/meteor,chinasb/meteor,D1no/meteor,JesseQin/meteor,namho102/meteor,neotim/meteor,jeblister/meteor,zdd910/meteor,dev-bobsong/meteor,wmkcc/meteor,EduShareOntario/meteor,AnjirHossain/meteor,nuvipannu/meteor,chmac/meteor,AlexR1712/meteor,brdtrpp/meteor,codingang/meteor,sclausen/meteor,4commerce-technologies-AG/meteor,meteor-velocity/meteor,Theviajerock/meteor,sunny-g/meteor,servel333/meteor,calvintychan/meteor,youprofit/meteor,IveWong/meteor,sdeveloper/meteor,Eynaliyev/meteor,AlexR1712/meteor,dfischer/meteor,yanisIk/meteor,bhargav175/meteor,emmerge/meteor,ljack/meteor,steedos/meteor,Jonekee/meteor,HugoRLopes/meteor,kengchau/meteor,Profab/meteor,h200863057/meteor,EduShareOntario/meteor,qscripter/meteor,chengxiaole/meteor,wmkcc/meteor,LWHTarena/meteor,h200863057/meteor,DAB0mB/meteor,kidaa/meteor,jrudio/meteor,stevenliuit/meteor,shadedprofit/meteor,baysao/meteor,skarekrow/meteor,daltonrenaldo/meteor,hristaki/meteor,baysao/meteor,lawrenceAIO/meteor,framewr/meteor,jirengu/meteor,zdd910/meteor,mjmasn/meteor,mauricionr/meteor,servel333/meteor,somallg/meteor,dfischer/meteor,ndarilek/meteor,paul-barry-kenzan/meteor,ericterpstra/meteor,ndarilek/meteor,IveWong/meteor,luohuazju/meteor,whip112/meteor,deanius/meteor,shmiko/meteor,emmerge/meteor,alexbeletsky/meteor,baysao/meteor,somallg/meteor,imanmafi/meteor,yinhe007/meteor,dandv/meteor,devgrok/meteor,queso/meteor,eluck/meteor,judsonbsilva/meteor,Jonekee/meteor,codingang/meteor,akintoey/meteor,sitexa/meteor,dandv/meteor,cbonami/meteor,chmac/meteor,TechplexEngineer/meteor,kencheung/meteor,kidaa/meteor,newswim/meteor,jg3526/meteor,imanmafi/meteor,hristaki/meteor,tdamsma/meteor,lassombra/meteor,TribeMedia/meteor,yonglehou/meteor,juansgaitan/meteor,katopz/meteor,DAB0mB/meteor,arunoda/meteor,yinhe007/meteor,vjau/meteor,chiefninew/meteor,aramk/meteor,shmiko/meteor,TribeMedia/meteor,skarekrow/meteor,Paulyoufu/meteor-1,jagi/meteor,colinligertwood/meteor,jagi/meteor,jdivy/meteor,framewr/meteor,mauricionr/meteor,lpinto93/meteor,qscripter/meteor,jenalgit/meteor,calvintychan/meteor,shrop/meteor,yinhe007/meteor,kidaa/meteor,sitexa/meteor,GrimDerp/meteor,Urigo/meteor,jirengu/meteor,vjau/meteor,pandeysoni/meteor,alexbeletsky/meteor,williambr/meteor,guazipi/meteor,AnjirHossain/meteor,ljack/meteor,daltonrenaldo/meteor,dboyliao/meteor,lawrenceAIO/meteor,Prithvi-A/meteor,papimomi/meteor,Hansoft/meteor,fashionsun/meteor,chasertech/meteor,yyx990803/meteor,katopz/meteor,karlito40/meteor,Quicksteve/meteor,dfischer/meteor,kidaa/meteor,planet-training/meteor,papimomi/meteor,lawrenceAIO/meteor,newswim/meteor,yonas/meteor-freebsd,AnjirHossain/meteor,Ken-Liu/meteor,PatrickMcGuinness/meteor,saisai/meteor,dev-bobsong/meteor,yonas/meteor-freebsd,karlito40/meteor,Profab/meteor,Prithvi-A/meteor,planet-training/meteor,udhayam/meteor,dandv/meteor,juansgaitan/meteor,vacjaliu/meteor,daltonrenaldo/meteor,daslicht/meteor,DAB0mB/meteor,yonas/meteor-freebsd,michielvanoeffelen/meteor,framewr/meteor,brettle/meteor,skarekrow/meteor,codedogfish/meteor,Paulyoufu/meteor-1,JesseQin/meteor,cbonami/meteor,daslicht/meteor,EduShareOntario/meteor,lorensr/meteor,queso/meteor,saisai/meteor,shmiko/meteor,baysao/meteor,luohuazju/meteor,steedos/meteor,AnthonyAstige/meteor,namho102/meteor,oceanzou123/meteor,mubassirhayat/meteor,modulexcite/meteor,aldeed/meteor,sclausen/meteor,benstoltz/meteor,tdamsma/meteor,pjump/meteor,dboyliao/meteor,SeanOceanHu/meteor,msavin/meteor,stevenliuit/meteor,Eynaliyev/meteor,joannekoong/meteor,Theviajerock/meteor,ndarilek/meteor,fashionsun/meteor,alphanso/meteor,pandeysoni/meteor,mubassirhayat/meteor,johnthepink/meteor,yyx990803/meteor,nuvipannu/meteor,papimomi/meteor,yonglehou/meteor,mauricionr/meteor,kencheung/meteor,somallg/meteor,dev-bobsong/meteor,yyx990803/meteor,GrimDerp/meteor,alexbeletsky/meteor,judsonbsilva/meteor,daslicht/meteor,planet-training/meteor,mirstan/meteor,benstoltz/meteor,dev-bobsong/meteor,l0rd0fwar/meteor,framewr/meteor,PatrickMcGuinness/meteor,kengchau/meteor,emmerge/meteor,eluck/meteor,saisai/meteor,jg3526/meteor,johnthepink/meteor,meonkeys/meteor,baiyunping333/meteor,whip112/meteor,evilemon/meteor,shmiko/meteor,4commerce-technologies-AG/meteor,rozzzly/meteor,chmac/meteor,dandv/meteor,daltonrenaldo/meteor,aramk/meteor,lieuwex/meteor,ndarilek/meteor,SeanOceanHu/meteor,Hansoft/meteor,calvintychan/meteor,mirstan/meteor,oceanzou123/meteor,benstoltz/meteor,TechplexEngineer/meteor,brdtrpp/meteor,codingang/meteor,jirengu/meteor,jg3526/meteor,jg3526/meteor,eluck/meteor,pjump/meteor,DCKT/meteor,chasertech/meteor,Theviajerock/meteor,msavin/meteor,yinhe007/meteor,AnthonyAstige/meteor,EduShareOntario/meteor,lassombra/meteor,papimomi/meteor,chiefninew/meteor,yyx990803/meteor,allanalexandre/meteor,Urigo/meteor,alphanso/meteor,jrudio/meteor,yalexx/meteor,stevenliuit/meteor,pandeysoni/meteor,D1no/meteor,codedogfish/meteor,servel333/meteor,lpinto93/meteor,namho102/meteor,elkingtonmcb/meteor,cbonami/meteor,Urigo/meteor,sunny-g/meteor,jrudio/meteor,queso/meteor,judsonbsilva/meteor,cherbst/meteor,steedos/meteor,papimomi/meteor,EduShareOntario/meteor,SeanOceanHu/meteor,daltonrenaldo/meteor,judsonbsilva/meteor,calvintychan/meteor,jdivy/meteor,chmac/meteor,wmkcc/meteor,kencheung/meteor,qscripter/meteor,namho102/meteor,yonas/meteor-freebsd,4commerce-technologies-AG/meteor,yiliaofan/meteor,D1no/meteor,h200863057/meteor,Quicksteve/meteor,l0rd0fwar/meteor,aldeed/meteor,Puena/meteor,lpinto93/meteor,chasertech/meteor,HugoRLopes/meteor,Prithvi-A/meteor,kengchau/meteor,Jonekee/meteor,justintung/meteor,GrimDerp/meteor,daslicht/meteor,cog-64/meteor,Jeremy017/meteor,rozzzly/meteor,skarekrow/meteor,dandv/meteor,D1no/meteor,whip112/meteor,meonkeys/meteor,Eynaliyev/meteor,chengxiaole/meteor,Prithvi-A/meteor,elkingtonmcb/meteor,aldeed/meteor,mjmasn/meteor,ljack/meteor,4commerce-technologies-AG/meteor,TribeMedia/meteor,alexbeletsky/meteor,kencheung/meteor,servel333/meteor,michielvanoeffelen/meteor,h200863057/meteor,saisai/meteor,johnthepink/meteor,pandeysoni/meteor,whip112/meteor,sitexa/meteor,aleclarson/meteor,jenalgit/meteor,shrop/meteor,Quicksteve/meteor,codedogfish/meteor,TechplexEngineer/meteor,dboyliao/meteor,SeanOceanHu/meteor,Urigo/meteor,codingang/meteor,ashwathgovind/meteor,AlexR1712/meteor,LWHTarena/meteor,Paulyoufu/meteor-1,Jeremy017/meteor,Quicksteve/meteor,baysao/meteor,jdivy/meteor,newswim/meteor,shadedprofit/meteor,meonkeys/meteor,daltonrenaldo/meteor,lassombra/meteor,servel333/meteor,aramk/meteor,jg3526/meteor,michielvanoeffelen/meteor,devgrok/meteor,stevenliuit/meteor,sunny-g/meteor,vjau/meteor,ashwathgovind/meteor,yiliaofan/meteor,jenalgit/meteor,fashionsun/meteor,luohuazju/meteor,mjmasn/meteor,juansgaitan/meteor,aleclarson/meteor,framewr/meteor,zdd910/meteor,sdeveloper/meteor,EduShareOntario/meteor,qscripter/meteor,chiefninew/meteor,PatrickMcGuinness/meteor,shadedprofit/meteor,codingang/meteor,dandv/meteor,JesseQin/meteor,meteor-velocity/meteor,vacjaliu/meteor,modulexcite/meteor,lorensr/meteor,evilemon/meteor,Jeremy017/meteor,esteedqueen/meteor,calvintychan/meteor,pandeysoni/meteor,l0rd0fwar/meteor,esteedqueen/meteor,fashionsun/meteor,cbonami/meteor,cherbst/meteor,yonglehou/meteor,paul-barry-kenzan/meteor,SeanOceanHu/meteor,chiefninew/meteor,somallg/meteor,Urigo/meteor,rozzzly/meteor,kencheung/meteor,elkingtonmcb/meteor,colinligertwood/meteor,esteedqueen/meteor,TribeMedia/meteor,JesseQin/meteor,dev-bobsong/meteor,ericterpstra/meteor,jirengu/meteor,sdeveloper/meteor,Quicksteve/meteor,rabbyalone/meteor,Profab/meteor,yonas/meteor-freebsd,DAB0mB/meteor,devgrok/meteor,Hansoft/meteor,yonglehou/meteor,guazipi/meteor,ndarilek/meteor,meteor-velocity/meteor,chengxiaole/meteor,juansgaitan/meteor,baiyunping333/meteor,evilemon/meteor,lassombra/meteor,tdamsma/meteor,ndarilek/meteor,henrypan/meteor,nuvipannu/meteor,cherbst/meteor,benjamn/meteor,ericterpstra/meteor,alphanso/meteor,SeanOceanHu/meteor,qscripter/meteor,sdeveloper/meteor,aleclarson/meteor,modulexcite/meteor,chengxiaole/meteor,jagi/meteor,chmac/meteor,sitexa/meteor,chiefninew/meteor,lawrenceAIO/meteor,wmkcc/meteor,deanius/meteor,tdamsma/meteor,ljack/meteor,oceanzou123/meteor,nuvipannu/meteor,mubassirhayat/meteor,planet-training/meteor,eluck/meteor,Jeremy017/meteor,karlito40/meteor,calvintychan/meteor,Eynaliyev/meteor,aramk/meteor,baysao/meteor,rozzzly/meteor,michielvanoeffelen/meteor,joannekoong/meteor,allanalexandre/meteor,Paulyoufu/meteor-1,mubassirhayat/meteor
--- +++ @@ -1,3 +1,3 @@ navigate = function (hash) { - window.location.replace(Meteor.absoluteUrl(null, { secure: true }) + hash); + window.location.replace(Meteor.absoluteUrl() + hash); };
fe0d1ba2d55121a69791896e0f9fec3aa70f7c3c
public/javascript/fonts.js
public/javascript/fonts.js
WebFontConfig = { custom: { families: ['Alternate Gothic No.3', 'Clarendon FS Medium', 'Proxima Nova Light', 'Proxima Nova Semibold', 'Stub Serif FS', 'Stub Serif FS'], urls: [ 'http://f.fontdeck.com/s/css/tEGvGvL6JlBfPjTgf2p9URd+sJ0/' + window.location.hostname + '/5502.css' ] } }; (function() { var wf = document.createElement('script'); wf.src = '/javascript/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wf, s); })();
WebFontConfig = { custom: { families: ['Alternate Gothic No.3', 'Clarendon FS Medium', 'Proxima Nova Light', 'Proxima Nova Semibold', 'Stub Serif FS', 'Stub Serif FS', 'Reminder Pro Bold'], urls: [ 'http://f.fontdeck.com/s/css/tEGvGvL6JlBfPjTgf2p9URd+sJ0/' + window.location.hostname + '/5502.css' ] } }; (function() { var wf = document.createElement('script'); wf.src = '/javascript/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wf, s); })();
Add new font to JS
Add new font to JS
JavaScript
mit
robinwhittleton/static,kalleth/static,tadast/static,robinwhittleton/static,robinwhittleton/static,kalleth/static,robinwhittleton/static,alphagov/static,tadast/static,alphagov/static,alphagov/static,kalleth/static,kalleth/static,tadast/static,tadast/static
--- +++ @@ -1,5 +1,5 @@ WebFontConfig = { - custom: { families: ['Alternate Gothic No.3', 'Clarendon FS Medium', 'Proxima Nova Light', 'Proxima Nova Semibold', 'Stub Serif FS', 'Stub Serif FS'], + custom: { families: ['Alternate Gothic No.3', 'Clarendon FS Medium', 'Proxima Nova Light', 'Proxima Nova Semibold', 'Stub Serif FS', 'Stub Serif FS', 'Reminder Pro Bold'], urls: [ 'http://f.fontdeck.com/s/css/tEGvGvL6JlBfPjTgf2p9URd+sJ0/' + window.location.hostname + '/5502.css' ] } };
040681cfa5be9a0b095fab6f8f3c84c833245c94
addon/components/one-way-input.js
addon/components/one-way-input.js
import Ember from 'ember'; const { Component, get } = Ember; export default Component.extend({ tagName: 'input', type: 'text', attributeBindings: [ 'accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', 'max', 'min', 'multiple', 'name', 'pattern', 'size', 'step', 'type', 'value', 'width' ], _sanitizedValue: undefined, input() { this._handleChangeEvent(); }, change() { this._handleChangeEvent(); }, _handleChangeEvent() { this._processNewValue.call(this, this.readDOMAttr('value')); }, _processNewValue(rawValue) { const value = this.sanitizeInput(rawValue); if (this._sanitizedValue !== value) { this._sanitizedValue = value; this.attrs.update(value); } }, sanitizeInput(input) { return input; }, didReceiveAttrs() { this._super(...arguments); if (!this.attrs.update) { throw new Error(`You must provide an \`update\` action to \`{{${this.templateName}}}\`.`); } this._processNewValue.call(this, get(this, 'value')); } });
import Ember from 'ember'; const { Component, get } = Ember; export default Component.extend({ tagName: 'input', type: 'text', attributeBindings: [ 'accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', 'max', 'min', 'multiple', 'name', 'pattern', 'placeholder', 'size', 'step', 'type', 'value', 'width' ], _sanitizedValue: undefined, input() { this._handleChangeEvent(); }, change() { this._handleChangeEvent(); }, _handleChangeEvent() { this._processNewValue.call(this, this.readDOMAttr('value')); }, _processNewValue(rawValue) { const value = this.sanitizeInput(rawValue); if (this._sanitizedValue !== value) { this._sanitizedValue = value; this.attrs.update(value); } }, sanitizeInput(input) { return input; }, didReceiveAttrs() { this._super(...arguments); if (!this.attrs.update) { throw new Error(`You must provide an \`update\` action to \`{{${this.templateName}}}\`.`); } this._processNewValue.call(this, get(this, 'value')); } });
Add placeholder to attribute bindings
Add placeholder to attribute bindings
JavaScript
mit
AdStage/ember-one-way-controls,dockyard/ember-one-way-input,dockyard/ember-one-way-controls,dockyard/ember-one-way-input,AdStage/ember-one-way-controls,dockyard/ember-one-way-controls
--- +++ @@ -27,6 +27,7 @@ 'multiple', 'name', 'pattern', + 'placeholder', 'size', 'step', 'type',
a0d7b9248e15b04725cc72834cebe1084a2e70e5
addons/storysource/src/manager.js
addons/storysource/src/manager.js
/* eslint-disable react/prop-types */ import React from 'react'; import addons from '@storybook/addons'; import StoryPanel from './StoryPanel'; import { ADDON_ID, PANEL_ID } from '.'; export function register() { addons.register(ADDON_ID, api => { addons.addPanel(PANEL_ID, { title: 'Story', render: ({ active, key }) => <StoryPanel key={key} api={api} active={active} />, paramKey: 'story', }); }); }
/* eslint-disable react/prop-types */ import React from 'react'; import addons from '@storybook/addons'; import StoryPanel from './StoryPanel'; import { ADDON_ID, PANEL_ID } from '.'; export function register() { addons.register(ADDON_ID, api => { addons.addPanel(PANEL_ID, { title: 'Story', render: ({ active, key }) => <StoryPanel key={key} api={api} active={active} />, paramKey: 'storysource', }); }); }
CHANGE paramKey for storysource addon disable
CHANGE paramKey for storysource addon disable
JavaScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook
--- +++ @@ -10,7 +10,7 @@ addons.addPanel(PANEL_ID, { title: 'Story', render: ({ active, key }) => <StoryPanel key={key} api={api} active={active} />, - paramKey: 'story', + paramKey: 'storysource', }); }); }
ff86c57864c82a30f9af6bea2b29b8b2ae68defd
server/routes/heroku.js
server/routes/heroku.js
var express = require('express'); var router = express.Router(); var request = require('request'); router.get('/', function(req, res) { request({ url: 'https://status.heroku.com/api/v3/current-status', method: 'GET' }, function(err, res, body) { console.log(body); res.sendStatus(200).end(); }); }); module.exports = router;
var express = require('express'); var router = express.Router(); var request = require('request'); router.get('/', function(req, res) { request({ url: 'https://status.heroku.com/api/v3/current-status', method: 'GET' }, function(error, response, body) { console.log(body); // {"status":{"Production":"green","Development":"green"},"issues":[]} res.sendStatus(200).end(); }); }); module.exports = router;
Rename res to not overwrite express res.
Rename res to not overwrite express res.
JavaScript
mit
jontewks/bc-slack-alerts
--- +++ @@ -6,8 +6,8 @@ request({ url: 'https://status.heroku.com/api/v3/current-status', method: 'GET' - }, function(err, res, body) { - console.log(body); + }, function(error, response, body) { + console.log(body); // {"status":{"Production":"green","Development":"green"},"issues":[]} res.sendStatus(200).end(); }); });
6af9dc39bbf566d6bea1d2bc553d47e9312e7daa
src/Components/EditableTable/EditableTableHeader/index.js
src/Components/EditableTable/EditableTableHeader/index.js
import React from 'react' import PropTypes from 'prop-types' const EditableTableHeader = ({columnNames}) => { return( <div> {columnNames.map( columnName => {return <div key={columnName}>{columnName}</div>})} </div> ) } EditableTableHeader.propTypes = { columnNames: PropTypes.arrayOf(PropTypes.string).isRequired } export default EditableTableHeader
import React from 'react' import PropTypes from 'prop-types' import styled from 'styled-components' const Div = styled.div` display:flex; flex-direction:row; ` const HeaderCell = styled.div` flex:1; ` const EditableTableHeader = ({columnNames}) => { return( <Div> {columnNames.map( columnName => {return <HeaderCell key={columnName}>{columnName}</HeaderCell>})} </Div> ) } EditableTableHeader.propTypes = { columnNames: PropTypes.arrayOf(PropTypes.string).isRequired } export default EditableTableHeader
Add styled components to EditableTableHeader
Add styled components to EditableTableHeader
JavaScript
mit
severnsc/brewing-app,severnsc/brewing-app
--- +++ @@ -1,12 +1,22 @@ import React from 'react' import PropTypes from 'prop-types' +import styled from 'styled-components' + +const Div = styled.div` + display:flex; + flex-direction:row; +` + +const HeaderCell = styled.div` + flex:1; +` const EditableTableHeader = ({columnNames}) => { return( - <div> - {columnNames.map( columnName => {return <div key={columnName}>{columnName}</div>})} - </div> + <Div> + {columnNames.map( columnName => {return <HeaderCell key={columnName}>{columnName}</HeaderCell>})} + </Div> ) }
5d3bae193a4258fe1310f677f09df68de082590f
packages/coinstac-common/src/models/computation/remote-computation-result.js
packages/coinstac-common/src/models/computation/remote-computation-result.js
'use strict'; const ComputationResult = require('./computation-result'); const joi = require('joi'); /* istanbul ignore next */ /** * @class RemoteComputationResult * @extends ComputationResult * @description RemoteComputationResult result container * @property {string[]} usernames * @property {string} _id extends it's parent `PouchDocument` `_id` requirement * and mandates the format: `runId` */ class RemoteComputationResult extends ComputationResult { constructor(opts) { super(opts); this._idRegex = RemoteComputationResult._idRegex; } } RemoteComputationResult._idRegex = /^([^-]+$)/; // format: runId RemoteComputationResult.schema = Object.assign({}, ComputationResult.schema, { _id: joi.string().regex(RemoteComputationResult._idRegex).required(), complete: joi.boolean().default(false), // DecentralizedComputation complete/halted computationInputs: joi.array().items(joi.array()).required(), endDate: joi.date().timestamp(), startDate: joi.date().timestamp().default(Date.now()), usernames: joi.array().items(joi.string()).default([]), userErrors: joi.array(), // runId - derived from _id, enforced on ComputationResult instantiation }); module.exports = RemoteComputationResult;
'use strict'; const ComputationResult = require('./computation-result'); const joi = require('joi'); /* istanbul ignore next */ /** * @class RemoteComputationResult * @extends ComputationResult * @description RemoteComputationResult result container * @property {string[]} usernames * @property {string} _id extends it's parent `PouchDocument` `_id` requirement * and mandates the format: `runId` */ class RemoteComputationResult extends ComputationResult { constructor(opts) { super(opts); this._idRegex = RemoteComputationResult._idRegex; } } RemoteComputationResult._idRegex = /^([^-]+$)/; // format: runId RemoteComputationResult.schema = Object.assign({}, ComputationResult.schema, { _id: joi.string().regex(RemoteComputationResult._idRegex).required(), complete: joi.boolean().default(false), // DecentralizedComputation complete/halted computationInputs: joi.array().items(joi.array()).required(), endDate: joi.date().timestamp(), startDate: joi.date().timestamp() .default(() => Date.now(), 'time of creation'), usernames: joi.array().items(joi.string()).default([]), userErrors: joi.array(), // runId - derived from _id, enforced on ComputationResult instantiation }); module.exports = RemoteComputationResult;
Fix remote computation document's start date bug.
Fix remote computation document's start date bug. This ensures that remote computation documents are created with a dynamically generated start date. Closes #185.
JavaScript
mit
MRN-Code/coinstac,MRN-Code/coinstac,MRN-Code/coinstac
--- +++ @@ -25,7 +25,8 @@ complete: joi.boolean().default(false), // DecentralizedComputation complete/halted computationInputs: joi.array().items(joi.array()).required(), endDate: joi.date().timestamp(), - startDate: joi.date().timestamp().default(Date.now()), + startDate: joi.date().timestamp() + .default(() => Date.now(), 'time of creation'), usernames: joi.array().items(joi.string()).default([]), userErrors: joi.array(), // runId - derived from _id, enforced on ComputationResult instantiation
1178d8d86a2b8774ad9636de8d29ca30d352db51
lib/assets/javascripts/cartodb/common/background_polling/models/upload_config.js
lib/assets/javascripts/cartodb/common/background_polling/models/upload_config.js
/** * Default upload config * */ module.exports = { uploadStates: [ 'enqueued', 'pending', 'importing', 'uploading', 'guessing', 'unpacking', 'getting', 'creating', 'complete' ], fileExtensions: [ 'csv', 'xls', 'xlsx', 'zip', 'kml', 'geojson', 'json', 'ods', 'kmz', 'tsv', 'gpx', 'tar', 'gz', 'tgz', 'osm', 'bz2', 'tif', 'tiff', 'txt', 'sql' ], // How big should file be? fileTimesBigger: 3 }
/** * Default upload config * */ module.exports = { uploadStates: [ 'enqueued', 'pending', 'importing', 'uploading', 'guessing', 'unpacking', 'getting', 'creating', 'complete' ], fileExtensions: [ 'csv', 'xls', 'xlsx', 'zip', 'kml', 'geojson', 'json', 'ods', 'kmz', 'tsv', 'gpx', 'tar', 'gz', 'tgz', 'osm', 'bz2', 'tif', 'tiff', 'txt', 'sql', 'rar' ], // How big should file be? fileTimesBigger: 3 }
Allow importing RAR files in the UI
Allow importing RAR files in the UI Fixes 2366
JavaScript
bsd-3-clause
splashblot/dronedb,CartoDB/cartodb,bloomberg/cartodb,splashblot/dronedb,CartoDB/cartodb,CartoDB/cartodb,codeandtheory/cartodb,codeandtheory/cartodb,bloomberg/cartodb,bloomberg/cartodb,CartoDB/cartodb,bloomberg/cartodb,splashblot/dronedb,CartoDB/cartodb,codeandtheory/cartodb,codeandtheory/cartodb,codeandtheory/cartodb,splashblot/dronedb,splashblot/dronedb,bloomberg/cartodb
--- +++ @@ -36,7 +36,8 @@ 'tif', 'tiff', 'txt', - 'sql' + 'sql', + 'rar' ], // How big should file be? fileTimesBigger: 3
19c9ad30143a106ecff8eceb1e03d1b0dc68a208
packages/redis/index.js
packages/redis/index.js
const Redis = require('ioredis'); module.exports = url => { const redis = new Redis(url); redis.setJSON = async (...arguments) => { arguments[1] = JSON.stringify(arguments[1]); if (typeof arguments[2] === 'object' && arguments[2].asSeconds) { arguments[2] = parseInt(arguments[2].asSeconds()); } if (typeof arguments[2] === 'number') { arguments[3] = parseInt(arguments[2]); arguments[2] = 'EX'; } return await redis.set.apply(redis, arguments); } redis.getJSON = async key => { const value = await redis.get(key); if (value) { return JSON.parse(value); } return value; } return redis; };
const Redis = require('ioredis'); module.exports = url => { const redis = new Redis(url); redis.setJSON = async (...arguments) => { arguments[1] = JSON.stringify(arguments[1]); if (typeof arguments[2] === 'object' && arguments[2].asSeconds) { arguments[2] = parseInt(arguments[2].asSeconds()); } if (typeof arguments[2] === 'number') { arguments[3] = parseInt(arguments[2]); arguments[2] = 'EX'; } if (typeof arguments[2] === 'undefined') { arguments = [arguments[0], arguments[1]]; } return await redis.set.apply(redis, arguments); } redis.getJSON = async key => { const value = await redis.get(key); if (value) { return JSON.parse(value); } return value; } return redis; };
Fix redis syntax error if third argument is undefined
Fix redis syntax error if third argument is undefined
JavaScript
mit
maxdome/maxdome-node,maxdome/maxdome-node
--- +++ @@ -12,6 +12,9 @@ arguments[3] = parseInt(arguments[2]); arguments[2] = 'EX'; } + if (typeof arguments[2] === 'undefined') { + arguments = [arguments[0], arguments[1]]; + } return await redis.set.apply(redis, arguments); }
87f5054b206cac2bc48cd908a83ebdce5723da62
blueprints/ember-cli-typescript/index.js
blueprints/ember-cli-typescript/index.js
/* eslint-env node */ const path = require('path'); module.exports = { description: 'Initialize files needed for typescript compilation', files() { return [ path.join(this.path, 'files', 'tsconfig.json'), path.join(this.path, 'files', 'app', 'config', 'environment.d.ts'), ]; }, mapFile() { const result = this._super.mapFile.apply(this, arguments); const tsconfigPattern = `${path.sep}tsconfig.json`; const appPattern = `${path.sep}app${path.sep}`; if (result.indexOf(tsconfigPattern) > -1) { return 'tsconfig.json'; } else if (result.indexOf(appPattern) > -1) { var pos = result.indexOf(appPattern); return result.substring(pos + 1); } }, locals() { return { inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [], }; }, normalizeEntityName() { // Entity name is optional right now, creating this hook avoids an error. }, afterInstall() { return this.addPackagesToProject([ { name: 'typescript', target: 'latest' }, { name: '@types/ember', target: 'latest' }, { name: '@types/rsvp', target: 'latest' }, { name: '@types/ember-testing-helpers', target: 'latest' }, ]); }, };
import { existsSync } from 'fs'; /* eslint-env node */ const path = require('path'); module.exports = { description: 'Initialize files needed for typescript compilation', files() { return [ path.join(this.path, 'files', 'tsconfig.json'), path.join(this.path, 'files', 'app', 'config', 'environment.d.ts'), ]; }, mapFile() { const result = this._super.mapFile.apply(this, arguments); const tsconfigPattern = `${path.sep}tsconfig.json`; const appPattern = `${path.sep}app${path.sep}`; if (result.indexOf(tsconfigPattern) > -1) { return 'tsconfig.json'; } else if (result.indexOf(appPattern) > -1) { var pos = result.indexOf(appPattern); return result.substring(pos + 1); } }, locals() { return { inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [], }; }, normalizeEntityName() { // Entity name is optional right now, creating this hook avoids an error. }, async afterInstall() { if (existsSync('.gitignore')) { await this.insertIntoFile('.gitignore', '\n# Ember CLI TypeScript\n.e-c-ts'); } return this.addPackagesToProject([ { name: 'typescript', target: 'latest' }, { name: '@types/ember', target: 'latest' }, { name: '@types/rsvp', target: 'latest' }, { name: '@types/ember-testing-helpers', target: 'latest' }, ]); }, };
Add `.e.c-ts` to `.gitignore` on install.
Add `.e.c-ts` to `.gitignore` on install.
JavaScript
mit
emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript
--- +++ @@ -1,3 +1,5 @@ +import { existsSync } from 'fs'; + /* eslint-env node */ const path = require('path'); @@ -36,7 +38,11 @@ // Entity name is optional right now, creating this hook avoids an error. }, - afterInstall() { + async afterInstall() { + if (existsSync('.gitignore')) { + await this.insertIntoFile('.gitignore', '\n# Ember CLI TypeScript\n.e-c-ts'); + } + return this.addPackagesToProject([ { name: 'typescript', target: 'latest' }, { name: '@types/ember', target: 'latest' },
fd0db8de5cc41d704148a4b5ad64c8161754e146
tests/commands/cmmTests.js
tests/commands/cmmTests.js
var cmm = require("__buttercup/classes/commands/command.cmm.js"); module.exports = { setUp: function(cb) { this.command = new cmm(); (cb)(); }, callbackInjected: { callsToCallback: function(test) { var callbackCalled = false; var callback = function(comment) { callbackCalled = true; }; this.command.injectCommentCallback(callback); this.command.execute({}, ""); test.strictEqual(callbackCalled, true, "Calls into callback"); test.done(); }, callsToCallbackWithCommentTestCaseOne: function(test) { var providedComment = "I am the first test case"; var callbackCalled = false; var callback = function(comment) { if (comment === providedComment) { callbackCalled = true; } }; this.command.injectCommentCallback(callback); this.command.execute({}, providedComment); test.strictEqual(callbackCalled, true, "Calls into callback with correct comment (test case one)"); test.done(); } } };
var cmm = require("__buttercup/classes/commands/command.cmm.js"); module.exports = { setUp: function(cb) { this.command = new cmm(); (cb)(); }, callbackInjected: { callsToCallback: function(test) { var callbackCalled = false; var callback = function(comment) { callbackCalled = true; }; this.command.injectCommentCallback(callback); this.command.execute({}, ""); test.strictEqual(callbackCalled, true, "Calls into callback"); test.done(); }, callsToCallbackWithCommentTestCaseOne: function(test) { var providedComment = "I am the first test case"; var callbackCalled = false; var callback = function(comment) { if (comment === providedComment) { callbackCalled = true; } }; this.command.injectCommentCallback(callback); this.command.execute({}, providedComment); test.strictEqual(callbackCalled, true, "Calls into callback with correct comment (test case one)"); test.done(); }, callsToCallbackWithCommentTestCaseTwo: function(test) { var providedComment = "The second test case, that is what I am"; var callbackCalled = false; var callback = function(comment) { if (comment === providedComment) { callbackCalled = true; } }; this.command.injectCommentCallback(callback); this.command.execute({}, providedComment); test.strictEqual(callbackCalled, true, "Calls into callback with correct comment (test case two)"); test.done(); } } };
Test case two for comment contents
Test case two for comment contents
JavaScript
mit
perry-mitchell/buttercup-core,buttercup-pw/buttercup-core,buttercup/buttercup-core,buttercup-pw/buttercup-core,perry-mitchell/buttercup-core,buttercup/buttercup-core,buttercup/buttercup-core
--- +++ @@ -35,6 +35,23 @@ test.strictEqual(callbackCalled, true, "Calls into callback with correct comment (test case one)"); test.done(); + }, + + callsToCallbackWithCommentTestCaseTwo: function(test) { + var providedComment = "The second test case, that is what I am"; + + var callbackCalled = false; + var callback = function(comment) { + if (comment === providedComment) { + callbackCalled = true; + } + }; + + this.command.injectCommentCallback(callback); + this.command.execute({}, providedComment); + + test.strictEqual(callbackCalled, true, "Calls into callback with correct comment (test case two)"); + test.done(); } } };
73419f13fdb6a10cc0362a108375c062721b612d
eg/piezo.js
eg/piezo.js
var five = require("../lib/johnny-five.js"), board = new five.Board(); board.on("ready", function() { // Creates a piezo object and defines the pin to be used for the signal var piezo = new five.Piezo(3); // Injects the piezo into the repl board.repl.inject({ piezo: piezo }); // Plays a song piezo.play({ // song is composed by an array of pairs of notes and beats // The first argument is the note (null means "no note") // The second argument is the length of time (beat) of the note (or non-note) song: [ ["C4", 1], ["D4", 1], ["F4", 1], ["D4", 1], ["A4", 1], [null, 1], ["A4", 4], ["G4", 4], [null, 2], ["C4", 1], ["D4", 1], ["F4", 1], ["D4", 1], ["G4", 1], [null, 1], ["G4", 4], ["F4", 4], [null, 2] ], tempo: 250 }); });
var five = require("../lib/johnny-five.js"), board = new five.Board(); board.on("ready", function() { // Creates a piezo object and defines the pin to be used for the signal var piezo = new five.Piezo(3); // Injects the piezo into the repl board.repl.inject({ piezo: piezo }); // Plays a song piezo.play({ // song is composed by an array of pairs of notes and beats // The first argument is the note (null means "no note") // The second argument is the length of time (beat) of the note (or non-note) song: [ ["C4", 1/4], ["D4", 1/4], ["F4", 1/4], ["D4", 1/4], ["A4", 1/4], [null, 1/4], ["A4", 1], ["G4", 1], [null, 1/2], ["C4", 1/4], ["D4", 1/4], ["F4", 1/4], ["D4", 1/4], ["G4", 1/4], [null, 1/4], ["G4", 1], ["F4", 1], [null, 1/2] ], tempo: 100 }); });
Change beat to fractional values
Change beat to fractional values
JavaScript
mit
AnnaGerber/johnny-five,cumbreras/rv,kod3r/johnny-five,kod3r/johnny-five,joelunmsm2003/arduino
--- +++ @@ -16,26 +16,26 @@ // The first argument is the note (null means "no note") // The second argument is the length of time (beat) of the note (or non-note) song: [ - ["C4", 1], - ["D4", 1], + ["C4", 1/4], + ["D4", 1/4], + ["F4", 1/4], + ["D4", 1/4], + ["A4", 1/4], + [null, 1/4], + ["A4", 1], + ["G4", 1], + [null, 1/2], + ["C4", 1/4], + ["D4", 1/4], + ["F4", 1/4], + ["D4", 1/4], + ["G4", 1/4], + [null, 1/4], + ["G4", 1], ["F4", 1], - ["D4", 1], - ["A4", 1], - [null, 1], - ["A4", 4], - ["G4", 4], - [null, 2], - ["C4", 1], - ["D4", 1], - ["F4", 1], - ["D4", 1], - ["G4", 1], - [null, 1], - ["G4", 4], - ["F4", 4], - [null, 2] + [null, 1/2] ], - tempo: 250 + tempo: 100 }); });
e513455d27aad423afe5bed9d34054430af82473
plugins/wallhaven_cc.js
plugins/wallhaven_cc.js
var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name: 'wallhaven.cc', prepareImgLinks: function (callback) { var res = []; hoverZoom.urlReplace(res, 'img[src*="/th.wallhaven.cc/"]', /\/th.wallhaven.cc\/(.*)\/(.*)\/(.*)\.(.*)$/, '/w.wallhaven.cc/full/$2/wallhaven-$3.jpg' ); $('body').on('mouseenter', 'a[href*="/wallhaven.cc/w/"]', function () { hoverZoom.prepareFromDocument($(this), this.href, function (doc) { var img = doc.getElementById('wallpaper'); return img ? img.src : false; }); }); callback($(res)); }, });
var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name: 'wallhaven.cc', version:'3.0', prepareImgLinks: function (callback) { var res = []; hoverZoom.urlReplace(res, 'img[src*="/th.wallhaven.cc/"]', /\/th.wallhaven.cc\/(.*)\/(.*)\/(.*)\.(.*)$/, '/w.wallhaven.cc/full/$2/wallhaven-$3.jpg' ); hoverZoom.urlReplace(res, 'img[src]', /\/avatar\/\d+\//, '/avatar/200/' ); $('body').on('mouseenter', 'a[href*="/wallhaven.cc/w/"]', function () { hoverZoom.prepareFromDocument($(this), this.href, function (doc) { var img = doc.getElementById('wallpaper'); return img ? img.src : false; }); }); callback($(res)); }, });
Update for plug-in : wallhaven.cc
Update for plug-in : wallhaven.cc
JavaScript
mit
extesy/hoverzoom,extesy/hoverzoom
--- +++ @@ -1,19 +1,30 @@ var hoverZoomPlugins = hoverZoomPlugins || []; hoverZoomPlugins.push({ name: 'wallhaven.cc', + version:'3.0', prepareImgLinks: function (callback) { + var res = []; + hoverZoom.urlReplace(res, 'img[src*="/th.wallhaven.cc/"]', /\/th.wallhaven.cc\/(.*)\/(.*)\/(.*)\.(.*)$/, '/w.wallhaven.cc/full/$2/wallhaven-$3.jpg' ); + + hoverZoom.urlReplace(res, + 'img[src]', + /\/avatar\/\d+\//, + '/avatar/200/' + ); + $('body').on('mouseenter', 'a[href*="/wallhaven.cc/w/"]', function () { hoverZoom.prepareFromDocument($(this), this.href, function (doc) { var img = doc.getElementById('wallpaper'); return img ? img.src : false; }); }); + callback($(res)); }, });
9ded25a6bb411da73117adcb50fe5194de8bd635
chrome/browser/resources/managed_user_passphrase_dialog.js
chrome/browser/resources/managed_user_passphrase_dialog.js
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. function load() { $('unlock-passphrase-button').onclick = function(event) { chrome.send('checkPassphrase', [$('passphrase-entry').value]); }; $('cancel-passphrase-button').onclick = function(event) { // TODO(akuegel): Replace by closeDialog. chrome.send('DialogClose'); }; $('passphrase-entry').oninput = function(event) { $('unlock-passphrase-button').disabled = $('passphrase-entry').value == ''; $('incorrect-passphrase-warning').hidden = true; }; } function passphraseCorrect() { chrome.send('DialogClose', ['true']); } function passphraseIncorrect() { $('incorrect-passphrase-warning').hidden = false; $('passphrase-entry').focus(); } window.addEventListener('DOMContentLoaded', load);
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. function load() { var checkPassphrase = function(event) { chrome.send('checkPassphrase', [$('passphrase-entry').value]); }; var closeDialog = function(event) { // TODO(akuegel): Replace by closeDialog. chrome.send('DialogClose'); }; // Directly set the focus on the input box so the user can start typing right // away. $('passphrase-entry').focus(); $('unlock-passphrase-button').onclick = checkPassphrase; $('cancel-passphrase-button').onclick = closeDialog; $('passphrase-entry').oninput = function(event) { $('unlock-passphrase-button').disabled = $('passphrase-entry').value == ''; $('incorrect-passphrase-warning').hidden = true; }; $('passphrase-entry').onkeypress = function(event) { if (!event) return; // Check if the user pressed enter. if (event.keyCode == 13) checkPassphrase(event); }; // Pressing escape anywhere in the frame should work. document.onkeyup = function(event) { if (!event) return; // Check if the user pressed escape. if (event.keyCode == 27) closeDialog(event); }; } function passphraseCorrect() { chrome.send('DialogClose', ['true']); } function passphraseIncorrect() { $('incorrect-passphrase-warning').hidden = false; $('passphrase-entry').focus(); } window.addEventListener('DOMContentLoaded', load);
Improve usability in passphrase input dialog.
Improve usability in passphrase input dialog. Add the possiblity to press Enter to submit the dialog and to press Escape to dismiss it. R=akuegel@chromium.org, jhawkins@chromium.org BUG=171370 Review URL: https://chromiumcodereview.appspot.com/12321166 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@185194 0039d316-1c4b-4281-b951-d872f2087c98
JavaScript
bsd-3-clause
krieger-od/nwjs_chromium.src,mohamed--abdel-maksoud/chromium.src,bright-sparks/chromium-spacewalk,dushu1203/chromium.src,ondra-novak/chromium.src,ltilve/chromium,timopulkkinen/BubbleFish,ChromiumWebApps/chromium,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,chuan9/chromium-crosswalk,timopulkkinen/BubbleFish,ltilve/chromium,pozdnyakov/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,bright-sparks/chromium-spacewalk,M4sse/chromium.src,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,M4sse/chromium.src,jaruba/chromium.src,dednal/chromium.src,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,hujiajie/pa-chromium,markYoungH/chromium.src,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,markYoungH/chromium.src,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,anirudhSK/chromium,chuan9/chromium-crosswalk,ondra-novak/chromium.src,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,hujiajie/pa-chromium,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,pozdnyakov/chromium-crosswalk,ChromiumWebApps/chromium,Pluto-tv/chromium-crosswalk,Just-D/chromium-1,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,anirudhSK/chromium,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,Chilledheart/chromium,timopulkkinen/BubbleFish,anirudhSK/chromium,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,mogoweb/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,pozdnyakov/chromium-crosswalk,mogoweb/chromium-crosswalk,patrickm/chromium.src,hujiajie/pa-chromium,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,Jonekee/chromium.src,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,ltilve/chromium,Pluto-tv/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,littlstar/chromium.src,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,littlstar/chromium.src,littlstar/chromium.src,ChromiumWebApps/chromium,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,timopulkkinen/BubbleFish,patrickm/chromium.src,ChromiumWebApps/chromium,anirudhSK/chromium,dednal/chromium.src,Jonekee/chromium.src,patrickm/chromium.src,chuan9/chromium-crosswalk,dushu1203/chromium.src,markYoungH/chromium.src,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,axinging/chromium-crosswalk,Just-D/chromium-1,ChromiumWebApps/chromium,jaruba/chromium.src,dednal/chromium.src,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,ChromiumWebApps/chromium,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,patrickm/chromium.src,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,anirudhSK/chromium,dednal/chromium.src,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,Just-D/chromium-1,crosswalk-project/chromium-crosswalk-efl,timopulkkinen/BubbleFish,Fireblend/chromium-crosswalk,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,pozdnyakov/chromium-crosswalk,Chilledheart/chromium,Jonekee/chromium.src,PeterWangIntel/chromium-crosswalk,M4sse/chromium.src,Chilledheart/chromium,markYoungH/chromium.src,ondra-novak/chromium.src,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,hujiajie/pa-chromium,Just-D/chromium-1,markYoungH/chromium.src,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,Chilledheart/chromium,anirudhSK/chromium,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,markYoungH/chromium.src,timopulkkinen/BubbleFish,dednal/chromium.src,chuan9/chromium-crosswalk,ltilve/chromium,Chilledheart/chromium,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,chuan9/chromium-crosswalk,ondra-novak/chromium.src,hujiajie/pa-chromium,littlstar/chromium.src,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,pozdnyakov/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,bright-sparks/chromium-spacewalk,littlstar/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,hujiajie/pa-chromium,M4sse/chromium.src,bright-sparks/chromium-spacewalk,dednal/chromium.src,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk-efl,M4sse/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,M4sse/chromium.src,TheTypoMaster/chromium-crosswalk,M4sse/chromium.src,PeterWangIntel/chromium-crosswalk,anirudhSK/chromium,anirudhSK/chromium,TheTypoMaster/chromium-crosswalk,jaruba/chromium.src,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,Just-D/chromium-1,anirudhSK/chromium,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,littlstar/chromium.src,hujiajie/pa-chromium,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,ltilve/chromium,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,patrickm/chromium.src,dushu1203/chromium.src,Jonekee/chromium.src,ChromiumWebApps/chromium,dednal/chromium.src,patrickm/chromium.src,dednal/chromium.src,ondra-novak/chromium.src,Just-D/chromium-1,Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,timopulkkinen/BubbleFish,dednal/chromium.src,hgl888/chromium-crosswalk-efl,chuan9/chromium-crosswalk,Chilledheart/chromium,krieger-od/nwjs_chromium.src,anirudhSK/chromium,Jonekee/chromium.src,littlstar/chromium.src,markYoungH/chromium.src,dushu1203/chromium.src,Chilledheart/chromium,markYoungH/chromium.src,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,timopulkkinen/BubbleFish,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,fujunwei/chromium-crosswalk,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,jaruba/chromium.src,krieger-od/nwjs_chromium.src,Chilledheart/chromium,anirudhSK/chromium,Jonekee/chromium.src,axinging/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,timopulkkinen/BubbleFish,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,patrickm/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,Just-D/chromium-1,hgl888/chromium-crosswalk-efl,patrickm/chromium.src,Fireblend/chromium-crosswalk,fujunwei/chromium-crosswalk,Jonekee/chromium.src,hgl888/chromium-crosswalk,Jonekee/chromium.src,hujiajie/pa-chromium,M4sse/chromium.src,fujunwei/chromium-crosswalk,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,mogoweb/chromium-crosswalk,Jonekee/chromium.src,markYoungH/chromium.src,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,littlstar/chromium.src,Jonekee/chromium.src,dednal/chromium.src
--- +++ @@ -3,16 +3,37 @@ // found in the LICENSE file. function load() { - $('unlock-passphrase-button').onclick = function(event) { + var checkPassphrase = function(event) { chrome.send('checkPassphrase', [$('passphrase-entry').value]); }; - $('cancel-passphrase-button').onclick = function(event) { + var closeDialog = function(event) { // TODO(akuegel): Replace by closeDialog. chrome.send('DialogClose'); }; + // Directly set the focus on the input box so the user can start typing right + // away. + $('passphrase-entry').focus(); + $('unlock-passphrase-button').onclick = checkPassphrase; + $('cancel-passphrase-button').onclick = closeDialog; $('passphrase-entry').oninput = function(event) { $('unlock-passphrase-button').disabled = $('passphrase-entry').value == ''; $('incorrect-passphrase-warning').hidden = true; + }; + $('passphrase-entry').onkeypress = function(event) { + if (!event) + return; + // Check if the user pressed enter. + if (event.keyCode == 13) + checkPassphrase(event); + }; + + // Pressing escape anywhere in the frame should work. + document.onkeyup = function(event) { + if (!event) + return; + // Check if the user pressed escape. + if (event.keyCode == 27) + closeDialog(event); }; }
dc7e4ee88250241d6950b4bdd6da0dc899050ccb
cla_public/static-src/javascripts/modules/cookie-banner.js
cla_public/static-src/javascripts/modules/cookie-banner.js
'use strict'; require('./cookie-functions.js'); require('govuk_publishing_components/components/cookie-banner.js'); window.GOVUK.DEFAULT_COOKIE_CONSENT = { 'essential': true, 'usage': false, 'brexit': false } window.GOVUK.setDefaultConsentCookie = function () { var defaultConsent = { 'essential': true, 'usage': false, 'brexit': false } window.GOVUK.setCookie('cookie_policy', JSON.stringify(defaultConsent), { days: 365 }) } window.GOVUK.approveAllCookieTypes = function () { var approvedConsent = { 'essential': true, 'usage': true, 'brexit': true } window.GOVUK.setCookie('cookie_policy', JSON.stringify(approvedConsent), { days: 365 }) }
'use strict'; require('./cookie-functions.js'); require('govuk_publishing_components/components/cookie-banner.js'); window.GOVUK.DEFAULT_COOKIE_CONSENT = { 'essential': true, 'usage': false, 'brexit': false } window.GOVUK.setDefaultConsentCookie = function () { var defaultConsent = { 'essential': true, 'usage': false, 'brexit': false } window.GOVUK.setCookie('cookie_policy', JSON.stringify(defaultConsent), { days: 365 }) } window.GOVUK.approveAllCookieTypes = function () { var approvedConsent = { 'essential': true, 'usage': true, 'brexit': true } window.GOVUK.setCookie('cookie_policy', JSON.stringify(approvedConsent), { days: 365 }) } window.GOVUK.Modules.CookieBanner.prototype.isInCookiesPage = function () { return window.location.pathname === '/cookie-settings' }
Remove cookie banner from cookie settings page
Remove cookie banner from cookie settings page
JavaScript
mit
ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public
--- +++ @@ -27,5 +27,9 @@ window.GOVUK.setCookie('cookie_policy', JSON.stringify(approvedConsent), { days: 365 }) } + window.GOVUK.Modules.CookieBanner.prototype.isInCookiesPage = function () { + return window.location.pathname === '/cookie-settings' + } +
6a68619153b8b2cd9c35401e3943d4c4cc218eb6
generators/server/templates/server/boot/security.js
generators/server/templates/server/boot/security.js
'use strict'; const cookieParser = require('cookie-parser'); const csrf = require('csurf'); module.exports = function(server) { let secure = true; if (process.env.NODE_ENV === 'development') { secure = false; } server.use(cookieParser()); server.use(csrf({cookie: { key: 'XSRF-SECRET', secure, httpOnly: true, path: '/<%= applicationFolder %>' }})); server.use((err, req, res, next) => { //eslint-disable-line if (err.code !== 'EBADCSRFTOKEN') { return next(err); } // handle CSRF token errors here res.status(403); //eslint-disable-line no-magic-numbers res.send('invalid csrf token'); }); server.use((req, res, next) => { const token = req.csrfToken(); res.header('x-powered-by', ''); res.cookie('XSRF-TOKEN', token, { secure, path: '/<%= applicationFolder %>' }); next(); }); };
'use strict'; const cookieParser = require('cookie-parser'); const csrf = require('csurf'); module.exports = function(server) { let secure = true; if (process.env.NODE_ENV === 'development') { secure = false; } server.use(cookieParser()); server.use(csrf({cookie: { key: 'XSRF-SECRET', secure, httpOnly: true, path: '/<%= applicationFolder %>' }})); server.use((err, req, res, next) => { // eslint-disable-line if (err.code !== 'EBADCSRFTOKEN') { return next(err); } // handle CSRF token errors here res.status(403); // eslint-disable-line no-magic-numbers res.send('invalid csrf token'); }); server.use((req, res, next) => { const token = req.csrfToken(); res.header('x-powered-by', ''); res.cookie('XSRF-TOKEN', token, { secure, path: '/<%= applicationFolder %>' }); next(); }); };
Fix linting errors on server
Fix linting errors on server
JavaScript
apache-2.0
societe-generale/react-loopback-generator,societe-generale/react-loopback-generator
--- +++ @@ -8,6 +8,7 @@ if (process.env.NODE_ENV === 'development') { secure = false; } + server.use(cookieParser()); server.use(csrf({cookie: { key: 'XSRF-SECRET', @@ -16,12 +17,13 @@ path: '/<%= applicationFolder %>' }})); - server.use((err, req, res, next) => { //eslint-disable-line + server.use((err, req, res, next) => { // eslint-disable-line if (err.code !== 'EBADCSRFTOKEN') { return next(err); } + // handle CSRF token errors here - res.status(403); //eslint-disable-line no-magic-numbers + res.status(403); // eslint-disable-line no-magic-numbers res.send('invalid csrf token'); });
05e683ffe8c940d8fe5f762d91b3d76ab95e5b9d
app/js/controllers.js
app/js/controllers.js
'use strict'; /* Controllers */ var cvAppControllers = angular.module('cvAppControllers', []); cvAppControllers.controller('HomeController', ['$scope', '$http', function($scope, $http) { $http.get('/app/info/info.json').success(function(data) { $scope.stuff = data; }); }]); cvAppControllers.controller('AboutController', ['$scope', '$http', function($scope, $http) { $http.get('/app/info/info.json').success(function(data) { $scope.stuff = data; }); }]);
'use strict'; /* Controllers */ var cvAppControllers = angular.module('cvAppControllers', []); cvAppControllers.controller('HomeController', ['$scope', '$http', function($scope, $http) { $http.get('/app/info/info.json').success(function(data) { $scope.stuff = data; }); $scope.backgroundImg = "/app/img/kugghjulet.png" }]); cvAppControllers.controller('AboutController', ['$scope', '$http', function($scope, $http) { $http.get('/app/info/info.json').success(function(data) { $scope.stuff = data; }); }]);
Add kugghjulet.png to home scope
Add kugghjulet.png to home scope
JavaScript
mit
RegularSvensson/cvApp,RegularSvensson/cvApp
--- +++ @@ -8,6 +8,7 @@ $http.get('/app/info/info.json').success(function(data) { $scope.stuff = data; }); + $scope.backgroundImg = "/app/img/kugghjulet.png" }]); cvAppControllers.controller('AboutController', ['$scope', '$http', function($scope, $http) {
ac3b1f587ed3a1cc7e0816d4d0a788da8e6d3a09
lib/node_modules/@stdlib/datasets/stopwords-english/lib/index.js
lib/node_modules/@stdlib/datasets/stopwords-english/lib/index.js
'use strict'; /** * A list of English stopwords. * * @module @stdlib/datasets/smart-stopwords-en * * @example * var STOPWORDS = require( '@stdlib/datasets/smart-stopwords-en' ) * // returns [ "a", "a's", "able", "about", ... ] */ var STOPWORDS = require( './../data/words.json' ); // EXPORTS // module.exports = STOPWORDS;
'use strict'; /** * A list of English stopwords. * * @module @stdlib/datasets/stopwords-en * * @example * var STOPWORDS = require( '@stdlib/datasets/stopwords-en' ) * // returns [ "a", "a's", "able", "about", ... ] */ var STOPWORDS = require( './../data/words.json' ); // EXPORTS // module.exports = STOPWORDS;
Revert name change of stopwords-english
Revert name change of stopwords-english
JavaScript
apache-2.0
stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib
--- +++ @@ -3,10 +3,10 @@ /** * A list of English stopwords. * -* @module @stdlib/datasets/smart-stopwords-en +* @module @stdlib/datasets/stopwords-en * * @example -* var STOPWORDS = require( '@stdlib/datasets/smart-stopwords-en' ) +* var STOPWORDS = require( '@stdlib/datasets/stopwords-en' ) * // returns [ "a", "a's", "able", "about", ... ] */
cecc6de2d3df51acd077c5e3f8e3c88b8608d987
app/services/index.js
app/services/index.js
import 'whatwg-fetch'; const apiBaseURL = 'http://localhost:1337'; function parseJSONFromResponse(response) { return response.json(); } export const bookshelfApi = { getBooks() { return fetch(`${apiBaseURL}/books`) .then(parseJSONFromResponse) .catch(error => console.error( `Something went wrong trying to fetch books from bookshelf-server. Make sure the bookshelf-server is started.`, error)); } };
import 'whatwg-fetch'; const apiBaseURL = 'http://localhost:1337'; function parseJSONFromResponse(response) { return response.json(); } function stringIsEmpty(str) { return str === '' || str === undefined || str === null; } export const bookshelfApi = { getBooks() { return fetch(`${apiBaseURL}/books`) .then(parseJSONFromResponse) .catch(error => console.error('something went wrong attempting to fetch books:', error)); }, createBook(title, author) { if (stringIsEmpty(title) || stringIsEmpty(author)) { return false; } return fetch(`${apiBaseURL}/books`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: JSON.stringify({ title, author, }), }).then(() => true) .catch(() => false); }, };
Add method createBook to bookshelfApi connection.
Add method createBook to bookshelfApi connection.
JavaScript
mit
w1nston/bookshelf,w1nston/bookshelf
--- +++ @@ -6,13 +6,33 @@ return response.json(); } +function stringIsEmpty(str) { + return str === '' || str === undefined || str === null; +} + export const bookshelfApi = { getBooks() { return fetch(`${apiBaseURL}/books`) .then(parseJSONFromResponse) .catch(error => - console.error( -`Something went wrong trying to fetch books from bookshelf-server. -Make sure the bookshelf-server is started.`, error)); - } + console.error('something went wrong attempting to fetch books:', error)); + }, + + createBook(title, author) { + if (stringIsEmpty(title) || stringIsEmpty(author)) { + return false; + } + + return fetch(`${apiBaseURL}/books`, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: JSON.stringify({ + title, + author, + }), + }).then(() => true) + .catch(() => false); + }, };
9672073a981ce9ebb88f7911854518ee9d0225ca
test/reducers/sum.spec.js
test/reducers/sum.spec.js
const sum = require('./sum'); test('adds 1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(3); });
const sum = require('./sum'); test('adds 1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(4); });
Change test result to test travis ci notification
Change test result to test travis ci notification
JavaScript
mit
FermORG/FermionJS,FermORG/FermionJS
--- +++ @@ -1,5 +1,5 @@ const sum = require('./sum'); test('adds 1 + 2 to equal 3', () => { - expect(sum(1, 2)).toBe(3); + expect(sum(1, 2)).toBe(4); });
2e424fd72f6a1e484da6085238702c989879ad27
server/server-logic.js
server/server-logic.js
const Q = require('q'); const RegularUsers = require('./../models/userSchema.js'); const BusinessUsers = require('./../models/businessUserSchema.js'); const Events = require('./../models/eventSchema.js'); const utils = require('../utils/utilities.js'); // Promisify a few mongoose methods with the `q` promise library const findUser = Q.nbind(RegularUsers.findOne, RegularUsers); const findBusUser = Q.nbind(BusinessUsers.findOne, BusinessUsers); const findAllEvents = Q.nbind(Events.find, Events); const postAnEvent = Q.nbind(Events.create, Events); module.exports = { getEvents: (req, res, next) => { findAllEvents({}) .then((events) => { res.json(events); }) .fail((error) => { next(error); }); }, postEvent: (req, res, next) => { const body = req.body; postAnEvent({ username: body.username, eventTime: body.eventTime, location: body.location, createdAt: new Date().toLocaleString(), tags: body.tags.split(' '), businessName: body.businessName, picLink: body.picLink, busLink: body.busLink, description: body.dscription, }) .then(() => { res.setStatus(201).end(); }) .fail(err => err); }, // getUser: (req, res, next) => { // // }, };
const Q = require('q'); const RegularUsers = require('./../models/userSchema.js'); const BusinessUsers = require('./../models/businessUserSchema.js'); const Events = require('./../models/eventSchema.js'); const utils = require('../utils/utilities.js'); // Promisify a few mongoose methods with the `q` promise library const findUser = Q.nbind(RegularUsers.findOne, RegularUsers); const findBusUser = Q.nbind(BusinessUsers.findOne, BusinessUsers); const findAllEvents = Q.nbind(Events.find, Events); const postAnEvent = Q.nbind(Events.create, Events); module.exports = { getEvents: (req, res, next) => { findAllEvents({}) .then((events) => { res.json(events); }) .fail((error) => { next(error); }); }, postEvent: (req, res, next) => { const body = req.body; const tags = body.tags ? body.tags.split(' ') : ''; postAnEvent({ username: body.username, eventTime: body.eventTime, location: body.location, createdAt: new Date().toLocaleString(), tags, businessName: body.businessName, picLink: body.picLink, busLink: body.busLink, description: body.dscription, }) .then(() => { res.setStatus(201).end(); }) .fail(err => err); }, // getUser: (req, res, next) => { // // }, };
Debug and tested server routes, successful post and get
Debug and tested server routes, successful post and get
JavaScript
unlicense
DeFieldsEPeriou/DeGreenFields,eperiou/DeGreenFields,eperiou/DeGreenFields,DeFieldsEPeriou/DeGreenFields
--- +++ @@ -25,13 +25,13 @@ postEvent: (req, res, next) => { const body = req.body; - + const tags = body.tags ? body.tags.split(' ') : ''; postAnEvent({ username: body.username, eventTime: body.eventTime, location: body.location, createdAt: new Date().toLocaleString(), - tags: body.tags.split(' '), + tags, businessName: body.businessName, picLink: body.picLink, busLink: body.busLink,
8d885db7d5e7a731f1ae180c0160db046cd1355c
examples/renderinitial/router.js
examples/renderinitial/router.js
var monorouter = require('monorouter'); var reactRouting = require('monorouter-react'); var PetList = require('./views/PetList'); var PetDetail = require('./views/PetDetail'); var Preloader = require('./views/Preloader'); module.exports = monorouter() .setup(reactRouting()) .route('index', '/', function(req) { this.renderInitial(Preloader, function() { // Artificially make the next render take a while. setTimeout(function() { this.render(PetList); }.bind(this), 1000); }); }) .route('pet', '/pet/:name', function(req) { this.renderInitial(Preloader, function() { // Artificially make the next render take a while. setTimeout(function() { this.render(PetDetail, {petName: req.params.name}); }.bind(this), 1000); }); });
var monorouter = require('monorouter'); var reactRouting = require('monorouter-react'); var PetList = require('./views/PetList'); var PetDetail = require('./views/PetDetail'); var Preloader = require('./views/Preloader'); module.exports = monorouter() .setup(reactRouting()) .route('index', '/', function(req) { this.renderInitial(Preloader, function() { // Artificially make the next render take a while. setTimeout(function() { this.render(PetList); }.bind(this), 1000); }); }) .route('pet', '/pet/:name', function(req) { // NOTE: Because we're calling `this.renderInitial()`, we lose the // opportunity to have the server send a 404, and the client will have to // display a 'missing' view. If you want the server to send 404s, you have // to call `this.unhandled()` before `this.renderInitial()`. this.renderInitial(Preloader, function() { // Artificially make the next render take a while. setTimeout(function() { this.render(PetDetail, {petName: req.params.name}); }.bind(this), 1000); }); });
Add note about 404 pitfall with renderInitial example
Add note about 404 pitfall with renderInitial example
JavaScript
mit
matthewwithanm/monorouter
--- +++ @@ -16,6 +16,10 @@ }); }) .route('pet', '/pet/:name', function(req) { + // NOTE: Because we're calling `this.renderInitial()`, we lose the + // opportunity to have the server send a 404, and the client will have to + // display a 'missing' view. If you want the server to send 404s, you have + // to call `this.unhandled()` before `this.renderInitial()`. this.renderInitial(Preloader, function() { // Artificially make the next render take a while. setTimeout(function() {
9c20d0be36788e04838ea8e19e6f7eed3e0f44c3
app/controllers/control.js
app/controllers/control.js
'use strict'; /** * Module dependencies. */ /** * Find device by id */ exports.command = function(req, res) { var client = exports.client; var channel = '/control/' + req.params.deviceId + '/' + req.params.command; client.publish(channel, req.body); console.log('Publish to channel: ' + channel); res.jsonp({result: 'OK'}); }; exports.setClient = function(client) { exports.client = client; };
'use strict'; /** * Module dependencies. */ /** * Find device by id */ exports.command = function(req, res) { var client = exports.client; var channel = '/control/' + req.params.deviceId; var data = { command: req.params.command, body: req.body } client.publish(channel, data); console.log('Publish to channel: ' + channel); res.jsonp({result: 'OK'}); }; exports.setClient = function(client) { exports.client = client; };
Send command in the published message
Send command in the published message
JavaScript
apache-2.0
msprunck/openit-site,msprunck/openit-site
--- +++ @@ -9,8 +9,12 @@ */ exports.command = function(req, res) { var client = exports.client; - var channel = '/control/' + req.params.deviceId + '/' + req.params.command; - client.publish(channel, req.body); + var channel = '/control/' + req.params.deviceId; + var data = { + command: req.params.command, + body: req.body + } + client.publish(channel, data); console.log('Publish to channel: ' + channel); res.jsonp({result: 'OK'}); };
c75bb56fc01ba261f77d848d5667b7b480c71261
app/controllers/category/index.js
app/controllers/category/index.js
import Ember from 'ember'; import PaginationMixin from '../../mixins/pagination'; const { computed } = Ember; export default Ember.Controller.extend(PaginationMixin, { queryParams: ['page', 'per_page', 'sort'], page: '1', per_page: 10, sort: 'alpha', totalItems: computed.readOnly('model.meta.total'), currentSortBy: computed('sort', function() { return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; }), });
import Ember from 'ember'; import PaginationMixin from '../../mixins/pagination'; const { computed } = Ember; export default Ember.Controller.extend(PaginationMixin, { queryParams: ['page', 'per_page', 'sort'], page: '1', per_page: 10, sort: 'downloads', totalItems: computed.readOnly('model.meta.total'), currentSortBy: computed('sort', function() { return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; }), });
Sort crates within a category by downloads by default
Sort crates within a category by downloads by default There will be an RFC soon about whether this is the best ordering or not.
JavaScript
apache-2.0
Susurrus/crates.io,steveklabnik/crates.io,steveklabnik/crates.io,Susurrus/crates.io,rust-lang/crates.io,rust-lang/crates.io,Susurrus/crates.io,Susurrus/crates.io,rust-lang/crates.io,rust-lang/crates.io,steveklabnik/crates.io,steveklabnik/crates.io
--- +++ @@ -7,7 +7,7 @@ queryParams: ['page', 'per_page', 'sort'], page: '1', per_page: 10, - sort: 'alpha', + sort: 'downloads', totalItems: computed.readOnly('model.meta.total'),
8d362700afeaa78d1741b91c7bf9f31553debfa3
public/src/js/logger.js
public/src/js/logger.js
/** * public/src/js/logger.js - delish * * Licensed under MIT license. * Copyright (C) 2017 Karim Alibhai. */ const util = require('util') , debounce = require('debounce') let currentLog = document.querySelector('.lead') , nextLog = document.querySelector('.lead.next') /** * Updates the current log status. * @param {String} message the string with formatting * @param {...Object} values any values to plug in */ export default debounce(function () { let text = util.format.apply(util, arguments) // transition to the new log nextLog.innerText = text currentLog.classList.add('hide') nextLog.classList.remove('next') // after the CSS transition completes, swap // the log elements out setTimeout(() => { let parent = currentLog.parentElement parent.removeChild(currentLog) currentLog = nextLog nextLog = document.createElement('div') nextLog.classList.add('lead') nextLog.classList.add('next') parent.appendChild(nextLog) }, 700) }, 700)
/** * public/src/js/logger.js - delish * * Licensed under MIT license. * Copyright (C) 2017 Karim Alibhai. */ const util = require('util') , debounce = require('debounce') let currentLog = document.querySelector('.lead') , nextLog = document.querySelector('.lead.next') /** * Updates the current log status. * @param {String} message the string with formatting * @param {...Object} values any values to plug in */ export default debounce(function () { let text = util.format.apply(util, arguments) // transition to the new log nextLog.innerText = text currentLog.classList.add('hide') nextLog.classList.remove('next') // after the CSS transition completes, swap // the log elements out setTimeout(() => { let parent = currentLog.parentElement parent.removeChild(currentLog) currentLog = nextLog nextLog = document.createElement('p') nextLog.classList.add('lead') nextLog.classList.add('next') parent.appendChild(nextLog) }, 700) }, 700)
Change div to p when creating new logs
Change div to p when creating new logs
JavaScript
mit
karimsa/delish,karimsa/delish,karimsa/delish
--- +++ @@ -32,7 +32,7 @@ parent.removeChild(currentLog) currentLog = nextLog - nextLog = document.createElement('div') + nextLog = document.createElement('p') nextLog.classList.add('lead') nextLog.classList.add('next') parent.appendChild(nextLog)
d23d00bafe9fb4a89d92f812506c244d2be595a1
src/browser/extension/background/getPreloadedState.js
src/browser/extension/background/getPreloadedState.js
export default function getPreloadedState(position, cb) { chrome.storage.local.get([ 'monitor' + position, 'slider' + position, 'dispatcher' + position, 'test-templates', 'test-templates-sel' ], options => { cb({ monitor: { selected: options['monitor' + position], sliderIsOpen: options['slider' + position] || false, dispatcherIsOpen: options['dispatcher' + position] || false, }, test: { selected: options['test-templates-sel'] || 0, templates: options['test-templates'] } }); }); }
const getIfExists = (sel, template) => ( typeof sel === 'undefined' || typeof template === 'undefined' || typeof template[sel] === 'undefined' ? 0 : sel ); export default function getPreloadedState(position, cb) { chrome.storage.local.get([ 'monitor' + position, 'slider' + position, 'dispatcher' + position, 'test-templates', 'test-templates-sel' ], options => { cb({ monitor: { selected: options['monitor' + position], sliderIsOpen: options['slider' + position] || false, dispatcherIsOpen: options['dispatcher' + position] || false, }, test: { selected: getIfExists(options['test-templates-sel'], options['test-templates']), templates: options['test-templates'] } }); }); }
Select the test template only if exists
Select the test template only if exists Related to https://github.com/zalmoxisus/redux-devtools-test-generator/issues/3
JavaScript
mit
zalmoxisus/redux-devtools-extension,zalmoxisus/redux-devtools-extension
--- +++ @@ -1,3 +1,10 @@ +const getIfExists = (sel, template) => ( + typeof sel === 'undefined' || + typeof template === 'undefined' || + typeof template[sel] === 'undefined' ? + 0 : sel +); + export default function getPreloadedState(position, cb) { chrome.storage.local.get([ 'monitor' + position, 'slider' + position, 'dispatcher' + position, @@ -10,7 +17,7 @@ dispatcherIsOpen: options['dispatcher' + position] || false, }, test: { - selected: options['test-templates-sel'] || 0, + selected: getIfExists(options['test-templates-sel'], options['test-templates']), templates: options['test-templates'] } });
0c2a557dbef6674d3d352cd49e9c13f4ed2f8362
src/js/schemas/service-schema/EnvironmentVariables.js
src/js/schemas/service-schema/EnvironmentVariables.js
let EnvironmentVariables = { description: 'Set environment variables for each task your service launches in addition to those set by Mesos.', type: 'object', title: 'Environment Variables', properties: { variables: { type: 'array', duplicable: true, addLabel: 'Add Environment Variable', getter: function (service) { let variableMap = service.getEnvironmentVariables(); if (variableMap == null) { return [{ key: null, value: null, usingSecret: null }]; } return Object.keys(variableMap).map(function (key) { let value = variableMap[key]; let usingSecret = null; if (typeof value === 'object' && value != null) { usingSecret = true; value = service.get('secrets')[value.secret].source; } return { key, value, usingSecret }; }); }, itemShape: { properties: { key: { title: 'Key', type: 'string' }, value: { title: 'Value', type: 'string' } } } } } }; module.exports = EnvironmentVariables;
import {Hooks} from 'PluginSDK'; let EnvironmentVariables = { description: 'Set environment variables for each task your service launches in addition to those set by Mesos.', type: 'object', title: 'Environment Variables', properties: { variables: { type: 'array', duplicable: true, addLabel: 'Add Environment Variable', getter: function (service) { let variableMap = service.getEnvironmentVariables(); if (variableMap == null) { return [{}]; } return Object.keys(variableMap).map(function (key) { return Hooks.applyFilter('variablesGetter', { key, value: variableMap[key] }, service); }); }, itemShape: { properties: { key: { title: 'Key', type: 'string' }, value: { title: 'Value', type: 'string' } } } } } }; module.exports = EnvironmentVariables;
Move unnecessary things out of env schema
Move unnecessary things out of env schema
JavaScript
apache-2.0
dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui
--- +++ @@ -1,3 +1,5 @@ +import {Hooks} from 'PluginSDK'; + let EnvironmentVariables = { description: 'Set environment variables for each task your service launches in addition to those set by Mesos.', type: 'object', @@ -10,26 +12,13 @@ getter: function (service) { let variableMap = service.getEnvironmentVariables(); if (variableMap == null) { - return [{ - key: null, - value: null, - usingSecret: null - }]; + return [{}]; } return Object.keys(variableMap).map(function (key) { - let value = variableMap[key]; - let usingSecret = null; - - if (typeof value === 'object' && value != null) { - usingSecret = true; - value = service.get('secrets')[value.secret].source; - } - - return { + return Hooks.applyFilter('variablesGetter', { key, - value, - usingSecret - }; + value: variableMap[key] + }, service); }); }, itemShape: {
14c9a161b2362d84905476ffb31be2864eec8a4a
angular-typescript-webpack-jasmine/webpack/webpack.test.js
angular-typescript-webpack-jasmine/webpack/webpack.test.js
const loaders = require("./loaders"); const webpack = require("webpack"); const path = require("path"); module.exports = { context: path.join(__dirname, ".."), entry: ["./src/test.ts"], output: { filename: "build.js", path: path.resolve("temp"), publicPath: "/" }, resolve: { extensions: [ ".ts", ".js", ".json" ] }, resolveLoader: { modules: ["node_modules"] }, devtool: "source-map-inline", module: { loaders: loaders /* postLoaders: [ { test: /^((?!\.spec\.ts).)*.ts$/, exclude: /(node_modules)/, loader: "istanbul-instrumenter" } ] */ } };
const rules = require("./rules"); const webpack = require("webpack"); const path = require("path"); module.exports = { context: path.join(__dirname, ".."), entry: ["./src/test.ts"], output: { filename: "build.js", path: path.resolve("temp"), publicPath: "/" }, resolve: { extensions: [ ".ts", ".js", ".json" ] }, resolveLoader: { modules: ["node_modules"] }, devtool: "source-map-inline", module: { rules: rules } };
Replace loaders -> rules. Delete useless configs
Replace loaders -> rules. Delete useless configs
JavaScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
--- +++ @@ -1,4 +1,4 @@ -const loaders = require("./loaders"); +const rules = require("./rules"); const webpack = require("webpack"); const path = require("path"); @@ -22,14 +22,7 @@ }, devtool: "source-map-inline", module: { - loaders: loaders - /* postLoaders: [ - { - test: /^((?!\.spec\.ts).)*.ts$/, - exclude: /(node_modules)/, - loader: "istanbul-instrumenter" - } - ] */ + rules: rules } };
bb1901f9173c5df8ca7444919cfbe18457ebfa3f
endswith.js
endswith.js
/*! http://mths.be/endswith v0.1.0 by @mathias */ if (!String.prototype.endsWith) { (function() { 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` var toString = {}.toString; String.prototype.endsWith = function(search) { var string = String(this); if ( this == null || (search && toString.call(search) == '[object RegExp]') ) { throw TypeError(); } var stringLength = string.length; var searchString = String(search); var searchLength = searchString.length; var pos = stringLength; if (arguments.length > 1) { var position = arguments[1]; if (position !== undefined) { // `ToInteger` pos = position ? Number(position) : 0; if (pos != pos) { // better `isNaN` pos = 0; } } } var end = Math.min(Math.max(pos, 0), stringLength); var start = end - searchLength; if (start < 0) { return false; } var index = -1; while (++index < searchLength) { if (string.charAt(start + index) != searchString.charAt(index)) { return false; } } return true; }; }()); }
/*! http://mths.be/endswith v0.1.0 by @mathias */ if (!String.prototype.endsWith) { (function() { 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` var toString = {}.toString; String.prototype.endsWith = function(search) { var string = String(this); if ( this == null || (search && toString.call(search) == '[object RegExp]') ) { throw TypeError(); } var stringLength = string.length; var searchString = String(search); var searchLength = searchString.length; var pos = stringLength; if (arguments.length > 1) { var position = arguments[1]; if (position !== undefined) { // `ToInteger` pos = position ? Number(position) : 0; if (pos != pos) { // better `isNaN` pos = 0; } } } var end = Math.min(Math.max(pos, 0), stringLength); var start = end - searchLength; if (start < 0) { return false; } var index = -1; while (++index < searchLength) { if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { return false; } } return true; }; }()); }
Use `charCodeAt` instead of `charAt`
Use `charCodeAt` instead of `charAt` `charCodeAt` is faster in general. Ref. #4.
JavaScript
mit
mathiasbynens/String.prototype.endsWith
--- +++ @@ -32,7 +32,7 @@ } var index = -1; while (++index < searchLength) { - if (string.charAt(start + index) != searchString.charAt(index)) { + if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { return false; } }
b8173fcb00aa5e8599c2bdca5e888614eebf70eb
lib/models/graph-object.js
lib/models/graph-object.js
// Copyright 2015, EMC, Inc. 'use strict'; module.exports = GraphModelFactory; GraphModelFactory.$provide = 'Models.GraphObject'; GraphModelFactory.$inject = [ 'Model' ]; function GraphModelFactory (Model) { return Model.extend({ connection: 'mongo', identity: 'graphobjects', attributes: { instanceId: { type: 'string', required: true, unique: true, uuidv4: true }, context: { type: 'json', required: true, json: true }, definition: { type: 'json', required: true, json: true }, tasks: { type: 'json', required: true, json: true }, node: { model: 'nodes' } } }); }
// Copyright 2015, EMC, Inc. 'use strict'; module.exports = GraphModelFactory; GraphModelFactory.$provide = 'Models.GraphObject'; GraphModelFactory.$inject = [ 'Model', 'Constants' ]; function GraphModelFactory (Model, Constants) { return Model.extend({ connection: 'mongo', identity: 'graphobjects', attributes: { instanceId: { type: 'string', required: true, unique: true, uuidv4: true }, context: { type: 'json', required: true, json: true }, definition: { type: 'json', required: true, json: true }, tasks: { type: 'json', required: true, json: true }, node: { model: 'nodes' }, active: function() { var obj = this.toObject(); return obj._status === Constants.Task.States.Pending; } } }); }
Add active() method to graph object model
Add active() method to graph object model
JavaScript
apache-2.0
YoussB/on-core,YoussB/on-core
--- +++ @@ -6,10 +6,11 @@ GraphModelFactory.$provide = 'Models.GraphObject'; GraphModelFactory.$inject = [ - 'Model' + 'Model', + 'Constants' ]; -function GraphModelFactory (Model) { +function GraphModelFactory (Model, Constants) { return Model.extend({ connection: 'mongo', identity: 'graphobjects', @@ -37,6 +38,10 @@ }, node: { model: 'nodes' + }, + active: function() { + var obj = this.toObject(); + return obj._status === Constants.Task.States.Pending; } } });
6a4390f2cd0731a55bc6f65745ca16156fa74a94
tests/unit/serializers/ilm-session-test.js
tests/unit/serializers/ilm-session-test.js
import { moduleForModel, test } from 'ember-qunit'; moduleForModel('ilm-session', 'Unit | Serializer | ilm session', { // Specify the other units that are required for this test. needs: ['serializer:ilm-session'] }); // Replace this with your real tests. test('it serializes records', function(assert) { let record = this.subject(); let serializedRecord = record.serialize(); assert.ok(serializedRecord); });
import { moduleForModel, test } from 'ember-qunit'; moduleForModel('ilm-session', 'Unit | Serializer | ilm session', { // Specify the other units that are required for this test. needs: [ 'model:session', 'model:learner-group', 'model:instructor-group', 'model:user', 'serializer:ilm-session' ] }); // Replace this with your real tests. test('it serializes records', function(assert) { let record = this.subject(); let serializedRecord = record.serialize(); assert.ok(serializedRecord); });
Fix ilm-session serializer test dependancies
Fix ilm-session serializer test dependancies
JavaScript
mit
jrjohnson/frontend,gabycampagna/frontend,djvoa12/frontend,thecoolestguy/frontend,gboushey/frontend,stopfstedt/frontend,dartajax/frontend,thecoolestguy/frontend,gboushey/frontend,ilios/frontend,dartajax/frontend,ilios/frontend,jrjohnson/frontend,gabycampagna/frontend,djvoa12/frontend,stopfstedt/frontend
--- +++ @@ -2,7 +2,13 @@ moduleForModel('ilm-session', 'Unit | Serializer | ilm session', { // Specify the other units that are required for this test. - needs: ['serializer:ilm-session'] + needs: [ + 'model:session', + 'model:learner-group', + 'model:instructor-group', + 'model:user', + 'serializer:ilm-session' + ] }); // Replace this with your real tests.
d12c22bcd977b818dd107cfe5a5fe072f9bbab74
tests/arity.js
tests/arity.js
var overload = require('../src/overload'); var should = require('should'); describe('overload', function() { describe('arity', function() { it('should exist', function() { overload.should.have.property('arity'); }); it('should work', function() { var two_or_three = overload.arity(2, 3); var obj = {}; var res = 0; overload.add(obj, 'work', function(one) { res += 1; }); overload.add(obj, 'work', two_or_three, function(one, two, three) { res += 2; }); obj.work('one'); res.should.eql(1); obj.work('one', 'two'); res.should.eql(3); obj.work('one', 'two', 'three'); res.should.eql(5); obj.work('one', 'two', 'three', 'four'); res.should.eql(5); }); }); });
var overload = require('../src/overload'); var should = require('should'); describe('overload', function() { describe('arity', function() { it('should exist', function() { overload.should.have.property('arity'); }); it('should work', function() { var two_or_three = overload.arity(2, 3); var obj = {}; var res = 0; overload.add(obj, 'work', function(one) { res += 1; }); overload.add(obj, 'work', two_or_three, function(one, two, three) { res += 2; }); obj.work('one'); res.should.eql(1); obj.work('one', 'two'); res.should.eql(3); obj.work('one', 'two', 'three'); res.should.eql(5); obj.work('one', 'two', 'three', 'four'); res.should.eql(5); }); it('should work with saying more than or equal to', function() { var obj = {}; var res = 0; overload.add(obj, 'work', overload.arity(3), function() { res++; }); obj.work(); res.should.eql(0); obj.work('one', 'two', 'three'); res.should.eql(1); obj.work('one', 'two', 'three', 'four'); res.should.eql(2); }); }); });
Add tests for saying more than
Add tests for saying more than
JavaScript
mit
nathggns/Overload
--- +++ @@ -33,5 +33,23 @@ obj.work('one', 'two', 'three', 'four'); res.should.eql(5); }); + + it('should work with saying more than or equal to', function() { + var obj = {}; + var res = 0; + + overload.add(obj, 'work', overload.arity(3), function() { + res++; + }); + + obj.work(); + res.should.eql(0); + + obj.work('one', 'two', 'three'); + res.should.eql(1); + + obj.work('one', 'two', 'three', 'four'); + res.should.eql(2); + }); }); });
e0fcfb103b04c290c4572cf2acacf8b56cd16f59
example/pub.js
example/pub.js
const R = require("ramda"); const Promise = require("bluebird"); const pubsub = require("../")("amqp://docker"); const publish = (event, index) => { const data = { number: index + 1 }; console.log(` [-] Published event '${ event.name }' with data:`, data); event.publish(data) }; // Create the event. const events = { foo: pubsub.event("foo"), bar: pubsub.event("bar") }; // Read in the command-line args, to determine which event to fire // and how many events to fire it. const args = process.argv.slice(2); const eventName = args[0] || "foo"; const count = parseInt(args[1]) || 1; if (events[eventName]) { const promises = R.times((index) => publish(events[eventName], index), count); Promise.all(promises) .then(() => { console.log(""); setTimeout(() => process.exit(0), 200); }) } else { console.log(`Event named '${ eventName }' does not exist.\n`); }
const R = require("ramda"); const Promise = require("bluebird"); const pubsub = require("../")("amqp://docker"); const publish = (event, index) => { const data = { number: index + 1 }; console.log(` [-] Published event '${ event.name }' with data:`, data); event.publish(data) }; // Create the event. const events = { foo: pubsub.event("foo"), bar: pubsub.event("bar") }; // Read in the command-line args, to determine which event to fire // and how many events to fire it. const args = process.argv.slice(2); const eventName = args[0] || "foo"; const count = parseInt(args[1]) || 1; if (events[eventName]) { const promises = R.times((index) => publish(events[eventName], index), count); Promise.all(promises) .then(() => { console.log(""); setTimeout(() => process.exit(0), 500); }) } else { console.log(`Event named '${ eventName }' does not exist.\n`); }
Extend timeout before killing process.
Extend timeout before killing process.
JavaScript
mit
philcockfield/mq-pubsub
--- +++ @@ -29,7 +29,7 @@ Promise.all(promises) .then(() => { console.log(""); - setTimeout(() => process.exit(0), 200); + setTimeout(() => process.exit(0), 500); }) } else {
2483669d68dd399e9597db2c413994817ef1ed61
test/assert.js
test/assert.js
'use strict'; var CustomError = require('es5-ext/error/custom') , logger = require('../lib/logger')(); module.exports = function (t, a) { t = t(logger); t(true, true, 'foo'); t.ok(false, 'bar'); t.not(false, true, 'not'); t.deep([1, 2], [1, 2], 'deep'); t.notDeep([1, 2], [2, 1], 'not deep'); t.throws(function () { throw new CustomError('Test', 'TEST'); }, 'TEST', 'throws'); a.deep([logger[0].type, logger[0].data], ['pass', 'foo']); a.deep([logger[1].type, logger[1].data.message], ['fail', 'bar']); a.deep([logger[2].type, logger[2].data], ['pass', 'not'], "'not' support"); a.deep([logger[3].type, logger[3].data], ['pass', 'deep'], "'deep' support"); a.deep([logger[4].type, logger[4].data], ['pass', 'not deep'], "'not deep' support"); a.deep([logger[5].type, logger[5].data], ['pass', 'throws'], "custom trhows support"); };
'use strict'; var customError = require('es5-ext/error/custom') , logger = require('../lib/logger')(); module.exports = function (t, a) { t = t(logger); t(true, true, 'foo'); t.ok(false, 'bar'); t.not(false, true, 'not'); t.deep([1, 2], [1, 2], 'deep'); t.notDeep([1, 2], [2, 1], 'not deep'); t.throws(function () { throw customError('Test', 'TEST'); }, 'TEST', 'throws'); a.deep([logger[0].type, logger[0].data], ['pass', 'foo']); a.deep([logger[1].type, logger[1].data.message], ['fail', 'bar']); a.deep([logger[2].type, logger[2].data], ['pass', 'not'], "'not' support"); a.deep([logger[3].type, logger[3].data], ['pass', 'deep'], "'deep' support"); a.deep([logger[4].type, logger[4].data], ['pass', 'not deep'], "'not deep' support"); a.deep([logger[5].type, logger[5].data], ['pass', 'throws'], "custom trhows support"); };
Update up to changes in es5-ext
Update up to changes in es5-ext
JavaScript
isc
medikoo/tad
--- +++ @@ -1,6 +1,6 @@ 'use strict'; -var CustomError = require('es5-ext/error/custom') +var customError = require('es5-ext/error/custom') , logger = require('../lib/logger')(); module.exports = function (t, a) { @@ -10,7 +10,7 @@ t.not(false, true, 'not'); t.deep([1, 2], [1, 2], 'deep'); t.notDeep([1, 2], [2, 1], 'not deep'); - t.throws(function () { throw new CustomError('Test', 'TEST'); }, 'TEST', + t.throws(function () { throw customError('Test', 'TEST'); }, 'TEST', 'throws'); a.deep([logger[0].type, logger[0].data], ['pass', 'foo']);
9cb0c8ee1f56dbe8c966ea4b912f4fd73f8d3684
server.js
server.js
import express from 'express'; import { apolloExpress, graphiqlExpress } from 'apollo-server'; import bodyParser from 'body-parser'; import cors from 'cors'; import { createServer } from 'http'; import { SubscriptionServer } from 'subscriptions-transport-ws'; import { subscriptionManager } from './data/subscriptions'; import schema from './data/schema'; const GRAPHQL_PORT = 8080; const WS_PORT = 8090; const graphQLServer = express().use('*', cors()); graphQLServer.use('/graphql', bodyParser.json(), apolloExpress({ schema, context: {}, })); graphQLServer.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql', })); graphQLServer.listen(GRAPHQL_PORT, () => console.log( `GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}/graphql` )); // WebSocket server for subscriptions const websocketServer = createServer((request, response) => { response.writeHead(404); response.end(); }); websocketServer.listen(WS_PORT, () => console.log( // eslint-disable-line no-console `Websocket Server is now running on http://localhost:${WS_PORT}` )); // eslint-disable-next-line new SubscriptionServer( { subscriptionManager }, websocketServer );
import express from 'express'; import { apolloExpress, graphiqlExpress } from 'apollo-server'; import bodyParser from 'body-parser'; import cors from 'cors'; import { createServer } from 'http'; import { SubscriptionServer } from 'subscriptions-transport-ws'; import { printSchema } from 'graphql/utilities/schemaPrinter' import { subscriptionManager } from './data/subscriptions'; import schema from './data/schema'; const GRAPHQL_PORT = 8080; const WS_PORT = 8090; const graphQLServer = express().use('*', cors()); graphQLServer.use('/graphql', bodyParser.json(), apolloExpress({ schema, context: {}, })); graphQLServer.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql', })); graphQLServer.use('/schema', function(req, res, _next) { res.set('Content-Type', 'text/plain'); res.send(printSchema(schema)); }); graphQLServer.listen(GRAPHQL_PORT, () => console.log( `GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}/graphql` )); // WebSocket server for subscriptions const websocketServer = createServer((request, response) => { response.writeHead(404); response.end(); }); websocketServer.listen(WS_PORT, () => console.log( // eslint-disable-line no-console `Websocket Server is now running on http://localhost:${WS_PORT}` )); // eslint-disable-next-line new SubscriptionServer( { subscriptionManager }, websocketServer );
Add /schema path that serves schema as plain text
Add /schema path that serves schema as plain text
JavaScript
mit
misas-io/misas-server,vincentfretin/assembl-graphql-js-server,misas-io/misas-server,a1528zhang/graphql-mock-server
--- +++ @@ -4,6 +4,7 @@ import cors from 'cors'; import { createServer } from 'http'; import { SubscriptionServer } from 'subscriptions-transport-ws'; +import { printSchema } from 'graphql/utilities/schemaPrinter' import { subscriptionManager } from './data/subscriptions'; import schema from './data/schema'; @@ -21,6 +22,11 @@ graphQLServer.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql', })); + +graphQLServer.use('/schema', function(req, res, _next) { + res.set('Content-Type', 'text/plain'); + res.send(printSchema(schema)); +}); graphQLServer.listen(GRAPHQL_PORT, () => console.log( `GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}/graphql`
4b91adde9fcdac4489f062552dd96c72efa26fda
server.js
server.js
// server.js 'use strict'; const express = require('express'); const app = express(); const mongoose = require('mongoose'); const morgan = require('morgan'); const bodyParser = require('body-parser'); // Pull info from HTML POST const methodOverride = require('method-override'); // Simulate DELETE and PUT const argv = require('yargs'); // ============================================================================= // Configuration // DB Config const DB_URL = argv.db || process.env.DATABASE_URL; mongoose.connect(DB_URL); // Set static files location /public/img will be /img for users app.use(express.static(__dirname + '/public')); // Log every request to the console app.use(morgan('dev')); // Parse application/x-www-form-unlencoded, JSON, and vnd.api+json as JSON app.use(bodyParser.urlencoded({'extended':'true'})); app.use(bodyParser.json()); app.use(bodyParser.json({ type: 'application/vnd.api+json' })); app.use(methodOverride()); // ============================================================================= // Initilize app app.listen(8080); console.log('App is running on port 8080');
// server.js //jscs:disable requireTrailingComma, disallowQuotedKeysInObjects 'use strict'; const express = require('express'); const app = express(); const mongoose = require('mongoose'); const morgan = require('morgan'); const bodyParser = require('body-parser'); // Pull info from HTML POST const methodOverride = require('method-override'); // Simulate DELETE and PUT const argv = require('yargs'); // ============================================================================= // Configuration // DB Config const DB_URL = argv.db || process.env.DATABASE_URL; mongoose.connect(DB_URL); // Set static files location /public/img will be /img for users app.use(express.static(__dirname + '/public')); // Log every request to the console app.use(morgan('dev')); // Parse application/x-www-form-unlencoded, JSON, and vnd.api+json as JSON app.use(bodyParser.urlencoded({'extended':'true'})); app.use(bodyParser.json()); app.use(bodyParser.json({ type: 'application/vnd.api+json' })); app.use(methodOverride()); // ============================================================================= // Initilize app app.listen(8080); console.log('App is running on port 8080');
Disable some annoying JSCS stuff
Disable some annoying JSCS stuff
JavaScript
mit
brandonlee503/Node-Angular-App-Test,brandonlee503/Node-Angular-App-Test
--- +++ @@ -1,4 +1,6 @@ // server.js + +//jscs:disable requireTrailingComma, disallowQuotedKeysInObjects 'use strict';
0d98c7264a78894fbed253e8711bf0ba8c89ba0c
server.js
server.js
'use strict'; const app = require('./app'); require('./api.js')(app); require('./static.js')(app); const PORT = process.env.PORT || 4000; app.listen(PORT, () => { console.log(`App listening on port ${PORT}!`); });
'use strict'; const app = require('./app'); // remove the automatically added `X-Powered-By` header app.disable('x-powered-by'); require('./api.js')(app); require('./static.js')(app); const PORT = process.env.PORT || 4000; app.listen(PORT, () => { console.log(`App listening on port ${PORT}!`); });
Remove the `X-Powered-By` header added by Express
Remove the `X-Powered-By` header added by Express The `X-Powered-By` header provides no real benefit and also leaks information about the design of the underlying system that may be useful to attackers.
JavaScript
mit
clembou/github-requests,clembou/github-requests,clembou/github-requests
--- +++ @@ -1,6 +1,10 @@ 'use strict'; const app = require('./app'); + +// remove the automatically added `X-Powered-By` header +app.disable('x-powered-by'); + require('./api.js')(app); require('./static.js')(app);
bb7dc88b6bdb324dfc2feb627a86d1125e8d51a4
test/javascripts/unit/hide_department_children_test.js
test/javascripts/unit/hide_department_children_test.js
module("Hide department children", { setup: function() { this.$departments = $( '<div class="js-hide-department-children">' + '<div class="department">' + '<div class="child-organisations">' + '<p>child content</p>' + '</div>' + '</div>' + '</div>'); $('#qunit-fixture').append(this.$departments); } }); test("should create toggle link before department list", function() { GOVUK.hideDepartmentChildren.init(); equals(this.$departments.find('.view-all').length, 1); console.log(this.$departments.html()); }); test("should toggle class when clicking view all link", function() { GOVUK.hideDepartmentChildren.init(); ok(this.$departments.find('.department').hasClass('js-hiding-children')); this.$departments.find('.view-all').click(); ok(!this.$departments.find('.department').hasClass('js-hiding-children')); });
module("Hide department children", { setup: function() { this.$departments = $( '<div class="js-hide-department-children">' + '<div class="department">' + '<div class="child-organisations">' + '<p>child content</p>' + '</div>' + '</div>' + '</div>'); $('#qunit-fixture').append(this.$departments); } }); test("should create toggle link before department list", function() { GOVUK.hideDepartmentChildren.init(); equals(this.$departments.find('.view-all').length, 1); }); test("should toggle class when clicking view all link", function() { GOVUK.hideDepartmentChildren.init(); ok(this.$departments.find('.department').hasClass('js-hiding-children')); this.$departments.find('.view-all').click(); ok(!this.$departments.find('.department').hasClass('js-hiding-children')); });
Remove left over console log
Remove left over console log
JavaScript
mit
robinwhittleton/whitehall,askl56/whitehall,hotvulcan/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,YOTOV-LIMITED/whitehall,ggoral/whitehall,alphagov/whitehall,hotvulcan/whitehall,ggoral/whitehall,alphagov/whitehall,askl56/whitehall,alphagov/whitehall,YOTOV-LIMITED/whitehall,robinwhittleton/whitehall,robinwhittleton/whitehall,ggoral/whitehall,YOTOV-LIMITED/whitehall,hotvulcan/whitehall,ggoral/whitehall,alphagov/whitehall,robinwhittleton/whitehall,hotvulcan/whitehall,askl56/whitehall
--- +++ @@ -16,7 +16,6 @@ test("should create toggle link before department list", function() { GOVUK.hideDepartmentChildren.init(); equals(this.$departments.find('.view-all').length, 1); - console.log(this.$departments.html()); }); test("should toggle class when clicking view all link", function() {
e28746346eb2439cf4f9fe3fbf02474cb39c65b6
testpilot/frontend/static-src/app/models/experiment.js
testpilot/frontend/static-src/app/models/experiment.js
import app from 'ampersand-app'; import Model from 'ampersand-model'; import querystring from 'querystring'; export default Model.extend({ urlRoot: '/api/experiments', extraProperties: 'allow', props: { enabled: {type: 'boolean', default: false} }, // This shouldn't be necessary; see comments in collections/experiments.js ajaxConfig: { headers: { 'Accept': 'application/json' }}, // TODO(DJ): this will be removed when we start tracking // install state through the User Installation model. // https://github.com/mozilla/testpilot/issues/195 initialize() { app.on('addon-install:install-ended', addon => { if (addon.id === this.id) { this.enabled = true; } }); app.on('addon-uninstall:uninstall-ended', addon => { if (addon.id === this.id) { this.enabled = false; } }); }, buildSurveyURL(ref) { const installed = Object.keys(app.me.installed); const queryParams = querystring.stringify({ ref: ref, experiment: this.title, installed: installed }); return `${this.survey_url}?${queryParams}`; } });
import app from 'ampersand-app'; import Model from 'ampersand-model'; import querystring from 'querystring'; export default Model.extend({ urlRoot: '/api/experiments', extraProperties: 'allow', props: { enabled: {type: 'boolean', default: false} }, // This shouldn't be necessary; see comments in collections/experiments.js ajaxConfig: { headers: { 'Accept': 'application/json' }}, // TODO(DJ): this will be removed when we start tracking // install state through the User Installation model. // https://github.com/mozilla/testpilot/issues/195 initialize() { app.on('addon-install:install-ended', addon => { if (addon.id === this.id) { this.enabled = true; } }); app.on('addon-uninstall:uninstall-ended', addon => { if (addon.id === this.id) { this.enabled = false; } }); }, buildSurveyURL(ref) { const queryParams = querystring.stringify({ ref: ref, experiment: this.title, installed: app.me.installed ? Object.keys(app.me.installed) : [] }); return `${this.survey_url}?${queryParams}`; } });
Fix fail on Object.keys(app.me.installed) which was holding up page loads.
Fix fail on Object.keys(app.me.installed) which was holding up page loads. - fixes #964
JavaScript
mpl-2.0
ckprice/testpilot,lmorchard/testpilot,lmorchard/testpilot,lmorchard/idea-town-server,lmorchard/testpilot,mozilla/idea-town,lmorchard/idea-town,meandavejustice/testpilot,fzzzy/testpilot,dannycoates/testpilot,mozilla/idea-town,fzzzy/testpilot,clouserw/testpilot,mathjazz/testpilot,mathjazz/testpilot,6a68/testpilot,flodolo/testpilot,mathjazz/testpilot,lmorchard/idea-town-server,flodolo/testpilot,mozilla/idea-town-server,ckprice/testpilot,flodolo/testpilot,6a68/testpilot,clouserw/testpilot,meandavejustice/testpilot,fzzzy/testpilot,mozilla/testpilot,6a68/idea-town,mozilla/testpilot,ckprice/testpilot,chuckharmston/testpilot,6a68/testpilot,meandavejustice/testpilot,clouserw/testpilot,mozilla/testpilot,meandavejustice/testpilot,mozilla/idea-town,lmorchard/idea-town,chuckharmston/testpilot,mozilla/idea-town,6a68/idea-town,dannycoates/testpilot,6a68/idea-town,clouserw/testpilot,dannycoates/testpilot,6a68/testpilot,mozilla/idea-town-server,lmorchard/idea-town,ckprice/testpilot,chuckharmston/testpilot,6a68/idea-town,mozilla/testpilot,lmorchard/testpilot,dannycoates/testpilot,chuckharmston/testpilot,mozilla/idea-town-server,flodolo/testpilot,fzzzy/testpilot,mathjazz/testpilot,mozilla/idea-town-server,lmorchard/idea-town-server,lmorchard/idea-town,lmorchard/idea-town-server
--- +++ @@ -30,11 +30,10 @@ }, buildSurveyURL(ref) { - const installed = Object.keys(app.me.installed); const queryParams = querystring.stringify({ ref: ref, experiment: this.title, - installed: installed + installed: app.me.installed ? Object.keys(app.me.installed) : [] }); return `${this.survey_url}?${queryParams}`; }
b1d751400723877c47e7c9fa4eddf8012fedee9d
js/devtools.js
js/devtools.js
// Script executed every time the devtools are opened. // custom panel chrome.devtools.panels.create("Backbone Debugger", "img/panel.png", "panel.html"); // custom sidebar pane in the elements panel chrome.devtools.panels.elements.createSidebarPane("Backbone Debugger", function(sidebar) { chrome.devtools.panels.elements.onSelectionChanged.addListener(function() { sidebar.setHeight("35px"); sidebar.setPage("elementsSidebar.html"); }); });
// Script executed every time the devtools are opened. // custom panel chrome.devtools.panels.create("Backbone", "img/panel.png", "panel.html"); // custom sidebar pane in the elements panel chrome.devtools.panels.elements.createSidebarPane("Backbone", function(sidebar) { chrome.devtools.panels.elements.onSelectionChanged.addListener(function() { sidebar.setHeight("35px"); sidebar.setPage("elementsSidebar.html"); }); });
Change the name of Panel and Elements sidebar pane to 'Backbone'
Change the name of Panel and Elements sidebar pane to 'Backbone'
JavaScript
mpl-2.0
Maluen/Backbone-Debugger,jbreeden/Backbone-Debugger,Maluen/Backbone-Debugger,jbreeden/Backbone-Debugger
--- +++ @@ -1,10 +1,10 @@ // Script executed every time the devtools are opened. // custom panel -chrome.devtools.panels.create("Backbone Debugger", "img/panel.png", "panel.html"); +chrome.devtools.panels.create("Backbone", "img/panel.png", "panel.html"); // custom sidebar pane in the elements panel -chrome.devtools.panels.elements.createSidebarPane("Backbone Debugger", function(sidebar) { +chrome.devtools.panels.elements.createSidebarPane("Backbone", function(sidebar) { chrome.devtools.panels.elements.onSelectionChanged.addListener(function() { sidebar.setHeight("35px"); sidebar.setPage("elementsSidebar.html");
1bba0e18bc7221580308890087a5334c0122ebf7
app.js
app.js
// Problem: We need a simple way to look at a user's badge count and JavaScript point from a web browser // Solution: Use Node.js to perform the profile look ups and server our template via HTTP // 1. Create a web server var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.write('This is before the end\n'); response.end('Hello World\n'); }).listen(3000); console.log('Server is running on port 3000'); // 2. Handle HTTP route GET / and POST / i.e. Home // if url == "/" && GET // show search // if url == "/" && POST // redirect to /:username // 3. Handle HTTP route GET /:username i.e. /chalkers // if url == "/...." // get json from Treehouse // on "end" // show profile // on "error" // show error // 4. Function that handles the reading of files and merge in value. // read from file and get a string // merge values in to string
// Problem: We need a simple way to look at a user's badge count and JavaScript point from a web browser // Solution: Use Node.js to perform the profile look ups and server our template via HTTP // 1. Create a web server var http = require('http'); http.createServer(function (request, response) { homeRoute(request, response); }).listen(3000); console.log('Server is running on port 3000'); // 2. Handle HTTP route GET / and POST / i.e. Home function homeRoute(request, response) { // if url == "/" && GET if (request.url === "/") { // show search response.writeHead(200, {'Content-Type': 'text/plain'}); response.write('Header\n'); response.write('Search\n'); response.end('Footer\n'); } // if url == "/" && POST // redirect to /:username } // 3. Handle HTTP route GET /:username i.e. /chalkers // if url == "/...." // get json from Treehouse // on "end" // show profile // on "error" // show error // 4. Function that handles the reading of files and merge in value. // read from file and get a string // merge values in to string
Create Web Server & Handle route GET and POST
Create Web Server & Handle route GET and POST
JavaScript
apache-2.0
JordanPortfolio/NodeJS-temp,JordanPortfolio/NodeJS-temp
--- +++ @@ -4,18 +4,23 @@ // 1. Create a web server var http = require('http'); http.createServer(function (request, response) { - response.writeHead(200, {'Content-Type': 'text/plain'}); - response.write('This is before the end\n'); - response.end('Hello World\n'); + homeRoute(request, response); }).listen(3000); console.log('Server is running on port 3000'); // 2. Handle HTTP route GET / and POST / i.e. Home - // if url == "/" && GET - // show search +function homeRoute(request, response) { + // if url == "/" && GET + if (request.url === "/") { + // show search + response.writeHead(200, {'Content-Type': 'text/plain'}); + response.write('Header\n'); + response.write('Search\n'); + response.end('Footer\n'); + } // if url == "/" && POST // redirect to /:username - +} // 3. Handle HTTP route GET /:username i.e. /chalkers // if url == "/...." // get json from Treehouse
3e6db5efd2d25ab673f8c77734ecb9b4de924588
app.js
app.js
var express = require('express'); var bunyan = require('bunyan'); var log = bunyan.createLogger({ name: 'app' }); var app = express(); var webhooks = require('datashaman-webhooks'); webhooks.boot(app, 'somesecret'); app.post('/', webhooks.router(function(req, res, event) { log.info(req.body, event); switch (event) { case 'ping': res.send('Ping'); } })); app.listen(8080);
var express = require('express'); var bunyan = require('bunyan'); var log = bunyan.createLogger({ name: 'app' }); var app = express(); var webhooks = require('datashaman-webhooks'); webhooks.boot(app, 'somesecret'); app.post('/', webhooks.router(function(req, res, event) { log.info(req.body, event); switch (event) { case 'ping': res.send('Ping'); break; default: res.send('Unhandled event: ' + event); } })); app.listen(8080);
Add default case to example file
Add default case to example file
JavaScript
mit
datashaman/datashaman-webhooks
--- +++ @@ -13,6 +13,9 @@ switch (event) { case 'ping': res.send('Ping'); + break; + default: + res.send('Unhandled event: ' + event); } }));
12bfc0b76c17b34baf779bc8debfa6fadb312890
server/db/models/userModel.js
server/db/models/userModel.js
const Sequelize = require('sequelize'); const db = require('../db.js'); const Users = db.define('users', { id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV1, primaryKey: true, }, facebook_id: { type: Sequelize.STRING, }, first_name: { type: Sequelize.STRING, }, last_name: { type: Sequelize.STRING, }, photo_url: { type: Sequelize.STRING, }, description: { type: Sequelize.STRING(256), defaultValue: 'Click here to edit!', }, // would like to add counter cache for request count and connection count }, { freezeTableName: true, } ); module.exports = Users;
const Sequelize = require('sequelize'); const db = require('../db.js'); const Users = db.define('users', { id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV1, primaryKey: true, }, facebook_id: { type: Sequelize.STRING, }, first_name: { type: Sequelize.STRING, }, last_name: { type: Sequelize.STRING, }, photo_url: { type: Sequelize.STRING, }, description: { type: Sequelize.STRING(256), }, // would like to add counter cache for request count and connection count }, { freezeTableName: true, } ); module.exports = Users;
Remove default description on user model
Remove default description on user model
JavaScript
mit
VictoriousResistance/iDioma,VictoriousResistance/iDioma
--- +++ @@ -22,7 +22,6 @@ }, description: { type: Sequelize.STRING(256), - defaultValue: 'Click here to edit!', }, // would like to add counter cache for request count and connection count },
bc07195fadc3d654a02917947e0dac2feb43e0bc
services/permissions/model.js
services/permissions/model.js
'use strict' const mongoose = require('mongoose') const PermissionSchema = new mongoose.Schema({ regex: { type: String, required: true, unique: true }, roles: { type: [ String ], required: true }, dateCreated: { type: Date, default: Date.now } }) PermissionSchema.statics.findMatches = function (email, cb) { const collected = [] this.find({}, function (err, permissions) { if (err) cb(err) for (let i = 0; i < permissions.length; i++) { const regex = new RegExp(permissions[i].regex) if (email.search(regex) > -1) collected.push(permissions[i]) } cb(null, collected) }) } module.exports = mongoose.model('Permission', PermissionSchema)
'use strict' const mongoose = require('mongoose') const PermissionSchema = new mongoose.Schema({ regex: { type: Object, required: true, unique: true }, roles: { type: [ String ], required: true }, dateCreated: { type: Date, default: Date.now } }) PermissionSchema.statics.findMatches = function (email, cb) { this.find({}, (err, permissions) => { if (err) cb(err) // return only permissions whose regex match the email cb(null, permissions ? permissions.filter(permission => permission.regex.test(email)) : null) }) } PermissionSchema.path('regex').set(function (regex) { return regex instanceof RegExp ? regex : new RegExp(regex) }) module.exports = mongoose.model('Permission', PermissionSchema)
Save RegExp object to database instead of string, and more concise filter
Save RegExp object to database instead of string, and more concise filter
JavaScript
mit
thebitmill/midwest-membership-services
--- +++ @@ -3,25 +3,22 @@ const mongoose = require('mongoose') const PermissionSchema = new mongoose.Schema({ - regex: { type: String, required: true, unique: true }, + regex: { type: Object, required: true, unique: true }, roles: { type: [ String ], required: true }, dateCreated: { type: Date, default: Date.now } }) PermissionSchema.statics.findMatches = function (email, cb) { - const collected = [] - - this.find({}, function (err, permissions) { + this.find({}, (err, permissions) => { if (err) cb(err) - for (let i = 0; i < permissions.length; i++) { - const regex = new RegExp(permissions[i].regex) - - if (email.search(regex) > -1) collected.push(permissions[i]) - } - - cb(null, collected) + // return only permissions whose regex match the email + cb(null, permissions ? permissions.filter(permission => permission.regex.test(email)) : null) }) } +PermissionSchema.path('regex').set(function (regex) { + return regex instanceof RegExp ? regex : new RegExp(regex) +}) + module.exports = mongoose.model('Permission', PermissionSchema)
db04398e499a8725a0391e10d1955b7c805cb209
test/remove.js
test/remove.js
#!/usr/bin/env node 'use strict'; /** Load modules. */ var fs = require('fs'), path = require('path'); /** Resolve program params. */ var args = process.argv.slice(process.argv[0] === process.execPath ? 2 : 0), filePath = path.resolve(args[1]); var pattern = (function() { var result = args[0], delimiter = result.charAt(0), lastIndex = result.lastIndexOf(delimiter); return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1)); }()); /** Used to match lines of code. */ var reLine = /.*/gm; /*----------------------------------------------------------------------------*/ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) { return match.replace(reLine, ''); }));
#!/usr/bin/env node 'use strict'; var fs = require('fs'), path = require('path'); var args = (args = process.argv) .slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0); var filePath = path.resolve(args[1]), reLine = /.*/gm, slice = Array.prototype.slice; var pattern = (function() { var result = args[0], delimiter = result.charAt(0), lastIndex = result.lastIndexOf(delimiter); return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1)); }()); /*----------------------------------------------------------------------------*/ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) { var snippet = slice.call(arguments, -3, -1)[0]; return match.replace(snippet, snippet.replace(reLine, '')); }));
Add support for removing the last capture group.
Add support for removing the last capture group.
JavaScript
mit
rlugojr/lodash,msmorgan/lodash,beaugunderson/lodash,steelsojka/lodash,boneskull/lodash,msmorgan/lodash,steelsojka/lodash,rlugojr/lodash,beaugunderson/lodash,boneskull/lodash
--- +++ @@ -1,13 +1,15 @@ #!/usr/bin/env node 'use strict'; -/** Load modules. */ var fs = require('fs'), path = require('path'); -/** Resolve program params. */ -var args = process.argv.slice(process.argv[0] === process.execPath ? 2 : 0), - filePath = path.resolve(args[1]); +var args = (args = process.argv) + .slice((args[0] === process.execPath || args[0] === 'node') ? 2 : 0); + +var filePath = path.resolve(args[1]), + reLine = /.*/gm, + slice = Array.prototype.slice; var pattern = (function() { var result = args[0], @@ -17,11 +19,9 @@ return RegExp(result.slice(1, lastIndex), result.slice(lastIndex + 1)); }()); -/** Used to match lines of code. */ -var reLine = /.*/gm; - /*----------------------------------------------------------------------------*/ fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace(pattern, function(match) { - return match.replace(reLine, ''); + var snippet = slice.call(arguments, -3, -1)[0]; + return match.replace(snippet, snippet.replace(reLine, '')); }));
1c26e7c754a77a6775ce7c8461dc6e47e856ebad
src/resources/assets/js/SparkKioskNotify/spark-kiosk-notify.js
src/resources/assets/js/SparkKioskNotify/spark-kiosk-notify.js
Vue.component('spark-kiosk-notify', { props: [ ], data() { return { 'notifications': [], 'users': [], 'newNotification': { "user_id": null } }; }, ready(){ this.getNotifications(); this.getUsers(); }, methods: { /** * Get all of the announcements. */ getNotifications: function(){ this.$http.get('/skn/notifications') .then(response => { this.notifications = response.data; }); }, /** * Get all of the users. */ getUsers: function(){ this.$http.get('/skn/users') .then(response => { this.users = response.data; }); }, /** * Create Notification. */ createNotification: function(){ this.$http.get('/skn/notifications/create', this.createNotification) .then(response => { this.createNotification = {}; this.getNotifications(); }); } } });
Vue.component('spark-kiosk-notify', { props: [ ], data() { return { 'notifications': [], 'users': [], 'newNotification': { "user_id": null } }; }, ready(){ this.getNotifications(); this.getUsers(); }, methods: { /** * Get all of the announcements. */ getNotifications: function(){ this.$http.get('/skn/notifications') .then(response => { this.notifications = response.data; }); }, /** * Get all of the users. */ getUsers: function(){ this.$http.get('/skn/users') .then(response => { this.users = response.data; }); }, /** * Create Notification. */ createNotification: function(){ this.$http.post('/skn/notifications/create', this.newNotification) .then(response => { this.newNotification = {}; this.getNotifications(); }); } } });
Change to 'newNotification', change to post
Change to 'newNotification', change to post
JavaScript
mit
vmitchell85/spark-kiosk-notify,vmitchell85/spark-kiosk-notify,vmitchell85/spark-kiosk-notify
--- +++ @@ -39,9 +39,9 @@ * Create Notification. */ createNotification: function(){ - this.$http.get('/skn/notifications/create', this.createNotification) + this.$http.post('/skn/notifications/create', this.newNotification) .then(response => { - this.createNotification = {}; + this.newNotification = {}; this.getNotifications(); }); }
2983df1c5a6363f1cdd827a9ac006ff71ddd259c
corehq/apps/domain/static/domain/js/case_search_main.js
corehq/apps/domain/static/domain/js/case_search_main.js
hqDefine('domain/js/case_search_main', [ 'jquery', 'hqwebapp/js/initial_page_data', 'domain/js/case_search', ], function( $, initialPageData, caseSearch ) { $(function () { var viewModel = caseSearch.CaseSearchConfig({ values: initialPageData.get('values'), caseTypes: initialPageData.get('case_types'), }); $('#case-search-config').koApplyBindings(viewModel); $('#case-search-config').on('change', viewModel.change).on('click', ':button', viewModel.change); }); });
hqDefine('domain/js/case_search_main', [ 'jquery', 'hqwebapp/js/initial_page_data', 'domain/js/case_search', 'hqwebapp/js/knockout_bindings.ko', // save button ], function( $, initialPageData, caseSearch ) { $(function () { var viewModel = caseSearch.CaseSearchConfig({ values: initialPageData.get('values'), caseTypes: initialPageData.get('case_types'), }); $('#case-search-config').koApplyBindings(viewModel); $('#case-search-config').on('change', viewModel.change).on('click', ':button', viewModel.change); }); });
Add knockout bindings as dependency to case search
Add knockout bindings as dependency to case search
JavaScript
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -2,6 +2,7 @@ 'jquery', 'hqwebapp/js/initial_page_data', 'domain/js/case_search', + 'hqwebapp/js/knockout_bindings.ko', // save button ], function( $, initialPageData,
4954b4b8f0e9325dbfe7bfa5baf9ece539f03347
js/endpoints.js
js/endpoints.js
/** * Created by Neil on 29/09/13. */ function signin(mode, callback, clientID) { // clientID filled in by template, immediate = true because we should not need to ask permission again gapi.auth.authorize({client_id: clientID, scope: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], immediate: true, response_type: 'token'}, // Can't use id tokens as we can't get the user if from an id token callback); } function userAuthed() { var request = gapi.client.oauth2.userinfo.get().execute(function (resp) { // Check the token by calling userinfo, if it's ok call our end point if (!resp.code) { var token = gapi.auth.getToken(); gapi.client.mylatitude.location.last().execute(function (resp) { // this does not do anything yet it's just a test. // console.log(resp); }); } }); }
/** * Created by Neil on 29/09/13. */ function signin(mode, callback, clientID) { // clientID filled in by template, immediate = true because we should not need to ask permission again gapi.auth.authorize({client_id: clientID, scope: ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], immediate: true, response_type: 'token'}, // Can't use id tokens as we can't get the user if from an id token callback); } function userAuthed() { var request = gapi.client.oauth2.userinfo.get().execute(function (resp) { // Check the token by calling userinfo, if it's ok call our end point if (!resp.code) { var token = gapi.auth.getToken(); gapi.client.mylatitude.locations.latest().execute(function (resp) { // this does not do anything yet it's just a test. // console.log(resp); }); } }); }
Change the name of the endpoint
Change the name of the endpoint
JavaScript
mit
nparley/mylatitude,nparley/mylatitude,nparley/mylatitude
--- +++ @@ -14,7 +14,7 @@ gapi.client.oauth2.userinfo.get().execute(function (resp) { // Check the token by calling userinfo, if it's ok call our end point if (!resp.code) { var token = gapi.auth.getToken(); - gapi.client.mylatitude.location.last().execute(function (resp) { // this does not do anything yet it's just a test. + gapi.client.mylatitude.locations.latest().execute(function (resp) { // this does not do anything yet it's just a test. // console.log(resp); }); }
c99f338e1ff0141d256e75150cd9c1e126429682
src/settings.js
src/settings.js
'use babel'; export default { binary: { title: 'Binary path', description: 'Path for elm-format', type: 'string', default: '/usr/local/bin/elm-format', order: 1, }, formatOnSave: { title: 'Format on save', description: 'Do we format when you save files?', type: 'boolean', default: true, order: 2, }, showNotifications: { title: 'Show notifications on save', description: 'Do you want to see the bar when we save?', type: 'boolean', default: false, order: 3, }, showErrorNotifications: { title: 'Show error notifications on save', description: 'Do you want to see the bar when we save?', type: 'boolean', default: true, order: 4, }, };
'use babel'; export default { binary: { title: 'Binary path', description: 'Path for elm-format', type: 'string', default: 'elm-format', order: 1, }, formatOnSave: { title: 'Format on save', description: 'Do we format when you save files?', type: 'boolean', default: true, order: 2, }, showNotifications: { title: 'Show notifications on save', description: 'Do you want to see the bar when we save?', type: 'boolean', default: false, order: 3, }, showErrorNotifications: { title: 'Show error notifications on save', description: 'Do you want to see the bar when we save?', type: 'boolean', default: true, order: 4, }, };
Use "elm-format" as the default binary path
Use "elm-format" as the default binary path Not all people have elm-format installed into /usr/local/bin/elm-format (I installed it via package manager so it's in /usr/bin/elm-format), but I assume most of the people have it int their PATH. This should fix #18 for most users.
JavaScript
mit
triforkse/atom-elm-format
--- +++ @@ -5,7 +5,7 @@ title: 'Binary path', description: 'Path for elm-format', type: 'string', - default: '/usr/local/bin/elm-format', + default: 'elm-format', order: 1, }, formatOnSave: {
bdbafc18317070530573bd28a2ec5241c793340b
ghost/admin/routes/posts.js
ghost/admin/routes/posts.js
import styleBody from 'ghost/mixins/style-body'; import AuthenticatedRoute from 'ghost/routes/authenticated'; var paginationSettings = { status: 'all', staticPages: 'all', page: 1, limit: 15 }; var PostsRoute = AuthenticatedRoute.extend(styleBody, { classNames: ['manage'], model: function () { // using `.filter` allows the template to auto-update when new models are pulled in from the server. // we just need to 'return true' to allow all models by default. return this.store.filter('post', paginationSettings, function () { return true; }); }, setupController: function (controller, model) { this._super(controller, model); controller.set('paginationSettings', paginationSettings); }, actions: { openEditor: function (post) { this.transitionTo('editor', post); } } }); export default PostsRoute;
import styleBody from 'ghost/mixins/style-body'; import AuthenticatedRoute from 'ghost/routes/authenticated'; var paginationSettings = { status: 'all', staticPages: 'all', page: 1 }; var PostsRoute = AuthenticatedRoute.extend(styleBody, { classNames: ['manage'], model: function () { // using `.filter` allows the template to auto-update when new models are pulled in from the server. // we just need to 'return true' to allow all models by default. return this.store.filter('post', paginationSettings, function () { return true; }); }, setupController: function (controller, model) { this._super(controller, model); controller.set('paginationSettings', paginationSettings); }, actions: { openEditor: function (post) { this.transitionTo('editor', post); } } }); export default PostsRoute;
Remove limit from ember post API calls
Remove limit from ember post API calls ref #3004 - this is unnecessary and causing bugs
JavaScript
mit
TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost
--- +++ @@ -4,8 +4,7 @@ var paginationSettings = { status: 'all', staticPages: 'all', - page: 1, - limit: 15 + page: 1 }; var PostsRoute = AuthenticatedRoute.extend(styleBody, {
76326fa424405c3930855652d69ee603ab7df5e7
bot/utils/twitter/tweetWeather.js
bot/utils/twitter/tweetWeather.js
/** * @module * Tweet the current weather. */ const {postStatus} = require('./../../api/twitter-api'); const weather = require('./../weather/getWeather'); const logger = require('./../logger'); const moment = require('moment-timezone'); const tweetWeather = async(address='Manila, Philippines') => { let curTime = moment.tz('Asia/Manila').format('hh:mm A'); try { let curForecast = await weather.getCurrForecast(address); let data = { status: curForecast.currently.summary, temp: curForecast.currently.temperature, precip: (curForecast.currently.precipProbability * 100) + '%', humid: (curForecast.currently.humidity * 100) + '%' } let tweetHead = `As of ${curTime} in ${address}\nThere will be ${curForecast.hourly.summary}\n\n`; let tweetBody = `Weather Status: ${data.status}\nTemperature: ${data.temp}\nPrecipitation: ${data.precip}\nHumidity: ${data.humid}`; await postStatus({status: tweetHead + tweetBody}); } catch (err) { logger.error('Error tweeting current weather forecast', {error: err}); } }; tweetWeather(); module.exports = tweetWeather;
/** * @module * Tweet the current weather. */ const {postStatus} = require('./../../api/twitter-api'); const weather = require('./../weather/getWeather'); const logger = require('./../logger'); const moment = require('moment-timezone'); const tweetWeather = async(address='Manila, Philippines') => { let curTime = moment.tz('Asia/Manila').format('hh:mm A'); try { let curForecast = await weather.getCurrForecast(address); let data = { status: curForecast.currently.summary, temp: curForecast.currently.temperature, precip: (curForecast.currently.precipProbability * 100) + '%', humid: (curForecast.currently.humidity * 100) + '%' } let tweetHead = `As of ${curTime} in ${address}\nThere will be ${curForecast.hourly.summary}\n\n`; let tweetBody = `Weather Status: ${data.status}\nTemperature: ${data.temp}\nPrecipitation: ${data.precip}\nHumidity: ${data.humid}`; // TODO: Find a workaround to post a tweet status over 140 characters. let tweetPost = await postStatus({status: tweetHead}); logger.info('Tweeted a new weather update', {tweet: tweetPost.text}); } catch (err) { logger.error('Error tweeting current weather forecast', {error: err}); } }; tweetWeather(); module.exports = tweetWeather;
Update weather tweet message to only tweetHead
Update weather tweet message to only tweetHead
JavaScript
mit
Ollen/dale-bot
--- +++ @@ -21,7 +21,9 @@ let tweetHead = `As of ${curTime} in ${address}\nThere will be ${curForecast.hourly.summary}\n\n`; let tweetBody = `Weather Status: ${data.status}\nTemperature: ${data.temp}\nPrecipitation: ${data.precip}\nHumidity: ${data.humid}`; - await postStatus({status: tweetHead + tweetBody}); + // TODO: Find a workaround to post a tweet status over 140 characters. + let tweetPost = await postStatus({status: tweetHead}); + logger.info('Tweeted a new weather update', {tweet: tweetPost.text}); } catch (err) { logger.error('Error tweeting current weather forecast', {error: err});
9d68a8e39598e53cee8c7ba26ab6096f9dfdd219
spread_operator/app-finish.js
spread_operator/app-finish.js
'use strict' let levelOnePokemons = ['Pikachu','Magikarp','Balbasaur']; let allPokemons = ['Meowth', 'Poliwag', ...levelOnePokemons]; console.log(allPokemons); let pikachuName = "Pikachu"; let arrayWords = [...pikachuName]; console.log(arrayWords);
'use strict' let levelOnePokemons = ['Pikachu','Magikarp','Balbasaur']; // Insert array to another array let allPokemons = ['Meowth', 'Poliwag', ...levelOnePokemons]; console.log(allPokemons); let pikachuName = "Pikachu"; // Split into literal array with spread operator let arrayWords = [...pikachuName]; console.log(arrayWords);
Add comment for explain step
Add comment for explain step
JavaScript
apache-2.0
teerasej/training-javascript-es6-beginner-thai
--- +++ @@ -2,11 +2,14 @@ let levelOnePokemons = ['Pikachu','Magikarp','Balbasaur']; +// Insert array to another array let allPokemons = ['Meowth', 'Poliwag', ...levelOnePokemons]; console.log(allPokemons); let pikachuName = "Pikachu"; + +// Split into literal array with spread operator let arrayWords = [...pikachuName]; console.log(arrayWords);
543a31cc11fdb145cde89c42b44f1bd0d22cef6d
gulpfile.js
gulpfile.js
const gulp = require('gulp'); const gutil = require('gulp-util'); const eslint = require('gulp-eslint'); const excludeGitignore = require('gulp-exclude-gitignore'); const mocha = require('gulp-mocha'); const istanbul = require('gulp-istanbul'); gulp.task('linter', eslintCheck); gulp.task('default', gulp.series('linter', gulp.series(istanbulCover, mochaTest))); function eslintCheck() { return gulp.src('**/*.js') .pipe(excludeGitignore()) .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()); } function istanbulCover() { return gulp.src('generators/**/index.js') .pipe(istanbul({includeUntested: true})) .pipe(istanbul.hookRequire()); } function mochaTest() { return gulp.src('test/**/*.js') .pipe(mocha({reporter: 'spec'})) .once('error', err => { gutil.log(gutil.colors.red('[Mocha]'), err.toString()); process.exit(1); }) .pipe(istanbul.writeReports()); }
const gulp = require('gulp'); const gutil = require('gulp-util'); const eslint = require('gulp-eslint'); const excludeGitignore = require('gulp-exclude-gitignore'); const mocha = require('gulp-mocha'); const istanbul = require('gulp-istanbul'); gulp.task('linter', eslintCheck); gulp.task('default', gulp.series('linter', gulp.series(istanbulCover, mochaTest))); function eslintCheck() { return gulp.src(['**/*.js', '!**/templates/**']) .pipe(excludeGitignore()) .pipe(eslint()) .pipe(eslint.format()) .pipe(eslint.failAfterError()); } function istanbulCover() { return gulp.src('generators/**/index.js') .pipe(istanbul({includeUntested: true})) .pipe(istanbul.hookRequire()); } function mochaTest() { return gulp.src('test/**/*.js') .pipe(mocha({reporter: 'spec'})) .once('error', err => { gutil.log(gutil.colors.red('[Mocha]'), err.toString()); process.exit(1); }) .pipe(istanbul.writeReports()); }
Add ignored files in gulp-eslint conf
Add ignored files in gulp-eslint conf
JavaScript
mit
FountainJS/generator-fountain-tslint
--- +++ @@ -9,7 +9,7 @@ gulp.task('default', gulp.series('linter', gulp.series(istanbulCover, mochaTest))); function eslintCheck() { - return gulp.src('**/*.js') + return gulp.src(['**/*.js', '!**/templates/**']) .pipe(excludeGitignore()) .pipe(eslint()) .pipe(eslint.format())
437b52a37060631ae6cce3bd2002db0d7143a3f7
gulpfile.js
gulpfile.js
'use strict'; const gulp = require('gulp'); const babel = require('gulp-babel'); gulp.task('default', () => gulp.src('lib/delve.js') .pipe(babel({ presets: ['es2015'] })) .pipe(gulp.dest('dist')) );
'use strict'; const gulp = require('gulp'); const clean = require('gulp-clean'); const babel = require('gulp-babel'); gulp.task('clean-dist', () => gulp.src('dist/', { read: false }) .pipe(clean()) ); gulp.task('default', [ 'clean-dist' ], () => gulp.src('lib/*.js') .pipe(babel({ presets: [ 'es2015' ] })) .pipe(gulp.dest('dist')) );
Add gulp clean & build tasks
Add gulp clean & build tasks
JavaScript
mit
tylerFowler/delvejs
--- +++ @@ -1,10 +1,16 @@ 'use strict'; const gulp = require('gulp'); +const clean = require('gulp-clean'); const babel = require('gulp-babel'); -gulp.task('default', () => - gulp.src('lib/delve.js') - .pipe(babel({ presets: ['es2015'] })) +gulp.task('clean-dist', () => + gulp.src('dist/', { read: false }) + .pipe(clean()) +); + +gulp.task('default', [ 'clean-dist' ], () => + gulp.src('lib/*.js') + .pipe(babel({ presets: [ 'es2015' ] })) .pipe(gulp.dest('dist')) );
f69dacc5aecab76e7dd3920decce6950f8c6d300
gulpfile.js
gulpfile.js
/* global require */ var gulp = require('gulp'), spawn = require('child_process').spawn, ember, node; gulp.task('server', function () { if (node) node.kill(); // Kill server if one is running node = spawn('node', ['server.js'], {cwd: 'node', stdio: 'inherit'}); node.on('close', function (code) { if (code === 8) { console.log('Node error detected, waiting for changes...'); } }); }); gulp.task('ember', function () { ember = spawn('./node_modules/.bin/ember', ['server', '--port=4900', '--proxy=http://localhost:3900'], {cwd: 'ember', stdio: 'inherit'}); ember.on('close', function (code) { if (code === 8) { console.log('Ember error detected, waiting for changes...'); } }); }); gulp.task('default', function () { gulp.run('server'); gulp.run('ember'); // Reload server if files changed gulp.watch(['node/**/*.js'], function () { gulp.run('server'); }); }); // kill node server on exit process.on('exit', function() { if (node) node.kill(); if (ember) ember.kill(); });
/* global require */ var gulp = require('gulp'), spawn = require('child_process').spawn, ember, node; gulp.task('node', function () { if (node) node.kill(); // Kill server if one is running node = spawn('node', ['server.js'], {cwd: 'node', stdio: 'inherit'}); node.on('close', function (code) { if (code === 8) { console.log('Node error detected, waiting for changes...'); } }); }); gulp.task('ember', function () { ember = spawn('./node_modules/.bin/ember', ['server', '--port=4900', '--proxy=http://localhost:3900'], {cwd: 'ember', stdio: 'inherit'}); ember.on('close', function (code) { if (code === 8) { console.log('Ember error detected, waiting for changes...'); } }); }); gulp.task('default', function () { gulp.run('node'); gulp.run('ember'); // Reload node if files changed gulp.watch(['node/**/*.js'], function () { gulp.run('node'); }); }); // kill node server on exit process.on('exit', function() { if (node) node.kill(); if (ember) ember.kill(); });
Rename server task to node
Rename server task to node
JavaScript
bsd-3-clause
FreeMusicNinja/freemusic.ninja,FreeMusicNinja/freemusic.ninja
--- +++ @@ -6,7 +6,7 @@ node; -gulp.task('server', function () { +gulp.task('node', function () { if (node) node.kill(); // Kill server if one is running node = spawn('node', ['server.js'], {cwd: 'node', stdio: 'inherit'}); node.on('close', function (code) { @@ -27,12 +27,12 @@ gulp.task('default', function () { - gulp.run('server'); + gulp.run('node'); gulp.run('ember'); - // Reload server if files changed + // Reload node if files changed gulp.watch(['node/**/*.js'], function () { - gulp.run('server'); + gulp.run('node'); }); });
866967ddb5ca862c34394113472f9ec543b7549c
gulpfile.js
gulpfile.js
var fontName = 'seti', gulp = require('gulp'), iconfont = require('gulp-iconfont'), iconfontCss = require('gulp-iconfont-css'), svgmin = require('gulp-svgmin'); gulp.task('font', function(){ gulp.src(['./icons/*.svg']) .pipe(iconfontCss({ fontName: fontName, path: './styles/_fonts/_template.less', targetPath: '../seti.less/', fontPath: './styles/_fonts/seti/' })) .pipe(iconfont({ normalize: true, fontName: fontName, formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'] })) .pipe(gulp.dest('./styles/_fonts/seti/')); }); gulp.task('icon', ['svg', 'font']); gulp.task('icons', ['svg', 'font']); gulp.task('svg', function() { gulp.src('./icons/*.svg') .pipe(svgmin()) .pipe(gulp.dest('./icons')); });
var fontName = 'seti', gulp = require('gulp'), iconfont = require('gulp-iconfont'), iconfontCss = require('gulp-iconfont-css'), svgmin = require('gulp-svgmin'); gulp.task('font', function(){ gulp.src(['./icons/*.svg']) .pipe(iconfontCss({ fontName: fontName, path: './styles/_fonts/_template.less', targetPath: '../seti.less/', fontPath: './styles/_fonts/seti/' })) .pipe(iconfont({ normalize: true, fontHeight: 1000, fontName: fontName, formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'] })) .pipe(gulp.dest('./styles/_fonts/seti/')); }); gulp.task('icon', ['svg', 'font']); gulp.task('icons', ['svg', 'font']); gulp.task('svg', function() { gulp.src('./icons/*.svg') .pipe(svgmin()) .pipe(gulp.dest('./icons')); });
Set font height to improve glyph quality
Set font height to improve glyph quality
JavaScript
mit
jesseweed/seti-ui
--- +++ @@ -14,6 +14,7 @@ })) .pipe(iconfont({ normalize: true, + fontHeight: 1000, fontName: fontName, formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'] }))
30013e03caa57ce57090d36c812aa6d128db3348
gulpfile.js
gulpfile.js
var gulp = require('gulp'), connect = require('gulp-connect'), stylus = require('gulp-stylus'), prefix = require('gulp-autoprefixer'); var paths = { styles: 'css/bare-ninja.styl', html: './*.html' }; gulp.task('connect', function() { connect.server({ livereload: true }); }); gulp.task('html', function () { gulp.src(paths.html) .pipe(connect.reload()); }); gulp.task('styles', function () { gulp.src(paths.styles) .pipe(stylus()) .pipe(prefix('last 2 version', 'ie 8', 'ie 9')) .pipe(gulp.dest('./css')) .pipe(connect.reload()); }); gulp.task('watch', function () { gulp.watch(paths.styles, ['styles']); gulp.watch(paths.html, ['html']); }); // The default task (called when you run `gulp` from cli) gulp.task('default', ['styles', 'connect', 'watch']);
var gulp = require('gulp'), connect = require('gulp-connect'), stylus = require('gulp-stylus'), prefix = require('gulp-autoprefixer'); var paths = { styles: 'css/**/*.styl', html: './*.html' }; gulp.task('connect', function() { connect.server({ livereload: true }); }); gulp.task('html', function () { gulp.src(paths.html) .pipe(connect.reload()); }); gulp.task('styles', function () { gulp.src('css/bare-ninja.styl') .pipe(stylus()) .pipe(prefix('last 2 version', 'ie 8', 'ie 9')) .pipe(gulp.dest('./css')) .pipe(connect.reload()); }); gulp.task('watch', function () { gulp.watch(paths.styles, ['styles']); gulp.watch(paths.html, ['html']); }); // The default task (called when you run `gulp` from cli) gulp.task('default', ['styles', 'connect', 'watch']);
Fix LiveReload for all .styl files
Fix LiveReload for all .styl files
JavaScript
mit
trevanhetzel/barekit,trevanhetzel/barekit
--- +++ @@ -4,7 +4,7 @@ prefix = require('gulp-autoprefixer'); var paths = { - styles: 'css/bare-ninja.styl', + styles: 'css/**/*.styl', html: './*.html' }; @@ -20,7 +20,7 @@ }); gulp.task('styles', function () { - gulp.src(paths.styles) + gulp.src('css/bare-ninja.styl') .pipe(stylus()) .pipe(prefix('last 2 version', 'ie 8', 'ie 9')) .pipe(gulp.dest('./css'))
65fc00db12ebad06df6557bc3276eccc493566e2
gulpfile.js
gulpfile.js
require('babel/register') var gulp = require('gulp') var $ = require("gulp-load-plugins")() var runSequence = require("run-sequence") gulp.task("build", function() { return gulp.src("src/**/*.js") .pipe($.babel()) .pipe(gulp.dest("lib")) }) gulp.task("lint", function() { return gulp.src("src/**/*.js") .pipe($.eslint()) .pipe($.eslint.format()) }) gulp.task("test", function() { process.env.NODE_ENV = "test" return gulp.src("test/**/*.js") .pipe($.mocha({ reporter: "spec", clearRequireCache: true, ignoreLeaks: true })) }) gulp.task("default", function(cb) { return runSequence("build", "test", cb) })
require('babel/register') var gulp = require('gulp') var $ = require("gulp-load-plugins")() var runSequence = require("run-sequence") gulp.task("build", function() { return gulp.src("src/**/*.js") .pipe($.babel()) .pipe(gulp.dest("lib")) }) gulp.task("lint", function() { return gulp.src("src/**/*.js") .pipe($.eslint()) .pipe($.eslint.format()) }) gulp.task("test", function() { process.env.NODE_ENV = "test" return gulp.src("test/**/*.js") .pipe($.mocha({ reporter: "spec", clearRequireCache: true, ignoreLeaks: true })) }) gulp.task("default", function(cb) { return runSequence("build", "test", cb) }) function release(importance) { return new Promise(function(resolve) { // Select package.json gulp.src(["package.json"]) // Bump version on the package.json .pipe($.bump({type: importance})) .pipe(gulp.dest('./')) // Commit the changes .pipe($.git.commit("Bump version")) // Tag our version .pipe($.tagVersion()) .on("end", function() { $.git.push("origin", "master", {args: "--follow-tags"}, function() { resolve() }) }) }) } gulp.task("release:minor", _.partial(release, "minor")); gulp.task("release:major", _.partial(release, "major")); gulp.task("release:patch", _.partial(release, "patch"));
Add release task (needs npm publish still)
Add release task (needs npm publish still)
JavaScript
mit
launchbadge/node-bok
--- +++ @@ -29,3 +29,30 @@ gulp.task("default", function(cb) { return runSequence("build", "test", cb) }) + +function release(importance) { + return new Promise(function(resolve) { + // Select package.json + gulp.src(["package.json"]) + + // Bump version on the package.json + .pipe($.bump({type: importance})) + .pipe(gulp.dest('./')) + + // Commit the changes + .pipe($.git.commit("Bump version")) + + // Tag our version + .pipe($.tagVersion()) + + .on("end", function() { + $.git.push("origin", "master", {args: "--follow-tags"}, function() { + resolve() + }) + }) + }) +} + +gulp.task("release:minor", _.partial(release, "minor")); +gulp.task("release:major", _.partial(release, "major")); +gulp.task("release:patch", _.partial(release, "patch"));
371a70778560330e5730acf1a76c6de17c578d17
gulpfile.js
gulpfile.js
"use strict" let gulp = require('gulp'); let ts = require('gulp-typescript'); let tsProject = ts.createProject("tsconfig.json"); gulp.task("default", () => { return tsProject.src() .pipe(tsProject()) .js.pipe(gulp.dest("dist")); });
"use strict" let gulp = require("gulp"); let sourcemaps = require("gulp-sourcemaps"); let ts = require("gulp-typescript"); let tsProject = ts.createProject("tsconfig.json"); gulp.task("default", () => { let tsResult = tsProject.src() .pipe(sourcemaps.init()) .pipe(tsProject()); return tsResult.js .pipe(sourcemaps.write()) .pipe(gulp.dest("dist")) }); gulp.task("watch", ["default"], () => { gulp.watch("*.ts", ["default"]); });
Set up gulp watch to automatically compile TypeScript files
Set up gulp watch to automatically compile TypeScript files
JavaScript
apache-2.0
munumafia/EasyJSON,munumafia/EasyJSON
--- +++ @@ -1,11 +1,20 @@ "use strict" -let gulp = require('gulp'); -let ts = require('gulp-typescript'); +let gulp = require("gulp"); +let sourcemaps = require("gulp-sourcemaps"); +let ts = require("gulp-typescript"); let tsProject = ts.createProject("tsconfig.json"); gulp.task("default", () => { - return tsProject.src() - .pipe(tsProject()) - .js.pipe(gulp.dest("dist")); + let tsResult = tsProject.src() + .pipe(sourcemaps.init()) + .pipe(tsProject()); + + return tsResult.js + .pipe(sourcemaps.write()) + .pipe(gulp.dest("dist")) }); + +gulp.task("watch", ["default"], () => { + gulp.watch("*.ts", ["default"]); +});
33ba0535b53c580d91b6b2de3d8b919ae3d5c781
helpers/sharedb-server.js
helpers/sharedb-server.js
var ShareDB = require('sharedb'); ShareDB.types.register(require('rich-text').type); module.exports = new ShareDB({ db: require('sharedb-mongo')('mongodb://localhost:27017/quill-sharedb-cursors') });
var ShareDB = require('sharedb'); ShareDB.types.register(require('rich-text').type); module.exports = new ShareDB({ db: require('sharedb-mongo')(process.env.MONGODB_URI || 'mongodb://localhost/quill-sharedb-cursors?auto_reconnect=true') });
Add MONGODB_URI env var config
Add MONGODB_URI env var config
JavaScript
mit
pedrosanta/quill-sharedb-cursors,pedrosanta/quill-sharedb-cursors
--- +++ @@ -3,5 +3,5 @@ ShareDB.types.register(require('rich-text').type); module.exports = new ShareDB({ - db: require('sharedb-mongo')('mongodb://localhost:27017/quill-sharedb-cursors') + db: require('sharedb-mongo')(process.env.MONGODB_URI || 'mongodb://localhost/quill-sharedb-cursors?auto_reconnect=true') });
d485edf1145ccfba4e8668c13dfd5ed2170624da
lib/AdapterJsRTCObjectFactory.js
lib/AdapterJsRTCObjectFactory.js
'use strict'; /** * An RTC Object factory that works in Firefox and Chrome when adapter.js is present */ function AdapterJsRTCObjectFactory() { this.createIceServer = function(url, username, password) { return createIceServer(url, username, password); }; this.createRTCSessionDescription = function (sessionDescriptionString) { return new RTCSessionDescription(sessionDescriptionString); }; this.createRTCIceCandidate = function (rtcIceCandidateString) { return new RTCIceCandidate(rtcIceCandidateString); }; this.createRTCPeerConnection = function(config) { return new RTCPeerConnection(config); }; } module.exports = AdapterJsRTCObjectFactory;
'use strict'; var Utils = require("cyclon.p2p-common"); /** * An RTC Object factory that works in Firefox and Chrome when adapter.js is present */ function AdapterJsRTCObjectFactory(logger) { Utils.checkArguments(arguments, 1); this.createIceServer = function (url, username, password) { if (typeof(createIceServer) !== "undefined") { return createIceServer(url, username, password); } else { logger.error("adapter.js not present or unsupported browser!"); return null; } }; this.createRTCSessionDescription = function (sessionDescriptionString) { if (typeof(RTCSessionDescription) !== "undefined") { return new RTCSessionDescription(sessionDescriptionString); } else { logger.error("adapter.js not present or unsupported browser!"); return null; } }; this.createRTCIceCandidate = function (rtcIceCandidateString) { if (typeof(RTCIceCandidate) !== "undefined") { return new RTCIceCandidate(rtcIceCandidateString); } else { logger.error("adapter.js not present or unsupported browser!"); return null; } }; this.createRTCPeerConnection = function (config) { if (typeof(RTCPeerConnection) !== "undefined") { return new RTCPeerConnection(config); } else { logger.error("adapter.js not present or unsupported browser!"); return null; } }; } module.exports = AdapterJsRTCObjectFactory;
Handle missing adapter.js more gracefully
Handle missing adapter.js more gracefully
JavaScript
mit
nicktindall/cyclon.p2p-rtc-client,nicktindall/cyclon.p2p-rtc-client
--- +++ @@ -1,24 +1,52 @@ 'use strict'; +var Utils = require("cyclon.p2p-common"); + /** - * An RTC Object factory that works in Firefox and Chrome when adapter.js is present + * An RTC Object factory that works in Firefox and Chrome when adapter.js is present */ -function AdapterJsRTCObjectFactory() { +function AdapterJsRTCObjectFactory(logger) { - this.createIceServer = function(url, username, password) { - return createIceServer(url, username, password); - }; + Utils.checkArguments(arguments, 1); + + this.createIceServer = function (url, username, password) { + if (typeof(createIceServer) !== "undefined") { + return createIceServer(url, username, password); + } + else { + logger.error("adapter.js not present or unsupported browser!"); + return null; + } + }; this.createRTCSessionDescription = function (sessionDescriptionString) { - return new RTCSessionDescription(sessionDescriptionString); + if (typeof(RTCSessionDescription) !== "undefined") { + return new RTCSessionDescription(sessionDescriptionString); + } + else { + logger.error("adapter.js not present or unsupported browser!"); + return null; + } }; this.createRTCIceCandidate = function (rtcIceCandidateString) { - return new RTCIceCandidate(rtcIceCandidateString); + if (typeof(RTCIceCandidate) !== "undefined") { + return new RTCIceCandidate(rtcIceCandidateString); + } + else { + logger.error("adapter.js not present or unsupported browser!"); + return null; + } }; - this.createRTCPeerConnection = function(config) { - return new RTCPeerConnection(config); + this.createRTCPeerConnection = function (config) { + if (typeof(RTCPeerConnection) !== "undefined") { + return new RTCPeerConnection(config); + } + else { + logger.error("adapter.js not present or unsupported browser!"); + return null; + } }; }
900b593d7c66248086892b9cedfa24563fb8e270
gulpfile.js
gulpfile.js
const inlineNg2Template = require('gulp-inline-ng2-template'); const gulp = require('gulp'); const clean = require('gulp-clean'); const tmpDir = './tmp'; const distDir = './dist'; gulp.task('inline-templates', ['clean-tmp'], function () { return gulp.src('./src/**/*.ts') .pipe(inlineNg2Template({ base: '/src', target: 'es6', useRelativePaths: true })) .pipe(gulp.dest(tmpDir)); }); gulp.task('clean-tmp', function () { return gulp.src(tmpDir, { read: false }) .pipe(clean()); }); gulp.task('clean-dist', function () { return gulp.src(distDir, { read: false }) .pipe(clean()); }); gulp.task('copy-package-json', function () { return gulp.src('package.json') .pipe(gulp.dest(distDir)); }); gulp.task('copy-misc-files', function () { return gulp.src(['README.MD', 'LICENSE']) .pipe(gulp.dest(distDir)); }); gulp.task('copy-all', ['copy-package-json', 'copy-misc-files']);
const inlineNg2Template = require('gulp-inline-ng2-template'); const gulp = require('gulp'); const clean = require('gulp-clean'); const tmpDir = './tmp'; const distDir = './dist'; gulp.task('inline-templates', ['clean-tmp'], function () { return gulp.src('./src/**/*.ts') .pipe(inlineNg2Template({ base: '/src', target: 'es6', useRelativePaths: true })) .pipe(gulp.dest(tmpDir)); }); gulp.task('clean-tmp', function () { return gulp.src(tmpDir, { read: false }) .pipe(clean()); }); gulp.task('clean-dist', function () { return gulp.src(distDir, { read: false }) .pipe(clean()); }); gulp.task('copy-package-json', function () { return gulp.src('package.json') .pipe(gulp.dest(distDir)); }); gulp.task('copy-misc-files', function () { return gulp.src(['README.MD', 'LICENSE', 'CHANGELOG.MD']) .pipe(gulp.dest(distDir)); }); gulp.task('copy-all', ['copy-package-json', 'copy-misc-files']);
Add CHANGELOG.MD to copy-misc-files task
Add CHANGELOG.MD to copy-misc-files task
JavaScript
mit
mpalourdio/ng-http-loader,mpalourdio/ng-http-loader,mpalourdio/ng-http-loader
--- +++ @@ -31,7 +31,7 @@ }); gulp.task('copy-misc-files', function () { - return gulp.src(['README.MD', 'LICENSE']) + return gulp.src(['README.MD', 'LICENSE', 'CHANGELOG.MD']) .pipe(gulp.dest(distDir)); });
64b03b3b7209ea61c03f35616b399c755c933541
sysapps/device_capabilities_new/device_capabilities_api.js
sysapps/device_capabilities_new/device_capabilities_api.js
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Implementation of the W3C's Device Capabilities API. // http://www.w3.org/2012/sysapps/device-capabilities/ var internal = requireNative('internal'); internal.setupInternalExtension(extension); var v8tools = requireNative('v8tools'); var common = requireNative('sysapps_common'); common.setupSysAppsCommon(internal, v8tools); var Promise = requireNative('sysapps_promise').Promise; var DeviceCapabilities = function() { common.BindingObject.call(this, common.getUniqueId()); internal.postMessage("deviceCapabilitiesConstructor", [this._id]); this._addMethodWithPromise("getAVCodecs", Promise); this._addMethodWithPromise("getCPUInfo", Promise); this._addMethodWithPromise("getMemoryInfo", Promise); this._addMethodWithPromise("getStorageInfo", Promise); }; DeviceCapabilities.prototype = new common.BindingObjectPrototype(); DeviceCapabilities.prototype.constructor = DeviceCapabilities; exports = new DeviceCapabilities();
// Copyright (c) 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Implementation of the W3C's Device Capabilities API. // http://www.w3.org/2012/sysapps/device-capabilities/ var internal = requireNative('internal'); internal.setupInternalExtension(extension); var v8tools = requireNative('v8tools'); var common = requireNative('sysapps_common'); common.setupSysAppsCommon(internal, v8tools); var Promise = requireNative('sysapps_promise').Promise; var DeviceCapabilities = function() { common.BindingObject.call(this, common.getUniqueId()); common.EventTarget.call(this); internal.postMessage("deviceCapabilitiesConstructor", [this._id]); this._addEvent("storageattach"); this._addEvent("storagedetach"); this._addMethodWithPromise("getAVCodecs", Promise); this._addMethodWithPromise("getCPUInfo", Promise); this._addMethodWithPromise("getMemoryInfo", Promise); this._addMethodWithPromise("getStorageInfo", Promise); }; DeviceCapabilities.prototype = new common.EventTargetPrototype(); DeviceCapabilities.prototype.constructor = DeviceCapabilities; exports = new DeviceCapabilities();
Make the JavaScript shim dispatch events
[SysApps] Make the JavaScript shim dispatch events The first thing to be done is make the JavaScript DeviceCapabilties an EventTarget (which is also a BindingObject). The BindingObjects are JavaScripts objects with a link with some native object and they use a unique ID for routing messages between them. common.EventTarget.call(this) initializes the EventTarget and makes this._addEvent() possible. Now all the blanks are filled and we are good to go. The next step would be replace the StorageInfoProviderMock with a real implementation for each platform we support. No need to touch on anything else.
JavaScript
bsd-3-clause
tomatell/crosswalk,rakuco/crosswalk,weiyirong/crosswalk-1,amaniak/crosswalk,crosswalk-project/crosswalk,fujunwei/crosswalk,chinakids/crosswalk,siovene/crosswalk,rakuco/crosswalk,hgl888/crosswalk-efl,Pluto-tv/crosswalk,rakuco/crosswalk,leonhsl/crosswalk,RafuCater/crosswalk,crosswalk-project/crosswalk-efl,pk-sam/crosswalk,siovene/crosswalk,zliang7/crosswalk,huningxin/crosswalk,jondong/crosswalk,pk-sam/crosswalk,darktears/crosswalk,dreamsxin/crosswalk,pk-sam/crosswalk,weiyirong/crosswalk-1,hgl888/crosswalk,amaniak/crosswalk,weiyirong/crosswalk-1,baleboy/crosswalk,myroot/crosswalk,fujunwei/crosswalk,xzhan96/crosswalk,rakuco/crosswalk,xzhan96/crosswalk,xzhan96/crosswalk,stonegithubs/crosswalk,mrunalk/crosswalk,bestwpw/crosswalk,Bysmyyr/crosswalk,tomatell/crosswalk,jpike88/crosswalk,axinging/crosswalk,PeterWangIntel/crosswalk,minggangw/crosswalk,ZhengXinCN/crosswalk,myroot/crosswalk,darktears/crosswalk,tedshroyer/crosswalk,shaochangbin/crosswalk,heke123/crosswalk,bestwpw/crosswalk,jondwillis/crosswalk,mrunalk/crosswalk,tedshroyer/crosswalk,chuan9/crosswalk,crosswalk-project/crosswalk-efl,hgl888/crosswalk,TheDirtyCalvinist/spacewalk,crosswalk-project/crosswalk,zliang7/crosswalk,zliang7/crosswalk,hgl888/crosswalk-efl,XiaosongWei/crosswalk,DonnaWuDongxia/crosswalk,chinakids/crosswalk,axinging/crosswalk,myroot/crosswalk,ZhengXinCN/crosswalk,jpike88/crosswalk,jondwillis/crosswalk,minggangw/crosswalk,Bysmyyr/crosswalk,huningxin/crosswalk,chuan9/crosswalk,qjia7/crosswalk,jondwillis/crosswalk,baleboy/crosswalk,axinging/crosswalk,amaniak/crosswalk,darktears/crosswalk,XiaosongWei/crosswalk,alex-zhang/crosswalk,qjia7/crosswalk,Bysmyyr/crosswalk,weiyirong/crosswalk-1,hgl888/crosswalk-efl,qjia7/crosswalk,TheDirtyCalvinist/spacewalk,baleboy/crosswalk,hgl888/crosswalk-efl,jpike88/crosswalk,XiaosongWei/crosswalk,tedshroyer/crosswalk,XiaosongWei/crosswalk,alex-zhang/crosswalk,crosswalk-project/crosswalk,minggangw/crosswalk,shaochangbin/crosswalk,jondong/crosswalk,darktears/crosswalk,minggangw/crosswalk,crosswalk-project/crosswalk,chinakids/crosswalk,darktears/crosswalk,hgl888/crosswalk-efl,weiyirong/crosswalk-1,alex-zhang/crosswalk,marcuspridham/crosswalk,marcuspridham/crosswalk,alex-zhang/crosswalk,zeropool/crosswalk,RafuCater/crosswalk,stonegithubs/crosswalk,dreamsxin/crosswalk,alex-zhang/crosswalk,crosswalk-project/crosswalk-efl,xzhan96/crosswalk,PeterWangIntel/crosswalk,TheDirtyCalvinist/spacewalk,PeterWangIntel/crosswalk,tomatell/crosswalk,PeterWangIntel/crosswalk,zliang7/crosswalk,crosswalk-project/crosswalk-efl,Bysmyyr/crosswalk,PeterWangIntel/crosswalk,DonnaWuDongxia/crosswalk,chinakids/crosswalk,PeterWangIntel/crosswalk,RafuCater/crosswalk,tedshroyer/crosswalk,minggangw/crosswalk,crosswalk-project/crosswalk,tomatell/crosswalk,chinakids/crosswalk,tedshroyer/crosswalk,marcuspridham/crosswalk,amaniak/crosswalk,tedshroyer/crosswalk,axinging/crosswalk,bestwpw/crosswalk,tomatell/crosswalk,siovene/crosswalk,DonnaWuDongxia/crosswalk,bestwpw/crosswalk,rakuco/crosswalk,jondong/crosswalk,bestwpw/crosswalk,marcuspridham/crosswalk,myroot/crosswalk,zliang7/crosswalk,amaniak/crosswalk,siovene/crosswalk,xzhan96/crosswalk,amaniak/crosswalk,marcuspridham/crosswalk,alex-zhang/crosswalk,hgl888/crosswalk-efl,Bysmyyr/crosswalk,jondwillis/crosswalk,leonhsl/crosswalk,Pluto-tv/crosswalk,bestwpw/crosswalk,jondong/crosswalk,stonegithubs/crosswalk,jpike88/crosswalk,zeropool/crosswalk,hgl888/crosswalk,tomatell/crosswalk,jondong/crosswalk,lincsoon/crosswalk,darktears/crosswalk,DonnaWuDongxia/crosswalk,hgl888/crosswalk,zliang7/crosswalk,dreamsxin/crosswalk,marcuspridham/crosswalk,jondwillis/crosswalk,zliang7/crosswalk,TheDirtyCalvinist/spacewalk,chuan9/crosswalk,leonhsl/crosswalk,dreamsxin/crosswalk,baleboy/crosswalk,XiaosongWei/crosswalk,zeropool/crosswalk,zeropool/crosswalk,tedshroyer/crosswalk,xzhan96/crosswalk,siovene/crosswalk,minggangw/crosswalk,dreamsxin/crosswalk,rakuco/crosswalk,fujunwei/crosswalk,mrunalk/crosswalk,marcuspridham/crosswalk,fujunwei/crosswalk,heke123/crosswalk,fujunwei/crosswalk,heke123/crosswalk,jpike88/crosswalk,myroot/crosswalk,jpike88/crosswalk,rakuco/crosswalk,qjia7/crosswalk,minggangw/crosswalk,crosswalk-project/crosswalk-efl,ZhengXinCN/crosswalk,fujunwei/crosswalk,crosswalk-project/crosswalk,pk-sam/crosswalk,Bysmyyr/crosswalk,stonegithubs/crosswalk,mrunalk/crosswalk,jpike88/crosswalk,ZhengXinCN/crosswalk,Pluto-tv/crosswalk,heke123/crosswalk,baleboy/crosswalk,hgl888/crosswalk,hgl888/crosswalk,bestwpw/crosswalk,PeterWangIntel/crosswalk,leonhsl/crosswalk,darktears/crosswalk,lincsoon/crosswalk,marcuspridham/crosswalk,zeropool/crosswalk,zeropool/crosswalk,stonegithubs/crosswalk,pk-sam/crosswalk,mrunalk/crosswalk,fujunwei/crosswalk,jondong/crosswalk,heke123/crosswalk,qjia7/crosswalk,huningxin/crosswalk,xzhan96/crosswalk,XiaosongWei/crosswalk,huningxin/crosswalk,pk-sam/crosswalk,leonhsl/crosswalk,lincsoon/crosswalk,Pluto-tv/crosswalk,baleboy/crosswalk,Pluto-tv/crosswalk,baleboy/crosswalk,leonhsl/crosswalk,hgl888/crosswalk,ZhengXinCN/crosswalk,heke123/crosswalk,siovene/crosswalk,hgl888/crosswalk,DonnaWuDongxia/crosswalk,stonegithubs/crosswalk,chuan9/crosswalk,huningxin/crosswalk,shaochangbin/crosswalk,DonnaWuDongxia/crosswalk,Pluto-tv/crosswalk,dreamsxin/crosswalk,xzhan96/crosswalk,crosswalk-project/crosswalk-efl,dreamsxin/crosswalk,shaochangbin/crosswalk,crosswalk-project/crosswalk,crosswalk-project/crosswalk,Bysmyyr/crosswalk,alex-zhang/crosswalk,heke123/crosswalk,ZhengXinCN/crosswalk,jondwillis/crosswalk,RafuCater/crosswalk,baleboy/crosswalk,tomatell/crosswalk,axinging/crosswalk,myroot/crosswalk,leonhsl/crosswalk,weiyirong/crosswalk-1,axinging/crosswalk,TheDirtyCalvinist/spacewalk,zliang7/crosswalk,minggangw/crosswalk,stonegithubs/crosswalk,lincsoon/crosswalk,Bysmyyr/crosswalk,weiyirong/crosswalk-1,lincsoon/crosswalk,heke123/crosswalk,RafuCater/crosswalk,DonnaWuDongxia/crosswalk,shaochangbin/crosswalk,chuan9/crosswalk,Pluto-tv/crosswalk,XiaosongWei/crosswalk,amaniak/crosswalk,huningxin/crosswalk,rakuco/crosswalk,jondong/crosswalk,axinging/crosswalk,jondong/crosswalk,shaochangbin/crosswalk,mrunalk/crosswalk,lincsoon/crosswalk,RafuCater/crosswalk,hgl888/crosswalk-efl,lincsoon/crosswalk,lincsoon/crosswalk,crosswalk-project/crosswalk-efl,pk-sam/crosswalk,chuan9/crosswalk,siovene/crosswalk,zeropool/crosswalk,chinakids/crosswalk,darktears/crosswalk,jondwillis/crosswalk,TheDirtyCalvinist/spacewalk,qjia7/crosswalk,chuan9/crosswalk,ZhengXinCN/crosswalk,RafuCater/crosswalk
--- +++ @@ -16,8 +16,12 @@ var DeviceCapabilities = function() { common.BindingObject.call(this, common.getUniqueId()); + common.EventTarget.call(this); internal.postMessage("deviceCapabilitiesConstructor", [this._id]); + + this._addEvent("storageattach"); + this._addEvent("storagedetach"); this._addMethodWithPromise("getAVCodecs", Promise); this._addMethodWithPromise("getCPUInfo", Promise); @@ -25,7 +29,7 @@ this._addMethodWithPromise("getStorageInfo", Promise); }; -DeviceCapabilities.prototype = new common.BindingObjectPrototype(); +DeviceCapabilities.prototype = new common.EventTargetPrototype(); DeviceCapabilities.prototype.constructor = DeviceCapabilities; exports = new DeviceCapabilities();
8c42ee718563fd7c82bacba65baf65cb12dd09fc
js/browser/resizeManager.js
js/browser/resizeManager.js
jsio('import browser.events') var logger = logging.getLogger(jsio.__path); var windowResizeCallbacks = []; function handleResize() { if (!windowResizeCallbacks.length) { return; } var size = exports.getWindowSize(); for (var i=0, callback; callback = windowResizeCallbacks[i]; i++) { callback(size); } } browser.events.add(window, 'resize', handleResize); exports = { onWindowResize: function(callback) { callback(exports.getWindowSize()); windowResizeCallbacks.push(callback); }, cancelWindowResize: function(targetCallback) { for (var i=0, callback; callback = windowResizeCallbacks[i]; i++) { if (callback == targetCallback) { continue; } windowResizeCallbacks.splice(i, 1); return; } }, getWindowSize: function() { return { width: window.innerWidth, height: window.innerHeight }; }, fireResize: handleResize }
jsio('import browser.events') var logger = logging.getLogger(jsio.__path); var windowResizeCallbacks = []; function handleResize() { if (!windowResizeCallbacks.length) { return; } var size = exports.getWindowSize(); for (var i=0, callback; callback = windowResizeCallbacks[i]; i++) { callback(size); } } browser.events.add(window, 'resize', handleResize); exports = { onWindowResize: function(callback) { callback(exports.getWindowSize()); windowResizeCallbacks.push(callback); }, cancelWindowResize: function(targetCallback) { for (var i=0, callback; callback = windowResizeCallbacks[i]; i++) { if (callback != targetCallback) { continue; } windowResizeCallbacks.splice(i, 1); return; } }, getWindowSize: function() { return { width: window.innerWidth, height: window.innerHeight }; }, fireResize: handleResize }
Fix bug where cancelWindowResize, would remove the wrong callback
Fix bug where cancelWindowResize, would remove the wrong callback
JavaScript
mit
marcuswestin/fin
--- +++ @@ -22,7 +22,7 @@ cancelWindowResize: function(targetCallback) { for (var i=0, callback; callback = windowResizeCallbacks[i]; i++) { - if (callback == targetCallback) { continue; } + if (callback != targetCallback) { continue; } windowResizeCallbacks.splice(i, 1); return; }
3799c780d5b9ca0cfd97f3795c1ce456b78d4261
gesso/index.js
gesso/index.js
// Re-using Gesso entry point // Detect whether this is called from a built bundle from the browser, or as the build project. if (typeof window !== 'undefined') { // Client-side require module.exports = { canvas: document.getElementById('gesso-target') }; } else { // Server-side require -- use module.require so the build doesn't detect this var command = module.require('./command'); module.exports = { globalMain: command.globalMain, packagelessMain: command.packagelessMain, main: command.main }; }
// Re-using Gesso entry point // Detect whether this is called from a built bundle from the browser, or as the build project. /* globals window */ if (typeof window !== 'undefined') { // Client-side require module.exports = { canvas: window.document.getElementById('gesso-target') }; } else { // Server-side require -- use module.require so the build doesn't detect this var command = module.require('./command'); module.exports = { globalMain: command.globalMain, packagelessMain: command.packagelessMain, main: command.main }; }
Use window.document for client-side require.
Use window.document for client-side require.
JavaScript
mit
gessojs/gessojs,gessojs/gessojs
--- +++ @@ -1,11 +1,12 @@ // Re-using Gesso entry point // Detect whether this is called from a built bundle from the browser, or as the build project. +/* globals window */ if (typeof window !== 'undefined') { // Client-side require module.exports = { - canvas: document.getElementById('gesso-target') + canvas: window.document.getElementById('gesso-target') }; } else { // Server-side require -- use module.require so the build doesn't detect this
150741269e8cc655ad7041faa1cf825fbf5a4515
WebComponentsMonkeyPatch.js
WebComponentsMonkeyPatch.js
/** * Evidently superinspired by Chris Wilson's AudioContext-MonkeyPatch library, * and just patching webkitCreateShadowRoot to createShadowRoot */ (function() { if( HTMLElement.prototype.webkitCreateShadowRoot !== undefined && HTMLElement.prototype.createShadowRoot === undefined ) { HTMLElement.prototype.createShadowRoot = HTMLElement.prototype.webkitCreateShadowRoot; } })(); (function() { if('register' in document || 'registerElement' in document){ document.register = document.registerElement = document.register || document.register; } })();
/** * Evidently superinspired by Chris Wilson's AudioContext-MonkeyPatch library, */ (function() { // Unprefixed createShadowRoot if( HTMLElement.prototype.webkitCreateShadowRoot !== undefined && HTMLElement.prototype.createShadowRoot === undefined ) { HTMLElement.prototype.createShadowRoot = HTMLElement.prototype.webkitCreateShadowRoot; } // Alias document.register to document.registerElement if('register' in document || 'registerElement' in document){ document.register = document.registerElement = document.register || document.register; } })();
Use only one function call
Use only one function call
JavaScript
apache-2.0
sole/WebComponentsMonkeyPatch
--- +++ @@ -1,20 +1,20 @@ /** * Evidently superinspired by Chris Wilson's AudioContext-MonkeyPatch library, - * and just patching webkitCreateShadowRoot to createShadowRoot */ (function() { - if( HTMLElement.prototype.webkitCreateShadowRoot !== undefined && - HTMLElement.prototype.createShadowRoot === undefined ) { + // Unprefixed createShadowRoot + if( HTMLElement.prototype.webkitCreateShadowRoot !== undefined && + HTMLElement.prototype.createShadowRoot === undefined ) { HTMLElement.prototype.createShadowRoot = HTMLElement.prototype.webkitCreateShadowRoot; } + // Alias document.register to document.registerElement + if('register' in document || 'registerElement' in document){ + document.register = document.registerElement = document.register || document.register; + } + })(); -(function() { - if('register' in document || 'registerElement' in document){ - document.register = document.registerElement = document.register || document.register; - } -})();
5cda8ad7e27dbbafc2ab2c7d6569fec6546db2ce
colorImageSelector.js
colorImageSelector.js
/* for each li color = find span color --- this.text url = find main prod image -- this.url category Swatch Color Button = matching color.url end on click */ var colorBtnSrc = {}; $("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').each( function getColorPhotosSrcs(){ var listings = $(this); prodColor = $(this).find('.name').text(); console.log(prodColor); $(this).find('label').click(); // find url of img when this li is checked and store it // for (i = 0; i < listings.length; i++) { // var colorImgSrc += $(document).find('.MagicZoomPlus img').attr('src'); // console.log(colorImgSrc); // } colorBtnSrc[prodColor] = $(document).find('.MagicZoomPlus img').attr('src'); }) console.log(colorBtnSrc); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').removeClass('selectedValue').find('.radio span').removeClass('checked'); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').eq(2).addClass('selectedValue').find('.radio span').addClass('checked'); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').eq(2).find('label').click();
/* for each li color = find span color --- this.text url = find main prod image -- this.url category Swatch Color Button = matching color.url end on click */ var colorBtnSrc = {}; $("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').each( function getColorPhotosSrcs(){ var listings = $(this); prodColor = $(this).find('.name').text(); console.log(prodColor); $(this).find('label').click(); // find url of img when this li is checked and store it // for (i = 0; i < listings.length; i++) { // var colorImgSrc += $(document).find('.MagicZoomPlus img').attr('src'); // console.log(colorImgSrc); // } colorBtnSrc[prodColor] = $(document).find('.MagicZoomPlus').attr('src'); }) console.log(colorBtnSrc); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').removeClass('selectedValue').find('.radio span').removeClass('checked'); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').eq(2).addClass('selectedValue').find('.radio span').addClass('checked'); //$("span:contains('Color')").parents().eq(2).find('.productAttributeValue li').eq(2).find('label').click();
Update to image src selector
Update to image src selector
JavaScript
mit
iamandrebulatov/BC-Category-Page-Color-Swatch
--- +++ @@ -23,7 +23,7 @@ // console.log(colorImgSrc); // } - colorBtnSrc[prodColor] = $(document).find('.MagicZoomPlus img').attr('src'); + colorBtnSrc[prodColor] = $(document).find('.MagicZoomPlus').attr('src'); })
a145c78423cab08cfb412f6d7c61ef87cef2199c
src/config/constants.js
src/config/constants.js
import firebase from 'firebase' const config = { apiKey: "AIzaSyDHL6JFTyBcaV60WpE4yXfeO0aZbzA9Xbk", authDomain: "practice-auth.firebaseapp.com", databaseURL: "https://practice-auth.firebaseio.com", } firebase.initializeApp(config) export const ref = firebase.database().ref() export const firebaseAuth = firebase.auth
import firebase from 'firebase'; const config = { apiKey: process.env.REACT_APP_FIREBASE_API, authDomain: process.env.REACT_APP_FIREBASE_DOMAIN, databaseURL: process.env.REACT_APP_FIREBASE_DATABASE, storageBucket: process.env.REACT_APP_FIREBASE_BUCKET, messagingSenderId: process.env.REACT_APP_FIREBASE_SENDER, }; firebase.initializeApp(config); export const ref = firebase.database().ref(); export const firebaseAuth = firebase.auth;
Read firebase creds from .env
Read firebase creds from .env
JavaScript
mit
nadavspi/UnwiseConnect,nadavspi/UnwiseConnect,nadavspi/UnwiseConnect
--- +++ @@ -1,12 +1,14 @@ -import firebase from 'firebase' +import firebase from 'firebase'; const config = { - apiKey: "AIzaSyDHL6JFTyBcaV60WpE4yXfeO0aZbzA9Xbk", - authDomain: "practice-auth.firebaseapp.com", - databaseURL: "https://practice-auth.firebaseio.com", -} + apiKey: process.env.REACT_APP_FIREBASE_API, + authDomain: process.env.REACT_APP_FIREBASE_DOMAIN, + databaseURL: process.env.REACT_APP_FIREBASE_DATABASE, + storageBucket: process.env.REACT_APP_FIREBASE_BUCKET, + messagingSenderId: process.env.REACT_APP_FIREBASE_SENDER, +}; -firebase.initializeApp(config) +firebase.initializeApp(config); -export const ref = firebase.database().ref() -export const firebaseAuth = firebase.auth +export const ref = firebase.database().ref(); +export const firebaseAuth = firebase.auth;
f6b8055acfc4127580725989fa0db32ece35f566
src/activities/when-graphs-mislead/client/scripts/parameters.js
src/activities/when-graphs-mislead/client/scripts/parameters.js
/** * @file Define the parameters for the activity's chart. */ define({ yLimitsUSD: { label: 'y-axis limits ($USD)', min: 0, max: 280000, step: 1000 }, yLimitsPct: { label: 'y-axis limits (% change)', min: 0, max: 1.2, step: 0.01 }, xLimits: { label: 'x-axis limits (year)', min: 1960, max: 2013, step: 1 }, yUnit: { label: 'y-axis unit', dflt: 'USD', values: { Pct: '% change in USD', USD: 'Real GDP per capita ($USD)' } } });
/** * @file Define the parameters for the activity's chart. */ define({ yLimitsUSD: { label: 'y-axis limits ($USD)', min: 0, max: 280000, step: 1000 }, yLimitsPct: { label: 'y-axis limits (% change)', min: 0, max: 1.3, step: 0.01 }, xLimits: { label: 'x-axis limits (year)', min: 1960, max: 2013, step: 1 }, yUnit: { label: 'y-axis unit', dflt: 'USD', values: { Pct: '% change in USD', USD: 'Real GDP per capita ($USD)' } } });
Increase limits for percentage change
Increase limits for percentage change
JavaScript
mpl-2.0
councilforeconed/interactive-activities,councilforeconed/interactive-activities,jugglinmike/cee,councilforeconed/interactive-activities,jugglinmike/cee
--- +++ @@ -11,7 +11,7 @@ yLimitsPct: { label: 'y-axis limits (% change)', min: 0, - max: 1.2, + max: 1.3, step: 0.01 }, xLimits: {
d33e9df3e82505d60c16324fb1a5fec6204bb5bb
gulpfile.js
gulpfile.js
var _ = require('lodash'); var gulp = require('gulp'); var gulp_mocha = require('gulp-mocha'); var gulp_jshint = require('gulp-jshint'); var gulp_jsdoc = require("gulp-jsdoc"); var files = ['lib/**/*.js']; var tests = ['test/**/*.spec.js']; var alljs = files.concat(tests); var readme = 'README.md'; function ignoreError(err) { this.emit('end'); } gulp.task('test', function() { return gulp.src(tests).pipe(new gulp_mocha({reporter: 'spec'})).on('error', ignoreError); }); gulp.task('watch:test', function() { // TODO: Only run tests that are linked to file changes by doing // something smart like reading through the require statements return gulp.watch(alljs, ['test']); }); gulp.task('jsdoc', function() { return gulp.src(files.concat([readme])) .pipe(gulp_jsdoc.parser()) .pipe(gulp_jsdoc.generator('./docs', { path: 'ink-docstrap', theme: 'flatly', })) }); gulp.task('lint', function() { return gulp.src(alljs) .pipe(gulp_jshint()) .pipe(gulp_jshint.reporter('default')); }); gulp.task('default', ['lint', 'jsdoc', 'test']);
var _ = require('lodash'); var gulp = require('gulp'); var gulp_mocha = require('gulp-mocha'); var gulp_jshint = require('gulp-jshint'); var gulp_jsdoc = require("gulp-jsdoc"); var files = ['lib/**/*.js']; var tests = ['test/**/*.spec.js']; var alljs = files.concat(tests); var readme = 'README.md'; function ignoreError(err) { this.emit('end'); } function testAllFiles() { return gulp.src(tests).pipe(new gulp_mocha({reporter: 'spec'})); } gulp.task('test', testAllFiles); gulp.task('test-nofail', function() { return testAllFiles().on('error', ignoreError); }); gulp.task('watch:test', function() { // TODO: Only run tests that are linked to file changes by doing // something smart like reading through the require statements return gulp.watch(alljs, ['test-nofail']); }); gulp.task('jsdoc', function() { return gulp.src(files.concat([readme])) .pipe(gulp_jsdoc.parser()) .pipe(gulp_jsdoc.generator('./docs', { path: 'ink-docstrap', theme: 'flatly', })) }); gulp.task('lint', function() { return gulp.src(alljs) .pipe(gulp_jshint()) .pipe(gulp_jshint.reporter('default')); }); gulp.task('default', ['lint', 'jsdoc', 'test']);
Make test fails for CI
Make test fails for CI
JavaScript
mit
bankonme/bitcore-channel,homeopatchy/bitcore-channel,eXcomm/bitcore-channel,braydonf/bitcore-channel,maraoz/bitcore-channel,bitpay/bitcore-channel,studio666/bitcore-channel
--- +++ @@ -15,14 +15,20 @@ this.emit('end'); } -gulp.task('test', function() { - return gulp.src(tests).pipe(new gulp_mocha({reporter: 'spec'})).on('error', ignoreError); +function testAllFiles() { + return gulp.src(tests).pipe(new gulp_mocha({reporter: 'spec'})); +} + +gulp.task('test', testAllFiles); + +gulp.task('test-nofail', function() { + return testAllFiles().on('error', ignoreError); }); gulp.task('watch:test', function() { // TODO: Only run tests that are linked to file changes by doing // something smart like reading through the require statements - return gulp.watch(alljs, ['test']); + return gulp.watch(alljs, ['test-nofail']); }); gulp.task('jsdoc', function() { @@ -35,7 +41,7 @@ }); gulp.task('lint', function() { - return gulp.src(alljs) + return gulp.src(alljs) .pipe(gulp_jshint()) .pipe(gulp_jshint.reporter('default')); });
9afda10bfeb4d07e3ba2e40e93ebec125d41d7ed
tests/search.js
tests/search.js
/** * search.js - Search form tests. */ casper.test.begin('Tests search form submission and results', 2, function suite(test) { casper.start(); // Open the homepage. casper.customThenOpen('/', function() { casper.waitFor(function check() { // Fill out the search form with 'health' and submit it. return this.evaluate(function() { jQuery('#site_search_text').val('health'); jQuery('#site_search_text').trigger('input'); return jQuery('div#site-search input[type="submit"]').trigger('click'); }); }, function then() { // Check current URL and search results. test.assertUrlMatch(/search\/health/, 'Current path is search/health'); test.assertExists('div.view-search-pane div.view-content div.views-row', 'Search results are listed under "Stories".'); }, function timeout() { this.echo("Search form has not been submitted.").exit(); }); }); casper.run(function() { test.done(); }); });
/** * Search form tests. */ casper.test.begin('Tests search form submission and results', 2, function suite(test) { casper.start(); // Open the homepage. casper.customThenOpen('/', function() { casper.waitFor(function check() { // Fill out the search form with 'health' and submit it. return this.evaluate(function() { jQuery('#site_search_text').val('health'); jQuery('#site_search_text').trigger('input'); return jQuery('div#site-search input[type="submit"]').trigger('click'); }); }, function then() { // Check current URL and search results. test.assertUrlMatch(/search\/health/, 'Current path is search/health'); test.assertExists('div.view-search-pane div.view-content div.views-row', 'Search results are listed under "Stories".'); }, function timeout() { this.echo("Search form has not been submitted.").exit(); }); }); casper.run(function() { test.done(); }); });
Remove unneded filename from header docblock.
Remove unneded filename from header docblock.
JavaScript
mit
Lullabot/casperjs_foundation,Lullabot/casperjs_foundation
--- +++ @@ -1,5 +1,5 @@ /** - * search.js - Search form tests. + * Search form tests. */ casper.test.begin('Tests search form submission and results', 2, function suite(test) {
801df6499b96c860a2d108dea053304131ab56fd
server/app.js
server/app.js
'use strict'; /** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var memos = require('./routes/memos'); var http = require('http'); var path = require('path'); var app = express(); // all environments app.set('port', process.env.PORT || 8000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); // app.use(express.logger('dev')); app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' === app.get('env')) { app.use(express.errorHandler()); } app.get('/', routes.index); app.get('/memos/*', memos.list); app.get('/memos', memos.list); app.get('/files/*', memos.get); var server = http.createServer(app); server.listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); }); var io = require('socket.io').listen(server, {'log level': 0}); memos.start(io);
'use strict'; /** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var memos = require('./routes/memos'); var http = require('http'); var path = require('path'); var app = express(); // all environments app.set('port', process.env.PORT || 9001); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); // app.use(express.logger('dev')); app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' === app.get('env')) { app.use(express.errorHandler()); } app.get('/', routes.index); app.get('/memos/*', memos.list); app.get('/memos', memos.list); app.get('/files/*', memos.get); var server = http.createServer(app); server.listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); }); var io = require('socket.io').listen(server, {'log level': 0}); memos.start(io);
Change port number to 9001
Change port number to 9001
JavaScript
mit
eqot/memo
--- +++ @@ -13,7 +13,7 @@ var app = express(); // all environments -app.set('port', process.env.PORT || 8000); +app.set('port', process.env.PORT || 9001); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon());