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
7a2cfa0c0cb640d9165d66113a5ca70c24ce5f58
examples/todo/src/renderOnServer.js
examples/todo/src/renderOnServer.js
import IsomorphicRouter from 'isomorphic-relay-router'; import path from 'path'; import React from 'react'; import ReactDOMServer from 'react-dom/server'; import Relay from 'react-relay'; import RelayStoreData from 'react-relay/lib/RelayStoreData'; import {match} from 'react-router'; import routes from './routes'; const GRAPHQL_URL = `http://localhost:8080/graphql`; Relay.injectNetworkLayer(new Relay.DefaultNetworkLayer(GRAPHQL_URL)); export default (req, res, next) => { match({routes, location: req.originalUrl}, (error, redirectLocation, renderProps) => { if (error) { next(error); } else if (redirectLocation) { res.redirect(302, redirectLocation.pathname + redirectLocation.search); } else if (renderProps) { IsomorphicRouter.prepareData(renderProps).then(render, next); } else { res.status(404).send('Not Found'); } function render({data, props}) { const reactOutput = ReactDOMServer.renderToString( <IsomorphicRouter.RouterContext {...props} /> ); res.render(path.resolve(__dirname, '..', 'views', 'index.ejs'), { preloadedData: JSON.stringify(data), reactOutput }); } }); };
import IsomorphicRouter from 'isomorphic-relay-router'; import path from 'path'; import React from 'react'; import ReactDOMServer from 'react-dom/server'; import Relay from 'react-relay'; import {match} from 'react-router'; import routes from './routes'; const GRAPHQL_URL = `http://localhost:8080/graphql`; Relay.injectNetworkLayer(new Relay.DefaultNetworkLayer(GRAPHQL_URL)); export default (req, res, next) => { match({routes, location: req.originalUrl}, (error, redirectLocation, renderProps) => { if (error) { next(error); } else if (redirectLocation) { res.redirect(302, redirectLocation.pathname + redirectLocation.search); } else if (renderProps) { IsomorphicRouter.prepareData(renderProps).then(render, next); } else { res.status(404).send('Not Found'); } function render({data, props}) { const reactOutput = ReactDOMServer.renderToString( <IsomorphicRouter.RouterContext {...props} /> ); res.render(path.resolve(__dirname, '..', 'views', 'index.ejs'), { preloadedData: JSON.stringify(data), reactOutput }); } }); };
Remove import which does not seem to be used any more
Remove import which does not seem to be used any more It seems like since we don't need ti inject batching strategy, we would not need this import?
JavaScript
bsd-2-clause
denvned/isomorphic-relay-router
--- +++ @@ -3,7 +3,6 @@ import React from 'react'; import ReactDOMServer from 'react-dom/server'; import Relay from 'react-relay'; -import RelayStoreData from 'react-relay/lib/RelayStoreData'; import {match} from 'react-router'; import routes from './routes';
4bb5c0dc0ee601277e375daa3477ae7906d5d415
webpack-cfg/babili.js
webpack-cfg/babili.js
const Babili = require('babili-webpack-plugin') module.exports = { plugins: [ new Babili({ removeConsole: false, removeDebugger: true }) ] }
const Babili = require('babili-webpack-plugin') const {ENV} = require('./paths') module.exports = { plugins: [ new Babili({ removeConsole: false, removeDebugger: true }, { sourceMap: ENV === 'production' ? 'hidden-source-map' : 'inline-source-map', }) ] }
Fix broken source map in production
Fix broken source map in production
JavaScript
mit
jsse-2017-ph23/web-frontend,jsse-2017-ph23/web-frontend,jsse-2017-ph23/web-frontend
--- +++ @@ -1,10 +1,13 @@ const Babili = require('babili-webpack-plugin') +const {ENV} = require('./paths') module.exports = { plugins: [ new Babili({ removeConsole: false, removeDebugger: true + }, { + sourceMap: ENV === 'production' ? 'hidden-source-map' : 'inline-source-map', }) ] }
0e5e4a4e11b23fbdf57ae785107a435a55895e99
tools/babel-preset.js
tools/babel-preset.js
const BABEL_ENV = process.env.BABEL_ENV; const building = BABEL_ENV != undefined && BABEL_ENV !== 'cjs'; const plugins = []; if (BABEL_ENV === 'umd') { plugins.push('external-helpers'); } if (process.env.NODE_ENV === 'production') { plugins.push( 'dev-expression', 'transform-react-remove-prop-types' ); } module.exports = { presets: [ ['env', { 'loose': true, 'modules': building ? false : 'commonjs', 'uglify': true, }], 'react' ], plugins: plugins };
const BABEL_ENV = process.env.BABEL_ENV; const building = BABEL_ENV != undefined && BABEL_ENV !== 'cjs'; const plugins = []; if (process.env.NODE_ENV === 'production') { plugins.push( 'babel-plugin-dev-expression', 'babel-plugin-transform-react-remove-prop-types' ); } module.exports = () => { return { presets: [ ['@babel/preset-env', { 'loose': true, 'modules': building ? false : 'commonjs', }], '@babel/preset-react' ], plugins: plugins }; };
Update Babel presets to align with new Babel version
Update Babel presets to align with new Babel version
JavaScript
mit
ryanhefner/react-video-players
--- +++ @@ -3,25 +3,22 @@ const plugins = []; -if (BABEL_ENV === 'umd') { - plugins.push('external-helpers'); -} - if (process.env.NODE_ENV === 'production') { plugins.push( - 'dev-expression', - 'transform-react-remove-prop-types' + 'babel-plugin-dev-expression', + 'babel-plugin-transform-react-remove-prop-types' ); } -module.exports = { - presets: [ - ['env', { - 'loose': true, - 'modules': building ? false : 'commonjs', - 'uglify': true, - }], - 'react' - ], - plugins: plugins +module.exports = () => { + return { + presets: [ + ['@babel/preset-env', { + 'loose': true, + 'modules': building ? false : 'commonjs', + }], + '@babel/preset-react' + ], + plugins: plugins + }; };
3438448956dff59dc4176cab3909964779b468e3
week-7/nums_commas.js
week-7/nums_commas.js
// Separate Numbers with Commas in JavaScript **Pairing Challenge** // I worked on this challenge with: . // Pseudocode // Initial Solution // Refactored Solution // Your Own Tests (OPTIONAL) // Reflection
// Separate Numbers with Commas in JavaScript **Pairing Challenge** // I worked on this challenge with: Elizabeth Brown. // Pseudocode // Input: A number with an indefinte number of digits // Output: String with commas separating every three digits starting from the right // Steps: // Create a function named: separateComma() that takes a number as an argument // Split the number into an array with each digit being an element // Reverse the array // Use a loop to insert a comma after every 3 elements // Loop closes when out of elements // Reverse array // Convert array to string (Perhaps use the JOIN function) //arr.insert(index, item) // Initial Solution // var separateComma = function(number) { // var string = number.toString() // var splitString = string.split("") // var newArray = [] // while(splitString.length > 3){ // newArray.push(splitString.pop()); // newArray.push(splitString.pop()); // newArray.push(splitString.pop()); // newArray.push(","); // } // var lastArray = newArray.concat(splitString.reverse()); // var outputString = lastArray.reverse().join(""); // console.log(outputString); // } // separateComma(12345678) // Refactored Solution var separateComma = function(number) { var numArray = number.toString().split("").reverse(); for (var i = 3 ; i < numArray.length ; i+=4){ numArray.splice(i,0,","); } var outputString = numArray.reverse().join(""); console.log(outputString); } separateComma(12345678) // Your Own Tests (OPTIONAL) // Reflection
Add initial and refactored solution
Add initial and refactored solution
JavaScript
mit
RobinSoubry/phase-0,RobinSoubry/phase-0
--- +++ @@ -1,21 +1,54 @@ // Separate Numbers with Commas in JavaScript **Pairing Challenge** - -// I worked on this challenge with: . +// I worked on this challenge with: Elizabeth Brown. // Pseudocode +// Input: A number with an indefinte number of digits +// Output: String with commas separating every three digits starting from the right +// Steps: +// Create a function named: separateComma() that takes a number as an argument +// Split the number into an array with each digit being an element +// Reverse the array +// Use a loop to insert a comma after every 3 elements +// Loop closes when out of elements +// Reverse array +// Convert array to string (Perhaps use the JOIN function) +//arr.insert(index, item) // Initial Solution +// var separateComma = function(number) { +// var string = number.toString() +// var splitString = string.split("") + +// var newArray = [] +// while(splitString.length > 3){ +// newArray.push(splitString.pop()); +// newArray.push(splitString.pop()); +// newArray.push(splitString.pop()); +// newArray.push(","); +// } +// var lastArray = newArray.concat(splitString.reverse()); +// var outputString = lastArray.reverse().join(""); + +// console.log(outputString); +// } - +// separateComma(12345678) // Refactored Solution +var separateComma = function(number) { + var numArray = number.toString().split("").reverse(); + for (var i = 3 ; i < numArray.length ; i+=4){ + numArray.splice(i,0,","); + } + var outputString = numArray.reverse().join(""); + console.log(outputString); +} - - +separateComma(12345678) // Your Own Tests (OPTIONAL)
66ecb5b2b8b2984b685071cee0b22450ca4ebc26
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require bootstrap-sprockets $(document).ready(function(){ $('.contact-artist').click(function (e) { e.preventDefault(); var at = '@' var ending = ".com" var dom = "bop" var user = 'be'; var subject = "Want to learn more"; var emailBody = "Hi Mark, \r\nI really like your artwork and would like to inquire about purchasing some of your pieces."; document.location = "mailto:"+ user + at + dom + ending + "?subject="+subject+"&body="+emailBody; }); })
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require bootstrap-sprockets $(document).ready(function(){ $('.contact-artist').click(function (e) { e.preventDefault(); var at = '@' var ending = ".com" var dom = "markeinert" var user = 'hello'; var subject = "Connecting from website"; // var emailBody = "Hi Mark, \r\nI really like your artwork and would like to inquire about purchasing some of your pieces."; document.location = "mailto:"+ user + at + dom + ending + "?subject="+subject; }); })
Update email address and message sent with email
Update email address and message sent with email
JavaScript
mit
ericbooker12/fuzzy_hat_artist_site,ericbooker12/fuzzy_hat_artist_site,ericbooker12/fuzzy_hat_artist_site
--- +++ @@ -22,13 +22,13 @@ e.preventDefault(); var at = '@' var ending = ".com" - var dom = "bop" - var user = 'be'; + var dom = "markeinert" + var user = 'hello'; - var subject = "Want to learn more"; - var emailBody = "Hi Mark, \r\nI really like your artwork and would like to inquire about purchasing some of your pieces."; + var subject = "Connecting from website"; + // var emailBody = "Hi Mark, \r\nI really like your artwork and would like to inquire about purchasing some of your pieces."; - document.location = "mailto:"+ user + at + dom + ending + "?subject="+subject+"&body="+emailBody; + document.location = "mailto:"+ user + at + dom + ending + "?subject="+subject; }); })
fcb64e1cf3397e4470035763ee2a5304379a110f
app/assets/javascripts/application.js
app/assets/javascripts/application.js
// from govuk_frontend_toolkit //= require vendor/polyfills/bind // from govuk_elements //= require details.polyfill //= require jquery //= require jquery.validate //= require govuk/selection-buttons //= require_tree . //= require piwik window.GOVUK.validation.init(); window.GOVUK.selectDocuments.init(); window.GOVUK.selectPhone.init(); window.GOVUK.willItWorkForMe.init(); window.GOVUK.feedback.init(); $(function () { // Use GOV.UK selection-buttons.js to set selected and focused states for block labels var $blockLabelInput = $(".block-label").find("input[type='radio'],input[type='checkbox']"); new GOVUK.SelectionButtons($blockLabelInput); window.GOVUK.validation.attach(); window.GOVUK.signin.attach(); window.GOVUK.autoSubmitForm.attach(); });
// from govuk_frontend_toolkit //= require vendor/polyfills/bind // from govuk_elements //= require details.polyfill //= require jquery //= require jquery_ujs //= require jquery.validate //= require govuk/selection-buttons //= require_tree . //= require piwik window.GOVUK.validation.init(); window.GOVUK.selectDocuments.init(); window.GOVUK.selectPhone.init(); window.GOVUK.willItWorkForMe.init(); window.GOVUK.feedback.init(); $(function () { // Use GOV.UK selection-buttons.js to set selected and focused states for block labels var $blockLabelInput = $(".block-label").find("input[type='radio'],input[type='checkbox']"); new GOVUK.SelectionButtons($blockLabelInput); window.GOVUK.validation.attach(); window.GOVUK.signin.attach(); window.GOVUK.autoSubmitForm.attach(); });
Revert "BAU: remove unused jQuery UJS library"
Revert "BAU: remove unused jQuery UJS library" This reverts commit b965059cefcca710e2fe232629f06cd9b87e7e07. We didn't realise UJS automatically adds the CSRF token into the request headers - so we started seeing Rails "missing CSRF token" errors in response to AJAX requests. Authors: 3708ce2d6828520f8dfb5991b9e0ba4fbc232136@leoshaw
JavaScript
mit
alphagov/verify-frontend,alphagov/verify-frontend,alphagov/verify-frontend,alphagov/verify-frontend
--- +++ @@ -5,6 +5,7 @@ //= require details.polyfill //= require jquery +//= require jquery_ujs //= require jquery.validate //= require govuk/selection-buttons //= require_tree .
868ce70c6234c1fbd01928d6f0fa3d751a38884c
Resources/ui/common/ApplicationTabGroup.js
Resources/ui/common/ApplicationTabGroup.js
function ApplicationTabGroup(Window) { //create module instance var self = Ti.UI.createTabGroup(); //create app tabs var win1 = Titanium.UI.createWindow({ title : 'User Authentication Demo', tabBarHidden : true, url : 'login.js' }); var win2 = new Window(L('settings')); var tab1 = Ti.UI.createTab({ title : L('home'), icon : '/images/KS_nav_ui.png', window : win1 }); win1.containingTab = tab1; var tab2 = Ti.UI.createTab({ title : L('settings'), icon : '/images/KS_nav_views.png', window : win2 }); win2.containingTab = tab2; self.addTab(tab1); self.addTab(tab2); return self; }; module.exports = ApplicationTabGroup;
function ApplicationTabGroup(Window) { //create module instance var self = Ti.UI.createTabGroup(); //load component dependencies var Post = require('post'); //create app tabs var win1 = Titanium.UI.createWindow({ title : 'Post a Job', tabBarHidden : true, }); //construct UI var post = new Post(); win1.add(post); var win2 = new Window(L('settings')); var tab1 = Ti.UI.createTab({ title : L('Post a Job'), icon : '/images/KS_nav_ui.png', window : win1 }); win1.containingTab = tab1; var tab2 = Ti.UI.createTab({ title : L('settings'), icon : '/images/KS_nav_views.png', window : win2 }); win2.containingTab = tab2; self.addTab(tab1); self.addTab(tab2); return self; }; module.exports = ApplicationTabGroup;
Revert "Set back to login code"
Revert "Set back to login code" This reverts commit c5f5d8cd6240db7ca4d887af57b85441547bb80f.
JavaScript
apache-2.0
martilar/OddJobMapsCloud
--- +++ @@ -1,18 +1,25 @@ function ApplicationTabGroup(Window) { //create module instance var self = Ti.UI.createTabGroup(); + + //load component dependencies + var Post = require('post'); + //create app tabs var win1 = Titanium.UI.createWindow({ - title : 'User Authentication Demo', + title : 'Post a Job', tabBarHidden : true, - url : 'login.js' }); + + //construct UI + var post = new Post(); + win1.add(post); var win2 = new Window(L('settings')); var tab1 = Ti.UI.createTab({ - title : L('home'), + title : L('Post a Job'), icon : '/images/KS_nav_ui.png', window : win1 });
e472e581369d10d51389f371de9033e5cb024b2d
client/forum/thread/append_next_page.js
client/forum/thread/append_next_page.js
'use strict'; module.exports = function ($el, event) { var current = ~~$el.data('current-page'), max = ~~$el.data('max-page'), params = {}; params.page = current + 1; params.id = $el.data('thread-id'); params.forum_id = $el.data('forum-id'); if (params.page < max) { // set current page to the one that was loaded nodeca.server.forum.thread(params, function (err, payload) { if (err) { nodeca.logger.error(err); return; } $el.data('current-page', params.page); payload.data.show_page_number = params.page; if (params.page === max) { $el.addClass('disabled'); } var html = nodeca.client.common.render('forum.thread_posts', '', payload.data); $('article.forum-post:last').after(html); }); } return false; };
'use strict'; module.exports = function ($el, event) { var current = ~~$el.data('current-page'), max = ~~$el.data('max-page'), params = {}; params.page = current + 1; params.id = $el.data('thread-id'); params.forum_id = $el.data('forum-id'); if (params.page <= max) { // set current page to the one that was loaded nodeca.server.forum.thread(params, function (err, payload) { if (err) { nodeca.logger.error(err); return; } $el.data('current-page', params.page); payload.data.show_page_number = params.page; if (params.page === max) { $el.addClass('disabled'); } var html = nodeca.client.common.render('forum.thread_posts', '', payload.data); $('article.forum-post:last').after(html); }); } return false; };
Fix append last page of posts issue
Fix append last page of posts issue
JavaScript
mit
nodeca/nodeca.forum
--- +++ @@ -10,7 +10,7 @@ params.id = $el.data('thread-id'); params.forum_id = $el.data('forum-id'); - if (params.page < max) { + if (params.page <= max) { // set current page to the one that was loaded nodeca.server.forum.thread(params, function (err, payload) { if (err) {
4faa9f04b943b59c71e5c19aab485c5998408f8a
app/assets/javascripts/application/item.js
app/assets/javascripts/application/item.js
var initialize = function() { var root = $('.item'); if (root.length) { var photos = root.find('.item__photos'); if (photos.length) { photos.magnificPopup({ type: 'image', delegate: '.item__photos__photo', gallery: { enabled: true }, preload: [1, 2], zoom: { enabled: true }, duration: 300, easing: 'ease-in-out' }); } if ($('.item__photos__photo').length) { $('.item__photo').on('click', function (e) { e.preventDefault(); $('.item__photos').magnificPopup('open'); }); } else { $('.item__photos__photo').magnificPopup({ type: 'image', zoom: { enabled: true }, duration: 300, easing: 'ease-in-out' }); } } }; $(initialize); $(document).on('page:load', initialize);
var initialize = function() { var root = $('.item'); if (root.length) { var photos = root.find('.item__photos'); if (photos.length) { photos.magnificPopup({ type: 'image', delegate: '.item__photos__photo', gallery: { enabled: true }, preload: [1, 2], zoom: { enabled: true }, duration: 300, easing: 'ease-in-out' }); } if ($('.item__photos__photo').length) { $('.item__photo').on('click', function (e) { e.preventDefault(); $('.item__photos').magnificPopup('open'); }); } else { $('.item__photo').magnificPopup({ type: 'image', zoom: { enabled: true }, duration: 300, easing: 'ease-in-out' }); } } }; $(initialize); $(document).on('page:load', initialize);
Fix JS showing just one photo
Fix JS showing just one photo
JavaScript
mit
dmitry/bazar,dmitry/bazar,dmitry/bazar
--- +++ @@ -25,7 +25,7 @@ $('.item__photos').magnificPopup('open'); }); } else { - $('.item__photos__photo').magnificPopup({ + $('.item__photo').magnificPopup({ type: 'image', zoom: { enabled: true
5a103e0a40c547cb3ba2139306218cfdda48a8a1
doNotEscapeNonAsciiURLChars/wsAccess.js
doNotEscapeNonAsciiURLChars/wsAccess.js
function applicationStarted(pluginWorkspaceAccess) { Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess); referenceResolver = { /*Called when a reference is resolved*/ makeRelative: function (baseURL, childURL) { try { if(!baseURL.toString().endsWith("/")) { lastIndexOfSlash = baseURL.getPath().lastIndexOf('/'); baseURL = new Packages.java.net.URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(), baseURL.getPath().substring(0, lastIndexOfSlash + 1)); } return Packages.java.net.URI.create(Packages.ro.sync.basic.util.URLUtil.uncorrect(baseURL.toString())).relativize(new Packages.java.net.URI(Packages.ro.sync.basic.util.URLUtil.uncorrect(childURL.toString()))).toString(); } catch (e) { e.printStackTrace(); } return null; } } pluginWorkspaceAccess.addRelativeReferencesResolver("file", new JavaAdapter(Packages.ro.sync.exml.workspace.api.util.RelativeReferenceResolver, referenceResolver)); } function applicationClosing(pluginWorkspaceAccess) { Packages.java.lang.System.err.println("Application closing " + pluginWorkspaceAccess); }
function applicationStarted(pluginWorkspaceAccess) { Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess); var calledFromOwnCode = false; referenceResolver = { /*Called when a reference is resolved*/ makeRelative: function (baseURL, childURL) { if(calledFromOwnCode){ return null; } try { calledFromOwnCode = true; ret = Packages.ro.sync.basic.util.URLUtil.makeRelative(new Packages.java.net.URL(Packages.ro.sync.basic.util.URLUtil.uncorrect(baseURL.toString())), new Packages.java.net.URL(Packages.ro.sync.basic.util.URLUtil.uncorrect(childURL.toString()))); calledFromOwnCode = false; return ret; } catch (e) { e.printStackTrace(); calledFromOwnCode = false; } return null; } } pluginWorkspaceAccess.addRelativeReferencesResolver("file", new JavaAdapter(Packages.ro.sync.exml.workspace.api.util.RelativeReferenceResolver, referenceResolver)); } function applicationClosing(pluginWorkspaceAccess) { Packages.java.lang.System.err.println("Application closing " + pluginWorkspaceAccess); }
Use Oxygen code to make URLs relative
Use Oxygen code to make URLs relative
JavaScript
apache-2.0
oxygenxml/wsaccess-javascript-sample-plugins
--- +++ @@ -1,16 +1,20 @@ function applicationStarted(pluginWorkspaceAccess) { Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess); + var calledFromOwnCode = false; referenceResolver = { /*Called when a reference is resolved*/ makeRelative: function (baseURL, childURL) { + if(calledFromOwnCode){ + return null; + } try { - if(!baseURL.toString().endsWith("/")) { - lastIndexOfSlash = baseURL.getPath().lastIndexOf('/'); - baseURL = new Packages.java.net.URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort(), baseURL.getPath().substring(0, lastIndexOfSlash + 1)); - } - return Packages.java.net.URI.create(Packages.ro.sync.basic.util.URLUtil.uncorrect(baseURL.toString())).relativize(new Packages.java.net.URI(Packages.ro.sync.basic.util.URLUtil.uncorrect(childURL.toString()))).toString(); + calledFromOwnCode = true; + ret = Packages.ro.sync.basic.util.URLUtil.makeRelative(new Packages.java.net.URL(Packages.ro.sync.basic.util.URLUtil.uncorrect(baseURL.toString())), new Packages.java.net.URL(Packages.ro.sync.basic.util.URLUtil.uncorrect(childURL.toString()))); + calledFromOwnCode = false; + return ret; } catch (e) { e.printStackTrace(); + calledFromOwnCode = false; } return null; }
cbfe63dc78bfcd229b225ee34553869f4e9ef2e3
client/app/scripts/utils/tracking-utils.js
client/app/scripts/utils/tracking-utils.js
import debug from 'debug'; const log = debug('service:tracking'); // Track mixpanel events only if Scope is running inside of Weave Cloud. export function trackAnalyticsEvent(name, props) { if (window.analytics && process.env.WEAVE_CLOUD) { window.analytics.track(name, props); } else { log('trackAnalyticsEvent', name, props); } }
import debug from 'debug'; const log = debug('service:tracking'); // Track segment events only if Scope is running inside of Weave Cloud. export function trackAnalyticsEvent(name, props) { if (window.analytics && process.env.WEAVE_CLOUD) { window.analytics.track(name, props); } else { log('trackAnalyticsEvent', name, props); } }
Fix now out of date comment
tracking: Fix now out of date comment
JavaScript
apache-2.0
kinvolk/scope,kinvolk/scope,weaveworks/scope,weaveworks/scope,weaveworks/scope,kinvolk/scope,alban/scope,kinvolk/scope,weaveworks/scope,alban/scope,alban/scope,weaveworks/scope,alban/scope,weaveworks/scope,kinvolk/scope,alban/scope,alban/scope,kinvolk/scope
--- +++ @@ -2,7 +2,7 @@ const log = debug('service:tracking'); -// Track mixpanel events only if Scope is running inside of Weave Cloud. +// Track segment events only if Scope is running inside of Weave Cloud. export function trackAnalyticsEvent(name, props) { if (window.analytics && process.env.WEAVE_CLOUD) { window.analytics.track(name, props);
e89d054f1df11ac3eb4ccb182ddf606637911408
src/server/models/index.js
src/server/models/index.js
var mongoose = require('mongoose'), shortid = require('shortid'); var UserSchema = new mongoose.Schema({ _id: {type: String, required: true, unique: true, 'default': shortid.generate}, username: {type: String, unique: true, sparse: true, trim: true, lowercase: true}, name: {type: String, required: true}, email: {type: String}, password: {type: String}, is_active: {type: Boolean, 'default': true}, is_admin: {type: Boolean, 'default': false}, created: {type: Date, required: true, 'default': Date.now}, google_id: {type: String} }); var User = mongoose.model('User', UserSchema); module.exports = { User: User };
var mongoose = require('mongoose'), shortid = require('shortid'); var UserSchema = new mongoose.Schema({ _id: {type: String, required: true, unique: true, 'default': shortid.generate}, username: {type: String, unique: true, sparse: true, trim: true, lowercase: true}, name: {type: String, required: true}, email: {type: String}, password: {type: String}, is_active: {type: Boolean, 'default': true}, is_admin: {type: Boolean, 'default': false}, created: {type: Date, required: true, 'default': Date.now}, google_id: {type: String} }); UserSchema.set('toObject', { transform: function (document, ret, options) { ret.id = ret._id; delete ret._id; delete ret.__v; } }); var User = mongoose.model('User', UserSchema); module.exports = { User: User };
Return id, not _id or __v.
Return id, not _id or __v.
JavaScript
mit
strekmann/node-boilerplate,strekmann/samklang,strekmann/samklang,strekmann/node-boilerplate
--- +++ @@ -13,6 +13,14 @@ google_id: {type: String} }); +UserSchema.set('toObject', { + transform: function (document, ret, options) { + ret.id = ret._id; + delete ret._id; + delete ret.__v; + } +}); + var User = mongoose.model('User', UserSchema); module.exports = {
b6b2cd5cca1177fe804ef32d6d798b9bb992a845
app/js/filters/markdownFilter.js
app/js/filters/markdownFilter.js
'use strict'; angular.module('gisto.filter.markDown', []).filter('markDown', function () { return function (input) { if (typeof input === 'undefined') { return; } else { var converter = new Showdown.converter(); var html = converter.makeHtml(input); return html; } }; })
'use strict'; angular.module('gisto.filter.markDown', []).filter('markDown', function ($compile, $rootScope) { return function (input) { if (typeof input === 'undefined') { return; } else { var converter = new Showdown.converter(); var html = converter.makeHtml(input); html = html.replace(/href="(.*)"/gi, function (match, p1) { return 'onclick="gui.Shell.openExternal(\'' + p1 + '\')"'; }); return html; } }; })
FIX (markdown links): All markdown links now open in a new browser window instead of inside the application.
FIX (markdown links): All markdown links now open in a new browser window instead of inside the application. Fixes #88
JavaScript
mit
Gisto/Gisto,shmool/Gisto,Gisto/Gisto,Gisto/Gisto,shmool/Gisto,shmool/Gisto,Gisto/Gisto
--- +++ @@ -1,12 +1,15 @@ 'use strict'; -angular.module('gisto.filter.markDown', []).filter('markDown', function () { +angular.module('gisto.filter.markDown', []).filter('markDown', function ($compile, $rootScope) { return function (input) { if (typeof input === 'undefined') { return; } else { var converter = new Showdown.converter(); var html = converter.makeHtml(input); + html = html.replace(/href="(.*)"/gi, function (match, p1) { + return 'onclick="gui.Shell.openExternal(\'' + p1 + '\')"'; + }); return html; } };
ae39e7f98c4d92e609bbfe6f9740c51d33ff30f8
internal/forum/_post_list_fields.js
internal/forum/_post_list_fields.js
'use strict'; module.exports = { post: [ '_id', 'to', 'tail', 'html', 'user', 'ts', 'st', 'ste', 'del_reason', 'del_by', 'votes' ], section: [ 'hid' ], topic: [ '_id', 'hid', 'cache', 'cache_hb', 'st', 'ste' ], settings: [ 'can_see_ip', 'can_see_hellbanned', 'forum_can_view', 'topic_title_min_length', 'forum_can_reply', 'forum_edit_max_time', 'forum_can_close_topic', 'forum_mod_can_delete_topics', 'forum_mod_can_hard_delete_topics', 'forum_mod_can_see_hard_deleted_topics', 'forum_mod_can_edit_posts', 'forum_mod_can_pin_topic', 'forum_mod_can_edit_titles', 'forum_mod_can_close_topic', 'can_vote', 'votes_add_max_time' ] };
'use strict'; module.exports = { post: [ '_id', 'to', 'tail', 'html', 'user', 'ts', 'st', 'ste', 'del_reason', 'del_by', 'votes' ], section: [ 'hid' ], topic: [ '_id', 'hid', 'cache', 'cache_hb', 'st', 'ste', 'title' ], settings: [ 'can_see_ip', 'can_see_hellbanned', 'forum_can_view', 'topic_title_min_length', 'forum_can_reply', 'forum_edit_max_time', 'forum_can_close_topic', 'forum_mod_can_delete_topics', 'forum_mod_can_hard_delete_topics', 'forum_mod_can_see_hard_deleted_topics', 'forum_mod_can_edit_posts', 'forum_mod_can_pin_topic', 'forum_mod_can_edit_titles', 'forum_mod_can_close_topic', 'can_vote', 'votes_add_max_time' ] };
Add "title" to forum.topic.list.by_page request
Add "title" to forum.topic.list.by_page request This fixes "[missing variable: title]" error when you visit /forum/fX/topicY page and click on "More posts".
JavaScript
mit
nodeca/nodeca.forum
--- +++ @@ -26,7 +26,8 @@ 'cache', 'cache_hb', 'st', - 'ste' + 'ste', + 'title' ], settings: [
697118ffe08b15e42e50e239807ce268755580d8
aritgeo/src/aritgeo.js
aritgeo/src/aritgeo.js
'use strict' module.exports = { aritGeo: function(numlist) { if (numlist.length === 0) { return 0; } } }
'use strict' module.exports = { aritGeo: function(numlist) { if (!Array.isArray(numlist)) { return null; } if (numlist.length === 0) { return 0; } } }
Implement aritGeo case for non-arrays
Implement aritGeo case for non-arrays
JavaScript
mit
princess-essien/andela-bootcamp-slc
--- +++ @@ -2,6 +2,10 @@ module.exports = { aritGeo: function(numlist) { + if (!Array.isArray(numlist)) { + return null; + } + if (numlist.length === 0) { return 0; }
634dffb61e24e3548f6634636acd33192f574552
lib/module/is-module-not-found-error.js
lib/module/is-module-not-found-error.js
// Whether passed error is error thrown by require in case module // (at given path) is not found 'use strict'; var k = require('es5-ext/function/k') , token, pattern; try { require(token = ':path:'); } catch (e) { pattern = e.message; } module.exports = exports = function (e, path) { return e.message === pattern.replace(token, path); }; Object.defineProperties(exports, { token: { get: k(token) }, pattern: { get: k(pattern) } });
// Whether passed error is error thrown by require in case module // (at given path) is not found 'use strict'; var constant = require('es5-ext/function/constant') , token, pattern; try { require(token = ':path:'); } catch (e) { pattern = e.message; } module.exports = exports = function (e, path) { return e.message === pattern.replace(token, path); }; Object.defineProperties(exports, { token: { get: constant(token) }, pattern: { get: constant(pattern) } });
Update up to changes in es5-ext
Update up to changes in es5-ext
JavaScript
mit
medikoo/node-ext
--- +++ @@ -3,7 +3,7 @@ 'use strict'; -var k = require('es5-ext/function/k') +var constant = require('es5-ext/function/constant') , token, pattern; @@ -18,6 +18,6 @@ }; Object.defineProperties(exports, { - token: { get: k(token) }, - pattern: { get: k(pattern) } + token: { get: constant(token) }, + pattern: { get: constant(pattern) } });
24afc74146676163c68bf1c422eeab4a387d0e37
test/react-native/index.js
test/react-native/index.js
describe('react-native', function () { it('just re-exports the global functions', function () { const globalFetch = global.fetch = function globalFetch () {} const globalHeaders = global.Headers = function globalHeaders () {} const globalRequest = global.Request = function globalRequest () {} const globalResponse = global.Response = function globalResponse () {} const { fetch, Request, Response, Headers } = require('../../dist/react-native-ponyfill') expect(fetch).to.equal(globalFetch) expect(Headers).to.equal(globalHeaders) expect(Request).to.equal(globalRequest) expect(Response).to.equal(globalResponse) delete global.fetch delete global.Headers delete global.Request delete global.Response }) })
describe('react-native', function () { it('just re-exports the global functions', function () { const globalFetch = global.fetch = function globalFetch () {} const globalHeaders = global.Headers = function globalHeaders () {} const globalRequest = global.Request = function globalRequest () {} const globalResponse = global.Response = function globalResponse () {} const { fetch, Request, Response, Headers } = require('../../dist/react-native-ponyfill') expect(fetch).to.equal(globalFetch) expect(Headers).to.equal(globalHeaders) expect(Request).to.equal(globalRequest) expect(Response).to.equal(globalResponse) delete global.fetch delete global.Headers delete global.Request delete global.Response }) it('doesn\'t touch the global functions when polyfilling', function () { const globalFetch = global.fetch = function globalFetch () {} const globalHeaders = global.Headers = function globalHeaders () {} const globalRequest = global.Request = function globalRequest () {} const globalResponse = global.Response = function globalResponse () {} require('../../dist/react-native-polyfill') expect(fetch).to.equal(globalFetch) expect(Headers).to.equal(globalHeaders) expect(Request).to.equal(globalRequest) expect(Response).to.equal(globalResponse) delete global.fetch delete global.Headers delete global.Request delete global.Response }) })
Add a test case for the no-op react-native polyfill
[test] Add a test case for the no-op react-native polyfill
JavaScript
mit
lquixada/cross-fetch,lquixada/cross-fetch,lquixada/cross-fetch,lquixada/cross-fetch
--- +++ @@ -17,4 +17,23 @@ delete global.Request delete global.Response }) + + it('doesn\'t touch the global functions when polyfilling', function () { + const globalFetch = global.fetch = function globalFetch () {} + const globalHeaders = global.Headers = function globalHeaders () {} + const globalRequest = global.Request = function globalRequest () {} + const globalResponse = global.Response = function globalResponse () {} + + require('../../dist/react-native-polyfill') + + expect(fetch).to.equal(globalFetch) + expect(Headers).to.equal(globalHeaders) + expect(Request).to.equal(globalRequest) + expect(Response).to.equal(globalResponse) + + delete global.fetch + delete global.Headers + delete global.Request + delete global.Response + }) })
22022846df7759f72cb105cd5fbc2a6401348a8d
sencha-workspace/SlateAdmin/app/model/person/progress/NoteRecipient.js
sencha-workspace/SlateAdmin/app/model/person/progress/NoteRecipient.js
Ext.define('SlateAdmin.model.person.progress.NoteRecipient', { extend: 'Ext.data.Model', groupField: 'RelationshipGroup', fields: [ { name: 'PersonID', type: 'integer' }, { name: 'FullName', type: 'string' }, { name: 'Email', type: 'string' }, { name: 'Label', type: 'string' }, { name: 'RelationshipGroup', convert: function (v) { return v || 'Other'; } }, // virtual fields { name: 'selected', type: 'boolean', convert: function (v, record) { var selected = !Ext.isEmpty(record.get('Status')); return selected; } } ], proxy: { type: 'slaterecords', startParam: null, limitParam: null, api: { read: '/notes/progress/recipients', update: '/notes/save', create: '/notes/save', destory: '/notes/save' }, reader: { type: 'json', rootProperty: 'data' }, writer: { type: 'json', rootProperty: 'data', writeAllFields: false, allowSingle: false } } });
Ext.define('SlateAdmin.model.person.progress.NoteRecipient', { extend: 'Ext.data.Model', groupField: 'RelationshipGroup', fields: [ { name: 'PersonID', type: 'integer' }, { name: 'FullName', type: 'string' }, { name: 'Email', type: 'string', allowNull: true }, { name: 'Label', type: 'string', allowNull: true }, { name: 'RelationshipGroup', convert: function (v) { return v || 'Other'; } }, // virtual fields { name: 'selected', type: 'boolean', convert: function (v, record) { var selected = !Ext.isEmpty(record.get('Status')); return selected; } } ], proxy: { type: 'slaterecords', startParam: null, limitParam: null, api: { read: '/notes/progress/recipients', update: '/notes/save', create: '/notes/save', destory: '/notes/save' }, reader: { type: 'json', rootProperty: 'data' }, writer: { type: 'json', rootProperty: 'data', writeAllFields: false, allowSingle: false } } });
Allow email and label to be null
Allow email and label to be null
JavaScript
mit
SlateFoundation/slate,SlateFoundation/slate,SlateFoundation/slate,SlateFoundation/slate-admin,SlateFoundation/slate-admin,SlateFoundation/slate,SlateFoundation/slate-admin,SlateFoundation/slate-admin,SlateFoundation/slate-admin,SlateFoundation/slate
--- +++ @@ -15,11 +15,13 @@ }, { name: 'Email', - type: 'string' + type: 'string', + allowNull: true }, { name: 'Label', - type: 'string' + type: 'string', + allowNull: true }, { name: 'RelationshipGroup',
b183e990c560178bd1da9a1ca4210e6a8fbe102c
service-worker.js
service-worker.js
async function networkOrCache(event) { try { const response = await fetch(event.request); if (response.ok) { const cache = await caches.open('steamstatus'); await cache.put(event.request, response.clone()); return response; } throw new Error(`Request failed with HTTP ${response.status}`); } catch (e) { // eslint-disable-next-line no-console console.error(e.message, event.request.url); const cache = await caches.open('steamstatus'); const matching = await cache.match(event.request); return matching || Promise.reject(new Error('Request not in cache')); } } self.addEventListener('fetch', (event) => { if (event.request.method !== 'GET') { return; } if (!event.request.url.startsWith(self.registration.scope)) { return; } event.respondWith(networkOrCache(event)); });
self.addEventListener( 'install', function( e ) { // hey } );
Revert "Update service worker to fallback to cache"
Revert "Update service worker to fallback to cache" This reverts commit af0f4ed564676f56bd87ef49b3284a2a7f5ea206.
JavaScript
mit
SteamDatabase/steamstat.us,SteamDatabase/steamstat.us
--- +++ @@ -1,33 +1,3 @@ -async function networkOrCache(event) { - try { - const response = await fetch(event.request); - - if (response.ok) { - const cache = await caches.open('steamstatus'); - await cache.put(event.request, response.clone()); - return response; - } - - throw new Error(`Request failed with HTTP ${response.status}`); - } catch (e) { - // eslint-disable-next-line no-console - console.error(e.message, event.request.url); - - const cache = await caches.open('steamstatus'); - const matching = await cache.match(event.request); - - return matching || Promise.reject(new Error('Request not in cache')); - } -} - -self.addEventListener('fetch', (event) => { - if (event.request.method !== 'GET') { - return; - } - - if (!event.request.url.startsWith(self.registration.scope)) { - return; - } - - event.respondWith(networkOrCache(event)); -}); +self.addEventListener( 'install', function( e ) { + // hey +} );
63d1c7e4909c6ed223e831411319bb5f082fa7f6
scripts/print-supported-connectors.js
scripts/print-supported-connectors.js
'use strict'; require('node-define'); function printSupportedConnectors() { let connectors = require('../core/connectors').sort(function(a, b) { return a.label.localeCompare(b.label); }); for (let connector of connectors) { console.log(connector.label); } } printSupportedConnectors();
'use strict'; require('node-define'); function printSupportedConnectors() { let connectors = require('../core/connectors').sort(function(a, b) { return a.label.localeCompare(b.label); }); for (let connector of connectors) { console.log(` ‒ ${connector.label}`); } } printSupportedConnectors();
Indent items of list of connectors
Indent items of list of connectors
JavaScript
mit
carpet-berlin/web-scrobbler,carpet-berlin/web-scrobbler,david-sabata/web-scrobbler,fakelbst/Chrome-Last.fm-Scrobbler,galeksandrp/web-scrobbler,alexesprit/web-scrobbler,inverse/web-scrobbler,usdivad/web-scrobbler,alexesprit/web-scrobbler,usdivad/web-scrobbler,david-sabata/web-scrobbler,galeksandrp/web-scrobbler,Paszt/web-scrobbler,fakelbst/Chrome-Last.fm-Scrobbler,inverse/web-scrobbler,Paszt/web-scrobbler
--- +++ @@ -6,8 +6,9 @@ let connectors = require('../core/connectors').sort(function(a, b) { return a.label.localeCompare(b.label); }); + for (let connector of connectors) { - console.log(connector.label); + console.log(` ‒ ${connector.label}`); } }
d906eb5a3f5b2e4adfe8338d011dd4290b735c0a
src/aui-datatable/js/aui-datatable-core.js
src/aui-datatable/js/aui-datatable-core.js
A.DataTable.NAME = 'table'; A.DataTable.CSS_PREFIX = 'aui-table'; console.log('core');
A.DataTable.NAME = 'table'; A.DataTable.CSS_PREFIX = 'aui-table';
Remove console.log from datatable core
Remove console.log from datatable core
JavaScript
bsd-3-clause
brianchandotcom/alloy-ui,ipeychev/alloy-ui,westonhancock/alloy-ui,drewbrokke/alloy-ui,fernandosouza/alloy-ui,eduardolundgren/alloy-ui,zenorocha/alloy-ui,drewbrokke/alloy-ui,modulexcite/alloy-ui,ipeychev/alloy-ui,mthadley/alloy-ui,zenorocha/alloy-ui,seedtigo/alloy-ui,antoniopol06/alloy-ui,inacionery/alloy-ui,ampratt/alloy-ui,jonathanmccann/alloy-ui,peterborkuti/alloy-ui,ambrinchaudhary/alloy-ui,Preston-Crary/alloy-ui,pei-jung/alloy-ui,fernandosouza/alloy-ui,zsagia/alloy-ui,dsanz/alloy-ui,ericchin/alloy-ui,Khamull/alloy-ui,antoniopol06/alloy-ui,pei-jung/alloy-ui,mthadley/alloy-ui,thiago-rocha/alloy-ui,BryanEngler/alloy-ui,ambrinchaudhary/alloy-ui,thiago-rocha/alloy-ui,inacionery/alloy-ui,Preston-Crary/alloy-ui,dsanz/alloy-ui,ericyanLr/alloy-ui,westonhancock/alloy-ui,modulexcite/alloy-ui,mairatma/alloy-ui,crimago/alloy-ui,4talesa/alloy-ui,bryceosterhaus/alloy-ui,jonathanmccann/alloy-ui,zsagia/alloy-ui,zsigmondrab/alloy-ui,peterborkuti/alloy-ui,samanzanedo/alloy-ui,4talesa/alloy-ui,seedtigo/alloy-ui,BryanEngler/alloy-ui,crimago/alloy-ui,mairatma/alloy-ui,Khamull/alloy-ui,ericchin/alloy-ui,zxdgoal/alloy-ui,zsigmondrab/alloy-ui,bryceosterhaus/alloy-ui,dsanz/alloy-ui,zxdgoal/alloy-ui,dsanz/alloy-ui,ericyanLr/alloy-ui,henvic/alloy-ui,henvic/alloy-ui,ampratt/alloy-ui
--- +++ @@ -1,3 +1,2 @@ A.DataTable.NAME = 'table'; A.DataTable.CSS_PREFIX = 'aui-table'; -console.log('core');
a7800b57b4eae24b5900d6cfa116f45dd029e137
app/client/views/home/residents/residents.js
app/client/views/home/residents/residents.js
import d3 from 'd3'; import moment from 'moment'; import 'moment/locale/fi'; Template.homeResidents.helpers({ abbreviatedWeekday (date) { // Get user browser language const locale = window.navigator.userLanguage || window.navigator.language; // Set locale based on user browser language moment.locale(locale); // Format the date to display abbreviated weekday in user language return moment(date).format('dd'); }, pastSevenDays () { // Get date seven days ago const sevenDaysAgo = moment().subtract(7, 'days').toDate(); // Get array of past seven days including today const pastSevenDays = d3.utcDay.range(sevenDaysAgo, new Date()); return pastSevenDays; } });
import d3 from 'd3'; import moment from 'moment'; import 'moment/locale/fi'; Template.homeResidents.helpers({ abbreviatedWeekday (date) { // Get user language const locale = TAPi18n.getLanguage(); // Set locale based on user browser language moment.locale(locale); // Format the date to display abbreviated weekday in user language return moment(date).format('dd'); }, pastSevenDays () { // Get date seven days ago const sevenDaysAgo = moment().subtract(7, 'days').toDate(); // Get array of past seven days including today const pastSevenDays = d3.utcDay.range(sevenDaysAgo, new Date()); return pastSevenDays; } });
Use selected language for table headers
Use selected language for table headers
JavaScript
agpl-3.0
GeriLife/wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,brylie/juhani-wellbeing
--- +++ @@ -4,8 +4,8 @@ Template.homeResidents.helpers({ abbreviatedWeekday (date) { - // Get user browser language - const locale = window.navigator.userLanguage || window.navigator.language; + // Get user language + const locale = TAPi18n.getLanguage(); // Set locale based on user browser language moment.locale(locale);
f1edcd571fee5667c81ad84e38dbe5379aa77974
reg-exp/#/unicode/is-implemented.js
reg-exp/#/unicode/is-implemented.js
'use strict'; module.exports = function () { return RegExp.prototype.unicode === false; };
'use strict'; module.exports = function () { var dummyRegExp = /a/; return 'unicode' in dummyRegExp; };
Fix native Unicode regexp support detection
Fix native Unicode regexp support detection https://github.com/tc39/ecma262/issues/262 https://github.com/tc39/ecma262/pull/263 https://bugs.chromium.org/p/v8/issues/detail?id=4617
JavaScript
isc
medikoo/es5-ext
--- +++ @@ -1,5 +1,6 @@ 'use strict'; module.exports = function () { - return RegExp.prototype.unicode === false; + var dummyRegExp = /a/; + return 'unicode' in dummyRegExp; };
8601aefa4df016377711b609cbeac23c785e5378
src/js/components/form/FormGroupHeading.js
src/js/components/form/FormGroupHeading.js
import classNames from 'classnames'; import React from 'react'; import FormGroupHeadingContent from './FormGroupHeadingContent'; function getModifiedChildren(children) { const asteriskNode = ( <FormGroupHeadingContent className="text-danger" key="asterisk"> * </FormGroupHeadingContent> ); const nextChildren = React.Children.toArray(children); nextChildren.splice(1, 0, asteriskNode); return nextChildren; } function FormGroupHeading({className, children, required}) { const classes = classNames('form-group-heading', className); return ( <div className={classes}> {required ? getModifiedChildren(children) : children} </div> ); } FormGroupHeading.defaultProps = { required: false }; FormGroupHeading.propTypes = { children: React.PropTypes.node.isRequired, className: React.PropTypes.oneOfType([ React.PropTypes.array, React.PropTypes.object, React.PropTypes.string ]), required: React.PropTypes.bool }; module.exports = FormGroupHeading;
import classNames from 'classnames'; import React from 'react'; import FormGroupHeadingContent from './FormGroupHeadingContent'; function injectAsteriskNode(children) { const asteriskNode = ( <FormGroupHeadingContent className="text-danger" key="asterisk"> * </FormGroupHeadingContent> ); const nextChildren = React.Children.toArray(children); nextChildren.splice(1, 0, asteriskNode); return nextChildren; } function FormGroupHeading({className, children, required}) { const classes = classNames('form-group-heading', className); return ( <div className={classes}> {required ? injectAsteriskNode(children) : children} </div> ); } FormGroupHeading.defaultProps = { required: false }; FormGroupHeading.propTypes = { children: React.PropTypes.node.isRequired, className: React.PropTypes.oneOfType([ React.PropTypes.array, React.PropTypes.object, React.PropTypes.string ]), required: React.PropTypes.bool }; module.exports = FormGroupHeading;
Use much better function name
Use much better function name
JavaScript
apache-2.0
dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui
--- +++ @@ -3,7 +3,7 @@ import FormGroupHeadingContent from './FormGroupHeadingContent'; -function getModifiedChildren(children) { +function injectAsteriskNode(children) { const asteriskNode = ( <FormGroupHeadingContent className="text-danger" key="asterisk"> * @@ -21,7 +21,7 @@ return ( <div className={classes}> - {required ? getModifiedChildren(children) : children} + {required ? injectAsteriskNode(children) : children} </div> ); }
4348446a0c6c39df4c0571c6d7284a6616d2ce1f
snippets/obfuscate-email-address.js
snippets/obfuscate-email-address.js
;(function($){ var email_obfuscated_class = 'obfuscated'; var email_data_attr_prefix = 'data-email-'; $(document) .on('mouseenter focus click touchstart keydown', 'a.obfuscated-email.' + email_obfuscated_class, function(e){ assemble_email(e); }) ; function assemble_email(e) { e.stopPropagation(); e.preventDefault(); var $email_link = $(e.target); var email_address = $email_link.attr(email_data_attr_prefix + '1') + '@' + $email_link.attr(email_data_attr_prefix + '2') + '.' + $email_link.attr(email_data_attr_prefix + '3'); var email_href = 'mailto:' + email_address; $email_link.attr('href', email_href).removeClass(email_obfuscated_class).removeAttr(email_data_attr_prefix + '1').find('span').remove(); // Prevent having to double-tap email link on mobile if(e.type === 'touchstart') { window.location = email_href; } } })(jQuery);
;(function($){ var email_obfuscated_class = 'obfuscated'; var email_data_attr_prefix = 'data-email-'; $(document) .on('mouseenter focus click touchstart keydown', 'a.obfuscated-email.' + email_obfuscated_class, function(e){ assemble_email(e); }) ; function assemble_email(e) { e.stopPropagation(); e.preventDefault(); var $email_link = $(e.target); var email_address = $email_link.attr(email_data_attr_prefix + '1') + '@' + $email_link.attr(email_data_attr_prefix + '2') + '.' + $email_link.attr(email_data_attr_prefix + '3'); var email_href = 'mailto:' + email_address; $email_link.attr('href', email_href) .removeClass(email_obfuscated_class) .removeAttr( email_data_attr_prefix + '1' + ' ' + email_data_attr_prefix + '2' + ' ' + email_data_attr_prefix + '3' ) .find('span').remove(); // Prevent having to double-tap email link on mobile if(e.type === 'touchstart') { window.location = email_href; } } })(jQuery);
Remove data attributes from obfuscated email address
Remove data attributes from obfuscated email address
JavaScript
mit
a-dg/codebox-snippets,a-dg/codebox-snippets,a-dg/codebox-snippets,a-dg/codebox-snippets
--- +++ @@ -18,7 +18,14 @@ + '@' + $email_link.attr(email_data_attr_prefix + '2') + '.' + $email_link.attr(email_data_attr_prefix + '3'); var email_href = 'mailto:' + email_address; - $email_link.attr('href', email_href).removeClass(email_obfuscated_class).removeAttr(email_data_attr_prefix + '1').find('span').remove(); + $email_link.attr('href', email_href) + .removeClass(email_obfuscated_class) + .removeAttr( + email_data_attr_prefix + '1' + + ' ' + email_data_attr_prefix + '2' + + ' ' + email_data_attr_prefix + '3' + ) + .find('span').remove(); // Prevent having to double-tap email link on mobile if(e.type === 'touchstart') {
dc01d50974784f9a2ece241dc7ef7c743db10e65
src/javascript/binary/pages/chartapp.js
src/javascript/binary/pages/chartapp.js
(function () { 'use strict'; var isMac = /Mac/i.test(navigator.platform), isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent), isAndroid = /Android/i.test(navigator.userAgent), isWindowsPhone = /Windows Phone/i.test(navigator.userAgent), isJavaInstalled = (deployJava.getJREs().length > 0) && deployJava.versionCheck("1.5+"), isMobile = isIOS || isAndroid || isWindowsPhone, canBeInstalled = isJavaInstalled && !isMobile; $('#install-java').toggle(!isJavaInstalled); $('#download-app').toggle(canBeInstalled); $('#install-java').on('click', function () { deployJava.installLatestJava(); }); $('#download-app').on('click', function () { if (isMac) { alert('You need to change your security preferences!'); return; } if (isMobile) { alert('The charting app is not available on mobile devices!'); } }); })();
(function () { 'use strict'; var isMac = /Mac/i.test(navigator.platform), isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent), isAndroid = /Android/i.test(navigator.userAgent), isWindowsPhone = /Windows Phone/i.test(navigator.userAgent), isJavaInstalled = (deployJava.getJREs().length > 0) && deployJava.versionCheck("1.5+"), isMobile = isIOS || isAndroid || isWindowsPhone, shouldBeInstalled = !isJavaInstalled && !isMobile; $('#install-java').toggle(shouldBeInstalled); $('#download-app').toggle(isJavaInstalled); $('#install-java').on('click', function () { deployJava.installLatestJava(); }); $('#download-app').on('click', function () { if (isMac) { alert('You need to change your security preferences!'); return; } if (isMobile) { alert('The charting app is not available on mobile devices!'); } }); })();
Fix Java chart app detection logic
Fix Java chart app detection logic
JavaScript
apache-2.0
massihx/binary-static,einhverfr/binary-static,borisyankov/binary-static,animeshsaxena/binary-static,massihx/binary-static,tfoertsch/binary-static,einhverfr/binary-static,junbon/binary-static-www2,tfoertsch/binary-static,borisyankov/binary-static,massihx/binary-static,animeshsaxena/binary-static,animeshsaxena/binary-static,massihx/binary-static,junbon/binary-static-www2,borisyankov/binary-static,brodiecapel16/binary-static,brodiecapel16/binary-static,animeshsaxena/binary-static,einhverfr/binary-static,brodiecapel16/binary-static,borisyankov/binary-static,brodiecapel16/binary-static,einhverfr/binary-static
--- +++ @@ -7,10 +7,10 @@ isWindowsPhone = /Windows Phone/i.test(navigator.userAgent), isJavaInstalled = (deployJava.getJREs().length > 0) && deployJava.versionCheck("1.5+"), isMobile = isIOS || isAndroid || isWindowsPhone, - canBeInstalled = isJavaInstalled && !isMobile; + shouldBeInstalled = !isJavaInstalled && !isMobile; - $('#install-java').toggle(!isJavaInstalled); - $('#download-app').toggle(canBeInstalled); + $('#install-java').toggle(shouldBeInstalled); + $('#download-app').toggle(isJavaInstalled); $('#install-java').on('click', function () { deployJava.installLatestJava();
714b400c1cea342927a3c7a0b8f77506f4710d8b
src/public/js/decorators/zero-clipboard.js
src/public/js/decorators/zero-clipboard.js
export default function (node/*, tooltipPlacement = 'right'*/) { /*let clip = */new ZeroClipboard(node); /*let $node = $(node); $node .on('mouseover', () => { $node .tooltip('destroy') .tooltip({ title: 'Copy to Clipboard', placement: tooltipPlacement, trigger: 'manual', container: 'body', }) .tooltip('show'); }) .on('mouseout', () => { $node.tooltip('destroy'); }); clip.on('aftercopy', () => { $node .tooltip('destroy') .tooltip({ title: 'Copied!', placement: tooltipPlacement, trigger: 'manual', container: 'body', }) .tooltip('show'); });*/ return { teardown: () => {} }; }
export default function (node, tooltipPlacement = 'top') { let clip = new ZeroClipboard(node); let $node = $(node); let tooltipOptions = { title: 'Copy to Clipboard', placement: tooltipPlacement, trigger: 'hover', container: 'body', animation: false, }; $node .on('mouseover', () => { $node .tooltip('destroy') .tooltip(tooltipOptions) .tooltip('show'); }); clip.on('aftercopy', () => { $node .tooltip('destroy') .tooltip($.extend({}, tooltipOptions, { title: 'Copied!' })) .tooltip('show'); }); return { teardown: () => {} }; }
Add tooltips to zeroclipboard buttons
Add tooltips to zeroclipboard buttons
JavaScript
mit
gmirr/www.jsdelivr.com,as-com/www.jsdelivr.com,MartinKolarik/www.jsdelivr.com,2947721120/jsdelivr.com,gmirr/www.jsdelivr.com,tomByrer/www.jsdelivr.com,2947721120/equanimous-octo-weasel,2947721120/cdn.c2cbc,tomByrer/www.jsdelivr.com,2947721120/equanimous-octo-weasel,2947721120/www.jsdelivr.com,jsdelivr/beta.jsdelivr.com,2947721120/www.jsdelivr.com,as-com/www.jsdelivr.com,gmirr/www.jsdelivr.com,algolia/www.jsdelivr.com,2947721120/cdn.c2cbc,algolia/www.jsdelivr.com,tomByrer/www.jsdelivr.com,jsdelivr/beta.jsdelivr.com,2947721120/cdn.c2cbc,2947721120/jsdelivr.com,2947721120/equanimous-octo-weasel,as-com/www.jsdelivr.com,2947721120/jsdelivr.com,jsdelivr/beta.jsdelivr.com,algolia/www.jsdelivr.com,MartinKolarik/www.jsdelivr.com,2947721120/www.jsdelivr.com,MartinKolarik/www.jsdelivr.com
--- +++ @@ -1,34 +1,28 @@ -export default function (node/*, tooltipPlacement = 'right'*/) { - /*let clip = */new ZeroClipboard(node); - /*let $node = $(node); +export default function (node, tooltipPlacement = 'top') { + let clip = new ZeroClipboard(node); + let $node = $(node); + let tooltipOptions = { + title: 'Copy to Clipboard', + placement: tooltipPlacement, + trigger: 'hover', + container: 'body', + animation: false, + }; $node .on('mouseover', () => { $node .tooltip('destroy') - .tooltip({ - title: 'Copy to Clipboard', - placement: tooltipPlacement, - trigger: 'manual', - container: 'body', - }) + .tooltip(tooltipOptions) .tooltip('show'); - }) - .on('mouseout', () => { - $node.tooltip('destroy'); }); clip.on('aftercopy', () => { $node .tooltip('destroy') - .tooltip({ - title: 'Copied!', - placement: tooltipPlacement, - trigger: 'manual', - container: 'body', - }) + .tooltip($.extend({}, tooltipOptions, { title: 'Copied!' })) .tooltip('show'); - });*/ + }); return { teardown: () => {}
66ad8904de8c07933028fb07021e3cbc9cff1764
src/c/admin-notification-history.js
src/c/admin-notification-history.js
window.c.AdminNotificationHistory = ((m, h, _, models) => { return { controller: (args) => { const notifications = m.prop([]), getNotifications = (user) => { let notification = models.notification; notification.getPageWithToken(m.postgrest.filtersVM({user_id: 'eq', sent_at: 'is.null'}).user_id(user.id).sent_at(!null).order({sent_at: 'desc'}).parameters()).then(function(data){ notifications(data); }); return notifications(); }; getNotifications(args.user); return { notifications: notifications }; }, view: (ctrl) => { return m('.w-col.w-col-4', [ m('.fontweight-semibold.fontsize-smaller.lineheight-tighter.u-marginbottom-20', 'Histórico de notificações'), ctrl.notifications().map(function(cEvent) { return m('.w-row.fontsize-smallest.lineheight-looser.date-event', [ m('.w-col.w-col-24', [ m('.fontcolor-secondary', h.momentify(cEvent.sent_at, 'DD/MM/YYYY, HH:mm'), ' - ', cEvent.template_name) ]), ]); }) ]); } }; }(window.m, window.c.h, window._, window.c.models));
window.c.AdminNotificationHistory = ((m, h, _, models) => { return { controller: (args) => { const notifications = m.prop([]), getNotifications = (user) => { let notification = models.notification; notification.getPageWithToken(m.postgrest.filtersVM({ user_id: 'eq', sent_at: 'is.null' }) .user_id(user.id) .sent_at(!null) .order({ sent_at: 'desc' }) .parameters()) .then((data) => { notifications(data); }); return notifications(); }; getNotifications(args.user); return { notifications: notifications }; }, view: (ctrl) => { return m('.w-col.w-col-4', [ m('.fontweight-semibold.fontsize-smaller.lineheight-tighter.u-marginbottom-20', 'Histórico de notificações'), ctrl.notifications().map((cEvent) => { return m('.w-row.fontsize-smallest.lineheight-looser.date-event', [ m('.w-col.w-col-24', [ m('.fontcolor-secondary', h.momentify(cEvent.sent_at, 'DD/MM/YYYY, HH:mm'), ' - ', cEvent.template_name) ]), ]); }) ]); } }; }(window.m, window.c.h, window._, window.c.models));
Fix indentation and es6 support
Fix indentation and es6 support
JavaScript
mit
thiagocatarse/catarse.js,catarse/catarse_admin,vicnicius/catarse_admin,vicnicius/catarse.js,sushant12/catarse.js,catarse/catarse.js,mikesmayer/cs2.js,adrianob/catarse.js
--- +++ @@ -4,7 +4,17 @@ const notifications = m.prop([]), getNotifications = (user) => { let notification = models.notification; - notification.getPageWithToken(m.postgrest.filtersVM({user_id: 'eq', sent_at: 'is.null'}).user_id(user.id).sent_at(!null).order({sent_at: 'desc'}).parameters()).then(function(data){ + notification.getPageWithToken(m.postgrest.filtersVM({ + user_id: 'eq', + sent_at: 'is.null' + }) + .user_id(user.id) + .sent_at(!null) + .order({ + sent_at: 'desc' + }) + .parameters()) + .then((data) => { notifications(data); }); return notifications(); @@ -20,7 +30,7 @@ view: (ctrl) => { return m('.w-col.w-col-4', [ m('.fontweight-semibold.fontsize-smaller.lineheight-tighter.u-marginbottom-20', 'Histórico de notificações'), - ctrl.notifications().map(function(cEvent) { + ctrl.notifications().map((cEvent) => { return m('.w-row.fontsize-smallest.lineheight-looser.date-event', [ m('.w-col.w-col-24', [ m('.fontcolor-secondary', h.momentify(cEvent.sent_at, 'DD/MM/YYYY, HH:mm'),
22e62634ed072b590495cdf268e08185247fdbb5
src/candela/components/Geo/index.js
src/candela/components/Geo/index.js
import geojs from 'geojs/geo.js'; import VisComponent from '../../VisComponent'; export default class Geo extends VisComponent { constructor (el, options) { super(el); this.plot = geojs.map({ node: el, zoom: 6, center: {x: 28.9550, y: 41.0136} }); this.plot.createLayer('osm'); if (options.features) { options.features.forEach(feature => { this.plot.createLayer('feature', { renderer: 'd3' }) .createFeature(feature.type) .data(feature.data) .position(d => ({ x: d[feature.x], y: d[feature.y] })); }); this.plot.draw(); } } render () { this.plot.draw(); } }
import geojs from 'geojs/geo.js'; import VisComponent from '../../VisComponent'; export default class Geo extends VisComponent { constructor (el, options) { super(el); this.plot = geojs.map({ node: el, zoom: 6, center: {x: 0, y: 0} }); this.plot.createLayer('osm', { renderer: null }); if (options.features) { options.features.forEach(feature => { this.plot.createLayer('feature', { renderer: 'd3' }) .createFeature(feature.type) .data(feature.data) .position(d => ({ x: d[feature.x], y: d[feature.y] })); }); this.plot.draw(); } } render () { this.plot.draw(); } }
Use null renderer (for ease of testing) and center at (0, 0)
Use null renderer (for ease of testing) and center at (0, 0)
JavaScript
apache-2.0
Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela
--- +++ @@ -8,9 +8,11 @@ this.plot = geojs.map({ node: el, zoom: 6, - center: {x: 28.9550, y: 41.0136} + center: {x: 0, y: 0} }); - this.plot.createLayer('osm'); + this.plot.createLayer('osm', { + renderer: null + }); if (options.features) { options.features.forEach(feature => { this.plot.createLayer('feature', {
c8d82ce73371243a3d92b961b43deed718251c69
public_html/modules/highscores/highscores.js
public_html/modules/highscores/highscores.js
// Module Route(s) DevAAC.config(['$routeProvider', function($routeProvider) { $routeProvider.when('/highscores', { // When a module contains multiple routes, use 'moduleName/viewName' in PageUrl function. templateUrl: PageUrl('highscores'), controller: 'HighscoresController', resolve: { vocations: function(Server) { return Server.vocations().$promise; } } }); }]); // Module Controller(s) DevAAC.controller('HighscoresController', ['$scope', 'Player', 'Server', 'vocations', function($scope, Player, Server, vocations) { $scope.order = 'level'; $scope.$watch('order', function(val) { $scope.loaded = false; $scope.players = Player.query({sort: '-'+val+',-level'}, function(val) { $scope.loaded = true; }); }); $scope.players = Player.query(function(val){ $scope.loaded = true; return {sort: '-'+val+',-level'}; }); $scope.vocation = function(id) { return _.findWhere(vocations, {id: id}); }; } ]);
// Module Route(s) DevAAC.config(['$routeProvider', function($routeProvider) { $routeProvider.when('/highscores', { // When a module contains multiple routes, use 'moduleName/viewName' in PageUrl function. templateUrl: PageUrl('highscores'), controller: 'HighscoresController', resolve: { vocations: function(Server) { return Server.vocations().$promise; } } }); }]); // Module Controller(s) DevAAC.controller('HighscoresController', ['$scope', 'Player', 'Server', 'vocations', function($scope, Player, Server, vocations) { $scope.order = 'level'; $scope.$watch('order', function(val) { $scope.loaded = false; $scope.players = Player.query({sort: '-'+val+',-level', limit: 100}, function(val) { $scope.loaded = true; }); }); $scope.players = Player.query(function(val){ $scope.loaded = true; return {sort: '-'+val+',-level', limit: 100}; }); $scope.vocation = function(id) { return _.findWhere(vocations, {id: id}); }; } ]);
Add limit (relevant for gods)
Add limit (relevant for gods)
JavaScript
mit
DevelopersPL/DevAAC,olszak94/DevAAC,olszak94/DevAAC,DevelopersPL/DevAAC,olszak94/DevAAC,olszak94/DevAAC,DevelopersPL/DevAAC
--- +++ @@ -18,14 +18,14 @@ $scope.order = 'level'; $scope.$watch('order', function(val) { $scope.loaded = false; - $scope.players = Player.query({sort: '-'+val+',-level'}, function(val) { + $scope.players = Player.query({sort: '-'+val+',-level', limit: 100}, function(val) { $scope.loaded = true; }); }); $scope.players = Player.query(function(val){ $scope.loaded = true; - return {sort: '-'+val+',-level'}; + return {sort: '-'+val+',-level', limit: 100}; }); $scope.vocation = function(id) {
4dbad38b98815c425d253a5fe7c4105c9850f6cb
src/templates/infinite-scroll-link.js
src/templates/infinite-scroll-link.js
import React from 'react' import Link from 'gatsby-link' export default class InfiniteScrollLink extends React.Component { constructor (props) { super(props) const observerOptions = { root: null, rootMargin: '0px', threshold: 0.25 } this.observerCallback = this.observerCallback.bind(this) this.state = { observer: new window.IntersectionObserver(this.observerCallback(props.callback || (() => {})), observerOptions) } } componentDidMount () { this.state.observer.observe(document.querySelector('#infinite-scroll-link')) } componentWillUnmount () { if (this.state.observer.unobserve instanceof Function) { this.state.observer.unobserve(document.querySelector('#infinite-scroll-link')) } } observerCallback (callback) { return () => { return callback(this.props.url) } } render () { return ( <Link id='infinite-scroll-link' to={this.props.url}> { this.props.linkName } </Link> ) } }
import React from 'react' import Link from 'gatsby-link' export default class InfiniteScrollLink extends React.Component { constructor (props) { super(props) const observerOptions = { root: null, rootMargin: '0px', threshold: 0.25 } this.observerCallback = this.observerCallback.bind(this) this.state = { observer: new window.IntersectionObserver(this.observerCallback(props.callback || (() => {})), observerOptions) } } componentDidMount () { this.state.observer.observe(document.querySelector('#infinite-scroll-link')) } componentWillUnmount () { if (this.state.observer.unobserve instanceof Function) { this.state.observer.unobserve(document.querySelector('#infinite-scroll-link')) } } observerCallback (callback) { return (entries) => { entries.forEach(entry => { if (entry.isIntersecting) { callback(this.props.url) } }) } } render () { return ( <Link id='infinite-scroll-link' to={this.props.url}> { this.props.linkName } </Link> ) } }
Call the callback function only when the target element is intersecting the root element; Avoids extra calls.
Call the callback function only when the target element is intersecting the root element; Avoids extra calls.
JavaScript
mit
LuisLoureiro/placard-wrapper
--- +++ @@ -29,8 +29,12 @@ } observerCallback (callback) { - return () => { - return callback(this.props.url) + return (entries) => { + entries.forEach(entry => { + if (entry.isIntersecting) { + callback(this.props.url) + } + }) } }
0d02b4c753001771c5ce43343b9ba2ffee067a7b
js/controllers/MenuController.js
js/controllers/MenuController.js
/** * Created by seanweppner on 8/4/16. */ app.controller('MenuController', ['$scope', function($scope) { $scope.downloadJson = function(){ console.log("Downloading"); var total_annotations = []; total_annotations = total_annotations.concat(annotation_state.prev_annotations); total_annotations.push(annotation_state.current_annotation); total_annotations = total_annotations.concat(annotation_state.next_annotations); var final_download = {}; var milliseconds = (new Date).getTime(); final_download["created"] = milliseconds; final_download["data"] = total_annotations; var something = window.open("data:text/json," + encodeURIComponent(JSON.stringify(final_download)), "_blank"); something.focus(); }; }]);
/** * Created by seanweppner on 8/4/16. */ app.controller('MenuController', ['$scope', function($scope) { $scope.downloadJson = function(){ console.log("Downloading"); var total_annotations = []; total_annotations = total_annotations.concat(annotation_state.prev_annotations); total_annotations.push(annotation_state.current_annotation); total_annotations = total_annotations.concat(annotation_state.next_annotations); var final_download = {}; var milliseconds = (new Date).getTime(); final_download["created"] = milliseconds; final_download["data"] = total_annotations; /*var something = window.open("data:text/json," + encodeURIComponent(JSON.stringify(final_download)), "_blank"); something.focus();*/ var iframe = "<iframe width='100%' height='100%' src='" + "data:text/json," + encodeURIComponent(JSON.stringify(final_download)) + "'></iframe>" var x = window.open(); x.document.open(); x.document.write(iframe); x.document.close(); }; }]);
Fix the error "Not allowed to navigate top frame to data URL"
Fix the error "Not allowed to navigate top frame to data URL" Link: https://stackoverflow.com/questions/45493234/jspdf-not-allowed-to-navigate-top-frame-to-data-url
JavaScript
agpl-3.0
sweppner/labeld,sweppner/labeld
--- +++ @@ -17,9 +17,15 @@ final_download["data"] = total_annotations; - var something = window.open("data:text/json," + encodeURIComponent(JSON.stringify(final_download)), + /*var something = window.open("data:text/json," + encodeURIComponent(JSON.stringify(final_download)), "_blank"); - something.focus(); + something.focus();*/ + + var iframe = "<iframe width='100%' height='100%' src='" + "data:text/json," + encodeURIComponent(JSON.stringify(final_download)) + "'></iframe>" + var x = window.open(); + x.document.open(); + x.document.write(iframe); + x.document.close(); };
a665caa231294586f178b946b50f972ec2b3e01f
app/javascript/app/routes/app-routes/country-sections/country-sections.js
app/javascript/app/routes/app-routes/country-sections/country-sections.js
import { createElement } from 'react'; import GHGCountryEmissions from 'components/country/country-ghg'; import NDCSDGLinkages from 'components/country/country-ndc-sdg-linkages'; import ClimateVulnerability from 'components/country/country-climate-vulnerability'; import CountryNdcOverview from 'components/country/country-ndc-overview'; export default [ { hash: 'ghg-emissions', label: 'GHG Emissions', anchor: true, component: GHGCountryEmissions }, { hash: 'climate-vulnerability', label: 'Climate Vulnerability and Readiness', anchor: true, component: ClimateVulnerability }, { hash: 'ndc-content-overview', label: 'NDC Content Overview', anchor: true, component: () => createElement(CountryNdcOverview, { actions: true }) }, { hash: 'ndc-sdg-linkages', label: 'NDC-SDG Linkages', anchor: true, component: NDCSDGLinkages } ];
import { createElement } from 'react'; import GHGCountryEmissions from 'components/country/country-ghg'; import NDCSDGLinkages from 'components/country/country-ndc-sdg-linkages'; import ClimateVulnerability from 'components/country/country-climate-vulnerability'; import CountryNdcOverview from 'components/country/country-ndc-overview'; import LawsAndPolicies from 'components/country/laws-and-policies'; export default [ { hash: 'ghg-emissions', label: 'GHG Emissions', anchor: true, component: GHGCountryEmissions }, { hash: 'climate-vulnerability', label: 'Climate Vulnerability and Readiness', anchor: true, component: ClimateVulnerability }, { hash: 'ndc-content-overview', label: 'NDC Content Overview', anchor: true, component: () => createElement(CountryNdcOverview, { actions: true }) }, { hash: 'ndc-sdg-linkages', label: 'NDC-SDG Linkages', anchor: true, component: NDCSDGLinkages }, { hash: 'laws-and-policies', label: 'Laws and Policies', anchor: true, component: LawsAndPolicies } ];
Add Laws and Policies to country sections routes
Add Laws and Policies to country sections routes
JavaScript
mit
Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch
--- +++ @@ -4,6 +4,7 @@ import NDCSDGLinkages from 'components/country/country-ndc-sdg-linkages'; import ClimateVulnerability from 'components/country/country-climate-vulnerability'; import CountryNdcOverview from 'components/country/country-ndc-overview'; +import LawsAndPolicies from 'components/country/laws-and-policies'; export default [ { @@ -29,5 +30,11 @@ label: 'NDC-SDG Linkages', anchor: true, component: NDCSDGLinkages + }, + { + hash: 'laws-and-policies', + label: 'Laws and Policies', + anchor: true, + component: LawsAndPolicies } ];
4d1cd59b6678bda00f8c1a0f5c9ab074324f236d
lib/filters/load_current_user.js
lib/filters/load_current_user.js
"use strict"; /*global nodeca, _*/ var me_in_fields = [ '_uname', 'locale' ]; // fetch current user info // fired before each controllers nodeca.filters.before('', { weight: -70 }, function load_current_user(params, next) { var env = this; // // fill in default (guest) values // env.current_user = null; env.runtime.user_name = ''; env.runtime.is_member = false; env.runtime.is_guest = true; // // if there's no session or session has no user_id, user is guest - skip // if (!env.session || !env.session.user_id) { next(); return; } nodeca.models.users.User .findOne({ '_id': env.session.user_id }) .select(me_in_fields.join(' ')) .setOptions({ lean: true }) .exec(function(err, user){ if (err) { next(err); return; } // user in session, but db does not know this user if (!user) { next(); return; } env.current_user = user; env.runtime.user_name = user._uname; env.runtime.is_guest = false; env.runtime.is_member = true; // set user's locale env.session.locale = user.locale || env.session.locale; next(); }); });
"use strict"; /*global nodeca, _*/ var me_in_fields = [ '_uname', 'locale' ]; // fetch current user info // fired before each controllers nodeca.filters.before('', { weight: -70 }, function load_current_user(params, next) { var env = this; // // fill in default (guest) values // env.current_user = null; env.runtime.user_name = ''; env.runtime.is_member = false; env.runtime.is_guest = true; // // if there's no session or session has no user_id, user is guest - skip // if (!env.session || !env.session.user_id) { next(); return; } nodeca.models.users.User .findOne({ '_id': env.session.user_id }) .select(me_in_fields.join(' ')) .setOptions({ lean: true }) .exec(function(err, user){ if (err) { next(err); return; } // user in session, but db does not know this user if (!user) { next(); return; } env.current_user = user; env.runtime.user_name = user._uname; env.runtime.is_guest = false; env.runtime.is_member = true; // set user's locale if (user.locale) { env.session.locale = user.locale; } next(); }); });
Use if instead of inline alternatives
Use if instead of inline alternatives
JavaScript
mit
nodeca/nodeca.users
--- +++ @@ -55,7 +55,9 @@ env.runtime.is_member = true; // set user's locale - env.session.locale = user.locale || env.session.locale; + if (user.locale) { + env.session.locale = user.locale; + } next(); });
304ab70218d01ca6f316ffaefb85ce8d3a67dff1
test/jsonFileConfigurationProvider.js
test/jsonFileConfigurationProvider.js
import test from 'ava'; import path from 'path'; import JsonFileConfigurationProvider from '../src/lib/jsonFileConfigurationProvider'; test('Constructor should throw for missing filePath', t => { t.throws( () => new JsonFileConfigurationProvider(), 'filePath must be provided.'); }); test('Configuration should set filePath', t => { const testFilePath = 'test.json'; const provider = new JsonFileConfigurationProvider(testFilePath); t.is(provider.filePath, testFilePath); }); test('getConfiguration should throw if file does not exist', t => { const testFilePath = 'test.json'; const provider = new JsonFileConfigurationProvider(testFilePath); t.throws(() => provider.getConfiguration(), /ENOENT: no such file or directory/); }); test('getConfiguration should throw for invalid JSON', t => { const testFilePath = path.resolve(__dirname, '../test/fixtures/invalidConfiguration.json'); const provider = new JsonFileConfigurationProvider(testFilePath); t.throws(() => provider.getConfiguration(), 'Unexpected token T'); }); test('getConfiguration should return expected configuration when valid JSON', t => { const testFilePath = path.resolve(__dirname, '../test/fixtures/validConfiguration.json'); const provider = new JsonFileConfigurationProvider(testFilePath); const configuration = provider.getConfiguration(); t.is(configuration.analyzers.length, 1); t.is(configuration.analyzers[0], 'spelling'); t.is(configuration.rules['spelling-error'], 'error'); });
import test from 'ava'; import path from 'path'; import JsonFileConfigurationProvider from '../src/lib/jsonFileConfigurationProvider'; test('Constructor should throw for missing filePath', t => { t.throws( () => new JsonFileConfigurationProvider(), 'filePath must be provided.'); }); test('Configuration should set filePath', t => { const testFilePath = 'test.json'; const provider = new JsonFileConfigurationProvider(testFilePath); t.is(provider.filePath, testFilePath); }); test('getConfiguration should throw if file does not exist', t => { const testFilePath = 'test.json'; const provider = new JsonFileConfigurationProvider(testFilePath); t.throws(() => provider.getConfiguration(), /ENOENT: no such file or directory/); }); test('getConfiguration should throw for invalid JSON', t => { const testFilePath = path.resolve(__dirname, '../test/fixtures/invalidConfiguration.json'); const provider = new JsonFileConfigurationProvider(testFilePath); t.throws(() => provider.getConfiguration(), /Unexpected token T/); }); test('getConfiguration should return expected configuration when valid JSON', t => { const testFilePath = path.resolve(__dirname, '../test/fixtures/validConfiguration.json'); const provider = new JsonFileConfigurationProvider(testFilePath); const configuration = provider.getConfiguration(); t.is(configuration.analyzers.length, 1); t.is(configuration.analyzers[0], 'spelling'); t.is(configuration.rules['spelling-error'], 'error'); });
Update test to support Node.js 6.1.0
Update test to support Node.js 6.1.0
JavaScript
mit
ritterim/markdown-proofing
--- +++ @@ -30,7 +30,7 @@ const provider = new JsonFileConfigurationProvider(testFilePath); - t.throws(() => provider.getConfiguration(), 'Unexpected token T'); + t.throws(() => provider.getConfiguration(), /Unexpected token T/); }); test('getConfiguration should return expected configuration when valid JSON', t => {
50981dff1c92c9f217bbf3b20ca175fe6462825e
src/server/app.js
src/server/app.js
/** * Module dependencies. */ var express = require('express'); var unminify = require('./lib/unminify'); var path = require('path'); var app = module.exports = express(); app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('change this value to something unique')); app.use(express.cookieSession()); app.use(unminify(app)); app.use(express.static(path.join(__dirname, '../../dist'))); app.use(express.static(path.join(__dirname, '../public'))); app.use(express.compress()); app.use(app.router); if ('development' === app.get('env')) { app.use(express.errorHandler()); } app.get('/api/package', function(req, res) { res.send(require('../../package.json')); });
/** * Module dependencies. */ var express = require('express'); var unminify = require('./lib/unminify'); var path = require('path'); var app = module.exports = express(); app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('change this value to something unique')); app.use(express.cookieSession()); app.use(unminify(app)); app.use(express.static(path.join(__dirname, '../../dist'))); app.use(express.compress()); app.use(app.router); if ('development' === app.get('env')) { app.use(express.errorHandler()); } app.get('/api/package', function(req, res) { res.send(require('../../package.json')); });
Remove static service of public (dist is only output)
Remove static service of public (dist is only output)
JavaScript
mit
ericclemmons/genesis-skeleton,ericclemmons/genesis-skeleton,genesis/angular,brettshollenberger/mrl001,ericclemmons/genesis-skeleton.com,genesis/angular,ericclemmons/ericclemmons.github.io,ericclemmons/ericclemmons.github.io,brettshollenberger/mrl001
--- +++ @@ -18,7 +18,6 @@ app.use(express.cookieSession()); app.use(unminify(app)); app.use(express.static(path.join(__dirname, '../../dist'))); -app.use(express.static(path.join(__dirname, '../public'))); app.use(express.compress()); app.use(app.router);
515f92e5a612830ee46eab44e0a387df6025efa2
src/components/encrypt/EncryptKeyListItem.js
src/components/encrypt/EncryptKeyListItem.js
'use strict'; import React, { Component } from 'react'; import ReactCSS from 'reactcss'; import { User } from '../common/index'; import colors from '../../styles/variables/colors'; import { spacing, sizing } from '../../styles/variables/utils'; class EncryptKeyListItem extends Component { classes() { return { 'default': { user: { padding: `${spacing.m}px ${spacing.m}px ${spacing.m}px`, display: 'flex', }, spaceLine: { borderBottom: `solid 1px ${colors.offBgLight}`, margin: `0px ${spacing.m}px 0px ${spacing.m + sizing.avatar + spacing.s}px`, item: 1, }, }, }; } render() { return <div></div>; } } export default ReactCSS(EncryptKeyListItem);
'use strict'; import React, { Component } from 'react'; import ReactCSS from 'reactcss'; import { User } from '../common/index'; import colors from '../../styles/variables/colors'; import { spacing, sizing } from '../../styles/variables/utils'; class EncryptKeyListItem extends Component { classes() { return { 'default': { user: { padding: `${spacing.m}px ${spacing.m}px ${spacing.m}px`, display: 'flex', }, spaceLine: { borderBottom: `solid 1px ${colors.offBgLight}`, margin: `0px ${spacing.m}px 0px ${spacing.m + sizing.avatar + spacing.s}px`, item: 1, }, }, }; } render() { return <div> <div is="user"> <User name={ this.props.name } /> </div> <div is="spaceLine"/> </div>; } } export default ReactCSS(EncryptKeyListItem);
Add encrypt key list item jsx
Add encrypt key list item jsx
JavaScript
mit
tobycyanide/felony,henryboldi/felony,henryboldi/felony,tobycyanide/felony
--- +++ @@ -26,7 +26,12 @@ } render() { - return <div></div>; + return <div> + <div is="user"> + <User name={ this.props.name } /> + </div> + <div is="spaceLine"/> + </div>; } }
21f02b826a85f1f61afe4b90f1fe02885a2f5cb6
src/tracker/Σ.js
src/tracker/Σ.js
/* execution */
DISCORD.setupMessageRequestHook((channel, messages) => { if (STATE.isTracking()){ var info = DISCORD.getSelectedChannel(); if (info.id == channel){ // Discord has a bug where the message request may be sent without switching channels STATE.addDiscordChannel(info.server, info.type, channel, info.channel); STATE.addDiscordMessages(channel, messages); } } }); GUI.showController(); GUI.showSettings();
Implement execution code with basic message tracking and GUI display
Implement execution code with basic message tracking and GUI display
JavaScript
mit
chylex/Discord-History-Tracker,chylex/Discord-History-Tracker,chylex/Discord-History-Tracker,chylex/Discord-History-Tracker,chylex/Discord-History-Tracker,chylex/Discord-History-Tracker
--- +++ @@ -1 +1,13 @@ -/* execution */ +DISCORD.setupMessageRequestHook((channel, messages) => { + if (STATE.isTracking()){ + var info = DISCORD.getSelectedChannel(); + + if (info.id == channel){ // Discord has a bug where the message request may be sent without switching channels + STATE.addDiscordChannel(info.server, info.type, channel, info.channel); + STATE.addDiscordMessages(channel, messages); + } + } +}); + +GUI.showController(); +GUI.showSettings();
f40788e699ee58a65d9d64559a0afbe4b2c6a003
tests/unit/components/app/todos.spec.js
tests/unit/components/app/todos.spec.js
import React from 'react'; import ReactDOM from 'react-dom'; import { Simulate } from 'react-addons-test-utils'; import { render } from '../../../helpers/rendering.js'; import $ from 'jquery'; import App, { TodoList } from './setup.js'; const ENTER = 13; describe('App', function() { describe('adding new todos', function() { let $component; beforeEach(function() { const component = render(<App />); $component = $(ReactDOM.findDOMNode(component)); }); it('should update the new todo input field when typing', function() { const node = $component.find('.new-todo')[0]; Simulate.change(node, { target: { value: 'buy milk' } }); expect($(node).val()).to.equal('buy milk'); }); it('should render a todo when pressing the enter key', function() { addTodo($component, 'buy milk'); expect(TodoList).to.have.been.renderedWith({ todos: [{ title: 'buy milk' }] }); }); it('should trim whitespace from new todos', function() { addTodo($component, ' buy milk '); expect(TodoList).to.have.been.renderedWith({ todos: [{ title: 'buy milk' }] }); }); }); }); function addTodo($component, todo) { const node = $component.find('.new-todo')[0]; Simulate.change(node, { target: { value: todo } }); Simulate.keyDown(node, { keyCode: ENTER }); }
import React from 'react'; import ReactDOM from 'react-dom'; import { Simulate } from 'react-addons-test-utils'; import { render } from '../../../helpers/rendering.js'; import $ from 'jquery'; import App, { TodoList } from './setup.js'; const ENTER = 13; describe('App', function() { describe('adding new todos', function() { let $component; beforeEach(function() { const component = render(<App />); $component = $(ReactDOM.findDOMNode(component)); }); it('should update the new todo input field when typing', function() { const node = $component.find('.new-todo')[0]; Simulate.change(node, { target: { value: 'buy milk' } }); expect($(node).val()).to.equal('buy milk'); }); it('should render a todo when pressing the enter key', function() { addTodo($component, 'buy milk'); expect(TodoList).to.have.been.renderedWith({ todos: [{ title: 'buy milk' }] }); }); it('should trim whitespace from new todos', function() { addTodo($component, ' wash car '); expect(TodoList).to.have.been.renderedWith({ todos: [{ title: 'wash car' }] }); }); }); }); function addTodo($component, todo) { const node = $component.find('.new-todo')[0]; Simulate.change(node, { target: { value: todo } }); Simulate.keyDown(node, { keyCode: ENTER }); }
Use different values between tests
Use different values between tests
JavaScript
mit
NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet
--- +++ @@ -35,10 +35,10 @@ }); it('should trim whitespace from new todos', function() { - addTodo($component, ' buy milk '); + addTodo($component, ' wash car '); expect(TodoList).to.have.been.renderedWith({ - todos: [{ title: 'buy milk' }] + todos: [{ title: 'wash car' }] }); }); });
8484529a2299cbbf62e41a8cd0973f01738170e7
tests/unit/serializers/customer-test.js
tests/unit/serializers/customer-test.js
import { moduleFor, test } from 'ember-qunit'; moduleFor('serializer:customer', { // Specify the other units that are required for this test. // needs: ['serializer:foo'] }); test('it exists', function(assert) { var serializer = this.subject(); assert.ok(serializer); });
import { moduleFor, test } from 'ember-qunit'; moduleFor('serializer:customer', { // Specify the other units that are required for this test. // needs: ['serializer:foo'] }); test('it is set up with embedded:always style for the addresses relation', function(assert) { var serializer = this.subject(); assert.ok(serializer.hasEmbeddedAlwaysOption('addresses'), 'addresses relation is not set up with embedded:always style'); });
Set up a more reasonable unit test.
Set up a more reasonable unit test. It is green already, yahoo! Need to set up a negative test also I think.
JavaScript
mit
tchak/ember-offline-adapter,Flexberry/ember-localforage-adapter,sebweaver/ember-localforage-adapter,sebweaver/ember-localforage-adapter,igorrKurr/ember-localforage-adapter,tchak/ember-offline-adapter,Flexberry/ember-localforage-adapter,igorrKurr/ember-localforage-adapter
--- +++ @@ -8,7 +8,7 @@ // needs: ['serializer:foo'] }); -test('it exists', function(assert) { +test('it is set up with embedded:always style for the addresses relation', function(assert) { var serializer = this.subject(); - assert.ok(serializer); + assert.ok(serializer.hasEmbeddedAlwaysOption('addresses'), 'addresses relation is not set up with embedded:always style'); });
2a7c3c06230bc9b998f6daa3dbf4ae64b9d1c6ec
server/src/api/v1/signUp/signUpController.js
server/src/api/v1/signUp/signUpController.js
'use strict'; import jwt from 'jwt-simple'; import { userModel } from '../../../models/index'; import { secret } from '../../../config/config'; import { buildResponse } from '../../../utils/responseService'; export const saveUser = (req, res) => { userModel.findOne({name: req.body.name}) .then(user => { if (user) { buildResponse(400, 'That name is already taken', res); } else { const user = new userModel({ name: req.body.name, fullname: req.body.fullname, password: req.body.password, initials: req.body.initials, email: req.body.email }); return user.save(); } }) .then(user => buildResponse(200, jwt.encode(user._id, secret), res)) .catch(err => buildResponse(500, err, res)); };
'use strict'; import jwt from 'jwt-simple'; import { userModel } from '../../../models/index'; import { secret } from '../../../config/config'; import { buildResponse } from '../../../utils/responseService'; export const saveUser = (req, res) => { userModel.findOne({name: req.body.name}) .then(user => { if (user) { throw new Error('That name is already taken'); } else { const user = new userModel({ name: req.body.name, fullname: req.body.fullname, password: req.body.password, initials: req.body.initials, email: req.body.email }); return user.save(); } }) .then(user => buildResponse(200, jwt.encode(user._id, secret), res)) .catch(err => buildResponse(500, err.message, res)); };
Fix the error message when the name is taken
Fix the error message when the name is taken
JavaScript
mit
Madmous/madClones,Madmous/Trello-Clone,Madmous/madClones,Madmous/madClones,Madmous/Trello-Clone,Madmous/Trello-Clone,Madmous/madClones
--- +++ @@ -11,7 +11,7 @@ userModel.findOne({name: req.body.name}) .then(user => { if (user) { - buildResponse(400, 'That name is already taken', res); + throw new Error('That name is already taken'); } else { const user = new userModel({ name: req.body.name, @@ -25,5 +25,5 @@ } }) .then(user => buildResponse(200, jwt.encode(user._id, secret), res)) - .catch(err => buildResponse(500, err, res)); + .catch(err => buildResponse(500, err.message, res)); };
1fed2405d36df7d0b7fb74b2f9b7275427aaeb77
src/components/BenefitsProgramsList.react.js
src/components/BenefitsProgramsList.react.js
"use strict"; import React, { Component } from 'react'; // Bootstrap export default class BenefitsList extends Component { componentDidMount(){ $.get('/api/v1/programs', function(result){ this.setState({ programs: result }); console.log(result); }.bind(this)); } constructor(props) { super(props); } render(){ return( <div className='BenefitsList'> <ul> {this.state.programs.map(function(program){ return( <div>{program.program_name}</div> ); }, this)} </ul> </div> ); } }
"use strict"; import React, { Component } from 'react'; // Bootstrap export default class BenefitsList extends Component { constructor(props) { super(props); this.state = { programs: [] }; } componentDidMount(){ $.get('/api/v1/programs', function(result){ this.setState({ programs: result }); }.bind(this)); } render(){ return( <div className='BenefitsList'> <ul> {this.state.programs.map(function(program, i){ return( <div key={i}>{program.program_name}</div> ); }, this)} </ul> </div> ); } }
Fix error where componentdidmount didn't load fast enough and caused a crash at render
Fix error where componentdidmount didn't load fast enough and caused a crash at render
JavaScript
mit
codeforamerica/nyc-january-project,codeforamerica/nyc-january-project
--- +++ @@ -4,26 +4,28 @@ // Bootstrap export default class BenefitsList extends Component { + constructor(props) { + super(props); + this.state = { + programs: [] + }; + } componentDidMount(){ $.get('/api/v1/programs', function(result){ this.setState({ programs: result }); - console.log(result); }.bind(this)); } - constructor(props) { - super(props); - } render(){ return( <div className='BenefitsList'> <ul> - {this.state.programs.map(function(program){ + {this.state.programs.map(function(program, i){ return( - <div>{program.program_name}</div> + <div key={i}>{program.program_name}</div> ); }, this)} </ul>
0d4d867d771107644b6f826503a870c1389ab941
webpack.config.js
webpack.config.js
const path = require('path'); module.exports = { entry: { app: path.resolve(__dirname, 'app/Resources/assets/js/app.js') }, output: { path: path.resolve(__dirname, 'web/builds'), filename: 'bundle.js', publicPath: '/builds/' }, module: { rules: [ { test: /\.js$/, exclude: /(node_modules)/, use: 'babel-loader' }, { test: /\.scss$/, use: [ { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" } ] }, { test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/, use: "url-loader" } ] }, resolve: { alias: { fonts: path.resolve(__dirname, 'web/fonts') } } };
const path = require('path'); const webpack = require('webpack'); module.exports = { entry: { app: path.resolve(__dirname, 'app/Resources/assets/js/app.js') }, output: { path: path.resolve(__dirname, 'web/builds'), filename: 'bundle.js', publicPath: '/builds/' }, module: { rules: [ { test: /\.js$/, exclude: /(node_modules)/, use: 'babel-loader' }, { test: /\.scss$/, use: [ { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" } ] }, { test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/, use: "url-loader" } ] }, plugins: [ new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery", }), ], resolve: { alias: { fonts: path.resolve(__dirname, 'web/fonts'), jquery: path.resolve(__dirname, 'app/Resources/assets/js/jquery-2.1.4.min.js') } } };
Fix module not found error on jQuery
Fix module not found error on jQuery
JavaScript
mit
alOneh/sf-live-2017-symfony-webpack,alOneh/sf-live-2017-symfony-webpack,alOneh/sf-live-2017-symfony-webpack
--- +++ @@ -1,4 +1,5 @@ const path = require('path'); +const webpack = require('webpack'); module.exports = { entry: { @@ -30,9 +31,17 @@ } ] }, + plugins: [ + new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery", + "window.jQuery": "jquery", + }), + ], resolve: { alias: { - fonts: path.resolve(__dirname, 'web/fonts') + fonts: path.resolve(__dirname, 'web/fonts'), + jquery: path.resolve(__dirname, 'app/Resources/assets/js/jquery-2.1.4.min.js') } } };
6b0d96ffe9ddd31fdb4ad8cd7923af0e2d2420e6
webpack.config.js
webpack.config.js
var debug = process.env.NODE_ENV !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { context: path.join(__dirname, "src"), devtool: debug ? "inline-sourcemap" : null, entry: "./js/app.js", module: { loaders: [ { test: /\.jsx?$/, exclude: /(node_modules|bower_components)/, loader: 'babel-loader', query: { presets: ['react', 'es2015', 'stage-0'], plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'], } } ] }, output: { path: __dirname + "/src/", filename: "bundle.js" }, plugins: debug ? [] : [ new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), ], };
var debug = process.env.NODE_ENV !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { context: path.join(__dirname, "src"), devtool: debug ? "inline-sourcemap" : null, entry: "./js/app.js", module: { loaders: [ { test: /\.jsx?$/, exclude: /(node_modules|bower_components)/, loader: 'babel-loader', query: { presets: ['react', 'es2015', 'stage-0'], plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'], } } ] }, output: { path: __dirname + "/src/", filename: "bundle.js" }, plugins: debug ? [] : [ new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }), new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), ], };
Add process.env inside plugins to react understand that we are at production env
Add process.env inside plugins to react understand that we are at production env
JavaScript
mit
afonsopacifer/react-pomodoro,afonsopacifer/react-pomodoro
--- +++ @@ -24,6 +24,11 @@ filename: "bundle.js" }, plugins: debug ? [] : [ + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + } + }), new webpack.optimize.DedupePlugin(), new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
84854f6764b38b445476fb80bb7ae131ca0a8705
webpack.config.js
webpack.config.js
var path = require('path'); var webpack = require('webpack'); module.exports = { entry: './scripts/main.js', output: { path: __dirname, filename: 'bundle.js' }, module: { loaders: [ { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, query: { presets: ['es2015', 'react'] } } ] }, devServer: { historyApiFallback: true } };
var path = require('path'); var webpack = require('webpack'); module.exports = { entry: './scripts/main.js', output: { path: __dirname, filename: 'bundle.js' }, module: { loaders: [ { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, query: { presets: ['es2015', 'react'] } } ] }, /* plugins: [ new webpack.optimize.UglifyJsPlugin({ sourceMap: false, mangle: false }) ],*/ devServer: { historyApiFallback: true } };
Comment out uglify plugin for webpack.
Style: Comment out uglify plugin for webpack.
JavaScript
mit
teamhacksmiths/food-drivr-frontend,teamhacksmiths/food-drivr-frontend
--- +++ @@ -16,6 +16,12 @@ } ] }, +/* plugins: [ + new webpack.optimize.UglifyJsPlugin({ + sourceMap: false, + mangle: false + }) + ],*/ devServer: { historyApiFallback: true }
66ae258fe078e4667db8024ea285b6891e6c79b9
jquery.equal-height.js
jquery.equal-height.js
jQuery.fn.equalHeight = function() { var $ = jQuery; var that = this; var setHeights = function() { var elems = {}; var cont = $(that); // Reset the elements heights cont.each(function() { $(this).height(''); }); // Create a mapping of elements and the max height for all elements at that top offset cont.each(function() { var t = $(this).offset().top; if (typeof elems[t] == "undefined") elems[t] = {maxHeight: 0, e: []}; elems[t].e.push($(this)); elems[t].maxHeight = Math.max($(this).outerHeight(), elems[t].maxHeight); }); // Apply the max height to all elements in each offset class for (t in elems) { var mh = elems[t].maxHeight; for (i in elems[t].e) { var e = elems[t].e[i]; var padding = e.outerHeight() - e.height(); e.height(mh - padding); } } } setHeights(); setTimeout(setHeights, 100); // Set heights after page elements have rendered, is there a more elegant way to do this? $(window).resize(setHeights); }
if (typeof jQuery === 'undefined') { throw new Error('The jQuery equal height extension requires jQuery!'); } jQuery.fn.equalHeight = function() { var $ = jQuery; var that = this; var setHeights = function() { var elems = {}; var cont = $(that); // Reset the elements heights cont.each(function() { $(this).height(''); }); // Create a mapping of elements and the max height for all elements at that top offset cont.each(function() { var t = $(this).offset().top; if (typeof elems[t] == "undefined") elems[t] = {maxHeight: 0, e: []}; elems[t].e.push($(this)); elems[t].maxHeight = Math.max($(this).outerHeight(), elems[t].maxHeight); }); // Apply the max height to all elements in each offset class for (var t in elems) { var mh = elems[t].maxHeight; for (var i in elems[t].e) { var e = elems[t].e[i]; var padding = e.outerHeight() - e.height(); e.height(mh - padding); } } } setHeights(); setTimeout(setHeights, 100); // Set heights after page elements have rendered, is there a more elegant way to do this? $(window).resize(setHeights); };
Check jQuery dependency, minor syntax adjustments
Check jQuery dependency, minor syntax adjustments
JavaScript
mit
Nikker/jquery-equal-height,Nikker/jquery.equal-height
--- +++ @@ -1,3 +1,7 @@ +if (typeof jQuery === 'undefined') { + throw new Error('The jQuery equal height extension requires jQuery!'); +} + jQuery.fn.equalHeight = function() { var $ = jQuery; @@ -21,9 +25,9 @@ }); // Apply the max height to all elements in each offset class - for (t in elems) { + for (var t in elems) { var mh = elems[t].maxHeight; - for (i in elems[t].e) { + for (var i in elems[t].e) { var e = elems[t].e[i]; var padding = e.outerHeight() - e.height(); e.height(mh - padding); @@ -34,4 +38,4 @@ setHeights(); setTimeout(setHeights, 100); // Set heights after page elements have rendered, is there a more elegant way to do this? $(window).resize(setHeights); -} +};
e626fee9561d12c5c562c89470f5167e929f1c91
js/requirejs.config.js
js/requirejs.config.js
requirejs.config({ "paths": { // requireJS plugins "text": "../external/requirejs/plugins/text", "json": "../external/requirejs/plugins/json" }, "shim": { "jquery.hashchange": { deps: [ "jquery" ] }, "jquery.ui.widget": { deps: [ "jquery" ], exports: "$.widget" }, "widgets/jquery.ui.tabs": { deps: [ "jquery.ui.widget" ] }, "widgets/jquery.ui.core": { deps: [ "jquery" ], exports: [ "$.ui" ] } } });
requirejs.config({ "paths": { // requireJS plugins "text": "../external/requirejs/plugins/text", "json": "../external/requirejs/plugins/json" }, "shim": { "jquery.hashchange": [ "jquery" ], "jquery.ui.widget": [ "jquery" ], "widgets/jquery.ui.tabs": [ "jquery.ui.widget" ], "widgets/jquery.ui.core": [ "jquery" ] } });
Use short syntax for RequireJS' shims
Build: Use short syntax for RequireJS' shims We don't need to export anything, just express dependencies of the non-AMD modules.
JavaScript
mit
hinaloe/jqm-demo-ja,arschmitz/jquery-mobile,arschmitz/jquery-mobile,arschmitz/uglymongrel-jquery-mobile,hinaloe/jqm-demo-ja,arschmitz/uglymongrel-jquery-mobile,hinaloe/jqm-demo-ja,arschmitz/uglymongrel-jquery-mobile,arschmitz/jquery-mobile
--- +++ @@ -5,19 +5,9 @@ "json": "../external/requirejs/plugins/json" }, "shim": { - "jquery.hashchange": { - deps: [ "jquery" ] - }, - "jquery.ui.widget": { - deps: [ "jquery" ], - exports: "$.widget" - }, - "widgets/jquery.ui.tabs": { - deps: [ "jquery.ui.widget" ] - }, - "widgets/jquery.ui.core": { - deps: [ "jquery" ], - exports: [ "$.ui" ] - } + "jquery.hashchange": [ "jquery" ], + "jquery.ui.widget": [ "jquery" ], + "widgets/jquery.ui.tabs": [ "jquery.ui.widget" ], + "widgets/jquery.ui.core": [ "jquery" ] } });
c1d182105693a4ce10ce0f2c4aa038456898eb61
logic/campaign/campaignModelCheckerLogic.js
logic/campaign/campaignModelCheckerLogic.js
var configuration = require('../../config/configuration.json') var utility = require('../../public/method/utility') module.exports = { checkCampaignModel: function (redisClient, accountHashID, payload, callback) { var begTime = utility.getUnixTimeStamp() - configuration.MinimumDelay var endTime = utility.getUnixTimeStamp() + configuration.MinimumDeuration var tableName = configuration.TableMAAccountModelAnnouncerAccountModel + accountHashID redisClient.hget(tableName, configuration.ConstantAMAAMBudget, function (err, replies) { if (err) { callback(err, null) return } if (parseInt(payload[configuration.ConstantCMBudget]) <= parseInt(replies)) { // First Check Pass if (parseInt(payload[configuration.ConstantCMBeginningTime]) >= begTime) { // Second Check Pass if (parseInt(payload[configuration.ConstantCMEndingTime]) >= endTime) { // Third Check Pass callback(null, 'Successful Check') } else { callback(new Error('Ending Time Problem'), null) return } } else { callback(new Error('Beginning Time Problem'), null) return } } else { callback(new Error('Budget Problem'), null) return } }) }, } }
var configuration = require('../../config/configuration.json') var utility = require('../../public/method/utility') module.exports = { checkCampaignModel: function (redisClient, accountHashID, payload, callback) { var begTime = utility.getUnixTimeStamp() - configuration.MinimumDelay var endTime = utility.getUnixTimeStamp() + configuration.MinimumDeuration var tableName = configuration.TableMAAccountModelAnnouncerAccountModel + accountHashID redisClient.hget(tableName, configuration.ConstantAMAAMBudget, function (err, replies) { if (err) { callback(err, null) return } if (parseInt(payload[configuration.ConstantCMBudget]) <= parseInt(replies)) { // First Check Pass if (parseInt(payload[configuration.ConstantCMBeginningTime]) >= begTime) { // Second Check Pass if (parseInt(payload[configuration.ConstantCMEndingTime]) >= endTime) { // Third Check Pass callback(null, 'Successful Check') } else { callback(new Error('Ending Time Problem'), null) return } } else { callback(new Error('Beginning Time Problem'), null) return } } else { callback(new Error('Budget Problem'), null) return } }) }, checkCampaignModelForExistence: function (redisClient, accountHashID, campaignHashID, callback) { var tableName = configuration.TableMSAccountModelCampaignModel + accountHashID redisClient.zscore(tableName, campaignHashID, function (err, replies) { if (err) { callback(err, null) return } if (replies == null || replies == undefined) callback(new Error(configuration.message.campaign.notExist), null) else callback(null, configuration.message.campaign.exist) }) } }
Check Campaign Existence for Delete/Set/Get Purposes
Check Campaign Existence for Delete/Set/Get Purposes
JavaScript
mit
Flieral/Announcer-Service,Flieral/Announcer-Service
--- +++ @@ -36,5 +36,17 @@ }) }, + checkCampaignModelForExistence: function (redisClient, accountHashID, campaignHashID, callback) { + var tableName = configuration.TableMSAccountModelCampaignModel + accountHashID + redisClient.zscore(tableName, campaignHashID, function (err, replies) { + if (err) { + callback(err, null) + return + } + if (replies == null || replies == undefined) + callback(new Error(configuration.message.campaign.notExist), null) + else + callback(null, configuration.message.campaign.exist) + }) } }
8b1a0f07592fbedad69a4f67ee3c286b8de4a9d7
client/app/controllers/boltController.js
client/app/controllers/boltController.js
angular.module('bolt.controller', []) .controller('BoltController', function($scope, Geo){ $scope.currentCoords = { lat: null, lng: null }; $scope.getCurrentCoords = function() { console.log('ran'); Geo.getCurrentCoords(function(coordsObj) { $scope.currentCoords = coordsObj; console.log('$scope.currentCoords.lat: ', $scope.currentCoords.lat); console.log('$scope.currentCoords.lng: ', $scope.currentCoords.lng); }); }; // setInterval($scope.getCurrentCoords, 500); })
angular.module('bolt.controller', []) .controller('BoltController', function($scope, Geo){ $scope.currentCoords = { lat: null, lng: null }; // $scope.getCurrentCoords = function() { // console.log('ran'); // Geo.getCurrentCoords(function(coordsObj) { // $scope.currentCoords = coordsObj; // console.log('$scope.currentCoords.lat: ', $scope.currentCoords.lat); // console.log('$scope.currentCoords.lng: ', $scope.currentCoords.lng); // }); // }; $scope.makeInitialMap = function() { console.log('in controller'); Geo.makeInitialMap(); }; $scope.makeInitialMap(); $scope.updateCurrentPosition = function() { Geo.updateCurrentPosition(); }; setInterval($scope.updateCurrentPosition, 1000); })
Add functionality to update current position marker
Add functionality to update current position marker
JavaScript
mit
thomasRhoffmann/Bolt,boisterousSplash/Bolt,elliotaplant/Bolt,thomasRhoffmann/Bolt,gm758/Bolt,gm758/Bolt,elliotaplant/Bolt,boisterousSplash/Bolt
--- +++ @@ -5,14 +5,25 @@ lat: null, lng: null }; - $scope.getCurrentCoords = function() { - console.log('ran'); - Geo.getCurrentCoords(function(coordsObj) { - $scope.currentCoords = coordsObj; - console.log('$scope.currentCoords.lat: ', $scope.currentCoords.lat); - console.log('$scope.currentCoords.lng: ', $scope.currentCoords.lng); - }); + // $scope.getCurrentCoords = function() { + // console.log('ran'); + // Geo.getCurrentCoords(function(coordsObj) { + // $scope.currentCoords = coordsObj; + // console.log('$scope.currentCoords.lat: ', $scope.currentCoords.lat); + // console.log('$scope.currentCoords.lng: ', $scope.currentCoords.lng); + // }); + // }; + + $scope.makeInitialMap = function() { + console.log('in controller'); + Geo.makeInitialMap(); }; - // setInterval($scope.getCurrentCoords, 500); + $scope.makeInitialMap(); + + $scope.updateCurrentPosition = function() { + Geo.updateCurrentPosition(); + }; + + setInterval($scope.updateCurrentPosition, 1000); })
1ca12907f56ea381d81eec98095a87a573f6cb50
lib/hyperagent/ajax.js
lib/hyperagent/ajax.js
import 'hyperagent/config' as c; function ajax(options) { var deferred = c.defer(); c.ajax(c._.extend(options, { success: deferred.resolve, error: deferred.reject })); return deferred.promise; } export = ajax;
import 'hyperagent/config' as c; function ajax(options) { var deferred = c.defer(); c.ajax(c._.extend(options, { headers: { 'Accept': 'application/hal+json, application/json, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest' }, success: deferred.resolve, error: deferred.reject })); return deferred.promise; } export = ajax;
Add some hard-coded headers for now
Add some hard-coded headers for now
JavaScript
mit
docteurklein/hyperagent,docteurklein/hyperagent,weluse/hyperagent
--- +++ @@ -3,6 +3,10 @@ function ajax(options) { var deferred = c.defer(); c.ajax(c._.extend(options, { + headers: { + 'Accept': 'application/hal+json, application/json, */*; q=0.01', + 'X-Requested-With': 'XMLHttpRequest' + }, success: deferred.resolve, error: deferred.reject }));
91fc63ad843bd17993c3b94845d3fac1178666e8
app/javascript/components/widgets/widgets/forest-change/fires/initial-state.js
app/javascript/components/widgets/widgets/forest-change/fires/initial-state.js
export default { title: { withLocation: 'Fires in {location}' }, config: { size: 'small', categories: ['forest-change', 'summary'], admins: ['country', 'region', 'subRegion'], metaKey: 'widget_fire_alert_location', layers: ['viirs_fires_alerts'], type: 'fires', sortOrder: { summary: 7, forestChange: 11 }, sentences: { initial: '{count} active fires detected in {location} in the last 7 days.' } }, settings: { period: 'week', periodValue: 1, layers: ['viirs_fires_alerts'] }, enabled: true };
export default { title: { withLocation: 'Fires in {location}' }, config: { size: 'small', categories: ['forest-change', 'summary'], admins: ['region', 'subRegion'], metaKey: 'widget_fire_alert_location', layers: ['viirs_fires_alerts'], type: 'fires', sortOrder: { summary: 7, forestChange: 11 }, sentences: { initial: '{count} active fires detected in {location} in the last 7 days.' } }, settings: { period: 'week', periodValue: 1, layers: ['viirs_fires_alerts'] }, enabled: true };
Remove countries from fires widg
Remove countries from fires widg
JavaScript
mit
Vizzuality/gfw,Vizzuality/gfw
--- +++ @@ -5,7 +5,7 @@ config: { size: 'small', categories: ['forest-change', 'summary'], - admins: ['country', 'region', 'subRegion'], + admins: ['region', 'subRegion'], metaKey: 'widget_fire_alert_location', layers: ['viirs_fires_alerts'], type: 'fires',
30afcd6147f98897c3d7fa4dd184c0931cf36f2d
dist/components/breadcrumb/breadcrumb.js
dist/components/breadcrumb/breadcrumb.js
define(['$'], function ($) { return { 'breadcrumb': [ {'label': 'Home', 'url': '#'}, {'label': 'Homeware', 'url': '#'}, {'label': 'Kitchen', 'url': '#'}, {'label': 'Cooking & Baking', 'url': '#'} ] }; });
define(['$'], function ($) { return { 'breadcrumb': [ {'label': 'Home', 'url': '#', 'class': ''}, {'label': 'Homeware', 'url': '#', 'class': ''}, {'label': 'Kitchen', 'url': '#', 'class': ''}, {'label': 'Cooking & Baking', 'url': '#', 'class': 'c--current'} ] }; });
Add class to Breadcrumb schema
Add class to Breadcrumb schema
JavaScript
mit
mobify/stencil,mobify/stencil
--- +++ @@ -2,10 +2,10 @@ return { 'breadcrumb': [ - {'label': 'Home', 'url': '#'}, - {'label': 'Homeware', 'url': '#'}, - {'label': 'Kitchen', 'url': '#'}, - {'label': 'Cooking & Baking', 'url': '#'} + {'label': 'Home', 'url': '#', 'class': ''}, + {'label': 'Homeware', 'url': '#', 'class': ''}, + {'label': 'Kitchen', 'url': '#', 'class': ''}, + {'label': 'Cooking & Baking', 'url': '#', 'class': 'c--current'} ] }; });
96e6cf15c1385f696abb488c295332c4722c8bc4
lib/node_modules/@stdlib/_tools/tests/browser-build/examples/fixtures/index.js
lib/node_modules/@stdlib/_tools/tests/browser-build/examples/fixtures/index.js
/* eslint-disable no-restricted-syntax */ 'use strict'; // MODULES // var tape = require( 'tape' ); // TESTS // tape( 'test test test', function test( t ) { t.strictEqual( true, true, 'is true' ); t.strictEqual( false, false, 'is false' ); t.end(); });
'use strict'; // MODULES // var tape = require( 'tape' ); // TESTS // tape( 'test test test', function test( t ) { // eslint-disable-line no-restricted-syntax t.strictEqual( true, true, 'is true' ); t.strictEqual( false, false, 'is false' ); t.end(); });
Disable rule only for offending line
Disable rule only for offending line
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
--- +++ @@ -1,4 +1,3 @@ -/* eslint-disable no-restricted-syntax */ 'use strict'; // MODULES // @@ -8,7 +7,7 @@ // TESTS // -tape( 'test test test', function test( t ) { +tape( 'test test test', function test( t ) { // eslint-disable-line no-restricted-syntax t.strictEqual( true, true, 'is true' ); t.strictEqual( false, false, 'is false' ); t.end();
51aa6690cc6d81059cfab6fa7f2208fc6949b971
public/app/models/universe/world.factory.js
public/app/models/universe/world.factory.js
(function () { "use strict"; angular .module("PLMApp") .factory("World", World); function World() { var World = function (world) { this.type = world.type; this.operations = []; this.currentState = -1; this.steps = []; this.width = world.width; this.height = world.height; }; World.prototype.clone = function () { return new World(this); }; World.prototype.addOperations = function (operations) { var step = []; var length = operations.length; for (var i = 0; i < length; i += 1) { var operation = operations[i]; step.push(operation); } this.operations.push(step); }; World.prototype.setState = function (state) { var i, j, length, step; if (state < this.operations.length && state >= -1) { if (this.currentState < state) { for (i = this.currentState + 1; i <= state; i += 1) { step= this.operations; length = step.length; this.drawSVG(step[i][0]); } } else { for (i = this.currentState; i > state; i -= 1) { step= this.operations; length = step.length; this.drawSVG(step[i][0]); } } this.currentState = state; } }; World.prototype.drawSVG = function (svg) { (function () { document.getElementById("drawingArea").innerHTML = svg.operation; var svgElm = document.getElementsByTagName("svg"); svgElm[0].setAttribute("width", "400px"); svgElm[0].setAttribute("height", "400px"); })(); }; return World; } }());
(function () { "use strict"; angular .module("PLMApp") .factory("World", World); function World() { var World = function (world) { this.type = world.type; this.operations = []; this.currentState = -1; this.steps = []; this.width = world.width; this.height = world.height; }; World.prototype.clone = function () { return new World(this); }; World.prototype.addOperations = function (operations) { var step = []; var length = operations.length; for (var i = 0; i < length; i += 1) { var operation = operations[i]; step.push(operation); } this.operations.push(step); }; World.prototype.setState = function (state) { if (state < this.operations.length && state >= -1) { this.drawSVG(this.operations[state][0]); this.currentState = state; } }; World.prototype.drawSVG = function (svg) { (function () { document.getElementById("drawingArea").innerHTML = svg.operation; var svgElm = document.getElementsByTagName("svg"); svgElm[0].setAttribute("width", "400px"); svgElm[0].setAttribute("height", "400px"); })(); }; return World; } }());
Simplify how we draw the world: operations are not additive operations anymore
Simplify how we draw the world: operations are not additive operations anymore
JavaScript
agpl-3.0
MatthieuNICOLAS/webPLM,BuggleInc/webPLM,BuggleInc/webPLM,MatthieuNICOLAS/webPLM,BuggleInc/webPLM,MatthieuNICOLAS/webPLM,BuggleInc/webPLM,MatthieuNICOLAS/webPLM,BuggleInc/webPLM
--- +++ @@ -32,21 +32,8 @@ }; World.prototype.setState = function (state) { - var i, j, length, step; if (state < this.operations.length && state >= -1) { - if (this.currentState < state) { - for (i = this.currentState + 1; i <= state; i += 1) { - step= this.operations; - length = step.length; - this.drawSVG(step[i][0]); - } - } else { - for (i = this.currentState; i > state; i -= 1) { - step= this.operations; - length = step.length; - this.drawSVG(step[i][0]); - } - } + this.drawSVG(this.operations[state][0]); this.currentState = state; } };
d2724554cc803cf151d5b9ad30010e58b862c882
lib/6to5/transformation/modules/umd.js
lib/6to5/transformation/modules/umd.js
module.exports = UMDFormatter; var AMDFormatter = require("./amd"); var util = require("../../util"); var t = require("../../types"); var _ = require("lodash"); function UMDFormatter(file) { this.file = file; this.ids = {}; } util.inherits(UMDFormatter, AMDFormatter); UMDFormatter.prototype.transform = function (ast) { var program = ast.program; var body = program.body; // build an array of module names var names = []; _.each(this.ids, function (id, name) { names.push(t.literal(name)); }); // factory var ids = _.values(this.ids); var args = [t.identifier("exports")].concat(ids); var factory = t.functionExpression(null, args, t.blockStatement(body)); // runner var moduleName = this.getModuleName(); var runner = util.template("umd-runner-body", { AMD_ARGUMENTS: [t.literal(moduleName), t.arrayExpression([t.literal("exports")].concat(names))], COMMON_ARGUMENTS: names.map(function (name) { return t.callExpression(t.identifier("require"), [name]); }) }); // var call = t.callExpression(runner, [factory]); program.body = [t.expressionStatement(call)]; };
module.exports = UMDFormatter; var AMDFormatter = require("./amd"); var util = require("../../util"); var t = require("../../types"); var _ = require("lodash"); function UMDFormatter(file, opts) { this.file = file; this.ids = {}; this.insertModuleId = opts.amdModuleId; } util.inherits(UMDFormatter, AMDFormatter); UMDFormatter.prototype.transform = function (ast) { var program = ast.program; var body = program.body; // build an array of module names var names = []; _.each(this.ids, function (id, name) { names.push(t.literal(name)); }); // factory var ids = _.values(this.ids); var args = [t.identifier("exports")].concat(ids); var factory = t.functionExpression(null, args, t.blockStatement(body)); // runner var moduleName = this.getModuleName(); var defineArgs = [t.arrayExpression([t.literal("exports")].concat(names))]; if( this.insertModuleId ) defineArgs.unshift(t.literal(moduleName)); var runner = util.template("umd-runner-body", { AMD_ARGUMENTS: defineArgs, COMMON_ARGUMENTS: names.map(function (name) { return t.callExpression(t.identifier("require"), [name]); }) }); // var call = t.callExpression(runner, [factory]); program.body = [t.expressionStatement(call)]; };
Make module id's for AMD body in UMD optional as well
Make module id's for AMD body in UMD optional as well
JavaScript
mit
sairion/babel,michaelficarra/babel,kaicataldo/babel,jeffmo/babel,guybedford/babel,jchip/babel,mcanthony/babel,gxr1020/babel,hulkish/babel,vhf/babel,kpdecker/babel,CrocoDillon/babel,lxe/babel,Skillupco/babel,victorenator/babel,loganfsmyth/babel,TheAlphaNerd/babel,tav/mu-babel,CrabDude/babel,SaltTeam/babel,amasad/babel,arthurvr/babel,zjmiller/babel,samwgoldman/babel,plemarquand/babel,paulcbetts/babel,aalluri-navaratan/babel,claudiopro/babel,cartermarino/babel,nmn/babel,ysmood/babel,jnuine/babel,tricknotes/babel,Jeremy017/babel,krasimir/babel,Industrial/babel,ywo/babel,arthurvr/babel,paulcbetts/babel,beni55/babel,zenlambda/babel,Victorystick/babel,rn0/babel,kaicataldo/babel,lxe/babel,drieks/babel,dariocravero/babel,ellbee/babel,Jeremy017/babel,KualiCo/babel,mrmayfield/babel,zertosh/babel,jhen0409/babel,cartermarino/babel,mgcrea/babel,ming-codes/babel,mrtrizer/babel,johnamiahford/babel,ramoslin02/babel,mrmayfield/babel,macressler/babel,mgcrea/babel,james4388/babel,existentialism/babel,beni55/babel,zenparsing/babel,jeffmo/babel,KualiCo/babel,maurobringolf/babel,grasuxxxl/babel,maurobringolf/babel,chengky/babel,claudiopro/babel,hzoo/babel,hulkish/babel,rektide/babel-repl,mayflower/babel,e-jigsaw/babel,ajcrites/babybel,mrapogee/babel,kedromelon/babel,nvivo/babel,lydell/babel,vjeux/babel,moander/babel,thorikawa/babel,douglasduteil/babel,kellyselden/babel,Skillupco/babel,greyhwndz/babel,andrewwilkins/babel,jeffmo/babel,mayflower/babel,mcanthony/babel,Dignifiedquire/babel,aalluri-navaratan/babel,manukall/babel,steveluscher/babel,hryniu555/babel,kevhuang/babel,zenparsing/babel,ysmood/babel,andrejkn/babel,hubli/babel,nishant8BITS/babel,vjeux/babel,casser/babel,vadzim/babel,jridgewell/babel,babel/babel,kedromelon/babel,codenamejason/babel,samwgoldman/babel,vipulnsward/babel,kevhuang/babel,sethcall/babel,forivall/babel,codenamejason/babel,chengky/babel,Mark-Simulacrum/babel,lastjune/babel,rwjblue/babel,forivall-old-repos/tacoscript-babel-shared-history,iamchenxin/babel,pingjiang/babel,drieks/babel,samccone/babel,fabiomcosta/babel,ajcrites/babybel,e-jigsaw/babel,framewr/babel,paulcbetts/babel,johnamiahford/babel,pixeldrew/babel,inikulin/babel,Mark-Simulacrum/babel,sethcall/babel,sairion/babel,kevinb7/6to5,e-jigsaw/babel,kaicataldo/babel,existentialism/babel,amasad/babel,zenlambda/babel,rwjblue/babel,grasuxxxl/babel,ryankanno/babel,plemarquand/babel,ianmstew/babel,ccschneidr/babel,koistya/babel,babel/babel,gxr1020/babel,douglasduteil/babel,STRML/babel,tav/mu-babel,moander/babel,victorenator/babel,AgentME/babel,spicyj/babel,pingjiang/babel,dustyjewett/babel-plugin-transform-es2015-modules-commonjs-ember,cesarandreu/6to5,AgentME/babel,jridgewell/babel,tikotzky/babel,jhen0409/babel,sdiaz/babel,PolymerLabs/babel,dariocravero/babel,abdulsam/babel,benjamn/babel,pixeldrew/babel,Jabher/babel,existentialism/babel,hubli/babel,zorosteven/babel,gxr1020/babel,mrapogee/babel,hawkrives/6to5,kedromelon/babel,benjamn/babel,Jabher/babel,jackmew/babel,mcanthony/babel,vjeux/babel,jridgewell/babel,jmptrader/babel,zorosteven/babel,prathamesh-sonpatki/babel,jaredly/babel,ywo/babel,jnuine/babel,VukDukic/babel,nmn/babel,plemarquand/babel,Skillupco/babel,kassens/babel,PolymerLabs/babel,kevhuang/babel,dariocravero/babel,rn0/babel,luca-barbieri/5to6,ellbee/babel,SaltTeam/babel,jridgewell/babel,rmacklin/babel,chengky/babel,TheAlphaNerd/babel,prathamesh-sonpatki/babel,ortutay/babel,cgvarela/babel,bcoe/babel,azu/babel,babel/babel,ajcrites/babybel,chicoxyzzy/babel,rmacklin/babel,samccone/babel,Dignifiedquire/babel,PolymerLabs/babel,beni55/babel,cgvarela/babel,tav/mu-babel,james4388/babel,loganfsmyth/babel,shuhei/babel,KunGha/babel,goatslacker/babel,rektide/babel-repl,garyjN7/babel,megawac/babel,VukDukic/babel,chicoxyzzy/babel,michaelficarra/babel,sejoker/babel,ezbreaks/babel,steveluscher/babel,vipulnsward/babel,forivall/babel,aalluri-navaratan/babel,sairion/babel,hubli/babel,sejoker/babel,1yvT0s/babel,abdulsam/babel,jmptrader/babel,shuhei/babel,ameyms/babel,kellyselden/babel,ianmstew/babel,hzoo/babel,guybedford/babel,cesarandreu/6to5,framewr/babel,ywo/babel,grasuxxxl/babel,abdulsam/babel,stefanpenner/6to5,mgcrea/babel,koistya/babel,megawac/babel,rn0/babel,jnuine/babel,STRML/babel,iamchenxin/babel,DmitrySoshnikov/babel,ortutay/babel,cartermarino/babel,greyhwndz/babel,inikulin/babel,jackmew/babel,ramoslin02/babel,koistya/babel,andrejkn/babel,andrewwilkins/babel,iamchenxin/babel,kassens/babel,jaredly/babel,jmm/babel,forivall/babel,Jeremy017/babel,Skillupco/babel,tricknotes/babel,michaelficarra/babel,kellyselden/babel,chicoxyzzy/babel,bcoe/babel,CrabDude/babel,Industrial/babel,DmitrySoshnikov/babel,claudiopro/babel,vadzim/babel,tricknotes/babel,iamolivinius/babel,1yvT0s/babel,nvivo/babel,ryankanno/babel,thorikawa/babel,loganfsmyth/babel,macressler/babel,ming-codes/babel,chicoxyzzy/babel,zorosteven/babel,VukDukic/babel,lastjune/babel,framewr/babel,codenamejason/babel,victorenator/babel,ianmstew/babel,zenlambda/babel,forivall-old-repos/tacoscript-babel-shared-history,kevinb7/6to5,thorikawa/babel,jchip/babel,jmptrader/babel,kellyselden/babel,james4388/babel,antn/babel,douglasduteil/babel,Dignifiedquire/babel,krasimir/babel,SaltTeam/babel,spicyj/babel,manukall/babel,samwgoldman/babel,thejameskyle/babel,megawac/babel,iamolivinius/babel,maurobringolf/babel,ErikBaath/babel,spicyj/babel,vhf/babel,macressler/babel,TheAlphaNerd/babel,dekelcohen/babel,thejameskyle/babel,steveluscher/babel,iamolivinius/babel,hryniu555/babel,babel/babel,hughsk/babel,iamstarkov/babel,johnamiahford/babel,tikotzky/babel,casser/babel,ameyms/babel,Victorystick/babel,ezbreaks/babel,inikulin/babel,jmm/babel,sejoker/babel,zertosh/babel,cesarandreu/6to5,luca-barbieri/5to6,hzoo/babel,ramoslin02/babel,dekelcohen/babel,fabiomcosta/babel,manukall/babel,lydell/babel,ErikBaath/babel,ortutay/babel,ysmood/babel,guybedford/babel,KunGha/babel,iamstarkov/babel,antn/babel,ezbreaks/babel,ErikBaath/babel,1yvT0s/babel,sdiaz/babel,cgvarela/babel,ccschneidr/babel,pingjiang/babel,kpdecker/babel,shuhei/babel,kaicataldo/babel,Victorystick/babel,hzoo/babel,andrewwilkins/babel,moander/babel,azu/babel,Mark-Simulacrum/babel,greyhwndz/babel,gaearon/6to5,mrtrizer/babel,amasad/babel,andrejkn/babel,lastjune/babel,garyjN7/babel,ryankanno/babel,prathamesh-sonpatki/babel,mrapogee/babel,jackmew/babel,hulkish/babel,CrocoDillon/babel,pixeldrew/babel,nmn/babel,zjmiller/babel,CrabDude/babel,vipulnsward/babel,mquandalle/6to5,drieks/babel,hulkish/babel,KualiCo/babel,mayflower/babel,nishant8BITS/babel,sethcall/babel,ming-codes/babel
--- +++ @@ -5,9 +5,10 @@ var t = require("../../types"); var _ = require("lodash"); -function UMDFormatter(file) { +function UMDFormatter(file, opts) { this.file = file; this.ids = {}; + this.insertModuleId = opts.amdModuleId; } util.inherits(UMDFormatter, AMDFormatter); @@ -34,8 +35,11 @@ var moduleName = this.getModuleName(); + var defineArgs = [t.arrayExpression([t.literal("exports")].concat(names))]; + if( this.insertModuleId ) defineArgs.unshift(t.literal(moduleName)); + var runner = util.template("umd-runner-body", { - AMD_ARGUMENTS: [t.literal(moduleName), t.arrayExpression([t.literal("exports")].concat(names))], + AMD_ARGUMENTS: defineArgs, COMMON_ARGUMENTS: names.map(function (name) { return t.callExpression(t.identifier("require"), [name]);
85a174bcaab83cce88f6b39c1cb3ca6ba1b42dbe
__tests__/index.js
__tests__/index.js
'use strict'; var eslint = require('eslint'); var path = require('path'); it('load config in eslint to validate rule syntax', function() { var data = new eslint.CLIEngine({ configFile: path.join(__dirname, '../index.js'), useEslintrc: false, }).executeOnText("export default 'foo';\n", 'valid.js'); expect(data).toBeTruthy(); expect(data.errorCount).toBe(0); expect(data.warningCount).toBe(0); expect(data.results[0].messages.length).toBe(0); });
'use strict'; var eslint = require('eslint'); var path = require('path'); it('load config in eslint to validate rule syntax', function() { var data = new eslint.CLIEngine({ configFile: path.join(__dirname, '../index.js'), useEslintrc: false, }).executeOnText('export default [];\n', 'valid.js'); expect(data).toBeTruthy(); expect(data.errorCount).toBe(0); expect(data.warningCount).toBe(0); expect(data.results[0].messages.length).toBe(0); });
Use syntax that doesn't fail ESLint checks
:green_heart: Use syntax that doesn't fail ESLint checks
JavaScript
mit
jamieconnolly/eslint-config
--- +++ @@ -7,7 +7,7 @@ var data = new eslint.CLIEngine({ configFile: path.join(__dirname, '../index.js'), useEslintrc: false, - }).executeOnText("export default 'foo';\n", 'valid.js'); + }).executeOnText('export default [];\n', 'valid.js'); expect(data).toBeTruthy(); expect(data.errorCount).toBe(0);
3029fb9c610407c2473d060839900b32b57302dc
src/apps/Hosting/HostingStore.js
src/apps/Hosting/HostingStore.js
import Reflux from 'reflux'; import _ from 'lodash'; import { CheckListStoreMixin, HostingMixin, WaitForStoreMixin, StoreLoadingMixin } from '../../mixins'; import SessionActions from '../Session/SessionActions'; import Actions from './HostingActions'; export default Reflux.createStore({ listenables: Actions, mixins: [ CheckListStoreMixin, HostingMixin, WaitForStoreMixin, StoreLoadingMixin ], getInitialState() { return { items: [], isLoading: false }; }, init() { this.data = this.getInitialState(); this.waitFor( SessionActions.setInstance, this.refreshData ); this.setLoadingStates(); }, sendHostingAnalytics(type, payload) { window.analytics.track('Used Dashboard Sockets API', { type, instance: payload.instanceName, socketId: payload.label, socket: 'hosting' }); }, setHosting(data) { this.data.items = _.forEach(data, this.prepareHosting); this.trigger(this.data); }, refreshData() { Actions.fetchHostings(); }, onFetchHostingsCompleted(data) { Actions.setHosting(data); }, onCreateHostingCompleted(payload) { this.sendHostingAnalytics('add', payload); }, onUpdateHostingCompleted(payload) { this.sendHostingAnalytics('edit', payload); }, onRemoveHostingsCompleted(payload) { this.refreshData(); this.sendHostingAnalytics('delete', payload); } });
import Reflux from 'reflux'; import _ from 'lodash'; import { CheckListStoreMixin, HostingMixin, WaitForStoreMixin, StoreLoadingMixin } from '../../mixins'; import SessionActions from '../Session/SessionActions'; import Actions from './HostingActions'; export default Reflux.createStore({ listenables: Actions, mixins: [ CheckListStoreMixin, HostingMixin, WaitForStoreMixin, StoreLoadingMixin ], getInitialState() { return { items: [], isLoading: false }; }, init() { this.data = this.getInitialState(); this.waitFor( SessionActions.setInstance, this.refreshData ); this.setLoadingStates(); }, sendHostingAnalytics(type, payload) { window.analytics.track('Used Dashboard Sockets API', { type, instance: payload.instanceName, socketId: payload.label, socket: 'hosting' }); }, setHosting(data) { this.data.items = _.forEach(data, this.prepareHosting); this.trigger(this.data); }, refreshData() { Actions.fetchHostings(); }, onFetchHostingsCompleted(data) { Actions.setHosting(data); }, onCreateHostingCompleted(payload) { this.refreshData(); this.sendHostingAnalytics('add', payload); }, onUpdateHostingCompleted(payload) { this.refreshData(); this.sendHostingAnalytics('edit', payload); }, onRemoveHostingsCompleted(payload) { this.refreshData(); this.sendHostingAnalytics('delete', payload); } });
Refresh hostings after closing modal
[DASH-2397] Refresh hostings after closing modal
JavaScript
mit
Syncano/syncano-dashboard,Syncano/syncano-dashboard,Syncano/syncano-dashboard
--- +++ @@ -55,10 +55,12 @@ }, onCreateHostingCompleted(payload) { + this.refreshData(); this.sendHostingAnalytics('add', payload); }, onUpdateHostingCompleted(payload) { + this.refreshData(); this.sendHostingAnalytics('edit', payload); },
0b853759babf896e946e04e3ab5e2279f1c59933
aura-components/src/main/components/aura/unescapedHtml/unescapedHtmlRenderer.js
aura-components/src/main/components/aura/unescapedHtml/unescapedHtmlRenderer.js
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ({ render : function(cmp){ var elements=$A.util.createElementsFromMarkup(cmp.get("v.value")); if(!elements.length){ $A.renderingService.renderFacet(cmp,elements); } return elements; }, rerender : function(cmp){ if (cmp.isDirty("v.value")) { var el = cmp.getElement(); var placeholder=null; if(el){ placeholder = document.createTextNode(""); $A.util.insertBefore(placeholder, el); }else{ placeholder=$A.renderingService.getMarker(cmp); } $A.unrender(cmp); var results = $A.render(cmp); if(results.length){ $A.util.insertBefore(results, placeholder); $A.afterRender(cmp); } } } })
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ({ render : function(cmp){ var elements=$A.util.createElementsFromMarkup(cmp.get("v.value")); if(!elements.length){ elements=$A.renderingService.renderFacet(cmp,elements); } return elements; }, rerender : function(cmp){ if (cmp.isDirty("v.value")) { var el = cmp.getElement(); var placeholder=null; if(el){ placeholder = document.createTextNode(""); $A.util.insertBefore(placeholder, el); }else{ placeholder=$A.renderingService.getMarker(cmp); } $A.unrender(cmp); var results = $A.render(cmp); if(results.length){ $A.util.insertBefore(results, placeholder); $A.afterRender(cmp); } } } })
Fix for unescapedHtml.cmp losing rendering after empty value.
Fix for unescapedHtml.cmp losing rendering after empty value.
JavaScript
apache-2.0
badlogicmanpreet/aura,badlogicmanpreet/aura,SalesforceSFDC/aura,badlogicmanpreet/aura,DebalinaDey/AuraDevelopDeb,TribeMedia/aura,madmax983/aura,madmax983/aura,lcnbala/aura,madmax983/aura,badlogicmanpreet/aura,navyliu/aura,badlogicmanpreet/aura,SalesforceSFDC/aura,SalesforceSFDC/aura,igor-sfdc/aura,igor-sfdc/aura,TribeMedia/aura,lcnbala/aura,forcedotcom/aura,TribeMedia/aura,forcedotcom/aura,SalesforceSFDC/aura,navyliu/aura,madmax983/aura,navyliu/aura,DebalinaDey/AuraDevelopDeb,badlogicmanpreet/aura,forcedotcom/aura,navyliu/aura,DebalinaDey/AuraDevelopDeb,SalesforceSFDC/aura,igor-sfdc/aura,lcnbala/aura,forcedotcom/aura,madmax983/aura,lcnbala/aura,DebalinaDey/AuraDevelopDeb,TribeMedia/aura,TribeMedia/aura,forcedotcom/aura,madmax983/aura,DebalinaDey/AuraDevelopDeb,TribeMedia/aura,igor-sfdc/aura,igor-sfdc/aura,navyliu/aura,SalesforceSFDC/aura,navyliu/aura,lcnbala/aura,DebalinaDey/AuraDevelopDeb,lcnbala/aura
--- +++ @@ -17,7 +17,7 @@ render : function(cmp){ var elements=$A.util.createElementsFromMarkup(cmp.get("v.value")); if(!elements.length){ - $A.renderingService.renderFacet(cmp,elements); + elements=$A.renderingService.renderFacet(cmp,elements); } return elements; },
7219c94956f460e4070fb69ed715550a98faac87
src/background/alarm_listener.js
src/background/alarm_listener.js
export default () => { chrome.alarms.onAlarm.addListener(function (alarm) { if (alarm.name === "reminder") { runIfTrackerOpen(function () { alert("Hey y'all, it's time to send out your WWLTW email!"); }); } }); } const runIfTrackerOpen = (callback) => { chrome.tabs.query({url: ["http://www.pivotaltracker.com/*", "https://www.pivotaltracker.com/*"]}, function (tabs) { if (tabs.length > 0) { callback(); } }); };
export default () => { chrome.alarms.onAlarm.addListener(function (alarm) { if (alarm.name === "reminder") { runIfTrackerOpen(function () { alert(`Hey y'all, it's time to send out your WWLTW email!\n\n` + `Head on over to Pivotal Tracker, open up your "WWLTW for the week of ${moment().format('M/D')}" chore and hit Finish to generate the email`); }); } }); } const runIfTrackerOpen = (callback) => { chrome.tabs.query({url: ["http://www.pivotaltracker.com/*", "https://www.pivotaltracker.com/*"]}, function (tabs) { if (tabs.length > 0) { callback(); } }); };
Add more instructions to the alarm alert
Add more instructions to the alarm alert
JavaScript
isc
oliverswitzer/wwltw-for-pivotal-tracker,oliverswitzer/wwltw-for-pivotal-tracker
--- +++ @@ -1,8 +1,10 @@ export default () => { chrome.alarms.onAlarm.addListener(function (alarm) { if (alarm.name === "reminder") { + runIfTrackerOpen(function () { - alert("Hey y'all, it's time to send out your WWLTW email!"); + alert(`Hey y'all, it's time to send out your WWLTW email!\n\n` + + `Head on over to Pivotal Tracker, open up your "WWLTW for the week of ${moment().format('M/D')}" chore and hit Finish to generate the email`); }); } });
e39bd586ffab1dd9e1844110ed67d3f257a6759d
src/components/HouseholdNotes.js
src/components/HouseholdNotes.js
import React from 'react' import { List } from 'semantic-ui-react' import format from 'date-fns/format' const HouseholdNotes = ({notes}) => { return ( <List> {notes.map(n => <List.Item>{format(new Date(n.created_at), 'MMMM Do, YYYY')} - {n.content}</List.Item>)} </List> ) } export default HouseholdNotes
import React from "react"; import { List } from "semantic-ui-react"; import format from "date-fns/format"; const HouseholdNotes = ({ notes }) => { return ( <List> {notes.map(n => <List.Item key={n.id}> {format(new Date(n.created_at), "MMMM Do, YYYY")} - {n.content} </List.Item> )} </List> ); }; export default HouseholdNotes;
Add key to household notes to avoid warning
Add key to household notes to avoid warning
JavaScript
mit
cernanb/personal-chef-react-app,cernanb/personal-chef-react-app
--- +++ @@ -1,13 +1,17 @@ -import React from 'react' -import { List } from 'semantic-ui-react' -import format from 'date-fns/format' +import React from "react"; +import { List } from "semantic-ui-react"; +import format from "date-fns/format"; -const HouseholdNotes = ({notes}) => { - return ( - <List> - {notes.map(n => <List.Item>{format(new Date(n.created_at), 'MMMM Do, YYYY')} - {n.content}</List.Item>)} - </List> - ) -} +const HouseholdNotes = ({ notes }) => { + return ( + <List> + {notes.map(n => + <List.Item key={n.id}> + {format(new Date(n.created_at), "MMMM Do, YYYY")} - {n.content} + </List.Item> + )} + </List> + ); +}; -export default HouseholdNotes +export default HouseholdNotes;
aeaba497661622e732c43b2e653e130a312b91fa
public/script/login.js
public/script/login.js
var description = d3.select("#text") .html("<b>Title: </b><br/><b>Number: </b><br/><b>Body: </b><br/><b>ID: </b><br/><b>Assignee: </b><br/><b>Milestone: </b><br/><b>Repo: </b>"); $.getJSON("orgs.json") .done(function (data, textStatus, jqXHR) { var orgs = data; render(orgs); }) .fail(); var render = function (orgs) { document.getElementById('user').addEventListener("click", userClick, false); function userClick(){ document.getElementById('orgdrop').disabled = "true"; document.getElementById('publictext').disabled = "true"; } document.getElementById('org').addEventListener("click", orgClick, false); function orgClick(){ document.getElementById('orgdrop').disabled = null; document.getElementById('publictext').disabled = "true"; } document.getElementById('public').addEventListener("click", pubClick, false); function pubClick(){ document.getElementById('publictext').disabled = null; document.getElementById('orgdrop').disabled = "true"; } orgs.forEach(function (org) { d3.select('select').append('option').append('text').text(org); }); };
var description = d3.select("#text") .html("<b>Title: </b><br/><b>Number: </b><br/><b>Body: </b><br/><b>ID: </b><br/><b>Assignee: </b><br/><b>Milestone: </b><br/><b>Repo: </b>"); $.getJSON("orgs.json") .done(function (data, textStatus, jqXHR) { var orgs = data; render(orgs); }) .fail(); var render = function (orgs) { document.getElementById('user').addEventListener("click", function userClick(){ document.getElementById('orgdrop').disabled = "true"; document.getElementById('publictext').disabled = "true"; }, false); document.getElementById('public').addEventListener("click", function pubClick(){ document.getElementById('publictext').disabled = null; document.getElementById('orgdrop').disabled = "true"; }, false); if (orgs.length !== 0){ document.getElementById('org').addEventListener("click", function orgClick(){ document.getElementById('orgdrop').disabled = null; document.getElementById('publictext').disabled = "true"; }, false); orgs.forEach(function (org) { d3.select('select').append('option').append('text').text(org); }); } else { document.getElementById('org').disabled = "true"; d3.select('select').append('option').append('text').text("User has no Orgs"); } };
Add more responsiveness for user without organizations
Add more responsiveness for user without organizations
JavaScript
mit
hjylewis/issue-graph,hjylewis/issue-graph
--- +++ @@ -10,25 +10,30 @@ }) .fail(); var render = function (orgs) { - document.getElementById('user').addEventListener("click", userClick, false); - function userClick(){ + document.getElementById('user').addEventListener("click", function userClick(){ document.getElementById('orgdrop').disabled = "true"; document.getElementById('publictext').disabled = "true"; + }, false); + + + document.getElementById('public').addEventListener("click", function pubClick(){ + document.getElementById('publictext').disabled = null; + document.getElementById('orgdrop').disabled = "true"; + }, false); + + + if (orgs.length !== 0){ + document.getElementById('org').addEventListener("click", function orgClick(){ + document.getElementById('orgdrop').disabled = null; + document.getElementById('publictext').disabled = "true"; + }, false); + + orgs.forEach(function (org) { + d3.select('select').append('option').append('text').text(org); + }); + } else { + document.getElementById('org').disabled = "true"; + d3.select('select').append('option').append('text').text("User has no Orgs"); } - document.getElementById('org').addEventListener("click", orgClick, false); - function orgClick(){ - document.getElementById('orgdrop').disabled = null; - document.getElementById('publictext').disabled = "true"; - } - document.getElementById('public').addEventListener("click", pubClick, false); - function pubClick(){ - document.getElementById('publictext').disabled = null; - document.getElementById('orgdrop').disabled = "true"; - } - - orgs.forEach(function (org) { - d3.select('select').append('option').append('text').text(org); - }); - };
967bd00a8d5783cfbd1a11f2e7c64fcf8e89ebb7
lib/hooks/views/get-implicit-defaults.js
lib/hooks/views/get-implicit-defaults.js
/** * getImplicitDefaults() * * Get a dictionary of implicit defaults this hook would like to merge * into `sails.config` when Sails is loaded. * * @param {Dictionary} existingConfig * Existing configuration which has already been loaded * e.g. the Sails app path, and any config overrides (programmtic, from .sailsrc, etc) * * @returns {Dictionary} */ module.exports = function getImplicitDefaults (existingConfig) { return { views: { // Extension for view files extension: 'ejs', // Layout is on by default, in the top level of the view directory // true === use default // false === don't use a layout // string === path to layout layout: true }, paths: { views: existingConfig.appPath + '/views', layout: existingConfig.appPath + '/views/layout.ejs' } }; };
/** * getImplicitDefaults() * * Get a dictionary of implicit defaults this hook would like to merge * into `sails.config` when Sails is loaded. * * @param {Dictionary} existingConfig * Existing configuration which has already been loaded * e.g. the Sails app path, and any config overrides (programmtic, from .sailsrc, etc) * * @returns {Dictionary} */ module.exports = function getImplicitDefaults (existingConfig) { return { views: { // Extension for view files extension: 'ejs', // Layout is on by default, in the top level of the view directory // false === don't use a layout // string === path to layout (absolute or relative to views directory), without extension layout: 'layout' }, paths: { views: existingConfig.appPath + '/views', layout: existingConfig.appPath + '/views/layout.ejs' } }; };
Update implicit default for view layout
Update implicit default for view layout
JavaScript
mit
balderdashy/sails,rlugojr/sails,rlugojr/sails
--- +++ @@ -19,10 +19,9 @@ extension: 'ejs', // Layout is on by default, in the top level of the view directory - // true === use default // false === don't use a layout - // string === path to layout - layout: true + // string === path to layout (absolute or relative to views directory), without extension + layout: 'layout' }, paths: {
489c675d59828cfdd689da0d65f43c3cce61a2d0
migrations/1461835592.activity.create.js
migrations/1461835592.activity.create.js
'use strict'; module.exports = { up: function(queryInterface, Sequelize) { return queryInterface.createTable('Activities', { id: { type: Sequelize.INTEGER, allowNull: false, unique: true, autoIncrement:true, primaryKey: true }, name: { type: Sequelize.STRING, allowNull: false }, description: { type: Sequelize.STRING }, tags: { type: Sequelize.ARRAY(Sequelize.TEXT) }, address: { type: Sequelize.STRING }, latitude: { type: Sequelize.DECIMAL }, longitude: { type: Sequelize.DECIMAL }, temporary: { type: Sequelize.BOOLEAN }, date_start: { type: Sequelize.DATE }, date_end: { type: Sequelize.DATE }, opening_hours: { type: Sequelize.ARRAY(Sequelize.INTEGER) }, type: { type: Sequelize.ENUM, }, source: { type: DataTypes.STRING, }, idSource: { type: DataTypes.DECIMAL, }, createdAt: { allowNull: false, type: Sequelize.DATE }, updatedAt: { allowNull: false, type: Sequelize.DATE } }); }, down: function(queryInterface, Sequelize) { return queryInterface.dropTable('Activities'); } };
'use strict'; module.exports = { up: function(queryInterface, Sequelize) { return queryInterface.createTable('Activities', { id: { type: Sequelize.INTEGER, allowNull: false, unique: true, autoIncrement:true, primaryKey: true }, name: { type: Sequelize.STRING, allowNull: false }, description: { type: Sequelize.STRING }, tags: { type: Sequelize.ARRAY(Sequelize.TEXT) }, address: { type: Sequelize.STRING }, latitude: { type: Sequelize.DECIMAL }, longitude: { type: Sequelize.DECIMAL }, temporary: { type: Sequelize.BOOLEAN }, date_start: { type: Sequelize.DATE }, date_end: { type: Sequelize.DATE }, opening_hours: { type: Sequelize.ARRAY(Sequelize.INTEGER) }, type: { type: Sequelize.ENUM, }, source: { type: Sequelize.STRING, }, idSource: { type: Sequelize.DECIMAL, }, createdAt: { allowNull: false, type: Sequelize.DATE }, updatedAt: { allowNull: false, type: Sequelize.DATE } }); }, down: function(queryInterface, Sequelize) { return queryInterface.dropTable('Activities'); } };
Add source and sourceId to db model
[FIX] Add source and sourceId to db model
JavaScript
mit
HexanomeBeurreTwo/Goon-Server,HexanomeBeurreTwo/Goon-Server
--- +++ @@ -44,10 +44,10 @@ type: Sequelize.ENUM, }, source: { - type: DataTypes.STRING, + type: Sequelize.STRING, }, idSource: { - type: DataTypes.DECIMAL, + type: Sequelize.DECIMAL, }, createdAt: { allowNull: false,
1c0959dfcc0fc51d854ff1a6a69857a2589f9a1b
scripts/bulk-mailer/nodemailer-mock.js
scripts/bulk-mailer/nodemailer-mock.js
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var fs = require('fs') var path = require('path') module.exports = function (config) { var messageId = 0; if (config.outputDir) { ensureOutputDirExists(config.outputDir) } return { sendMail: function (emailConfig, callback) { if (config.outputDir) { var language = emailConfig.headers['Content-Language'] var outputPath = path.join(config.outputDir, language + '.' + emailConfig.to) var textPath = outputPath + '.txt' fs.writeFileSync(textPath, emailConfig.text) var htmlPath = outputPath + '.html' fs.writeFileSync(htmlPath, emailConfig.html) } if (Math.random() > config.failureRate) { messageId++ callback(null, { message: 'good', messageId: messageId }) } else { callback(new Error('uh oh')) } }, close: function () {} }; }; function ensureOutputDirExists(outputDir) { var dirStats try { dirStats = fs.statSync(outputDir) } catch (e) { fs.mkdirSync(outputDir); return; } if (! dirStats.isDirectory()) { console.error(outputDir + ' is not a directory'); process.exit(1) } }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var fs = require('fs') var path = require('path') module.exports = function (config) { var messageId = 0; if (config.outputDir) { ensureOutputDirExists(config.outputDir) } return { sendMail: function (emailConfig, callback) { if (config.outputDir) { var language = emailConfig.headers['Content-Language'] var outputPath = path.join(config.outputDir, emailConfig.to) var textPath = outputPath + '.txt' fs.writeFileSync(textPath, emailConfig.text) var htmlPath = outputPath + '.html' fs.writeFileSync(htmlPath, emailConfig.html) } if (Math.random() > config.failureRate) { messageId++ callback(null, { message: 'good', messageId: messageId }) } else { callback(new Error('uh oh')) } }, close: function () {} }; }; function ensureOutputDirExists(outputDir) { var dirStats try { dirStats = fs.statSync(outputDir) } catch (e) { fs.mkdirSync(outputDir); return; } if (! dirStats.isDirectory()) { console.error(outputDir + ' is not a directory'); process.exit(1) } }
Remove the locale prefix on filenames w/ --write
fix(bulk-mailer): Remove the locale prefix on filenames w/ --write
JavaScript
mpl-2.0
TDA/fxa-auth-server,shane-tomlinson/fxa-auth-server,mozilla/fxa-auth-server,mozilla/fxa-auth-server,mozilla/fxa-auth-server,shane-tomlinson/fxa-auth-server,eoger/fxa-auth-server,TDA/fxa-auth-server,TDA/fxa-auth-server,eoger/fxa-auth-server,eoger/fxa-auth-server,TDA/fxa-auth-server,mozilla/fxa-auth-server,shane-tomlinson/fxa-auth-server,shane-tomlinson/fxa-auth-server,eoger/fxa-auth-server
--- +++ @@ -18,7 +18,7 @@ var language = emailConfig.headers['Content-Language'] - var outputPath = path.join(config.outputDir, language + '.' + emailConfig.to) + var outputPath = path.join(config.outputDir, emailConfig.to) var textPath = outputPath + '.txt' fs.writeFileSync(textPath, emailConfig.text)
44f781b7218643d7c15a8aba504d677881d809b5
public/javascripts/jquery.preyfetcher.js
public/javascripts/jquery.preyfetcher.js
(function($) { $().ready(function() { var ANIMATION_SPEED = 250; $('body').addClass('js'); // DMs on the Settings page $('#user_enable_dms').click(function(event) { $('#dm-priority-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_dms:checked').length == 1) $('#dm-priority-container').show(); // Mentions on the Settings page $('#user_enable_mentions').click(function(event) { $('#mention-priority-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_mentions:checked').length == 1) $('#mention-priority-container').show(); // Lists on the Settings page $('#user_enable_list').click(function(event) { $('#list-priority-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_list:checked').length == 1) $('#list-priority-container').show(); }); })(jQuery);
(function($) { $().ready(function() { var ANIMATION_SPEED = 250; $('body').addClass('js'); // DMs on the Settings page $('#user_enable_dms').click(function(event) { $('#dm-priority-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_dms:checked').length == 1) $('#dm-priority-container').show(); // Mentions on the Settings page $('#user_enable_mentions').click(function(event) { $('#mention-priority-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_mentions:checked').length == 1) $('#mention-priority-container').show(); // Lists on the Settings page $('#user_enable_list').click(function(event) { $('#list-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_list:checked').length == 1) $('#list-container').show(); }); })(jQuery);
Update id of list element container
Update id of list element container
JavaScript
mit
tofumatt/Prey-Fetcher,tofumatt/Prey-Fetcher
--- +++ @@ -20,10 +20,10 @@ // Lists on the Settings page $('#user_enable_list').click(function(event) { - $('#list-priority-container').slideToggle(ANIMATION_SPEED); + $('#list-container').slideToggle(ANIMATION_SPEED); }); if ($('#user_enable_list:checked').length == 1) - $('#list-priority-container').show(); + $('#list-container').show(); }); })(jQuery);
857f4e3a37be001dafb461253e29960de784d7c6
spec/support/fixtures/stripejs-mock.js
spec/support/fixtures/stripejs-mock.js
class Element { mount(el) { if (typeof el === "string") { el = document.querySelector(el); } el.innerHTML = ` <input id="stripe-cardnumber" name="cardnumber" placeholder="Card number" size="16" type="text"> <input name="exp-date" placeholder="MM / YY" size="6" type="text"> <input name="cvc" placeholder="CVC" size="3" type="text"> `; } } window.Stripe = () => { const fetchLastFour = () => { return document.getElementById("stripe-cardnumber").value.substr(-4, 4); }; return { elements: () => { return { create: (type, options) => new Element() }; }, createToken: card => { return new Promise(resolve => { resolve({ token: { id: "tok_123", card: { last4: fetchLastFour() } } }); }); } }; };
class Element { mount(el) { if (typeof el === "string") { el = document.querySelector(el); } el.innerHTML = ` <input id="stripe-cardnumber" name="cardnumber" placeholder="Card number" size="16" type="text"> <input name="exp-date" placeholder="MM / YY" size="6" type="text"> <input name="cvc" placeholder="CVC" size="3" type="text"> `; } addEventListener(event) { return true; } } window.Stripe = () => { const fetchLastFour = () => { return document.getElementById("stripe-cardnumber").value.substr(-4, 4); }; return { elements: () => { return { create: (type, options) => new Element() }; }, createToken: card => { return new Promise(resolve => { resolve({ token: { id: "tok_123", card: { last4: fetchLastFour() } } }); }); } }; };
Add missing method to StripeJS mock
Add missing method to StripeJS mock Our Angular code calls this method for interacting with live form validations and messages. We don't really need to use in tests, it just needs to exist otherwise the specs fail.
JavaScript
agpl-3.0
lin-d-hop/openfoodnetwork,openfoodfoundation/openfoodnetwork,Matt-Yorkley/openfoodnetwork,mkllnk/openfoodnetwork,openfoodfoundation/openfoodnetwork,mkllnk/openfoodnetwork,lin-d-hop/openfoodnetwork,mkllnk/openfoodnetwork,openfoodfoundation/openfoodnetwork,Matt-Yorkley/openfoodnetwork,openfoodfoundation/openfoodnetwork,Matt-Yorkley/openfoodnetwork,lin-d-hop/openfoodnetwork,mkllnk/openfoodnetwork,lin-d-hop/openfoodnetwork,Matt-Yorkley/openfoodnetwork
--- +++ @@ -9,6 +9,10 @@ <input name="exp-date" placeholder="MM / YY" size="6" type="text"> <input name="cvc" placeholder="CVC" size="3" type="text"> `; + } + + addEventListener(event) { + return true; } }
81caa8aa2d94fed2fd8564431e8b7d7421c648fd
server/db/orm-model.js
server/db/orm-model.js
'use strict'; var db = require('./database'); var Sequelize = require('sequelize'); module.exports = function(){ var User = db.define('Users', { userId: {type: Sequelize.STRING, unique: true, notEmpty: true, notNull: true, primaryKey: true }, email: Sequelize.STRING, picture: Sequelize.STRING, name: Sequelize.STRING, nickname: Sequelize.STRING }); var Activity = db.define('Activity', { title: { type: Sequelize.STRING, notEmpty: true, notNull: true }, description: { type: Sequelize.STRING, notEmpty: true, notNull: true }, location: { type: Sequelize.STRING }, keywords: { type: Sequelize.STRING } //sequelize automatically makes createdAt and updatedAt columns }); // We don't need create a join table when we're using an ORM // Use a method to set relationships Activity.belongsToMany(User, {through: 'UserActivity'}); User.belongsToMany(Activity, {through: 'UserActivity'}); // User.sync().success(function () { // console.log('User table created!'); // }); // Activity.sync().success(function () { // console.log('Activity table created!'); // }); db.sync(); return {User:User, Activity: Activity}; };
'use strict'; var db = require('./database'); var Sequelize = require('sequelize'); module.exports = function(){ var User = db.define('Users', { userId: {type: Sequelize.STRING, unique: true, notEmpty: true, notNull: true, primaryKey: true }, email: Sequelize.STRING, picture: Sequelize.STRING, name: Sequelize.STRING, nickname: Sequelize.STRING }); var Activity = db.define('Activity', { title: { type: Sequelize.STRING, notEmpty: true, notNull: true }, description: { type: Sequelize.STRING, notEmpty: true, notNull: true }, location: { type: Sequelize.STRING }, keywords: { type: Sequelize.STRING } //sequelize automatically makes createdAt and updatedAt columns }); // We don't need create a join table when we're using an ORM // Use a method to set relationships Activity.belongsToMany(User, {through: 'UserActivity'}); User.belongsToMany(Activity, {through: 'UserActivity'}); // User.sync().success(function () { // console.log('User table created!'); // }); // Activity.sync().success(function () { // console.log('Activity table created!'); // }); db.sync(); return {User:User, Activity: Activity}; };
Modify user table to match data from Auth0
Modify user table to match data from Auth0
JavaScript
mit
hmfoster/beards-of-zeus,marqshort/beards-of-zeus,beards-of-zeus/beards-of-zeus,beards-of-zeus/beards-of-zeus,hmfoster/beards-of-zeus,marqshort/beards-of-zeus,beards-of-zeus/beards-of-zeus,marqshort/beards-of-zeus,hmfoster/beards-of-zeus
eb8d348aa7fb51bb87f347689c128a7de0c163f5
server/db/userModel.js
server/db/userModel.js
/* eslint new-cap: 0 */ const mongoose = require('mongoose'); const bcrypt = require('bcrypt-nodejs'); const Q = require('q'); const SALT_WORK_FACTOR = 10; const UserSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true, }, password: { type: String, required: true, }, salt: String, textViewText: { type: Array, default: [], }, speechViewText: { type: Array, default: [], }, speechViewSecondsElapsed: Number, }); UserSchema.methods.comparePasswords = function (candidatePassword) { const savedPassword = this.password; return Q.Promise((resolve, reject) => { bcrypt.compare(candidatePassword, savedPassword, (err, matched) => { if (err) { reject(err); } else { resolve(matched); } }); }); }; UserSchema.pre('save', function presaveCallback(next) { const user = this; return bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt) => { if (err) { return next(err); } return bcrypt.hash(user.password, salt, null, (err2, hash) => { if (err2) { return next(err2); } user.password = hash; user.salt = salt; return next(); }); }); }); module.exports = mongoose.model('User', UserSchema);
/* eslint new-cap: 0 */ const mongoose = require('mongoose'); const bcrypt = require('bcrypt-nodejs'); const Q = require('q'); const SALT_WORK_FACTOR = 10; const UserSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true, }, password: { type: String, required: true, }, salt: String, textViewText: { type: Array, default: [], }, speechViewText: { type: Array, default: [], }, speechViewSecondsElapsed: Number, }); UserSchema.methods.comparePasswords = (candidatePassword) => { const savedPassword = this.password; return Q.Promise((resolve, reject) => { bcrypt.compare(candidatePassword, savedPassword, (err, matched) => { if (err) { reject(err); } else { resolve(matched); } }); }); }; UserSchema.pre('save', function presaveCallback(next) { const user = this; return bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt) => { if (err) { return next(err); } return bcrypt.hash(user.password, salt, null, (err2, hash) => { if (err2) { return next(err2); } user.password = hash; user.salt = salt; return next(); }); }); }); module.exports = mongoose.model('User', UserSchema);
Remove unused JWT and fix linter erros
Remove unused JWT and fix linter erros
JavaScript
mit
nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor
--- +++ @@ -27,7 +27,7 @@ speechViewSecondsElapsed: Number, }); -UserSchema.methods.comparePasswords = function (candidatePassword) { +UserSchema.methods.comparePasswords = (candidatePassword) => { const savedPassword = this.password; return Q.Promise((resolve, reject) => { bcrypt.compare(candidatePassword, savedPassword, (err, matched) => {
2605920af7d5b2000b13fd64eb791d30d041faf6
server/routes/memos.js
server/routes/memos.js
var fs = require('fs'); var read = fs.createReadStream('./memos/memo0.md'); var io = require('socket.io').listen(9001); io.sockets.on('connection', function (socket) { read.on('data', function (data) { var content = data.toString(); socket.emit('memo', { title: 'Title', content: content }); }); }); exports.list = function(req, res){ res.send("respond with a resource"); };
var MEMO_FILE = './memos/memo0.md'; var fs = require('fs'); var read = fs.createReadStream(MEMO_FILE); var io = require('socket.io').listen(9001); io.sockets.on('connection', function (socket) { read.on('data', function (data) { startWatching(MEMO_FILE); var content = data.toString(); sendMemo(content); function startWatching (fileName) { var watcher = fs.watch(fileName, {persistent: true}, function (event, filename) { content = fs.readFileSync(MEMO_FILE).toString(); sendMemo(content); watcher.close(); startWatching(fileName); }); } function sendMemo (content) { socket.emit('memo', { title: 'Title', content: content }); } }); }); exports.list = function(req, res){ res.send("respond with a resource"); };
Update memo when its file is updated
Update memo when its file is updated
JavaScript
mit
eqot/memo
--- +++ @@ -1,16 +1,32 @@ +var MEMO_FILE = './memos/memo0.md'; var fs = require('fs'); -var read = fs.createReadStream('./memos/memo0.md'); +var read = fs.createReadStream(MEMO_FILE); var io = require('socket.io').listen(9001); io.sockets.on('connection', function (socket) { read.on('data', function (data) { + startWatching(MEMO_FILE); + var content = data.toString(); + sendMemo(content); - socket.emit('memo', { - title: 'Title', - content: content - }); + function startWatching (fileName) { + var watcher = fs.watch(fileName, {persistent: true}, function (event, filename) { + content = fs.readFileSync(MEMO_FILE).toString(); + sendMemo(content); + + watcher.close(); + startWatching(fileName); + }); + } + + function sendMemo (content) { + socket.emit('memo', { + title: 'Title', + content: content + }); + } }); });
f2a175f1af5ae117a03e2761e44d1cf771e99a84
spec/hyperYieldSpec.js
spec/hyperYieldSpec.js
describe('hyper-yield tag', function() { var $compile, $rootScope; beforeEach(module('hyperContentFor')); beforeEach(inject(function(_$compile_, _$rootScope_) { $compile = _$compile_; $rootScope = _$rootScope_; })); it('Replace with content from matching hyper-content', function() { var contentForElement = $compile("<hyper-content to='header'><h2>Content for header</h2></hyper-yield>")($rootScope); var yieldToElement = $compile("<hyper-yield from='header'><h2>Default</h2></hyper-yield>")($rootScope); $rootScope.$digest(); expect(yieldToElement.html()).toContain("<h2 class=\"ng-scope\">Content for header</h2>"); }); });
describe('hyper-yield tag', function() { var $compile, $rootScope; beforeEach(module('hyperContentFor')); beforeEach(inject(function(_$compile_, _$rootScope_) { $compile = _$compile_; $rootScope = _$rootScope_; })); it('is replaced with content from matching hyper-content', function() { var contentForElement = $compile("<hyper-content to='header'><h2>Content for header</h2></hyper-yield>")($rootScope); var yieldToElement = $compile("<hyper-yield from='header'><h2>Default</h2></hyper-yield>")($rootScope); $rootScope.$digest(); expect(yieldToElement.html()).toContain("<h2 class=\"ng-scope\">Content for header</h2>"); }); });
Change it description for better error output
Change it description for better error output
JavaScript
mit
hyperoslo/hyper-content-for-angular,hyperoslo/hyper-content-for-angular
--- +++ @@ -9,7 +9,7 @@ $rootScope = _$rootScope_; })); - it('Replace with content from matching hyper-content', function() { + it('is replaced with content from matching hyper-content', function() { var contentForElement = $compile("<hyper-content to='header'><h2>Content for header</h2></hyper-yield>")($rootScope); var yieldToElement = $compile("<hyper-yield from='header'><h2>Default</h2></hyper-yield>")($rootScope);
743b34469b870f47acc97973accb9f7b92c8e3cb
src/initialReducers.js
src/initialReducers.js
import { reducer as form } from 'redux-form'; import okapiReducer from './okapiReducer'; import { discoveryReducer } from './discoverServices'; export default { // TODO: here's where you'd pull in a reducer to handle Okapi actions like auth okapi: okapiReducer, discovery: discoveryReducer, form, };
import { reducer as form } from 'redux-form'; import okapiReducer from './okapiReducer'; import { discoveryReducer } from './discoverServices'; import { keyBindingsReducer } from './discoverKeyBindings'; export default { // TODO: here's where you'd pull in a reducer to handle Okapi actions like auth okapi: okapiReducer, discovery: discoveryReducer, bindings: keyBindingsReducer, form, };
Include keyBindingsReducer is initial reducers.
Include keyBindingsReducer is initial reducers. Part of STRPCORE-2.
JavaScript
apache-2.0
folio-org/stripes-core,folio-org/stripes-core,folio-org/stripes-core
--- +++ @@ -1,10 +1,12 @@ import { reducer as form } from 'redux-form'; import okapiReducer from './okapiReducer'; import { discoveryReducer } from './discoverServices'; +import { keyBindingsReducer } from './discoverKeyBindings'; export default { // TODO: here's where you'd pull in a reducer to handle Okapi actions like auth okapi: okapiReducer, discovery: discoveryReducer, + bindings: keyBindingsReducer, form, };
5a873161f8604b144e309bb01e7e18d71e9f8cc3
src/js/windows/main.js
src/js/windows/main.js
/** * Squid Desktop * Main window * */ 'use strict'; var Desktop = window.Squid var MainWindow = function() { console.log('+++++++') console.log( Desktop._UID ) console.log( screen.height ) return this } module.exports = MainWindow
/** * Squid Desktop * Main window * */ 'use strict'; var Desktop = window.Squid , Core = Desktop.core() var MainWindow = function() { console.log('+++++++') console.log( Desktop._UID ) console.log( screen.height ) // set user token // -------------------- var Config = require('../config') // private config file Core.setGithubToken( Config.githubApp.token ) console.log( Core.getGithubToken() ) var store = Core.store('user') store.listen( function( status ) { if( status.user ) { // console.log('------------------') // console.log( store.model().attributes ) // console.log('------------------') console.log(store.model().getName()) // userRepo() // userOrgs() } if( status.error ) console.log('status: ', status.message) }) return this } module.exports = MainWindow
Test call store from app window
Test call store from app window
JavaScript
mit
squid-app/desktop,squid-app/desktop,squid-app/desktop,squid-app/desktop,squid-app/desktop
--- +++ @@ -7,12 +7,40 @@ 'use strict'; var Desktop = window.Squid + , Core = Desktop.core() var MainWindow = function() { console.log('+++++++') console.log( Desktop._UID ) console.log( screen.height ) + + + // set user token + // -------------------- + var Config = require('../config') // private config file + Core.setGithubToken( Config.githubApp.token ) + + console.log( Core.getGithubToken() ) + + var store = Core.store('user') + + store.listen( function( status ) + { + if( status.user ) + { + // console.log('------------------') + // console.log( store.model().attributes ) + // console.log('------------------') + console.log(store.model().getName()) + // userRepo() + // userOrgs() + } + + if( status.error ) + console.log('status: ', status.message) + }) + return this }
b7f97d7185efe2e2e1f1a5282e65000e68813932
src/plugins/example/public/js/example.js
src/plugins/example/public/js/example.js
(function (window, $, undefined) { 'use strict'; var Example; Example = function Example(cockpit) { console.log('Loading example plugin in the browser.'); // Instance variables this.cockpit = cockpit; // Add required UI elements $('#menu').prepend('<div id="example" class="hidden">[example]</div>'); cockpitEventEmitter.on('cockpit.pluginsLoaded', function() { cockpitEventEmitter.emit('headsUpMenu.register', { label: "Example menu", // no type == explicit buttons callback: function () { alert('example menu item from heads up menu'); } }); cockpitEventEmitter.emit('headsUpMenu.register', { label: "Example menu button", type: "button", callback: function () { alert('example menu item from heads up menu 2'); } }); cockpitEventEmitter.emit('headsUpMenu.register', { type: "custom", content: '<button class="btn btn-large btn-info btn-block" data-bind="click: callback">Custom button</button>', callback: function () { alert('Message from custom Button'); } }); }); }; window.Cockpit.plugins.push(Example); }(window, jQuery));
(function (window, $, undefined) { 'use strict'; var Example; Example = function Example(cockpit) { console.log('Loading example plugin in the browser.'); // Instance variables this.cockpit = cockpit; // Add required UI elements $('#menu').prepend('<div id="example" class="hidden">[example]</div>'); cockpitEventEmitter.on('cockpit.pluginsLoaded', function() { var item = { label: ko.observable("Example menu") }; item.callback = function () { alert('example menu item from heads up menu'); item.label( item.label() +" Foo Bar"); }; cockpitEventEmitter.emit('headsUpMenu.register', item); cockpitEventEmitter.emit('headsUpMenu.register', { type: "custom", content: '<button class="btn btn-large btn-info btn-block" data-bind="click: callback">Custom button</button>', callback: function () { alert('Message from custom Button'); } }); }); }; window.Cockpit.plugins.push(Example); }(window, jQuery));
Test with content changing button
Test with content changing button
JavaScript
mit
BrianAdams/openrov-software,MysteriousChanger/burrito-cockpid,ChangerR/burrito-cockpid,ZonaElka/testOpenROV,codewithpassion/openrov-software,BrianAdams/openrov-software,ChangerR/burrito-cockpid,codewithpassion/openrov-software,MysteriousChanger/burrito-cockpid,ZonaElka/testOpenROV,LeeCheongAh/openrov-software,MysteriousChanger/burrito-cockpid,BrianAdams/openrov-software,ChangerR/burrito-cockpid,LeeCheongAh/openrov-software,codewithpassion/openrov-software,BrianAdams/openrov-software,ZonaElka/testOpenROV,codewithpassion/openrov-software
--- +++ @@ -9,20 +9,17 @@ $('#menu').prepend('<div id="example" class="hidden">[example]</div>'); cockpitEventEmitter.on('cockpit.pluginsLoaded', function() { - cockpitEventEmitter.emit('headsUpMenu.register', { - label: "Example menu", - // no type == explicit buttons - callback: function () { + + var item = { + label: ko.observable("Example menu") + }; + item.callback = function () { alert('example menu item from heads up menu'); - } - }); - cockpitEventEmitter.emit('headsUpMenu.register', { - label: "Example menu button", - type: "button", - callback: function () { - alert('example menu item from heads up menu 2'); - } - }); + item.label( item.label() +" Foo Bar"); + }; + + cockpitEventEmitter.emit('headsUpMenu.register', item); + cockpitEventEmitter.emit('headsUpMenu.register', { type: "custom", content: '<button class="btn btn-large btn-info btn-block" data-bind="click: callback">Custom button</button>', @@ -31,6 +28,8 @@ } }); + + }); }; window.Cockpit.plugins.push(Example);
44fd1ebce7593b78580b790c44db32fc46a19c5e
src/scripts/components/colour/History.js
src/scripts/components/colour/History.js
import Clipboard from 'clipboard'; import React from 'react'; import { Colours } from '../../modules/colours'; import { Saved } from '../../modules/saved'; export class History extends React.Component { constructor (props) { super(props); this.max = 10; this.state = { history: new Array(this.max) }; this.pushToStack = this.pushToStack.bind(this); } componentWillMount () { this.pushToStack(this.props.colour); } componentWillReceiveProps (nextProps) { this.pushToStack(nextProps.colour); } pushToStack (item) { let stack = this.state.history; stack.push(item); // Only keep newest max amount of items stack.splice(0, stack.length - this.max); } render () { return ( <div className='history'> { this.state.history.map((colour, i) => { let formattedColour = Colours.format(colour, this.props.format); return ( <div key={i} className='history__item copy' style={{ backgroundColor: colour }} data-colour={formattedColour} data-clipboard-text={formattedColour} onClick={() => Saved.add(colour)} /> ); }) } </div> ); } }
import Clipboard from 'clipboard'; import React from 'react'; import { Colours } from '../../modules/colours'; import { Saved } from '../../modules/saved'; export class History extends React.Component { constructor (props) { super(props); this.max = 10; this.state = { history: new Array(this.max) }; this.pushToStack = this.pushToStack.bind(this); } componentWillMount () { this.pushToStack(this.props.colour); } componentWillReceiveProps (nextProps) { this.pushToStack(nextProps.colour); } pushToStack (item) { if (item !== this.state.history[this.state.history.length - 1]) { let stack = this.state.history; stack.push(item); // Only keep newest max amount of items stack.splice(0, stack.length - this.max); } } render () { return ( <div className='history'> { this.state.history.map((colour, i) => { let formattedColour = Colours.format(colour, this.props.format); return ( <div key={i} className='history__item copy' style={{ backgroundColor: colour }} data-colour={formattedColour} data-clipboard-text={formattedColour} onClick={() => Saved.add(colour)} /> ); }) } </div> ); } }
Fix history adding too many things when clicked
Fix history adding too many things when clicked
JavaScript
mit
arkon/ColourNTP,arkon/ColourNTP
--- +++ @@ -26,12 +26,14 @@ } pushToStack (item) { - let stack = this.state.history; + if (item !== this.state.history[this.state.history.length - 1]) { + let stack = this.state.history; - stack.push(item); + stack.push(item); - // Only keep newest max amount of items - stack.splice(0, stack.length - this.max); + // Only keep newest max amount of items + stack.splice(0, stack.length - this.max); + } } render () {
bc692a8b85694dd231588a223b34ea32ba8849b6
test/129809_ais_class_b_static_data.js
test/129809_ais_class_b_static_data.js
var chai = require("chai"); chai.Should(); chai.use(require('chai-things')); chai.use(require('signalk-schema').chaiModule); var mapper = require("../n2kMapper.js"); describe('129039 Class B Update', function () { it('complete sentence converts', function () { var msg = JSON.parse('{"timestamp":"2014-08-15-15:00:04.655","prio":"6","src":"43","dst":"255","pgn":"129809","description":"AIS Class B static data (msg 24 Part A)","fields":{"Message ID":"24","Repeat indicator":"Initial","User ID":"230044160","Name":"LAGUNA"}}'); var delta = mapper.toDelta(msg); delta.updates.length.should.equal(1); delta.updates[0].context.should.equal('vessels.230044160'); }); });
var chai = require("chai"); chai.Should(); chai.use(require('chai-things')); chai.use(require('signalk-schema').chaiModule); var mapper = require("../n2kMapper.js"); describe('129809 Class B static data', function () { it('complete sentence converts', function () { var msg = JSON.parse('{"timestamp":"2014-08-15-15:00:04.655","prio":"6","src":"43","dst":"255","pgn":"129809","description":"AIS Class B static data (msg 24 Part A)","fields":{"Message ID":"24","Repeat indicator":"Initial","User ID":"230044160","Name":"LAGUNA"}}'); var delta = mapper.toDelta(msg); delta.updates.length.should.equal(1); delta.updates[0].context.should.equal('vessels.230044160'); }); });
Fix error in test title
Fix error in test title
JavaScript
apache-2.0
SignalK/n2k-signalk
--- +++ @@ -6,7 +6,7 @@ var mapper = require("../n2kMapper.js"); -describe('129039 Class B Update', function () { +describe('129809 Class B static data', function () { it('complete sentence converts', function () { var msg = JSON.parse('{"timestamp":"2014-08-15-15:00:04.655","prio":"6","src":"43","dst":"255","pgn":"129809","description":"AIS Class B static data (msg 24 Part A)","fields":{"Message ID":"24","Repeat indicator":"Initial","User ID":"230044160","Name":"LAGUNA"}}'); var delta = mapper.toDelta(msg);
918d1eafc61fc406249114c6368bde438ec74588
client/src/components/Bookmarks/Bookmarks.js
client/src/components/Bookmarks/Bookmarks.js
import React from 'react'; import { withScrollToTop } from '../hocs/withScrollToTop'; import FeaturedItems from '../FeaturedItems'; import { Header, Status } from './styled'; const Bookmarks = ({ savedJobs = [], data, loggedIn, ...props }) => { const jobs = savedJobs.reduce((acc, id) => { const job = data.find(job => job._id === id); if (job) acc.push(job); return acc; }, []); const status = !jobs.length ? `You haven't saved any jobs yet` : `You have ${jobs.length} saved job${jobs.length === 1 ? '' : 's'}`; if (!loggedIn || !data) { return null; } return ( <div> <Header>My saved jobs</Header> <Status>{status}</Status> <FeaturedItems {...props} data={jobs} savedJobs={savedJobs} />; </div> ); }; export default withScrollToTop(Bookmarks);
import React from 'react'; import { withScrollToTop } from '../hocs/withScrollToTop'; import FeaturedItems from '../FeaturedItems'; import { Header, Status } from './styled'; const Bookmarks = props => { const { savedJobs = [], data, loggedIn } = props; const jobs = savedJobs.reduce((acc, id) => { const job = data.find(job => job._id === id); if (job) acc.push(job); return acc; }, []); const status = !jobs.length ? `You haven't saved any jobs yet` : `You have ${jobs.length} saved job${jobs.length === 1 ? '' : 's'}`; if (!loggedIn || !data) { return null; } return ( <div> <Header>My saved jobs</Header> <Status>{status}</Status> <FeaturedItems {...props} data={jobs} />; </div> ); }; export default withScrollToTop(Bookmarks);
Fix bug with removing saved job from bookmarks
Fix bug with removing saved job from bookmarks
JavaScript
mit
jenovs/bears-team-14,jenovs/bears-team-14
--- +++ @@ -6,7 +6,9 @@ import { Header, Status } from './styled'; -const Bookmarks = ({ savedJobs = [], data, loggedIn, ...props }) => { +const Bookmarks = props => { + const { savedJobs = [], data, loggedIn } = props; + const jobs = savedJobs.reduce((acc, id) => { const job = data.find(job => job._id === id); if (job) acc.push(job); @@ -25,7 +27,7 @@ <div> <Header>My saved jobs</Header> <Status>{status}</Status> - <FeaturedItems {...props} data={jobs} savedJobs={savedJobs} />; + <FeaturedItems {...props} data={jobs} />; </div> ); };
3a9a202817b20cc00d3fc4b558a00425d965da38
components/page/header/language-selection.js
components/page/header/language-selection.js
import { stringify } from 'querystring' import React from 'react' import PropTypes from 'prop-types' import moment from 'moment' import { withRouter } from 'next/router' import { translate } from 'react-i18next' import Dropdown from '../../dropdown' export class LanguageSelection extends React.PureComponent { static propTypes = { i18n: PropTypes.shape({ changeLanguage: PropTypes.func.isRequired }).isRequired, router: PropTypes.shape({ pathname: PropTypes.string.isRequired, query: PropTypes.object.isRequired, asPath: PropTypes.string.isRequired }).isRequired } changeLanguage(language) { const { i18n, router } = this.props const current = i18n.language moment.locale(language) i18n.changeLanguage(language) router.replace( `${router.pathname}?${stringify(router.query)}`, `/${language}${router.asPath.substring(1 + current.length)}` ) } render() { const { i18n } = this.props return ( <Dropdown title={i18n.language === 'en' ? '🇬🇧' : '🇫🇷'} links={[ { action: () => this.changeLanguage('en'), text: 'English 🇬🇧' }, { action: () => this.changeLanguage('fr'), text: 'Français 🇫🇷' } ]} /> ) } } export default translate()(withRouter(LanguageSelection))
import { stringify } from 'querystring' import React from 'react' import PropTypes from 'prop-types' import { withRouter } from 'next/router' import { translate } from 'react-i18next' import Dropdown from '../../dropdown' export class LanguageSelection extends React.PureComponent { static propTypes = { i18n: PropTypes.shape({ changeLanguage: PropTypes.func.isRequired }).isRequired, router: PropTypes.shape({ pathname: PropTypes.string.isRequired, query: PropTypes.object.isRequired, asPath: PropTypes.string.isRequired }).isRequired } changeLanguage(language) { const { i18n, router } = this.props const current = i18n.language i18n.changeLanguage(language) router.replace( `${router.pathname}?${stringify(router.query)}`, `/${language}${router.asPath.substring(1 + current.length)}` ) } render() { const { i18n } = this.props return ( <Dropdown title={i18n.language === 'en' ? '🇬🇧' : '🇫🇷'} links={[ { action: () => this.changeLanguage('en'), text: 'English 🇬🇧' }, { action: () => this.changeLanguage('fr'), text: 'Français 🇫🇷' } ]} /> ) } } export default translate()(withRouter(LanguageSelection))
Stop changing moment locale twice
Stop changing moment locale twice
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -1,7 +1,6 @@ import { stringify } from 'querystring' import React from 'react' import PropTypes from 'prop-types' -import moment from 'moment' import { withRouter } from 'next/router' import { translate } from 'react-i18next' @@ -25,7 +24,6 @@ const current = i18n.language - moment.locale(language) i18n.changeLanguage(language) router.replace(
d0337c801ae406538f98e9503449baaab12507f9
assets/javascript/head.scripts.js
assets/javascript/head.scripts.js
/** * head.script.js * * Essential scripts, to be loaded in the head of the document * Use gruntfile.js to include the necessary script files. */ // Load respimage if <picture> element is not supported if(!window.HTMLPictureElement){ enhance.loadJS('/assets/javascript/lib/polyfills/respimage.min.js'); }
/** * head.script.js * * Essential scripts, to be loaded in the head of the document * Use gruntfile.js to include the necessary script files. */ // Load respimage if <picture> element is not supported if(!window.HTMLPictureElement){ document.createElement('picture'); enhance.loadJS('/assets/javascript/lib/polyfills/respimage.min.js'); }
Create hidden picture element when respimage is loaded.
Create hidden picture element when respimage is loaded. Seen in this example: https://github.com/fabianmichael/kirby-imageset#23-template-setup
JavaScript
mit
jolantis/altair,jolantis/altair
--- +++ @@ -7,5 +7,6 @@ // Load respimage if <picture> element is not supported if(!window.HTMLPictureElement){ + document.createElement('picture'); enhance.loadJS('/assets/javascript/lib/polyfills/respimage.min.js'); }
362bd33a93a7fe98d4eb92552ae17f093724d0f9
app/scripts/components/openstack/openstack-backup/openstack-backup-restore-summary.js
app/scripts/components/openstack/openstack-backup/openstack-backup-restore-summary.js
const openstackBackupRestoreSummary = { template: '<openstack-instance-checkout-summary ng-if="$ctrl.context.resource" model="$ctrl.summaryModel"/>', bindings: { model: '<', field: '<', context: '<', }, controller: class ComponentController { constructor($scope) { // @ngInject this.$scope = $scope; this.summaryModel = {}; } $onInit() { this.$scope.$watch(() => this.model, () => { this.summaryModel = this.getSummaryModel(); }, true); } getSummaryModel() { return { service: { settings: this.context.resource.service_settings, name: this.context.resource.service_name, }, flavor: this.model.flavor, image: { name: this.context.resource.metadata.image_name, }, customer: { name: this.context.resource.customer_name, }, project: { name: this.context.resource.project_name, }, system_volume_size: 0, data_volume_size: 0, }; } } }; export default openstackBackupRestoreSummary;
const openstackBackupRestoreSummary = { template: '<openstack-instance-checkout-summary ng-if="$ctrl.resource" model="$ctrl.summaryModel"/>', bindings: { model: '<', field: '<', context: '<', }, controller: class ComponentController { constructor($scope, resourcesService) { // @ngInject this.$scope = $scope; this.resourcesService = resourcesService; this.summaryModel = {}; } $onInit() { this.loadResource(); this.setupWatcher(); } loadResource() { if (!this.context.resource.metadata) { this.resourcesService .$get(null, null, this.context.resource.url) .then(resource => this.resource = resource) } else { this.resource = this.context.resource; } } setupWatcher() { this.$scope.$watch(() => [this.model, this.resource], () => { this.summaryModel = this.getSummaryModel(); }, true); } getSummaryModel() { if (!this.resource) { return; } return { service: { settings: this.resource.service_settings, name: this.resource.service_name, }, flavor: this.model.flavor, image: { name: this.resource.metadata.image_name, }, customer: { name: this.resource.customer_name, }, project: { name: this.resource.project_name, }, system_volume_size: this.resource.metadata.size, data_volume_size: 0, }; } } }; export default openstackBackupRestoreSummary;
Load beackup metadata for restore action
Load beackup metadata for restore action [WAL-547]
JavaScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -1,40 +1,59 @@ const openstackBackupRestoreSummary = { - template: '<openstack-instance-checkout-summary ng-if="$ctrl.context.resource" model="$ctrl.summaryModel"/>', + template: '<openstack-instance-checkout-summary ng-if="$ctrl.resource" model="$ctrl.summaryModel"/>', bindings: { model: '<', field: '<', context: '<', }, controller: class ComponentController { - constructor($scope) { + constructor($scope, resourcesService) { // @ngInject this.$scope = $scope; + this.resourcesService = resourcesService; this.summaryModel = {}; } $onInit() { - this.$scope.$watch(() => this.model, () => { + this.loadResource(); + this.setupWatcher(); + } + + loadResource() { + if (!this.context.resource.metadata) { + this.resourcesService + .$get(null, null, this.context.resource.url) + .then(resource => this.resource = resource) + } else { + this.resource = this.context.resource; + } + } + + setupWatcher() { + this.$scope.$watch(() => [this.model, this.resource], () => { this.summaryModel = this.getSummaryModel(); }, true); } getSummaryModel() { + if (!this.resource) { + return; + } return { service: { - settings: this.context.resource.service_settings, - name: this.context.resource.service_name, + settings: this.resource.service_settings, + name: this.resource.service_name, }, flavor: this.model.flavor, image: { - name: this.context.resource.metadata.image_name, + name: this.resource.metadata.image_name, }, customer: { - name: this.context.resource.customer_name, + name: this.resource.customer_name, }, project: { - name: this.context.resource.project_name, + name: this.resource.project_name, }, - system_volume_size: 0, + system_volume_size: this.resource.metadata.size, data_volume_size: 0, }; }
1b43b73887930d6809652e1ee1b20b257008035b
frappe/public/js/frappe/ui/toolbar/search.js
frappe/public/js/frappe/ui/toolbar/search.js
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // MIT License. See license.txt frappe.ui.toolbar.Search = frappe.ui.toolbar.SelectorDialog.extend({ init: function() { this._super({ title: frappe._("Search"), execute: function(val) { frappe.set_route("List", val); }, help: frappe._("Shortcut") + ": Ctrl+G" }); // get new types this.set_values(frappe.boot.profile.can_search.join(',').split(',')); } });
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // MIT License. See license.txt frappe.ui.toolbar.Search = frappe.ui.toolbar.SelectorDialog.extend({ init: function() { this._super({ title: frappe._("Search"), execute: function(val) { frappe.set_route("List", val, {"name": "%"}); }, help: frappe._("Shortcut") + ": Ctrl+G" }); // get new types this.set_values(frappe.boot.profile.can_search.join(',').split(',')); } });
Add default filter on ID when listview loaded from Toolber Search
Add default filter on ID when listview loaded from Toolber Search
JavaScript
mit
gangadharkadam/saloon_frappe,bohlian/frappe,Tejal011089/digitales_frappe,pranalik/frappe-bb,indictranstech/phr-frappe,indictranstech/trufil-frappe,sbktechnology/sap_frappe,aboganas/frappe,gangadharkadam/office_frappe,manassolanki/frappe,mhbu50/frappe,gangadharkadam/tailorfrappe,manassolanki/frappe,suyashphadtare/sajil-frappe,hatwar/buyback-frappe,suyashphadtare/sajil-frappe,rohitwaghchaure/vestasi-frappe,saurabh6790/frappe,chdecultot/frappe,nerevu/frappe,vqw/frappe,suyashphadtare/sajil-final-frappe,indictranstech/ebuy-now-frappe,ESS-LLP/frappe,indictranstech/osmosis-frappe,vqw/frappe,jevonearth/frappe,gangadharkadam/johnfrappe,gangadharkadam/letzfrappe,indictranstech/omnitech-frappe,gangadhar-kadam/helpdesk-frappe,rkawale/Internalhr-frappe,elba7r/frameworking,mbauskar/frappe,saurabh6790/test-frappe,indictranstech/fbd_frappe,gangadharkadam/vervefrappe,rohitw1991/frappe,gangadhar-kadam/verve_test_frappe,gangadharkadam/frappecontribution,erpletzerp/letzerpcore,indictranstech/phr-frappe,Tejal011089/digitales_frappe,rohitwaghchaure/frappe,indictranstech/phr-frappe,sbktechnology/trufil-frappe,Amber-Creative/amber-frappe,ashokrajbathu/secondrep,rohitwaghchaure/frappe,saurabh6790/frappe,saurabh6790/test-frappe,elba7r/builder,deveninfotech/deven-frappe,rohitwaghchaure/frappe-alec,indictranstech/frappe-digitales,mbauskar/omnitech-demo-frappe,neilLasrado/frappe,bcornwellmott/frappe,vCentre/vFRP-6233,mbauskar/omnitech-demo-frappe,bohlian/frappe,rohitwaghchaure/frappe-digitales,RicardoJohann/frappe,mbauskar/frappe,gangadharkadam/vervefrappe,bcornwellmott/frappe,rohitwaghchaure/frappe_smart,mbauskar/helpdesk-frappe,pranalik/frappe-bb,mbauskar/omnitech-demo-frappe,indictranstech/phr-frappe,drukhil/frappe,gangadharkadam/v5_frappe,indautgrp/frappe,suyashphadtare/sajil-final-frappe,shitolepriya/test-frappe,gangadhar-kadam/verve_test_frappe,ShashaQin/frappe,paurosello/frappe,elba7r/builder,paurosello/frappe,rohitwaghchaure/New_Theme_frappe,StrellaGroup/frappe,gangadharkadam/vervefrappe,indictranstech/frappe-digitales,indictranstech/trufil-frappe,tmimori/frappe,mbauskar/tele-frappe,gangadhar-kadam/verve_frappe,erpletzerp/letzerpcore,gangadharkadam/vlinkfrappe,indautgrp/frappe,vqw/frappe,gangadhar-kadam/verve_live_frappe,rohitwaghchaure/frappe-digitales,indictranstech/tele-frappe,mbauskar/frappe,cadencewatches/frappe,pawaranand/phr-frappe,MaxMorais/frappe,gangadhar-kadam/smrterpfrappe,tundebabzy/frappe,mbauskar/Das_frappe,rohitw1991/smartfrappe,RicardoJohann/frappe,mbauskar/phr-frappe,yashodhank/frappe,indictranstech/Das_frappe,ShashaQin/frappe,anandpdoshi/frappe,praba230890/frappe,rohitw1991/smartfrappe,gangadharkadam/v4_frappe,almeidapaulopt/frappe,indictranstech/Das_frappe,hatwar/buyback-frappe,adityahase/frappe,praba230890/frappe,gangadharkadam/frappecontribution,ESS-LLP/frappe,tmimori/frappe,shitolepriya/test-frappe,indictranstech/tele-frappe,drukhil/frappe,gangadhar-kadam/hrfrappe,mbauskar/tele-frappe,indictranstech/frappe,manassolanki/frappe,indictranstech/frappe,indictranstech/frappe,mhbu50/frappe,BhupeshGupta/frappe,gangadharkadam/letzfrappe,gangadharkadam/shfr,sbkolate/sap_frappe_v6,gangadharkadam/v6_frappe,gangadharkadam/v6_frappe,gangadharkadam/vlinkfrappe,jevonearth/frappe,vCentre/vFRP-6233,RicardoJohann/frappe,rohitwaghchaure/vestasi-frappe,indictranstech/reciphergroup-frappe,StrellaGroup/frappe,anandpdoshi/frappe,hatwar/buyback-frappe,tundebabzy/frappe,mbauskar/Das_frappe,sbktechnology/sap_frappe,shitolepriya/test-frappe,BhupeshGupta/frappe,mbauskar/phr-frappe,indictranstech/reciphergroup-frappe,letzerp/framework,aboganas/frappe,yashodhank/frappe,hernad/frappe,drukhil/frappe,ESS-LLP/frappe,paurosello/frappe,hernad/frappe,indictranstech/frappe,indictranstech/internal-frappe,mbauskar/omnitech-frappe,frappe/frappe,deveninfotech/deven-frappe,mbauskar/phr-frappe,elba7r/frameworking,ShashaQin/frappe,indictranstech/internal-frappe,maxtorete/frappe,elba7r/builder,indictranstech/trufil-frappe,indictranstech/tele-frappe,praba230890/frappe,rohitwaghchaure/frappe,pranalik/frappe-bb,bohlian/frappe,Amber-Creative/amber-frappe,gangadharkadam/saloon_frappe_install,indictranstech/ebuy-now-frappe,maxtorete/frappe,almeidapaulopt/frappe,yashodhank/frappe,sbkolate/sap_frappe_v6,gangadharkadam/vlinkfrappe,manassolanki/frappe,sbkolate/sap_frappe_v6,elba7r/frameworking,geo-poland/frappe,gangadhar-kadam/lgnlvefrape,drukhil/frappe,gangadhar-kadam/helpdesk-frappe,gangadhar-kadam/hrfrappe,bcornwellmott/frappe,reachalpineswift/frappe-bench,adityahase/frappe,BhupeshGupta/frappe,rohitwaghchaure/New_Theme_frappe,saurabh6790/phr-frappe,aboganas/frappe,sbkolate/sap_frappe_v6,pranalik/frappe-bb,rohitwaghchaure/frappe-alec,vCentre/vFRP-6233,indictranstech/frappe-digitales,gangadharkadam/v5_frappe,saurabh6790/frappe,reachalpineswift/frappe-bench,MaxMorais/frappe,gangadhar-kadam/helpdesk-frappe,gangadharkadam/v4_frappe,gangadharkadam/shfr,nerevu/frappe,rohitwaghchaure/frappe-digitales,pombredanne/frappe,indictranstech/reciphergroup-frappe,vqw/frappe,rmehta/frappe,indictranstech/Das_frappe,mbauskar/tele-frappe,mhbu50/frappe,StrellaGroup/frappe,adityahase/frappe,suyashphadtare/propshikhari-frappe,indictranstech/omnitech-frappe,saguas/frappe,gangadhar-kadam/helpdesk-frappe,ESS-LLP/frappe,indautgrp/frappe,neilLasrado/frappe,almeidapaulopt/frappe,gangadharkadam/saloon_frappe_install,gangadharkadam/vervefrappe,gangadharkadam/saloon_frappe,tundebabzy/frappe,pombredanne/frappe,suyashphadtare/propshikhari-frappe,chdecultot/frappe,erpletzerp/letzerpcore,gangadhar-kadam/laganfrappe,indictranstech/fbd_frappe,gangadharkadam/smrtfrappe,indictranstech/osmosis-frappe,MaxMorais/frappe,ashokrajbathu/secondrep,anandpdoshi/frappe,chdecultot/frappe,suyashphadtare/propshikhari-frappe,indictranstech/omnitech-frappe,mbauskar/omnitech-frappe,elba7r/frameworking,mbauskar/Das_frappe,indictranstech/internal-frappe,erpletzerp/letzerpcore,vjFaLk/frappe,shitolepriya/test-frappe,gangadharkadam/letzfrappe,rohitwaghchaure/frappe-digitales,almeidapaulopt/frappe,mbauskar/omnitech-frappe,gangadhar-kadam/verve_test_frappe,indictranstech/tele-frappe,gangadharkadam/saloon_frappe,gangadhar-kadam/verve_live_frappe,indictranstech/frappe-digitales,mbauskar/Das_frappe,aboganas/frappe,gangadharkadam/v6_frappe,nerevu/frappe,indictranstech/Das_frappe,Tejal011089/digitales_frappe,pawaranand/phr-frappe,yashodhank/frappe,neilLasrado/frappe,mbauskar/helpdesk-frappe,gangadharkadam/saloon_frappe_install,gangadhar-kadam/laganfrappe,hernad/frappe,gangadhar-kadam/lgnlvefrape,saguas/frappe,saguas/frappe,sbktechnology/sap_frappe,letzerp/framework,indictranstech/ebuy-now-frappe,saguas/frappe,gangadharkadam/office_frappe,gangadhar-kadam/laganfrappe,vjFaLk/frappe,sbktechnology/sap_frappe,rohitw1991/smarttailorfrappe,mbauskar/frappe,rohitwaghchaure/frappe,gangadhar-kadam/verve_live_frappe,gangadharkadam/vlinkfrappe,gangadhar-kadam/verve_frappe,adityahase/frappe,frappe/frappe,gangadharkadam/v4_frappe,letzerp/framework,mbauskar/omnitech-frappe,jevonearth/frappe,mbauskar/helpdesk-frappe,nerevu/frappe,indictranstech/fbd_frappe,gangadharkadam/tailorfrappe,pawaranand/phr-frappe,pawaranand/phr_frappe,indictranstech/osmosis-frappe,reachalpineswift/frappe-bench,mbauskar/tele-frappe,letzerp/framework,deveninfotech/deven-frappe,gangadhar-kadam/verve_live_frappe,hernad/frappe,bohlian/frappe,rohitwaghchaure/vestasi-frappe,gangadharkadam/johnfrappe,indautgrp/frappe,pawaranand/phr_frappe,rmehta/frappe,indictranstech/omnitech-frappe,anandpdoshi/frappe,mhbu50/frappe,mbauskar/omnitech-demo-frappe,saurabh6790/frappe,gangadhar-kadam/smrterpfrappe,BhupeshGupta/frappe,gangadhar-kadam/lgnlvefrape,indictranstech/osmosis-frappe,hatwar/buyback-frappe,mbauskar/phr-frappe,bcornwellmott/frappe,indictranstech/internal-frappe,geo-poland/frappe,indictranstech/reciphergroup-frappe,ShashaQin/frappe,saurabh6790/test-frappe,gangadharkadam/smrtfrappe,vjFaLk/frappe,saurabh6790/phr-frappe,gangadharkadam/stfrappe,rkawale/Internalhr-frappe,MaxMorais/frappe,praba230890/frappe,rmehta/frappe,vjFaLk/frappe,rohitwaghchaure/frappe_smart,sbktechnology/trufil-frappe,suyashphadtare/sajil-final-frappe,saurabh6790/test-frappe,tmimori/frappe,sbktechnology/trufil-frappe,elba7r/builder,maxtorete/frappe,rohitwaghchaure/New_Theme_frappe,frappe/frappe,chdecultot/frappe,indictranstech/fbd_frappe,deveninfotech/deven-frappe,ashokrajbathu/secondrep,rohitwaghchaure/frappe-alec,geo-poland/frappe,reachalpineswift/frappe-bench,gangadhar-kadam/verve_frappe,neilLasrado/frappe,indictranstech/ebuy-now-frappe,pombredanne/frappe,gangadharkadam/letzfrappe,RicardoJohann/frappe,saurabh6790/phr-frappe,rohitwaghchaure/vestasi-frappe,pawaranand/phr_frappe,pawaranand/phr_frappe,rmehta/frappe,gangadharkadam/v5_frappe,gangadharkadam/v5_frappe,cadencewatches/frappe,jevonearth/frappe,gangadharkadam/saloon_frappe,gangadhar-kadam/verve_test_frappe,gangadharkadam/saloon_frappe_install,mbauskar/helpdesk-frappe,paurosello/frappe,suyashphadtare/sajil-frappe,saurabh6790/phr-frappe,indictranstech/trufil-frappe,gangadhar-kadam/verve_frappe,sbktechnology/trufil-frappe,gangadharkadam/v4_frappe,maxtorete/frappe,ashokrajbathu/secondrep,gangadharkadam/stfrappe,Amber-Creative/amber-frappe,pombredanne/frappe,suyashphadtare/propshikhari-frappe,vCentre/vFRP-6233,gangadharkadam/frappecontribution,rohitw1991/smarttailorfrappe,Tejal011089/digitales_frappe,gangadharkadam/frappecontribution,rohitw1991/frappe,Amber-Creative/amber-frappe,gangadharkadam/office_frappe,gangadharkadam/v6_frappe,tmimori/frappe,tundebabzy/frappe
--- +++ @@ -6,7 +6,7 @@ this._super({ title: frappe._("Search"), execute: function(val) { - frappe.set_route("List", val); + frappe.set_route("List", val, {"name": "%"}); }, help: frappe._("Shortcut") + ": Ctrl+G" });
744cea642166ad67b8f0a35331d96ca246092636
src/ol/webgl/Buffer.js
src/ol/webgl/Buffer.js
/** * @module ol/webgl/Buffer */ import _ol_webgl_ from '../webgl.js'; /** * @enum {number} */ const BufferUsage = { STATIC_DRAW: _ol_webgl_.STATIC_DRAW, STREAM_DRAW: _ol_webgl_.STREAM_DRAW, DYNAMIC_DRAW: _ol_webgl_.DYNAMIC_DRAW }; /** * @constructor * @param {Array.<number>=} opt_arr Array. * @param {number=} opt_usage Usage. * @struct */ const WebGLBuffer = function(opt_arr, opt_usage) { /** * @private * @type {Array.<number>} */ this.arr_ = opt_arr !== undefined ? opt_arr : []; /** * @private * @type {number} */ this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage; }; /** * @return {Array.<number>} Array. */ WebGLBuffer.prototype.getArray = function() { return this.arr_; }; /** * @return {number} Usage. */ WebGLBuffer.prototype.getUsage = function() { return this.usage_; }; export default WebGLBuffer;
/** * @module ol/webgl/Buffer */ import _ol_webgl_ from '../webgl.js'; /** * @enum {number} */ const BufferUsage = { STATIC_DRAW: _ol_webgl_.STATIC_DRAW, STREAM_DRAW: _ol_webgl_.STREAM_DRAW, DYNAMIC_DRAW: _ol_webgl_.DYNAMIC_DRAW }; /** * @constructor * @param {Array.<number>=} opt_arr Array. * @param {number=} opt_usage Usage. * @struct */ const WebGLBuffer = function(opt_arr, opt_usage) { /** * @private * @type {Array.<number>} */ this.arr_ = opt_arr !== undefined ? opt_arr : []; /** * @private * @type {number} */ this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage.STATIC_DRAW; }; /** * @return {Array.<number>} Array. */ WebGLBuffer.prototype.getArray = function() { return this.arr_; }; /** * @return {number} Usage. */ WebGLBuffer.prototype.getUsage = function() { return this.usage_; }; export default WebGLBuffer;
Use STATIC_DRAW as default WebGL buffer usage
Use STATIC_DRAW as default WebGL buffer usage
JavaScript
bsd-2-clause
ahocevar/ol3,fredj/ol3,mzur/ol3,openlayers/openlayers,openlayers/openlayers,ahocevar/openlayers,geekdenz/openlayers,stweil/openlayers,adube/ol3,ahocevar/openlayers,fredj/ol3,tschaub/ol3,bjornharrtell/ol3,mzur/ol3,stweil/openlayers,gingerik/ol3,oterral/ol3,mzur/ol3,tschaub/ol3,bjornharrtell/ol3,geekdenz/ol3,geekdenz/openlayers,geekdenz/ol3,bjornharrtell/ol3,geekdenz/openlayers,fredj/ol3,geekdenz/ol3,openlayers/openlayers,oterral/ol3,stweil/ol3,ahocevar/openlayers,geekdenz/ol3,stweil/ol3,gingerik/ol3,gingerik/ol3,ahocevar/ol3,oterral/ol3,ahocevar/ol3,adube/ol3,gingerik/ol3,stweil/ol3,tschaub/ol3,stweil/openlayers,tschaub/ol3,adube/ol3,mzur/ol3,stweil/ol3,fredj/ol3,ahocevar/ol3
--- +++ @@ -30,7 +30,7 @@ * @private * @type {number} */ - this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage; + this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage.STATIC_DRAW; };
e80c620a958020e3221335a872a7439eae9233e6
app/assets/javascripts/vehicle-licensing/controllers/vehicle-license-volumes-module.js
app/assets/javascripts/vehicle-licensing/controllers/vehicle-license-volumes-module.js
define([ 'vehicle-licensing/collections/services', 'extensions/views/timeseries-graph/timeseries-graph', 'extensions/views/tabs', 'extensions/views/graph/headline', ], function (ServicesCollection, TimeseriesGraph, Tabs, Headline) { return function (selector, id, type) { var serviceCollection = new ServicesCollection([], { seriesList: [{ id: id, title: type }] }); serviceCollection.query.set('period', 'week'); serviceCollection.fetch(); new TimeseriesGraph({ el: $(selector), collection: serviceCollection }); var tabs = new Tabs({ el: $(selector + '-nav'), model: serviceCollection.query, attr: 'period', tabs: [ {id: "month", name: "Monthly"}, {id: "week", name: "Weekly"} ] }); tabs.render(); var headline = new Headline({ el: $(selector + '-headline'), model: serviceCollection.query, prefix: 'Applications submissions' }); headline.render(); }; });
define([ 'vehicle-licensing/collections/services', 'extensions/views/timeseries-graph/timeseries-graph', 'extensions/views/tabs', 'extensions/views/graph/headline', ], function (ServicesCollection, TimeseriesGraph, Tabs, Headline) { return function (selector, id, type) { var serviceCollection = new ServicesCollection([], { seriesList: [{ id: id, title: type }] }); serviceCollection.query.set('period', 'week'); serviceCollection.fetch(); new TimeseriesGraph({ el: $(selector), collection: serviceCollection }); var tabs = new Tabs({ el: $(selector + '-nav'), model: serviceCollection.query, attr: 'period', tabs: [ {id: "month", name: "Monthly"}, {id: "week", name: "Weekly"} ] }); tabs.render(); var headline = new Headline({ el: $(selector + '-headline'), model: serviceCollection.query, prefix: 'Applications' }); headline.render(); }; });
Remove 'submissions' from volumetrics graph label
Remove 'submissions' from volumetrics graph label
JavaScript
mit
gds-attic/limelight,gds-attic/limelight,gds-attic/limelight
--- +++ @@ -31,7 +31,7 @@ var headline = new Headline({ el: $(selector + '-headline'), model: serviceCollection.query, - prefix: 'Applications submissions' + prefix: 'Applications' }); headline.render(); };
aeb2562d36fae72763113a2603a95c2db5cb0128
static/js/moderator.js
static/js/moderator.js
var socket = io(); //var verifyNameFormState = false; socket.on('moderate name', function(msg){ $('#currentName').text(msg); }); $('#accept').click(function(e){ // Prevent JavaScript from doing normal functionality e.preventDefault(); // Serialize the name and whether the name is valid var nameInfo = JSON.stringify({msg, true}); // Emit a message to accept the current name socket.emit('add name', nameInfo); // Disable form after first submission $('form').unbind('accept'); $('form').accept(function(e){ e.preventDefault(); }); }); $('#decline').click(function(e){ // Prevent JavaScript from doing normal functionality e.preventDefault(); // Serialize the name and whether the name is valid var nameInfo = JSON.stringify({msg, false}); // Emit a message to accept the current name socket.emit('add name', nameInfo); // Disable form after first submission $('form').unbind('decline'); $('form').decline(function(e){ e.preventDefault(); }); });
var socket = io(); //var verifyNameFormState = false; socket.on('moderate name', function(msg){ $('#currentName').text(msg); }); $('#accept').click(function(e){ // Prevent JavaScript from doing normal functionality e.preventDefault(); // Serialize the name and whether the name is valid var nameInfo = JSON.stringify([$('#currentName').text(), true]); // Emit a message to accept the current name socket.emit('add name', nameInfo); // Disable form after first submission $('form').unbind('accept'); $('form').accept(function(e){ e.preventDefault(); }); }); $('#decline').click(function(e){ // Prevent JavaScript from doing normal functionality e.preventDefault(); // Serialize the name and whether the name is valid var nameInfo = JSON.stringify([$('#currentName').text(), false]); // Emit a message to accept the current name socket.emit('add name', nameInfo); // Disable form after first submission $('form').unbind('decline'); $('form').decline(function(e){ e.preventDefault(); }); });
Update name being sent to the server
Moderator: Update name being sent to the server Update the name being sent to the server to be the name that was put into the currentName variable.
JavaScript
mit
2016-ksu-cis-open-house/tree-display,2016-ksu-cis-open-house/tree-display,2016-ksu-cis-open-house/tree-display
--- +++ @@ -10,7 +10,7 @@ e.preventDefault(); // Serialize the name and whether the name is valid - var nameInfo = JSON.stringify({msg, true}); + var nameInfo = JSON.stringify([$('#currentName').text(), true]); // Emit a message to accept the current name socket.emit('add name', nameInfo); @@ -25,7 +25,7 @@ e.preventDefault(); // Serialize the name and whether the name is valid - var nameInfo = JSON.stringify({msg, false}); + var nameInfo = JSON.stringify([$('#currentName').text(), false]); // Emit a message to accept the current name socket.emit('add name', nameInfo);
c2ce3a82155cdd03822a8359e35c68c896975fad
dinosaurs/js/controllers/index.js
dinosaurs/js/controllers/index.js
var m = require('mithril'); module.exports = function() { self = this; self.domains = []; self.currentDomain = m.prop(''); self.init = function() { m.request({method: "GET", url: "/api/v1/domains"}).then(function(ret) { self.domains = ret.availableDomains; self.currentDomain(self.domains[0]); }); }; self.init(); };
var m = require('mithril'); module.exports = function() { self = this; self.email = m.prop(''); self.domains = []; self.currentDomain = m.prop(''); self.init = function() { m.request({method: "GET", url: "/api/v1/domains"}).then(function(ret) { self.domains = ret.availableDomains; self.currentDomain(self.domains[0]); }); }; self.getIt = function(email) { m.request({ method: "POST", url: "/api/v1/emails", data: { 'domain': self.currentDomain(), 'email': self.email() } }); }; self.init(); };
Add a method for requesting an email
Add a method for requesting an email
JavaScript
mit
chrisseto/dinosaurs.sexy,chrisseto/dinosaurs.sexy
--- +++ @@ -3,6 +3,7 @@ module.exports = function() { self = this; + self.email = m.prop(''); self.domains = []; self.currentDomain = m.prop(''); @@ -14,5 +15,16 @@ }); }; + self.getIt = function(email) { + m.request({ + method: "POST", + url: "/api/v1/emails", + data: { + 'domain': self.currentDomain(), + 'email': self.email() + } + }); + }; + self.init(); };
c6dc08c0f1fc84c64a3590c98ad25bdb3585d1c3
web-audio/web-audio.js
web-audio/web-audio.js
var context; window.addEventListener('load', init, false); function init() { try { var dogBarkingUrl = 'https://commons.wikimedia.org/wiki/File:Sound-of-dog.ogg'; var dogBarkingBuffer = null; // Fix up prefixing window.AudioContext = window.AudioContext || window.webkitAudioContext; context = new AudioContext(); loadDogSound(dogBarkingUrl); alert('Sound Loaded'); playSound(dogBarkingBuffer); } catch(e) { alert('Web Audio API is not supported in this browser'); } } function loadDogSound(url) { var request = new XMLHttpRequest(); request.open('GET', url, true); request.responseType = 'arraybuffer'; // Decode asynchronously request.onload = function() { context.decodeAudioData( request.response, function(buffer) { dogBarkingBuffer = buffer; }, onError ); } request.send(); } function playSound(buffer) { var source = context.createBufferSource(); // creates a sound source source.buffer = buffer; // tell the source which sound to play source.connect(context.destination); // connect the source to the context's destination (the speakers) source.start(0); // play the source now // note: on older systems, may have to use deprecated noteOn(time); }
var context; window.addEventListener('load', init, false); function init() { try { var dogBarkingUrl = 'https://upload.wikimedia.org/wikipedia/commons/c/ce/Sound-of-dog.ogg'; var dogBarkingBuffer = null; // Fix up prefixing window.AudioContext = window.AudioContext || window.webkitAudioContext; context = new AudioContext(); loadDogSound(dogBarkingUrl); alert('Sound Loaded'); playSound(dogBarkingBuffer); } catch(e) { alert('Web Audio API is not supported in this browser'); } } function loadDogSound(url) { var request = new XMLHttpRequest(); request.open('GET', url, true); request.responseType = 'arraybuffer'; // Decode asynchronously request.onload = function() { context.decodeAudioData( request.response, function(buffer) { dogBarkingBuffer = buffer; }, onError ); } request.send(); } function playSound(buffer) { var source = context.createBufferSource(); // creates a sound source source.buffer = buffer; // tell the source which sound to play source.connect(context.destination); // connect the source to the context's destination (the speakers) source.start(0); // play the source now // note: on older systems, may have to use deprecated noteOn(time); }
Fix url of sample sound
Fix url of sample sound
JavaScript
mit
Rholais/voice-share,Rholais/voice-share
--- +++ @@ -2,7 +2,7 @@ window.addEventListener('load', init, false); function init() { try { - var dogBarkingUrl = 'https://commons.wikimedia.org/wiki/File:Sound-of-dog.ogg'; + var dogBarkingUrl = 'https://upload.wikimedia.org/wikipedia/commons/c/ce/Sound-of-dog.ogg'; var dogBarkingBuffer = null; // Fix up prefixing window.AudioContext = window.AudioContext || window.webkitAudioContext;
81f22cfed7c6f61edf6065d00d50735e760a3a34
webpack/prod.config.js
webpack/prod.config.js
/* eslint no-var: 0 */ var objectAssign = require('object-assign'); var webpack = require('webpack'); var baseConfig = require('./base.config'); module.exports = objectAssign(baseConfig, { entry: './src/index.js', plugins: [ new webpack.optimize.UglifyJsPlugin(), new webpack.DefinePlugin({ __DEV__: false }) ] });
/* eslint no-var: 0 */ var objectAssign = require('object-assign'); var webpack = require('webpack'); var baseConfig = require('./base.config'); module.exports = objectAssign(baseConfig, { entry: './src/index.js', plugins: [ new webpack.optimize.UglifyJsPlugin({ compressor: { screw_ie8: true, warnings: false } }), new webpack.DefinePlugin({ __DEV__: false }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }) ] });
Enable react production mode and fix uglify settings
Enable react production mode and fix uglify settings
JavaScript
mit
webkom/lego-webapp,webkom/lego-webapp,webkom/lego-webapp
--- +++ @@ -6,9 +6,17 @@ module.exports = objectAssign(baseConfig, { entry: './src/index.js', plugins: [ - new webpack.optimize.UglifyJsPlugin(), + new webpack.optimize.UglifyJsPlugin({ + compressor: { + screw_ie8: true, + warnings: false + } + }), new webpack.DefinePlugin({ __DEV__: false + }), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production') }) ] });
32a63c1fa66b14b7fe0e5274a4d084e93435f45e
test/selenium/index.js
test/selenium/index.js
var test = require('selenium-webdriver/testing'); var server = require('./server'); global.driver = null; function setUpDriverFor(test) { test.before(function() { var webdriver = require('selenium-webdriver'); var chrome = require('selenium-webdriver/chrome'); var path = require('chromedriver').path; var service = new chrome.ServiceBuilder(path).build(); chrome.setDefaultService(service); driver = new webdriver.Builder() .withCapabilities(webdriver.Capabilities.chrome()) .build(); server.start(); }); test.after(function() { driver.quit(); server.stop(); }); } test.describe('FieldKit Selenium Test', function() { setUpDriverFor(test); require('./adaptive_card_formatter_test'); require('./amex_card_formatter_test'); require('./card_text_field_test'); require('./default_card_formatter_test'); require('./delimited_text_formatter_test'); require('./expiry_date_formatter_test'); require('./phone_formatter_test'); require('./social_security_number_formatter_test'); require('./text_field_test'); });
var test = require('selenium-webdriver/testing'); var server = require('./server'); global.driver = null; function setUpDriverFor(test) { test.before(function() { var webdriver = require('selenium-webdriver'); var builder = new webdriver.Builder(); if (process.env.CONTINUOUS_INTEGRATION) { builder.forBrowser('firefox'); } else { var chrome = require('selenium-webdriver/chrome'); var path = require('chromedriver').path; var service = new chrome.ServiceBuilder(path).build(); chrome.setDefaultService(service); builder.withCapabilities(webdriver.Capabilities.chrome()) } driver = builder.build(); server.start(); }); test.after(function() { driver.quit(); server.stop(); }); } test.describe('FieldKit Selenium Test', function() { setUpDriverFor(test); require('./adaptive_card_formatter_test'); require('./amex_card_formatter_test'); require('./card_text_field_test'); require('./default_card_formatter_test'); require('./delimited_text_formatter_test'); require('./expiry_date_formatter_test'); require('./phone_formatter_test'); require('./social_security_number_formatter_test'); require('./text_field_test'); });
Use Firefox for the Selenium tests in CI.
Use Firefox for the Selenium tests in CI.
JavaScript
apache-2.0
shyamalschandra/field-kit,daverome/field-kit,damiankaplewski/field-kit,greyhwndz/field-kit,daverome/field-kit,square/fieldkit,BionicClick/field-kit,paultyng/field-kit,UmarMughal/field-kit,janusnic/field-kit,janusnic/field-kit,square/field-kit,square/fieldkit,greyhwndz/field-kit,paultyng/field-kit,BionicClick/field-kit,square/field-kit,damiankaplewski/field-kit,shyamalschandra/field-kit,UmarMughal/field-kit
--- +++ @@ -5,15 +5,21 @@ function setUpDriverFor(test) { test.before(function() { var webdriver = require('selenium-webdriver'); - var chrome = require('selenium-webdriver/chrome'); - var path = require('chromedriver').path; + var builder = new webdriver.Builder(); - var service = new chrome.ServiceBuilder(path).build(); - chrome.setDefaultService(service); + if (process.env.CONTINUOUS_INTEGRATION) { + builder.forBrowser('firefox'); + } else { + var chrome = require('selenium-webdriver/chrome'); + var path = require('chromedriver').path; - driver = new webdriver.Builder() - .withCapabilities(webdriver.Capabilities.chrome()) - .build(); + var service = new chrome.ServiceBuilder(path).build(); + chrome.setDefaultService(service); + + builder.withCapabilities(webdriver.Capabilities.chrome()) + } + + driver = builder.build(); server.start(); });
27aa65d399fc930633f52968b93a07ddf8970997
lib/adapters/local/get-indexes/index.js
lib/adapters/local/get-indexes/index.js
'use strict'; var utils = require('../../../utils'); var localUtils = require('../utils'); var massageIndexDef = localUtils.massageIndexDef; function getIndexes(db) { // just search through all the design docs and filter in-memory. // hopefully there aren't that many ddocs. return db.allDocs({ startkey: '_design/', endkey: '_design/\uffff', include_docs: true }).then(function (allDocsRes) { var res = { indexes: [{ ddoc: null, name: '_all_docs', type: 'special', def: { fields: [{_id: 'asc'}] } }] }; res.indexes = utils.flatten(res.indexes, allDocsRes.rows.filter(function (row) { return row.doc.language === 'query'; }).map(function (row) { var viewNames = Object.keys(row.doc.views); return viewNames.map(function (viewName) { var view = row.doc.views[viewName]; return { ddoc: row.id, name: viewName, type: 'json', def: massageIndexDef(view.options.def) }; }); })); // these are sorted by view name for some reason res.indexes.sort(function (left, right) { return utils.compare(left.name, right.name); }); res.total_rows = res.indexes.length; return res; }); } module.exports = getIndexes;
'use strict'; var utils = require('../../../utils'); var localUtils = require('../utils'); var massageIndexDef = localUtils.massageIndexDef; function getIndexes(db) { // just search through all the design docs and filter in-memory. // hopefully there aren't that many ddocs. return db.allDocs({ startkey: '_design/', endkey: '_design/\uffff', include_docs: true }).then(function (allDocsRes) { var res = { indexes: [{ ddoc: null, name: '_all_docs', type: 'special', def: { fields: [{_id: 'asc'}] } }] }; res.indexes = utils.flatten(res.indexes, allDocsRes.rows.filter(function (row) { return row.doc.language === 'query'; }).map(function (row) { var viewNames = row.doc.views !== undefined ? Object.keys(row.doc.views) : []; return viewNames.map(function (viewName) { var view = row.doc.views[viewName]; return { ddoc: row.id, name: viewName, type: 'json', def: massageIndexDef(view.options.def) }; }); })); // these are sorted by view name for some reason res.indexes.sort(function (left, right) { return utils.compare(left.name, right.name); }); res.total_rows = res.indexes.length; return res; }); } module.exports = getIndexes;
Fix for missing view in design doc
Fix for missing view in design doc My Cloudant DB that I replicated to Pouch has design docs with no views present (for some reason). Fixes nolanlawson/pouchdb-find#100.
JavaScript
apache-2.0
nolanlawson/pouchdb-find,wehriam/pouchdb-find,wehriam/pouchdb-find,nolanlawson/pouchdb-find,nolanlawson/pouchdb-find,wehriam/pouchdb-find,wehriam/pouchdb-find,nolanlawson/pouchdb-find
--- +++ @@ -27,7 +27,8 @@ res.indexes = utils.flatten(res.indexes, allDocsRes.rows.filter(function (row) { return row.doc.language === 'query'; }).map(function (row) { - var viewNames = Object.keys(row.doc.views); + var viewNames = row.doc.views !== undefined ? + Object.keys(row.doc.views) : []; return viewNames.map(function (viewName) { var view = row.doc.views[viewName];
55f175646889a2dabd957d80272994e13d121487
svyMicroSamples/forms/AbstractMicroSample.js
svyMicroSamples/forms/AbstractMicroSample.js
/** * Show the display name of the sample for navigation * @public * @return {String} * @properties={typeid:24,uuid:"EB63D830-02F7-4CE4-BC4F-96E36F200217"} */ function getName(){ throw 'Method must be implemented' } /** * Show the description, i.e. tooltip * * @public * @return {String} * @properties={typeid:24,uuid:"64E4FDEA-B37D-403E-81D6-54E4E62961A4"} */ function getDescription(){ throw 'Method must be implemented' } /** * Gets the parent form for hierarchy * @public * @return {RuntimeForm<AbstractMicroSample>} * @properties={typeid:24,uuid:"4F502D68-AD7C-46FE-90E6-4364A13E857E"} */ function getParent(){ return null; }
/** * Show the display name of the sample for navigation * @public * @return {String} * @properties={typeid:24,uuid:"EB63D830-02F7-4CE4-BC4F-96E36F200217"} */ function getName(){ throw 'Method must be implemented' } /** * Show the description, i.e. tooltip * * @public * @return {String} * @properties={typeid:24,uuid:"64E4FDEA-B37D-403E-81D6-54E4E62961A4"} */ function getDescription(){ throw 'Method must be implemented' } /** * Gets the parent form for hierarchy * @public * @return {RuntimeForm<AbstractMicroSample>} * @properties={typeid:24,uuid:"4F502D68-AD7C-46FE-90E6-4364A13E857E"} */ function getParent(){ return null; } /** * Gets an optional icon style class for menu navigation * @public * @return {String} * @properties={typeid:24,uuid:"03913234-F650-4704-B138-4C8EA9BE27C2"} */ function getIconStyleClass(){ return null; }
Add icon style class for menu
Add icon style class for menu
JavaScript
mit
Servoy/svyMicroSamples,Servoy/svyMicroSamples,Servoy/svyMicroSamples
--- +++ @@ -28,3 +28,13 @@ function getParent(){ return null; } + +/** + * Gets an optional icon style class for menu navigation + * @public + * @return {String} + * @properties={typeid:24,uuid:"03913234-F650-4704-B138-4C8EA9BE27C2"} + */ +function getIconStyleClass(){ + return null; +}
8e97db3f914ab8410e3890d6872d7b59076a524d
source/features/add-delete-fork-link.js
source/features/add-delete-fork-link.js
import {h} from 'dom-chef'; import select from 'select-dom'; import * as pageDetect from '../libs/page-detect'; const repoUrl = pageDetect.getRepoURL(); export default function () { const canDeleteFork = select.exists('.reponav-item [data-selected-links~="repo_settings"]'); const postMergeDescription = select('#partial-pull-merging .merge-branch-description'); if (canDeleteFork && postMergeDescription) { const currentBranch = postMergeDescription.querySelector('.commit-ref'); const forkPath = currentBranch ? currentBranch.title.split(':')[0] : null; if (forkPath && forkPath !== repoUrl) { postMergeDescription.append( <a id="refined-github-delete-fork-link" href={`/${forkPath}/settings`}> Delete fork </a> ); } } }
import {h} from 'dom-chef'; import select from 'select-dom'; import * as pageDetect from '../libs/page-detect'; const repoUrl = pageDetect.getRepoURL(); export default function () { const canDeleteFork = select.exists('.reponav-item[data-selected-links~="repo_settings"]'); const postMergeDescription = select('#partial-pull-merging .merge-branch-description'); if (canDeleteFork && postMergeDescription) { const currentBranch = postMergeDescription.querySelector('.commit-ref'); const forkPath = currentBranch ? currentBranch.title.split(':')[0] : null; if (forkPath && forkPath !== repoUrl) { postMergeDescription.append( <a id="refined-github-delete-fork-link" href={`/${forkPath}/settings`}> Delete fork </a> ); } } }
Update selector for Delete Fork Link
Update selector for Delete Fork Link Related to #1001
JavaScript
mit
sindresorhus/refined-github,sindresorhus/refined-github,busches/refined-github,busches/refined-github
--- +++ @@ -5,7 +5,7 @@ const repoUrl = pageDetect.getRepoURL(); export default function () { - const canDeleteFork = select.exists('.reponav-item [data-selected-links~="repo_settings"]'); + const canDeleteFork = select.exists('.reponav-item[data-selected-links~="repo_settings"]'); const postMergeDescription = select('#partial-pull-merging .merge-branch-description'); if (canDeleteFork && postMergeDescription) {
bbb33e60a4079b47af7d5d2f5a6f004210ccf6ae
src/components/authorPage/AuthorData.js
src/components/authorPage/AuthorData.js
'use strict' import React, { PropTypes } from 'react' import classNames from 'classnames' import styles from './AuthorData.scss' const boxClasses = classNames( styles['author-box'], 'center-block' ) const AuthorData = (props) => { const authorData = props.authorData let gotAuthorMail = !(authorData.authorMail === undefined) ? true : false return ( <div className={boxClasses}> <div className={styles['author-img-container']}><img className={styles['author-img']} src={authorData.authorImg}/></div> <div className={styles['author-data-container']}> <div className={styles['author-name']}>{authorData.authorName}</div> {!gotAuthorMail ? null : <div className={styles['author-mail']}>{authorData.authorMail}</div>} <div className={styles['author-bio']}>{authorData.authorBio}</div> </div> </div> )} AuthorData.propTypes = { authorData: PropTypes.shape({ authorId: PropTypes.string.isRequired, authorName: PropTypes.string.isRequired, authorImg: PropTypes.string, authorMail: PropTypes.string, authorBio: PropTypes.string }) } export default AuthorData
'use strict' import React, { PropTypes } from 'react' import classNames from 'classnames' import styles from './AuthorData.scss' const boxClasses = classNames( styles['author-box'], 'center-block' ) const AuthorData = (props) => { const { authorImg, authorName, authorMail, authorBio } = props.authorData return ( <div className={boxClasses}> <div className={styles['author-img-container']}><img className={styles['author-img']} src={authorImg}/></div> <div className={styles['author-data-container']}> <div className={styles['author-name']}>{authorName}</div> {!authorMail ? null : <div className={styles['author-mail']}>{authorMail}</div>} <div className={styles['author-bio']}>{authorBio}</div> </div> </div> )} AuthorData.propTypes = { authorData: PropTypes.shape({ authorId: PropTypes.string.isRequired, authorName: PropTypes.string.isRequired, authorImg: PropTypes.string, authorMail: PropTypes.string, authorBio: PropTypes.string }) } export default AuthorData
Make author data parser concise
Make author data parser concise
JavaScript
agpl-3.0
garfieldduck/twreporter-react,twreporter/twreporter-react,hanyulo/twreporter-react,nickhsine/twreporter-react,garfieldduck/twreporter-react,hanyulo/twreporter-react
--- +++ @@ -10,15 +10,14 @@ ) const AuthorData = (props) => { - const authorData = props.authorData - let gotAuthorMail = !(authorData.authorMail === undefined) ? true : false + const { authorImg, authorName, authorMail, authorBio } = props.authorData return ( <div className={boxClasses}> - <div className={styles['author-img-container']}><img className={styles['author-img']} src={authorData.authorImg}/></div> + <div className={styles['author-img-container']}><img className={styles['author-img']} src={authorImg}/></div> <div className={styles['author-data-container']}> - <div className={styles['author-name']}>{authorData.authorName}</div> - {!gotAuthorMail ? null : <div className={styles['author-mail']}>{authorData.authorMail}</div>} - <div className={styles['author-bio']}>{authorData.authorBio}</div> + <div className={styles['author-name']}>{authorName}</div> + {!authorMail ? null : <div className={styles['author-mail']}>{authorMail}</div>} + <div className={styles['author-bio']}>{authorBio}</div> </div> </div> )}
85ce5556585c89fbd93c662e3c8e5ada9dca1c7c
scripts/install.js
scripts/install.js
#!/usr/bin/env node var child; var exec = require('child_process').exec; exec('tsd reinstall -s');
#!/usr/bin/env node var child; var exec = require('child_process').exec; exec('typings install');
Use the new `typings` instead of the deprecated `tsd`
fix(build): Use the new `typings` instead of the deprecated `tsd`
JavaScript
mit
rixrix/stencil,rixrix/stencil,rixrix/stencil
--- +++ @@ -3,4 +3,4 @@ var child; var exec = require('child_process').exec; -exec('tsd reinstall -s'); +exec('typings install');
1b6bebbd342000d007210d958fc82dfebdfd22c9
scripts/madlibs.js
scripts/madlibs.js
var madLibs = function() { var storyDiv = document.getElementById("story"); var name = document.getElementById("name").value; var adjective = document.getElementById("adjective").value; var noun = document.getElementById("noun").value; storyDiv.innerHTML = name + " has a " + adjective + " " + noun + " and can't make it to the party!"; } var libButton = document.getElementById("button"); libButton.addEventListener("click", madLibs);
Add JS for solo challenge
Add JS for solo challenge
JavaScript
mit
sharonjean/sharonjean.github.io,sharonjean/sharonjean.github.io
--- +++ @@ -0,0 +1,10 @@ +var madLibs = function() { + var storyDiv = document.getElementById("story"); + var name = document.getElementById("name").value; + var adjective = document.getElementById("adjective").value; + var noun = document.getElementById("noun").value; + storyDiv.innerHTML = name + " has a " + adjective + " " + noun + " and can't make it to the party!"; + } + +var libButton = document.getElementById("button"); +libButton.addEventListener("click", madLibs);
45e2d5a3e89bb03f33140cf3775db7cbb7a0f414
server/lib/tags.js
server/lib/tags.js
const Tags = require("../models/").Tags; // const Article = require('../models/').Article; exports.addTags = (tags, articleId) => { // console.log("tags", tags); tags.forEach(async tag => { await Tags.findOne({ tag: tag }).then(async (res, err) => { if (err) { throw new Error(err); } if (res) { return Tags.update( { tag: tag }, { $addToSet: { articleId: articleId } } ); } else { return Tags.create({ tag, articleId }); } }); }); }; exports.findTagByTagName = tag => { return Tags.findOne({ tag: tag }).exec(); }; exports.deleteTag = tagId => { return Tags.remove({ _id: tagId }).exec(); }; exports.getTags = count => { return Tags.find() .limit(count) .exec(); }; exports.getAllTags = () => { return Tags.find().exec(); };
const Tags = require("../models/").Tags; // const Article = require('../models/').Article; exports.addTags = (tags, articleId) => { // console.log("tags", tags); tags.forEach(async tag => { try { await Tags.findOne({ tag: tag }).then(async (res, err) => { if (err) { throw new Error(err); } if (res) { return Tags.update( { tag: tag }, { $addToSet: { articleId: articleId } } ); } else { return Tags.create({ tag, articleId }); } }); } catch (e) { throw new Error(e); } }); }; exports.findTagByTagName = tag => { return Tags.findOne({ tag: tag }).exec(); }; exports.deleteTags = (tags, articleId) => { tags.forEach(async tag => { await Tags.update({ tag: tag }, { $pull: { articleId: articleId } }).then( async res => { if (res.ok != 1) { return false; } let ans = await Tags.aggregate( { $match: { tag: tag } }, { $addFields: { count: { $size: "$articleId" } } }, { $project: { count: 1 } } ); if (ans[0].count === 0) { console.log("remove tags", tags); return await Tags.remove({ tag: tag }); } else { return true; } } ); }); }; exports.getTags = count => { return Tags.find() .limit(count) .exec(); }; exports.getAllTags = () => { return Tags.find().exec(); }; exports.updateTag = (tags, articleId) => { tags.forEach(async tag => { try { } catch (e) { throw new Error(e); } }); };
Fix Article-Edit Tags And Catalogs Post
Fix Article-Edit Tags And Catalogs Post
JavaScript
mit
wuwzhang/koa2-react-blog-wuw,wuwzhang/koa2-react-blog-wuw
--- +++ @@ -4,26 +4,60 @@ exports.addTags = (tags, articleId) => { // console.log("tags", tags); tags.forEach(async tag => { - await Tags.findOne({ tag: tag }).then(async (res, err) => { - if (err) { - throw new Error(err); - } - if (res) { - return Tags.update( - { tag: tag }, - { $addToSet: { articleId: articleId } } - ); - } else { - return Tags.create({ tag, articleId }); - } - }); + try { + await Tags.findOne({ tag: tag }).then(async (res, err) => { + if (err) { + throw new Error(err); + } + if (res) { + return Tags.update( + { tag: tag }, + { $addToSet: { articleId: articleId } } + ); + } else { + return Tags.create({ tag, articleId }); + } + }); + } catch (e) { + throw new Error(e); + } }); }; exports.findTagByTagName = tag => { return Tags.findOne({ tag: tag }).exec(); }; -exports.deleteTag = tagId => { - return Tags.remove({ _id: tagId }).exec(); +exports.deleteTags = (tags, articleId) => { + tags.forEach(async tag => { + await Tags.update({ tag: tag }, { $pull: { articleId: articleId } }).then( + async res => { + if (res.ok != 1) { + return false; + } + let ans = await Tags.aggregate( + { $match: { tag: tag } }, + { + $addFields: { + count: { + $size: "$articleId" + } + } + }, + { + $project: { + count: 1 + } + } + ); + + if (ans[0].count === 0) { + console.log("remove tags", tags); + return await Tags.remove({ tag: tag }); + } else { + return true; + } + } + ); + }); }; exports.getTags = count => { return Tags.find() @@ -33,3 +67,12 @@ exports.getAllTags = () => { return Tags.find().exec(); }; + +exports.updateTag = (tags, articleId) => { + tags.forEach(async tag => { + try { + } catch (e) { + throw new Error(e); + } + }); +};
d68b4f628e9ff821096f522ef730836808a0f968
spec/encryption.js
spec/encryption.js
describe('Encryption', () => { it('apply encryption and decryption to get original message', done => { window.newEncryptionKey().then(key => { const message = 'The quick brown fox jumps over the lazy dog'; const encoded = new TextEncoder('utf-8').encode(message); return window.encrypt(encoded, key).then(ciphertext => { return window.decrypt(ciphertext, key).then(plaintext => { const decoded = new TextDecoder('utf-8').decode(plaintext); expect(message).toEqual(decoded); done(); }); }); }).catch(error => done.fail(error.message)); }); });
describe('Encryption', () => { it('apply encryption and decryption to get original message', done => { window.newEncryptionKey().then(key => { const message = 'The quick brown fox jumps over the lazy dog'; const encoded = new TextEncoder('utf-8').encode(message); return window.encrypt(encoded, key).then(ciphertext => { return window.decrypt(ciphertext, key).then(plaintext => { const decoded = new TextDecoder('utf-8').decode(plaintext); expect(message).toEqual(decoded); done(); }); }); }).catch(error => done.fail(error.message)); }); it('tamper with the ciphertext to verify that it will be rejected', done => { window.newEncryptionKey().then(key => { const message = 'The quick brown fox jumps over the lazy dog'; const encoded = new TextEncoder('utf-8').encode(message); return window.encrypt(encoded, key).then(ciphertext => { const view = new Uint8Array(ciphertext); view[view.length - 1] ^= 1; return window.decrypt(ciphertext, key) .then(() => done.fail('Expected ciphertext to be rejected')); }); }).catch(() => { expect(true).toBe(true); done(); }); }); });
Add test for ciphertext tampering
Add test for ciphertext tampering
JavaScript
mit
Metalnem/javascript-crypto,Metalnem/javascript-crypto
--- +++ @@ -13,4 +13,22 @@ }); }).catch(error => done.fail(error.message)); }); + + it('tamper with the ciphertext to verify that it will be rejected', done => { + window.newEncryptionKey().then(key => { + const message = 'The quick brown fox jumps over the lazy dog'; + const encoded = new TextEncoder('utf-8').encode(message); + + return window.encrypt(encoded, key).then(ciphertext => { + const view = new Uint8Array(ciphertext); + view[view.length - 1] ^= 1; + + return window.decrypt(ciphertext, key) + .then(() => done.fail('Expected ciphertext to be rejected')); + }); + }).catch(() => { + expect(true).toBe(true); + done(); + }); + }); });
3e0e7ab1b3034d774787685c78b53ba4664c823e
test/spec/controllers/footer.ctrl.spec.js
test/spec/controllers/footer.ctrl.spec.js
'use strict'; describe('FooterCtrl', function() { var FooterCtrl; beforeEach(function() { module('yourStlCourts'); inject(function($controller) { FooterCtrl = $controller('FooterCtrl', {}); }); }); it('indicates should collapse options', function() { var shouldCollapseOptions = FooterCtrl.collapseOptions(); expect(shouldCollapseOptions).toBe(false); }); });
'use strict'; describe('FooterCtrl', function() { var FooterCtrl; beforeEach(function() { module('yourStlCourts'); inject(function($controller) { FooterCtrl = $controller('FooterCtrl', {}); }); }); //TODO: Add tests where needed });
Remove test that covers method that Matt previously removed
Remove test that covers method that Matt previously removed
JavaScript
mit
OpenDataSTL/gh-angular,OpenDataSTL/STLCourts-client,OpenDataSTL/gh-angular,OpenDataSTL/STLCourts-client
--- +++ @@ -11,9 +11,5 @@ }); }); - it('indicates should collapse options', function() { - var shouldCollapseOptions = FooterCtrl.collapseOptions(); - - expect(shouldCollapseOptions).toBe(false); - }); + //TODO: Add tests where needed });
2af3b102bfb5fc29b585c147424978af8246a6a6
website/addons/s3/static/s3-rubeus-cfg.js
website/addons/s3/static/s3-rubeus-cfg.js
(function(Rubeus) { Rubeus.cfg.s3 = { uploadMethod: 'PUT', uploadUrl: null, uploadAdded: function(file, item) { var self = this; var parent = self.getByID(item.parentID); var name = file.name; // Make it possible to upload into subfolders while (parent.depth > 1 && !parent.isAddonRoot) { name = parent.name + '/' + name; parent = self.getByID(parent.parentID); } file.destination = name; self.dropzone.options.signedUrlFrom = parent.urls.upload; }, uploadSending: function(file, formData, xhr) { xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); xhr.setRequestHeader('x-amz-acl', 'private'); }, uploadSuccess: function(file, item, data) { item.urls = { 'delete': nodeApiUrl + 's3/delete/' + file.destination + '/', 'download': nodeApiUrl + 's3/download/' + file.destination + '/', 'view': '/' + nodeId + '/s3/view/' + file.destination + '/' } } }; })(Rubeus);
(function(Rubeus) { Rubeus.cfg.s3 = { uploadMethod: 'PUT', uploadUrl: null, uploadAdded: function(file, item) { var self = this; var parent = self.getByID(item.parentID); var name = file.name; // Make it possible to upload into subfolders while (parent.depth > 1 && !parent.isAddonRoot) { name = parent.name + '/' + name; parent = self.getByID(parent.parentID); } file.destination = name; self.dropzone.options.signedUrlFrom = parent.urls.upload; }, uploadSending: function(file, formData, xhr) { xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); xhr.setRequestHeader('x-amz-acl', 'private'); }, uploadSuccess: function(file, item, data) { // Update the added item's urls and permissions item.urls = { 'delete': nodeApiUrl + 's3/delete/' + file.destination + '/', 'download': nodeApiUrl + 's3/download/' + file.destination + '/', 'view': '/' + nodeId + '/s3/view/' + file.destination + '/' }; var parent = this.getByID(item.parentID); item.permissions = parent.permissions; this.updateItem(item); } }; })(Rubeus);
Fix deleting S3 files after they are uploaded
Fix deleting S3 files after they are uploaded
JavaScript
apache-2.0
jeffreyliu3230/osf.io,Nesiehr/osf.io,fabianvf/osf.io,Johnetordoff/osf.io,chennan47/osf.io,acshi/osf.io,fabianvf/osf.io,KAsante95/osf.io,leb2dg/osf.io,arpitar/osf.io,hmoco/osf.io,brandonPurvis/osf.io,mfraezz/osf.io,jmcarp/osf.io,asanfilippo7/osf.io,crcresearch/osf.io,acshi/osf.io,doublebits/osf.io,pattisdr/osf.io,cosenal/osf.io,lamdnhan/osf.io,caneruguz/osf.io,revanthkolli/osf.io,abought/osf.io,njantrania/osf.io,monikagrabowska/osf.io,caneruguz/osf.io,mluke93/osf.io,KAsante95/osf.io,reinaH/osf.io,mfraezz/osf.io,bdyetton/prettychart,MerlinZhang/osf.io,zkraime/osf.io,CenterForOpenScience/osf.io,DanielSBrown/osf.io,Nesiehr/osf.io,MerlinZhang/osf.io,chrisseto/osf.io,jinluyuan/osf.io,jmcarp/osf.io,TomBaxter/osf.io,mluke93/osf.io,mluo613/osf.io,samchrisinger/osf.io,jnayak1/osf.io,saradbowman/osf.io,brandonPurvis/osf.io,doublebits/osf.io,billyhunt/osf.io,kch8qx/osf.io,felliott/osf.io,amyshi188/osf.io,HarryRybacki/osf.io,cwisecarver/osf.io,reinaH/osf.io,GaryKriebel/osf.io,monikagrabowska/osf.io,ZobairAlijan/osf.io,kushG/osf.io,revanthkolli/osf.io,jinluyuan/osf.io,samchrisinger/osf.io,pattisdr/osf.io,HarryRybacki/osf.io,arpitar/osf.io,binoculars/osf.io,rdhyee/osf.io,HarryRybacki/osf.io,leb2dg/osf.io,chrisseto/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,sbt9uc/osf.io,GageGaskins/osf.io,monikagrabowska/osf.io,cslzchen/osf.io,cosenal/osf.io,kch8qx/osf.io,lyndsysimon/osf.io,doublebits/osf.io,bdyetton/prettychart,leb2dg/osf.io,cwisecarver/osf.io,jolene-esposito/osf.io,cldershem/osf.io,samanehsan/osf.io,revanthkolli/osf.io,hmoco/osf.io,lamdnhan/osf.io,erinspace/osf.io,alexschiller/osf.io,Ghalko/osf.io,rdhyee/osf.io,zamattiac/osf.io,sbt9uc/osf.io,ticklemepierce/osf.io,icereval/osf.io,Johnetordoff/osf.io,reinaH/osf.io,zachjanicki/osf.io,brandonPurvis/osf.io,barbour-em/osf.io,jolene-esposito/osf.io,sloria/osf.io,ZobairAlijan/osf.io,felliott/osf.io,adlius/osf.io,sloria/osf.io,kch8qx/osf.io,ckc6cz/osf.io,chrisseto/osf.io,caneruguz/osf.io,jnayak1/osf.io,TomHeatwole/osf.io,zachjanicki/osf.io,monikagrabowska/osf.io,zachjanicki/osf.io,cwisecarver/osf.io,DanielSBrown/osf.io,binoculars/osf.io,abought/osf.io,jeffreyliu3230/osf.io,HalcyonChimera/osf.io,himanshuo/osf.io,hmoco/osf.io,kwierman/osf.io,reinaH/osf.io,njantrania/osf.io,hmoco/osf.io,icereval/osf.io,danielneis/osf.io,amyshi188/osf.io,zkraime/osf.io,SSJohns/osf.io,wearpants/osf.io,icereval/osf.io,GageGaskins/osf.io,chrisseto/osf.io,cosenal/osf.io,acshi/osf.io,brianjgeiger/osf.io,acshi/osf.io,brandonPurvis/osf.io,adlius/osf.io,monikagrabowska/osf.io,asanfilippo7/osf.io,haoyuchen1992/osf.io,emetsger/osf.io,samchrisinger/osf.io,cslzchen/osf.io,kushG/osf.io,ZobairAlijan/osf.io,HarryRybacki/osf.io,laurenrevere/osf.io,mluo613/osf.io,ckc6cz/osf.io,GaryKriebel/osf.io,rdhyee/osf.io,alexschiller/osf.io,amyshi188/osf.io,danielneis/osf.io,kwierman/osf.io,caseyrygt/osf.io,alexschiller/osf.io,zamattiac/osf.io,SSJohns/osf.io,RomanZWang/osf.io,cosenal/osf.io,jmcarp/osf.io,CenterForOpenScience/osf.io,TomBaxter/osf.io,felliott/osf.io,petermalcolm/osf.io,billyhunt/osf.io,acshi/osf.io,kwierman/osf.io,aaxelb/osf.io,zamattiac/osf.io,AndrewSallans/osf.io,zkraime/osf.io,dplorimer/osf,Ghalko/osf.io,GaryKriebel/osf.io,himanshuo/osf.io,lyndsysimon/osf.io,cwisecarver/osf.io,brianjgeiger/osf.io,baylee-d/osf.io,kushG/osf.io,ticklemepierce/osf.io,jeffreyliu3230/osf.io,caseyrollins/osf.io,ckc6cz/osf.io,arpitar/osf.io,haoyuchen1992/osf.io,haoyuchen1992/osf.io,chennan47/osf.io,mluo613/osf.io,RomanZWang/osf.io,aaxelb/osf.io,dplorimer/osf,haoyuchen1992/osf.io,caseyrygt/osf.io,ckc6cz/osf.io,abought/osf.io,dplorimer/osf,leb2dg/osf.io,jinluyuan/osf.io,mattclark/osf.io,jolene-esposito/osf.io,wearpants/osf.io,GageGaskins/osf.io,AndrewSallans/osf.io,crcresearch/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,baylee-d/osf.io,zkraime/osf.io,jnayak1/osf.io,TomHeatwole/osf.io,DanielSBrown/osf.io,bdyetton/prettychart,MerlinZhang/osf.io,KAsante95/osf.io,sbt9uc/osf.io,erinspace/osf.io,billyhunt/osf.io,jnayak1/osf.io,barbour-em/osf.io,GaryKriebel/osf.io,TomBaxter/osf.io,bdyetton/prettychart,doublebits/osf.io,mattclark/osf.io,caneruguz/osf.io,aaxelb/osf.io,caseyrygt/osf.io,SSJohns/osf.io,mluke93/osf.io,danielneis/osf.io,billyhunt/osf.io,asanfilippo7/osf.io,brandonPurvis/osf.io,revanthkolli/osf.io,HalcyonChimera/osf.io,adlius/osf.io,brianjgeiger/osf.io,RomanZWang/osf.io,laurenrevere/osf.io,Ghalko/osf.io,cldershem/osf.io,DanielSBrown/osf.io,himanshuo/osf.io,laurenrevere/osf.io,njantrania/osf.io,himanshuo/osf.io,wearpants/osf.io,HalcyonChimera/osf.io,kch8qx/osf.io,amyshi188/osf.io,emetsger/osf.io,fabianvf/osf.io,mluke93/osf.io,ticklemepierce/osf.io,ticklemepierce/osf.io,felliott/osf.io,mluo613/osf.io,kch8qx/osf.io,samanehsan/osf.io,SSJohns/osf.io,MerlinZhang/osf.io,samanehsan/osf.io,wearpants/osf.io,TomHeatwole/osf.io,HalcyonChimera/osf.io,samchrisinger/osf.io,njantrania/osf.io,jmcarp/osf.io,binoculars/osf.io,Johnetordoff/osf.io,abought/osf.io,adlius/osf.io,lyndsysimon/osf.io,aaxelb/osf.io,kushG/osf.io,dplorimer/osf,caseyrygt/osf.io,doublebits/osf.io,alexschiller/osf.io,sbt9uc/osf.io,asanfilippo7/osf.io,sloria/osf.io,zamattiac/osf.io,barbour-em/osf.io,saradbowman/osf.io,fabianvf/osf.io,jeffreyliu3230/osf.io,mfraezz/osf.io,GageGaskins/osf.io,crcresearch/osf.io,arpitar/osf.io,billyhunt/osf.io,cldershem/osf.io,lamdnhan/osf.io,petermalcolm/osf.io,ZobairAlijan/osf.io,petermalcolm/osf.io,brianjgeiger/osf.io,emetsger/osf.io,mfraezz/osf.io,alexschiller/osf.io,erinspace/osf.io,rdhyee/osf.io,Nesiehr/osf.io,mattclark/osf.io,mluo613/osf.io,CenterForOpenScience/osf.io,jolene-esposito/osf.io,lamdnhan/osf.io,RomanZWang/osf.io,KAsante95/osf.io,samanehsan/osf.io,GageGaskins/osf.io,RomanZWang/osf.io,caseyrollins/osf.io,Nesiehr/osf.io,Ghalko/osf.io,cldershem/osf.io,danielneis/osf.io,barbour-em/osf.io,petermalcolm/osf.io,cslzchen/osf.io,chennan47/osf.io,KAsante95/osf.io,caseyrollins/osf.io,zachjanicki/osf.io,jinluyuan/osf.io,emetsger/osf.io,baylee-d/osf.io,TomHeatwole/osf.io,lyndsysimon/osf.io,kwierman/osf.io
--- +++ @@ -22,13 +22,16 @@ xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream'); xhr.setRequestHeader('x-amz-acl', 'private'); }, - uploadSuccess: function(file, item, data) { + // Update the added item's urls and permissions item.urls = { 'delete': nodeApiUrl + 's3/delete/' + file.destination + '/', 'download': nodeApiUrl + 's3/download/' + file.destination + '/', 'view': '/' + nodeId + '/s3/view/' + file.destination + '/' - } + }; + var parent = this.getByID(item.parentID); + item.permissions = parent.permissions; + this.updateItem(item); } };
4dafd365c46539a1ece52787e818e657be655568
dev/app/shared/TB-Table/tb-table.directive.js
dev/app/shared/TB-Table/tb-table.directive.js
tbTable.$inject = [ 'tableBuilder' ]; function tbTable(tableBuilder) { var directive = { restrict: 'E', scope: { schema: '=', model: '=', onRowClick: '=?' }, link: scope => { scope.$watch('model', newModel => { if (newModel) scope.table = tableBuilder.newTable(scope.schema, newModel); else scope.table = tableBuilder.emptyTable(); }, true); }, templateUrl: 'templates/shared/TB-Table/tb-table.html' }; return directive; } module.exports = { name: 'tbTable', drtv: tbTable };
tbTable.$inject = [ 'tableBuilder' ]; function tbTable(tableBuilder) { var directive = { restrict: 'E', scope: { schema: '=', model: '=', onRowClick: '=?', table: '=?' }, link: scope => { scope.$watch('model', newModel => { if (newModel) scope.table = tableBuilder.newTable(scope.schema, newModel); else scope.table = tableBuilder.emptyTable(); }, true); }, templateUrl: 'templates/shared/TB-Table/tb-table.html' }; return directive; } module.exports = { name: 'tbTable', drtv: tbTable };
Fix table scope var in tb-table
Fix table scope var in tb-table
JavaScript
mit
Tribu-Anal/Vinculacion-Front-End,Tribu-Anal/Manejo-Horas-de-Vinculacion-UNITEC,Tribu-Anal/Manejo-Horas-de-Vinculacion-UNITEC,Tribu-Anal/Vinculacion-Front-End
--- +++ @@ -7,7 +7,8 @@ scope: { schema: '=', model: '=', - onRowClick: '=?' + onRowClick: '=?', + table: '=?' }, link: scope => { scope.$watch('model', newModel => {
d88b287fe9bf8c23f5c6e6857358a7b644da43e3
resources/assets/components/Quantity/index.js
resources/assets/components/Quantity/index.js
import React from 'react'; class Quantity extends React.Component { render() { return ( <div className="container__row figure -left -center"> <div className="figure__media"> <div className="quantity">{this.props.quantity}</div> </div> <div className="figure__body"> {this.props.noun && this.props.verb ? <h4 className="reportback-noun-verb">{this.props.noun} {this.props.verb}</h4> : null} </div> </div> ) } } export default Quantity;
import React from 'react'; import PropTypes from 'prop-types'; class Quantity extends React.Component { render() { return ( <div className="container__row figure -left -center"> <div className="figure__media"> <div className="quantity">{this.props.quantity}</div> </div> <div className="figure__body"> {this.props.noun && this.props.verb ? <h4 className="reportback-noun-verb">{this.props.noun} {this.props.verb}</h4> : null} </div> </div> ) } } Quantity.propTypes = { noun: PropTypes.string.isRequired, quantity: PropTypes.int.isRequired, verb: PropTypes.string.isRequired, }; export default Quantity;
Add proptype validation to Quantity component
Add proptype validation to Quantity component
JavaScript
mit
DoSomething/rogue,DoSomething/rogue,DoSomething/rogue
--- +++ @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; class Quantity extends React.Component { render() { @@ -17,4 +18,10 @@ } } +Quantity.propTypes = { + noun: PropTypes.string.isRequired, + quantity: PropTypes.int.isRequired, + verb: PropTypes.string.isRequired, +}; + export default Quantity;
784efbf5bfcb989ad81b2d80fa504e028c1d6466
generators/app/index.js
generators/app/index.js
'use strict'; var BaseGenerator = require('yeoman-generator').Base; module.exports = BaseGenerator.extend({ constructor: function () { BaseGenerator.apply(this, arguments); this.option('preset', {desc: 'App preset: dust | example | handlebars | jade', alias: 'p', defaults: 'handlebars'}); this.argument('appName', {desc: 'App name', required: false, defaults: this.appname}); }, writing: function () { this.log('App name = ' + this.appName); this.fs.copy( this.templatePath(this.options.preset + '/**/*'), this.destinationRoot() ); this.fs.extendJSON(this.destinationPath('package.json'), {name: this.appName}); }, install: function () { this.installDependencies(); } });
'use strict'; var BaseGenerator = require('yeoman-generator').Base; module.exports = BaseGenerator.extend({ constructor: function () { BaseGenerator.apply(this, arguments); this.option('preset', {desc: 'App preset: dust | example | handlebars | jade', alias: 'p', defaults: 'handlebars'}); this.argument('appName', {desc: 'App name', required: false, defaults: this.appname}); }, writing: function () { var appName = this.appName, preset = this.options.preset; this.log('App name = ' + appName); this.config.set('preset', preset); this.fs.copy( this.templatePath(preset + '/**/*'), this.destinationRoot() ); this.fs.extendJSON(this.destinationPath('package.json'), {name: appName}); }, install: function () { this.installDependencies(); } });
Save app preset in config
Save app preset in config
JavaScript
mit
catberry/generator-catberry,catberry/generator-catberry
--- +++ @@ -11,12 +11,14 @@ }, writing: function () { - this.log('App name = ' + this.appName); + var appName = this.appName, preset = this.options.preset; + this.log('App name = ' + appName); + this.config.set('preset', preset); this.fs.copy( - this.templatePath(this.options.preset + '/**/*'), + this.templatePath(preset + '/**/*'), this.destinationRoot() ); - this.fs.extendJSON(this.destinationPath('package.json'), {name: this.appName}); + this.fs.extendJSON(this.destinationPath('package.json'), {name: appName}); }, install: function () {