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
c316a0757defcde769be70b5d8af5c51ef0ccb75
task/import.js
task/import.js
var geonames = require('geonames-stream'); var peliasConfig = require( 'pelias-config' ).generate(); var peliasAdminLookup = require( 'pelias-admin-lookup' ); var dbclient = require('pelias-dbclient'); var model = require( 'pelias-model' ); var resolvers = require('./resolvers'); var adminLookupMetaStream = require('../lib/streams/adminLookupMetaStream'); var peliasDocGenerator = require( '../lib/streams/peliasDocGenerator'); module.exports = function( filename ){ var pipeline = resolvers.selectSource( filename ) .pipe( geonames.pipeline ) .pipe( peliasDocGenerator.createPeliasDocGenerator() ); if( peliasConfig.imports.geonames.adminLookup ){ pipeline = pipeline .pipe( adminLookupMetaStream.create() ) .pipe( peliasAdminLookup.stream() ); } pipeline .pipe(model.createDocumentMapperStream()) .pipe( dbclient() ); };
var geonames = require('geonames-stream'); var peliasConfig = require( 'pelias-config' ).generate(); var peliasAdminLookup = require( 'pelias-admin-lookup' ); var dbclient = require('pelias-dbclient'); var model = require( 'pelias-model' ); var resolvers = require('./resolvers'); var adminLookupMetaStream = require('../lib/streams/adminLookupMetaStream'); var peliasDocGenerator = require( '../lib/streams/peliasDocGenerator'); module.exports = function( filename ){ var pipeline = resolvers.selectSource( filename ) .pipe( geonames.pipeline ) .pipe( peliasDocGenerator.create() ); if( peliasConfig.imports.geonames.adminLookup ){ pipeline = pipeline .pipe( adminLookupMetaStream.create() ) .pipe( peliasAdminLookup.stream() ); } pipeline .pipe(model.createDocumentMapperStream()) .pipe( dbclient() ); };
Use new function name for doc generator
Use new function name for doc generator
JavaScript
mit
pelias/geonames,pelias/geonames
--- +++ @@ -11,7 +11,7 @@ module.exports = function( filename ){ var pipeline = resolvers.selectSource( filename ) .pipe( geonames.pipeline ) - .pipe( peliasDocGenerator.createPeliasDocGenerator() ); + .pipe( peliasDocGenerator.create() ); if( peliasConfig.imports.geonames.adminLookup ){ pipeline = pipeline
6bb0842748a92359d383445e1046bb622a6649e4
tasks/build.js
tasks/build.js
/* Copyright (c) 2013, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://yuilibrary.com/license/ */ module.exports = function(grunt) { // The `artifacts` directory will usually only ever in YUI's CI system. // If you're in CI, and `build-npm` exists (meaning YUI's already built), skip the build. if ((grunt.file.exists('artifacts') && grunt.file.exists('build-npm')) || 'GRUNT_SKIP_BUILD' in process.env) { grunt.registerTask('build', 'Building YUI', function() { grunt.log.ok('Found GRUNT_SKIP_BUILD in environment, skipping build.'); }); } else { grunt.registerTask('build', 'Building YUI', ['yogi-build', 'npm']); } grunt.registerTask('build-test', 'Building and testing YUI', ['yogi-build', 'npm', 'test']); grunt.registerTask('all', 'Building and testing YUI', ['build-test']); };
/* Copyright (c) 2013, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://yuilibrary.com/license/ */ module.exports = function(grunt) { // The `artifacts` directory will usually only ever in YUI's CI system. // If you're in CI, `build-npm` exists, and this task was called in // response to the `postinstall` hook; skip the build. if ((process.env.npm_lifecycle_event === "postinstall" && grunt.file.exists('artifacts') && grunt.file.exists('build-npm')) || 'GRUNT_SKIP_BUILD' in process.env) { grunt.registerTask('build', 'Building YUI', function() { grunt.log.ok('Found GRUNT_SKIP_BUILD in environment, skipping build.'); }); } else { grunt.registerTask('build', 'Building YUI', ['yogi-build', 'npm']); } grunt.registerTask('build-test', 'Building and testing YUI', ['yogi-build', 'npm', 'test']); grunt.registerTask('all', 'Building and testing YUI', ['build-test']); };
Add more specificity to the CI "check."
Add more specificity to the CI "check."
JavaScript
bsd-3-clause
yui/grunt-yui-contrib
--- +++ @@ -6,8 +6,9 @@ module.exports = function(grunt) { // The `artifacts` directory will usually only ever in YUI's CI system. - // If you're in CI, and `build-npm` exists (meaning YUI's already built), skip the build. - if ((grunt.file.exists('artifacts') && grunt.file.exists('build-npm')) || 'GRUNT_SKIP_BUILD' in process.env) { + // If you're in CI, `build-npm` exists, and this task was called in + // response to the `postinstall` hook; skip the build. + if ((process.env.npm_lifecycle_event === "postinstall" && grunt.file.exists('artifacts') && grunt.file.exists('build-npm')) || 'GRUNT_SKIP_BUILD' in process.env) { grunt.registerTask('build', 'Building YUI', function() { grunt.log.ok('Found GRUNT_SKIP_BUILD in environment, skipping build.'); });
261149bf0046fda82bb80dbe50fcc2f6233fe779
modules/core/client/config/core-admin.client.routes.js
modules/core/client/config/core-admin.client.routes.js
'use strict'; // Setting up route angular.module('core.admin.routes').config(['$stateProvider', function ($stateProvider) { $stateProvider .state('admin', { abstract: true, url: '/admin', template: '<ui-view/>', data: { adminOnly: true } }) .state('admin.index', { url: '', templateUrl: 'modules/core/client/views/admin/list.client.view.html' }); } ]);
'use strict'; // Setting up route angular.module('core.admin.routes').config(['$stateProvider', function ($stateProvider) { $stateProvider .state('admin', { abstract: true, url: '/admin', template: '<ui-view/>', data: { adminOnly: true } }) .state('admin.index', { url: '', templateUrl: 'modules/core/client/views/admin/index.client.view.html' }); } ]);
Add event category descriptions + update style
Add event category descriptions + update style
JavaScript
mit
CEN3031GroupA/US-Hackathon,CEN3031GroupA/US-Hackathon,CEN3031GroupA/US-Hackathon
--- +++ @@ -14,7 +14,7 @@ }) .state('admin.index', { url: '', - templateUrl: 'modules/core/client/views/admin/list.client.view.html' + templateUrl: 'modules/core/client/views/admin/index.client.view.html' }); } ]);
7c3f65c9492218d91d2213e9c5d5ae88d5ae2772
lib/node_modules/@stdlib/math/base/dist/betaprime/lib/index.js
lib/node_modules/@stdlib/math/base/dist/betaprime/lib/index.js
'use strict'; /* * When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. */ // MODULES // var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); // MAIN // /** * Top-level namespace. * * @namespace betaprime */ var betaprime = {}; /** * @name mean * @memberof betaprime * @readonly * @type {Function} * @see {@link module:@stdlib/math/base/dist/betaprime/mean} */ setReadOnly( betaprime, 'mean', require( '@stdlib/math/base/dist/betaprime/mean' ) ); /** * @name variance * @memberof betaprime * @readonly * @type {Function} * @see {@link module:@stdlib/math/base/dist/betaprime/variance} */ setReadOnly( betaprime, 'variance', require( '@stdlib/math/base/dist/betaprime/variance' ) ); // EXPORTS // module.exports = betaprime;
'use strict'; /* * When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. */ // MODULES // var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); // MAIN // /** * Top-level namespace. * * @namespace betaprime */ var betaprime = {}; /** * @name mean * @memberof betaprime * @readonly * @type {Function} * @see {@link module:@stdlib/math/base/dist/betaprime/mean} */ setReadOnly( betaprime, 'mean', require( '@stdlib/math/base/dist/betaprime/mean' ) ); /** * @name skewness * @memberof betaprime * @readonly * @type {Function} * @see {@link module:@stdlib/math/base/dist/betaprime/skewness} */ setReadOnly( betaprime, 'skewness', require( '@stdlib/math/base/dist/betaprime/skewness' ) ); /** * @name variance * @memberof betaprime * @readonly * @type {Function} * @see {@link module:@stdlib/math/base/dist/betaprime/variance} */ setReadOnly( betaprime, 'variance', require( '@stdlib/math/base/dist/betaprime/variance' ) ); // EXPORTS // module.exports = betaprime;
Add skewness to beta prime namespace
Add skewness to beta prime namespace
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
--- +++ @@ -28,6 +28,15 @@ setReadOnly( betaprime, 'mean', require( '@stdlib/math/base/dist/betaprime/mean' ) ); /** +* @name skewness +* @memberof betaprime +* @readonly +* @type {Function} +* @see {@link module:@stdlib/math/base/dist/betaprime/skewness} +*/ +setReadOnly( betaprime, 'skewness', require( '@stdlib/math/base/dist/betaprime/skewness' ) ); + +/** * @name variance * @memberof betaprime * @readonly
40a96dbb0681ff912a64f8fdc3f542256dab1fd4
src/main/js/components/views/builder/SponsorAffinities.js
src/main/js/components/views/builder/SponsorAffinities.js
import React from 'react'; import { List, ListSubHeader, ListCheckbox } from 'react-toolbox/lib/list'; const SponsorAffinities = () => { return ( <div> <List selectable ripple> <ListSubHeader caption='list_a' /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> </List> <List selectable ripple> <ListSubHeader caption='list_b' /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> </List> </div> ); }; export default SponsorAffinities;
import React from 'react'; import { List, ListSubHeader, ListCheckbox } from 'react-toolbox/lib/list'; const SponsorAffinities = () => { return ( <div className="horizontal"> <List selectable ripple className="horizontalChild"> <ListSubHeader caption='list_a' /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> </List> <List selectable ripple className="horizontalChild"> <ListSubHeader caption='list_b' /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> <ListCheckbox caption='affinity' checked={false} /> </List> </div> ); }; export default SponsorAffinities;
Set classes for showing the lists horizontally
Set classes for showing the lists horizontally
JavaScript
apache-2.0
Bernardo-MG/dreadball-toolkit-webpage,Bernardo-MG/dreadball-toolkit-webpage,Bernardo-MG/dreadball-toolkit-webpage,Bernardo-MG/dreadball-toolkit-webpage
--- +++ @@ -3,8 +3,8 @@ const SponsorAffinities = () => { return ( - <div> - <List selectable ripple> + <div className="horizontal"> + <List selectable ripple className="horizontalChild"> <ListSubHeader caption='list_a' /> <ListCheckbox caption='affinity' @@ -25,7 +25,7 @@ caption='affinity' checked={false} /> </List> - <List selectable ripple> + <List selectable ripple className="horizontalChild"> <ListSubHeader caption='list_b' /> <ListCheckbox caption='affinity'
873e2e8a92b286e73375a0f3505615d63dde3d9e
server/graphql/queries/entries/multiple.js
server/graphql/queries/entries/multiple.js
const { GraphQLList, GraphQLString } = require('graphql'); const mongoose = require('mongoose'); const { outputType } = require('../../types/Entries'); const getProjection = require('../../get-projection'); const getUserPermissions = require('../../../utils/getUserPermissions'); const Entry = mongoose.model('Entry'); module.exports = { type: new GraphQLList(outputType), args: { status: { name: 'status', type: GraphQLString, }, }, async resolve(root, args, ctx, ast) { const projection = getProjection(ast); const perms = await getUserPermissions(ctx.user._id); if (!perms.canSeeDrafts) { return Entry .find({ status: 'live' }) .select(projection) .exec(); } return Entry .find(args) .select(projection) .exec(); }, };
const { GraphQLList, GraphQLString } = require('graphql'); const mongoose = require('mongoose'); const { outputType } = require('../../types/Entries'); const getProjection = require('../../get-projection'); const getUserPermissions = require('../../../utils/getUserPermissions'); const Entry = mongoose.model('Entry'); module.exports = { type: new GraphQLList(outputType), args: { status: { name: 'status', type: GraphQLString, }, }, async resolve(root, args, ctx, ast) { const projection = getProjection(ast); if (ctx.user) { const perms = await getUserPermissions(ctx.user._id); if (!perms.canSeeDrafts) { return Entry .find({ status: 'live' }) .select(projection) .exec(); } } return Entry .find(args) .select(projection) .exec(); }, };
Fix permissions check in Entries query
:lock: Fix permissions check in Entries query
JavaScript
mit
JasonEtco/flintcms,JasonEtco/flintcms
--- +++ @@ -17,13 +17,16 @@ }, async resolve(root, args, ctx, ast) { const projection = getProjection(ast); - const perms = await getUserPermissions(ctx.user._id); - if (!perms.canSeeDrafts) { - return Entry - .find({ status: 'live' }) - .select(projection) - .exec(); + if (ctx.user) { + const perms = await getUserPermissions(ctx.user._id); + + if (!perms.canSeeDrafts) { + return Entry + .find({ status: 'live' }) + .select(projection) + .exec(); + } } return Entry
e67f17f3430c9509f4d1ff07ddefc6baf05780ff
client/actions/profile.js
client/actions/profile.js
import axios from 'axios'; import { FETCHING_PROFILE, PROFILE_SUCCESS, PROFILE_FAILURE } from './types'; import { apiURL } from './userSignUp'; import setHeader from '../helpers/setheader'; const fetchingProfile = () => ({ type: FETCHING_PROFILE, }); const profileSuccess = profile => ({ type: PROFILE_SUCCESS, profile, }); const profileFailure = error => ({ type: PROFILE_FAILURE, error, }); const getUserProfile = userId => (dispatch) => { dispatch(fetchingProfile()); setHeader(); return axios.get(`${apiURL}/users/${userId}`) .then((response) => { console.log(response.data); dispatch(profileSuccess(response.data)); }) .catch((error) => { if (error.response) { let errorMessage = ''; errorMessage = error.response.msg; dispatch(profileFailure(errorMessage)); } else { dispatch(profileFailure(error.message)); } }); }; export default getUserProfile;
import axios from 'axios'; import { FETCHING_PROFILE, PROFILE_SUCCESS, PROFILE_FAILURE, RETURN_BOOK_SUCCESS, RETURN_BOOK_REQUEST, RETURN_BOOK_FAILURE, } from './types'; import { apiURL } from './userSignUp'; import setHeader from '../helpers/setheader'; const fetchingProfile = () => ({ type: FETCHING_PROFILE, }); const profileSuccess = profile => ({ type: PROFILE_SUCCESS, profile, }); const profileFailure = error => ({ type: PROFILE_FAILURE, error, }); export const getUserProfile = userId => (dispatch) => { dispatch(fetchingProfile()); setHeader(); return axios.get(`${apiURL}/users/${userId}`) .then((response) => { console.log(response.data); dispatch(profileSuccess(response.data.user)); }) .catch((error) => { if (error.response) { let errorMessage = ''; errorMessage = error.response.msg; dispatch(profileFailure(errorMessage)); } else { dispatch(profileFailure(error.message)); } }); }; const returningBook = () => ({ type: RETURN_BOOK_REQUEST, }); const returnBookSuccess = returnRequest => ({ type: RETURN_BOOK_SUCCESS, returnRequest, }); const returnBookFailure = error => ({ type: RETURN_BOOK_FAILURE, error, }); export const returnBook = (userId, bookId) => (dispatch) => { dispatch(returningBook()); setHeader(); return axios.post(`${apiURL}/users/${userId}/return/${bookId}`) .then((response) => { console.log(response.data); dispatch(returnBookSuccess(response.data.returnRequest)); }) .catch((error) => { if (error.response) { let errorMessage = ''; errorMessage = error.response.msg; console.log(errorMessage); dispatch(returnBookFailure(errorMessage)); } else { dispatch(returnBookFailure(error.message)); } }); };
Add actions for returning a book
Add actions for returning a book
JavaScript
mit
amarachukwu-agbo/hello-books,amarachukwu-agbo/hello-books
--- +++ @@ -1,5 +1,12 @@ import axios from 'axios'; -import { FETCHING_PROFILE, PROFILE_SUCCESS, PROFILE_FAILURE } from './types'; +import { + FETCHING_PROFILE, + PROFILE_SUCCESS, + PROFILE_FAILURE, + RETURN_BOOK_SUCCESS, + RETURN_BOOK_REQUEST, + RETURN_BOOK_FAILURE, +} from './types'; import { apiURL } from './userSignUp'; import setHeader from '../helpers/setheader'; @@ -17,13 +24,13 @@ error, }); -const getUserProfile = userId => (dispatch) => { +export const getUserProfile = userId => (dispatch) => { dispatch(fetchingProfile()); setHeader(); return axios.get(`${apiURL}/users/${userId}`) .then((response) => { console.log(response.data); - dispatch(profileSuccess(response.data)); + dispatch(profileSuccess(response.data.user)); }) .catch((error) => { if (error.response) { @@ -36,5 +43,37 @@ }); }; -export default getUserProfile; +const returningBook = () => ({ + type: RETURN_BOOK_REQUEST, +}); +const returnBookSuccess = returnRequest => ({ + type: RETURN_BOOK_SUCCESS, + returnRequest, +}); + +const returnBookFailure = error => ({ + type: RETURN_BOOK_FAILURE, + error, +}); + +export const returnBook = (userId, bookId) => (dispatch) => { + dispatch(returningBook()); + setHeader(); + return axios.post(`${apiURL}/users/${userId}/return/${bookId}`) + .then((response) => { + console.log(response.data); + dispatch(returnBookSuccess(response.data.returnRequest)); + }) + .catch((error) => { + if (error.response) { + let errorMessage = ''; + errorMessage = error.response.msg; + console.log(errorMessage); + dispatch(returnBookFailure(errorMessage)); + } else { + dispatch(returnBookFailure(error.message)); + } + }); +}; +
a4e2361908ff921fa0033a4fecbf4abf2d5766da
client/app/docs/module.js
client/app/docs/module.js
/** * This file is part of Superdesk. * * Copyright 2013, 2014 Sourcefabric z.u. and contributors. * * For the full copyright and license information, please see the * AUTHORS and LICENSE files distributed with this source code, or * at https://www.sourcefabric.org/superdesk/license */ (function() { 'use strict'; var app = angular.module('superdesk.docs', []); MainDocsView.$inject = ['$location', '$anchorScroll']; function MainDocsView($location, $anchorScroll) { return { templateUrl: 'docs/views/main.html', link: function(scope, elem, attrs) { scope.scrollTo = function(id) { $location.hash(id); $anchorScroll(); }; } }; } app.directive('sdDocs', MainDocsView); app.directive('prettyprint', function() { return { restrict: 'C', link: function postLink(scope, element, attrs) { var langExtension = attrs['class'].match(/\blang(?:uage)?-([\w.]+)(?!\S)/); if (langExtension) { langExtension = langExtension[1]; } element.html(window.prettyPrintOne(_.escape(element.html()), langExtension, true)); } }; }); return app; })();
/** * This file is part of Superdesk. * * Copyright 2013, 2014 Sourcefabric z.u. and contributors. * * For the full copyright and license information, please see the * AUTHORS and LICENSE files distributed with this source code, or * at https://www.sourcefabric.org/superdesk/license */ (function() { 'use strict'; var app = angular.module('superdesk.docs', []); MainDocsView.$inject = ['$location', '$anchorScroll']; function MainDocsView($location, $anchorScroll) { return { templateUrl: '/docs/views/main.html', link: function(scope, elem, attrs) { scope.scrollTo = function(id) { $location.hash(id); $anchorScroll(); }; } }; } app.directive('sdDocs', MainDocsView); app.directive('prettyprint', function() { return { restrict: 'C', link: function postLink(scope, element, attrs) { var langExtension = attrs['class'].match(/\blang(?:uage)?-([\w.]+)(?!\S)/); if (langExtension) { langExtension = langExtension[1]; } element.html(window.prettyPrintOne(_.escape(element.html()), langExtension, true)); } }; }); return app; })();
Fix template url for UI docs
fix(docs): Fix template url for UI docs
JavaScript
agpl-3.0
mdhaman/superdesk-aap,sivakuna-aap/superdesk,thnkloud9/superdesk,pavlovicnemanja92/superdesk,ancafarcas/superdesk,hlmnrmr/superdesk,pavlovicnemanja92/superdesk,plamut/superdesk,superdesk/superdesk-ntb,marwoodandrew/superdesk-aap,verifiedpixel/superdesk,fritzSF/superdesk,superdesk/superdesk,verifiedpixel/superdesk,sivakuna-aap/superdesk,akintolga/superdesk,sivakuna-aap/superdesk,pavlovicnemanja92/superdesk,mugurrus/superdesk,plamut/superdesk,Aca-jov/superdesk,pavlovicnemanja/superdesk,mugurrus/superdesk,akintolga/superdesk-aap,petrjasek/superdesk,ancafarcas/superdesk,liveblog/superdesk,mdhaman/superdesk,superdesk/superdesk,superdesk/superdesk,thnkloud9/superdesk,Aca-jov/superdesk,superdesk/superdesk-ntb,vied12/superdesk,petrjasek/superdesk-ntb,petrjasek/superdesk,gbbr/superdesk,Aca-jov/superdesk,liveblog/superdesk,pavlovicnemanja/superdesk,mdhaman/superdesk-aap,darconny/superdesk,amagdas/superdesk,plamut/superdesk,marwoodandrew/superdesk,verifiedpixel/superdesk,pavlovicnemanja/superdesk,amagdas/superdesk,marwoodandrew/superdesk,sjunaid/superdesk,gbbr/superdesk,superdesk/superdesk-aap,verifiedpixel/superdesk,hlmnrmr/superdesk,vied12/superdesk,sivakuna-aap/superdesk,mdhaman/superdesk-aap,akintolga/superdesk-aap,marwoodandrew/superdesk-aap,fritzSF/superdesk,mdhaman/superdesk-aap,ancafarcas/superdesk,thnkloud9/superdesk,superdesk/superdesk,superdesk/superdesk-aap,fritzSF/superdesk,gbbr/superdesk,mdhaman/superdesk,ioanpocol/superdesk,petrjasek/superdesk,akintolga/superdesk,ioanpocol/superdesk,petrjasek/superdesk-ntb,ioanpocol/superdesk-ntb,amagdas/superdesk,petrjasek/superdesk-ntb,superdesk/superdesk-aap,darconny/superdesk,marwoodandrew/superdesk-aap,pavlovicnemanja92/superdesk,akintolga/superdesk,superdesk/superdesk-ntb,plamut/superdesk,superdesk/superdesk-ntb,verifiedpixel/superdesk,plamut/superdesk,hlmnrmr/superdesk,mdhaman/superdesk,ioanpocol/superdesk,vied12/superdesk,pavlovicnemanja/superdesk,ioanpocol/superdesk-ntb,sivakuna-aap/superdesk,mugurrus/superdesk,sjunaid/superdesk,marwoodandrew/superdesk,liveblog/superdesk,amagdas/superdesk,vied12/superdesk,amagdas/superdesk,akintolga/superdesk-aap,marwoodandrew/superdesk,ioanpocol/superdesk-ntb,akintolga/superdesk,darconny/superdesk,petrjasek/superdesk-ntb,marwoodandrew/superdesk,fritzSF/superdesk,liveblog/superdesk,fritzSF/superdesk,akintolga/superdesk-aap,superdesk/superdesk-aap,pavlovicnemanja92/superdesk,petrjasek/superdesk,akintolga/superdesk,marwoodandrew/superdesk-aap,vied12/superdesk,sjunaid/superdesk,liveblog/superdesk
--- +++ @@ -17,7 +17,7 @@ MainDocsView.$inject = ['$location', '$anchorScroll']; function MainDocsView($location, $anchorScroll) { return { - templateUrl: 'docs/views/main.html', + templateUrl: '/docs/views/main.html', link: function(scope, elem, attrs) { scope.scrollTo = function(id) { $location.hash(id);
8e8a784f1318f367f2a633395429abff30566c64
updates/0.1.0-fr-settings.js
updates/0.1.0-fr-settings.js
exports.create = { Settings: [{ "site": { "name": "EStore Demo" }, "payment.cod.active": true }] };
exports.create = { Settings: [{ "site": { "name": "EStore Demo" }, "payments.cod.active": true }] };
Fix no payment set by default error.
Fix no payment set by default error.
JavaScript
mit
stunjiturner/estorejs,quenktechnologies/estorejs,stunjiturner/estorejs
--- +++ @@ -5,7 +5,7 @@ "site": { "name": "EStore Demo" }, - "payment.cod.active": true + "payments.cod.active": true }] };
52fbbe3c5e4be1ad9be58fe862185a577a0e6c1f
packages/vega-parser/index.js
packages/vega-parser/index.js
// setup transform definition aliases import {definition} from 'vega-dataflow'; definition('Sort', definition('Collect')); definition('Formula', definition('Apply')); export {default as parse} from './src/parse'; export {default as selector} from './src/parsers/event-selector'; export {default as signal} from './src/parsers/signal'; export {default as signalUpdates} from './src/parsers/signal-updates'; export {default as stream} from './src/parsers/stream'; export { MarkRole, FrameRole, ScopeRole, AxisRole, AxisDomainRole, AxisGridRole, AxisLabelRole, AxisTickRole, AxisTitleRole, LegendRole, LegendEntryRole, LegendLabelRole, LegendSymbolRole, LegendTitleRole } from './src/parsers/marks/roles'; export {marktypes, isMarkType} from './src/parsers/marks/marktypes'; export {default as Scope} from './src/Scope'; export {default as DataScope} from './src/DataScope';
// setup transform definition aliases import {definition} from 'vega-dataflow'; definition('Formula', definition('Apply')); export {default as parse} from './src/parse'; export {default as selector} from './src/parsers/event-selector'; export {default as signal} from './src/parsers/signal'; export {default as signalUpdates} from './src/parsers/signal-updates'; export {default as stream} from './src/parsers/stream'; export { MarkRole, FrameRole, ScopeRole, AxisRole, AxisDomainRole, AxisGridRole, AxisLabelRole, AxisTickRole, AxisTitleRole, LegendRole, LegendEntryRole, LegendLabelRole, LegendSymbolRole, LegendTitleRole } from './src/parsers/marks/roles'; export {marktypes, isMarkType} from './src/parsers/marks/marktypes'; export {default as Scope} from './src/Scope'; export {default as DataScope} from './src/DataScope';
Drop Sort alias for Collect.
Drop Sort alias for Collect.
JavaScript
bsd-3-clause
lgrammel/vega,vega/vega,vega/vega,vega/vega,vega/vega
--- +++ @@ -1,6 +1,5 @@ // setup transform definition aliases import {definition} from 'vega-dataflow'; -definition('Sort', definition('Collect')); definition('Formula', definition('Apply')); export {default as parse} from './src/parse';
e569c4f2081979947e7b948de870978e9bde719a
app/elements/sidebar.js
app/elements/sidebar.js
import * as React from 'react' import {State} from 'react-router' import SearchButton from 'elements/searchButton' import GraduationStatus from 'elements/graduationStatus' let Sidebar = React.createClass({ mixins: [State], render() { let isSearching = this.getQuery().search let sidebar = isSearching ? React.createElement(SearchButton, {search: isSearching}) : React.createElement(GraduationStatus, {student: this.props.student, sections: this.getQuery().sections}) return sidebar }, }) export default Sidebar
import * as React from 'react' import {State} from 'react-router' import SearchButton from 'elements/searchButton' import GraduationStatus from 'elements/graduationStatus' let Sidebar = React.createClass({ mixins: [State], render() { let isSearching = 'search' in this.getQuery() let sidebar = isSearching ? React.createElement(SearchButton, {search: isSearching}) : React.createElement(GraduationStatus, {student: this.props.student, sections: this.getQuery().sections}) return sidebar }, }) export default Sidebar
Use `in` to detect if the query param has "search"
Use `in` to detect if the query param has "search"
JavaScript
agpl-3.0
hawkrives/gobbldygook,hawkrives/gobbldygook,hawkrives/gobbldygook
--- +++ @@ -7,7 +7,7 @@ let Sidebar = React.createClass({ mixins: [State], render() { - let isSearching = this.getQuery().search + let isSearching = 'search' in this.getQuery() let sidebar = isSearching ? React.createElement(SearchButton, {search: isSearching}) : React.createElement(GraduationStatus, {student: this.props.student, sections: this.getQuery().sections})
1c3042481b75e305e993316256dc19f51fd41cf6
SPAWithAngularJS/module2/customServices/js/app.shoppingListService.js
SPAWithAngularJS/module2/customServices/js/app.shoppingListService.js
// app.shoppingListService.js (function() { "use strict"; angular.module("MyApp") .service("ShoppingListService", ShoppingListService); function ShoppingListService() { let service = this; // List of Shopping items let items = []; service.addItem = addItem; function addItem(itemName, itemQuantity) { console.log("ShoppingListService", itemName, itemQuantity); let item = { name: itemName, quantity: itemQuantity }; items.push(item); } service.getItems = getItems; function getItems() { return items; } } })();
// app.shoppingListService.js (function() { "use strict"; angular.module("MyApp") .service("ShoppingListService", ShoppingListService); function ShoppingListService() { let service = this; // List of Shopping items let items = []; service.addItem = addItem; service.getItems = getItems; service.removeItem = removeItem; function addItem(itemName, itemQuantity) { let item = { name: itemName, quantity: itemQuantity }; items.push(item); } function getItems() { return items; } function removeItem(itemIndex) { items.splice(itemIndex, 1); } } })();
Delete useless code. Added removeItem method
Delete useless code. Added removeItem method
JavaScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
--- +++ @@ -13,10 +13,10 @@ let items = []; service.addItem = addItem; + service.getItems = getItems; + service.removeItem = removeItem; function addItem(itemName, itemQuantity) { - console.log("ShoppingListService", itemName, itemQuantity); - let item = { name: itemName, quantity: itemQuantity @@ -25,10 +25,12 @@ items.push(item); } - service.getItems = getItems; - function getItems() { return items; } + + function removeItem(itemIndex) { + items.splice(itemIndex, 1); + } } })();
47b9aba68050230eeff0754f4076b7596cbe9eb9
api/throttle.js
api/throttle.js
"use strict" module.exports = function(callback) { //60fps translates to 16.6ms, round it down since setTimeout requires int var time = 16 var last = 0, pending = null var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout return function(synchronous) { var now = new Date().getTime() if (synchronous === true || last === 0 || now - last >= time) { last = now callback() } else if (pending === null) { pending = timeout(function() { pending = null callback() last = new Date().getTime() }, time - (now - last)) } } }
"use strict" var ts = Date.now || function() { return new Date().getTime() } module.exports = function(callback) { //60fps translates to 16.6ms, round it down since setTimeout requires int var time = 16 var last = 0, pending = null var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout return function(synchronous) { var now = ts() if (synchronous === true || last === 0 || now - last >= time) { last = now callback() } else if (pending === null) { pending = timeout(function() { pending = null callback() last = ts() }, time - (now - last)) } } }
Use Date.now() if available since it's faster
Use Date.now() if available since it's faster
JavaScript
mit
pygy/mithril.js,impinball/mithril.js,tivac/mithril.js,MithrilJS/mithril.js,barneycarroll/mithril.js,barneycarroll/mithril.js,tivac/mithril.js,impinball/mithril.js,pygy/mithril.js,lhorie/mithril.js,lhorie/mithril.js,MithrilJS/mithril.js
--- +++ @@ -1,4 +1,8 @@ "use strict" + +var ts = Date.now || function() { + return new Date().getTime() +} module.exports = function(callback) { //60fps translates to 16.6ms, round it down since setTimeout requires int @@ -6,7 +10,7 @@ var last = 0, pending = null var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout return function(synchronous) { - var now = new Date().getTime() + var now = ts() if (synchronous === true || last === 0 || now - last >= time) { last = now callback() @@ -15,7 +19,7 @@ pending = timeout(function() { pending = null callback() - last = new Date().getTime() + last = ts() }, time - (now - last)) } }
a5add8048b2548c5f216d7afd9e0ebcb097f4fcc
lib/dom/accessibility/sections.js
lib/dom/accessibility/sections.js
(function() { 'use strict'; var headings = ['h6', 'h5', 'h4', 'h3', 'h2', 'h1']; var score = 0; var message = ''; var sections = Array.prototype.slice.call(window.document.getElementsByTagName('section')); var totalSections = sections.length; if (totalSections === 0) { message = 'The page doesn\'t use sections. You could possible use them to get a better structure of your content.'; score = 100; } else { sections.forEach(function(section) { var hasHeading = false; headings.forEach(function(heading) { var tags = Array.prototype.slice.call(section.getElementsByTagName(heading)); if (tags.length > 0) { hasHeading = true; } }, this); if (!hasHeading) { score += 10; message += ' The page is missing a heading within a section tag on the page.'; } }) } return { id: 'sections', title: 'Use headings tags within section tags to better structure your page', description: 'Section tags should have at least one heading element as a direct descendant.', advice: message, score: Math.max(0, 100 - score), weight: 0, offending: [], tags: ['accessibility', 'html'] }; })();
(function() { 'use strict'; var headings = ['h6', 'h5', 'h4', 'h3', 'h2', 'h1']; var score = 0; var message = ''; var sections = Array.prototype.slice.call(window.document.getElementsByTagName('section')); var totalSections = sections.length; if (totalSections === 0) { message = 'The page doesn\'t use sections. You could possible use them to get a better structure of your content.'; score = 100; } else { sections.forEach(function(section) { var hasHeading = false; headings.forEach(function(heading) { var tags = Array.prototype.slice.call(section.getElementsByTagName(heading)); if (tags.length > 0) { hasHeading = true; } }); if (!hasHeading) { score += 10; message = 'The page is missing a heading within a section tag on the page.'; } }) } return { id: 'sections', title: 'Use headings tags within section tags to better structure your page', description: 'Section tags should have at least one heading element as a direct descendant.', advice: message, score: Math.max(0, 100 - score), weight: 0, offending: [], tags: ['accessibility', 'html'] }; })();
Remove extra space in message.
Remove extra space in message.
JavaScript
mit
sitespeedio/coach,sitespeedio/coach
--- +++ @@ -17,10 +17,10 @@ if (tags.length > 0) { hasHeading = true; } - }, this); + }); if (!hasHeading) { score += 10; - message += ' The page is missing a heading within a section tag on the page.'; + message = 'The page is missing a heading within a section tag on the page.'; } }) }
18ac5c64a7da29e5bf25bc274c61ad6078bace86
config/environments.config.js
config/environments.config.js
// Here is where you can define configuration overrides based on the execution environment. // Supply a key to the default export matching the NODE_ENV that you wish to target, and // the base configuration will apply your overrides before exporting itself. module.exports = { // ====================================================== // Overrides when NODE_ENV === 'development' // ====================================================== // NOTE: In development, we use an explicit public path when the assets // are served webpack by to fix this issue: // http://stackoverflow.com/questions/34133808/webpack-ots-parsing-error-loading-fonts/34133809#34133809 development : (config) => ({ compiler_public_path : `http://${config.server_host}:${config.server_port}/` }), // ====================================================== // Overrides when NODE_ENV === 'production' // ====================================================== production : (config) => ({ compiler_public_path : '/', compiler_fail_on_warning : false, compiler_hash_type : 'chunkhash', compiler_devtool : null, compiler_stats : { chunks : true, chunkModules : true, colors : true } }) }
// Here is where you can define configuration overrides based on the execution environment. // Supply a key to the default export matching the NODE_ENV that you wish to target, and // the base configuration will apply your overrides before exporting itself. module.exports = { // ====================================================== // Overrides when NODE_ENV === 'development' // ====================================================== // NOTE: In development, we use an explicit public path when the assets // are served webpack by to fix this issue: // http://stackoverflow.com/questions/34133808/webpack-ots-parsing-error-loading-fonts/34133809#34133809 development : (config) => ({ compiler_public_path : `http://${config.server_host}:${config.server_port}/` }), // ====================================================== // Overrides when NODE_ENV === 'production' // ====================================================== production : (config) => ({ compiler_public_path : '/', compiler_fail_on_warning : false, compiler_hash_type : 'chunkhash', compiler_devtool : 'source-map', compiler_stats : { chunks : true, chunkModules : true, colors : true } }) }
Enable sourcemaps on production builds
Enable sourcemaps on production builds
JavaScript
mit
matthisk/es6console,matthisk/es6console
--- +++ @@ -19,7 +19,7 @@ compiler_public_path : '/', compiler_fail_on_warning : false, compiler_hash_type : 'chunkhash', - compiler_devtool : null, + compiler_devtool : 'source-map', compiler_stats : { chunks : true, chunkModules : true,
a095b3f6f17687fb769670f236f4224556254edd
js/game.js
js/game.js
// Game define([ 'stage', 'models/ui', 'utility' ], function(Stage, UI, Utility) { console.log("game.js loaded"); var Game = (function() { // Game canvas var stage; var gameUI; return { // Initialize the game init: function() { stage = new Stage('game-canvas'); gameUI = new UI(stage); gameUI.init(); stage.addChild(gameUI); } } })(); return Game; });
// Game define([ 'stage', 'models/ui', 'utility' ], function(Stage, UI, Utility) { console.log("game.js loaded"); var Game = (function() { // Game canvas var stage; var gameUI; return { // Initialize the game init: function() { try { stage = new Stage('game-canvas'); } catch(e) { alert('Cannot obtain the canvas context.'); return; } gameUI = new UI(stage); gameUI.init(); stage.addChild(gameUI); } } })(); return Game; });
Add try-catch block for obtaining canvas context
Add try-catch block for obtaining canvas context
JavaScript
mit
vicksonzero/TyphoonTycoon,vicksonzero/TyphoonTycoon,ericksli/TyphoonTycoon,jasonycw/TyphoonTycoon,ericksli/TyphoonTycoon,jasonycw/TyphoonTycoon
--- +++ @@ -16,7 +16,12 @@ return { // Initialize the game init: function() { - stage = new Stage('game-canvas'); + try { + stage = new Stage('game-canvas'); + } catch(e) { + alert('Cannot obtain the canvas context.'); + return; + } gameUI = new UI(stage); gameUI.init(); stage.addChild(gameUI);
1802e997a2d682ec3fc05d292e95fd64f3258b1b
src/components/fields/Text/index.js
src/components/fields/Text/index.js
import React from 'react' export default class Text extends React.Component { static propTypes = { onChange: React.PropTypes.func, value: React.PropTypes.string, fieldType: React.PropTypes.string, passProps: React.PropTypes.object, placeholder: React.PropTypes.node, errorMessage: React.PropTypes.node } static defaultProps = { fieldType: 'text', value: '' } render () { return ( <div> <div className='os-input-container'> <input ref='input' className='os-input-text' type={this.props.fieldType} value={this.props.value} placeholder={this.props.placeholder} onChange={event => this.props.onChange(event.target.value)} {...this.props.passProps} /> </div> <div className='os-input-error'>{this.props.errorMessage}</div> </div> ) } }
import React from 'react' export default class Text extends React.Component { static propTypes = { onChange: React.PropTypes.func, value: React.PropTypes.string, fieldType: React.PropTypes.string, passProps: React.PropTypes.object, placeholder: React.PropTypes.node, errorMessage: React.PropTypes.node, disabled: React.PropTypes.boolean } static defaultProps = { fieldType: 'text', value: '' } render () { return ( <div> <div className='os-input-container'> <input ref='input' className='os-input-text' type={this.props.fieldType} value={this.props.value} placeholder={this.props.placeholder} onChange={event => this.props.onChange(event.target.value)} disabled={this.props.disabled} {...this.props.passProps} /> </div> <div className='os-input-error'>{this.props.errorMessage}</div> </div> ) } }
Add disabled to text input
Add disabled to text input
JavaScript
mit
orionsoft/parts
--- +++ @@ -8,7 +8,8 @@ fieldType: React.PropTypes.string, passProps: React.PropTypes.object, placeholder: React.PropTypes.node, - errorMessage: React.PropTypes.node + errorMessage: React.PropTypes.node, + disabled: React.PropTypes.boolean } static defaultProps = { @@ -27,6 +28,7 @@ value={this.props.value} placeholder={this.props.placeholder} onChange={event => this.props.onChange(event.target.value)} + disabled={this.props.disabled} {...this.props.passProps} /> </div> <div className='os-input-error'>{this.props.errorMessage}</div>
82a4e6147a20b6583df43375e70b593a73cf0396
lib/transport/ssh.spec.js
lib/transport/ssh.spec.js
'use strict'; const { expect } = require('chai'); const SshTransport = require('./ssh'); describe('SshTransport', () => { it('should not use a private key if password is specified', () => { const options = getTransportOptions({ password: 'pass' }); expect(options.usePrivateKey).to.be.false; expect(options.privateKeyPath).to.be.undefined; }); it('should use a private key if password is not specified', () => { const options = getTransportOptions(); expect(options.usePrivateKey).to.be.true; expect(options.privateKeyPath).not.to.be.undefined; }); }); function getTransportOptions(config) { const options = Object.assign({ remoteUrl: '/', remotePath: '/' }, config); const ssh = new SshTransport({ transport: options }); return ssh.options; }
'use strict'; const { expect } = require('chai'); const SshTransport = require('./ssh'); class NoExceptionSshTransport extends SshTransport { normalizeOptions() { try { super.normalizeOptions(); } catch (e) { this.error = e; } } } describe('SshTransport', () => { it('should not use a private key if password is specified', () => { const options = getTransportOptions({ password: 'pass' }); expect(options.usePrivateKey).to.be.false; expect(options.privateKeyPath).to.be.undefined; }); it('should use a private key if password is not specified', () => { const options = getTransportOptions(); expect(options.usePrivateKey).to.be.true; expect(options.privateKeyPath).not.to.be.undefined; }); }); function getTransportOptions(config) { const options = Object.assign({ remoteUrl: '/', remotePath: '/' }, config); const ssh = new NoExceptionSshTransport({ transport: options }); return ssh.options; }
Fix a test on travis
Fix a test on travis
JavaScript
mit
megahertz/electron-simple-publisher
--- +++ @@ -3,6 +3,16 @@ const { expect } = require('chai'); const SshTransport = require('./ssh'); + +class NoExceptionSshTransport extends SshTransport { + normalizeOptions() { + try { + super.normalizeOptions(); + } catch (e) { + this.error = e; + } + } +} describe('SshTransport', () => { it('should not use a private key if password is specified', () => { @@ -26,7 +36,7 @@ remotePath: '/' }, config); - const ssh = new SshTransport({ transport: options }); + const ssh = new NoExceptionSshTransport({ transport: options }); return ssh.options; }
a08a2e797d2783defdd2551bf2ca203e54a3702b
js/main.js
js/main.js
// Github API call according to their json-p dox function callGHAPI(url, callback) { var apiRoot = "https://api.github.com/"; var script = document.createElement("script"); script.src = apiRoot + url + "?callback=" + callback; document.getElementsByTagName("head")[0].appendChild(script); } // validate the user input function validateInput() { if ($("#username").val().length > 0 && $("#repository").val().length > 0) { $("#get-stats-button").prop("disabled", false); } else { $("#get-stats-button").prop("disabled", true); } } // Callback function for getting user repositories function getUserReposCB(response) { var data = response.data; var repoNames = []; $.each(data, function(index, item) { repoNames.push(data[index].name); }); $("#repository").typeahead({source: repoNames}); } // The main function $(function() { validateInput(); $("#username, #repository").keyup(validateInput); $("#username").change(function() { var user = $("#username").val(); callGHAPI("users/" + user + "/repos", "getUserReposCB"); }); });
// Github API call according to their json-p dox function callGHAPI(url, callback) { var apiRoot = "https://api.github.com/"; var script = document.createElement("script"); script.src = apiRoot + url + "?callback=" + callback; document.getElementsByTagName("head")[0].appendChild(script); } // validate the user input function validateInput() { if ($("#username").val().length > 0 && $("#repository").val().length > 0) { $("#get-stats-button").prop("disabled", false); } else { $("#get-stats-button").prop("disabled", true); } } // Callback function for getting user repositories function getUserReposCB(response) { var data = response.data; var repoNames = []; $.each(data, function(index, item) { repoNames.push(data[index].name); }); var autoComplete = $('#repository').typeahead(); autoComplete.data('typeahead').source = repoNames; } // The main function $(function() { validateInput(); $("#username, #repository").keyup(validateInput); $("#username").change(function() { var user = $("#username").val(); callGHAPI("users/" + user + "/repos", "getUserReposCB"); }); });
Update typeahead source when different user entered
Update typeahead source when different user entered
JavaScript
mit
Somsubhra/github-release-stats,Somsubhra/github-release-stats
--- +++ @@ -23,7 +23,8 @@ $.each(data, function(index, item) { repoNames.push(data[index].name); }); - $("#repository").typeahead({source: repoNames}); + var autoComplete = $('#repository').typeahead(); + autoComplete.data('typeahead').source = repoNames; } // The main function
a1b98bb9dad8a3a82fe750dc09d470e14fe233ec
js/main.js
js/main.js
--- layout: null --- $(document).ready(function () { $('a.events-button').click(function (e) { if ($('.panel-cover').hasClass('panel-cover--collapsed')) return currentWidth = $('.panel-cover').width() if (currentWidth < 960) { $('.panel-cover').addClass('panel-cover--collapsed') $('.content-wrapper').addClass('animated slideInRight') } else { $('.panel-cover').css('max-width', currentWidth) $('.panel-cover').animate({'max-width': '530px', 'width': '40%'}, 400, swing = 'swing', function () {}) } }) if (window.location.hash && window.location.hash == '#events') { $('.panel-cover').addClass('panel-cover--collapsed') } if (window.location.pathname !== '{{ site.baseurl }}' && window.location.pathname !== '{{ site.baseurl }}index.html') { $('.panel-cover').addClass('panel-cover--collapsed') } $('.btn-mobile-menu').click(function () { $('.navigation-wrapper').toggleClass('visible animated bounceInDown') $('.btn-mobile-menu__icon').toggleClass('icon-list icon-x-circle animated fadeIn') }) $('.navigation-wrapper .events-button').click(function () { $('.navigation-wrapper').toggleClass('visible') $('.btn-mobile-menu__icon').toggleClass('icon-list icon-x-circle animated fadeIn') }) })
--- layout: null --- $(document).ready(function () { $('a.events-button').click(function (e) { if ($('.panel-cover').hasClass('panel-cover--collapsed')) return currentWidth = $('.panel-cover').width() if (currentWidth < 960) { $('.panel-cover').addClass('panel-cover--collapsed') $('.content-wrapper').addClass('animated slideInRight') } else { $('.panel-cover').css('max-width', currentWidth) $('.panel-cover').animate({'max-width': '530px', 'width': '40%'}, 400, swing = 'swing', function () {}) } }) if (window.location.hash && window.location.hash == '#events') { $('.panel-cover').addClass('panel-cover--collapsed') } if (window.location.pathname !== '{{ site.baseurl }}') { $('.panel-cover').addClass('panel-cover--collapsed') } $('.btn-mobile-menu').click(function () { $('.navigation-wrapper').toggleClass('visible animated bounceInDown') $('.btn-mobile-menu__icon').toggleClass('icon-list icon-x-circle animated fadeIn') }) $('.navigation-wrapper .events-button').click(function () { $('.navigation-wrapper').toggleClass('visible') $('.btn-mobile-menu__icon').toggleClass('icon-list icon-x-circle animated fadeIn') }) })
Fix defaulting to events page, maybe....
Fix defaulting to events page, maybe....
JavaScript
mit
GRPosh/GRPosh.github.io,GRPosh/GRPosh.github.io,GRPosh/GRPosh.github.io
--- +++ @@ -18,7 +18,7 @@ $('.panel-cover').addClass('panel-cover--collapsed') } - if (window.location.pathname !== '{{ site.baseurl }}' && window.location.pathname !== '{{ site.baseurl }}index.html') { + if (window.location.pathname !== '{{ site.baseurl }}') { $('.panel-cover').addClass('panel-cover--collapsed') }
86773197f53aeb163de92fbd9f339d53903dd4c3
lib/viewer/DataSetView.js
lib/viewer/DataSetView.js
import React from 'react'; export default React.createClass({ displayName: 'DataSetViewer', propTypes: { base: React.PropTypes.string, item: React.PropTypes.object, }, openDataSet() { ArcticViewer.load('http://' + location.host + this.props.base + this.props.item.path, document.querySelector('.react-content')); }, render() { return ( <div className='DataSetView'> <div className='DataSetView__thumbnail' onClick={ this.openDataSet } style={{ backgroundImage: 'url(' + this.props.base + this.props.item.thumbnail + ')' }}> <i className={this.props.item.thumbnail ? '' : 'fa fa-question' }></i> </div> <div className='DataSetView__titleBar'> <strong>{ this.props.item.name }</strong> <span className='DataSetView__size'>{ this.props.item.size }</span> </div> <div className='DataSetView__description'> { this.props.item.description } </div> </div> ); }, });
import React from 'react'; export default React.createClass({ displayName: 'DataSetViewer', propTypes: { base: React.PropTypes.string, item: React.PropTypes.object, }, openDataSet() { ArcticViewer.load('http://' + location.host + this.props.base + this.props.item.path, document.querySelector('.react-content')); // eslint-disable-line }, render() { return ( <div className='DataSetView'> <div className='DataSetView__thumbnail' onClick={ this.openDataSet } style={{ backgroundImage: 'url(' + this.props.base + this.props.item.thumbnail + ')' }}> <i className={this.props.item.thumbnail ? '' : 'fa fa-question' }></i> </div> <div className='DataSetView__titleBar'> <strong>{ this.props.item.name }</strong> <span className='DataSetView__size'>{ this.props.item.size }</span> </div> <div className='DataSetView__description'> { this.props.item.description } </div> </div> ); }, });
Update code formatting to comply with our ESLint specification
style(ESLint): Update code formatting to comply with our ESLint specification
JavaScript
bsd-3-clause
Kitware/arctic-viewer,Kitware/in-situ-data-viewer,Kitware/in-situ-data-viewer,Kitware/arctic-viewer,Kitware/arctic-viewer
--- +++ @@ -10,7 +10,7 @@ }, openDataSet() { - ArcticViewer.load('http://' + location.host + this.props.base + this.props.item.path, document.querySelector('.react-content')); + ArcticViewer.load('http://' + location.host + this.props.base + this.props.item.path, document.querySelector('.react-content')); // eslint-disable-line }, render() {
97889608f3e80095e139d3da69be2b24df6eacd7
components/guestbookCapture.js
components/guestbookCapture.js
/** @jsxImportSource theme-ui */ import { Box, Button } from 'theme-ui' import Link from 'next/link' import Sparkle from './sparkle' import Spicy from './spicy' // email export default function GuestbookCapture({ props }) { return ( <Box sx={{ position: 'relative', p: [3, 3, 4], bg: 'elevated', height: 'fit-content', borderRadius: '4px', maxWidth: ['100%', '50%'], }} > <h3> <Spicy>Sign the web3 guestbook!</Spicy> </h3> <p> Connect with your favorite wallet, and sign the Web3 Guestbook with a gasless meta-transaction. </p> <Link href="/guestbook"> <Button title="Discuss on Twitter"> <Sparkle>Guestbook</Sparkle> </Button> </Link> </Box> ) }
/** @jsxImportSource theme-ui */ import { Box, Button } from 'theme-ui' import Link from 'next/link' import Sparkle from './sparkle' import Spicy from './spicy' // email export default function GuestbookCapture({ props }) { return ( <Box sx={{ position: 'relative', p: [3, 3, 4], bg: 'elevated', height: 'fit-content', borderRadius: '4px', }} > <h3> <Spicy>Sign the web3 guestbook!</Spicy> </h3> <p> Connect with your favorite wallet, and sign the Web3 Guestbook with a gasless meta-transaction. </p> <Link href="/guestbook"> <Button title="Discuss on Twitter"> <Sparkle>Guestbook</Sparkle> </Button> </Link> </Box> ) }
Remove max-width from guestbook capture
Remove max-width from guestbook capture
JavaScript
mit
iammatthias/.com,iammatthias/.com,iammatthias/.com
--- +++ @@ -15,7 +15,6 @@ bg: 'elevated', height: 'fit-content', borderRadius: '4px', - maxWidth: ['100%', '50%'], }} > <h3>
783a18b1ed4e3053861315eccfee5bf55a467c02
services/frontend/src/components/elements/account/follow.js
services/frontend/src/components/elements/account/follow.js
import React from 'react'; import steem from 'steem' import { Button } from 'semantic-ui-react' export default class AccountFollow extends React.Component { constructor(props) { super(props) this.state = { processing: false, following: props.account.following || [] } } componentWillReceiveProps(nextProps) { if(this.state.processing && nextProps.length !== this.state.following.length) { this.setState({processing: false}) } } follow = (e) => { this.setState({processing: true}) this.props.actions.follow({ account: this.props.account, action: "follow", who: this.props.who }) } unfollow = (e) => { this.setState({processing: true}) this.props.actions.follow({ account: this.props.account, action: "unfollow", who: this.props.who }) } render() { const loading = (this.state.processing || !this.props.account || !this.props.account.following) const following = (this.props.account.following && this.props.account.following.indexOf(this.props.who) !== -1) return ( <Button color={(loading) ? 'grey' : (following) ? 'orange' : 'green' } content={(following) ? 'Unfollow' : 'Follow'} loading={loading} onClick={(loading) ? () => {} : (following) ? this.unfollow : this.follow} /> ) } }
import React from 'react'; import steem from 'steem' import { Button } from 'semantic-ui-react' export default class AccountFollow extends React.Component { constructor(props) { super(props) this.state = { processing: false, following: props.account.following || [] } } componentWillReceiveProps(nextProps) { if(this.state.processing && nextProps.length !== this.state.following.length) { this.setState({processing: false}) } } follow = (e) => { this.setState({processing: true}) this.props.actions.follow({ account: this.props.account, action: "follow", who: this.props.who }) } unfollow = (e) => { this.setState({processing: true}) this.props.actions.follow({ account: this.props.account, action: "unfollow", who: this.props.who }) } render() { if(this.props.account.name === this.props.who) return false const loading = (this.state.processing || !this.props.account || !this.props.account.following) const following = (this.props.account.following && this.props.account.following.indexOf(this.props.who) !== -1) return ( <Button color={(loading) ? 'grey' : (following) ? 'orange' : 'green' } content={(following) ? 'Unfollow' : 'Follow'} loading={loading} onClick={(loading) ? () => {} : (following) ? this.unfollow : this.follow} /> ) } }
Hide for your own account.
Hide for your own account.
JavaScript
mit
aaroncox/chainbb,aaroncox/chainbb
--- +++ @@ -33,6 +33,7 @@ }) } render() { + if(this.props.account.name === this.props.who) return false const loading = (this.state.processing || !this.props.account || !this.props.account.following) const following = (this.props.account.following && this.props.account.following.indexOf(this.props.who) !== -1) return (
6b00187f384c2078cb06c5d8dab4d5ef48ca8953
src/web_loaders/ember-app-loader/get-module-exports.js
src/web_loaders/ember-app-loader/get-module-exports.js
const HarmonyExportExpressionDependency = require( "webpack/lib/dependencies/HarmonyExportExpressionDependency" ); const HarmonyExportSpecifierDependency = require( "webpack/lib/dependencies/HarmonyExportSpecifierDependency" ); const HarmonyExportImportedSpecifierDependency = require( "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" ); module.exports = function getModuleExportsFactory( loaderContext ) { return path => new Promise( ( resolve, reject ) => { loaderContext.loadModule( path, ( error, source, sourceMap, { dependencies } ) => { if ( error || !dependencies ) { return reject( error ); } // does the module have a default export? const exports = dependencies.find( d => d instanceof HarmonyExportExpressionDependency ) // just resolve with the default export name ? [ "default" ] // get the list of all export names instead : dependencies .filter( d => d instanceof HarmonyExportSpecifierDependency || d instanceof HarmonyExportImportedSpecifierDependency ) .map( dependency => dependency.name ); resolve( exports ); }); }); };
const HarmonyExportExpressionDependency = require( "webpack/lib/dependencies/HarmonyExportExpressionDependency" ); const HarmonyExportSpecifierDependency = require( "webpack/lib/dependencies/HarmonyExportSpecifierDependency" ); const HarmonyExportImportedSpecifierDependency = require( "webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency" ); module.exports = function getModuleExportsFactory( loaderContext ) { return path => new Promise( ( resolve, reject ) => { loaderContext.loadModule( path, ( error, source, sourceMap, { dependencies } = {} ) => { if ( error || !dependencies ) { return reject( error ); } // does the module have a default export? const exports = dependencies.find( d => d instanceof HarmonyExportExpressionDependency ) // just resolve with the default export name ? [ "default" ] // get the list of all export names instead : dependencies .filter( d => d instanceof HarmonyExportSpecifierDependency || d instanceof HarmonyExportImportedSpecifierDependency ) .map( dependency => dependency.name ); resolve( exports ); }); }); };
Fix ember-app-loader error on invalid modules
Fix ember-app-loader error on invalid modules
JavaScript
mit
chhe/livestreamer-twitch-gui,streamlink/streamlink-twitch-gui,bastimeyer/livestreamer-twitch-gui,chhe/livestreamer-twitch-gui,bastimeyer/livestreamer-twitch-gui,streamlink/streamlink-twitch-gui,streamlink/streamlink-twitch-gui,chhe/livestreamer-twitch-gui,bastimeyer/livestreamer-twitch-gui
--- +++ @@ -8,7 +8,7 @@ module.exports = function getModuleExportsFactory( loaderContext ) { return path => new Promise( ( resolve, reject ) => { - loaderContext.loadModule( path, ( error, source, sourceMap, { dependencies } ) => { + loaderContext.loadModule( path, ( error, source, sourceMap, { dependencies } = {} ) => { if ( error || !dependencies ) { return reject( error ); }
cc63c5d48f48294163b1e9d01efa8b8fc00fce06
client/index.js
client/index.js
import 'babel-polyfill'; require('normalize.css'); require('reveal.js/css/reveal.css'); require('reveal.js/css/theme/black.css'); require('./index.css'); import reveal from 'reveal.js'; import setupMedimapWidgets from './medimap-widget.js'; reveal.initialize({ controls: false, progress: false, loop: true, shuffle: true, autoSlide: 20 * 1000, autoSlideStoppable: false, transition: 'slide', transitionSpeed: 'default', backgroundTransition: 'slide', }); // Setup all medimap widgets setupMedimapWidgets();
import 'babel-polyfill'; require('normalize.css'); require('reveal.js/css/reveal.css'); require('reveal.js/css/theme/black.css'); require('./index.css'); import reveal from 'reveal.js'; import setupMedimapWidgets from './medimap-widget.js'; reveal.initialize({ controls: false, progress: false, loop: true, shuffle: true, autoSlide: 20 * 1000, autoSlideStoppable: false, transition: 'fade', transitionSpeed: 'default', backgroundTransition: 'fade', }); // Setup all medimap widgets setupMedimapWidgets();
Switch to fade transition (performance issues)
Switch to fade transition (performance issues)
JavaScript
mit
jo12bar/medimap-viewer,jo12bar/medimap-viewer,jo12bar/medimap-viewer,jo12bar/medimap-viewer,jo12bar/medimap-viewer
--- +++ @@ -15,9 +15,9 @@ shuffle: true, autoSlide: 20 * 1000, autoSlideStoppable: false, - transition: 'slide', + transition: 'fade', transitionSpeed: 'default', - backgroundTransition: 'slide', + backgroundTransition: 'fade', }); // Setup all medimap widgets
908c305b901b73e92cd0e1ef4fd0f76d1aa2ea72
lib/config.js
lib/config.js
var fs = require('fs'); var mkdirp = require('mkdirp'); var existsSync = fs.existsSync || path.existsSync; // to support older nodes than 0.8 var CONFIG_FILE_NAME = 'config.json'; var Config = function(home) { this.home = home; this.load(); }; Config.prototype = { home: null, data: {}, configFilePath: function() { return this.home + '/' + CONFIG_FILE_NAME; }, load: function() { if (existsSync(this.configFilePath())) { this.data = JSON.parse(fs.readFileSync(this.configFilePath())); } }, save: function() { var json = JSON.stringify(this.data); mkdirp.sync(this.home); fs.writeFileSync(this.configFilePath(), json); } }; module.exports.Config = Config;
var fs = require('fs'); var mkdirp = require('mkdirp'); var existsSync = fs.existsSync || require('path').existsSync; // to support older nodes than 0.8 var CONFIG_FILE_NAME = 'config.json'; var Config = function(home) { this.home = home; this.load(); }; Config.prototype = { home: null, data: {}, configFilePath: function() { return this.home + '/' + CONFIG_FILE_NAME; }, load: function() { if (existsSync(this.configFilePath())) { this.data = JSON.parse(fs.readFileSync(this.configFilePath())); } }, save: function() { var json = JSON.stringify(this.data); mkdirp.sync(this.home); fs.writeFileSync(this.configFilePath(), json); } }; module.exports.Config = Config;
Add the missing require for path module
Add the missing require for path module
JavaScript
mit
groonga/gcs-console
--- +++ @@ -1,6 +1,6 @@ var fs = require('fs'); var mkdirp = require('mkdirp'); -var existsSync = fs.existsSync || path.existsSync; // to support older nodes than 0.8 +var existsSync = fs.existsSync || require('path').existsSync; // to support older nodes than 0.8 var CONFIG_FILE_NAME = 'config.json'; var Config = function(home) {
8262f90630783eb9329613aaf676b2b43c960dff
lib/CarbonClient.js
lib/CarbonClient.js
var RestClient = require('carbon-client') var util = require('util') var fibrous = require('fibrous'); /**************************************************************************************************** * monkey patch the endpoint class to support sync get/post/put/delete/head/patch */ var Endpoint = RestClient.super_ /**************************************************************************************************** * syncifyClassMethod * * @param clazz the class * @param methodName name of the method to syncify */ function syncifyClassMethod(clazz, methodName){ var asyncMethod = clazz.prototype[methodName] clazz.prototype[methodName] = function() { // if last argument is a callback then run async if(arguments && (typeof(arguments[arguments.length-1]) === 'function') ) { asyncMethod.apply(this, arguments); } else { // sync call! return asyncMethod.sync.apply(this, arguments); } } } // syncify all Endpoint methods Endpoint.ALL_METHODS.forEach(function(m) { syncifyClassMethod(Endpoint, m) }) // syncify Collection methods var Collection = Endpoint.collectionClass Collection.ALL_METHODS.forEach(function(m) { syncifyClassMethod(Collection, m) }) /**************************************************************************************************** * exports */ module.exports = RestClient
var RestClient = require('carbon-client') var util = require('util') var fibrous = require('fibrous'); /**************************************************************************************************** * monkey patch the endpoint class to support sync get/post/put/delete/head/patch */ var Endpoint = RestClient.super_ /**************************************************************************************************** * syncifyClassMethod * * @param clazz the class * @param methodName name of the method to syncify */ function syncifyClassMethod(clazz, methodName){ var asyncMethod = clazz.prototype[methodName] clazz.prototype[methodName] = function() { // if last argument is a callback then run async if(arguments && (typeof(arguments[arguments.length-1]) === 'function') ) { asyncMethod.apply(this, arguments); } else { // sync call! return asyncMethod.sync.apply(this, arguments); } } } // syncify all Endpoint methods var ENDPOINT_METHODS = [ "get", "post", "head", "put", "delete", "patch" ] ENDPOINT_METHODS.forEach(function(m) { syncifyClassMethod(Endpoint, m) }) // syncify Collection methods var COLLECTION_METHODS = [ "find", "insert", "update", "remove" ] var Collection = Endpoint.collectionClass COLLECTION_METHODS.forEach(function(m) { syncifyClassMethod(Collection, m) }) /**************************************************************************************************** * exports */ module.exports = RestClient
Move method list to node client
Move method list to node client
JavaScript
mit
carbon-io/carbon-client-node,carbon-io/carbon-client-node
--- +++ @@ -1,6 +1,7 @@ var RestClient = require('carbon-client') var util = require('util') var fibrous = require('fibrous'); + /**************************************************************************************************** * monkey patch the endpoint class to support sync get/post/put/delete/head/patch @@ -34,13 +35,26 @@ // syncify all Endpoint methods -Endpoint.ALL_METHODS.forEach(function(m) { syncifyClassMethod(Endpoint, m) }) +var ENDPOINT_METHODS = [ + "get", + "post", + "head", + "put", + "delete", + "patch" +] +ENDPOINT_METHODS.forEach(function(m) { syncifyClassMethod(Endpoint, m) }) // syncify Collection methods +var COLLECTION_METHODS = [ + "find", + "insert", + "update", + "remove" +] var Collection = Endpoint.collectionClass - -Collection.ALL_METHODS.forEach(function(m) { syncifyClassMethod(Collection, m) }) +COLLECTION_METHODS.forEach(function(m) { syncifyClassMethod(Collection, m) }) /**************************************************************************************************** * exports
4855e94ed7492a333597b4715a9d606cb74ab086
plugins/services/src/js/pages/task-details/ServiceTaskDetailPage.js
plugins/services/src/js/pages/task-details/ServiceTaskDetailPage.js
import React from 'react'; import TaskDetail from './TaskDetail'; import MesosStateStore from '../../../../../../src/js/stores/MesosStateStore'; import ServiceBreadcrumbs from '../../components/ServiceBreadcrumbs'; import Page from '../../../../../../src/js/components/Page'; class ServiceTaskDetailPage extends React.Component { render() { const {params, routes} = this.props; const {id, taskID} = params; let routePrefix = `/services/overview/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskID)}`; const tabs = [ {label: 'Details', routePath: routePrefix + '/details'}, {label: 'Files', routePath: routePrefix + '/files'}, {label: 'Logs', routePath: routePrefix + '/logs'} ]; let task = MesosStateStore.getTaskFromTaskID(taskID); if (task == null) { return this.getNotFound('task', taskID); } const breadcrumbs = ( <ServiceBreadcrumbs serviceID={id} taskID={task.getId()} taskName={task.getName()} /> ); return ( <Page> <Page.Header breadcrumbs={breadcrumbs} tabs={tabs} iconID="services" /> <TaskDetail params={params} routes={routes}> {this.props.children} </TaskDetail> </Page> ); } } TaskDetail.propTypes = { params: React.PropTypes.object, routes: React.PropTypes.array }; module.exports = ServiceTaskDetailPage;
import React from 'react'; import TaskDetail from './TaskDetail'; import MesosStateStore from '../../../../../../src/js/stores/MesosStateStore'; import ServiceBreadcrumbs from '../../components/ServiceBreadcrumbs'; import Page from '../../../../../../src/js/components/Page'; class ServiceTaskDetailPage extends React.Component { render() { const {params, routes} = this.props; const {id, taskID} = params; let routePrefix = `/services/overview/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskID)}`; const tabs = [ {label: 'Details', routePath: routePrefix + '/details'}, {label: 'Files', routePath: routePrefix + '/files'}, {label: 'Logs', routePath: routePrefix + '/view'} ]; let task = MesosStateStore.getTaskFromTaskID(taskID); if (task == null) { return this.getNotFound('task', taskID); } const breadcrumbs = ( <ServiceBreadcrumbs serviceID={id} taskID={task.getId()} taskName={task.getName()} /> ); return ( <Page> <Page.Header breadcrumbs={breadcrumbs} tabs={tabs} iconID="services" /> <TaskDetail params={params} routes={routes}> {this.props.children} </TaskDetail> </Page> ); } } TaskDetail.propTypes = { params: React.PropTypes.object, routes: React.PropTypes.array }; module.exports = ServiceTaskDetailPage;
Fix up route to logs tab
Fix up route to logs tab
JavaScript
apache-2.0
dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui,dcos/dcos-ui
--- +++ @@ -15,7 +15,7 @@ const tabs = [ {label: 'Details', routePath: routePrefix + '/details'}, {label: 'Files', routePath: routePrefix + '/files'}, - {label: 'Logs', routePath: routePrefix + '/logs'} + {label: 'Logs', routePath: routePrefix + '/view'} ]; let task = MesosStateStore.getTaskFromTaskID(taskID);
0f2fc159b5c0622b20f34d9eed915c7563237a7a
lib/cfn.js
lib/cfn.js
exports.init = function(genericAWSClient) { // Creates a CloudFormation API client var createCFNClient = function (accessKeyId, secretAccessKey, options) { options = options || {}; var client = cfnClient({ host: options.host || "cloudformation.us-east-1.amazonaws.com", path: options.path || "/", accessKeyId: accessKeyId, secretAccessKey: secretAccessKey, secure: options.secure, version: options.version }); return client; } // Amazon CloudFormation API handler which is wrapped around the genericAWSClient var cfnClient = function(obj) { var aws = genericAWSClient({ host: obj.host, path: obj.path, accessKeyId: obj.accessKeyId, secretAccessKey: obj.secretAccessKey, secure: obj.secure }); obj.call = function(action, query, callback) { query["Action"] = action query["Version"] = obj.version || '2010-08-01' query["SignatureMethod"] = "HmacSHA256" query["SignatureVersion"] = "2" return aws.call(action, query, callback); } return obj; } return createCFNClient; }
exports.init = function(genericAWSClient) { // Creates a CloudFormation API client var createCFNClient = function (accessKeyId, secretAccessKey, options) { options = options || {}; var client = cfnClient({ host: options.host || "cloudformation.us-east-1.amazonaws.com", path: options.path || "/", accessKeyId: accessKeyId, secretAccessKey: secretAccessKey, secure: options.secure, version: options.version }); return client; } // Amazon CloudFormation API handler which is wrapped around the genericAWSClient var cfnClient = function(obj) { var aws = genericAWSClient({ host: obj.host, path: obj.path, accessKeyId: obj.accessKeyId, secretAccessKey: obj.secretAccessKey, secure: obj.secure }); obj.call = function(action, query, callback) { query["Action"] = action query["Version"] = obj.version || '2010-05-15' query["SignatureMethod"] = "HmacSHA256" query["SignatureVersion"] = "2" return aws.call(action, query, callback); } return obj; } return createCFNClient; }
Use advertised API version for CFN.
Use advertised API version for CFN.
JavaScript
mit
mirkokiefer/aws-lib,livelycode/aws-lib,pnedunuri/aws-lib
--- +++ @@ -21,7 +21,7 @@ }); obj.call = function(action, query, callback) { query["Action"] = action - query["Version"] = obj.version || '2010-08-01' + query["Version"] = obj.version || '2010-05-15' query["SignatureMethod"] = "HmacSHA256" query["SignatureVersion"] = "2" return aws.call(action, query, callback);
370857a2c3d321b2fb1e7177de266b8422112425
app/assets/javascripts/alchemy/alchemy.jquery_loader.js
app/assets/javascripts/alchemy/alchemy.jquery_loader.js
if (typeof(Alchemy) === 'undefined') { var Alchemy = {}; } // Load jQuery on demand. Use this if jQuery is not present. // Found on http://css-tricks.com/snippets/jquery/load-jquery-only-if-not-present/ Alchemy.loadjQuery = function(callback) { var thisPageUsingOtherJSLibrary = false; if (typeof($) === 'function') { thisPageUsingOtherJSLibrary = true; } function getScript(url, success) { var script = document.createElement('script'); var head = document.getElementsByTagName('head')[0], done = false; script.src = url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function() { if (!done && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) { done = true; // callback function provided as param success(); script.onload = script.onreadystatechange = null; head.removeChild(script); }; }; head.appendChild(script); } getScript('/assets/jquery.min.js', function() { if (typeof(jQuery) !== 'undefined') { if (thisPageUsingOtherJSLibrary) { jQuery.noConflict(); } callback(jQuery); } }); }
if (typeof(Alchemy) === 'undefined') { var Alchemy = {}; } // Load jQuery on demand. Use this if jQuery is not present. // Found on http://css-tricks.com/snippets/jquery/load-jquery-only-if-not-present/ Alchemy.loadjQuery = function(callback) { var thisPageUsingOtherJSLibrary = false; if (typeof($) === 'function') { thisPageUsingOtherJSLibrary = true; } function getScript(url, success) { var script = document.createElement('script'); var head = document.getElementsByTagName('head')[0], done = false; script.src = url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function() { if (!done && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) { done = true; // callback function provided as param success(); script.onload = script.onreadystatechange = null; head.removeChild(script); }; }; head.appendChild(script); } getScript('//code.jquery.com/jquery.min.js', function() { if (typeof(jQuery) !== 'undefined') { if (thisPageUsingOtherJSLibrary) { jQuery.noConflict(); } callback(jQuery); } }); }
Load jquery from cdn instead of locally for menubar.
Load jquery from cdn instead of locally for menubar.
JavaScript
bsd-3-clause
clst/alchemy_cms,mtomov/alchemy_cms,nielspetersen/alchemy_cms,mamhoff/alchemy_cms,thomasjachmann/alchemy_cms,heisam/alchemy_cms,Domenoth/alchemy_cms,kinsomicrote/alchemy_cms,mamhoff/alchemy_cms,thomasjachmann/alchemy_cms,cygnus6/alchemy_cms,IngoAlbers/alchemy_cms,robinboening/alchemy_cms,AlchemyCMS/alchemy_cms,cygnus6/alchemy_cms,paperculture/alchemy_cms,Domenoth/alchemy_cms,akra/alchemy_cms,mtomov/alchemy_cms,thomasjachmann/alchemy_cms,heisam/alchemy_cms,getkiwicom/alchemy_cms,jsqu99/alchemy_cms,mamhoff/alchemy_cms,IngoAlbers/alchemy_cms,AlchemyCMS/alchemy_cms,phaedryx/alchemy_cms,heisam/alchemy_cms,watg/alchemy_cms,chalmagean/alchemy_cms,phaedryx/alchemy_cms,IngoAlbers/alchemy_cms,chalmagean/alchemy_cms,Domenoth/alchemy_cms,akra/alchemy_cms,akra/alchemy_cms,phaedryx/alchemy_cms,cygnus6/alchemy_cms,clst/alchemy_cms,mixandgo/alchemy_cms,mixandgo/alchemy_cms,mtomov/alchemy_cms,thomasjachmann/alchemy_cms,watg/alchemy_cms,getkiwicom/alchemy_cms,mixandgo/alchemy_cms,watg/alchemy_cms,paperculture/alchemy_cms,nielspetersen/alchemy_cms,cygnus6/alchemy_cms,akra/alchemy_cms,chalmagean/alchemy_cms,getkiwicom/alchemy_cms,IngoAlbers/alchemy_cms,heisam/alchemy_cms,phaedryx/alchemy_cms,chalmagean/alchemy_cms,getkiwicom/alchemy_cms,jsqu99/alchemy_cms,kinsomicrote/alchemy_cms,nielspetersen/alchemy_cms,watg/alchemy_cms,paperculture/alchemy_cms,AlchemyCMS/alchemy_cms,robinboening/alchemy_cms,clst/alchemy_cms,robinboening/alchemy_cms,jsqu99/alchemy_cms,paperculture/alchemy_cms,jsqu99/alchemy_cms,mtomov/alchemy_cms,kinsomicrote/alchemy_cms,nielspetersen/alchemy_cms,Domenoth/alchemy_cms,mixandgo/alchemy_cms,kinsomicrote/alchemy_cms,clst/alchemy_cms
--- +++ @@ -30,7 +30,7 @@ head.appendChild(script); } - getScript('/assets/jquery.min.js', function() { + getScript('//code.jquery.com/jquery.min.js', function() { if (typeof(jQuery) !== 'undefined') { if (thisPageUsingOtherJSLibrary) { jQuery.noConflict();
2d1dd9b1bbfd7b07bdcae40613899eab31c75f9a
lib/wee.js
lib/wee.js
#! /usr/bin/env node /* global require, process */ var program = require('commander'), fs = require('fs'), cwd = process.cwd(), cliPath = cwd + '/node_modules/wee-core/cli.js'; // Register version and init command program .version(require('../package').version) .usage('<command> [options]') .command('init [name]', 'create a new project'); fs.stat(cliPath, function(err) { if (err !== null) { fs.stat('./package.json', function(err) { if (err !== null) { console.log('Wee package.json not found in current directory'); return; } fs.readFile('./package.json', function(err, data) { if (err) { console.log(err); return; } // Check for valid Wee installation var config = JSON.parse(data); if (config.name == 'wee-framework' || config.name == 'wee') { console.log('Run "npm install" to install Wee core'); } else { console.log('The package.json is not compatible with Wee'); } }); }); return; } // Register all other commands from specific project require(cliPath)(cwd, program); // Process cli input and execute command program.parse(process.argv); });
#! /usr/bin/env node /* global require, process */ var program = require('commander'), fs = require('fs'), cwd = process.cwd(), cliPath = cwd + '/node_modules/wee-core/cli.js'; // Register version and init command program .version(require('../package').version) .usage('<command> [options]') .command('init [name]', 'create a new project'); // TODO: Finish init command // Set help as default command if nothing found program .on('*', () => { program.outputHelp(); }); fs.stat(cliPath, function(err) { if (err !== null) { fs.stat('./package.json', function(err) { if (err !== null) { console.log('Wee package.json not found in current directory'); return; } fs.readFile('./package.json', function(err, data) { if (err) { console.log(err); return; } // Check for valid Wee installation var config = JSON.parse(data); if (config.name == 'wee-framework' || config.name == 'wee') { console.log('Run "npm install" to install Wee core'); } else { console.log('The package.json is not compatible with Wee'); } }); }); return; } // Register all other commands from specific project require(cliPath)(cwd, program); // Process cli input and execute command program.parse(process.argv); });
Print out help menu when incorrect argument is given
Print out help menu when incorrect argument is given
JavaScript
apache-2.0
weepower/wee-cli
--- +++ @@ -12,6 +12,13 @@ .version(require('../package').version) .usage('<command> [options]') .command('init [name]', 'create a new project'); + // TODO: Finish init command + +// Set help as default command if nothing found +program + .on('*', () => { + program.outputHelp(); + }); fs.stat(cliPath, function(err) { if (err !== null) {
63284bdb3177e678208650e0b738dc9876afa643
app/components/Todo.js
app/components/Todo.js
import React, { PropTypes } from 'react' import ListItem from 'material-ui/lib/lists/list-item' import Checkbox from 'material-ui/lib/checkbox' import ActionDelete from 'material-ui/lib/svg-icons/action/delete' const Todo = ({ onClick, onDelete, completed, text }) => ( <ListItem onClick={onClick} primaryText={text} leftCheckbox={<Checkbox checked={completed} />} rightIcon={<ActionDelete onClick={onDelete} />} /> ) Todo.propTypes = { onClick: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired, completed: PropTypes.bool.isRequired, text: PropTypes.string.isRequired } export default Todo
import React, { PropTypes } from 'react' import ListItem from 'material-ui/lib/lists/list-item' import Checkbox from 'material-ui/lib/checkbox' import ActionDelete from 'material-ui/lib/svg-icons/action/delete' const Todo = ({ onClick, onDelete, completed, text }) => ( <ListItem onClick={onClick} primaryText={text} leftCheckbox={<Checkbox checked={completed} />} rightIcon={<ActionDelete onClick={onDelete} />} style={completed ? {textDecoration: 'line-through'} : {}} /> ) Todo.propTypes = { onClick: PropTypes.func.isRequired, onDelete: PropTypes.func.isRequired, completed: PropTypes.bool.isRequired, text: PropTypes.string.isRequired } export default Todo
Add strike-through for completed tasks
Add strike-through for completed tasks
JavaScript
mit
rxlabs/tasty-todos,rxlabs/tasty-todos,rxlabs/tasty-todos
--- +++ @@ -9,6 +9,7 @@ primaryText={text} leftCheckbox={<Checkbox checked={completed} />} rightIcon={<ActionDelete onClick={onDelete} />} + style={completed ? {textDecoration: 'line-through'} : {}} /> )
ad03ed2e56b56f22fc0f148dd6e6027eab718591
specs/server/ServerSpec.js
specs/server/ServerSpec.js
/* global require, describe, it */ 'use strict'; var expect = require('chai').expect; var request = require('request'); var url = function(path) { return 'http://localhost:8000' + path; }; describe('GET /', function() { it('responds', function(done){ request(url('/'), function(error, res) { expect(res.statusCode).to.equal(200); done(); }); }); }); describe('GET /index.html', function() { it('responds', function(done){ request(url('/indexs.html'), function(error, res) { expect(res.headers['content-type'].indexOf('html')).to.not.equal(-1); done(); }); }); }); describe('GET /no-such-file.html', function() { it('responds', function(done){ request(url('/no-such-file.html'), function(error, res) { expect(res.statusCode).to.equal(404); done(); }); }); });
/* global require, describe, it */ 'use strict'; var expect = require('chai').expect; var request = require('request'); var url = function(path) { return 'http://localhost:8000' + path; }; describe("MongoDB", function() { it("is there a server running", function(next) { var MongoClient = require('mongodb').MongoClient; MongoClient.connect('mongodb://127.0.0.1:27017/brainstormer', function(err, db) { expect(err).to.equal(null); next(); }); }); }); describe('GET /', function() { it('responds', function(done){ request(url('/'), function(error, res) { expect(res.statusCode).to.equal(200); done(); }); }); }); describe('GET /index.html', function() { it('responds', function(done){ request(url('/indexs.html'), function(error, res) { expect(res.headers['content-type'].indexOf('html')).to.not.equal(-1); done(); }); }); }); describe('GET /no-such-file.html', function() { it('responds', function(done){ request(url('/no-such-file.html'), function(error, res) { expect(res.statusCode).to.equal(404); done(); }); }); });
Add test to ensure mongodb is running.
Add test to ensure mongodb is running.
JavaScript
mit
JulieMarie/Brainstorm,HRR2-Brainstorm/Brainstorm,JulieMarie/Brainstorm,ekeric13/Brainstorm,EJJ-Brainstorm/Brainstorm,EJJ-Brainstorm/Brainstorm,ekeric13/Brainstorm,plauer/Brainstorm,drabinowitz/Brainstorm
--- +++ @@ -7,6 +7,16 @@ var url = function(path) { return 'http://localhost:8000' + path; }; + +describe("MongoDB", function() { + it("is there a server running", function(next) { + var MongoClient = require('mongodb').MongoClient; + MongoClient.connect('mongodb://127.0.0.1:27017/brainstormer', function(err, db) { + expect(err).to.equal(null); + next(); + }); + }); +}); describe('GET /', function() { it('responds', function(done){
7f08b0b8950ee9e4123b2d5332f2fcfe8616d771
lib/daemon-setup.js
lib/daemon-setup.js
(function() { 'use strict'; exports.init = function(params) { var fs = require('fs'); var path = require('path'); var service = params['service']; var shell = require('shelljs'); if (!service) { throw new Error('missing required parameter "service"'); } createUser(); enableLogging(); writeUpstart(); enableDaemon(); function createUser() { console.log('creating user ' + service); } function writeUpstart() { var srcFile = path.join(__dirname, 'template.upstart'); console.log('upstart contents:'); fs.readFile(srcFile, 'utf8', function(err, data) { if (err) { return console.log(err); } console.log(data); }); } function enableLogging() { var logPath = path.join(process.env.npm_config_quichean_logging_path, service); console.log('log path: ' + logPath); } function enableDaemon() { console.log('enabling daemon'); } }; })();
(function() { 'use strict'; exports.init = function(params) { var fs = require('fs'); var path = require('path'); var service = params['service']; var shell = require('shelljs'); if (!service) { throw new Error('missing required parameter "service"'); } createUser(); enableLogging(); writeUpstart(); enableDaemon(); function createUser() { console.log('creating user ' + service); } function writeUpstart() { //var srcFile = path.join(__dirname, 'template.upstart'); var srcFile = path.join(__dirname, 'foo.upstart'); console.log('upstart contents:'); fs.readFile(srcFile, 'utf8', function(err, data) { if (err) { throw new Error(err); } console.log(data); }); } function enableLogging() { var logPath = path.join(process.env.npm_config_quichean_logging_path, service); console.log('log path: ' + logPath); } function enableDaemon() { console.log('enabling daemon'); } }; })();
Verify that exception is raised if appropriate.
Verify that exception is raised if appropriate.
JavaScript
mit
optbot/daemon-setup,optbot/daemon-setup
--- +++ @@ -20,11 +20,13 @@ } function writeUpstart() { - var srcFile = path.join(__dirname, 'template.upstart'); + //var srcFile = path.join(__dirname, 'template.upstart'); + var srcFile = path.join(__dirname, 'foo.upstart'); + console.log('upstart contents:'); fs.readFile(srcFile, 'utf8', function(err, data) { if (err) { - return console.log(err); + throw new Error(err); } console.log(data); });
788c0adabe8a1501e8032e5b9d90afcc5c4927ab
lib/delve-client.js
lib/delve-client.js
/** DelveClient @description creates a singleton Delve client **/ 'use babel'; const DelveClient = require('delvejs'); var delveClient; const connManager = { connect: function connect(host, port) { delveClient = new DelveClient(host, port); return delveClient.establishSocketConn(); }, endConnection: function endConnection() { delveClient.endSession(); delveClient = null; } }; export { connManager as DelveConnMgr }; export default delveClient;
/** DelveClient @description creates a singleton Delve client **/ 'use babel'; const DelveClient = require('delvejs'); var delveClient; const connManager = { isConnected: false, connect: function connect(host, port) { delveClient = new DelveClient(host, port); return delveClient.establishSocketConn() .then(() => this.isConnected = true); }, endConnection: function endConnection() { if (this.isConnected) { delveClient.endSession(); delveClient = null; } } }; export { connManager as DelveConnMgr }; export default delveClient;
Check for is connected before ending
Check for is connected before ending
JavaScript
mit
tylerFowler/atom-delve
--- +++ @@ -9,14 +9,18 @@ var delveClient; const connManager = { + isConnected: false, connect: function connect(host, port) { delveClient = new DelveClient(host, port); - return delveClient.establishSocketConn(); + return delveClient.establishSocketConn() + .then(() => this.isConnected = true); }, endConnection: function endConnection() { - delveClient.endSession(); - delveClient = null; + if (this.isConnected) { + delveClient.endSession(); + delveClient = null; + } } };
31fde45536d569f6629b4896d61b4f6093059f2c
source/@lacqueristas/signals/refreshResources/index.js
source/@lacqueristas/signals/refreshResources/index.js
import {map} from "ramda" import mergeResource from "../mergeResource" export default function refreshResources (): Function { return function thunk (dispatch: ReduxDispatchType, getState: GetStateType, {client}: {client: HSDKClientType}): Promise<SignalType> { const state = getState() map((collection: Array<any>) => { map((member: any): any => { const {id} = member const {type} = member const {meta} = member const {version} = meta // TODO: Check for staleness instead of always refreshing if (id && type && version && client[type][version].show) { return client[type][version] .show({id}) .then(({data}: {data: any}): SignalType => dispatch(mergeResource(data))) } return member }, collection) }, state.resources) } }
import {ok} from "httpstatuses" import {forEach} from "ramda" import {omit} from "ramda" import * as resources from "@lacqueristas/resources" import mergeResource from "../mergeResource" const MAPPING = { accounts: "account", sessions: "session", projects: "project", } export default function refreshResources (): Function { return function thunk (dispatch: ReduxDispatchType, getState: GetStateType, {client}: {client: HSDKClientType}): Promise<SignalType> { const state = getState() forEach((collection: Array<Promise<ResourceType>>) => { forEach((member: ResourceType) => { const {id} = member const {type} = member const {meta} = member const {version} = meta // TODO: Check for staleness instead of always refreshing if (id && type && version && client[type][version].show) { client[type][version] .show({id}) .then(({data, status}: {data: JSONAPIResponse, status: number}): ResourceType => { const resource = resources[MAPPING[type]] switch (status) { case ok: { return omit(["__abstraction__"], resource(data.data)) } default: { return Promise.reject(new Error("We received an unexpected status code from the server")) } } }) .then((resource: ResourceType): SignalType => dispatch(mergeResource(resource))) .catch(console.error.bind(console)) } }, collection) }, state.resources) return dispatch({type: "refreshResources"}) } }
Refactor for abstractions and better control flow
Refactor for abstractions and better control flow
JavaScript
mit
lacqueristas/www,lacqueristas/www
--- +++ @@ -1,13 +1,22 @@ -import {map} from "ramda" +import {ok} from "httpstatuses" +import {forEach} from "ramda" +import {omit} from "ramda" +import * as resources from "@lacqueristas/resources" import mergeResource from "../mergeResource" + +const MAPPING = { + accounts: "account", + sessions: "session", + projects: "project", +} export default function refreshResources (): Function { return function thunk (dispatch: ReduxDispatchType, getState: GetStateType, {client}: {client: HSDKClientType}): Promise<SignalType> { const state = getState() - map((collection: Array<any>) => { - map((member: any): any => { + forEach((collection: Array<Promise<ResourceType>>) => { + forEach((member: ResourceType) => { const {id} = member const {type} = member const {meta} = member @@ -15,13 +24,26 @@ // TODO: Check for staleness instead of always refreshing if (id && type && version && client[type][version].show) { - return client[type][version] + client[type][version] .show({id}) - .then(({data}: {data: any}): SignalType => dispatch(mergeResource(data))) + .then(({data, status}: {data: JSONAPIResponse, status: number}): ResourceType => { + const resource = resources[MAPPING[type]] + + switch (status) { + case ok: { + return omit(["__abstraction__"], resource(data.data)) + } + default: { + return Promise.reject(new Error("We received an unexpected status code from the server")) + } + } + }) + .then((resource: ResourceType): SignalType => dispatch(mergeResource(resource))) + .catch(console.error.bind(console)) } - - return member }, collection) }, state.resources) + + return dispatch({type: "refreshResources"}) } }
4893fe0778f0e6a3876d0c634d5437c3f7e6911d
lib/controllers/api/v1/users.js
lib/controllers/api/v1/users.js
'use strict'; var mongoose = require('mongoose'), utils = require('../utils'), User = mongoose.model('User'), Application = mongoose.model('Application'), SimpleApiKey = mongoose.model('SimpleApiKey'), OauthConsumer = mongoose.model('OauthConsumer'), Event = mongoose.model('Event'), middleware = require('../../../middleware'), devsite = require('../../../clients/devsite'); module.exports = function(app, cacher) { }
'use strict'; var mongoose = require('mongoose'), utils = require('../utils'), User = mongoose.model('User'), Application = mongoose.model('Application'), SimpleApiKey = mongoose.model('SimpleApiKey'), OauthConsumer = mongoose.model('OauthConsumer'), Event = mongoose.model('Event'), User = mongoose.model('User'), Chapter = mongoose.model('Chapter'), middleware = require('../../../middleware'), devsite = require('../../../clients/devsite'); module.exports = function(app, cacher) { app.route("get", "/organizer/:gplusId", {}, cacher.cache('hours', 24), function(req, res) { Chapter.find({organizers: req.params.gplusId}, function(err, chapters) { if (err) { console.log(err); return res.send(500, "Internal Error"); } var response = { msg: "ok", user: req.params.gplusId, chapters: [] }; for(var i = 0; i < chapters.length; i++) { response.chapters.push({ id: chapters[i]._id, name: chapters[i].name }); } return res.send(200, response); } ); }); }
Add organizer Endpoint to API
Add organizer Endpoint to API
JavaScript
apache-2.0
Splaktar/hub,gdg-x/hub,gdg-x/hub,nassor/hub,fchuks/hub,nassor/hub,fchuks/hub,Splaktar/hub
--- +++ @@ -7,9 +7,27 @@ SimpleApiKey = mongoose.model('SimpleApiKey'), OauthConsumer = mongoose.model('OauthConsumer'), Event = mongoose.model('Event'), + User = mongoose.model('User'), + Chapter = mongoose.model('Chapter'), middleware = require('../../../middleware'), devsite = require('../../../clients/devsite'); module.exports = function(app, cacher) { + app.route("get", "/organizer/:gplusId", {}, cacher.cache('hours', 24), function(req, res) { + Chapter.find({organizers: req.params.gplusId}, function(err, chapters) { + if (err) { console.log(err); return res.send(500, "Internal Error"); } + var response = { + msg: "ok", + user: req.params.gplusId, + chapters: [] + }; + for(var i = 0; i < chapters.length; i++) { + response.chapters.push({ id: chapters[i]._id, name: chapters[i].name }); + } + + return res.send(200, response); + } + ); + }); }
a4187de0cd7c54363cc6225f72fe9093b8a8b4c8
src/javascripts/ng-admin/Main/component/directive/maDashboardPanel.js
src/javascripts/ng-admin/Main/component/directive/maDashboardPanel.js
function maDashboardPanel($state) { return { restrict: 'E', scope: { collection: '&', entries: '&' }, link: function(scope) { scope.gotoList = function () { $state.go($state.get('list'), { entity: scope.collection().entity.name() }); }; }, template: '<div class="panel-heading">' + '<a ng-click="gotoList()">{{ collection().title() || collection().entity().label() }}</a>' + '</div>' + '<ma-datagrid name="{{ collection().name() }}"' + ' entries="entries()"' + ' fields="::collection().fields()"' + ' entity="::collection().entity"' + ' list-actions="::collection().listActions()">' + '</ma-datagrid>' }; } maDashboardPanel.$inject = ['$state']; module.exports = maDashboardPanel;
function maDashboardPanel($state) { return { restrict: 'E', scope: { collection: '&', entries: '&' }, link: function(scope) { scope.gotoList = function () { $state.go($state.get('list'), { entity: scope.collection().entity.name() }); }; }, template: '<div class="panel-heading">' + '<a ng-click="gotoList()">{{ collection().title() || collection().entity.label() }}</a>' + '</div>' + '<ma-datagrid name="{{ collection().name() }}"' + ' entries="entries()"' + ' fields="::collection().fields()"' + ' entity="::collection().entity"' + ' list-actions="::collection().listActions()">' + '</ma-datagrid>' }; } maDashboardPanel.$inject = ['$state']; module.exports = maDashboardPanel;
Fix dashboard panel title when dashboard is undefined
Fix dashboard panel title when dashboard is undefined
JavaScript
mit
Benew/ng-admin,LuckeyHomes/ng-admin,ulrobix/ng-admin,maninga/ng-admin,manuelnaranjo/ng-admin,ronal2do/ng-admin,jainpiyush111/ng-admin,baytelman/ng-admin,manekinekko/ng-admin,eBoutik/ng-admin,marmelab/ng-admin,rifer/ng-admin,baytelman/ng-admin,rifer/ng-admin,bericonsulting/ng-admin,SebLours/ng-admin,SebLours/ng-admin,ahgittin/ng-admin,thachp/ng-admin,thachp/ng-admin,rao1219/ng-admin,jainpiyush111/ng-admin,jainpiyush111/ng-admin,LuckeyHomes/ng-admin,manekinekko/ng-admin,bericonsulting/ng-admin,ulrobix/ng-admin,eBoutik/ng-admin,janusnic/ng-admin,LuckeyHomes/ng-admin,zealot09/ng-admin,vasiakorobkin/ng-admin,vasiakorobkin/ng-admin,Benew/ng-admin,VincentBel/ng-admin,eBoutik/ng-admin,shekhardesigner/ng-admin,gxr1028/ng-admin,marmelab/ng-admin,janusnic/ng-admin,marmelab/ng-admin,manuelnaranjo/ng-admin,AgustinCroce/ng-admin,AgustinCroce/ng-admin,VincentBel/ng-admin,spfjr/ng-admin,ahgittin/ng-admin,jainpiyush111/ng-admin,rao1219/ng-admin,zealot09/ng-admin,shekhardesigner/ng-admin,ronal2do/ng-admin,heliodor/ng-admin,arturbrasil/ng-admin,spfjr/ng-admin,arturbrasil/ng-admin,gxr1028/ng-admin,heliodor/ng-admin,ulrobix/ng-admin,maninga/ng-admin
--- +++ @@ -12,7 +12,7 @@ }, template: '<div class="panel-heading">' + - '<a ng-click="gotoList()">{{ collection().title() || collection().entity().label() }}</a>' + + '<a ng-click="gotoList()">{{ collection().title() || collection().entity.label() }}</a>' + '</div>' + '<ma-datagrid name="{{ collection().name() }}"' + ' entries="entries()"' +
d4a57ac1e7516a75a3770e23a06241366a90dbcb
spec/lib/repository-mappers/figshare/parseL1ArticlePresenters-spec.js
spec/lib/repository-mappers/figshare/parseL1ArticlePresenters-spec.js
import parseL1ArticlePresenters from '../../../../lib/repository-mappers/figshare/parseL1ArticlePresenters'; const figshareL1Articles = require('./resources/figshareL1Articles.json'); const convertedArticles = parseL1ArticlePresenters(figshareL1Articles); it('parses all articles figshare returns', () => expect(convertedArticles.length).toBe(2) ); it('converts Figshare article DOIs to codemeta identifier', () => { expect(convertedArticles[0].identifier).toBe(figshareL1Articles[0].doi); expect(convertedArticles[1].identifier).toBe(figshareL1Articles[1].doi); }); it('converts Figshare article titles to codemeta titles', () => { expect(convertedArticles[0].title).toBe(convertedArticles[0].title); expect(convertedArticles[1].title).toBe(convertedArticles[1].title); }); it('converts Figshare article published date to codemeta date published', () => { expect(convertedArticles[0].datePublished).toBe(figshareL1Articles[0].published_date); expect(convertedArticles[1].datePublished).toBe(figshareL1Articles[1].published_date); });
import parseL1ArticlePresenters from '../../../../lib/repository-mappers/figshare/parseL1ArticlePresenters'; const figshareL1Articles = require('./resources/figshareL1Articles.json'); const convertedArticles = parseL1ArticlePresenters(figshareL1Articles); it('parses all articles figshare returns', () => expect(convertedArticles.length).toBe(2) ); it('parses Figshare article IDs', () => { expect(convertedArticles[0].id).toBe(figshareL1Articles[0].id); expect(convertedArticles[1].id).toBe(figshareL1Articles[1].id); }); it('converts Figshare article DOIs to codemeta identifier', () => { expect(convertedArticles[0].identifier).toBe(figshareL1Articles[0].doi); expect(convertedArticles[1].identifier).toBe(figshareL1Articles[1].doi); }); it('converts Figshare article titles to codemeta titles', () => { expect(convertedArticles[0].title).toBe(convertedArticles[0].title); expect(convertedArticles[1].title).toBe(convertedArticles[1].title); }); it('converts Figshare article published date to codemeta date published', () => { expect(convertedArticles[0].datePublished).toBe(figshareL1Articles[0].published_date); expect(convertedArticles[1].datePublished).toBe(figshareL1Articles[1].published_date); });
Add unit test for Figshare ID in L1 presenter
Add unit test for Figshare ID in L1 presenter
JavaScript
mit
mozillascience/software-discovery-dashboard,mozillascience/software-discovery-dashboard
--- +++ @@ -6,6 +6,11 @@ it('parses all articles figshare returns', () => expect(convertedArticles.length).toBe(2) ); + +it('parses Figshare article IDs', () => { + expect(convertedArticles[0].id).toBe(figshareL1Articles[0].id); + expect(convertedArticles[1].id).toBe(figshareL1Articles[1].id); +}); it('converts Figshare article DOIs to codemeta identifier', () => { expect(convertedArticles[0].identifier).toBe(figshareL1Articles[0].doi);
5df003b17e805ea3c649330bd72fe3d0d7ad085d
app/src/store/index.js
app/src/store/index.js
import Vue from "vue"; import Vuex, {Store} from "vuex"; import state from "./state"; import * as mutations from "./mutations"; import * as getters from "./getters"; import * as actions from "./actions"; import {persistencePlugin, i18nPlugin} from "./plugins"; Vue.use(Vuex); export default new Store({ strict: process.env.NODE_ENV !== "production", state, mutations, getters, actions, plugins: [ persistencePlugin({ prefix: "sulcalc", saveOn: { addCustomSets: "sets.custom", setSmogonSets: "enabledSets.smogon", setPokemonPerfectSets: "enabledSets.pokemonPerfect", setCustomSets: "enabledSets.custom", setLongRolls: "longRolls", setFractions: "fractions" } }), i18nPlugin() ] });
import Vue from "vue"; import Vuex, {Store} from "vuex"; import state from "./state"; import * as mutations from "./mutations"; import * as getters from "./getters"; import * as actions from "./actions"; import {persistencePlugin, i18nPlugin} from "./plugins"; Vue.use(Vuex); export default new Store({ strict: process.env.NODE_ENV !== "production", state, mutations, getters, actions, plugins: [ persistencePlugin({ prefix: "sulcalc", saveOn: { importPokemon: "sets.custom", toggleSmogonSets: "enabledSets.smogon", togglePokemonPerfectSets: "enabledSets.pokemonPerfect", toggleCustomSets: "enabledSets.custom", toggleLongRolls: "longRolls", toggleFractions: "fractions" } }), i18nPlugin() ] });
Fix persistence issues not tracking the correct mutations
Fix persistence issues not tracking the correct mutations
JavaScript
mit
sulcata/sulcalc,sulcata/sulcalc,sulcata/sulcalc
--- +++ @@ -18,12 +18,12 @@ persistencePlugin({ prefix: "sulcalc", saveOn: { - addCustomSets: "sets.custom", - setSmogonSets: "enabledSets.smogon", - setPokemonPerfectSets: "enabledSets.pokemonPerfect", - setCustomSets: "enabledSets.custom", - setLongRolls: "longRolls", - setFractions: "fractions" + importPokemon: "sets.custom", + toggleSmogonSets: "enabledSets.smogon", + togglePokemonPerfectSets: "enabledSets.pokemonPerfect", + toggleCustomSets: "enabledSets.custom", + toggleLongRolls: "longRolls", + toggleFractions: "fractions" } }), i18nPlugin()
1d894193ceebc30520ef2d18a6c15452f52a2e30
tests/dummy/app/controllers/collapsible.js
tests/dummy/app/controllers/collapsible.js
export default Ember.Controller.extend({ actions: { collapseLeft: function() { this.get('leftChild').collapse(); }, collapseRight: function() { this.get('rightChild').collapse(); } } });
import Ember from 'ember'; export default Ember.Controller.extend({ actions: { collapseLeft: function() { this.get('leftChild').collapse(); }, collapseRight: function() { this.get('rightChild').collapse(); } } });
Add missing import ember to dummy app
Add missing import ember to dummy app
JavaScript
mit
BryanCrotaz/ember-split-view,BryanHunt/ember-split-view,BryanCrotaz/ember-split-view,BryanHunt/ember-split-view
--- +++ @@ -1,3 +1,5 @@ +import Ember from 'ember'; + export default Ember.Controller.extend({ actions: { collapseLeft: function() {
d0f443c0b9c32a72faa67de95da03a01025c2ad0
config/nconf.js
config/nconf.js
var nconf = require('nconf'); nconf .env(); nconf.defaults({ 'RIPPLE_REST_API': 'http://localhost:5990', 'DATABASE_URL': 'postgres://postgres:password@localhost:5432/ripple_gateway', 'RIPPLE_DATAMODEL_ADAPTER': 'ripple-gateway-data-sequelize-adapter', 'RIPPLE_EXPRESS_GATEWAY': 'ripple-gateway-express', 'SSL': true, 'PORT': 5000 }); module.exports = nconf;
var nconf = require('nconf'); nconf .file({ file: './config/config.json' }) .env(); nconf.defaults({ 'RIPPLE_REST_API': 'http://localhost:5990', 'DATABASE_URL': 'postgres://postgres:password@localhost:5432/ripple_gateway', 'RIPPLE_DATAMODEL_ADAPTER': 'ripple-gateway-data-sequelize-adapter', 'RIPPLE_EXPRESS_GATEWAY': 'ripple-gateway-express', 'SSL': true, 'PORT': 5000 }); module.exports = nconf;
Load base config from file.
[FEATURE] Load base config from file.
JavaScript
isc
zealord/gatewayd,Parkjeahwan/awegeeks,xdv/gatewayd,Parkjeahwan/awegeeks,whotooktwarden/gatewayd,xdv/gatewayd,crazyquark/gatewayd,zealord/gatewayd,whotooktwarden/gatewayd,crazyquark/gatewayd
--- +++ @@ -1,6 +1,7 @@ var nconf = require('nconf'); nconf + .file({ file: './config/config.json' }) .env(); nconf.defaults({
e9d0001580fcd7178334071d6ea9040da9df49a9
jest.setup.js
jest.setup.js
/* eslint-disable import/no-unassigned-import */ import 'raf/polyfill' import 'mock-local-storage' import {configure} from 'enzyme' import Adapter from 'enzyme-adapter-react-16' configure({adapter: new Adapter()})
/* eslint-disable import/no-unassigned-import */ import 'raf/polyfill' import 'mock-local-storage' import {configure} from 'enzyme' import Adapter from 'enzyme-adapter-react-16' import {setConfig} from 'next/config' configure({adapter: new Adapter()}) // Initialize Next.js configuration with empty values. setConfig({ publicRuntimeConfig: {}, secretRuntimeConfig: {} })
Set default configuration for tests
Set default configuration for tests
JavaScript
mit
sgmap/inspire,sgmap/inspire
--- +++ @@ -5,5 +5,12 @@ import {configure} from 'enzyme' import Adapter from 'enzyme-adapter-react-16' +import {setConfig} from 'next/config' configure({adapter: new Adapter()}) + +// Initialize Next.js configuration with empty values. +setConfig({ + publicRuntimeConfig: {}, + secretRuntimeConfig: {} +})
e6bfa9f7036d4ad51af84a9205616b4782a5db91
geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundselector/BackgroundselectorDirective.js
geoportal/geoportailv3_geoportal/static-ngeo/js/backgroundselector/BackgroundselectorDirective.js
import appModule from '../module.js'; /** * @param {string} appBackgroundselectorTemplateUrl Url to backgroundselector template. * @return {angular.IDirective} * @ngInject */ const exports = function(appBackgroundselectorTemplateUrl) { return { restrict: 'E', scope: { 'map': '=appBackgroundselectorMap' }, controller: 'AppBackgroundselectorController', controllerAs: 'ctrl', bindToController: true, templateUrl: appBackgroundselectorTemplateUrl } } appModule.directive('appBackgroundselector', exports); export default exports;
import appModule from '../module.js'; /** * @param {string} appBackgroundselectorTemplateUrl Url to backgroundselector template. * @return {angular.IDirective} * @ngInject */ const exports = function(appBackgroundselectorTemplateUrl) { return { restrict: 'E', scope: { 'map': '=appBackgroundselectorMap' }, controller: 'AppBackgroundselectorController', controllerAs: 'ctrl', bindToController: true, templateUrl: appBackgroundselectorTemplateUrl } } // Custom directive for the "vector tiles style" upload button appModule.directive('customOnChange', function() { return { restrict: 'A', link: function (scope, element, attrs) { var onChangeHandler = scope.$eval(attrs.customOnChange); element.on('change', onChangeHandler); element.on('$destroy', function() { element.off(); }); } }; }); appModule.directive('appBackgroundselector', exports); export default exports;
Add missing customOnChange directive for the new background selector component
Add missing customOnChange directive for the new background selector component
JavaScript
mit
Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3
--- +++ @@ -18,6 +18,20 @@ } } + // Custom directive for the "vector tiles style" upload button + appModule.directive('customOnChange', function() { + return { + restrict: 'A', + link: function (scope, element, attrs) { + var onChangeHandler = scope.$eval(attrs.customOnChange); + element.on('change', onChangeHandler); + element.on('$destroy', function() { + element.off(); + }); + } + }; + }); + appModule.directive('appBackgroundselector', exports); export default exports;
067d0b0d647385559f5008aa62c89b18688431c0
karma.conf.js
karma.conf.js
// Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html const path = require('path'); process.env.CHROME_BIN = require('puppeteer').executablePath(); module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client:{ clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: path.join(__dirname, 'coverage/app'), reports: ['html'], fixWebpackSourcePaths: true }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['ChromeHeadless'], singleRun: false, restartOnFileChange: true }); };
// Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html const path = require('path'); process.env.CHROME_BIN = require('puppeteer').executablePath(); module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client:{ captureConsole: false, clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: path.join(__dirname, 'coverage/app'), reports: ['html'], fixWebpackSourcePaths: true }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['ChromeHeadless'], singleRun: false, restartOnFileChange: true }); };
Disable unit test console logging
Disable unit test console logging
JavaScript
mit
kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard
--- +++ @@ -17,6 +17,7 @@ require('@angular-devkit/build-angular/plugins/karma') ], client:{ + captureConsole: false, clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: {
6cbd9e5ade62b19781fce3263aa8890242aa2804
contentcuration/contentcuration/frontend/shared/vuex/snackbar/index.js
contentcuration/contentcuration/frontend/shared/vuex/snackbar/index.js
export default { state: { isVisible: false, options: { text: '', autoDismiss: true, }, }, getters: { snackbarIsVisible(state) { return state.isVisible; }, snackbarOptions(state) { return state.options; }, }, mutations: { CORE_CREATE_SNACKBAR(state, snackbarOptions = {}) { // reset state.isVisible = false; state.options = {}; // set new options state.isVisible = true; // options include text, autoDismiss, duration, actionText, actionCallback, // hideCallback, bottomPosition state.options = snackbarOptions; }, CORE_CLEAR_SNACKBAR(state) { state.isVisible = false; state.options = {}; }, CORE_SET_SNACKBAR_TEXT(state, text) { state.options.text = text; }, }, };
export default { state: { isVisible: false, options: { text: '', // duration in ms, 0 indicates it should not automatically dismiss duration: 6000, actionText: '', actionCallback: null, }, }, getters: { snackbarIsVisible(state) { return state.isVisible; }, snackbarOptions(state) { return state.options; }, }, actions: { showSnackbar({ commit }, { text, duration, actionText, actionCallback }) { commit('CORE_CREATE_SNACKBAR', { text, duration, actionText, actionCallback }); }, clearSnackbar({ commit }) { commit('CORE_CLEAR_SNACKBAR'); } }, mutations: { CORE_CREATE_SNACKBAR(state, snackbarOptions = {}) { // reset state.isVisible = false; state.options = {}; // set new options state.isVisible = true; // options include text, duration, actionText, actionCallback, // hideCallback, bottomPosition state.options = snackbarOptions; }, CORE_CLEAR_SNACKBAR(state) { state.isVisible = false; state.options = {}; }, CORE_SET_SNACKBAR_TEXT(state, text) { state.options.text = text; }, }, };
Remove `autoDismiss` and add actions
Remove `autoDismiss` and add actions - `autoDismiss: false` can be done by making duration `null` in this case the snackbar won't dismiss until the button is clicked on the snackbar item - Now we can dispatch actions rather than commit mutations directly. Per Vue 'best practices'
JavaScript
mit
DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation
--- +++ @@ -3,7 +3,10 @@ isVisible: false, options: { text: '', - autoDismiss: true, + // duration in ms, 0 indicates it should not automatically dismiss + duration: 6000, + actionText: '', + actionCallback: null, }, }, getters: { @@ -14,6 +17,14 @@ return state.options; }, }, + actions: { + showSnackbar({ commit }, { text, duration, actionText, actionCallback }) { + commit('CORE_CREATE_SNACKBAR', { text, duration, actionText, actionCallback }); + }, + clearSnackbar({ commit }) { + commit('CORE_CLEAR_SNACKBAR'); + } + }, mutations: { CORE_CREATE_SNACKBAR(state, snackbarOptions = {}) { // reset @@ -21,7 +32,7 @@ state.options = {}; // set new options state.isVisible = true; - // options include text, autoDismiss, duration, actionText, actionCallback, + // options include text, duration, actionText, actionCallback, // hideCallback, bottomPosition state.options = snackbarOptions; },
a003149c2d98a236c320bd84c0e484a6cf62f370
packages/rekit-studio/src/features/common/monaco/setupLinter.js
packages/rekit-studio/src/features/common/monaco/setupLinter.js
/* eslint no-use-before-define: 0 */ import _ from 'lodash'; import axios from 'axios'; let editor; let monaco; // Worker always run and will never terminate // There is only one global editor instance never disposed in Rekit Studio. function setupLintWorker(_editor, _monaco) { editor = _editor; monaco = _monaco; editor.onDidChangeModelContent(doLint); requestAnimationFrame(doLint); // For first time load } const doLint = _.debounce(() => { if (/javascript/i.test(editor.getModel().getModeId())) { const code = editor.getValue(); axios .post('/rekit/api/lint', { content: code, file: editor._editingFile // eslint-disable-line }) .then(res => { if (code === editor.getValue()) { updateLintWarnings(res.data); } }) .catch(() => {}); } }, 500); function updateLintWarnings(validations) { const markers = validations.map(error => ({ severity: Math.min(error.severity + 1, 3), startColumn: error.column, startLineNumber: error.line, endColumn: error.endColumn, endLineNumber: error.endLine, message: `${error.message} (${error.ruleId})`, source: 'eslint' })); monaco.editor.setModelMarkers(editor.getModel(), 'eslint', markers); } export default setupLintWorker;
/* eslint no-use-before-define: 0 */ import _ from 'lodash'; import axios from 'axios'; let editor; let monaco; // Worker always run and will never terminate // There is only one global editor instance never disposed in Rekit Studio. function setupLintWorker(_editor, _monaco) { editor = _editor; monaco = _monaco; editor.onDidChangeModelContent(doLint); requestAnimationFrame(doLint); // For first time load } const doLint = _.debounce(() => { if (/javascript/i.test(editor.getModel().getModeId())) { const code = editor.getValue(); axios .post('/rekit/api/lint', { content: code, file: editor._editingFile // eslint-disable-line }) .then(res => { if (code === editor.getValue()) { updateLintWarnings(res.data); } }) .catch(() => {}); } else { updateLintWarnings([]); } }, 500); function updateLintWarnings(validations) { const markers = validations.map(error => ({ severity: Math.min(error.severity + 1, 3), startColumn: error.column, startLineNumber: error.line, endColumn: error.endColumn, endLineNumber: error.endLine, message: `${error.message} (${error.ruleId})`, source: 'eslint' })); monaco.editor.setModelMarkers(editor.getModel(), 'eslint', markers); } export default setupLintWorker;
Clear eslint error for non-js files.
Clear eslint error for non-js files.
JavaScript
mit
supnate/rekit
--- +++ @@ -28,6 +28,8 @@ } }) .catch(() => {}); + } else { + updateLintWarnings([]); } }, 500);
5cf5083c97d2189a75c1124581c40c30cf3921dc
lib/global.js
lib/global.js
global.WRTC = require('wrtc') global.WEBTORRENT_ANNOUNCE = [ 'wss://tracker.webtorrent.io' ]
global.WRTC = require('wrtc') global.WEBTORRENT_ANNOUNCE = [ 'wss://tracker.webtorrent.io/' ]
Fix error "connection error to wss://tracker.webtorrent.io?1fe16837ed"
Fix error "connection error to wss://tracker.webtorrent.io?1fe16837ed"
JavaScript
mit
feross/webtorrent-hybrid,yciabaud/webtorrent-hybrid,feross/webtorrent-hybrid
--- +++ @@ -1,2 +1,2 @@ global.WRTC = require('wrtc') -global.WEBTORRENT_ANNOUNCE = [ 'wss://tracker.webtorrent.io' ] +global.WEBTORRENT_ANNOUNCE = [ 'wss://tracker.webtorrent.io/' ]
751c2642026e2e6aabd62e1661d7ee01dfb82b4c
app/assets/javascripts/app.js
app/assets/javascripts/app.js
angular .module('fitnessTracker', ['ui.router', 'templates', 'Devise']) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('signup', { url: '/signup', templateUrl: 'auth/_signup.html', controller: 'AuthenticationController as AuthCtrl' }) .state('signin', { url: '/signin', templateUrl: 'auth/_signin.html', controller: 'AuthenticationController as AuthCtrl' }) .state('profile', { url: '/user', template: 'user/_user.html', controller: 'UserController as UserCtrl' }); $urlRouterProvider.otherwise('/signin'); });
angular .module('fitnessTracker', ['ui.router', 'templates', 'Devise']) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('signup', { url: '/signup', templateUrl: 'auth/_signup.html', controller: 'AuthenticationController as AuthCtrl' }) .state('signin', { url: '/signin', templateUrl: 'auth/_signin.html', controller: 'AuthenticationController as AuthCtrl' }) .state('user', { url: '/user', template: 'user/_user.html', controller: 'UserController as UserCtrl' }); $urlRouterProvider.otherwise('/signin'); });
Change state name from 'profile' to 'user'
Change state name from 'profile' to 'user'
JavaScript
mit
viparthasarathy/fitness-tracker,viparthasarathy/fitness-tracker,viparthasarathy/fitness-tracker
--- +++ @@ -12,7 +12,7 @@ templateUrl: 'auth/_signin.html', controller: 'AuthenticationController as AuthCtrl' }) - .state('profile', { + .state('user', { url: '/user', template: 'user/_user.html', controller: 'UserController as UserCtrl'
06309a28546f22db3ada5c67a363e7062914c701
lib/loader.js
lib/loader.js
/*jshint node: true */ var Promise = require("bluebird"); var fs = require("fs"); /** * Maps file paths to their contents. Filled in by readTemplate() if the * disableCache argument is not set to true. */ var cache = {}; /** * Reads the template file at the given path and returns its contents as a * Promise. The second parameter is optional; if it is set to true, the string * that was read will not be cached for another access in the future. */ module.exports = function load(path, disableCache) { var prom; if (!disableCache && cache[path]) { // load from cache prom = Promise.resolve(cache[path]); } else { // read file prom = read(path); } if (!disableCache) { // store in cache prom = prom.then(function (template) { cache[path] = template; return template; }); } return prom; }; /** * Reads the file at the given path and returns its contents as a string. */ function read(path) { return new Promise(function (fulfill, reject) { fs.readFile(path, "utf8", function (err, template) { if (err) reject(err); else fulfill(template); }); }); }
/*jshint node: true */ var Promise = require("bluebird"); var fs = require("fs"); /** * Maps file paths to their contents */ var cache = {}; /** * Reads the template file at the given path and returns its contents as a * Promise. The second parameter is optional; if it is set to true, the string * that was read will not be cached for another access in the future. */ module.exports = function load(path, disableCache) { var prom; if (!disableCache && cache[path]) { // load from cache prom = Promise.resolve(cache[path]); } else { // read file prom = read(path); } if (!disableCache) { // store in cache prom = prom.then(function (template) { cache[path] = template; return template; }); } return prom; }; /** * Reads the file at the given path and returns its contents as a string. */ function read(path) { return new Promise(function (fulfill, reject) { fs.readFile(path, "utf8", function (err, template) { if (err) reject(err); else fulfill(template); }); }); }
Fix 'cache' variable doc comment
Fix 'cache' variable doc comment The comment referenced a non-existing function from during the development; the affected sentence is removed.
JavaScript
mit
JangoBrick/teval,JangoBrick/teval
--- +++ @@ -8,8 +8,7 @@ /** - * Maps file paths to their contents. Filled in by readTemplate() if the - * disableCache argument is not set to true. + * Maps file paths to their contents */ var cache = {};
672d4b454e02fe0cb894fdca00f6a151f7e522e4
src/data/ui/breakpoints/reducers.js
src/data/ui/breakpoints/reducers.js
//@flow import { updateObject } from "../../reducers/utils"; export default ( state: { breakpoints: { main: string } }, action: { type: string, newLayout: string, component: string } ) => updateObject(state, { breakpoints: updateObject(state.breakpoints, { [action.component]: action.newLayout }) });
//@flow import { updateObject } from "../../reducers/utils"; export default ( state: { breakpoints: { main: string } }, action: { type: string, component: string, query: { [string]: string } } ) => updateObject(state, { breakpoints: updateObject(state.breakpoints, { [action.component]: updateObject( state.breakpoints[action.component], action.query ) }) });
Update breakpoint reducer to assign deeper queries object
Update breakpoint reducer to assign deeper queries object
JavaScript
mit
slightly-askew/portfolio-2017,slightly-askew/portfolio-2017
--- +++ @@ -4,10 +4,17 @@ export default ( state: { breakpoints: { main: string } }, - action: { type: string, newLayout: string, component: string } + action: { + type: string, + component: string, + query: { [string]: string } + } ) => updateObject(state, { breakpoints: updateObject(state.breakpoints, { - [action.component]: action.newLayout + [action.component]: updateObject( + state.breakpoints[action.component], + action.query + ) }) });
b90abb59cc56d6ec0f0adf381e73f4901d5cfbee
lib/assert.js
lib/assert.js
'use strict'; var Assert = require('test/assert').Assert , bindMethods = require('es5-ext/lib/Object/bind-methods').call , merge = require('es5-ext/lib/Object/plain/merge').call , never, neverBind; never = function (message) { this.fail({ message: message, operator: "never" }); }; neverBind = function (message) { return never.bind(this, message); }; module.exports = function (logger) { var assert = new Assert({ pass: logger.pass.bind(logger), fail: logger.fail.bind(logger), error: logger.error.bind(logger) }); assert = bindMethods(assert.strictEqual.bind(assert), assert, Assert.prototype); assert.not = assert.notStrictEqual; assert.deep = assert.deepEqual; assert.notDeep = assert.notDeepEqual; assert.never = never.bind(assert); assert.never.bind = neverBind.bind(assert); return assert; };
'use strict'; var Assert = require('test/assert').Assert , bindMethods = require('es5-ext/lib/Object/plain/bind-methods').call , merge = require('es5-ext/lib/Object/plain/merge').call , never, neverBind; never = function (message) { this.fail({ message: message, operator: "never" }); }; neverBind = function (message) { return never.bind(this, message); }; module.exports = function (logger) { var assert = new Assert({ pass: logger.pass.bind(logger), fail: logger.fail.bind(logger), error: logger.error.bind(logger) }); assert = bindMethods(assert.strictEqual.bind(assert), assert, Assert.prototype); assert.not = assert.notStrictEqual; assert.deep = assert.deepEqual; assert.notDeep = assert.notDeepEqual; assert.never = never.bind(assert); assert.never.bind = neverBind.bind(assert); return assert; };
Update up to changes in es5-ext
Update up to changes in es5-ext
JavaScript
isc
medikoo/tad
--- +++ @@ -1,7 +1,7 @@ 'use strict'; var Assert = require('test/assert').Assert - , bindMethods = require('es5-ext/lib/Object/bind-methods').call + , bindMethods = require('es5-ext/lib/Object/plain/bind-methods').call , merge = require('es5-ext/lib/Object/plain/merge').call , never, neverBind;
96e722264b46887d4127cf23d3e472783fba777e
js/main.js
js/main.js
var updatePreviewTarget = function(data, status) { $('.spinner').hide(); $('#preview-target').html(data); renderLatexExpressions(); } var renderLatexExpressions = function() { $('.latex-container').each( function(index) { katex.render( this.innerText, this, { displayMode: $(this).data('displaymode') == 'block' } ); } ); } var main = function() { $('div code').each(function(i, block) { hljs.highlightBlock(block); }); $('button#preview').click( function() { $('#preview-target').html(''); $('.spinner').show(); $('h1.preview').text($('input[name=title]').val()) $.post('/note_preview', {text: $('#note-txt').val()}, updatePreviewTarget); } ); renderLatexExpressions(); }; function searchRedirect(searchpage) { event.preventDefault(); var term = (arguments.length == 1) ? document.getElementById('mainsearch').value : document.getElementById('searchbox').value; window.location = '/search/' + term + '/'; } $(main);
var updatePreviewTarget = function(data, status) { $('.spinner').hide(); $('#preview-target').html(data); renderLatexExpressions(); } var renderLatexExpressions = function() { $('.latex-container').each( function(index) { katex.render( this.textContent, this, { displayMode: $(this).data('displaymode') == 'block' } ); } ); } var main = function() { $('div code').each(function(i, block) { hljs.highlightBlock(block); }); $('button#preview').click( function() { $('#preview-target').html(''); $('.spinner').show(); $('h1.preview').text($('input[name=title]').val()) $.post('/note_preview', {text: $('#note-txt').val()}, updatePreviewTarget); } ); renderLatexExpressions(); }; function searchRedirect(searchpage) { event.preventDefault(); var term = (arguments.length == 1) ? document.getElementById('mainsearch').value : document.getElementById('searchbox').value; window.location = '/search/' + term + '/'; } $(main);
Fix katex rendering on firefox
Fix katex rendering on firefox
JavaScript
mit
erettsegik/erettsegik.hu,erettsegik/erettsegik.hu,erettsegik/erettsegik.hu
--- +++ @@ -8,7 +8,7 @@ $('.latex-container').each( function(index) { katex.render( - this.innerText, + this.textContent, this, { displayMode: $(this).data('displaymode') == 'block' } );
f070ba58f9d8fe367284a9c82fd9e8ec75829584
src/components/Projects.js
src/components/Projects.js
import React from 'react' import { Project } from './Project' const Projects = ({ projects = [], feature }) => { if (!projects.length) return null const featuredProjects = projects.filter((project) => project.feature) const nonFeaturedProjects = projects.filter((project) => !project.feature) return ( <> {feature ? ( <ul className="divide-y divide-gray-200"> {featuredProjects.map((project) => ( <li key={project.id} className="flex py-12 space-x-6"> <Project project={project} /> </li> ))} </ul> ) : ( <ul className="grid grid-cols-1 sm:grid-cols-2 gap-4 mt-12"> {nonFeaturedProjects.map((project) => ( <li key={project.id} className="p-4 border rounded-sm"> <Project project={{ ...project, image: undefined }} /> </li> ))} </ul> )} </> ) } export { Projects }
import React from 'react' import { Project } from './Project' const Projects = ({ projects = [], feature }) => { if (!projects.length) return null const featuredProjects = projects.filter((project) => project.feature) const nonFeaturedProjects = projects.filter((project) => !project.feature) return ( <> {feature ? ( <ul className="divide-y divide-gray-200"> {featuredProjects.map((project) => ( <li key={project.id} className="flex py-12 space-x-6"> <Project project={project} /> </li> ))} </ul> ) : ( <ul className="grid grid-cols-1 sm:grid-cols-2 gap-4 mt-12"> {nonFeaturedProjects.map((project) => ( <li key={project.id} className="p-4 border rounded-lg shadow-md"> <Project project={{ ...project, image: undefined }} /> </li> ))} </ul> )} </> ) } export { Projects }
Add shadow to non-feature project container
Add shadow to non-feature project container
JavaScript
mit
dtjv/dtjv.github.io
--- +++ @@ -21,7 +21,7 @@ ) : ( <ul className="grid grid-cols-1 sm:grid-cols-2 gap-4 mt-12"> {nonFeaturedProjects.map((project) => ( - <li key={project.id} className="p-4 border rounded-sm"> + <li key={project.id} className="p-4 border rounded-lg shadow-md"> <Project project={{ ...project, image: undefined }} /> </li> ))}
0f874d8c12778c07c93526a84a8e0a43d4d27e3b
js/main.js
js/main.js
$(function() { yourCollection = new Models.ItemListings(); friendCollection = new Models.ItemListings(); featuredCollection = new Models.ItemListings(); publicCollection = new Models.ItemListings(); yourView = new Views.ListingView({ collection: yourCollection, el: $('#you-listing')[0] }); friendView = new Views.ListingView({ collection: friendCollection, el: $('#friend-listing')[0] }); featuredView = new Views.ListingView({ collection: featuredCollection, el: $('#featured-listing')[0] }); publicView = new Views.ListingView({ collection: publicCollection, el: $('#public-listing')[0] }) yourCollection.add({ id: 0, name: "Test Item", price: "(USD) $5", location: "Singapore", buyers: [0], owner: 0, imageUrl: 'http://placehold.it/96x96' }); friendCollection.add({ id: 1, name: "Another Item", price: "(USD) $25", location: "Singapore", buyers: [0, 1, 2], owner: 1, imageUrl: 'http://placehold.it/96x96' }); });
$(function() { yourCollection = new Models.ItemListings(); friendCollection = new Models.ItemListings(); featuredCollection = new Models.ItemListings(); publicCollection = new Models.ItemListings(); yourView = new Views.ListingView({ collection: yourCollection, el: $('#you-listing')[0] }); friendView = new Views.ListingView({ collection: friendCollection, el: $('#friend-listing')[0] }); featuredView = new Views.ListingView({ collection: featuredCollection, el: $('#featured-listing')[0] }); publicView = new Views.ListingView({ collection: publicCollection, el: $('#public-listing')[0] }); yourCollection.add({ id: 0, name: "Test Item", price: "(USD) $5", location: "Singapore", buyers: [0], owner: 0, imageUrl: 'http://placehold.it/96x96' }); friendCollection.add({ id: 1, name: "Another Item", price: "(USD) $25", location: "Singapore", buyers: [0, 1, 2], owner: 1, imageUrl: 'http://placehold.it/96x96' }); });
Add missing semicolon, remove trailing whitespace.
Add missing semicolon, remove trailing whitespace.
JavaScript
mit
burnflare/CrowdBuy,burnflare/CrowdBuy
--- +++ @@ -22,7 +22,7 @@ publicView = new Views.ListingView({ collection: publicCollection, el: $('#public-listing')[0] - }) + }); yourCollection.add({ id: 0, @@ -34,12 +34,12 @@ imageUrl: 'http://placehold.it/96x96' }); friendCollection.add({ - id: 1, - name: "Another Item", - price: "(USD) $25", - location: "Singapore", - buyers: [0, 1, 2], - owner: 1, + id: 1, + name: "Another Item", + price: "(USD) $25", + location: "Singapore", + buyers: [0, 1, 2], + owner: 1, imageUrl: 'http://placehold.it/96x96' }); });
db55033e85b3c87ba45b1d5fdb28120cbc526208
src/manager/components/CommentList/index.js
src/manager/components/CommentList/index.js
import React, { Component } from 'react'; import style from './style'; import CommentItem from '../CommentItem'; export default class CommentList extends Component { componentDidMount() { this.wrapper.scrollTop = this.wrapper.scrollHeight; } componentDidUpdate(prev) { if (this.props.comments.length !== prev.comments.length) { this.wrapper.scrollTop = this.wrapper.scrollHeight; } } render() { const { comments } = this.props; if (comments.length === 0) { return ( <div ref={(el) => { this.wrapper = el; }} style={style.wrapper}> <div style={style.noComments}>No Comments Yet!</div> </div> ); } return ( <div ref={(el) => { this.wrapper = el; }} style={style.wrapper}> {comments.map((comment, idx) => ( <CommentItem key={`comment_${idx}`} comment={comment} ownComment={comment.userId === this.props.user && this.props.user.id} deleteComment={() => this.props.deleteComment(comment.id)} /> ))} </div> ); } } CommentList.propTypes = { comments: React.PropTypes.array, user: React.PropTypes.object, deleteComment: React.PropTypes.func, };
import React, { Component } from 'react'; import style from './style'; import CommentItem from '../CommentItem'; export default class CommentList extends Component { componentDidMount() { this.wrapper.scrollTop = this.wrapper.scrollHeight; } componentDidUpdate(prev) { if (this.props.comments.length !== prev.comments.length) { this.wrapper.scrollTop = this.wrapper.scrollHeight; } } render() { const { comments } = this.props; if (comments.length === 0) { return ( <div ref={(el) => { this.wrapper = el; }} style={style.wrapper}> <div style={style.noComments}>No Comments Yet!</div> </div> ); } return ( <div ref={(el) => { this.wrapper = el; }} style={style.wrapper}> {comments.map((comment, idx) => ( <CommentItem key={`comment_${idx}`} comment={comment} ownComment={comment.userId === (this.props.user && this.props.user.id)} deleteComment={() => this.props.deleteComment(comment.id)} /> ))} </div> ); } } CommentList.propTypes = { comments: React.PropTypes.array, user: React.PropTypes.object, deleteComment: React.PropTypes.func, };
Fix boolean logic related to showing delete button
Fix boolean logic related to showing delete button
JavaScript
mit
kadirahq/react-storybook,nfl/react-storybook,shilman/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,jribeiro/storybook,enjoylife/storybook,storybooks/storybook,rhalff/storybook,rhalff/storybook,rhalff/storybook,bigassdragon/storybook,jribeiro/storybook,storybooks/storybook,storybooks/react-storybook,enjoylife/storybook,nfl/react-storybook,rhalff/storybook,jribeiro/storybook,jribeiro/storybook,bigassdragon/storybook,storybooks/storybook,storybooks/react-storybook,shilman/storybook,shilman/storybook,enjoylife/storybook,kadirahq/react-storybook,storybooks/storybook,nfl/react-storybook,rhalff/storybook,storybooks/react-storybook,rhalff/storybook,enjoylife/storybook,shilman/storybook,bigassdragon/storybook,bigassdragon/storybook,nfl/react-storybook
--- +++ @@ -30,7 +30,7 @@ <CommentItem key={`comment_${idx}`} comment={comment} - ownComment={comment.userId === this.props.user && this.props.user.id} + ownComment={comment.userId === (this.props.user && this.props.user.id)} deleteComment={() => this.props.deleteComment(comment.id)} /> ))}
42af1e835e8ffd80e6772a8dc7694ad81b425dc5
test/test-api-ping-plugins-route.js
test/test-api-ping-plugins-route.js
var request = require('supertest'); var assert = require('assert'); var storageFactory = require('../lib/storage/storage-factory'); var storage = storageFactory.getStorageInstance('test'); var app = require('../webserver/app')(storage); describe('ping plugins route', function () { var server; var PORT = 3355; var API_ROOT = '/api/plugins'; var agent = request.agent(app); before(function (done) { server = app.listen(PORT, function () { if (server.address()) { console.log('starting server in port ' + PORT); done(); } else { console.log('something went wrong... couldn\'t listen to that port.'); process.exit(1); } }); }); after(function () { server.close(); }); describe('plugin list', function () { describe('with an anonymous user ', function () { it('should return list of plugins', function (done) { agent .get(API_ROOT + '/') .set('Accept', 'application/json') .expect('Content-Type', /json/) .expect(200) .send() .end(function (err, res) { assert.equal(res.body.length, 2); assert.equal(res.body[0].name, 'http-head'); done(err); }); }); }); }); });
var request = require('supertest'); var assert = require('assert'); var storageFactory = require('../lib/storage/storage-factory'); var storage = storageFactory.getStorageInstance('test'); var app = require('../webserver/app')(storage); describe('ping plugins route', function () { var server; var PORT = 3355; var API_ROOT = '/api/plugins'; var agent = request.agent(app); before(function (done) { server = app.listen(PORT, function () { if (server.address()) { console.log('starting server in port ' + PORT); done(); } else { console.log('something went wrong... couldn\'t listen to that port.'); process.exit(1); } }); }); after(function () { server.close(); }); describe('plugin list', function () { describe('with an anonymous user ', function () { it('should return list of plugins', function (done) { agent .get(API_ROOT + '/') .set('Accept', 'application/json') .expect('Content-Type', /json/) .expect(200) .send() .end(function (err, res) { assert.equal(res.body.length, 2); var plugins = res.body.sort(function(a, b){ return a.name > b.name; }); assert.equal(plugins[0].name, 'http-contains'); assert.equal(plugins[1].name, 'http-head'); done(err); }); }); }); }); });
Sort to get determinist ordering
Sort to get determinist ordering
JavaScript
mit
corinis/watchmen,corinis/watchmen,ravi/watchmen,iloire/WatchMen,Cellington1/Status,iloire/WatchMen,Cellington1/Status,iloire/WatchMen,Cellington1/Status,NotyIm/WatchMen,ravi/watchmen,corinis/watchmen,NotyIm/WatchMen,NotyIm/WatchMen,plyo/watchmen,plyo/watchmen,labianchin/WatchMen,labianchin/WatchMen,ravi/watchmen,labianchin/WatchMen,plyo/watchmen
--- +++ @@ -44,7 +44,9 @@ .send() .end(function (err, res) { assert.equal(res.body.length, 2); - assert.equal(res.body[0].name, 'http-head'); + var plugins = res.body.sort(function(a, b){ return a.name > b.name; }); + assert.equal(plugins[0].name, 'http-contains'); + assert.equal(plugins[1].name, 'http-head'); done(err); }); });
81a144daaf912e9e9692f558b1ce0fb521575db1
package.js
package.js
Package.describe({ name: "practicalmeteor:loglevel", summary: "Simple logger with app and per-package log levels and line number preserving output.", version: "1.2.0_2", git: "https://github.com/practicalmeteor/meteor-loglevel.git" }); Package.onUse(function (api) { api.versionsFrom('0.9.3'); api.use(['meteor', 'coffeescript']); api.use(['practicalmeteor:chai@2.1.0_1']); api.addFiles('loglevel-1.2.0.js'); api.addFiles('LoggerFactory.coffee'); api.addFiles('ObjectLogger.coffee'); api.export(['loglevel', 'ObjectLogger']); }); Package.onTest(function(api) { api.use(['coffeescript', 'practicalmeteor:loglevel@1.2.0_2', 'practicalmeteor:munit@2.1.2']); api.addFiles('tests/LoggerFactoryTest.coffee'); api.addFiles('tests/ObjectLoggerTest.coffee'); });
Package.describe({ name: "practicalmeteor:loglevel", summary: "Simple logger with app and per-package log levels and line number preserving output.", version: "1.2.0_2", git: "https://github.com/practicalmeteor/meteor-loglevel.git" }); Package.onUse(function (api) { api.versionsFrom('0.9.3'); api.use(['meteor', 'coffeescript']); api.use(['practicalmeteor:chai@2.1.0_1']); api.addFiles('loglevel-1.2.0.js'); api.addFiles('LoggerFactory.coffee'); api.addFiles('ObjectLogger.coffee'); api.export(['loglevel', 'ObjectLogger']); }); Package.onTest(function(api) { api.use(['coffeescript', 'practicalmeteor:loglevel@1.2.0_2', 'practicalmeteor:munit@2.1.4']); api.addFiles('tests/LoggerFactoryTest.coffee'); api.addFiles('tests/ObjectLoggerTest.coffee'); });
Update munit dependency to 2.1.4
Update munit dependency to 2.1.4
JavaScript
mit
practicalmeteor/meteor-loglevel,solderzzc/meteor-loglevel
--- +++ @@ -22,7 +22,7 @@ Package.onTest(function(api) { - api.use(['coffeescript', 'practicalmeteor:loglevel@1.2.0_2', 'practicalmeteor:munit@2.1.2']); + api.use(['coffeescript', 'practicalmeteor:loglevel@1.2.0_2', 'practicalmeteor:munit@2.1.4']); api.addFiles('tests/LoggerFactoryTest.coffee'); api.addFiles('tests/ObjectLoggerTest.coffee');
d0d62e6e7bcf78e7955ac693b36084d3dc94b725
lib/workers/repository/onboarding/branch/index.js
lib/workers/repository/onboarding/branch/index.js
const { detectPackageFiles } = require('../../../../manager'); const { createOnboardingBranch } = require('./create'); const { rebaseOnboardingBranch } = require('./rebase'); const { isOnboarded, onboardingPrExists } = require('./check'); async function checkOnboardingBranch(config) { logger.debug('checkOnboarding()'); logger.trace({ config }); const repoIsOnboarded = await isOnboarded(config); if (repoIsOnboarded) { logger.debug('Repo is onboarded'); return { ...config, repoIsOnboarded }; } if (config.isFork) { throw new Error('fork'); } logger.info('Repo is not onboarded'); if (await onboardingPrExists(config)) { logger.debug('Onboarding PR already exists'); await rebaseOnboardingBranch(config); } else { logger.debug('Onboarding PR does not exist'); if ((await detectPackageFiles(config)).length === 0) { throw new Error('no-package-files'); } logger.info('Need to create onboarding PR'); await createOnboardingBranch(config); } await platform.setBaseBranch(`renovate/configure`); const branchList = [`renovate/configure`]; return { ...config, repoIsOnboarded, branchList }; } module.exports = { checkOnboardingBranch, };
const { detectPackageFiles } = require('../../../../manager'); const { createOnboardingBranch } = require('./create'); const { rebaseOnboardingBranch } = require('./rebase'); const { isOnboarded, onboardingPrExists } = require('./check'); async function checkOnboardingBranch(config) { logger.debug('checkOnboarding()'); logger.trace({ config }); const repoIsOnboarded = await isOnboarded(config); if (repoIsOnboarded) { logger.debug('Repo is onboarded'); return { ...config, repoIsOnboarded }; } if (config.isFork && !config.renovateFork) { throw new Error('fork'); } logger.info('Repo is not onboarded'); if (await onboardingPrExists(config)) { logger.debug('Onboarding PR already exists'); await rebaseOnboardingBranch(config); } else { logger.debug('Onboarding PR does not exist'); if ((await detectPackageFiles(config)).length === 0) { throw new Error('no-package-files'); } logger.info('Need to create onboarding PR'); await createOnboardingBranch(config); } await platform.setBaseBranch(`renovate/configure`); const branchList = [`renovate/configure`]; return { ...config, repoIsOnboarded, branchList }; } module.exports = { checkOnboardingBranch, };
Allow --renovate-fork Cli flag for onboarding.
Allow --renovate-fork Cli flag for onboarding. Fixes https://github.com/renovateapp/renovate/issues/1371.
JavaScript
mit
singapore/renovate,singapore/renovate,singapore/renovate
--- +++ @@ -11,7 +11,7 @@ logger.debug('Repo is onboarded'); return { ...config, repoIsOnboarded }; } - if (config.isFork) { + if (config.isFork && !config.renovateFork) { throw new Error('fork'); } logger.info('Repo is not onboarded');
e1693cbc3e8f27a15109e128d17b675845f16166
assets/mathjaxhelper.js
assets/mathjaxhelper.js
MathJax.Hub.Config({ "tex2jax": { inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true } }); MathJax.Hub.Config({ config: ["MMLorHTML.js"], jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"], extensions: ["MathMenu.js", "MathZoom.js", "AMSmath.js", "AMSsymbols.js", "autobold.js", "autoload-all.js"] }); MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "AMS" } } });
MathJax.Hub.Config({ "tex2jax": { inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true } }); MathJax.Hub.Config({ config: ["MMLorHTML.js"], jax: [ "input/TeX", "output/HTML-CSS", "output/NativeMML" ], extensions: [ "MathMenu.js", "MathZoom.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js", "TeX/autobold.js", "TeX/autoload-all.js" ] }); MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "AMS" } } });
Fix paths for some mathjax extensions.
Fix paths for some mathjax extensions.
JavaScript
mit
mortenpi/Documenter.jl,MichaelHatherly/Documenter.jl,MichaelHatherly/Lapidary.jl,JuliaDocs/Documenter.jl
--- +++ @@ -6,8 +6,19 @@ }); MathJax.Hub.Config({ config: ["MMLorHTML.js"], - jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"], - extensions: ["MathMenu.js", "MathZoom.js", "AMSmath.js", "AMSsymbols.js", "autobold.js", "autoload-all.js"] + jax: [ + "input/TeX", + "output/HTML-CSS", + "output/NativeMML" + ], + extensions: [ + "MathMenu.js", + "MathZoom.js", + "TeX/AMSmath.js", + "TeX/AMSsymbols.js", + "TeX/autobold.js", + "TeX/autoload-all.js" + ] }); MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "AMS" } }
2aed51e0cddadbf600421ae56587a2b1fceb6198
config/index.js
config/index.js
import defaults from 'defaults' const API_GLOBAL = '_IMDIKATOR' const env = process.env.NODE_ENV || 'development' const DEFAULTS = { port: 3000, reduxDevTools: false } const globalConfig = (typeof window !== 'undefined' && window[API_GLOBAL] || {}) export default defaults({ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', nodeApiHost: 'http://atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS), showDebug: process.env.DEBUG }, DEFAULTS)
import defaults from 'defaults' const API_GLOBAL = '_IMDIKATOR' const env = process.env.NODE_ENV || 'development' const DEFAULTS = { port: 3000, reduxDevTools: false } const globalConfig = (typeof window !== 'undefined' && window[API_GLOBAL] || {}) export default defaults({ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', nodeApiHost: 'https://atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS), showDebug: process.env.DEBUG }, DEFAULTS)
FIX - changed node api to https
FIX - changed node api to https
JavaScript
mit
bengler/imdikator,bengler/imdikator
--- +++ @@ -15,7 +15,7 @@ env, port: process.env.PORT, // nodeApiHost: 'localhost:8080', - nodeApiHost: 'http://atindikatornode.azurewebsites.net', + nodeApiHost: 'https://atindikatornode.azurewebsites.net', apiHost: globalConfig.apiHost, contentApiHost: globalConfig.contentApiHost, reduxDevTools: env == 'development' && !['0', 'false'].includes(process.env.REDUX_DEVTOOLS),
fdce895bbaa4c08431d173edd286cb9b6670f2c2
tools/cli/dev-bundle-bin-helpers.js
tools/cli/dev-bundle-bin-helpers.js
var path = require("path"); var devBundleDir = path.resolve(__dirname, "..", "..", "dev_bundle"); var binDir = path.join(devBundleDir, "bin"); exports.getCommandPath = function (command) { return path.join(binDir, command); }; exports.getEnv = function () { var env = Object.create(process.env); env.PATH = [ // When npm looks for node, it must find dev_bundle/bin/node. binDir, // Also make available any scripts installed by packages in // dev_bundle/lib/node_modules, such as node-gyp. path.join(devBundleDir, "lib", "node_modules", ".bin"), env.PATH ].join(path.delimiter); if (process.platform === "win32") { // On Windows we provide a reliable version of python.exe for use by // node-gyp (the tool that rebuilds binary node modules). #WinPy env.PYTHON = env.PYTHON || path.join( devBundleDir, "python", "python.exe"); // We don't try to install a compiler toolchain on the developer's // behalf, but setting GYP_MSVS_VERSION helps select the right one. env.GYP_MSVS_VERSION = env.GYP_MSVS_VERSION || "2015"; } return env; };
var path = require("path"); var devBundleDir = path.resolve(__dirname, "..", "..", "dev_bundle"); var binDir = path.join(devBundleDir, "bin"); exports.getCommandPath = function (command) { return path.join(binDir, command); }; exports.getEnv = function () { var env = Object.create(process.env); var paths = [ // When npm looks for node, it must find dev_bundle/bin/node. binDir, // Also make available any scripts installed by packages in // dev_bundle/lib/node_modules, such as node-gyp. path.join(devBundleDir, "lib", "node_modules", ".bin"), ]; var PATH = env.PATH || env.Path; if (PATH) { paths.push(PATH); } env.PATH = paths.join(path.delimiter); if (process.platform === "win32") { // On Windows we provide a reliable version of python.exe for use by // node-gyp (the tool that rebuilds binary node modules). #WinPy env.PYTHON = env.PYTHON || path.join( devBundleDir, "python", "python.exe"); // We don't try to install a compiler toolchain on the developer's // behalf, but setting GYP_MSVS_VERSION helps select the right one. env.GYP_MSVS_VERSION = env.GYP_MSVS_VERSION || "2015"; // While the original process.env object allows for case insensitive // access on Windows, Object.create interferes with that behavior, so // here we ensure env.PATH === env.Path on Windows. env.Path = env.PATH; } return env; };
Make sure env.Path === env.PATH on Windows.
Make sure env.Path === env.PATH on Windows.
JavaScript
mit
Hansoft/meteor,Hansoft/meteor,4commerce-technologies-AG/meteor,jdivy/meteor,mjmasn/meteor,Hansoft/meteor,4commerce-technologies-AG/meteor,chasertech/meteor,chasertech/meteor,4commerce-technologies-AG/meteor,chasertech/meteor,chasertech/meteor,4commerce-technologies-AG/meteor,Hansoft/meteor,4commerce-technologies-AG/meteor,jdivy/meteor,mjmasn/meteor,4commerce-technologies-AG/meteor,mjmasn/meteor,Hansoft/meteor,chasertech/meteor,mjmasn/meteor,chasertech/meteor,jdivy/meteor,mjmasn/meteor,Hansoft/meteor,mjmasn/meteor,4commerce-technologies-AG/meteor,chasertech/meteor,Hansoft/meteor,jdivy/meteor,jdivy/meteor,jdivy/meteor,mjmasn/meteor,jdivy/meteor
--- +++ @@ -8,15 +8,20 @@ exports.getEnv = function () { var env = Object.create(process.env); - - env.PATH = [ + var paths = [ // When npm looks for node, it must find dev_bundle/bin/node. binDir, // Also make available any scripts installed by packages in // dev_bundle/lib/node_modules, such as node-gyp. path.join(devBundleDir, "lib", "node_modules", ".bin"), - env.PATH - ].join(path.delimiter); + ]; + + var PATH = env.PATH || env.Path; + if (PATH) { + paths.push(PATH); + } + + env.PATH = paths.join(path.delimiter); if (process.platform === "win32") { // On Windows we provide a reliable version of python.exe for use by @@ -27,6 +32,11 @@ // We don't try to install a compiler toolchain on the developer's // behalf, but setting GYP_MSVS_VERSION helps select the right one. env.GYP_MSVS_VERSION = env.GYP_MSVS_VERSION || "2015"; + + // While the original process.env object allows for case insensitive + // access on Windows, Object.create interferes with that behavior, so + // here we ensure env.PATH === env.Path on Windows. + env.Path = env.PATH; } return env;
7e6697514f6f2596ebcc9227c730effc72783c06
test/visual/cypress/specs/home-page-spec.js
test/visual/cypress/specs/home-page-spec.js
describe('home page', () => { before(() => { cy.visit('/') }) it('content', () => { cy.get('.dashboard-section__info-feed-date').hideElement() cy.get('.grid-row').compareSnapshot('homePageContent') }) it('header', () => { cy.get('.datahub-header').compareSnapshot('homePageHeader') }) it('search bar', () => { cy.get('.govuk-grid-column-full') .first() .compareSnapshot('homePageSearchBar') }) })
describe('home page', () => { before(() => { cy.visit('/') }) it('content', () => { cy.get('.dashboard-section__info-feed-date').hideElement() cy.get('[for="company-name"]').should('be.visible') cy.get('.grid-row').compareSnapshot('homePageContent') }) it('header', () => { cy.get('.datahub-header').compareSnapshot('homePageHeader') }) it('search bar', () => { cy.get('.govuk-grid-column-full') .first() .compareSnapshot('homePageSearchBar') }) })
Add assertion to test to wait for component to load
Add assertion to test to wait for component to load
JavaScript
mit
uktrade/data-hub-fe-beta2,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-frontend
--- +++ @@ -5,6 +5,7 @@ it('content', () => { cy.get('.dashboard-section__info-feed-date').hideElement() + cy.get('[for="company-name"]').should('be.visible') cy.get('.grid-row').compareSnapshot('homePageContent') })
2c1660c07e516d96dbdf8000a766fd6b63f3ef73
packages/ember-data/lib/system/application_ext.js
packages/ember-data/lib/system/application_ext.js
var set = Ember.set; Ember.onLoad('Ember.Application', function(Application) { Application.registerInjection({ name: "store", before: "controllers", injection: function(app, stateManager, property) { if (!stateManager) { return; } if (property === 'Store') { set(stateManager, 'store', app[property].create()); } } }); Application.registerInjection({ name: "giveStoreToControllers", after: ['store','controllers'], injection: function(app, stateManager, property) { if (!stateManager) { return; } if (/^[A-Z].*Controller$/.test(property)) { var controllerName = property.charAt(0).toLowerCase() + property.substr(1); var store = stateManager.get('store'); var controller = stateManager.get(controllerName); if(!controller) { return; } controller.set('store', store); } } }); });
var set = Ember.set; /** This code registers an injection for Ember.Application. If an Ember.js developer defines a subclass of DS.Store on their application, this code will automatically instantiate it and make it available on the router. Additionally, after an application's controllers have been injected, they will each have the store made available to them. For example, imagine an Ember.js application with the following classes: App.Store = DS.Store.extend({ adapter: 'App.MyCustomAdapter' }); App.PostsController = Ember.ArrayController.extend({ // ... }); When the application is initialized, `App.Store` will automatically be instantiated, and the instance of `App.PostsController` will have its `store` property set to that instance. Note that this code will only be run if the `ember-application` package is loaded. If Ember Data is being used in an environment other than a typical application (e.g., node.js where only `ember-runtime` is available), this code will be ignored. */ Ember.onLoad('Ember.Application', function(Application) { Application.registerInjection({ name: "store", before: "controllers", // If a store subclass is defined, like App.Store, // instantiate it and inject it into the router. injection: function(app, stateManager, property) { if (!stateManager) { return; } if (property === 'Store') { set(stateManager, 'store', app[property].create()); } } }); Application.registerInjection({ name: "giveStoreToControllers", after: ['store','controllers'], // For each controller, set its `store` property // to the DS.Store instance we created above. injection: function(app, stateManager, property) { if (!stateManager) { return; } if (/^[A-Z].*Controller$/.test(property)) { var controllerName = property.charAt(0).toLowerCase() + property.substr(1); var store = stateManager.get('store'); var controller = stateManager.get(controllerName); if(!controller) { return; } controller.set('store', store); } } }); });
Add inline docs to injection code
Add inline docs to injection code
JavaScript
mit
BookingSync/data,EmberSherpa/data,Eric-Guo/data,funtusov/data,sebastianseilund/data,topaxi/data,courajs/data,tarzan/data,sammcgrail/data,Turbo87/ember-data,kimroen/data,courajs/data,greyhwndz/data,sebastianseilund/data,gniquil/data,hibariya/data,Robdel12/data,fpauser/data,lostinpatterns/data,yaymukund/data,gabriel-letarte/data,arenoir/data,fsmanuel/data,Kuzirashi/data,simaob/data,topaxi/data,webPapaya/data,tarzan/data,jgwhite/data,Turbo87/ember-data,bf4/data,PrecisionNutrition/data,thaume/data,eriktrom/data,minasmart/data,andrejunges/data,H1D/data,stefanpenner/data,Robdel12/data,andrejunges/data,nickiaconis/data,slindberg/data,k-fish/data,danmcclain/data,nickiaconis/data,bcardarella/data,webPapaya/data,bcardarella/data,intuitivepixel/data,rtablada/data,pdud/data,martndemus/data,jmurphyau/data,heathharrelson/data,gkaran/data,hjdivad/data,slindberg/data,workmanw/data,BBLN/data,hibariya/data,tstirrat/ember-data,jgwhite/data,intuitivepixel/data,martndemus/data,sammcgrail/data,eriktrom/data,greyhwndz/data,danmcclain/data,bf4/data,acburdine/data,gniquil/data,rtablada/data,funtusov/data,BBLN/data,EmberSherpa/data,sammcgrail/data,faizaanshamsi/data,duggiefresh/data,in4mates/ember-data,fpauser/data,BookingSync/data,intuitivepixel/data,Turbo87/ember-data,heathharrelson/data,zoeesilcock/data,tonywok/data,heathharrelson/data,fsmanuel/data,zoeesilcock/data,H1D/data,workmanw/data,simaob/data,zoeesilcock/data,jgwhite/data,knownasilya/data,wecc/data,hibariya/data,ryanpatrickcook/data,hibariya/data,davidpett/data,trisrael/em-data,sandstrom/ember-data,simaob/data,BookingSync/data,XrXr/data,wecc/data,nickiaconis/data,offirgolan/data,dustinfarris/data,radiumsoftware/data,greyhwndz/data,Addepar/ember-data,EmberSherpa/data,Globegitter/ember-data-evolution,basho/ember-data,topaxi/data,usecanvas/data,gabriel-letarte/data,usecanvas/data,dustinfarris/data,basho/ember-data,XrXr/data,martndemus/data,lostinpatterns/data,kappiah/data,Eric-Guo/data,radiumsoftware/data,Globegitter/ember-data-evolution,ryanpatrickcook/data,arenoir/data,flowjzh/data,in4mates/ember-data,seanpdoyle/data,vikram7/data,teddyzeenny/data,topaxi/data,HeroicEric/data,usecanvas/data,yaymukund/data,funtusov/data,sebweaver/data,eriktrom/data,flowjzh/data,gkaran/data,trisrael/em-data,workmanw/data,lostinpatterns/data,swarmbox/data,InboxHealth/data,BBLN/data,bcardarella/data,minasmart/data,faizaanshamsi/data,eriktrom/data,arenoir/data,splattne/data,slindberg/data,tarzan/data,wecc/data,martndemus/data,tarzan/data,sebastianseilund/data,yaymukund/data,acburdine/data,H1D/data,usecanvas/data,dustinfarris/data,PrecisionNutrition/data,acburdine/data,knownasilya/data,offirgolan/data,gniquil/data,gabriel-letarte/data,funtusov/data,sebweaver/data,duggiefresh/data,stefanpenner/data,davidpett/data,fpauser/data,davidpett/data,faizaanshamsi/data,InboxHealth/data,fpauser/data,rwjblue/data,vikram7/data,HeroicEric/data,kappiah/data,sebweaver/data,arenoir/data,tstirrat/ember-data,rwjblue/data,bf4/data,fsmanuel/data,simaob/data,duggiefresh/data,heathharrelson/data,k-fish/data,flowjzh/data,FinSync/ember-data,in4mates/ember-data,seanpdoyle/data,k-fish/data,vikram7/data,fsmanuel/data,EmberSherpa/data,seanpdoyle/data,yaymukund/data,kappiah/data,BBLN/data,InboxHealth/data,splattne/data,ryanpatrickcook/data,gkaran/data,wecc/data,Kuzirashi/data,swarmbox/data,davidpett/data,kappiah/data,splattne/data,dustinfarris/data,Kuzirashi/data,jmurphyau/data,offirgolan/data,jmurphyau/data,Eric-Guo/data,sandstrom/ember-data,FinSync/ember-data,InboxHealth/data,danmcclain/data,H1D/data,rtablada/data,mphasize/data,gabriel-letarte/data,swarmbox/data,danmcclain/data,ryanpatrickcook/data,bf4/data,k-fish/data,intuitivepixel/data,mphasize/data,pdud/data,duggiefresh/data,pdud/data,HeroicEric/data,pdud/data,kimroen/data,XrXr/data,sammcgrail/data,whatthewhat/data,Turbo87/ember-data,kimroen/data,whatthewhat/data,teddyzeenny/data,nickiaconis/data,gkaran/data,acburdine/data,thaume/data,bcardarella/data,FinSync/ember-data,tstirrat/ember-data,sebastianseilund/data,knownasilya/data,andrejunges/data,faizaanshamsi/data,greyhwndz/data,stefanpenner/data,seanpdoyle/data,sebweaver/data,zoeesilcock/data,jmurphyau/data,PrecisionNutrition/data,Addepar/ember-data,webPapaya/data,XrXr/data,splattne/data,mphasize/data,swarmbox/data,offirgolan/data,Kuzirashi/data,Robdel12/data,tonywok/data,minasmart/data,courajs/data,rtablada/data,BookingSync/data,mphasize/data,flowjzh/data,FinSync/ember-data,tonywok/data,stefanpenner/data,webPapaya/data,andrejunges/data,gniquil/data,minasmart/data,workmanw/data,vikram7/data,thaume/data,hjdivad/data,Addepar/ember-data,lostinpatterns/data,Eric-Guo/data,trisrael/em-data,Robdel12/data,thaume/data,HeroicEric/data,tonywok/data,whatthewhat/data,whatthewhat/data,PrecisionNutrition/data,jgwhite/data,courajs/data,tstirrat/ember-data
--- +++ @@ -1,10 +1,42 @@ var set = Ember.set; + +/** + This code registers an injection for Ember.Application. + + If an Ember.js developer defines a subclass of DS.Store on their application, + this code will automatically instantiate it and make it available on the + router. + + Additionally, after an application's controllers have been injected, they will + each have the store made available to them. + + For example, imagine an Ember.js application with the following classes: + + App.Store = DS.Store.extend({ + adapter: 'App.MyCustomAdapter' + }); + + App.PostsController = Ember.ArrayController.extend({ + // ... + }); + + When the application is initialized, `App.Store` will automatically be + instantiated, and the instance of `App.PostsController` will have its `store` + property set to that instance. + + Note that this code will only be run if the `ember-application` package is + loaded. If Ember Data is being used in an environment other than a + typical application (e.g., node.js where only `ember-runtime` is available), + this code will be ignored. +*/ Ember.onLoad('Ember.Application', function(Application) { Application.registerInjection({ name: "store", before: "controllers", + // If a store subclass is defined, like App.Store, + // instantiate it and inject it into the router. injection: function(app, stateManager, property) { if (!stateManager) { return; } if (property === 'Store') { @@ -17,6 +49,8 @@ name: "giveStoreToControllers", after: ['store','controllers'], + // For each controller, set its `store` property + // to the DS.Store instance we created above. injection: function(app, stateManager, property) { if (!stateManager) { return; } if (/^[A-Z].*Controller$/.test(property)) {
26d55a74b3f302f3803f8e87d05866bab81cb5ed
src/components/svg-icon/svg-icon.js
src/components/svg-icon/svg-icon.js
// Aurelia import { bindable, bindingMode } from 'aurelia-framework'; import icons from 'configs/icons'; export class SvgIcon { @bindable({ defaultBindingMode: bindingMode.oneWay }) iconId; attached () { const id = this.iconId.toUpperCase().replace('-', '_'); this.icon = icons[id] ? icons[id] : icons.WARNING; } }
// Aurelia import { bindable, bindingMode } from 'aurelia-framework'; import icons from 'configs/icons'; export class SvgIcon { @bindable({ defaultBindingMode: bindingMode.oneWay }) iconId; constructor () { this.icon = { viewBox: '0 0 16 16', svg: '' }; } attached () { const id = this.iconId.toUpperCase().replace('-', '_'); this.icon = icons[id] ? icons[id] : icons.WARNING; } }
Set default values to avoid initial binding errors.
Set default values to avoid initial binding errors.
JavaScript
mit
flekschas/hipiler,flekschas/hipiler,flekschas/hipiler
--- +++ @@ -9,6 +9,13 @@ export class SvgIcon { @bindable({ defaultBindingMode: bindingMode.oneWay }) iconId; + constructor () { + this.icon = { + viewBox: '0 0 16 16', + svg: '' + }; + } + attached () { const id = this.iconId.toUpperCase().replace('-', '_'); this.icon = icons[id] ? icons[id] : icons.WARNING;
62b43e17c7f22f339b9d0e84792a63dbcaf6d83c
EPFL_People.user.js
EPFL_People.user.js
// ==UserScript== // @name EPFL People // @namespace none // @description A script to improve browsing on people.epfl.ch // @include http://people.epfl.ch/* // @version 1 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @author EPFL-dojo // ==/UserScript== //Avoid conflicts this.$ = this.jQuery = jQuery.noConflict(true); $(document).ready(function() { // get the h1 name content $.h1name = $("h1").text(); // get the sciper number $.sciper = $('a[href*="http://people.epfl.ch/cgi-bin/people?id="]').attr('href').match(/id=([0-9]{6})/)[1]; // change the main title content to add the sciper in it $("h1").text($.h1name + " #" + $.sciper + " ()"); $.get("/cgi-bin/people/showcv?id=" + $.sciper + "&op=admindata&type=show&lang=en&cvlang=en", function(data){ $.username = data.match(/Username: (\w+)\s/)[1] $("h1").text($.h1name + " #" + $.sciper + " (" + $.username + ")"); }) });
// ==UserScript== // @name EPFL People // @namespace none // @description A script to improve browsing on people.epfl.ch // @include http://people.epfl.ch/* // @version 1 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @author EPFL-dojo // ==/UserScript== //Avoid conflicts this.$ = this.jQuery = jQuery.noConflict(true); $(document).ready(function() { // get the h1 name content $.epfl_user = { "name": $("h1").text(), "sciper": $('a[href*="http://people.epfl.ch/cgi-bin/people?id="]').attr('href').match(/id=([0-9]{6})/)[1] }; // change the main title content to add the sciper in it $("h1").text($.epfl_user["name"] + " #" + $.epfl_user["sciper"] + " ()"); $.get("/cgi-bin/people/showcv?id=" + $.epfl_user["sciper"] + "&op=admindata&type=show&lang=en&cvlang=en", function(data){ $.epfl_user["username"] = data.match(/Username: (\w+)\s/)[1]; $("h1").text($.epfl_user["name"] + " #" + $.epfl_user["sciper"] + " (" + $.epfl_user["username"]+ ")"); }) });
Save only one variable (dict)
Save only one variable (dict)
JavaScript
unlicense
epfl-dojo/EPFL_People_UserScript
--- +++ @@ -14,14 +14,15 @@ $(document).ready(function() { // get the h1 name content - $.h1name = $("h1").text(); - // get the sciper number - $.sciper = $('a[href*="http://people.epfl.ch/cgi-bin/people?id="]').attr('href').match(/id=([0-9]{6})/)[1]; + $.epfl_user = { + "name": $("h1").text(), + "sciper": $('a[href*="http://people.epfl.ch/cgi-bin/people?id="]').attr('href').match(/id=([0-9]{6})/)[1] + }; // change the main title content to add the sciper in it - $("h1").text($.h1name + " #" + $.sciper + " ()"); + $("h1").text($.epfl_user["name"] + " #" + $.epfl_user["sciper"] + " ()"); - $.get("/cgi-bin/people/showcv?id=" + $.sciper + "&op=admindata&type=show&lang=en&cvlang=en", function(data){ - $.username = data.match(/Username: (\w+)\s/)[1] - $("h1").text($.h1name + " #" + $.sciper + " (" + $.username + ")"); + $.get("/cgi-bin/people/showcv?id=" + $.epfl_user["sciper"] + "&op=admindata&type=show&lang=en&cvlang=en", function(data){ + $.epfl_user["username"] = data.match(/Username: (\w+)\s/)[1]; + $("h1").text($.epfl_user["name"] + " #" + $.epfl_user["sciper"] + " (" + $.epfl_user["username"]+ ")"); }) });
c85b6344fcaaa605fb5aa58de659a0e5e042d1e3
src/js/controller/about.js
src/js/controller/about.js
'use strict'; var cfg = require('../app-config').config; // // Controller // var AboutCtrl = function($scope) { $scope.state.about = { toggle: function(to) { $scope.state.lightbox = (to) ? 'about' : undefined; } }; // // scope variables // $scope.version = cfg.appVersion; $scope.date = new Date(); // // scope functions // }; module.exports = AboutCtrl;
'use strict'; var cfg = require('../app-config').config; // // Controller // var AboutCtrl = function($scope) { $scope.state.about = { toggle: function(to) { $scope.state.lightbox = (to) ? 'about' : undefined; } }; // // scope variables // $scope.version = cfg.appVersion + ' (beta)'; $scope.date = new Date(); // // scope functions // }; module.exports = AboutCtrl;
Add beta ta to version
Add beta ta to version
JavaScript
mit
whiteout-io/mail-html5,kalatestimine/mail-html5,halitalf/mail-html5,sheafferusa/mail-html5,whiteout-io/mail,b-deng/mail-html5,dopry/mail-html5,dopry/mail-html5,kalatestimine/mail-html5,clochix/mail-html5,tanx/hoodiecrow,dopry/mail-html5,b-deng/mail-html5,whiteout-io/mail,dopry/mail-html5,halitalf/mail-html5,halitalf/mail-html5,b-deng/mail-html5,b-deng/mail-html5,whiteout-io/mail-html5,sheafferusa/mail-html5,sheafferusa/mail-html5,kalatestimine/mail-html5,whiteout-io/mail-html5,whiteout-io/mail-html5,whiteout-io/mail,tanx/hoodiecrow,clochix/mail-html5,tanx/hoodiecrow,halitalf/mail-html5,kalatestimine/mail-html5,whiteout-io/mail,clochix/mail-html5,clochix/mail-html5,sheafferusa/mail-html5
--- +++ @@ -18,7 +18,7 @@ // scope variables // - $scope.version = cfg.appVersion; + $scope.version = cfg.appVersion + ' (beta)'; $scope.date = new Date(); //
b36005ed996391dbf9502aaffbed6e0fc1297d28
main.js
main.js
var app = require('app'); var BrowserWindow = require('browser-window'); var glob = require('glob'); var mainWindow = null; // Require and setup each JS file in the main-process dir glob('main-process/**/*.js', function (error, files) { files.forEach(function (file) { require('./' + file).setup(); }); }); app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } }); app.on('ready', () => { mainWindow = new BrowserWindow({ width: 800, height: 900 }); mainWindow.loadURL('file://' + __dirname + '/index.html'); // mainWindow.openDevTools(); mainWindow.on('closed', () => { mainWindow = null; }); });
var app = require('app'); var BrowserWindow = require('browser-window'); var glob = require('glob'); var mainWindow = null; // Require and setup each JS file in the main-process dir glob('main-process/**/*.js', function (error, files) { files.forEach(function (file) { require('./' + file).setup(); }); }); function createWindow () { mainWindow = new BrowserWindow({ width: 800, height: 900 }); mainWindow.loadURL('file://' + __dirname + '/index.html'); mainWindow.on('closed', function() { mainWindow = null; }); } app.on('ready', createWindow); app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit(); } }); app.on('activate', function () { if (mainWindow === null) { createWindow(); } });
Handle OS X no window situation
Handle OS X no window situation Same setup as quick start guide
JavaScript
mit
PanCheng111/XDF_Personal_Analysis,electron/electron-api-demos,electron/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,blep/electron-api-demos,blep/electron-api-demos,blep/electron-api-demos,PanCheng111/XDF_Personal_Analysis,PanCheng111/XDF_Personal_Analysis
--- +++ @@ -11,20 +11,24 @@ }); }); -app.on('window-all-closed', () => { +function createWindow () { + mainWindow = new BrowserWindow({ width: 800, height: 900 }); + mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.on('closed', function() { + mainWindow = null; + }); +} + +app.on('ready', createWindow); + +app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit(); } }); -app.on('ready', () => { - mainWindow = new BrowserWindow({ width: 800, height: 900 }); - - mainWindow.loadURL('file://' + __dirname + '/index.html'); - - // mainWindow.openDevTools(); - - mainWindow.on('closed', () => { - mainWindow = null; - }); +app.on('activate', function () { + if (mainWindow === null) { + createWindow(); + } });
9f5a15819d2f6503f33e5b27b0d30be239e5e72a
main.js
main.js
console.log("I'm ready");
// Init the app after page loaded. window.onload = initPage; // The entry function. function initPage() { if (!canvasSupport()) { // If Canvas is not supported on the browser, do nothing but tell the user. alert("Sorry, your browser does not support HTML5 Canvas"); return false; } drawScreen(); } function drawScreen() { var canvas = document.getElementById("theCanvas"); if (!canvas) { throw new Error("The canvas element does not exists!"); } } // Does the browser support HTML5 Canvas ? function canvasSupport() { var canvas = document.createElement("canvas"); return !!(canvas.getContext && canvas.getContext("2d")); }
Make sure Canvas is supported on the browser
Make sure Canvas is supported on the browser
JavaScript
mit
rainyjune/canvas-guesstheletter,rainyjune/canvas-guesstheletter
--- +++ @@ -1 +1,24 @@ -console.log("I'm ready"); +// Init the app after page loaded. +window.onload = initPage; + +// The entry function. +function initPage() { + if (!canvasSupport()) { // If Canvas is not supported on the browser, do nothing but tell the user. + alert("Sorry, your browser does not support HTML5 Canvas"); + return false; + } + drawScreen(); +} + +function drawScreen() { + var canvas = document.getElementById("theCanvas"); + if (!canvas) { + throw new Error("The canvas element does not exists!"); + } +} + +// Does the browser support HTML5 Canvas ? +function canvasSupport() { + var canvas = document.createElement("canvas"); + return !!(canvas.getContext && canvas.getContext("2d")); +}
b77e8e11e199428578ca8074a6367d9c740d1182
{{cookiecutter.repo_name}}/webapp/webapp/webpack/config.dev.js
{{cookiecutter.repo_name}}/webapp/webapp/webpack/config.dev.js
/* eslint-disable */ const path = require('path'); const webpack = require('webpack'); const makeConfig = require('./config.base'); // The app/ dir const app_root = path.resolve(__dirname, '..'); const filenameTemplate = 'webapp/[name]'; const config = makeConfig({ filenameTemplate: filenameTemplate, mode: 'development', devtool: 'eval-source-map', namedModules: true, minimize: false, // Needed for inline CSS (via JS) - see set-public-path.js for more info prependSources: [path.resolve(app_root, 'webpack', 'set-public-path.js')], // This must be same as Django's STATIC_URL setting publicPath: '/static/', plugins: [], performance: { hints: 'warning', }, }); console.log("Using DEV config"); module.exports = config;
/* eslint-disable */ const path = require('path'); const webpack = require('webpack'); const makeConfig = require('./config.base'); // The app/ dir const app_root = path.resolve(__dirname, '..'); const filenameTemplate = 'webapp/[name]'; const config = makeConfig({ filenameTemplate: filenameTemplate, mode: 'development', devtool: 'eval-source-map', namedModules: true, minimize: false, // Needed for inline CSS (via JS) - see set-public-path.js for more info prependSources: [path.resolve(app_root, 'webpack', 'set-public-path.js')], // This must be same as Django's STATIC_URL setting publicPath: '/assets/', plugins: [], performance: { hints: 'warning', }, }); console.log("Using DEV config"); module.exports = config;
Fix wrong public URL for static in webpack
Fix wrong public URL for static in webpack After a recent change, `STATIC_URL` is now `assets` in the webapp. The webpack config has not been updated though, and the frontend was trying an old URL.
JavaScript
isc
thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template,thorgate/django-project-template
--- +++ @@ -24,7 +24,7 @@ prependSources: [path.resolve(app_root, 'webpack', 'set-public-path.js')], // This must be same as Django's STATIC_URL setting - publicPath: '/static/', + publicPath: '/assets/', plugins: [],
285c390eb811461d517f777a03167d9f44913af5
views/components/touch-feedback.android.js
views/components/touch-feedback.android.js
import React from "react-native"; const { TouchableNativeFeedback } = React; export default class TouchFeedback extends React.Component { render() { return ( <TouchableNativeFeedback {...this.props} background={TouchableNativeFeedback.Ripple(this.props.pressColor)}> {this.props.children} </TouchableNativeFeedback> ); } } TouchFeedback.propTypes = { pressColor: React.PropTypes.string, children: React.PropTypes.node };
import React from "react-native"; import VersionCodes from "../../modules/version-codes"; const { TouchableNativeFeedback, Platform } = React; export default class TouchFeedback extends React.Component { render() { return ( <TouchableNativeFeedback {...this.props} background={ Platform.Version >= VersionCodes.LOLLIPOP ? TouchableNativeFeedback.Ripple(this.props.pressColor) : TouchableNativeFeedback.SelectableBackground() } > {this.props.children} </TouchableNativeFeedback> ); } } TouchFeedback.propTypes = { pressColor: React.PropTypes.string, children: React.PropTypes.node };
Fix crash on Android 4.x
Fix crash on Android 4.x
JavaScript
unknown
wesley1001/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods
--- +++ @@ -1,13 +1,20 @@ import React from "react-native"; +import VersionCodes from "../../modules/version-codes"; const { - TouchableNativeFeedback + TouchableNativeFeedback, + Platform } = React; export default class TouchFeedback extends React.Component { render() { return ( - <TouchableNativeFeedback {...this.props} background={TouchableNativeFeedback.Ripple(this.props.pressColor)}> + <TouchableNativeFeedback + {...this.props} + background={ + Platform.Version >= VersionCodes.LOLLIPOP ? TouchableNativeFeedback.Ripple(this.props.pressColor) : TouchableNativeFeedback.SelectableBackground() + } + > {this.props.children} </TouchableNativeFeedback> );
32c88d9541ed8b948d82c27e84d974d6340d3cb8
views/controllers/room-title-controller.js
views/controllers/room-title-controller.js
import React from "react-native"; import RoomTitle from "../components/room-title"; import controller from "./controller"; const { InteractionManager } = React; @controller export default class RoomTitleController extends React.Component { constructor(props) { super(props); const displayName = this.props.room.replace(/-+/g, " ").replace(/\w\S*/g, s => s.charAt(0).toUpperCase() + s.slice(1)).trim(); this.state = { room: { displayName } }; } componentDidMount() { setTimeout(() => this._onDataArrived(this.store.getRoomById(this.props.room)), 0); } _onDataArrived(room) { InteractionManager.runAfterInteractions(() => { if (this._mounted) { this.setState({ room }); } }); } render() { return <RoomTitle {...this.state} />; } } RoomTitleController.propTypes = { room: React.PropTypes.string.isRequired };
import React from "react-native"; import RoomTitle from "../components/room-title"; import controller from "./controller"; const { InteractionManager } = React; @controller export default class RoomTitleController extends React.Component { constructor(props) { super(props); const displayName = this.props.room.replace(/-+/g, " ").replace(/\w\S*/g, s => s.charAt(0).toUpperCase() + s.slice(1)).trim(); this.state = { room: { displayName } }; } componentDidMount() { this._updateData(); this.handle("statechange", changes => { if (changes.entities && changes.entities[this.props.room]) { this._updateData(); } }); } _updateData() { InteractionManager.runAfterInteractions(() => { if (this._mounted) { const room = this.store.getRoom(this.props.room); if (room.displayName) { this.setState({ room }); } } }); } render() { return <RoomTitle {...this.state} />; } } RoomTitleController.propTypes = { room: React.PropTypes.string.isRequired };
Update room title on store change
Update room title on store change
JavaScript
unknown
scrollback/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods
--- +++ @@ -19,13 +19,23 @@ } componentDidMount() { - setTimeout(() => this._onDataArrived(this.store.getRoomById(this.props.room)), 0); + this._updateData(); + + this.handle("statechange", changes => { + if (changes.entities && changes.entities[this.props.room]) { + this._updateData(); + } + }); } - _onDataArrived(room) { + _updateData() { InteractionManager.runAfterInteractions(() => { if (this._mounted) { - this.setState({ room }); + const room = this.store.getRoom(this.props.room); + + if (room.displayName) { + this.setState({ room }); + } } }); }
5cb17c421ddbb9cc6ddf46b22db5255042c6f7d8
www/static/js/jsfiddle-integration-babel.js
www/static/js/jsfiddle-integration-babel.js
// Do not delete or move this file. // Many fiddles reference it so we have to keep it here. (function() { var tag = document.querySelector( 'script[type="application/javascript;version=1.7"]' ); if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) { alert('Bad JSFiddle configuration, please fork the original React JSFiddle'); } tag.setAttribute('type', 'text/babel'); tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, ''); })();
// Do not delete or move this file. // Many fiddles reference it so we have to keep it here. (function() { var tag = document.querySelector( 'script[type="application/javascript;version=1.7"]' ); if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) { alert('Bad JSFiddle configuration, please fork the original React JSFiddle'); } tag.setAttribute('type', 'text/babel'); tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, ''); })();
Fix lint error in master
Fix lint error in master
JavaScript
mit
apaatsio/react,pyitphyoaung/react,maxschmeling/react,krasimir/react,billfeller/react,empyrical/react,yangshun/react,ericyang321/react,aickin/react,brigand/react,jdlehman/react,VioletLife/react,mjackson/react,jorrit/react,mhhegazy/react,camsong/react,pyitphyoaung/react,pyitphyoaung/react,Simek/react,jzmq/react,acdlite/react,chicoxyzzy/react,mjackson/react,empyrical/react,chenglou/react,jameszhan/react,VioletLife/react,silvestrijonathan/react,flarnie/react,mjackson/react,terminatorheart/react,apaatsio/react,empyrical/react,kaushik94/react,yungsters/react,krasimir/react,jzmq/react,cpojer/react,Simek/react,acdlite/react,Simek/react,jorrit/react,yangshun/react,roth1002/react,prometheansacrifice/react,yangshun/react,anushreesubramani/react,TheBlasfem/react,mjackson/react,camsong/react,TheBlasfem/react,krasimir/react,rickbeerendonk/react,empyrical/react,tomocchino/react,jdlehman/react,maxschmeling/react,chicoxyzzy/react,flarnie/react,cpojer/react,maxschmeling/react,mjackson/react,STRML/react,jorrit/react,nhunzaker/react,brigand/react,cpojer/react,apaatsio/react,cpojer/react,billfeller/react,camsong/react,yungsters/react,facebook/react,empyrical/react,ericyang321/react,cpojer/react,dilidili/react,chenglou/react,kaushik94/react,nhunzaker/react,acdlite/react,jameszhan/react,glenjamin/react,acdlite/react,jameszhan/react,anushreesubramani/react,prometheansacrifice/react,krasimir/react,dilidili/react,jorrit/react,pyitphyoaung/react,facebook/react,jdlehman/react,flarnie/react,silvestrijonathan/react,rickbeerendonk/react,mjackson/react,mosoft521/react,roth1002/react,brigand/react,jzmq/react,dilidili/react,rricard/react,pyitphyoaung/react,facebook/react,terminatorheart/react,Simek/react,TheBlasfem/react,ArunTesco/react,trueadm/react,chicoxyzzy/react,Simek/react,chenglou/react,trueadm/react,STRML/react,kaushik94/react,nhunzaker/react,TheBlasfem/react,STRML/react,terminatorheart/react,jdlehman/react,TheBlasfem/react,tomocchino/react,billfeller/react,billfeller/react,flarnie/react,pyitphyoaung/react,krasimir/react,yiminghe/react,silvestrijonathan/react,yiminghe/react,ArunTesco/react,jdlehman/react,trueadm/react,camsong/react,roth1002/react,anushreesubramani/react,anushreesubramani/react,kaushik94/react,brigand/react,nhunzaker/react,yangshun/react,chenglou/react,silvestrijonathan/react,nhunzaker/react,aickin/react,trueadm/react,tomocchino/react,STRML/react,aickin/react,chenglou/react,trueadm/react,VioletLife/react,syranide/react,TheBlasfem/react,yungsters/react,glenjamin/react,jameszhan/react,tomocchino/react,mhhegazy/react,Simek/react,krasimir/react,glenjamin/react,maxschmeling/react,tomocchino/react,cpojer/react,rricard/react,VioletLife/react,jorrit/react,jdlehman/react,prometheansacrifice/react,flarnie/react,rickbeerendonk/react,acdlite/react,syranide/react,silvestrijonathan/react,anushreesubramani/react,prometheansacrifice/react,dilidili/react,anushreesubramani/react,roth1002/react,camsong/react,silvestrijonathan/react,maxschmeling/react,mhhegazy/react,glenjamin/react,kaushik94/react,rickbeerendonk/react,flarnie/react,jorrit/react,yungsters/react,trueadm/react,ArunTesco/react,mosoft521/react,Simek/react,camsong/react,chenglou/react,anushreesubramani/react,dilidili/react,STRML/react,jdlehman/react,yiminghe/react,STRML/react,ericyang321/react,yangshun/react,jameszhan/react,aickin/react,mosoft521/react,aickin/react,billfeller/react,mhhegazy/react,glenjamin/react,jameszhan/react,facebook/react,apaatsio/react,brigand/react,kaushik94/react,roth1002/react,yiminghe/react,terminatorheart/react,trueadm/react,VioletLife/react,flarnie/react,brigand/react,jameszhan/react,VioletLife/react,yiminghe/react,syranide/react,billfeller/react,glenjamin/react,empyrical/react,mhhegazy/react,yiminghe/react,kaushik94/react,apaatsio/react,chicoxyzzy/react,rricard/react,roth1002/react,yiminghe/react,mosoft521/react,rickbeerendonk/react,nhunzaker/react,maxschmeling/react,chicoxyzzy/react,STRML/react,jzmq/react,krasimir/react,dilidili/react,apaatsio/react,nhunzaker/react,yangshun/react,rricard/react,chicoxyzzy/react,rickbeerendonk/react,facebook/react,chenglou/react,facebook/react,syranide/react,yungsters/react,jzmq/react,silvestrijonathan/react,camsong/react,jzmq/react,facebook/react,acdlite/react,terminatorheart/react,mjackson/react,billfeller/react,pyitphyoaung/react,prometheansacrifice/react,empyrical/react,mhhegazy/react,jorrit/react,jzmq/react,yungsters/react,rricard/react,chicoxyzzy/react,brigand/react,terminatorheart/react,ericyang321/react,dilidili/react,glenjamin/react,ericyang321/react,mosoft521/react,yungsters/react,acdlite/react,prometheansacrifice/react,yangshun/react,roth1002/react,ericyang321/react,VioletLife/react,rricard/react,rickbeerendonk/react,tomocchino/react,ericyang321/react,aickin/react,mosoft521/react,maxschmeling/react,apaatsio/react,aickin/react,mosoft521/react,cpojer/react,tomocchino/react,mhhegazy/react,prometheansacrifice/react
7d961ab16ca4db0bd91419cdfed8bb7f873ab36b
homeworks/dmitry.minchenko_wer1Kua/homework_2/script.js
homeworks/dmitry.minchenko_wer1Kua/homework_2/script.js
(function() { let height = 15, block = '#', space = ' '; if (height<2 || height>12) { return console.log('Error! Height must be >= 2 and <= 12'); } for (let i = 0; i < height; i++) { console.log(space.repeat(height-i) + block.repeat(i+1) + space.repeat(2) + block.repeat(1+i)); } })();
(function() { const HEIGHT = 15, BLOCK = '#', SPACE = ' '; if (HEIGHT<2 || HEIGHT>12) { return console.log('Error! Height must be >= 2 and <= 12'); } for (let i = 0; i < HEIGHT; i++) { console.log(SPACE.repeat(HEIGHT-i) + BLOCK.repeat(i+1) + SPACE.repeat(2) + BLOCK.repeat(1+i)); } })();
Change to const instead of let
Change to const instead of let
JavaScript
mit
MastersAcademy/js-course-2017,MastersAcademy/js-course-2017,MastersAcademy/js-course-2017
--- +++ @@ -1,13 +1,13 @@ (function() { - let height = 15, - block = '#', - space = ' '; + const HEIGHT = 15, + BLOCK = '#', + SPACE = ' '; - if (height<2 || height>12) { + if (HEIGHT<2 || HEIGHT>12) { return console.log('Error! Height must be >= 2 and <= 12'); } - for (let i = 0; i < height; i++) { - console.log(space.repeat(height-i) + block.repeat(i+1) + space.repeat(2) + block.repeat(1+i)); + for (let i = 0; i < HEIGHT; i++) { + console.log(SPACE.repeat(HEIGHT-i) + BLOCK.repeat(i+1) + SPACE.repeat(2) + BLOCK.repeat(1+i)); } })();
cf2fd636251dd9aeb60c224cfcbddf10dd65aea3
frontend/cordova/app/hooks/after_platform_add/add_plugins.js
frontend/cordova/app/hooks/after_platform_add/add_plugins.js
#!/usr/bin/env node //this hook installs all your plugins var pluginlist = [ "https://github.com/driftyco/ionic-plugins-keyboard.git", "cordova-plugin-vibration", "cordova-plugin-media", "https://github.com/apache/cordova-plugin-splashscreen.git", "https://github.com/extendedmind/Calendar-PhoneGap-Plugin.git", "https://github.com/extendedmind/cordova-plugin-local-notifications", "https://github.com/leohenning/KeepScreenOnPlugin", "https://github.com/extendedmind/cordova-webintent", "cordova-plugin-device", "cordova-plugin-whitelist" ]; // no need to configure below var fs = require('fs'); var path = require('path'); var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } pluginlist.forEach(function(plug) { exec("cordova plugin add " + plug, puts); });
#!/usr/bin/env node //this hook installs all your plugins var pluginlist = [ "https://github.com/driftyco/ionic-plugins-keyboard.git#v1.0.4", "cordova-plugin-vibration", "cordova-plugin-media", "https://github.com/apache/cordova-plugin-splashscreen.git", "https://github.com/extendedmind/Calendar-PhoneGap-Plugin.git", "https://github.com/extendedmind/cordova-plugin-local-notifications", "https://github.com/leohenning/KeepScreenOnPlugin", "https://github.com/extendedmind/cordova-webintent", "cordova-plugin-device", "cordova-plugin-whitelist" ]; // no need to configure below var fs = require('fs'); var path = require('path'); var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } pluginlist.forEach(function(plug) { exec("cordova plugin add " + plug, puts); });
Use specific version of Ionic Keyboard plugin
Use specific version of Ionic Keyboard plugin
JavaScript
agpl-3.0
extendedmind/extendedmind,ttiurani/extendedmind,extendedmind/extendedmind,extendedmind/extendedmind,ttiurani/extendedmind,extendedmind/extendedmind,extendedmind/extendedmind,ttiurani/extendedmind,extendedmind/extendedmind,extendedmind/extendedmind,ttiurani/extendedmind,ttiurani/extendedmind,ttiurani/extendedmind
--- +++ @@ -3,7 +3,7 @@ //this hook installs all your plugins var pluginlist = [ - "https://github.com/driftyco/ionic-plugins-keyboard.git", + "https://github.com/driftyco/ionic-plugins-keyboard.git#v1.0.4", "cordova-plugin-vibration", "cordova-plugin-media", "https://github.com/apache/cordova-plugin-splashscreen.git",
0a4d8a5b194a5c636b0aa6225dadd2ab9ff7e150
parseFiles.js
parseFiles.js
var dir = require('node-dir'); dir.readFiles(__dirname, { exclude: ['LICENSE', '.gitignore', '.DS_Store'], excludeDir: ['node_modules', '.git'] }, function(err, content, next) { if (err) throw err; console.log('content:', content); next(); }, function(err, files) { if (err) throw err; console.log('finished reading files:', files); });
var dir = require('node-dir'); dir.readFiles(__dirname, { exclude: ['LICENSE', '.gitignore', '.DS_Store'], excludeDir: ['node_modules', '.git'] }, function(err, content, next) { if (err) throw err; var digitalOceanToken = findDigitalOceanToken(String(content)); var awsToken = findAwsToken(String(content)); if(awsToken != null || digitalOceanToken != null){ console.log("Key in commit. Remove and commit again"); process.exit(1); } next(); }, function(err, files) { if (err) throw err; //console.log('finished reading files:', files); }); function findDigitalOceanToken(content){ return content.match(/\"[a-zA-Z0-9]{63,65}\"/); } function findAwsToken(content){ return content.match(/\"AKIA[a-zA-Z0-9]{16,17}\"/); }
Add functionality to check for keys in commmit
Add functionality to check for keys in commmit
JavaScript
mit
DevOps-HeadBangers/target-project-node
--- +++ @@ -5,10 +5,24 @@ excludeDir: ['node_modules', '.git'] }, function(err, content, next) { if (err) throw err; - console.log('content:', content); + var digitalOceanToken = findDigitalOceanToken(String(content)); + var awsToken = findAwsToken(String(content)); + if(awsToken != null || digitalOceanToken != null){ + console.log("Key in commit. Remove and commit again"); + process.exit(1); + } next(); }, function(err, files) { if (err) throw err; - console.log('finished reading files:', files); + //console.log('finished reading files:', files); }); + + +function findDigitalOceanToken(content){ + return content.match(/\"[a-zA-Z0-9]{63,65}\"/); +} + +function findAwsToken(content){ + return content.match(/\"AKIA[a-zA-Z0-9]{16,17}\"/); +}
53fd5fdf4afa38fd732728c283e9bc2277b7a5cb
index.js
index.js
const jsonMask = require('json-mask') const badCode = code => code >= 300 || code < 200 module.exports = function (opt) { opt = opt || {} function partialResponse(obj, fields) { if (!fields) return obj return jsonMask(obj, fields) } function wrap(orig) { return function (obj) { const param = this.req.query[opt.query || 'fields'] if (1 === arguments.length) { return orig(partialResponse(obj, param)) } if ('number' === typeof arguments[1] && !badCode(arguments[1])) { // res.json(body, status) backwards compat return orig(partialResponse(obj, param), arguments[1]) } if ('number' === typeof obj && !badCode(obj)) { // res.json(status, body) backwards compat return orig(obj, partialResponse(arguments[1], param)) } // The original actually returns this.send(body) return orig(obj, arguments[1]) } } return function (req, res, next) { if (badCode(res.statusCode)) return next() if (!res.__isJSONMaskWrapped) { res.json = wrap(res.json.bind(res)) if (req.jsonp) res.jsonp = wrap(res.jsonp.bind(res)) res.__isJSONMaskWrapped = true } next() } }
const jsonMask = require('json-mask') const badCode = code => code >= 300 || code < 200 module.exports = function (opt) { opt = opt || {} function partialResponse(obj, fields) { if (!fields) return obj return jsonMask(obj, fields) } function wrap(orig) { return function (obj) { const param = this.req.query[opt.query || 'fields'] if (1 === arguments.length && !badCode(obj)) { return orig(partialResponse(obj, param)) } if ('number' === typeof arguments[1] && !badCode(arguments[1])) { // res.json(body, status) backwards compat return orig(partialResponse(obj, param), arguments[1]) } if ('number' === typeof obj && !badCode(obj)) { // res.json(status, body) backwards compat return orig(obj, partialResponse(arguments[1], param)) } // The original actually returns this.send(body) return orig(obj, arguments[1]) } } return function (req, res, next) { if (!res.__isJSONMaskWrapped) { res.json = wrap(res.json.bind(res)) if (req.jsonp) res.jsonp = wrap(res.jsonp.bind(res)) res.__isJSONMaskWrapped = true } next() } }
Move badCode to the wrapping function
Move badCode to the wrapping function This moves the badCode to the wrapping funciton as the status will not be correct in the function where the middleware first gets called.
JavaScript
mit
nemtsov/express-partial-response
--- +++ @@ -13,7 +13,7 @@ function wrap(orig) { return function (obj) { const param = this.req.query[opt.query || 'fields'] - if (1 === arguments.length) { + if (1 === arguments.length && !badCode(obj)) { return orig(partialResponse(obj, param)) } @@ -33,7 +33,6 @@ } return function (req, res, next) { - if (badCode(res.statusCode)) return next() if (!res.__isJSONMaskWrapped) { res.json = wrap(res.json.bind(res)) if (req.jsonp) res.jsonp = wrap(res.jsonp.bind(res))
4cfecfa2d4734c968ca6d3d1b65ec7e720f63081
index.js
index.js
/** * Created by tshen on 16/7/15. */ 'use strict' import {NativeModules} from 'react-native'; const NativeSimpleFetch = NativeModules.SimpleFetch; const fetch = function (url, options) { const params = { url: url, method: options.method ? options.method.toUpperCase() : 'GET', headers: options.headers, timeout: 10000, body: options.body, gzipRequest: true }; console.log(params); return NativeSimpleFetch.sendRequest(params).then((res)=> { console.log(res); const statusCode = parseInt(res[0]); const body = res[1]; return { ok: statusCode >= 200 && statusCode <= 300, status: statusCode, json: ()=> { return new Promise((resolve, reject)=> { try { let obj = JSON.parse(body); resolve(obj); } catch (e) { if (typeof body === 'string') { resolve(body); } else { reject(e); } } }); } }; }, (err)=> { console.log(err); return err; }); }; module.exports = { fetch };
/** * Created by tshen on 16/7/15. */ 'use strict' import {NativeModules} from 'react-native'; const NativeSimpleFetch = NativeModules.SimpleFetch; const fetch = function (url, options) { const params = { url: url, method: options.method ? options.method.toUpperCase() : 'GET', headers: options.headers, timeout: 10000, body: options.body, gzipRequest: true }; return NativeSimpleFetch.sendRequest(params).then((res)=> { const status = parseInt(res[0]); const body = res[1]; return { ok: statusCode >= 200 && statusCode <= 300, status: status, json: ()=> { return new Promise((resolve, reject)=> { try { let obj = JSON.parse(body); resolve(obj); } catch (e) { if (typeof body === 'string') { resolve(body); } else { reject(e); } } }); } }; }); }; module.exports = { fetch };
Fix bug. Remove console logs.
Fix bug. Remove console logs.
JavaScript
mit
liaoyuan-io/react-native-simple-fetch
--- +++ @@ -16,14 +16,12 @@ gzipRequest: true }; - console.log(params); return NativeSimpleFetch.sendRequest(params).then((res)=> { - console.log(res); - const statusCode = parseInt(res[0]); + const status = parseInt(res[0]); const body = res[1]; return { ok: statusCode >= 200 && statusCode <= 300, - status: statusCode, + status: status, json: ()=> { return new Promise((resolve, reject)=> { try { @@ -40,9 +38,6 @@ }); } }; - }, (err)=> { - console.log(err); - return err; }); };
7b50be2427d450460b9b8c8ae8be6c81743bbf48
index.js
index.js
/* jshint node: true */ 'use strict'; // var path = require('path'); module.exports = { name: 'ember-power-select', contentFor: function(type, config) { if (config.environment !== 'test' && type === 'body-footer') { return '<div id="ember-power-select-wormhole"></div>'; } }, included: function(app) { this._super.included(app); // this.app.registry.availablePlugins['ember-cli-sass'] --->' 4.2.1', // I can use this to determine if the consumer app is using sass // and if so take a different approch. }, // treeForStyles: function(){ // debugger; // var tree = new Funnel(this.treePaths['addon-styles'], { // srcDir: '/', // destDir: '/app/styles' // }); // return tree; // } };  
/* jshint node: true */ 'use strict'; // var path = require('path'); module.exports = { name: 'ember-power-select', contentFor: function(type, config) { if (config.environment !== 'test' && type === 'body-footer') { return '<div id="ember-power-select-wormhole"></div>'; } }, included: function(app) { // Don't include the precompiled css file if the user uses ember-cli-sass if (!app.registry.availablePlugins['ember-cli-sass']) { app.import('vendor/ember-power-select.css'); } }, };  
Include precompiled styles automatically for non-sass users
Include precompiled styles automatically for non-sass users
JavaScript
mit
cibernox/ember-power-select,esbanarango/ember-power-select,chrisgame/ember-power-select,esbanarango/ember-power-select,cibernox/ember-power-select,Dremora/ember-power-select,chrisgame/ember-power-select,cibernox/ember-power-select,Dremora/ember-power-select,cibernox/ember-power-select,esbanarango/ember-power-select
--- +++ @@ -12,19 +12,10 @@ }, included: function(app) { - this._super.included(app); - // this.app.registry.availablePlugins['ember-cli-sass'] --->' 4.2.1', - // I can use this to determine if the consumer app is using sass - // and if so take a different approch. + // Don't include the precompiled css file if the user uses ember-cli-sass + if (!app.registry.availablePlugins['ember-cli-sass']) { + app.import('vendor/ember-power-select.css'); + } }, - - // treeForStyles: function(){ - // debugger; - // var tree = new Funnel(this.treePaths['addon-styles'], { - // srcDir: '/', - // destDir: '/app/styles' - // }); - // return tree; - // } };  
429aa690a42e8f0f9282ca4a63bff052e45ea25e
packages/accounts-meetup/meetup_client.js
packages/accounts-meetup/meetup_client.js
(function () { Meteor.loginWithMeetup = function (options, callback) { // support both (options, callback) and (callback). if (!callback && typeof options === 'function') { callback = options; options = {}; } var config = Accounts.loginServiceConfiguration.findOne({service: 'meetup'}); if (!config) { callback && callback(new Accounts.ConfigError("Service not configured")); return; } var state = Random.id(); var scope = (options && options.requestPermissions) || []; var flatScope = _.map(scope, encodeURIComponent).join('+'); var loginUrl = 'https://secure.meetup.com/oauth2/authorize' + '?client_id=' + config.clientId + '&response_type=code' + '&scope=' + flatScope + '&redirect_uri=' + Meteor.absoluteUrl('_oauth/meetup?close') + '&state=' + state; Accounts.oauth.initiateLogin(state, loginUrl, callback, {width: 900, height: 450}); }; }) ();
(function () { Meteor.loginWithMeetup = function (options, callback) { // support both (options, callback) and (callback). if (!callback && typeof options === 'function') { callback = options; options = {}; } var config = Accounts.loginServiceConfiguration.findOne({service: 'meetup'}); if (!config) { callback && callback(new Accounts.ConfigError("Service not configured")); return; } var state = Random.id(); var scope = (options && options.requestPermissions) || []; var flatScope = _.map(scope, encodeURIComponent).join('+'); var loginUrl = 'https://secure.meetup.com/oauth2/authorize' + '?client_id=' + config.clientId + '&response_type=code' + '&scope=' + flatScope + '&redirect_uri=' + Meteor.absoluteUrl('_oauth/meetup?close') + '&state=' + state; // meetup box gets taller when permissions requested. var height = 620; if (_.without(scope, 'basic').length) height += 130; Accounts.oauth.initiateLogin(state, loginUrl, callback, {width: 900, height: height}); }; }) ();
Tweak the height of the popup box. Meetup varies the height of their box based on which permissions are requested.
Tweak the height of the popup box. Meetup varies the height of their box based on which permissions are requested.
JavaScript
mit
aldeed/meteor,sunny-g/meteor,pjump/meteor,shmiko/meteor,esteedqueen/meteor,wmkcc/meteor,framewr/meteor,Profab/meteor,ndarilek/meteor,steedos/meteor,allanalexandre/meteor,daltonrenaldo/meteor,Jonekee/meteor,vjau/meteor,Jeremy017/meteor,devgrok/meteor,jdivy/meteor,allanalexandre/meteor,Prithvi-A/meteor,joannekoong/meteor,modulexcite/meteor,ljack/meteor,TechplexEngineer/meteor,luohuazju/meteor,guazipi/meteor,chiefninew/meteor,chmac/meteor,jg3526/meteor,johnthepink/meteor,framewr/meteor,ndarilek/meteor,dfischer/meteor,nuvipannu/meteor,aramk/meteor,GrimDerp/meteor,deanius/meteor,mauricionr/meteor,judsonbsilva/meteor,youprofit/meteor,alphanso/meteor,deanius/meteor,Quicksteve/meteor,aramk/meteor,TechplexEngineer/meteor,brettle/meteor,mubassirhayat/meteor,guazipi/meteor,baysao/meteor,Eynaliyev/meteor,brdtrpp/meteor,Ken-Liu/meteor,h200863057/meteor,IveWong/meteor,eluck/meteor,zdd910/meteor,shadedprofit/meteor,emmerge/meteor,evilemon/meteor,vacjaliu/meteor,lieuwex/meteor,katopz/meteor,namho102/meteor,Quicksteve/meteor,dev-bobsong/meteor,servel333/meteor,Prithvi-A/meteor,somallg/meteor,lorensr/meteor,yanisIk/meteor,l0rd0fwar/meteor,AnthonyAstige/meteor,dfischer/meteor,michielvanoeffelen/meteor,SeanOceanHu/meteor,ericterpstra/meteor,alphanso/meteor,h200863057/meteor,akintoey/meteor,Hansoft/meteor,tdamsma/meteor,D1no/meteor,luohuazju/meteor,msavin/meteor,emmerge/meteor,sunny-g/meteor,calvintychan/meteor,allanalexandre/meteor,DCKT/meteor,ljack/meteor,Prithvi-A/meteor,ndarilek/meteor,akintoey/meteor,Prithvi-A/meteor,planet-training/meteor,cbonami/meteor,Hansoft/meteor,chasertech/meteor,shadedprofit/meteor,cog-64/meteor,AnjirHossain/meteor,Quicksteve/meteor,AlexR1712/meteor,codingang/meteor,tdamsma/meteor,codedogfish/meteor,dboyliao/meteor,cherbst/meteor,yanisIk/meteor,chengxiaole/meteor,iman-mafi/meteor,alexbeletsky/meteor,yyx990803/meteor,baiyunping333/meteor,cbonami/meteor,karlito40/meteor,meonkeys/meteor,wmkcc/meteor,jg3526/meteor,kencheung/meteor,dandv/meteor,Theviajerock/meteor,johnthepink/meteor,justintung/meteor,Paulyoufu/meteor-1,brdtrpp/meteor,akintoey/meteor,pandeysoni/meteor,l0rd0fwar/meteor,Hansoft/meteor,iman-mafi/meteor,guazipi/meteor,rabbyalone/meteor,somallg/meteor,codingang/meteor,chinasb/meteor,chiefninew/meteor,chengxiaole/meteor,Prithvi-A/meteor,meteor-velocity/meteor,qscripter/meteor,guazipi/meteor,devgrok/meteor,AnthonyAstige/meteor,aldeed/meteor,ndarilek/meteor,eluck/meteor,namho102/meteor,vacjaliu/meteor,AnjirHossain/meteor,bhargav175/meteor,michielvanoeffelen/meteor,Ken-Liu/meteor,somallg/meteor,codedogfish/meteor,deanius/meteor,emmerge/meteor,lorensr/meteor,Profab/meteor,lassombra/meteor,ashwathgovind/meteor,kidaa/meteor,oceanzou123/meteor,luohuazju/meteor,judsonbsilva/meteor,EduShareOntario/meteor,PatrickMcGuinness/meteor,saisai/meteor,justintung/meteor,shmiko/meteor,lpinto93/meteor,lassombra/meteor,benstoltz/meteor,mirstan/meteor,udhayam/meteor,dfischer/meteor,sclausen/meteor,Paulyoufu/meteor-1,newswim/meteor,jirengu/meteor,youprofit/meteor,chinasb/meteor,vjau/meteor,evilemon/meteor,TechplexEngineer/meteor,jdivy/meteor,jirengu/meteor,l0rd0fwar/meteor,yanisIk/meteor,saisai/meteor,namho102/meteor,michielvanoeffelen/meteor,msavin/meteor,alphanso/meteor,Theviajerock/meteor,servel333/meteor,Jeremy017/meteor,JesseQin/meteor,qscripter/meteor,IveWong/meteor,sitexa/meteor,brettle/meteor,mirstan/meteor,colinligertwood/meteor,dandv/meteor,chasertech/meteor,HugoRLopes/meteor,sitexa/meteor,yiliaofan/meteor,sdeveloper/meteor,justintung/meteor,h200863057/meteor,yalexx/meteor,h200863057/meteor,judsonbsilva/meteor,joannekoong/meteor,jenalgit/meteor,mauricionr/meteor,mirstan/meteor,Profab/meteor,EduShareOntario/meteor,SeanOceanHu/meteor,henrypan/meteor,neotim/meteor,justintung/meteor,baiyunping333/meteor,steedos/meteor,pjump/meteor,Profab/meteor,dev-bobsong/meteor,yanisIk/meteor,TribeMedia/meteor,yonglehou/meteor,mauricionr/meteor,DAB0mB/meteor,sunny-g/meteor,sitexa/meteor,whip112/meteor,steedos/meteor,EduShareOntario/meteor,aldeed/meteor,imanmafi/meteor,l0rd0fwar/meteor,tdamsma/meteor,allanalexandre/meteor,evilemon/meteor,neotim/meteor,eluck/meteor,paul-barry-kenzan/meteor,Puena/meteor,sclausen/meteor,Eynaliyev/meteor,skarekrow/meteor,lassombra/meteor,4commerce-technologies-AG/meteor,namho102/meteor,pandeysoni/meteor,michielvanoeffelen/meteor,l0rd0fwar/meteor,codingang/meteor,AnjirHossain/meteor,jirengu/meteor,chengxiaole/meteor,baysao/meteor,judsonbsilva/meteor,Hansoft/meteor,saisai/meteor,SeanOceanHu/meteor,brdtrpp/meteor,henrypan/meteor,vjau/meteor,paul-barry-kenzan/meteor,dfischer/meteor,chengxiaole/meteor,saisai/meteor,HugoRLopes/meteor,brettle/meteor,Ken-Liu/meteor,PatrickMcGuinness/meteor,DAB0mB/meteor,jirengu/meteor,JesseQin/meteor,namho102/meteor,jdivy/meteor,Jeremy017/meteor,yanisIk/meteor,JesseQin/meteor,Paulyoufu/meteor-1,kencheung/meteor,kengchau/meteor,dboyliao/meteor,TribeMedia/meteor,Urigo/meteor,elkingtonmcb/meteor,vjau/meteor,aleclarson/meteor,queso/meteor,henrypan/meteor,hristaki/meteor,framewr/meteor,yiliaofan/meteor,oceanzou123/meteor,luohuazju/meteor,eluck/meteor,chengxiaole/meteor,Puena/meteor,youprofit/meteor,evilemon/meteor,bhargav175/meteor,Eynaliyev/meteor,devgrok/meteor,lpinto93/meteor,nuvipannu/meteor,yonglehou/meteor,IveWong/meteor,sdeveloper/meteor,elkingtonmcb/meteor,nuvipannu/meteor,cbonami/meteor,Urigo/meteor,Jonekee/meteor,kencheung/meteor,yalexx/meteor,jenalgit/meteor,lassombra/meteor,justintung/meteor,kengchau/meteor,elkingtonmcb/meteor,somallg/meteor,deanius/meteor,calvintychan/meteor,yinhe007/meteor,Puena/meteor,queso/meteor,esteedqueen/meteor,rozzzly/meteor,msavin/meteor,Paulyoufu/meteor-1,katopz/meteor,jirengu/meteor,benjamn/meteor,aldeed/meteor,ashwathgovind/meteor,TechplexEngineer/meteor,codedogfish/meteor,framewr/meteor,jdivy/meteor,colinligertwood/meteor,qscripter/meteor,JesseQin/meteor,Eynaliyev/meteor,DAB0mB/meteor,jeblister/meteor,shrop/meteor,modulexcite/meteor,servel333/meteor,paul-barry-kenzan/meteor,lieuwex/meteor,karlito40/meteor,shmiko/meteor,Theviajerock/meteor,sdeveloper/meteor,aldeed/meteor,imanmafi/meteor,AnthonyAstige/meteor,DCKT/meteor,brdtrpp/meteor,neotim/meteor,LWHTarena/meteor,Puena/meteor,oceanzou123/meteor,whip112/meteor,kidaa/meteor,AnthonyAstige/meteor,dboyliao/meteor,Quicksteve/meteor,planet-training/meteor,sitexa/meteor,somallg/meteor,fashionsun/meteor,yonglehou/meteor,IveWong/meteor,fashionsun/meteor,tdamsma/meteor,luohuazju/meteor,johnthepink/meteor,benstoltz/meteor,joannekoong/meteor,esteedqueen/meteor,sclausen/meteor,newswim/meteor,mubassirhayat/meteor,kidaa/meteor,qscripter/meteor,chiefninew/meteor,yiliaofan/meteor,jrudio/meteor,TribeMedia/meteor,oceanzou123/meteor,akintoey/meteor,wmkcc/meteor,benstoltz/meteor,esteedqueen/meteor,allanalexandre/meteor,dboyliao/meteor,dandv/meteor,meonkeys/meteor,jirengu/meteor,GrimDerp/meteor,LWHTarena/meteor,AlexR1712/meteor,vjau/meteor,D1no/meteor,pandeysoni/meteor,jenalgit/meteor,chmac/meteor,pandeysoni/meteor,sclausen/meteor,ljack/meteor,ljack/meteor,SeanOceanHu/meteor,yonas/meteor-freebsd,saisai/meteor,planet-training/meteor,aleclarson/meteor,tdamsma/meteor,dandv/meteor,guazipi/meteor,fashionsun/meteor,elkingtonmcb/meteor,modulexcite/meteor,mubassirhayat/meteor,emmerge/meteor,yanisIk/meteor,zdd910/meteor,juansgaitan/meteor,mubassirhayat/meteor,daltonrenaldo/meteor,Profab/meteor,hristaki/meteor,4commerce-technologies-AG/meteor,HugoRLopes/meteor,brdtrpp/meteor,hristaki/meteor,oceanzou123/meteor,steedos/meteor,Puena/meteor,wmkcc/meteor,iman-mafi/meteor,pjump/meteor,aramk/meteor,judsonbsilva/meteor,yanisIk/meteor,juansgaitan/meteor,judsonbsilva/meteor,aldeed/meteor,luohuazju/meteor,TribeMedia/meteor,karlito40/meteor,queso/meteor,calvintychan/meteor,karlito40/meteor,yonas/meteor-freebsd,cog-64/meteor,jenalgit/meteor,bhargav175/meteor,skarekrow/meteor,papimomi/meteor,lieuwex/meteor,jrudio/meteor,imanmafi/meteor,yalexx/meteor,daltonrenaldo/meteor,karlito40/meteor,hristaki/meteor,TechplexEngineer/meteor,daltonrenaldo/meteor,alexbeletsky/meteor,kengchau/meteor,jagi/meteor,newswim/meteor,meonkeys/meteor,nuvipannu/meteor,jenalgit/meteor,devgrok/meteor,pjump/meteor,vjau/meteor,modulexcite/meteor,lawrenceAIO/meteor,chiefninew/meteor,EduShareOntario/meteor,papimomi/meteor,johnthepink/meteor,mirstan/meteor,yalexx/meteor,Quicksteve/meteor,namho102/meteor,AnthonyAstige/meteor,benjamn/meteor,michielvanoeffelen/meteor,servel333/meteor,JesseQin/meteor,wmkcc/meteor,michielvanoeffelen/meteor,shrop/meteor,steedos/meteor,mirstan/meteor,HugoRLopes/meteor,alphanso/meteor,colinligertwood/meteor,stevenliuit/meteor,calvintychan/meteor,servel333/meteor,brettle/meteor,D1no/meteor,Eynaliyev/meteor,dboyliao/meteor,skarekrow/meteor,codingang/meteor,zdd910/meteor,Jonekee/meteor,paul-barry-kenzan/meteor,williambr/meteor,jagi/meteor,meonkeys/meteor,jdivy/meteor,dev-bobsong/meteor,SeanOceanHu/meteor,codingang/meteor,Urigo/meteor,Eynaliyev/meteor,HugoRLopes/meteor,EduShareOntario/meteor,brettle/meteor,GrimDerp/meteor,IveWong/meteor,arunoda/meteor,SeanOceanHu/meteor,framewr/meteor,Jonekee/meteor,yyx990803/meteor,lassombra/meteor,sdeveloper/meteor,TribeMedia/meteor,Theviajerock/meteor,servel333/meteor,alphanso/meteor,udhayam/meteor,shmiko/meteor,meteor-velocity/meteor,yonas/meteor-freebsd,yonas/meteor-freebsd,mjmasn/meteor,brdtrpp/meteor,rozzzly/meteor,yinhe007/meteor,lieuwex/meteor,mirstan/meteor,HugoRLopes/meteor,benjamn/meteor,yyx990803/meteor,kidaa/meteor,mubassirhayat/meteor,cog-64/meteor,arunoda/meteor,brdtrpp/meteor,eluck/meteor,queso/meteor,dev-bobsong/meteor,papimomi/meteor,bhargav175/meteor,imanmafi/meteor,chinasb/meteor,cog-64/meteor,D1no/meteor,tdamsma/meteor,johnthepink/meteor,codedogfish/meteor,yyx990803/meteor,ljack/meteor,daslicht/meteor,vacjaliu/meteor,karlito40/meteor,sclausen/meteor,dandv/meteor,yonglehou/meteor,AlexR1712/meteor,daslicht/meteor,kengchau/meteor,lpinto93/meteor,kengchau/meteor,lorensr/meteor,lpinto93/meteor,meonkeys/meteor,newswim/meteor,sdeveloper/meteor,wmkcc/meteor,AnjirHossain/meteor,guazipi/meteor,neotim/meteor,cog-64/meteor,jagi/meteor,lawrenceAIO/meteor,Ken-Liu/meteor,ndarilek/meteor,ericterpstra/meteor,jeblister/meteor,DCKT/meteor,colinligertwood/meteor,pandeysoni/meteor,ashwathgovind/meteor,h200863057/meteor,mjmasn/meteor,Eynaliyev/meteor,benjamn/meteor,Paulyoufu/meteor-1,somallg/meteor,chasertech/meteor,planet-training/meteor,nuvipannu/meteor,chasertech/meteor,imanmafi/meteor,mubassirhayat/meteor,kengchau/meteor,4commerce-technologies-AG/meteor,jg3526/meteor,chmac/meteor,chiefninew/meteor,daslicht/meteor,dfischer/meteor,judsonbsilva/meteor,ashwathgovind/meteor,deanius/meteor,chiefninew/meteor,colinligertwood/meteor,DAB0mB/meteor,chmac/meteor,sunny-g/meteor,youprofit/meteor,brdtrpp/meteor,shadedprofit/meteor,lorensr/meteor,framewr/meteor,lawrenceAIO/meteor,shrop/meteor,shrop/meteor,zdd910/meteor,Quicksteve/meteor,ljack/meteor,qscripter/meteor,justintung/meteor,johnthepink/meteor,benjamn/meteor,arunoda/meteor,yinhe007/meteor,rabbyalone/meteor,benjamn/meteor,stevenliuit/meteor,codingang/meteor,brettle/meteor,saisai/meteor,modulexcite/meteor,imanmafi/meteor,yanisIk/meteor,lawrenceAIO/meteor,modulexcite/meteor,shadedprofit/meteor,PatrickMcGuinness/meteor,yyx990803/meteor,D1no/meteor,hristaki/meteor,daslicht/meteor,allanalexandre/meteor,IveWong/meteor,somallg/meteor,msavin/meteor,yalexx/meteor,Urigo/meteor,chinasb/meteor,shmiko/meteor,cbonami/meteor,4commerce-technologies-AG/meteor,ashwathgovind/meteor,h200863057/meteor,Profab/meteor,chasertech/meteor,baiyunping333/meteor,jg3526/meteor,lorensr/meteor,TribeMedia/meteor,queso/meteor,iman-mafi/meteor,cherbst/meteor,jenalgit/meteor,daltonrenaldo/meteor,calvintychan/meteor,benstoltz/meteor,GrimDerp/meteor,Theviajerock/meteor,cbonami/meteor,benstoltz/meteor,chiefninew/meteor,jirengu/meteor,PatrickMcGuinness/meteor,yiliaofan/meteor,yinhe007/meteor,jeblister/meteor,lieuwex/meteor,codedogfish/meteor,jg3526/meteor,SeanOceanHu/meteor,SeanOceanHu/meteor,pandeysoni/meteor,Hansoft/meteor,jagi/meteor,arunoda/meteor,calvintychan/meteor,AnthonyAstige/meteor,Puena/meteor,guazipi/meteor,williambr/meteor,dboyliao/meteor,jg3526/meteor,baysao/meteor,LWHTarena/meteor,dandv/meteor,l0rd0fwar/meteor,lawrenceAIO/meteor,stevenliuit/meteor,kencheung/meteor,arunoda/meteor,hristaki/meteor,akintoey/meteor,luohuazju/meteor,ericterpstra/meteor,henrypan/meteor,alexbeletsky/meteor,steedos/meteor,GrimDerp/meteor,meteor-velocity/meteor,qscripter/meteor,justintung/meteor,chasertech/meteor,queso/meteor,aramk/meteor,daltonrenaldo/meteor,namho102/meteor,meteor-velocity/meteor,mubassirhayat/meteor,stevenliuit/meteor,yiliaofan/meteor,benjamn/meteor,rozzzly/meteor,kencheung/meteor,Urigo/meteor,joannekoong/meteor,cherbst/meteor,newswim/meteor,Puena/meteor,udhayam/meteor,emmerge/meteor,alexbeletsky/meteor,katopz/meteor,Jeremy017/meteor,esteedqueen/meteor,daltonrenaldo/meteor,yinhe007/meteor,Theviajerock/meteor,arunoda/meteor,meteor-velocity/meteor,yalexx/meteor,yiliaofan/meteor,sdeveloper/meteor,daltonrenaldo/meteor,framewr/meteor,JesseQin/meteor,evilemon/meteor,jagi/meteor,akintoey/meteor,mjmasn/meteor,4commerce-technologies-AG/meteor,williambr/meteor,chmac/meteor,oceanzou123/meteor,planet-training/meteor,bhargav175/meteor,mauricionr/meteor,shrop/meteor,newswim/meteor,Eynaliyev/meteor,IveWong/meteor,jdivy/meteor,chinasb/meteor,yonas/meteor-freebsd,henrypan/meteor,williambr/meteor,nuvipannu/meteor,msavin/meteor,ljack/meteor,l0rd0fwar/meteor,yonglehou/meteor,alphanso/meteor,johnthepink/meteor,sclausen/meteor,planet-training/meteor,papimomi/meteor,newswim/meteor,h200863057/meteor,karlito40/meteor,Paulyoufu/meteor-1,Prithvi-A/meteor,wmkcc/meteor,jeblister/meteor,katopz/meteor,lieuwex/meteor,meonkeys/meteor,katopz/meteor,rozzzly/meteor,chmac/meteor,baiyunping333/meteor,dfischer/meteor,JesseQin/meteor,emmerge/meteor,meteor-velocity/meteor,skarekrow/meteor,TechplexEngineer/meteor,rabbyalone/meteor,neotim/meteor,dandv/meteor,ashwathgovind/meteor,AnjirHossain/meteor,AlexR1712/meteor,ndarilek/meteor,PatrickMcGuinness/meteor,tdamsma/meteor,lorensr/meteor,jenalgit/meteor,arunoda/meteor,lawrenceAIO/meteor,mauricionr/meteor,Ken-Liu/meteor,rabbyalone/meteor,rabbyalone/meteor,ericterpstra/meteor,D1no/meteor,elkingtonmcb/meteor,tdamsma/meteor,HugoRLopes/meteor,michielvanoeffelen/meteor,AlexR1712/meteor,daslicht/meteor,yyx990803/meteor,servel333/meteor,Jonekee/meteor,Profab/meteor,D1no/meteor,udhayam/meteor,mubassirhayat/meteor,EduShareOntario/meteor,Jeremy017/meteor,henrypan/meteor,dboyliao/meteor,TechplexEngineer/meteor,alphanso/meteor,skarekrow/meteor,codedogfish/meteor,williambr/meteor,cog-64/meteor,DCKT/meteor,benstoltz/meteor,elkingtonmcb/meteor,baysao/meteor,dev-bobsong/meteor,joannekoong/meteor,deanius/meteor,alexbeletsky/meteor,whip112/meteor,esteedqueen/meteor,stevenliuit/meteor,jrudio/meteor,pjump/meteor,evilemon/meteor,Quicksteve/meteor,shmiko/meteor,Hansoft/meteor,jagi/meteor,lieuwex/meteor,alexbeletsky/meteor,chinasb/meteor,eluck/meteor,cbonami/meteor,cherbst/meteor,sunny-g/meteor,skarekrow/meteor,brettle/meteor,papimomi/meteor,devgrok/meteor,chinasb/meteor,zdd910/meteor,dboyliao/meteor,mauricionr/meteor,juansgaitan/meteor,Urigo/meteor,yonglehou/meteor,GrimDerp/meteor,iman-mafi/meteor,yonglehou/meteor,cog-64/meteor,chengxiaole/meteor,aldeed/meteor,rabbyalone/meteor,shmiko/meteor,jeblister/meteor,williambr/meteor,sunny-g/meteor,pjump/meteor,PatrickMcGuinness/meteor,LWHTarena/meteor,AnjirHossain/meteor,DCKT/meteor,ericterpstra/meteor,youprofit/meteor,cherbst/meteor,zdd910/meteor,lpinto93/meteor,papimomi/meteor,eluck/meteor,evilemon/meteor,baiyunping333/meteor,Urigo/meteor,youprofit/meteor,udhayam/meteor,chengxiaole/meteor,udhayam/meteor,benstoltz/meteor,pjump/meteor,servel333/meteor,hristaki/meteor,kidaa/meteor,whip112/meteor,Prithvi-A/meteor,AlexR1712/meteor,D1no/meteor,lorensr/meteor,AlexR1712/meteor,4commerce-technologies-AG/meteor,yiliaofan/meteor,AnthonyAstige/meteor,saisai/meteor,DAB0mB/meteor,oceanzou123/meteor,jrudio/meteor,katopz/meteor,cbonami/meteor,LWHTarena/meteor,shadedprofit/meteor,dev-bobsong/meteor,sunny-g/meteor,shrop/meteor,nuvipannu/meteor,baiyunping333/meteor,chiefninew/meteor,papimomi/meteor,baysao/meteor,juansgaitan/meteor,karlito40/meteor,msavin/meteor,Jonekee/meteor,HugoRLopes/meteor,colinligertwood/meteor,LWHTarena/meteor,rozzzly/meteor,allanalexandre/meteor,yinhe007/meteor,whip112/meteor,sclausen/meteor,joannekoong/meteor,Jeremy017/meteor,DAB0mB/meteor,codingang/meteor,henrypan/meteor,msavin/meteor,Jeremy017/meteor,sdeveloper/meteor,sitexa/meteor,GrimDerp/meteor,meonkeys/meteor,fashionsun/meteor,devgrok/meteor,ashwathgovind/meteor,modulexcite/meteor,mauricionr/meteor,Paulyoufu/meteor-1,lpinto93/meteor,pandeysoni/meteor,whip112/meteor,mjmasn/meteor,TribeMedia/meteor,4commerce-technologies-AG/meteor,calvintychan/meteor,youprofit/meteor,udhayam/meteor,rozzzly/meteor,aramk/meteor,stevenliuit/meteor,skarekrow/meteor,eluck/meteor,DCKT/meteor,cherbst/meteor,yalexx/meteor,baysao/meteor,mirstan/meteor,shrop/meteor,williambr/meteor,aramk/meteor,codedogfish/meteor,mjmasn/meteor,daslicht/meteor,bhargav175/meteor,iman-mafi/meteor,vjau/meteor,shadedprofit/meteor,jrudio/meteor,Jonekee/meteor,rozzzly/meteor,paul-barry-kenzan/meteor,somallg/meteor,chmac/meteor,yinhe007/meteor,katopz/meteor,sitexa/meteor,juansgaitan/meteor,fashionsun/meteor,mjmasn/meteor,mjmasn/meteor,esteedqueen/meteor,alexbeletsky/meteor,rabbyalone/meteor,planet-training/meteor,baysao/meteor,jeblister/meteor,dev-bobsong/meteor,kencheung/meteor,Ken-Liu/meteor,colinligertwood/meteor,yonas/meteor-freebsd,yyx990803/meteor,fashionsun/meteor,meteor-velocity/meteor,lpinto93/meteor,fashionsun/meteor,Hansoft/meteor,daslicht/meteor,alexbeletsky/meteor,jdivy/meteor,vacjaliu/meteor,ericterpstra/meteor,vacjaliu/meteor,neotim/meteor,juansgaitan/meteor,AnjirHossain/meteor,devgrok/meteor,imanmafi/meteor,iman-mafi/meteor,lassombra/meteor,joannekoong/meteor,Ken-Liu/meteor,ndarilek/meteor,juansgaitan/meteor,paul-barry-kenzan/meteor,sunny-g/meteor,kidaa/meteor,lassombra/meteor,EduShareOntario/meteor,deanius/meteor,steedos/meteor,whip112/meteor,stevenliuit/meteor,jg3526/meteor,jeblister/meteor,yonas/meteor-freebsd,akintoey/meteor,AnthonyAstige/meteor,Theviajerock/meteor,vacjaliu/meteor,kidaa/meteor,ljack/meteor,lawrenceAIO/meteor,sitexa/meteor,shadedprofit/meteor,jagi/meteor,bhargav175/meteor,ndarilek/meteor,baiyunping333/meteor,ericterpstra/meteor,allanalexandre/meteor,vacjaliu/meteor,queso/meteor,zdd910/meteor,qscripter/meteor,emmerge/meteor,jrudio/meteor,LWHTarena/meteor,neotim/meteor,aramk/meteor,elkingtonmcb/meteor,DAB0mB/meteor,dfischer/meteor,planet-training/meteor,DCKT/meteor,PatrickMcGuinness/meteor,aleclarson/meteor,cherbst/meteor,kencheung/meteor,chasertech/meteor,paul-barry-kenzan/meteor,kengchau/meteor
--- +++ @@ -24,6 +24,12 @@ '&redirect_uri=' + Meteor.absoluteUrl('_oauth/meetup?close') + '&state=' + state; - Accounts.oauth.initiateLogin(state, loginUrl, callback, {width: 900, height: 450}); + // meetup box gets taller when permissions requested. + var height = 620; + if (_.without(scope, 'basic').length) + height += 130; + + Accounts.oauth.initiateLogin(state, loginUrl, callback, + {width: 900, height: height}); }; }) ();
5317b7fb100af66af865bcd82ed32c2dc3a1643c
index.js
index.js
var elixir = require('laravel-elixir'); var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var pngquant = require('imagemin-pngquant'); var notify = require('gulp-notify'); var _ = require('underscore'); var utilities = require('laravel-elixir/ingredients/helpers/utilities'); /* |---------------------------------------------------------------- | ImageMin Processor |---------------------------------------------------------------- | | This task will trigger your images to be processed using | imagemin processor. | | Minify PNG, JPEG, GIF and SVG images | */ elixir.extend('imagemin', function(src, output, options) { var config = this; var baseDir = config.assetsDir + 'img'; src = utilities.buildGulpSrc(src, baseDir, '**/*'); options = _.extend({ progressive: true, svgoPlugins: [{removeViewBox: false}], use: [pngquant()] }, options); gulp.task('imagemin', function() { return gulp.src(src) .pipe(imagemin(options)) .pipe(gulp.dest(output || 'public/img')) .pipe(notify({ title: 'ImageMin Complete!', message: 'All images have be optimised.', icon: __dirname + '/../laravel-elixir/icons/pass.png' })); }); this.registerWatcher('imagemin', [ baseDir + '/**/*.png', baseDir + '/**/*.gif', baseDir + '/**/*.svg', baseDir + '/**/*.jpg', baseDir + '/**/*.jpeg' ]); return this.queueTask('imagemin'); });
var elixir = require('laravel-elixir'); var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var pngquant = require('imagemin-pngquant'); var notify = require('gulp-notify'); var _ = require('underscore'); var utilities = require('laravel-elixir/ingredients/commands/utilities'); /* |---------------------------------------------------------------- | ImageMin Processor |---------------------------------------------------------------- | | This task will trigger your images to be processed using | imagemin processor. | | Minify PNG, JPEG, GIF and SVG images | */ elixir.extend('imagemin', function(src, output, options) { var config = this; var baseDir = config.assetsDir + 'img'; src = utilities.buildGulpSrc(src, baseDir, '**/*'); options = _.extend({ progressive: true, svgoPlugins: [{removeViewBox: false}], use: [pngquant()] }, options); gulp.task('imagemin', function() { return gulp.src(src) .pipe(imagemin(options)) .pipe(gulp.dest(output || 'public/img')) .pipe(notify({ title: 'ImageMin Complete!', message: 'All images have be optimised.', icon: __dirname + '/../laravel-elixir/icons/pass.png' })); }); this.registerWatcher('imagemin', [ baseDir + '/**/*.png', baseDir + '/**/*.gif', baseDir + '/**/*.svg', baseDir + '/**/*.jpg', baseDir + '/**/*.jpeg' ]); return this.queueTask('imagemin'); });
Fix utilities path from helpers to commands
Fix utilities path from helpers to commands
JavaScript
mit
waldemarfm/laravel-elixir-imagemin,nathanmac/laravel-elixir-imagemin
--- +++ @@ -4,7 +4,7 @@ var pngquant = require('imagemin-pngquant'); var notify = require('gulp-notify'); var _ = require('underscore'); -var utilities = require('laravel-elixir/ingredients/helpers/utilities'); +var utilities = require('laravel-elixir/ingredients/commands/utilities'); /* |----------------------------------------------------------------
e5b7f40ea0e1751213048b3d50e49dc36438c3e3
website/src/app/project/experiments/experiment/components/notes/mc-experiment-notes.component.js
website/src/app/project/experiments/experiment/components/notes/mc-experiment-notes.component.js
angular.module('materialscommons').component('mcExperimentNotes', { templateUrl: 'app/project/experiments/experiment/components/notes/mc-experiment-notes.html', bindings: { experiment: '=' } });
angular.module('materialscommons').component('mcExperimentNotes', { templateUrl: 'app/project/experiments/experiment/components/notes/mc-experiment-notes.html', controller: MCExperimentNotesComponentController, bindings: { experiment: '=' } }); class MCExperimentNotesComponentController { /*@ngInject*/ constructor($scope) { $scope.editorOptions = {}; } addNote() { } }
Add controller (to be filled out).
Add controller (to be filled out).
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -1,6 +1,18 @@ angular.module('materialscommons').component('mcExperimentNotes', { templateUrl: 'app/project/experiments/experiment/components/notes/mc-experiment-notes.html', + controller: MCExperimentNotesComponentController, bindings: { experiment: '=' } }); + +class MCExperimentNotesComponentController { + /*@ngInject*/ + constructor($scope) { + $scope.editorOptions = {}; + } + + addNote() { + + } +}
a91e08c79733eac0ff55f16840bbefc39adb6aa8
index.js
index.js
const vm = require('vm') module.exports = class Guards { constructor () { this.guardRegex = /[^=<>!']=[^=]/ this.templateRegex = /[^|]\|[^|]/ this.optionsVM = { displayErrors: true, filename: 'guards' } } getStack () { const origin = Error.prepareStackTrace const error = new Error() Error.prepareStackTrace = (_, stack) => stack Error.captureStackTrace(error, this.getStack) const stack = error.stack Error.prepareStackTrace = origin // V8 stack traces. return stack } equal (constants) { return template => { const guards = this.parse(template.raw[0]) const lineOffset = this.getStack()[1].getLineNumber() const firstTruthyGuard = ( guards.map( g => this.runInVM(g.eval, constants, lineOffset) ) ).findIndex(a => a === true) if (firstTruthyGuard === -1) this.error(`Non-exhaustive patterns in guards at line ${lineOffset}!`) // First truthy guard is returned, like in Haskell. return guards[firstTruthyGuard].result } } error (e) { console.error(e) process.exit(1) } parse (template) { // Inline guards need filtering. return template .split(this.templateRegex) .filter(g => g.trim() !== '') .map((g, i) => { // Remove break line and extract the guard. const parts = g.trim().split(this.guardRegex) return { eval: parts[0], result: JSON.parse(`${parts[1].trim().replace(/'/g, '"')}`) } }) } runInVM (code, sandbox, lineOffset) { const options = Object.assign({}, this.optionsVM, { lineOffset: lineOffset }) return vm.runInNewContext(code, sandbox, options) } }
class Guards { constructor () { this.guardRegex = /[^=<>!']=[^=]/ this.templateRegex = /[^|]\|[^|]/ } buildPredicate (constants, guard) { return new Function( '', [ `const { ${this.destructureProps(constants)} } = ${JSON.stringify(constants)}`, `return ${guard}` ].join(';') ) } destructureProps (constants) { return Object.keys(constants).join(',') } equal (constants) { const self = this // Inline guards need filtering. return template => template.raw[0] .split(this.templateRegex) .filter(g => g.trim() !== '') .map((g, i) => { // Remove break line and extract the guard. const parts = g.trim().split(this.guardRegex) return [ parts[0], JSON.parse(`${parts[1].trim().replace(/'/g, '"')}`) ] }) .find(g => self.buildPredicate(constants, g[0])())[1] } } module.exports = (c, t) => (new Guards()).equal(c, t)
Drop v8 vm for native implementation, update tests accordingly :rocket:.
Drop v8 vm for native implementation, update tests accordingly :rocket:. - Implements and closes #1 by @edmulraney. - Better performance & browser support.
JavaScript
mit
yamafaktory/pattern-guard
--- +++ @@ -1,75 +1,42 @@ -const vm = require('vm') - -module.exports = class Guards { +class Guards { constructor () { this.guardRegex = /[^=<>!']=[^=]/ this.templateRegex = /[^|]\|[^|]/ - - this.optionsVM = { - displayErrors: true, - filename: 'guards' - } } - getStack () { - const origin = Error.prepareStackTrace - const error = new Error() + buildPredicate (constants, guard) { + return new Function( + '', + [ + `const { ${this.destructureProps(constants)} } = ${JSON.stringify(constants)}`, + `return ${guard}` + ].join(';') + ) + } - Error.prepareStackTrace = (_, stack) => stack - - Error.captureStackTrace(error, this.getStack) - - const stack = error.stack - - Error.prepareStackTrace = origin - - // V8 stack traces. - return stack + destructureProps (constants) { + return Object.keys(constants).join(',') } equal (constants) { - return template => { - const guards = this.parse(template.raw[0]) - const lineOffset = this.getStack()[1].getLineNumber() - const firstTruthyGuard = ( - guards.map( - g => this.runInVM(g.eval, constants, lineOffset) - ) - ).findIndex(a => a === true) + const self = this - if (firstTruthyGuard === -1) this.error(`Non-exhaustive patterns in guards at line ${lineOffset}!`) - - // First truthy guard is returned, like in Haskell. - return guards[firstTruthyGuard].result - } - } - - error (e) { - console.error(e) - - process.exit(1) - } - - parse (template) { // Inline guards need filtering. - return template + return template => template.raw[0] .split(this.templateRegex) .filter(g => g.trim() !== '') .map((g, i) => { // Remove break line and extract the guard. const parts = g.trim().split(this.guardRegex) - return { - eval: parts[0], - result: JSON.parse(`${parts[1].trim().replace(/'/g, '"')}`) - } + return [ + parts[0], + JSON.parse(`${parts[1].trim().replace(/'/g, '"')}`) + ] }) - } - - runInVM (code, sandbox, lineOffset) { - const options = Object.assign({}, this.optionsVM, { lineOffset: lineOffset }) - - return vm.runInNewContext(code, sandbox, options) + .find(g => self.buildPredicate(constants, g[0])())[1] } } + +module.exports = (c, t) => (new Guards()).equal(c, t)
e3a2c979b160201b53cb38660733f495be2b449a
index.js
index.js
'use strict'; var extend = require('extend'); var express = require('express'); var bodyParser = require('body-parser'); var router = express.Router(); var defaults = { loginEndpoint: '/login', logoutEndpoint: '/logout', idField: 'email', passwordField: 'password' }; module.exports = function (options) { options = options || {}; options = extend({}, defaults, options); router.use(bodyParser.json()); router.use(bodyParser.urlencoded({ extended: false })); router.post(options.loginEndpoint, function (req, res) { var body = req.body; var idField = options.idField; var passwordField = options.passwordField; if (body[idField] && body[passwordField]) { res.json('ok'); } else { res.status(400).json('Invalid arguments, expected `' + idField + '` and `' + passwordField + '` to be present.'); } }); router.post(options.logoutEndpoint, function (req, res) { }); return router; };
'use strict'; var extend = require('extend'); var express = require('express'); var bodyParser = require('body-parser'); var bcrypt = require('bcrypt'); var router = express.Router(); var defaults = { loginEndpoint: '/login', logoutEndpoint: '/logout', idField: 'email', passwordField: 'password', passwordHashField: 'password_hash' }; module.exports = function (options) { options = options || {}; options = extend({}, defaults, options); var getUser = options.getUser; var validatePassword = options.validatePassword || bcrypt.compareSync; // Setup router specific middleware router.use(bodyParser.json()); router.use(bodyParser.urlencoded({ extended: false })); // Login endpoints router.post(options.loginEndpoint, function (req, res) { var body = req.body; var idField = options.idField; var passwordField = options.passwordField; var id = body[idField]; var password = body[passwordField]; if (id && password) { getUser(id, function (err, user) { if (err) { return res.status(500).json(err); } var hash; if (!user || user[options.passwordHashField]) { hash = user[options.passwordHashField]; if (validatePassword(password, hash)) { delete user[options.passwordHashField]; res.json({ user: user }); } else { res.status(401).json('Unauthorized'); } } else { res.status(400).json('Invalid user data.'); } }); } else { res.status(400).json('Invalid arguments, expected `' + idField + '` and `' + passwordField + '` to be present.'); } }); router.post(options.logoutEndpoint, function (req, res) { }); return router; };
Add getUser and validatePassword to login
Add getUser and validatePassword to login
JavaScript
isc
knownasilya/just-auth
--- +++ @@ -3,31 +3,62 @@ var extend = require('extend'); var express = require('express'); var bodyParser = require('body-parser'); +var bcrypt = require('bcrypt'); var router = express.Router(); var defaults = { loginEndpoint: '/login', logoutEndpoint: '/logout', idField: 'email', - passwordField: 'password' + passwordField: 'password', + passwordHashField: 'password_hash' }; module.exports = function (options) { options = options || {}; options = extend({}, defaults, options); + var getUser = options.getUser; + var validatePassword = options.validatePassword || bcrypt.compareSync; + + // Setup router specific middleware router.use(bodyParser.json()); router.use(bodyParser.urlencoded({ extended: false })); + // Login endpoints router.post(options.loginEndpoint, function (req, res) { var body = req.body; var idField = options.idField; var passwordField = options.passwordField; + var id = body[idField]; + var password = body[passwordField]; - if (body[idField] && body[passwordField]) { - res.json('ok'); + if (id && password) { + getUser(id, function (err, user) { + if (err) { + return res.status(500).json(err); + } + + var hash; + + if (!user || user[options.passwordHashField]) { + hash = user[options.passwordHashField]; + + if (validatePassword(password, hash)) { + delete user[options.passwordHashField]; + + res.json({ user: user }); + } + else { + res.status(401).json('Unauthorized'); + } + } + else { + res.status(400).json('Invalid user data.'); + } + }); } else { res.status(400).json('Invalid arguments, expected `' + idField + '` and `' + passwordField + '` to be present.');
a3fd89525c5eb04e8bdcc5289fbe1e907d038821
src/plugins/plugin-shim.js
src/plugins/plugin-shim.js
/** * Add shim config for configuring the dependencies and exports for * older, traditional "browser globals" scripts that do not use define() * to declare the dependencies and set a module value. */ (function(seajs, global) { // seajs.config({ // alias: { // "jquery": { // src: "lib/jquery.js", // exports: "jQuery" or function // }, // "jquery.easing": { // src: "lib/jquery.easing.js", // deps: ["jquery"] // } // }) seajs.on("config", onConfig) onConfig(seajs.config.data) function onConfig(data) { if (!data) return var alias = data.alias for (var id in alias) { (function(item) { if (item.src) { // Set dependencies item.deps && define(item.src, item.deps) // Define the proxy cmd module define(id, [seajs.resolve(item.src)], function() { var exports = item.exports return typeof exports === "function" ? exports() : typeof exports === "string" ? global[exports] : exports }) } })(alias[id]) } } })(seajs, typeof global === "undefined" ? this : global);
/** * Add shim config for configuring the dependencies and exports for * older, traditional "browser globals" scripts that do not use define() * to declare the dependencies and set a module value. */ (function(seajs, global) { // seajs.config({ // alias: { // "jquery": { // src: "lib/jquery.js", // exports: "jQuery" or function // }, // "jquery.easing": { // src: "lib/jquery.easing.js", // deps: ["jquery"] // } // }) seajs.on("config", onConfig) onConfig(seajs.config.data) function onConfig(data) { if (!data) return var alias = data.alias for (var id in alias) { (function(item) { if (item.src) { // Set dependencies item.deps && define(item.src, item.deps) // Define the proxy cmd module define(id, [seajs.resolve(item.src)], function() { var exports = item.exports return typeof exports === "function" ? exports() : typeof exports === "string" ? global[exports] : exports }) } else { // Define the proxy cmd module use an exist object when src file have been loaded before define(id, item.deps, function() { var exports = item.exports return typeof exports === "function" ? exports() : typeof exports === "string" ? global[exports] : exports }) } })(alias[id]) } } })(seajs, typeof global === "undefined" ? this : global);
Fix the bug when src key is undefined,the shim plugin do not work.
Fix the bug when src key is undefined,the shim plugin do not work. When an alias item, the 'src' key is not defined, the code do not work well with the exports value.
JavaScript
mit
moccen/seajs,Lyfme/seajs,coolyhx/seajs,zaoli/seajs,baiduoduo/seajs,twoubt/seajs,tonny-zhang/seajs,mosoft521/seajs,wenber/seajs,miusuncle/seajs,yern/seajs,Gatsbyy/seajs,imcys/seajs,angelLYK/seajs,kuier/seajs,MrZhengliang/seajs,twoubt/seajs,JeffLi1993/seajs,lianggaolin/seajs,yern/seajs,uestcNaldo/seajs,121595113/seajs,uestcNaldo/seajs,lianggaolin/seajs,hbdrawn/seajs,121595113/seajs,evilemon/seajs,mosoft521/seajs,hbdrawn/seajs,liupeng110112/seajs,angelLYK/seajs,sheldonzf/seajs,lee-my/seajs,jishichang/seajs,sheldonzf/seajs,imcys/seajs,JeffLi1993/seajs,AlvinWei1024/seajs,kaijiemo/seajs,wenber/seajs,chinakids/seajs,twoubt/seajs,Gatsbyy/seajs,zaoli/seajs,evilemon/seajs,PUSEN/seajs,baiduoduo/seajs,zwh6611/seajs,lee-my/seajs,coolyhx/seajs,yuhualingfeng/seajs,tonny-zhang/seajs,PUSEN/seajs,lovelykobe/seajs,eleanors/SeaJS,FrankElean/SeaJS,mosoft521/seajs,angelLYK/seajs,kuier/seajs,ysxlinux/seajs,yuhualingfeng/seajs,Lyfme/seajs,imcys/seajs,FrankElean/SeaJS,evilemon/seajs,13693100472/seajs,JeffLi1993/seajs,lovelykobe/seajs,seajs/seajs,AlvinWei1024/seajs,jishichang/seajs,zaoli/seajs,LzhElite/seajs,uestcNaldo/seajs,AlvinWei1024/seajs,longze/seajs,MrZhengliang/seajs,LzhElite/seajs,kuier/seajs,coolyhx/seajs,lovelykobe/seajs,judastree/seajs,treejames/seajs,liupeng110112/seajs,LzhElite/seajs,kaijiemo/seajs,longze/seajs,zwh6611/seajs,tonny-zhang/seajs,ysxlinux/seajs,miusuncle/seajs,miusuncle/seajs,lee-my/seajs,treejames/seajs,chinakids/seajs,eleanors/SeaJS,judastree/seajs,zwh6611/seajs,PUSEN/seajs,ysxlinux/seajs,kaijiemo/seajs,liupeng110112/seajs,seajs/seajs,treejames/seajs,moccen/seajs,judastree/seajs,Gatsbyy/seajs,FrankElean/SeaJS,Lyfme/seajs,wenber/seajs,yern/seajs,longze/seajs,seajs/seajs,eleanors/SeaJS,moccen/seajs,sheldonzf/seajs,yuhualingfeng/seajs,13693100472/seajs,jishichang/seajs,MrZhengliang/seajs,baiduoduo/seajs,lianggaolin/seajs
--- +++ @@ -39,6 +39,16 @@ exports }) + } else { + + // Define the proxy cmd module use an exist object when src file have been loaded before + define(id, item.deps, function() { + var exports = item.exports + return typeof exports === "function" ? exports() : + typeof exports === "string" ? global[exports] : + exports + }) + } })(alias[id]) }
d54150b9a86c3cc0a08376e3b1cf9c223a7c0096
index.js
index.js
;(_ => { 'use strict'; var tagContent = 'router2-content'; function matchHash() { var containers = document.querySelectorAll(`${tagContent}:not([hidden])`); var container; for (var i = 0; i < containers.length; i++) { containers[i].hidden = true; } var hash = window.location.hash.slice(1); // nothing to unhide... if (!hash) { return; } // this selector selects the children items too... that's incorrect var containers = document.querySelectorAll(`${tagContent}`); for (var i = 0; i < containers.length; i++) { container = containers[i]; var matcher = new RegExp(`^${container.getAttribute('hash')}`); var match = matcher.test(hash); if (match) { container.hidden = false; return; } } throw new Error(`hash "${hash}" does not match any content`); } window.addEventListener('hashchange', (e) => { matchHash(); }); window.addEventListener('load', (e) => { matchHash(); }); })();
;(_ => { 'use strict'; var tagContent = 'router2-content'; function matchHash(parent, hash) { var containers; var container; var _hash = hash || window.location.hash; if (!parent) { containers = document.querySelectorAll(`${tagContent}:not([hidden])`); for (var i = 0; i < containers.length; i++) { containers[i].hidden = true; } _hash = _hash.slice(1); // nothing to unhide... if (!_hash) { return; } containers = document.querySelectorAll(`${tagContent}`); } else { containers = parent.querySelectorAll(`${tagContent}`); if (_hash[0] === '/') { _hash = _hash.slice(1); } if (containers.length === 0) { return; } } // this selector selects the children items too... that's incorrect for (var i = 0; i < containers.length; i++) { container = containers[i]; var matcher = new RegExp(`^${container.getAttribute('hash')}`); var match = matcher.test(_hash); if (match) { container.hidden = false; matchHash(container, _hash.split(matcher)[1]); return; } } throw new Error(`hash "${_hash}" does not match any content`); } window.addEventListener('hashchange', (e) => { matchHash(); }); window.addEventListener('load', (e) => { matchHash(); }); })();
Complete the test for case 3
Complete the test for case 3
JavaScript
isc
m3co/router3,m3co/router3
--- +++ @@ -2,33 +2,46 @@ 'use strict'; var tagContent = 'router2-content'; - function matchHash() { - var containers = document.querySelectorAll(`${tagContent}:not([hidden])`); + function matchHash(parent, hash) { + var containers; var container; - for (var i = 0; i < containers.length; i++) { - containers[i].hidden = true; - } + var _hash = hash || window.location.hash; - var hash = window.location.hash.slice(1); - // nothing to unhide... - if (!hash) { - return; - } - - // this selector selects the children items too... that's incorrect - var containers = document.querySelectorAll(`${tagContent}`); - for (var i = 0; i < containers.length; i++) { - container = containers[i]; - var matcher = new RegExp(`^${container.getAttribute('hash')}`); - var match = matcher.test(hash); - - if (match) { - container.hidden = false; + if (!parent) { + containers = document.querySelectorAll(`${tagContent}:not([hidden])`); + for (var i = 0; i < containers.length; i++) { + containers[i].hidden = true; + } + _hash = _hash.slice(1); + // nothing to unhide... + if (!_hash) { + return; + } + containers = document.querySelectorAll(`${tagContent}`); + } else { + containers = parent.querySelectorAll(`${tagContent}`); + if (_hash[0] === '/') { + _hash = _hash.slice(1); + } + if (containers.length === 0) { return; } } - throw new Error(`hash "${hash}" does not match any content`); + // this selector selects the children items too... that's incorrect + for (var i = 0; i < containers.length; i++) { + container = containers[i]; + var matcher = new RegExp(`^${container.getAttribute('hash')}`); + var match = matcher.test(_hash); + + if (match) { + container.hidden = false; + matchHash(container, _hash.split(matcher)[1]); + return; + } + } + + throw new Error(`hash "${_hash}" does not match any content`); } window.addEventListener('hashchange', (e) => {
4840f0296869dc9e78856cf577d766e3ce3ccabe
index.js
index.js
'use strict'; var server = require('./lib/server/')(); var config = require('config'); function ngrokIsAvailable() { try { require.resolve('ngrok'); return true; } catch (e) { return false; } } if (config.isValid()) { var port = config.get("port") || 8080; server.listen(port, function () { console.log('listening on port ' + port); if (process.env.NODE_ENV === 'development' && ngrokIsAvailable()) { require('ngrok').connect(port, function (err, url) { if (err) { console.error('ngrok error', err); return; } console.log('publicly accessible https url is: ' + url); }); } }); } else { config.getConfigValidityReport().errors.forEach(function(error){ console.log(error); }); console.error("\n\nInvalid configuration detected. Aborted server startup.\n"); return; }
'use strict'; var server = require('./lib/server/')(); var config = require('config'); function ngrokIsAvailable() { try { require.resolve('ngrok'); return true; } catch (e) { return false; } } /** * Make sure to configuration is valid before attempting to start the server. */ if (!config.isValid()) { config.getConfigValidityReport().errors.forEach(function(error){ console.log(error); }); console.error("\n\nInvalid configuration detected. Aborted server startup.\n"); return; } var port = config.get("port") || 8080; server.listen(port, function () { console.log('listening on port ' + port); if (process.env.NODE_ENV === 'development' && ngrokIsAvailable()) { require('ngrok').connect(port, function (err, url) { if (err) { console.error('ngrok error', err); return; } console.log('publicly accessible https url is: ' + url); }); } });
Rearrange code to reduce nesting as requested by PR comment.
Rearrange code to reduce nesting as requested by PR comment.
JavaScript
mit
syjulian/Frontier,codeforhuntsville/Frontier
--- +++ @@ -11,24 +11,10 @@ } } -if (config.isValid()) { - var port = config.get("port") || 8080; - server.listen(port, function () { - console.log('listening on port ' + port); - - if (process.env.NODE_ENV === 'development' && ngrokIsAvailable()) { - require('ngrok').connect(port, function (err, url) { - if (err) { - console.error('ngrok error', err); - return; - } - - console.log('publicly accessible https url is: ' + url); - }); - } - }); -} -else { +/** + * Make sure to configuration is valid before attempting to start the server. + */ +if (!config.isValid()) { config.getConfigValidityReport().errors.forEach(function(error){ console.log(error); }); @@ -36,3 +22,20 @@ return; } +var port = config.get("port") || 8080; +server.listen(port, function () { + console.log('listening on port ' + port); + + if (process.env.NODE_ENV === 'development' && ngrokIsAvailable()) { + require('ngrok').connect(port, function (err, url) { + if (err) { + console.error('ngrok error', err); + return; + } + + console.log('publicly accessible https url is: ' + url); + }); + } +}); + +
8aca8785d53d7c0568020a128df8e4fcb7865d2b
index.js
index.js
'use strict'; require('whatwg-fetch'); const path = require('path'), querystring = require('querystring').parse; const registry = 'http://npm-registry.herokuapp.com'; const query = querystring(window.location.search.slice(1)).q; if (query) { window.fetch(path.join(registry, query)) .then((response) => response.json()) .then((info) => { document.write(`Redirecting to ${info.homepage}...`); window.location = info.homepage; }); } else { document.write('<form method="get"><input type="text" name="q"><input type="submit" value="Go"></form>'); }
'use strict'; require('whatwg-fetch'); const url = require('url'), querystring = require('querystring').parse; const registry = 'http://npm-registry.herokuapp.com'; const query = querystring(window.location.search.slice(1)).q; if (query) { window.fetch(url.resolve(registry, query)) .then((response) => response.json()) .then((info) => { document.write(`Redirecting to ${info.homepage}...`); window.location = info.homepage; }); } else { document.write('<form method="get"><input type="text" name="q"><input type="submit" value="Go"></form>'); }
Use url.resolve to get the url
Use url.resolve to get the url
JavaScript
mit
npmdocs/www
--- +++ @@ -1,7 +1,7 @@ 'use strict'; require('whatwg-fetch'); -const path = require('path'), +const url = require('url'), querystring = require('querystring').parse; const registry = 'http://npm-registry.herokuapp.com'; @@ -10,7 +10,7 @@ const query = querystring(window.location.search.slice(1)).q; if (query) { - window.fetch(path.join(registry, query)) + window.fetch(url.resolve(registry, query)) .then((response) => response.json()) .then((info) => { document.write(`Redirecting to ${info.homepage}...`);
349a44df9340accdccbf829317dce9e359442e8c
service.js
service.js
var find = require('reactor/find'), serializer = require('./serializer'), url = require('url'); function say () { var all = [].slice.call(arguments), filtered = all.filter(function (argument) { return argument !== say }); console.log.apply(console, filtered); if (filtered.length != all.length) process.exit(1); } exports.create = function (base, context) { var reactor = require('reactor').createReactor(); find(base, 'stencil').forEach(function (route) { reactor.get(route.route, function (params, request, response, next) { var pathInfo = params.pathInfo ? '/' + params.pathInfo : ''; context.generate(route.script, { pathInfo: pathInfo }, function (error, stencil) { if (error) { next(error); } else { response.setHeader("Content-Type", "text/html; charset=utf8"); response.end(serializer(stencil.document.documentElement)); } }); }); }); return function (req, res, next){ if (!reactor.react(req.method, url.parse(req.url).pathname, req, res, next)) next(); } }
var find = require('reactor/find'), serializer = require('./serializer'), url = require('url'); function say () { var all = [].slice.call(arguments), filtered = all.filter(function (argument) { return argument !== say }); console.log.apply(console, filtered); if (filtered.length != all.length) process.exit(1); } exports.create = function (base, context) { var reactor = require('reactor').createReactor(); find(base, 'stencil').forEach(function (route) { reactor.get(route.route, function (params, request, response, next) { var pathInfo = params.pathInfo ? '/' + params.pathInfo : ''; context.generate(route.script, { request: request, response: response, pathInfo: pathInfo }, function (error, stencil) { if (error) { next(error); } else { response.setHeader("Content-Type", "text/html; charset=utf8"); response.end(serializer(stencil.document.documentElement)); } }); }); }); return function (req, res, next){ if (!reactor.react(req.method, url.parse(req.url).pathname, req, res, next)) next(); } }
Add `request` and `response` to context.
Add `request` and `response` to context. Add `request` and `response` to context in the service. Closes #106.
JavaScript
mit
bigeasy/stencil,bigeasy/stencil,bigeasy/stencil
--- +++ @@ -14,7 +14,9 @@ find(base, 'stencil').forEach(function (route) { reactor.get(route.route, function (params, request, response, next) { var pathInfo = params.pathInfo ? '/' + params.pathInfo : ''; - context.generate(route.script, { pathInfo: pathInfo }, function (error, stencil) { + context.generate(route.script, { + request: request, response: response, pathInfo: pathInfo + }, function (error, stencil) { if (error) { next(error); } else {
5afa8d8796312b693964d133e626f23f3ba3a67c
src/main.js
src/main.js
import React from 'react'; import App from './App'; import config from './config'; var mountNode = document.getElementById('main'); React.render(<App config={config.params} />, mountNode);
import React from 'react'; import App from './App'; var mountNode = document.getElementById('main'); const config = { name: window.GROUP_NAME, description: window.GROUP_DESCRIPTION, rootUrl: window.ROOT_URL, formContact: window.FORM_CONTACT, headerMenuLinks: window.HEADER_MENU_LINKS, twitterUsername: window.TWITTER_USERNAME, twitterWidgetId: window.TWITTER_WIDGET_ID }; React.render(<App config={config} />, mountNode);
Use global variables instead of configuration file (no need to recompile the JS code to see the changes)
Use global variables instead of configuration file (no need to recompile the JS code to see the changes)
JavaScript
apache-2.0
naltaki/naltaki-front,naltaki/naltaki-front
--- +++ @@ -1,7 +1,16 @@ import React from 'react'; import App from './App'; -import config from './config'; var mountNode = document.getElementById('main'); -React.render(<App config={config.params} />, mountNode); +const config = { + name: window.GROUP_NAME, + description: window.GROUP_DESCRIPTION, + rootUrl: window.ROOT_URL, + formContact: window.FORM_CONTACT, + headerMenuLinks: window.HEADER_MENU_LINKS, + twitterUsername: window.TWITTER_USERNAME, + twitterWidgetId: window.TWITTER_WIDGET_ID +}; + +React.render(<App config={config} />, mountNode);
5570a14c93b71af910e89fc4f2a6f8d7435451ed
src/main.js
src/main.js
import electron from 'electron'; import path from 'path'; import Menu from './remote/Menu'; import config from './config'; const app = electron.app; // Report crashes to our server. // electron.CrashReporter.start(); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is GCed. let mainWindow = null; app.on('window-all-closed', () => { app.quit(); }); app.on('ready', () => { // Create the browser window. mainWindow = new electron.BrowserWindow({width: 1100, height: 600}); mainWindow.loadURL(`file://${path.resolve(__dirname, '../web/index.html')}`); // Open the devtools. if (config.__DEV__) { mainWindow.openDevTools(); } // Setup the menu bar Menu.setupMenu(); mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null; }); });
import electron from 'electron'; import path from 'path'; import process from 'process'; import Menu from './remote/Menu'; import config from './config'; const app = electron.app; // Report crashes to our server. // electron.CrashReporter.start(); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is GCed. let mainWindow = null; app.on('window-all-closed', () => { app.quit(); process.exit(0); }); app.on('ready', () => { // Create the browser window. mainWindow = new electron.BrowserWindow({width: 1100, height: 600}); mainWindow.loadURL(`file://${path.resolve(__dirname, '../web/index.html')}`); // Open the devtools. if (config.__DEV__) { mainWindow.openDevTools(); } // Setup the menu bar Menu.setupMenu(); mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null; }); });
Call process.exit() when all windows are closed
[XDE] Call process.exit() when all windows are closed
JavaScript
mit
exponentjs/xde,exponentjs/xde
--- +++ @@ -1,5 +1,6 @@ import electron from 'electron'; import path from 'path'; +import process from 'process'; import Menu from './remote/Menu'; @@ -16,6 +17,7 @@ app.on('window-all-closed', () => { app.quit(); + process.exit(0); }); app.on('ready', () => {
1d0bbe6b09e8c2beeb4cf4cb9c9c20944f194275
index.js
index.js
var Promise = require('bluebird'); var mapObj = require('map-obj'); var assign = require('object-assign'); function FileWebpackPlugin(files) { this.files = files || {}; } FileWebpackPlugin.prototype.apply = function(compiler) { var self = this; compiler.plugin('emit', function(compiler, done) { var data = {}; var assetPromises = mapObj(self.files, function(filename, asyncTemplate) { var promise = Promise .fromNode(asyncTemplate.bind(null, data)) .then(createAssetFromContents) return [filename, promise]; }); Promise.props(assetPromises) .then(function(assets) { assign(compiler.assets, assets); done(); }, function(err) { done(err); }); }); }; function createAssetFromContents(contents) { return { source: function() { return contents; }, size: function() { return contents.length; } }; } module.exports = FileWebpackPlugin;
var Promise = require('bluebird'); var mapObj = require('map-obj'); var assign = require('object-assign'); function FileWebpackPlugin(files) { this.files = files || {}; } FileWebpackPlugin.prototype.apply = function(compiler) { var self = this; compiler.plugin('emit', function(compiler, done) { var data = {}; var assetPromises = mapObj(self.files, function(filename, asyncTemplate) { var promise = Promise .fromNode(asyncTemplate.bind(null, data)) .then(createAssetFromContents) return [filename, promise]; }); Promise.props(assetPromises) .then(function(assets) { assign(compiler.assets, assets); }) .nodeify(done); }); }; function createAssetFromContents(contents) { return { source: function() { return contents; }, size: function() { return contents.length; } }; } module.exports = FileWebpackPlugin;
Use Bluebird's nodeify to handle resulting promise
Use Bluebird's nodeify to handle resulting promise
JavaScript
mit
markdalgleish/file-webpack-plugin
--- +++ @@ -22,10 +22,8 @@ Promise.props(assetPromises) .then(function(assets) { assign(compiler.assets, assets); - done(); - }, function(err) { - done(err); - }); + }) + .nodeify(done); }); };
a84c9a76cbb4b65bf6c8a4f3483025a509bfab76
src/api/mqttPublishMessage.js
src/api/mqttPublishMessage.js
const apiPutMqttMessage = { schema: { summary: 'Retrieve a list of all keys present in the specified namespace.', description: '', body: { type: 'object', properties: { topic: { type: 'string', description: 'Name of namespace whose keys should be returned.', example: 'qliksense/new_data_notification/sales', }, message: { type: 'string', description: 'The message is a generic text string and can thus contain anything that can be represented in a string, including JSON, key-value pairs, plain text etc.', example: 'dt=20201028', }, }, required: ['topic', 'message'], }, response: { 201: { description: 'MQTT message successfully published.', type: 'object', }, 400: { description: 'Required parameter missing.', type: 'object', properties: { statusCode: { type: 'number' }, code: { type: 'string' }, error: { type: 'string' }, message: { type: 'string' }, time: { type: 'string' }, }, }, 500: { description: 'Internal error.', type: 'object', properties: { statusCode: { type: 'number' }, code: { type: 'string' }, error: { type: 'string' }, message: { type: 'string' }, time: { type: 'string' }, }, }, }, }, }; module.exports = { apiPutMqttMessage, };
const apiPutMqttMessage = { schema: { summary: 'Publish a message to a MQTT topic.', description: '', body: { type: 'object', properties: { topic: { type: 'string', description: 'Topic to which message should be published.', example: 'qliksense/new_data_notification/sales', }, message: { type: 'string', description: 'The message is a generic text string and can thus contain anything that can be represented in a string, including JSON, key-value pairs, plain text etc.', example: 'dt=20201028', }, }, required: ['topic', 'message'], }, response: { 201: { description: 'MQTT message successfully published.', type: 'object', }, 400: { description: 'Required parameter missing.', type: 'object', properties: { statusCode: { type: 'number' }, code: { type: 'string' }, error: { type: 'string' }, message: { type: 'string' }, time: { type: 'string' }, }, }, 500: { description: 'Internal error.', type: 'object', properties: { statusCode: { type: 'number' }, code: { type: 'string' }, error: { type: 'string' }, message: { type: 'string' }, time: { type: 'string' }, }, }, }, }, }; module.exports = { apiPutMqttMessage, };
Fix incorrect text for MQTT publish
docs: Fix incorrect text for MQTT publish Fixes #262
JavaScript
mit
mountaindude/butler
--- +++ @@ -1,13 +1,13 @@ const apiPutMqttMessage = { schema: { - summary: 'Retrieve a list of all keys present in the specified namespace.', + summary: 'Publish a message to a MQTT topic.', description: '', body: { type: 'object', properties: { topic: { type: 'string', - description: 'Name of namespace whose keys should be returned.', + description: 'Topic to which message should be published.', example: 'qliksense/new_data_notification/sales', }, message: {
42f0f66acdef27a58599d59f72c6b8ae784975ab
src/blocks/scratch3_motion.js
src/blocks/scratch3_motion.js
function Scratch3MotionBlocks(runtime) { /** * The runtime instantiating this block package. * @type {Runtime} */ this.runtime = runtime; } /** * Retrieve the block primitives implemented by this package. * @return {Object.<string, Function>} Mapping of opcode to Function. */ Scratch3MotionBlocks.prototype.getPrimitives = function() { return { 'motion_gotoxy': this.goToXY, 'motion_turnright': this.turnRight }; }; Scratch3MotionBlocks.prototype.goToXY = function (args, util) { util.target.setXY(args.X, args.Y); }; Scratch3MotionBlocks.prototype.turnRight = function (args, util) { if (args.DEGREES !== args.DEGREES) { throw "Bad degrees" + args.DEGREES; } util.target.setDirection(args.DEGREES + util.target.direction); }; module.exports = Scratch3MotionBlocks;
var MathUtil = require('../util/math-util'); function Scratch3MotionBlocks(runtime) { /** * The runtime instantiating this block package. * @type {Runtime} */ this.runtime = runtime; } /** * Retrieve the block primitives implemented by this package. * @return {Object.<string, Function>} Mapping of opcode to Function. */ Scratch3MotionBlocks.prototype.getPrimitives = function() { return { 'motion_movesteps': this.moveSteps, 'motion_gotoxy': this.goToXY, 'motion_turnright': this.turnRight, 'motion_turnleft': this.turnLeft, 'motion_pointindirection': this.pointInDirection }; }; Scratch3MotionBlocks.prototype.moveSteps = function (args, util) { var radians = MathUtil.degToRad(util.target.direction); var dx = args.STEPS * Math.cos(radians); var dy = args.STEPS * Math.sin(radians); util.target.setXY(util.target.x + dx, util.target.y + dy); }; Scratch3MotionBlocks.prototype.goToXY = function (args, util) { util.target.setXY(args.X, args.Y); }; Scratch3MotionBlocks.prototype.turnRight = function (args, util) { util.target.setDirection(util.target.direction + args.DEGREES); }; Scratch3MotionBlocks.prototype.turnLeft = function (args, util) { util.target.setDirection(util.target.direction - args.DEGREES); }; Scratch3MotionBlocks.prototype.pointInDirection = function (args, util) { util.target.setDirection(args.DIRECTION); }; module.exports = Scratch3MotionBlocks;
Implement move steps, turn right, turn left, point in direction
Implement move steps, turn right, turn left, point in direction
JavaScript
bsd-3-clause
TheBrokenRail/scratch-vm,LLK/scratch-vm,LLK/scratch-vm,LLK/scratch-vm,TheBrokenRail/scratch-vm
--- +++ @@ -1,3 +1,5 @@ +var MathUtil = require('../util/math-util'); + function Scratch3MotionBlocks(runtime) { /** * The runtime instantiating this block package. @@ -12,9 +14,19 @@ */ Scratch3MotionBlocks.prototype.getPrimitives = function() { return { + 'motion_movesteps': this.moveSteps, 'motion_gotoxy': this.goToXY, - 'motion_turnright': this.turnRight + 'motion_turnright': this.turnRight, + 'motion_turnleft': this.turnLeft, + 'motion_pointindirection': this.pointInDirection }; +}; + +Scratch3MotionBlocks.prototype.moveSteps = function (args, util) { + var radians = MathUtil.degToRad(util.target.direction); + var dx = args.STEPS * Math.cos(radians); + var dy = args.STEPS * Math.sin(radians); + util.target.setXY(util.target.x + dx, util.target.y + dy); }; Scratch3MotionBlocks.prototype.goToXY = function (args, util) { @@ -22,10 +34,15 @@ }; Scratch3MotionBlocks.prototype.turnRight = function (args, util) { - if (args.DEGREES !== args.DEGREES) { - throw "Bad degrees" + args.DEGREES; - } - util.target.setDirection(args.DEGREES + util.target.direction); + util.target.setDirection(util.target.direction + args.DEGREES); +}; + +Scratch3MotionBlocks.prototype.turnLeft = function (args, util) { + util.target.setDirection(util.target.direction - args.DEGREES); +}; + +Scratch3MotionBlocks.prototype.pointInDirection = function (args, util) { + util.target.setDirection(args.DIRECTION); }; module.exports = Scratch3MotionBlocks;
ff95f103ac755324d36b4d3a60a61ad8014e9ce9
src/web3.js
src/web3.js
import Web3 from 'web3'; const web3 = new Web3(); export default web3; export const initWeb3 = (web3) => { if (window.web3) { web3.setProvider(window.web3.currentProvider); } else { web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/')); } window.web3 = web3; }
import Web3 from 'web3'; const web3 = new Web3(); export default web3; export const initWeb3 = (web3) => { if (window.web3) { web3.setProvider(window.web3.currentProvider); } else { web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/Tl5m5gSA2IY0XJe9BWrS')); } window.web3 = web3; }
Add api key... will have to remove eventually
Add api key... will have to remove eventually
JavaScript
mit
nanexcool/feeds,nanexcool/feeds
--- +++ @@ -8,7 +8,7 @@ if (window.web3) { web3.setProvider(window.web3.currentProvider); } else { - web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/')); + web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/Tl5m5gSA2IY0XJe9BWrS')); } window.web3 = web3; }
d3296125920a838a56c68ca2da1e9f9b4216bc03
preTest.js
preTest.js
//makes the bdd interface available (describe, it before, after, etc if(Meteor.settings.public.mocha_setup_args) { mocha.setup(Meteor.settings.public.mocha_setup_args); } else { mocha.setup("bdd"); }
//makes the bdd interface available (describe, it before, after, etc if(Meteor.settings && Meteor.settings.public.mocha_setup_args) { mocha.setup(Meteor.settings.public.mocha_setup_args); } else { mocha.setup("bdd"); }
Fix for when Mocha.settings are not available
Fix for when Mocha.settings are not available
JavaScript
mit
kelbongoo/meteor-mocha-web,abernix/meteor-mocha-web,mad-eye/meteor-mocha-web,mad-eye/meteor-mocha-web,kelbongoo/meteor-mocha-web,abernix/meteor-mocha-web
--- +++ @@ -1,5 +1,5 @@ //makes the bdd interface available (describe, it before, after, etc -if(Meteor.settings.public.mocha_setup_args) { +if(Meteor.settings && Meteor.settings.public.mocha_setup_args) { mocha.setup(Meteor.settings.public.mocha_setup_args); } else { mocha.setup("bdd");
ba64925e6c6b07b42f8a28b9a141e1ada42c3550
src/components/MainNav/Breadcrumbs/Breadcrumbs.js
src/components/MainNav/Breadcrumbs/Breadcrumbs.js
import React from 'react'; import css from './Breadcrumbs.css'; const propTypes = { links: React.PropTypes.array, }; function Breadcrumbs(props) { const links = props.links.map((link, i) => { const linkElem = <li key={`breadcrumb_${i}`}><a href={link.path}>{link.label}</a></li>; const dividerElem = <li key={`divider${i}`}>{'>'}</li>; if (i !== props.links.length - 1) { return (linkElem + dividerElem); } return linkElem; }); return ( <ul className={css.navBreadcrumbs}> {links} </ul> ); } Breadcrumbs.propTypes = propTypes; export default Breadcrumbs;
import React from 'react'; import css from './Breadcrumbs.css'; const propTypes = { links: React.PropTypes.array, }; function Breadcrumbs(props) { const links = props.links.map((link, i) => { // eslint-disable-next-line react/no-array-index-key const linkElem = <li key={`breadcrumb_${i}`}><a href={link.path}>{link.label}</a></li>; // eslint-disable-next-line react/no-array-index-key const dividerElem = <li key={`divider${i}`}>{'>'}</li>; if (i !== props.links.length - 1) { return (linkElem + dividerElem); } return linkElem; }); return ( <ul className={css.navBreadcrumbs}> {links} </ul> ); } Breadcrumbs.propTypes = propTypes; export default Breadcrumbs;
Add eslint-disable-next-line comments to get rid of excessively pedantic react/no-array-index-key errors.
Add eslint-disable-next-line comments to get rid of excessively pedantic react/no-array-index-key errors.
JavaScript
apache-2.0
folio-org/stripes-core,folio-org/stripes-core,folio-org/stripes-core
--- +++ @@ -7,7 +7,9 @@ function Breadcrumbs(props) { const links = props.links.map((link, i) => { + // eslint-disable-next-line react/no-array-index-key const linkElem = <li key={`breadcrumb_${i}`}><a href={link.path}>{link.label}</a></li>; + // eslint-disable-next-line react/no-array-index-key const dividerElem = <li key={`divider${i}`}>{'>'}</li>; if (i !== props.links.length - 1) { return (linkElem + dividerElem);
470c616cf598fb14842d8326d6fe416952b79d8a
test/common.js
test/common.js
'use strict'; const hookModule = require("../src/"); class TallyHook extends hookModule.Hook { preProcess(thing) { thing.preTally = thing.preTally + 1; return true; } postProcess(thing) { thing.postTally = thing.postTally + 1; } } module.exports = { TallyHook };
'use strict'; const hookModule = require("../src/"); class TallyHook extends hookModule.Hook { preProcess(thing) { thing.preTally = thing.preTally + 1; return true; } postProcess(thing) { thing.postTally = thing.postTally + 1; } } class DelayableHook extends hookModule.Hook { constructor(options) { super(options) } preProcess() { this.delay( this.settings.preprocess || 500, "preProcess"); return true } execute() { this.delay(this.settings.execute || 200, "execute"); } postProcess() { this.delay(this.settings.postprocess || 100, "postProcess"); } delay(ms, str){ var ctr, rej, p = new Promise((resolve, reject) => { ctr = setTimeout(() => { console.log( `delayed ${str} by ${ms}ms`) resolve(); }, ms); rej = reject; }); p.cancel = function(){ clearTimeout(ctr); rej(Error("Cancelled"))}; return p; } } module.exports = { TallyHook, DelayableHook };
Add a DelayedHook test class.
Add a DelayedHook test class.
JavaScript
mit
StevenBlack/hooks-and-anchors
--- +++ @@ -13,6 +13,42 @@ } } +class DelayableHook extends hookModule.Hook { + constructor(options) { + super(options) + } + + preProcess() { + this.delay( this.settings.preprocess || 500, "preProcess"); + return true + } + + execute() { + this.delay(this.settings.execute || 200, "execute"); + } + + postProcess() { + this.delay(this.settings.postprocess || 100, "postProcess"); + } + + + delay(ms, str){ + var ctr, rej, p = new Promise((resolve, reject) => { + ctr = setTimeout(() => { + console.log( `delayed ${str} by ${ms}ms`) + resolve(); + }, ms); + rej = reject; + }); + + + p.cancel = function(){ clearTimeout(ctr); rej(Error("Cancelled"))}; + return p; + } +} + + module.exports = { - TallyHook + TallyHook, + DelayableHook };
e49fd692e1281f91164d216708befd81a1a3c102
test/simple.js
test/simple.js
var test = require("tape") var crypto = require('crypto') var cryptoB = require('../') var assert = require('assert') function assertSame (fn) { test(fn.name, function (t) { fn(crypto, function (err, expected) { fn(cryptoB, function (err, actual) { t.equal(actual, expected) t.end() }) }) }) } assertSame(function sha1 (crypto, cb) { cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex')) }) assertSame(function md5(crypto, cb) { cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex')) }) assert.equal(cryptoB.randomBytes(10).length, 10) test('randomBytes', function (t) { cryptoB.randomBytes(10, function(ex, bytes) { assert.ifError(ex) bytes.forEach(function(bite) { assert.equal(typeof bite, 'number') }) t.end() }) })
var test = require("tape") var crypto = require('crypto') var cryptoB = require('../') function assertSame (fn) { test(fn.name, function (t) { t.plan(1) fn(crypto, function (err, expected) { fn(cryptoB, function (err, actual) { t.equal(actual, expected) t.end() }) }) }) } assertSame(function sha1 (crypto, cb) { cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex')) }) assertSame(function md5(crypto, cb) { cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex')) }) test('randomBytes', function (t) { t.plan(3 + 10) t.equal(cryptoB.randomBytes(10).length, 10) cryptoB.randomBytes(10, function(ex, bytes) { t.error(ex) t.equal(bytes.length, 10) bytes.forEach(function(bite) { t.equal(typeof bite, 'number') }) t.end() }) })
Use tape for asserts to better detect callbacks not being fired
Use tape for asserts to better detect callbacks not being fired
JavaScript
mit
crypto-browserify/crypto-browserify,crypto-browserify/crypto-browserify
--- +++ @@ -2,10 +2,10 @@ var crypto = require('crypto') var cryptoB = require('../') -var assert = require('assert') function assertSame (fn) { test(fn.name, function (t) { + t.plan(1) fn(crypto, function (err, expected) { fn(cryptoB, function (err, actual) { t.equal(actual, expected) @@ -23,12 +23,14 @@ cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex')) }) -assert.equal(cryptoB.randomBytes(10).length, 10) test('randomBytes', function (t) { + t.plan(3 + 10) + t.equal(cryptoB.randomBytes(10).length, 10) cryptoB.randomBytes(10, function(ex, bytes) { - assert.ifError(ex) + t.error(ex) + t.equal(bytes.length, 10) bytes.forEach(function(bite) { - assert.equal(typeof bite, 'number') + t.equal(typeof bite, 'number') }) t.end() })
4da17d2e30b07b73de2a5d7b548ca8ed4b9bc4f2
src/utils/hex-generator.js
src/utils/hex-generator.js
const hexWidth = 50; const hexPadding = 2; export default ({ width, height, columns, rows, renderSector }) => { const hexWidthUnit = hexWidth / 4; const hexHeight = (Math.sqrt(3) / 2) * hexWidth; const hexHeightUnit = hexHeight / 2; const hexArray = []; let isWithinHeight = true; let isWithinWidth = true; let i = 0; let j = 0; while (isWithinHeight) { const minRowHeight = hexHeightUnit * 2 * i; while (isWithinWidth) { const xOffset = j * 3 * hexWidthUnit; hexArray.push({ key: `${i}-${j}`, width: hexWidth - hexPadding, xOffset, yOffset: j % 2 ? minRowHeight + hexHeightUnit : minRowHeight, highlighted: renderSector && i < rows && j < columns, }); j += 1; isWithinWidth = xOffset + (2 * hexWidthUnit) < width; } j = 0; i += 1; isWithinWidth = true; isWithinHeight = minRowHeight - hexHeightUnit < height; } return hexArray; };
const defaultHexWidth = 50; const hexPadding = 2; export default ({ width, height, columns, rows, renderSector }) => { const scaledWidth = Math.min(height / (rows + 4), width / (columns + 4)); const horizHexOffset = Math.ceil((((width / scaledWidth) / (Math.sqrt(3) / 2)) - columns) / 2); const vertHexOffset = Math.ceil(((height / scaledWidth) - rows) / 2); const hexWidth = renderSector ? scaledWidth / (Math.sqrt(3) / 2) : defaultHexWidth; const hexWidthUnit = hexWidth / 4; const hexHeight = (Math.sqrt(3) / 2) * hexWidth; const hexHeightUnit = hexHeight / 2; const hexArray = []; let isWithinHeight = true; let isWithinWidth = true; let i = 0; let j = 0; while (isWithinHeight) { const minRowHeight = hexHeightUnit * 2 * i; while (isWithinWidth) { const xOffset = j * 3 * hexWidthUnit; hexArray.push({ key: `${i}-${j}`, width: hexWidth - hexPadding, xOffset, yOffset: j % 2 ? minRowHeight + hexHeightUnit : minRowHeight, highlighted: renderSector && i > vertHexOffset && i < rows + vertHexOffset && j > horizHexOffset && j < columns + horizHexOffset, }); j += 1; isWithinWidth = xOffset + (2 * hexWidthUnit) < width; } j = 0; i += 1; isWithinWidth = true; isWithinHeight = minRowHeight - hexHeightUnit < height; } return hexArray; };
Put the sector in the middle of the hex grid (very crude)
Put the sector in the middle of the hex grid (very crude)
JavaScript
mit
mpigsley/sectors-without-number,mpigsley/sectors-without-number
--- +++ @@ -1,7 +1,11 @@ -const hexWidth = 50; +const defaultHexWidth = 50; const hexPadding = 2; export default ({ width, height, columns, rows, renderSector }) => { + const scaledWidth = Math.min(height / (rows + 4), width / (columns + 4)); + const horizHexOffset = Math.ceil((((width / scaledWidth) / (Math.sqrt(3) / 2)) - columns) / 2); + const vertHexOffset = Math.ceil(((height / scaledWidth) - rows) / 2); + const hexWidth = renderSector ? scaledWidth / (Math.sqrt(3) / 2) : defaultHexWidth; const hexWidthUnit = hexWidth / 4; const hexHeight = (Math.sqrt(3) / 2) * hexWidth; const hexHeightUnit = hexHeight / 2; @@ -20,7 +24,9 @@ width: hexWidth - hexPadding, xOffset, yOffset: j % 2 ? minRowHeight + hexHeightUnit : minRowHeight, - highlighted: renderSector && i < rows && j < columns, + highlighted: renderSector + && i > vertHexOffset && i < rows + vertHexOffset + && j > horizHexOffset && j < columns + horizHexOffset, }); j += 1; isWithinWidth = xOffset + (2 * hexWidthUnit) < width;