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
ef5a0a25ba4cd62820838f2cdae2db8cf50bd3cc
app/stores/SettingsStore.js
app/stores/SettingsStore.js
// @flow import { observable, computed } from 'mobx'; import BigNumber from 'bignumber.js'; import Store from './lib/Store'; import CachedRequest from './lib/CachedRequest'; export default class SettingsStore extends Store { @observable termsOfUseRequest = new CachedRequest(this.api, 'getTermsOfUse'); @observable bigNumberDecimalFormat = { decimalSeparator: '.', groupSeparator: ' ', groupSize: 3, secondaryGroupSize: 0, fractionGroupSeparator: ' ', fractionGroupSize: 0 }; setup() { this.registerReactions([ this._setBigNumberFormat, ]); } @computed get termsOfUse(): string { return this.termsOfUseRequest.execute().result; } _setBigNumberFormat = () => { BigNumber.config({ FORMAT: this.bigNumberDecimalFormat }); } }
// @flow import { observable, computed } from 'mobx'; import BigNumber from 'bignumber.js'; import Store from './lib/Store'; import CachedRequest from './lib/CachedRequest'; export default class SettingsStore extends Store { @observable termsOfUseRequest = new CachedRequest(this.api, 'getTermsOfUse'); @observable bigNumberDecimalFormat = { decimalSeparator: '.', groupSeparator: ',', groupSize: 3, secondaryGroupSize: 0, fractionGroupSeparator: ' ', fractionGroupSize: 0 }; setup() { this.registerReactions([ this._setBigNumberFormat, ]); } @computed get termsOfUse(): string { return this.termsOfUseRequest.execute().result; } _setBigNumberFormat = () => { BigNumber.config({ FORMAT: this.bigNumberDecimalFormat }); } }
Fix big number format configuration
Fix big number format configuration
JavaScript
apache-2.0
input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus,input-output-hk/daedalus
--- +++ @@ -10,7 +10,7 @@ @observable bigNumberDecimalFormat = { decimalSeparator: '.', - groupSeparator: ' ', + groupSeparator: ',', groupSize: 3, secondaryGroupSize: 0, fractionGroupSeparator: ' ',
6468e300b31dc2b1bf87e35f11a77952825a9e75
karma.conf.js
karma.conf.js
const base = require('skatejs-build/karma.conf'); module.exports = function (config) { base(config); // Remove all explicit IE definitions. config.browsers = config.browsers.filter(name => !/^internet_explorer/.test(name)); // Only test IE latest. config.browsers.push('internet_explorer_latest'); // Shims for testing. config.files = [ 'node_modules/es6-shim/es6-shim.js' ].concat(config.files); // Ensure mobile browsers have enough time to run. config.browserNoActivityTimeout = 60000; };
const base = require('skatejs-build/karma.conf'); module.exports = function (config) { base(config); // Remove all explicit IE definitions. config.browsers = config.browsers.filter(name => !/^internet_explorer/.test(name)); // Only test IE latest. config.browsers.push('internet_explorer_11'); // Shims for testing. config.files = [ 'node_modules/es6-shim/es6-shim.js' ].concat(config.files); // Ensure mobile browsers have enough time to run. config.browserNoActivityTimeout = 60000; };
Add browser spec for ie11. Doesn't seem that internet_explorer_latest works.
test(ie11): Add browser spec for ie11. Doesn't seem that internet_explorer_latest works.
JavaScript
mit
skatejs/skatejs,skatejs/skatejs,chrisdarroch/skatejs,skatejs/skatejs,chrisdarroch/skatejs
--- +++ @@ -6,7 +6,7 @@ config.browsers = config.browsers.filter(name => !/^internet_explorer/.test(name)); // Only test IE latest. - config.browsers.push('internet_explorer_latest'); + config.browsers.push('internet_explorer_11'); // Shims for testing. config.files = [
0d8e1060b97b42c3937267de07a4a9587ebdba1b
karma.conf.js
karma.conf.js
module.exports = function (config) { config.set({ frameworks: ['jasmine', 'browserify'], preprocessors: { 'dist/lion.js': ['browserify', 'coverage'], 'test/**/*.js': ['browserify'] }, reporters: ['progress', 'junit', 'coverage'], junitReporter: { outputFile: 'test-results.xml', suite: '' }, coverageReporter: { type: 'html', dir: 'test/coverage', file: 'coverage.html' }, files: [{ pattern: 'test/helpers/describeEach.js', included: true, served: true }, { pattern: 'bower_components/angular/angular.js', included: true, served: true }, { pattern: 'bower_components/angular-mocks/angular-mocks.js', included: true, served: true }, { pattern: 'bower_components/joi-browserify/joi-browserify.min.js', included: true, served: true }, 'test/unit/*.spec.js', { pattern: 'dist/lion.js', included: true, served: true } ], browsers: ['PhantomJS'], browserify: { debug: true, configure: function (bundle) { bundle.on('prebundle', function () { bundle.external('joi-browserify'); bundle.external('angular'); }); } } }); };
module.exports = function (config) { config.set({ frameworks: ['jasmine', 'browserify'], preprocessors: { 'dist/lion.js': ['browserify', 'coverage'], 'test/**/*.js': ['browserify'] }, reporters: ['progress', 'junit', 'coverage'], junitReporter: { outputFile: path.join(process.env.CIRCLE_TEST_REPORTS || '.', "karma", "junit.xml"), suite: 'karma' }, coverageReporter: { type: 'html', dir: 'test/coverage', file: 'coverage.html' }, files: [{ pattern: 'test/helpers/describeEach.js', included: true, served: true }, { pattern: 'bower_components/angular/angular.js', included: true, served: true }, { pattern: 'bower_components/angular-mocks/angular-mocks.js', included: true, served: true }, { pattern: 'bower_components/joi-browserify/joi-browserify.min.js', included: true, served: true }, 'test/unit/*.spec.js', { pattern: 'dist/lion.js', included: true, served: true } ], browsers: ['PhantomJS'], browserify: { debug: true, configure: function (bundle) { bundle.on('prebundle', function () { bundle.external('joi-browserify'); bundle.external('angular'); }); } } }); };
Add test output to Karma
Add test output to Karma
JavaScript
mit
asilluron/lionjs
--- +++ @@ -7,8 +7,8 @@ }, reporters: ['progress', 'junit', 'coverage'], junitReporter: { - outputFile: 'test-results.xml', - suite: '' + outputFile: path.join(process.env.CIRCLE_TEST_REPORTS || '.', "karma", "junit.xml"), + suite: 'karma' }, coverageReporter: { type: 'html',
cf285d9197c1e6c65d0d99583d588b09b264110f
test-main.js
test-main.js
if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function() {}, fBound = function() { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } var allTestFiles = []; var TEST_REGEXP = /(spec|test)\.js$/i; var pathToModule = function(path) { return path.replace(/^\/base\//, '').replace(/\.js$/, ''); }; Object.keys(window.__karma__.files).forEach(function(file) { if (TEST_REGEXP.test(file)) { // Normalize paths to RequireJS module names. allTestFiles.push(pathToModule(file)); } }); require.config({ // Karma serves files under /base, which is the basePath from your config file baseUrl: '/base', paths: { "chai": "/base/node_modules/chai/chai" }, // dynamically load all test files deps: allTestFiles, // we have to kickoff jasmine, as it is asynchronous callback: window.__karma__.start });
// PhantomJS doesn't support Function.prototype.bind if (!Function.prototype.bind) { var slice = Array.prototype.slice; Function.prototype.bind = function(context) { var func = this; var args = slice.call(arguments, 1); function bound() { var calledAsConstructor = func.prototype && (this instanceof func); return func.apply( // ignore context when called as a constructor !calledAsConstructor && context || this, args.concat(slice.call(arguments)) ); } bound.prototype = func.prototype; return bound; }; } var allTestFiles = []; var TEST_REGEXP = /(spec|test)\.js$/i; var pathToModule = function(path) { return path.replace(/^\/base\//, '').replace(/\.js$/, ''); }; Object.keys(window.__karma__.files).forEach(function(file) { if (TEST_REGEXP.test(file)) { // Normalize paths to RequireJS module names. allTestFiles.push(pathToModule(file)); } }); require.config({ // Karma serves files under /base, which is the basePath from your config file baseUrl: '/base', paths: { "chai": "/base/node_modules/chai/chai" }, // dynamically load all test files deps: allTestFiles, // we have to kickoff jasmine, as it is asynchronous callback: window.__karma__.start });
Fix Function.bind polyfill to work properly on PhantomJS.
Fix Function.bind polyfill to work properly on PhantomJS.
JavaScript
mit
OneJSToolkit/onejs,OneJSToolkit/onejs
--- +++ @@ -1,25 +1,22 @@ +// PhantomJS doesn't support Function.prototype.bind if (!Function.prototype.bind) { - Function.prototype.bind = function(oThis) { - if (typeof this !== 'function') { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); + var slice = Array.prototype.slice; + Function.prototype.bind = function(context) { + var func = this; + var args = slice.call(arguments, 1); + + function bound() { + var calledAsConstructor = func.prototype && (this instanceof func); + return func.apply( + // ignore context when called as a constructor + !calledAsConstructor && context || this, + args.concat(slice.call(arguments)) + ); } - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function() {}, - fBound = function() { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; + bound.prototype = func.prototype; - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; + return bound; }; }
ac903898478d239b507afa29a4bf10614cdc8976
data/maps/caveCombat.js
data/maps/caveCombat.js
eburp.registerMap("caveCombat",{ name: "Cave Combat", width: 9, height: 9, map: "\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ " });
eburp.registerMap("caveCombat",{ name: "Cave Combat", width: 9, height: 9, map: "\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ C'''''''C\ " });
Fix cave combat to reflect new battle sizes. 9x9
Fix cave combat to reflect new battle sizes. 9x9
JavaScript
apache-2.0
justindujardin/pow2,justindujardin/pow2,justindujardin/pow2
--- +++ @@ -11,5 +11,6 @@ C'''''''C\ C'''''''C\ C'''''''C\ +C'''''''C\ " });
e0976a86e8ea6145337ac4962a861638ca6d0488
models/Game.js
models/Game.js
/** * Module dependencies. */ const Score = require('./score'); const mongoose = require('mongoose'); const Schema = mongoose.Schema; // create a schema const gameSchema = new Schema({ started_at: Date, ended_at: Date, teams: [Schema.Types.ObjectId], score: [Score.schema] }); // create a model using schema const Game = mongoose.model('Game', gameSchema); // on every save, add the date gameSchema.pre('save', (next) => { if (!this.created_at) { this.created_at = new Date(); } next(); }); gameSchema.prototype.complete = function finishGame(completion) { if (ended_at) { // game is already completed return; } ended_at = new Date(); completion(); } // make this available to our users in our Node applications module.exports = Game;
/** * Module dependencies. */ const Score = require('./score'); const mongoose = require('mongoose'); const Schema = mongoose.Schema; // create a schema const gameSchema = new Schema({ started_at: Date, ended_at: Date, teams: [Schema.Types.ObjectId], score: [Score.schema] }); gameSchema.methods.start = function start(completion) { if (!this.started_at) { // game is already started this.started_at = new Date(); } gameSchema.prototype.complete = function finishGame(completion) { if (ended_at) { // game is already completed return; } ended_at = new Date(); completion(); } // make this available to our users in our Node applications module.exports = Game;
Replace pre function with start game function
Replace pre function with start game function
JavaScript
mit
lostatseajoshua/Challenger
--- +++ @@ -13,16 +13,11 @@ score: [Score.schema] }); -// create a model using schema -const Game = mongoose.model('Game', gameSchema); - -// on every save, add the date -gameSchema.pre('save', (next) => { - if (!this.created_at) { - this.created_at = new Date(); +gameSchema.methods.start = function start(completion) { + if (!this.started_at) { + // game is already started + this.started_at = new Date(); } - next(); -}); gameSchema.prototype.complete = function finishGame(completion) { if (ended_at) {
c5fd2290ef4ab86998fcb2ee887043920aa52e31
packages/github-oauth/package.js
packages/github-oauth/package.js
Package.describe({ summary: 'GitHub OAuth flow', version: '1.2.0' }); Package.onUse(function (api) { api.use('oauth2', ['client', 'server']); api.use('oauth', ['client', 'server']); api.use('http', ['server']); api.use('underscore', 'server'); api.use('random', 'client'); api.use('service-configuration', ['client', 'server']); api.addFiles('github_client.js', 'client'); api.addFiles('github_server.js', 'server'); api.export('Github'); });
Package.describe({ summary: 'GitHub OAuth flow', version: '1.2.1' }); Package.onUse(function (api) { api.use('oauth2', ['client', 'server']); api.use('oauth', ['client', 'server']); api.use('http', ['server']); api.use('underscore', ['client', 'server']); api.use('random', 'client'); api.use('service-configuration', ['client', 'server']); api.addFiles('github_client.js', 'client'); api.addFiles('github_server.js', 'server'); api.export('Github'); });
Use underscore on client in github-oauth
Use underscore on client in github-oauth `_` is being used in github_client.js, but not specified in the package
JavaScript
mit
Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor
--- +++ @@ -1,13 +1,13 @@ Package.describe({ summary: 'GitHub OAuth flow', - version: '1.2.0' + version: '1.2.1' }); Package.onUse(function (api) { api.use('oauth2', ['client', 'server']); api.use('oauth', ['client', 'server']); api.use('http', ['server']); - api.use('underscore', 'server'); + api.use('underscore', ['client', 'server']); api.use('random', 'client'); api.use('service-configuration', ['client', 'server']);
b7dd1f5adf6eeb229805dece644ac90f0625f4d7
models/user.js
models/user.js
module.exports = function(sequelize, DataTypes) { var User = sequelize.define('User', { username: {type: DataTypes.STRING, unique: true}, password: DataTypes.STRING, email: DataTypes.STRING }); return User; };
module.exports = function(sequelize, DataTypes) { var User = sequelize.define('User', { username: { type: DataTypes.STRING, allowNull: false, unique: true }, password: { type: DataTypes.STRING, allowNull: false }, email: { type: DataTypes.STRING, allowNull: false }, experience: { type: DataTypes.BIGINT, allowNull: false, defaultValue: 0 } }); return User; };
Add experience and non-null constraints to User model.
Add experience and non-null constraints to User model.
JavaScript
mit
kevinwang/questkey
--- +++ @@ -1,8 +1,23 @@ module.exports = function(sequelize, DataTypes) { var User = sequelize.define('User', { - username: {type: DataTypes.STRING, unique: true}, - password: DataTypes.STRING, - email: DataTypes.STRING + username: { + type: DataTypes.STRING, + allowNull: false, + unique: true + }, + password: { + type: DataTypes.STRING, + allowNull: false + }, + email: { + type: DataTypes.STRING, + allowNull: false + }, + experience: { + type: DataTypes.BIGINT, + allowNull: false, + defaultValue: 0 + } }); return User; };
fba33f2eb3ad86f45d733cf349c6b13a7ebb6ee5
addon/locales/ru/components/flexberry-maplayer.js
addon/locales/ru/components/flexberry-maplayer.js
export default { 'opacity-label': { 'tooltip': 'Видимость слоя' }, 'attributes-button': { 'tooltip': 'Показать панель атрибутов слоя' }, 'bounds-button': { 'tooltip': 'Приблизить к границам слоя' }, 'add-button': { 'tooltip': 'Добавить новй дочерний слой' }, 'copy-button': { 'tooltip': 'Создать копию слоя' }, 'edit-button': { 'tooltip': 'Редактировать настройки слоя' }, 'remove-button': { 'tooltip': 'Удалить слой' } };
export default { 'opacity-label': { 'tooltip': 'Видимость слоя' }, 'attributes-button': { 'tooltip': 'Показать панель атрибутов слоя' }, 'bounds-button': { 'tooltip': 'Приблизить к границам слоя' }, 'add-button': { 'tooltip': 'Добавить новый дочерний слой' }, 'copy-button': { 'tooltip': 'Создать копию слоя' }, 'edit-button': { 'tooltip': 'Редактировать настройки слоя' }, 'remove-button': { 'tooltip': 'Удалить слой' } };
Fix typo on add new layer button
Fix typo on add new layer button
JavaScript
mit
Flexberry/ember-flexberry-gis,Flexberry/ember-flexberry-gis,Flexberry/ember-flexberry-gis
--- +++ @@ -9,7 +9,7 @@ 'tooltip': 'Приблизить к границам слоя' }, 'add-button': { - 'tooltip': 'Добавить новй дочерний слой' + 'tooltip': 'Добавить новый дочерний слой' }, 'copy-button': { 'tooltip': 'Создать копию слоя'
a9d782a0953b13a18487883ae727b821813a98ef
assets/javascripts/color.js
assets/javascripts/color.js
(function(){ var app = angular.module('color', []); app.config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; }]); app.controller('ColorController', [ '$http', function($http) { var color = this; color.start = "000000"; color.middle = "808080"; color.end = "FFFFFF"; this.inputChanged = function() { if (!properInputSizes()) return; var call = "http://color-divider.herokuapp.com/middle_color?start_color=%23" + color.start + "&end_color=%23" + color.end; $http.get(call).success(function(data){ color.middle = data.substr(1); }); } function properInputSizes() { return (color.start.length == 3 || color.start.length == 6) && /^([0-9a-fA-F]+)$/.test(color.start) && (color.end.length == 3 || color.end.length == 6) && /^([0-9a-fA-F]+)$/.test(color.end); } }]); })();
(function(){ angular.module('color', []) .config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; }]) .controller('ColorController', [ '$http', function($http) { var color = this; color.start = "000000"; color.middle = "808080"; color.end = "FFFFFF"; this.inputChanged = function() { if (!properInputSizes()) return; var call = "http://color-divider.herokuapp.com/middle_color?start_color=%23" + color.start + "&end_color=%23" + color.end; $http.get(call).success(function(data){ color.middle = data.substr(1); }); } function properInputSizes() { return (color.start.length == 3 || color.start.length == 6) && /^([0-9a-fA-F]+)$/.test(color.start) && (color.end.length == 3 || color.end.length == 6) && /^([0-9a-fA-F]+)$/.test(color.end); } }]); })();
Remove the app variable for styling
Remove the app variable for styling
JavaScript
mit
cbachich/color_divider-fe
--- +++ @@ -1,12 +1,13 @@ (function(){ - var app = angular.module('color', []); - app.config(['$httpProvider', function($httpProvider) { + angular.module('color', []) + + .config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; - }]); + }]) - app.controller('ColorController', [ '$http', function($http) { + .controller('ColorController', [ '$http', function($http) { var color = this; color.start = "000000";
cd32d405c9f9bc703e5fd4b12c883846b17bdf90
gulp/build.js
gulp/build.js
'use strict'; var gulp = require('gulp'); var config = require('./_config.js'); var paths = config.paths; var $ = config.plugins; var istanbul = require('browserify-istanbul'); gulp.task('clean', function () { return gulp.src(paths.tmp, {read: true}) .pipe($.rimraf()); }); gulp.task('build', ['index.html', 'js', 'css']); gulp.task('index.html', function () { return gulp.src(paths.app + '/index.jade') .pipe($.jade({ pretty: true })) .pipe(gulp.dest(paths.tmp)); }); gulp.task('jade', function () { return gulp.src(paths.app + '/*.html') .pipe(gulp.dest(paths.tmp)); }); gulp.task('js', function () { return gulp.src(paths.app + '/js/main.js', { read: false }) .pipe($.browserify({ transform: [istanbul], debug: false })) .pipe(gulp.dest(paths.tmp + '/js')); }); gulp.task('css', function () { // FIXME return gulp.src('mama'); });
'use strict'; var gulp = require('gulp'); var config = require('./_config.js'); var paths = config.paths; var $ = config.plugins; var istanbul = require('browserify-istanbul'); gulp.task('clean', function () { return gulp.src(paths.tmp, {read: true}) .pipe($.rimraf()); }); gulp.task('build', ['index.html', 'js', 'css']); gulp.task('index.html', function () { return gulp.src(paths.app + '/index.jade') .pipe($.jade({ pretty: true })) .pipe(gulp.dest(paths.tmp)); }); gulp.task('jade', function () { return gulp.src(paths.app + '/*.html') .pipe(gulp.dest(paths.tmp)); }); gulp.task('js', function () { return gulp.src(paths.app + '/js/main.js', { read: false }) .pipe($.browserify({ transform: [istanbul], debug: true })) .pipe(gulp.dest(paths.tmp + '/js')); }); gulp.task('css', function () { // FIXME return gulp.src('mama'); });
Switch browserify back to debugging mode.
Switch browserify back to debugging mode.
JavaScript
mpl-2.0
learnfwd/learnfwd.com,learnfwd/learnfwd.com,learnfwd/learnfwd.com
--- +++ @@ -32,7 +32,7 @@ return gulp.src(paths.app + '/js/main.js', { read: false }) .pipe($.browserify({ transform: [istanbul], - debug: false + debug: true })) .pipe(gulp.dest(paths.tmp + '/js')); });
2750c4c4c08dc452e7dedea70f15e28e25e0f334
app/components/Avatar/index.js
app/components/Avatar/index.js
// @flow import React from 'react'; import { Image, View } from 'react-native'; import theme from '../../theme'; type Props = { size?: number, source: string, style?: Object, }; export default function Avatar({ size = 44, source, style, ...props }: Props) { const styles = { wrapper: { backgroundColor: theme.color.sceneBg, borderRadius: size, overflow: 'hidden', height: size, width: size, }, image: { borderRadius: size, height: size, width: size, }, }; return ( <View style={[styles.wrapper, style]} {...props}> <Image source={{ uri: source }} style={styles.image} /> </View> ); }
// @flow import React from 'react'; import { Image, Platform, View } from 'react-native'; import theme from '../../theme'; type Props = { size?: number, source: string, style?: Object, }; export default function Avatar({ size = 44, source, style, ...props }: Props) { const styles = { wrapper: { backgroundColor: theme.color.sceneBg, borderRadius: size, overflow: 'hidden', height: size, width: size, }, image: { borderRadius: Platform.OS === 'android' ? size : 0, height: size, width: size, }, }; return ( <View style={[styles.wrapper, style]} {...props}> <Image source={{ uri: source }} style={styles.image} /> </View> ); }
Fix for double attempt at circle on iOS.
Fix for double attempt at circle on iOS.
JavaScript
mit
Thinkmill/react-conf-app,Thinkmill/react-conf-app,brentvatne/react-conf-app,Thinkmill/react-conf-app
--- +++ @@ -1,6 +1,6 @@ // @flow import React from 'react'; -import { Image, View } from 'react-native'; +import { Image, Platform, View } from 'react-native'; import theme from '../../theme'; @@ -20,7 +20,7 @@ width: size, }, image: { - borderRadius: size, + borderRadius: Platform.OS === 'android' ? size : 0, height: size, width: size, },
ca3bfdc68e01285f1118496906799f4a4cef0eb1
app/routes/events/components/RegisteredSummary.js
app/routes/events/components/RegisteredSummary.js
import React from 'react'; import { Link } from 'react-router'; import Tooltip from 'app/components/Tooltip'; import { FlexRow, FlexColumn, FlexItem } from 'app/components/FlexBox'; const Reg = ({ user }) => ( <Tooltip content={user.fullName}> <Link to={`/users/${user.username}`} style={{ color: 'white' }}> {user.firstName} </Link> </Tooltip> ); const namesList = (registrations) => ( <FlexColumn> {registrations.map((reg) => ( <FlexItem key={reg.id}>{reg.fullName}</FlexItem> ))} </FlexColumn> ); const RegList = ({ registrations }) => ( <Tooltip content={namesList(registrations)} list> {[`${registrations.length} ${registrations.length === 1 ? 'annen' : 'andre'}`]} </Tooltip> ); const RegisteredSummary = ({ registrations }) => ( <FlexRow> {[<Reg key={0} user={registrations[0]} />, ',\u00A0', <Reg key={1} user={registrations[1]} />, '\u00A0og\u00A0', <RegList key={2} registrations={registrations.slice(2)} />, '\u00A0er påmeldt']} </FlexRow> ); export default RegisteredSummary;
import React from 'react'; import { Link } from 'react-router'; import Tooltip from 'app/components/Tooltip'; import { FlexRow, FlexColumn, FlexItem } from 'app/components/FlexBox'; const Registration = ({ user }) => ( <Tooltip content={user.fullName}> <Link to={`/users/${user.username}`} style={{ color: 'white' }}> {user.firstName} </Link> </Tooltip> ); const nameList = (registrations) => ( <FlexColumn> {registrations.map((reg) => ( <FlexItem key={reg.id}>{reg.fullName}</FlexItem> ))} </FlexColumn> ); const RegistrationList = ({ registrations }) => ( <Tooltip content={nameList(registrations)} list> {`${registrations.length} ${registrations.length === 1 ? 'annen' : 'andre'}`} </Tooltip> ); const RegisteredSummary = ({ registrations }) => ( <FlexRow> {[<Registration key={0} user={registrations[0]} />, ',\u00A0', <Registration key={1} user={registrations[1]} />, '\u00A0og\u00A0', <RegistrationList key={2} registrations={registrations.slice(2)} />, '\u00A0er påmeldt']} </FlexRow> ); export default RegisteredSummary;
Fix naming and remove unnecessary
Fix naming and remove unnecessary []
JavaScript
mit
webkom/lego-webapp,webkom/lego-webapp,webkom/lego-webapp
--- +++ @@ -3,7 +3,7 @@ import Tooltip from 'app/components/Tooltip'; import { FlexRow, FlexColumn, FlexItem } from 'app/components/FlexBox'; -const Reg = ({ user }) => ( +const Registration = ({ user }) => ( <Tooltip content={user.fullName}> <Link to={`/users/${user.username}`} style={{ color: 'white' }}> {user.firstName} @@ -11,7 +11,7 @@ </Tooltip> ); -const namesList = (registrations) => ( +const nameList = (registrations) => ( <FlexColumn> {registrations.map((reg) => ( <FlexItem key={reg.id}>{reg.fullName}</FlexItem> @@ -19,19 +19,19 @@ </FlexColumn> ); -const RegList = ({ registrations }) => ( - <Tooltip content={namesList(registrations)} list> - {[`${registrations.length} ${registrations.length === 1 ? 'annen' : 'andre'}`]} +const RegistrationList = ({ registrations }) => ( + <Tooltip content={nameList(registrations)} list> + {`${registrations.length} ${registrations.length === 1 ? 'annen' : 'andre'}`} </Tooltip> ); const RegisteredSummary = ({ registrations }) => ( <FlexRow> - {[<Reg key={0} user={registrations[0]} />, + {[<Registration key={0} user={registrations[0]} />, ',\u00A0', - <Reg key={1} user={registrations[1]} />, + <Registration key={1} user={registrations[1]} />, '\u00A0og\u00A0', - <RegList key={2} registrations={registrations.slice(2)} />, + <RegistrationList key={2} registrations={registrations.slice(2)} />, '\u00A0er påmeldt']} </FlexRow> );
096e398fbc89bf0dd3751ad012e6f944e4093949
assets/js/components/adminbar/AdminBarZeroData.js
assets/js/components/adminbar/AdminBarZeroData.js
/** * Admin Bar Clicks component. * * Site Kit by Google, Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const AdminBarZeroData = () => { return ( <div className=" mdc-layout-grid__cell mdc-layout-grid__cell--span-4-phone mdc-layout-grid__cell--span-8-tablet mdc-layout-grid__cell--span-10-desktop "> <div className="googlesitekit-zero-data"> <h3 className="googlesitekit-zero-data__title">No data available yet</h3> <p className="googlesitekit-zero-data__description">There is no data available for this content yet. This could be because it was recently created or because nobody has accessed it so far.</p> </div> </div> ); }; export default AdminBarZeroData;
/** * Admin Bar Clicks component. * * Site Kit by Google, Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const AdminBarZeroData = () => { return ( <div className=" mdc-layout-grid__cell--span-4-phone mdc-layout-grid__cell--span-8-tablet mdc-layout-grid__cell--span-12-desktop "> <div className="googlesitekit-zero-data"> <h3 className="googlesitekit-zero-data__title">No data available yet</h3> <p className="googlesitekit-zero-data__description">There is no data available for this content yet. This could be because it was recently created or because nobody has accessed it so far.</p> </div> </div> ); }; export default AdminBarZeroData;
Update zero data column width on desktop.
Update zero data column width on desktop.
JavaScript
apache-2.0
google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp
--- +++ @@ -1,7 +1,7 @@ /** * Admin Bar Clicks component. * - * Site Kit by Google, Copyright 2020 Google LLC + * Site Kit by Google, Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,9 @@ const AdminBarZeroData = () => { return ( <div className=" - mdc-layout-grid__cell mdc-layout-grid__cell--span-4-phone mdc-layout-grid__cell--span-8-tablet - mdc-layout-grid__cell--span-10-desktop + mdc-layout-grid__cell--span-12-desktop "> <div className="googlesitekit-zero-data"> <h3 className="googlesitekit-zero-data__title">No data available yet</h3>
abb3d6440881e4aac491eae0bb90817f469637b2
controllers/artist-controller.js
controllers/artist-controller.js
var request = require('request'); var model = require('../models/index'); /* Sets a like in the Like table for a given artist and user (by Facebook ID number) */ exports.likeArtist = function(req, res) { if (isNaN(req.params.id)) { return res.status(400).send('Bad input: ' + req.params.id); } else { if (!(req.params.id % 1 === 0)) { return res.status(400).send('Bad input: ' + req.params.id); } } model.Artist.find({ where: { facebookId: req.params.id } }) .then(function(artist) { if (artist === null) { return res.status(400).send('No artist found: ' + req.params.id); } else { model.Like.find({ where: { user: req.user.id, artist: req.params.id } }) .then(function(like) { if (like === null) { model.Like.create({ user: req.user.id, artist: req.params.id }) .then(function(like) { return res.status(200).send(like); }) .catch(function(err) { console.log(err); return res.status(400).send(err); }); } else { return res.status(400).send('Like already in table: ' + like); } }) .catch(function(err) { console.log(err); return res.status(400).send(err); }); } }) .catch(function(err) { console.log(err); return res.status(400).send(err); }); } /* Retrieves the artist recommendations for the user */ exports.getArtistRecommendations = function(req, res) { return res.status(200).send('Success'); }
var model = require('../models/index'); /* Sets a like in the Like table for a given artist and user (by Facebook ID number) */ exports.likeArtist = function(req, res) { return res.status(200).send('Success'); } /* Retrieves the artist recommendations for the user */ exports.getArtistRecommendations = function(req, res) { return res.status(200).send('Success'); }
Move code to the job queue implementation
Move code to the job queue implementation
JavaScript
mit
kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender,kurtbradd/facebook-music-recommender
--- +++ @@ -1,49 +1,8 @@ -var request = require('request'); var model = require('../models/index'); /* Sets a like in the Like table for a given artist and user (by Facebook ID number) */ exports.likeArtist = function(req, res) { - if (isNaN(req.params.id)) { - return res.status(400).send('Bad input: ' + req.params.id); - } - else { - if (!(req.params.id % 1 === 0)) { - return res.status(400).send('Bad input: ' + req.params.id); - } - } - - model.Artist.find({ where: { facebookId: req.params.id } }) - .then(function(artist) { - if (artist === null) { - return res.status(400).send('No artist found: ' + req.params.id); - } - else { - model.Like.find({ where: { user: req.user.id, artist: req.params.id } }) - .then(function(like) { - if (like === null) { - model.Like.create({ user: req.user.id, artist: req.params.id }) - .then(function(like) { - return res.status(200).send(like); - }) - .catch(function(err) { - console.log(err); - return res.status(400).send(err); - }); - } - else { - return res.status(400).send('Like already in table: ' + like); - } - }) - .catch(function(err) { - console.log(err); - return res.status(400).send(err); - }); - } - }) - .catch(function(err) { - console.log(err); - return res.status(400).send(err); - }); + return res.status(200).send('Success'); } /* Retrieves the artist recommendations for the user */
15c1b77326ce093c3b2e9be837fdc2d914a10aee
app/views/DiscussionDetails.js
app/views/DiscussionDetails.js
import React from "react-native"; import PeopleListContainer from "../containers/PeopleListContainer"; import Card from "./Card"; import CardTitle from "./CardTitle"; import DiscussionSummary from "./DiscussionSummary"; import CardAuthor from "./CardAuthor"; import ListHeader from "./ListHeader"; const { ScrollView, View, StyleSheet } = React; const styles = StyleSheet.create({ details: { paddingVertical: 12 }, title: { marginBottom: 8, marginHorizontal: 16 }, author: { marginTop: 8, marginHorizontal: 16 } }); const DiscussionDetails = props => { const { thread, navigator } = props; return ( <ScrollView {...props}> <Card style={styles.details}> <CardTitle style={styles.title}>{thread.title}</CardTitle> <DiscussionSummary text={thread.text} /> <CardAuthor nick={thread.from} style={styles.author} /> </Card> <ListHeader>People talking</ListHeader> <PeopleListContainer thread={thread.id} navigator={navigator} /> </ScrollView> ); }; DiscussionDetails.propTypes = { thread: React.PropTypes.shape({ text: React.PropTypes.string.isRequired }).isRequired, navigator: React.PropTypes.object.isRequired }; export default DiscussionDetails;
import React from "react-native"; import PeopleListContainer from "../containers/PeopleListContainer"; import Card from "./Card"; import CardTitle from "./CardTitle"; import DiscussionSummary from "./DiscussionSummary"; import CardAuthor from "./CardAuthor"; import ListHeader from "./ListHeader"; const { ScrollView, StyleSheet } = React; const styles = StyleSheet.create({ details: { paddingVertical: 12, marginVertical: 0 }, title: { marginBottom: 8, marginHorizontal: 16 }, author: { marginTop: 8, marginHorizontal: 16 } }); const DiscussionDetails = props => { const { thread, navigator } = props; return ( <ScrollView {...props}> <Card style={styles.details}> <CardTitle style={styles.title}>{thread.title}</CardTitle> <DiscussionSummary text={thread.text} /> <CardAuthor nick={thread.from} style={styles.author} /> </Card> <ListHeader>People talking</ListHeader> <PeopleListContainer thread={thread.id} navigator={navigator} /> </ScrollView> ); }; DiscussionDetails.propTypes = { thread: React.PropTypes.shape({ text: React.PropTypes.string.isRequired }).isRequired, navigator: React.PropTypes.object.isRequired }; export default DiscussionDetails;
Remove vertical padding from details card
Remove vertical padding from details card
JavaScript
unknown
wesley1001/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods
--- +++ @@ -8,13 +8,13 @@ const { ScrollView, - View, StyleSheet } = React; const styles = StyleSheet.create({ details: { - paddingVertical: 12 + paddingVertical: 12, + marginVertical: 0 }, title: {
6be99d06a66f2e339e8f58453829bf2f4b2b6470
static/main_site/index.js
static/main_site/index.js
$(function () { $('.frilinks .fri').each(function (n, e) { e = $(e); var hr = e.find('a').attr('href'); if (!hr) return; e.css({cursor: 'pointer'}); e.click(function (e) { window.open(hr); e.preventDefault(); }); }); var header = $('.header'); var headbg = header.find('.background'); var bhc = header.find('.big-header-content'); var tsy = 250; var bhch; function find_bhch () { bhc.css({"height": ""}); bhch = (bhc.length ? bhc.height() : 0) tsy = header.height(); } function am () { requestAnimationFrame(am); find_bhch(); var t = Math.min(window.scrollY / tsy, 1); headbg.css({opacity: 1 - t}); if (bhch > 0) { bhc.css({height: (bhch * (1 - t)) + "px", opacity: 1 - t}); bhc.css("pointer-events", (t>=0.5?"none":"")); } } am(); });
$(function () { $('.frilinks .fri').each(function (n, e) { e = $(e); var hr = e.find('a').attr('href'); if (!hr) return; e.css({cursor: 'pointer'}); e.click(function (e) { window.open(hr); e.preventDefault(); }); }); var header = $('.header'); var headbg = header.find('.background'); var bhc = header.find('.big-header-content'); var tsy = 250; var bhch; function find_bhch () { bhc.css({"height": ""}); bhch = (bhc.length ? bhc.height() : 0) tsy = header.height(); } function am () { requestAnimationFrame(am); find_bhch(); var t = Math.min($(window).scrollTop() / tsy, 1); headbg.css({opacity: 1 - t}); if (bhch > 0) { bhc.css({height: (bhch * (1 - t)) + "px", opacity: 1 - t}); bhc.css("pointer-events", (t>=0.5?"none":"")); } } am(); });
Use jQuery.scrollTop to support IE.
Use jQuery.scrollTop to support IE.
JavaScript
mit
micromaomao/maowtm.org,micromaomao/maowtm.org
--- +++ @@ -23,7 +23,7 @@ function am () { requestAnimationFrame(am); find_bhch(); - var t = Math.min(window.scrollY / tsy, 1); + var t = Math.min($(window).scrollTop() / tsy, 1); headbg.css({opacity: 1 - t}); if (bhch > 0) { bhc.css({height: (bhch * (1 - t)) + "px", opacity: 1 - t});
970c1663a035f57133359a84d7cabf2d2ebc68ac
unify/framework/source/class/unify/core/Init.js
unify/framework/source/class/unify/core/Init.js
(function() { var app; var getApplication = function() { return app; }; var shutDown = function() { lowland.ObjectManager.dispose(); }; var startUp = function() { var Application = core.Class.getByName(core.Env.getValue("application") + ".Application"); var init = new Application(); app = init; init.main(); init.finalize(); //lowland.bom.Events.listen(window, "shutdown", shutDown); lowland.bom.Events.listen(window, "beforeunload", shutDown); }; core.Class("unify.core.Init", { include : [unify.core.Object], construct : function() { unify.core.Object.call(this); }, members : { main : function() { throw new Error("main is not implemented"); }, finalize : function() {} } }); unify.core.Statics.annotate(unify.core.Init, { getApplication : getApplication, startUp : startUp, shutDown : shutDown }); })();
(function() { var app; var getApplication = function() { return app; }; var shutDown = function() { lowland.ObjectManager.dispose(); }; var startUp = function() { var Application = core.Class.getByName(core.Env.getValue("application") + ".Application"); var init = new Application(); app = init; init.main(); init.finalize(); //lowland.bom.Events.listen(window, "shutdown", shutDown); //lowland.bom.Events.listen(window, "beforeunload", shutDown); }; core.Class("unify.core.Init", { include : [unify.core.Object], construct : function() { unify.core.Object.call(this); }, members : { main : function() { throw new Error("main is not implemented"); }, finalize : function() {} } }); unify.core.Statics.annotate(unify.core.Init, { getApplication : getApplication, startUp : startUp, shutDown : shutDown }); })();
Remove unload objects as this leads to errors
Remove unload objects as this leads to errors
JavaScript
mit
unify/unify,unify/unify,unify/unify,unify/unify,unify/unify,unify/unify
--- +++ @@ -20,7 +20,7 @@ init.finalize(); //lowland.bom.Events.listen(window, "shutdown", shutDown); - lowland.bom.Events.listen(window, "beforeunload", shutDown); + //lowland.bom.Events.listen(window, "beforeunload", shutDown); };
45659acb2978512fa873234a2017ace6e68c5be3
client/datamodel/datamodel.js
client/datamodel/datamodel.js
xcomponents.appVersion = '0.1'; xcomponents.menuOptions = [ { label : 'Data objects', url : '/', icon : 'fa-dashboard' } ]; xcomponents.models['dataObject'] = { name : 'Data object', fields : [ { label : 'Name' , field: 'name', required: true}, { label : 'Scope/module', field : 'scope', type : 'select', options : ['System', 'Overview module', 'Dashboard module', 'Document Library module', 'Workbook module']}, { label : 'Attributes', field : 'attributes', type : 'multiline'}, { label : 'Last update', field : 'updated', type : 'date', edit : false}, { label : 'Details' , field: 'details', type : 'multiline' } ] };
xcomponents.appVersion = '0.1'; xcomponents.menuOptions = [ { label : 'Data objects', url : '/', icon : 'fa-dashboard' } ]; xcomponents.models['dataObject'] = { name : 'Data object', fields : [ { label : 'Name' , field: 'name', required: true}, { label : 'Scope/module', field : 'scope', type : 'select', options : ['System', 'Overview module', 'Dashboard module', 'Document Wiki module', 'Workbook module']}, { label : 'Attributes', field : 'attributes', type : 'multiline'}, { label : 'Last update', field : 'updated', type : 'date', edit : false}, { label : 'Details' , field: 'details', type : 'multiline' } ] };
Document library renamed to Document Wiki
Document library renamed to Document Wiki
JavaScript
agpl-3.0
SteveFortune/isometrica-app,SteveFortune/isometrica-app,SteveFortune/isometrica-app
--- +++ @@ -9,7 +9,7 @@ name : 'Data object', fields : [ { label : 'Name' , field: 'name', required: true}, - { label : 'Scope/module', field : 'scope', type : 'select', options : ['System', 'Overview module', 'Dashboard module', 'Document Library module', 'Workbook module']}, + { label : 'Scope/module', field : 'scope', type : 'select', options : ['System', 'Overview module', 'Dashboard module', 'Document Wiki module', 'Workbook module']}, { label : 'Attributes', field : 'attributes', type : 'multiline'}, { label : 'Last update', field : 'updated', type : 'date', edit : false}, { label : 'Details' , field: 'details', type : 'multiline' }
7852d101c6c1e5a1081e38c89923a5de16317c71
rhaptos2/repo/static/authortools_aloha_settings.js
rhaptos2/repo/static/authortools_aloha_settings.js
/** * Used to initialize the Aloha settings for this application. * * Author: Michael Mulich * Copyright (c) 2012 Rice University * * This software is subject to the provisions of the GNU Lesser General * Public License Version 2.1 (LGPL). See LICENSE.txt for details. */ Aloha = window.Aloha || {}; Aloha.settings = { // jQuery: window.jQuery, // logLevels: {'error': true, 'warn': true, 'info': false, 'debug': false}, // errorhandling : true, plugins: { draganddropfiles: { upload: { config: { method: "POST", url: function() { var url, uid; id = serialise_form().uuid; url = MODULEURL + id + '/upload'; return url; }, callback: function(resp) { Aloha.jQuery('#' + this.id).attr('src', resp); console.log('Updated Image src as a result of upload'); }, }, }, }, block: { defaults : { '.default-block': { }, 'figure': { 'aloha-block-type': 'EditableImageBlock' }, } } }, };
/** * Used to initialize the Aloha settings for this application. * * Author: Michael Mulich * Copyright (c) 2012 Rice University * * This software is subject to the provisions of the GNU Lesser General * Public License Version 2.1 (LGPL). See LICENSE.txt for details. */ Aloha = window.Aloha || {}; Aloha.settings = { // jQuery: window.jQuery, // logLevels: {'error': true, 'warn': true, 'info': false, 'debug': false}, // errorhandling : true, plugins: { image: { uploadurl: "/resource", parseresponse: function(xhr) { return xhr.response; }, }, block: { defaults : { '.default-block': { }, 'figure': { 'aloha-block-type': 'EditableImageBlock' }, } } }, };
Use the oerpub image plugin instead.
Use the oerpub image plugin instead.
JavaScript
lgpl-2.1
philschatz/rhaptos2.repo,philschatz/rhaptos2.repo,philschatz/rhaptos2.repo
--- +++ @@ -15,22 +15,9 @@ // logLevels: {'error': true, 'warn': true, 'info': false, 'debug': false}, // errorhandling : true, plugins: { - draganddropfiles: { - upload: { - config: { - method: "POST", - url: function() { - var url, uid; - id = serialise_form().uuid; - url = MODULEURL + id + '/upload'; - return url; - }, - callback: function(resp) { - Aloha.jQuery('#' + this.id).attr('src', resp); - console.log('Updated Image src as a result of upload'); - }, - }, - }, + image: { + uploadurl: "/resource", + parseresponse: function(xhr) { return xhr.response; }, }, block: { defaults : {
cc1092a5c94b102448090429f0d7ee14ed26e19d
server/model/content_code/schema.js
server/model/content_code/schema.js
'use strict'; const _ = require('lodash'); const Bluebird = require('bluebird'); const mongoose = require('mongoose'); const mongooseDelete = require('mongoose-delete'); const ShortId = require('mongoose-shortid-nodeps'); const Settings = require('../../settings'); const Content = require('./content'); const validations = require('./validations'); const schema = new mongoose.Schema({ code: { type : ShortId, index : true // Added to make the code unique }, name: String, active: { type: Boolean, default: true }, content: [ Content ] }); schema.plugin(validations); schema.plugin(mongooseDelete, { overrideMethods: 'all' }); function transform(doc, ret) { return _.pick(ret, Settings.ContentCode.paths); } schema.set('toJSON', { transform }); schema.set('toObject', { transform }); // Promisify mongoose-delete methods Bluebird.promisifyAll(schema.methods); module.exports = schema;
'use strict'; const _ = require('lodash'); const Bluebird = require('bluebird'); const mongoose = require('mongoose'); const mongooseDelete = require('mongoose-delete'); const ShortId = require('mongoose-shortid-nodeps'); const Settings = require('../../settings'); const Content = require('./content'); const validations = require('./validations'); const schema = new mongoose.Schema({ code: { type : ShortId, index : true // Added to make the code unique }, name: String, active: { type: Boolean, default: true }, content: [ Content ] }); schema.plugin(validations); schema.plugin(mongooseDelete, { overrideMethods: 'all' }); function transform(doc, ret) { let result = _.cloneDeep(ret); result = _.pick(ret, Settings.ContentCode.paths); // Sort by created date. It would be better to add a created_at field. result.content = _.sortBy(result.content, (ci) => { return -ci._id.getTimestamp(); }); return result; } schema.set('toJSON', { transform }); schema.set('toObject', { transform }); // Promisify mongoose-delete methods Bluebird.promisifyAll(schema.methods); module.exports = schema;
Sort content items by DEC _id
Sort content items by DEC _id
JavaScript
mit
jedbangers/exclusive-content-web,jedbangers/exclusive-content-web
--- +++ @@ -23,7 +23,15 @@ schema.plugin(mongooseDelete, { overrideMethods: 'all' }); function transform(doc, ret) { - return _.pick(ret, Settings.ContentCode.paths); + let result = _.cloneDeep(ret); + result = _.pick(ret, Settings.ContentCode.paths); + + // Sort by created date. It would be better to add a created_at field. + result.content = _.sortBy(result.content, (ci) => { + return -ci._id.getTimestamp(); + }); + + return result; } schema.set('toJSON', { transform });
dfcf1531726ad89afbec3054b666fc6b84a2093a
scripts/embedQA.js
scripts/embedQA.js
/* global $ */ $(() => { "use strict"; var $qanda = $(".js-q-and-a"); var url = "http://localhost:8000/5614e8bded37eded3f16a9e6"; fetch(url).then((response) => { response.json().then((resp) => { if (!resp._embedded || !resp._embedded["hack:questions"] || !resp._embedded["hack:questions"].length) { throw new Error("Unable to find questions!"); } let questions = resp._embedded["hack:questions"]; $qanda.html(""); questions.forEach((q) => { if (!q._embedded || !q._embedded["hack:answers"] || !q._embedded["hack:answers"].length) { return; // skip, no answers yet for this question } q._embedded["hack:answers"].forEach((answer) => $qanda.append(` <div><h4>${q.question}</h4><p>${answer.answer}</p></div> `)); }); }); }); });
/* global $ */ $(() => { "use strict"; var $qanda = $(".js-q-and-a"); var url = "http://localhost:8000/5614e8bded37eded3f16a9e6"; fetch(url).then((response) => { response.json().then((resp) => { if (!resp._embedded || !resp._embedded["hack:questions"] || !resp._embedded["hack:questions"].length) { throw new Error("Unable to find questions!"); } let questions = resp._embedded["hack:questions"]; console.log(resp._embedded["hack:questions"]) $qanda.html(""); questions.forEach((q) => { if (!q._embedded || !q._embedded["hack:answers"] || !q._embedded["hack:answers"].length) { return; // skip, no answers yet for this question } let answers = q._embedded["hack:answers"].reduce((i, answer) => { return `${i} <li class="question--answer">${answer.answer}</li>`; }, ""); $qanda.append(` <div class="question"> <h4 class="question--title">${q.question}</h4> <div class="question--info"> <span>on ${q.createdAt}</span> | <span>Upvotes: ${q.positive}</span> </div> <ul>${answers}</ul> </div> `); }); }); }); });
Add styling classes to the embedded product page script
Add styling classes to the embedded product page script
JavaScript
mit
roelbaka/hyperquaid,eturan/hyperquaid,epallerols/hyperquaid,peej/hyperquaid
--- +++ @@ -13,7 +13,7 @@ } let questions = resp._embedded["hack:questions"]; - + console.log(resp._embedded["hack:questions"]) $qanda.html(""); questions.forEach((q) => { @@ -21,9 +21,20 @@ return; // skip, no answers yet for this question } - q._embedded["hack:answers"].forEach((answer) => $qanda.append(` - <div><h4>${q.question}</h4><p>${answer.answer}</p></div> - `)); + let answers = q._embedded["hack:answers"].reduce((i, answer) => { + return `${i} <li class="question--answer">${answer.answer}</li>`; + }, ""); + + $qanda.append(` + <div class="question"> + <h4 class="question--title">${q.question}</h4> + <div class="question--info"> + <span>on ${q.createdAt}</span> + | <span>Upvotes: ${q.positive}</span> + </div> + <ul>${answers}</ul> + </div> + `); }); }); });
b79362a07eaa527f27f2e28b8e6f4f5ebf37af30
app/src/index.js
app/src/index.js
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux' import { createStore } from 'redux' import './index.css'; import App from './App'; import Immutable from 'immutable' import rootReducer from './rootReducer' import registerServiceWorker from './registerServiceWorker'; import { existingComments } from './mockData' const initialState = Immutable.Map({ nick: '', comments: existingComments }) let store = createStore(rootReducer, initialState) ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') ) registerServiceWorker();
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux' import { createStore } from 'redux' import './index.css'; import App from './components/App'; import Immutable from 'immutable' import rootReducer from './rootReducer' import registerServiceWorker from './registerServiceWorker'; import { existingComments } from './mockData' const initialState = Immutable.Map({ nick: '', comments: existingComments }) let store = createStore(rootReducer, initialState) ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') ) registerServiceWorker();
Fix App import pointing to old place
Fix App import pointing to old place
JavaScript
mit
kheldysh/discursor,kheldysh/discursor
--- +++ @@ -3,7 +3,7 @@ import { Provider } from 'react-redux' import { createStore } from 'redux' import './index.css'; -import App from './App'; +import App from './components/App'; import Immutable from 'immutable' import rootReducer from './rootReducer' import registerServiceWorker from './registerServiceWorker';
6ca919bb4d7d42ef8dd1aa284a07bf3500a2d2a5
examples/express/api.js
examples/express/api.js
const bugsnag = require("./bugsnag"); function attemptLogin(username, password) { return new Promise((resolve, reject) => { if (username === "crash") { // Obviously you wouldn't expect to see this in your production app, but here is an example of what // you might have underlying your database abstraction. reject(new Error(`Unable to connect to database`)); } else { if (username === password) { resolve({ id: 1, name: username, }); } else { resolve(null); } } }); } function loadSession(req, res, next) { // We may not always be reporting errors manually. What happens if there's an error we didn't anticipate? // In that case we can attach some user data to the request, so we know which user was affected by the error. bugsnag.requestData.user = { id: 1, name: "james", plan: "beast-mode", }; next(null); } module.exports = { attemptLogin, loadSession, };
const bugsnag = require("./bugsnag"); function attemptLogin(username, password) { return new Promise((resolve, reject) => { if (username === "crash") { // Obviously you wouldn't expect to see this in your production app, but here is an example of what // you might have underlying your database abstraction. reject(new Error(`Unable to connect to database`)); } else { if (username === password) { resolve({ id: 1, name: username, }); } else { resolve(null); } } }); } function loadSession(req, res, next) { // We may not always be reporting errors manually. What happens if there's an error we didn't anticipate? // In that case we can attach some user data to the request, so we know which user was affected by the error. if (bugsnag.requestData) { bugsnag.requestData.user = { id: 1, name: "james", plan: "beast-mode", }; } next(null); } module.exports = { attemptLogin, loadSession, };
Check for request data prior to setting user
chore(examples): Check for request data prior to setting user If outside of request scope (or the process domain is otherwise null, then skip setting request data)
JavaScript
mit
bugsnag/bugsnag-node
--- +++ @@ -22,11 +22,13 @@ function loadSession(req, res, next) { // We may not always be reporting errors manually. What happens if there's an error we didn't anticipate? // In that case we can attach some user data to the request, so we know which user was affected by the error. - bugsnag.requestData.user = { - id: 1, - name: "james", - plan: "beast-mode", - }; + if (bugsnag.requestData) { + bugsnag.requestData.user = { + id: 1, + name: "james", + plan: "beast-mode", + }; + } next(null); }
04ca961a6b19d7bfc2d2962a6f9c6e9f876b333d
client/app/config/config.js
client/app/config/config.js
module.exports = { notice: { 'logFile': './logs/ark-desktop.log', 'level': 1, 'defaultHideDelay': 5000 } };
module.exports = { notice: { 'logFile': null, 'level': 1, 'defaultHideDelay': 5000 } };
Disable logging to file by default
Disable logging to file by default
JavaScript
mit
krau612/ark-desktop,krau612/ark-desktop,krau612/ark-desktop
--- +++ @@ -1,6 +1,6 @@ module.exports = { notice: { - 'logFile': './logs/ark-desktop.log', + 'logFile': null, 'level': 1, 'defaultHideDelay': 5000 }
e66ec1691a3ba9bf445a166ac3ebdb84efe37df9
src/DeepNgRoot/Frontend/js/app/module/ng-config.js
src/DeepNgRoot/Frontend/js/app/module/ng-config.js
'use strict'; 'format es6'; export class Config { /** * * @param {Boolean} isLocalhost * @param {String} ngRewrite * @param {Object} $locationProvider */ constructor(isLocalhost, ngRewrite, $locationProvider) { if (!isLocalhost && ngRewrite === '/') { $locationProvider.html5Mode(true); } } }
'use strict'; 'format es6'; export class Config { /** * * @param {Boolean} isLocalhost * @param {String} ngRewrite * @param {Object} $locationProvider */ constructor(isLocalhost, ngRewrite, $locationProvider) { let isAwsWebsite = /\.amazonaws\.com$/i.test(window.location.hostname); if (!isAwsWebsite && !isLocalhost && ngRewrite === '/') { $locationProvider.html5Mode(true); } } }
Disable html5Mode if hostname is s3-website
Disable html5Mode if hostname is s3-website
JavaScript
mit
MitocGroup/deep-microservices-root-angularjs,MitocGroup/deep-microservices-root-angularjs,MitocGroup/deep-microservices-root-angularjs
--- +++ @@ -9,7 +9,8 @@ * @param {Object} $locationProvider */ constructor(isLocalhost, ngRewrite, $locationProvider) { - if (!isLocalhost && ngRewrite === '/') { + let isAwsWebsite = /\.amazonaws\.com$/i.test(window.location.hostname); + if (!isAwsWebsite && !isLocalhost && ngRewrite === '/') { $locationProvider.html5Mode(true); } }
9f946527929d65607c0d42d33733d370fee27f83
spec/api-system-preferences-spec.js
spec/api-system-preferences-spec.js
const assert = require('assert') const {remote} = require('electron') const {systemPreferences} = remote describe('systemPreferences module', function () { if (process.platform !== 'darwin') { return } describe('systemPreferences.getUserDefault(key, type)', function () { it('returns values for known user defaults', function () { let locale = systemPreferences.getUserDefault('AppleLocale', 'string') assert.notEqual(locale, null) assert(locale.length > 0) let languages = systemPreferences.getUserDefault('AppleLanguages', 'array') assert.notEqual(languages, null) assert(languages.length > 0) }) }) })
const assert = require('assert') const {remote} = require('electron') const {systemPreferences} = remote describe('systemPreferences module', function () { describe('systemPreferences.getAccentColor', function () { if (process.platform !== 'win32') { return } it('should return a non-empty string', function () { let accentColor = systemPreferences.getAccentColor(); assert.notEqual(accentColor, null); assert(accentColor.length > 0); }) }) describe('systemPreferences.getUserDefault(key, type)', function () { if (process.platform !== 'darwin') { return } it('returns values for known user defaults', function () { let locale = systemPreferences.getUserDefault('AppleLocale', 'string') assert.notEqual(locale, null) assert(locale.length > 0) let languages = systemPreferences.getUserDefault('AppleLanguages', 'array') assert.notEqual(languages, null) assert(languages.length > 0) }) }) })
Add basic spec for getAccentColor
Add basic spec for getAccentColor
JavaScript
mit
shiftkey/electron,renaesop/electron,brenca/electron,wan-qy/electron,electron/electron,miniak/electron,seanchas116/electron,seanchas116/electron,aliib/electron,aliib/electron,the-ress/electron,gabriel/electron,the-ress/electron,electron/electron,dongjoon-hyun/electron,biblerule/UMCTelnetHub,tonyganch/electron,dongjoon-hyun/electron,wan-qy/electron,shiftkey/electron,leethomas/electron,gerhardberger/electron,dongjoon-hyun/electron,dongjoon-hyun/electron,wan-qy/electron,rajatsingla28/electron,joaomoreno/atom-shell,electron/electron,noikiy/electron,aliib/electron,biblerule/UMCTelnetHub,dongjoon-hyun/electron,twolfson/electron,electron/electron,kokdemo/electron,deed02392/electron,bpasero/electron,miniak/electron,twolfson/electron,rreimann/electron,leethomas/electron,the-ress/electron,Floato/electron,thomsonreuters/electron,voidbridge/electron,shiftkey/electron,joaomoreno/atom-shell,gerhardberger/electron,shiftkey/electron,MaxWhere/electron,seanchas116/electron,kokdemo/electron,MaxWhere/electron,deed02392/electron,renaesop/electron,dongjoon-hyun/electron,twolfson/electron,seanchas116/electron,rreimann/electron,wan-qy/electron,gerhardberger/electron,tinydew4/electron,tonyganch/electron,joaomoreno/atom-shell,gerhardberger/electron,gerhardberger/electron,miniak/electron,brenca/electron,thomsonreuters/electron,thompsonemerson/electron,gabriel/electron,bpasero/electron,leethomas/electron,MaxWhere/electron,gerhardberger/electron,thompsonemerson/electron,thomsonreuters/electron,leethomas/electron,rajatsingla28/electron,rreimann/electron,Floato/electron,thompsonemerson/electron,biblerule/UMCTelnetHub,shiftkey/electron,MaxWhere/electron,MaxWhere/electron,miniak/electron,gabriel/electron,MaxWhere/electron,Floato/electron,tinydew4/electron,thomsonreuters/electron,tonyganch/electron,the-ress/electron,aliib/electron,tinydew4/electron,renaesop/electron,noikiy/electron,seanchas116/electron,kokdemo/electron,deed02392/electron,bpasero/electron,thompsonemerson/electron,noikiy/electron,bpasero/electron,kokdemo/electron,noikiy/electron,rreimann/electron,biblerule/UMCTelnetHub,rreimann/electron,voidbridge/electron,bpasero/electron,aliib/electron,aliib/electron,electron/electron,wan-qy/electron,kokdemo/electron,kokdemo/electron,thomsonreuters/electron,brenca/electron,deed02392/electron,gabriel/electron,seanchas116/electron,tinydew4/electron,thomsonreuters/electron,electron/electron,renaesop/electron,gabriel/electron,gabriel/electron,deed02392/electron,the-ress/electron,voidbridge/electron,miniak/electron,biblerule/UMCTelnetHub,shiftkey/electron,rreimann/electron,rajatsingla28/electron,biblerule/UMCTelnetHub,renaesop/electron,twolfson/electron,bpasero/electron,brenca/electron,tonyganch/electron,voidbridge/electron,tinydew4/electron,rajatsingla28/electron,twolfson/electron,bpasero/electron,voidbridge/electron,Floato/electron,brenca/electron,tonyganch/electron,leethomas/electron,joaomoreno/atom-shell,the-ress/electron,voidbridge/electron,Floato/electron,twolfson/electron,joaomoreno/atom-shell,leethomas/electron,rajatsingla28/electron,tinydew4/electron,brenca/electron,thompsonemerson/electron,thompsonemerson/electron,renaesop/electron,rajatsingla28/electron,wan-qy/electron,the-ress/electron,miniak/electron,noikiy/electron,tonyganch/electron,electron/electron,Floato/electron,noikiy/electron,gerhardberger/electron,deed02392/electron,joaomoreno/atom-shell
--- +++ @@ -3,11 +3,23 @@ const {systemPreferences} = remote describe('systemPreferences module', function () { - if (process.platform !== 'darwin') { - return - } + describe('systemPreferences.getAccentColor', function () { + if (process.platform !== 'win32') { + return + } + + it('should return a non-empty string', function () { + let accentColor = systemPreferences.getAccentColor(); + assert.notEqual(accentColor, null); + assert(accentColor.length > 0); + }) + }) describe('systemPreferences.getUserDefault(key, type)', function () { + if (process.platform !== 'darwin') { + return + } + it('returns values for known user defaults', function () { let locale = systemPreferences.getUserDefault('AppleLocale', 'string') assert.notEqual(locale, null)
0798ad99e384fb91233ff0ba9c7ab8f439d1cb85
public/js/report.js
public/js/report.js
/* Can't use $.toggle() as we are using a custom `display` that is `none` when the page first loads */ function toggle (name, mode) { var id = name + '-' + mode var e = document.getElementById(id) var ej = $(e) e.style.display = e.style.display == 'table-row' ? 'none' : 'table-row' $('#' + id + '-btn').toggleClass('active') if (e.style.display === 'table-row') { if (ej.hasClass('loaded')) return $.getJSON('/api/' + slot + '/' + date + '/' + name, null, function success (data) { ej.find('code.language-git').html( decodeURIComponent(escape(atob(data[mode])))) ej.addClass('loaded') Prism.highlightAll() // FIXME }) } } function hide (id) { var e = document.getElementById(id) e.style.display = 'none' $('#' + id + '-btn').removeClass('active') } function show_diff (name) { hide(name + '-stderr') toggle(name, 'diff') } function show_err (name) { hide(name + '-diff') toggle(name, 'stderr') }
/* Can't use $.toggle() as we are using a custom `display` that is `none` when the page first loads */ function toggle (name, mode) { var id = name.replace(/\./g, '\\.') + '-' + mode , e = $('#' + id) if (e.css('display') === 'none') var activating = 1 else var activating = 0 e.css('display', activating ? 'table-row' : 'none') $('#' + id + '-btn').toggleClass('active') if (activating) { if (e.hasClass('loaded')) return $.getJSON('/api/' + slot + '/' + date + '/' + name, null, function success (data) { var codeElement = e.find('code.language-git') codeElement.html(decodeURIComponent(escape(atob(data[mode])))) e.addClass('loaded') Prism.highlightElement(codeElement[0]) }) } } function hide (id) { var e = document.getElementById(id) e.style.display = 'none' $('#' + id.replace(/\./g, '\\.') + '-btn').removeClass('active') } function show_diff (name) { hide(name + '-stderr') toggle(name, 'diff') } function show_err (name) { hide(name + '-diff') toggle(name, 'stderr') }
Fix dot escaping for jQuery and use $()[0]
Fix dot escaping for jQuery and use $()[0]
JavaScript
mit
TimothyGu/fateserver-node,TimothyGu/fateserver-node
--- +++ @@ -1,26 +1,27 @@ /* Can't use $.toggle() as we are using a custom `display` that is `none` when the page first loads */ function toggle (name, mode) { - var id = name + '-' + mode - var e = document.getElementById(id) - var ej = $(e) - e.style.display = e.style.display == 'table-row' ? 'none' : 'table-row' + var id = name.replace(/\./g, '\\.') + '-' + mode + , e = $('#' + id) + if (e.css('display') === 'none') var activating = 1 + else var activating = 0 + e.css('display', activating ? 'table-row' : 'none') $('#' + id + '-btn').toggleClass('active') - if (e.style.display === 'table-row') { - if (ej.hasClass('loaded')) return + if (activating) { + if (e.hasClass('loaded')) return $.getJSON('/api/' + slot + '/' + date + '/' + name, null, function success (data) { - ej.find('code.language-git').html( - decodeURIComponent(escape(atob(data[mode])))) - ej.addClass('loaded') - Prism.highlightAll() // FIXME + var codeElement = e.find('code.language-git') + codeElement.html(decodeURIComponent(escape(atob(data[mode])))) + e.addClass('loaded') + Prism.highlightElement(codeElement[0]) }) } } function hide (id) { var e = document.getElementById(id) e.style.display = 'none' - $('#' + id + '-btn').removeClass('active') + $('#' + id.replace(/\./g, '\\.') + '-btn').removeClass('active') } function show_diff (name) { hide(name + '-stderr')
013aea55f73a9cdf4063be8efb6689ae6fd6f985
services/ui/src/components/LogViewer/index.js
services/ui/src/components/LogViewer/index.js
import React from 'react'; import { bp } from 'lib/variables'; const LogViewer = ({ logs }) => ( <React.Fragment> <div className="logs"> <div className="log-viewer">{logs || 'Logs are not available.'}</div> </div> <style jsx>{` .logs { padding: 0 calc(100vw / 16) 48px; width: 100%; .log-viewer { background-color: #222222; color: #d6d6d6; font-family: 'Monaco', monospace; font-size: 12px; font-weight: 400; height: 600px; margin: 0; overflow-wrap: break-word; overflow-x: scroll; padding: calc((100vw / 16) * 0.5) calc(100vw / 16); white-space: pre-wrap; will-change: initial; word-break: break-all; word-wrap: break-word; @media ${bp.xs_smallUp} { padding: 30px; } } } `}</style> </React.Fragment> ); export default LogViewer;
import React from 'react'; import { bp } from 'lib/variables'; const LogViewer = ({ logs }) => ( <React.Fragment> <div className="logs"> <div className="log-viewer">{logs || 'Logs are not available.'}</div> </div> <style jsx>{` .logs { padding: 0 calc(100vw / 16) 48px; width: 100%; .log-viewer { background-color: #222222; color: #d6d6d6; font-family: 'Monaco', monospace; font-size: 12px; font-weight: 400; margin: 0; overflow-wrap: break-word; overflow-x: scroll; padding: calc((100vw / 16) * 0.5) calc(100vw / 16); white-space: pre-wrap; will-change: initial; word-break: break-all; word-wrap: break-word; @media ${bp.xs_smallUp} { padding: 30px; } } } `}</style> </React.Fragment> ); export default LogViewer;
Allow log container to be full height
Allow log container to be full height When viewing deployment logs in the dashboard, the logs are typically very long, but the log window is limited to 600px heigh. Given there is nothing else on the deployment page other than the logs, would be good if the height wasn't limited. There's a few benefits to this: 1. Users don't have to scroll as much because more of the log output fits on their screen at once. 1. Once the container is not-height restricted, the browser's behaviour of showing where search matches occur in the document by flagging them on the its scroll bar kicks in, this is great for jumping between areas areas of the output where a search string exists.
JavaScript
apache-2.0
amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon,amazeeio/lagoon
--- +++ @@ -16,7 +16,6 @@ font-family: 'Monaco', monospace; font-size: 12px; font-weight: 400; - height: 600px; margin: 0; overflow-wrap: break-word; overflow-x: scroll;
3ea4eebf2ed5dc409460b86a148b8fb0cdb2f9d7
components/counter/Counter.js
components/counter/Counter.js
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import omit from 'lodash.omit'; import theme from './theme.css'; class Counter extends PureComponent { static propTypes = { children: PropTypes.node, className: PropTypes.string, color: PropTypes.oneOf([ 'neutral', 'ruby' ]), size: PropTypes.oneOf([ 'small', 'medium' ]), }; static defaultProps = { color: 'neutral', size: 'medium', }; render () { const { children, className, color, size, ...others } = this.props; const classes = cx( theme.counter, theme.monospaced, theme[color], theme[size], { [theme.circular]: !children, [theme.rounded]: children, }, className, ); const rest = omit(others, [ 'color', 'size', ]); return ( <span className={classes} {...rest} data-teamleader-ui="counter"> {children} </span> ); } } export default Counter;
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import omit from 'lodash.omit'; import { Monospaced } from '../typography'; import theme from './theme.css'; class Counter extends PureComponent { static propTypes = { children: PropTypes.node, className: PropTypes.string, color: PropTypes.oneOf([ 'neutral', 'ruby' ]), size: PropTypes.oneOf([ 'small', 'medium' ]), }; static defaultProps = { color: 'neutral', size: 'medium', }; render () { const { children, className, color, size, ...others } = this.props; const classes = cx( theme.counter, theme[color], theme[size], { [theme.circular]: !children, [theme.rounded]: children, }, className, ); const rest = omit(others, [ 'color', 'size', ]); return ( <span className={classes} {...rest} data-teamleader-ui="counter"> <Monospaced>{children}</Monospaced> </span> ); } } export default Counter;
Use our own Monospaced component instead of applying monospace class from ui-typography
Use our own Monospaced component instead of applying monospace class from ui-typography
JavaScript
mit
teamleadercrm/teamleader-ui
--- +++ @@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; import cx from 'classnames'; import omit from 'lodash.omit'; +import { Monospaced } from '../typography'; import theme from './theme.css'; class Counter extends PureComponent { @@ -28,7 +29,6 @@ const classes = cx( theme.counter, - theme.monospaced, theme[color], theme[size], { @@ -45,7 +45,7 @@ return ( <span className={classes} {...rest} data-teamleader-ui="counter"> - {children} + <Monospaced>{children}</Monospaced> </span> ); }
6c0ed962b38457d9b95e9318a711ffbf0cf838c3
backend/models/users.js
backend/models/users.js
(function () { var User = require('../database/mongodb').Users, jwt = require('jwt-simple'), async = require('async'), crypto = require('crypto'); function _getUserInfo(userId, callback) { User.findById(userId, function (err, resp) { callback(err, resp); }) } function _updateUserInfo(userId, data, callback) { User.findByIdAndUpdate(userId, data, function (err, resp) { callback(err, resp); }) } function _registerUser(userInfo, callback) { User.create(userInfo, function (err, resp) { callback(err, resp); }) } function _login(username, password, callback) { async.waterfall([ function (callback) { User.findOne({username: username}, function (err, data) { if (err) return callback(err, null); if (data.length > 0) { callback(null, data); } else { callback('ERROR.USER', null); } }) }, function (user){ var userPass = crypto.createHash('md5').update(password).digest('hex'); if(user.password == userPass){ callback(null, user); }else { callback('ERROR.PASSWORD', null) } } ], function (err, resp) { callback(err, resp); }) } })();
(function () { var User = require('../database/mongodb').Users, jwt = require('jwt-simple'), async = require('async'), crypto = require('crypto'); function _getUserInfo(userId, callback) { User.findById(userId, function (err, resp) { callback(err, resp); }) } function _updateUserInfo(userId, data, callback) { User.findByIdAndUpdate(userId, data, function (err, resp) { callback(err, resp); }) } function _registerUser(userInfo, callback) { User.create(userInfo, function (err, resp) { callback(err, resp); }) } function _login(username, password, callback) { async.waterfall([ function (callback) { User.findOne({username: username}, function (err, data) { if (err) return callback(err, null); if (data.length > 0) { callback(null, data); } else { callback('ERROR.USER', null); } }) }, function (user){ var userPass = crypto.createHash('md5').update(password).digest('hex'); if(user.password == userPass){ callback(null, user); }else { callback('ERROR.PASSWORD', null) } } ], function (err, resp) { callback(err, resp); }) } return { getUserInfo : _getUserInfo, updateUserInfo: _updateUserInfo, register: _registerUser, login: _login } })();
Update function help interact with User
Update function help interact with User
JavaScript
mit
thinhit/Buzz
--- +++ @@ -46,5 +46,11 @@ callback(err, resp); }) } + return { + getUserInfo : _getUserInfo, + updateUserInfo: _updateUserInfo, + register: _registerUser, + login: _login + } })();
65a6f25c4523a2844ef7c0bc8dc1dbb2b0edc347
app/components/code-snippet.js
app/components/code-snippet.js
import Ember from "ember"; import Snippets from "../snippets"; /* global require */ var Highlight = require('highlight.js'); export default Ember.Component.extend({ tagName: 'pre', classNameBindings: ['language'], unindent: true, _unindent: function(src) { if (!this.get('unindent')) { return src; } var match, min, lines = src.split("\n"); for (var i = 0; i < lines.length; i++) { match = /^\s*/.exec(lines[i]); if (match && (typeof min === 'undefined' || min > match[0].length)) { min = match[0].length; } } if (typeof min !== 'undefined' && min > 0) { src = src.replace(new RegExp("(\\n|^)\\s{" + min + "}", 'g'), "$1"); } return src; }, source: function(){ return this._unindent( (Snippets[this.get('name')] || "") .replace(/^(\s*\n)*/, '') .replace(/\s*$/, '') ); }.property('name'), didInsertElement: function(){ Highlight.highlightBlock(this.get('element')); }, language: function(){ var m = /\.(\w+)$/i.exec(this.get('name')); if (m) { switch (m[1].toLowerCase()) { case 'js': return 'javascript'; case 'hbs': return 'handlebars'; } } }.property('name') });
import Ember from "ember"; import Snippets from "../snippets"; /* global require */ var Highlight = require('highlight.js'); export default Ember.Component.extend({ tagName: 'pre', classNameBindings: ['language'], unindent: true, _unindent: function(src) { if (!this.get('unindent')) { return src; } var match, min, lines = src.split("\n"); for (var i = 0; i < lines.length; i++) { match = /^\s*/.exec(lines[i]); if (match && (typeof min === 'undefined' || min > match[0].length)) { min = match[0].length; } } if (typeof min !== 'undefined' && min > 0) { src = src.replace(new RegExp("(\\n|^)\\s{" + min + "}", 'g'), "$1"); } return src; }, source: Ember.computed('name', function(){ return this._unindent( (Snippets[this.get('name')] || "") .replace(/^(\s*\n)*/, '') .replace(/\s*$/, '') ); }), didInsertElement: function(){ Highlight.highlightBlock(this.get('element')); }, language: Ember.computed('name', function(){ var m = /\.(\w+)$/i.exec(this.get('name')); if (m) { switch (m[1].toLowerCase()) { case 'js': return 'javascript'; case 'hbs': return 'handlebars'; } } }) });
Remove reliance on function prototype extension.
Remove reliance on function prototype extension.
JavaScript
mit
greyhwndz/ember-code-snippet,mike-north/ember-code-snippet,ef4/ember-code-snippet,ef4/ember-code-snippet
--- +++ @@ -26,19 +26,19 @@ return src; }, - source: function(){ + source: Ember.computed('name', function(){ return this._unindent( (Snippets[this.get('name')] || "") .replace(/^(\s*\n)*/, '') .replace(/\s*$/, '') ); - }.property('name'), + }), didInsertElement: function(){ Highlight.highlightBlock(this.get('element')); }, - language: function(){ + language: Ember.computed('name', function(){ var m = /\.(\w+)$/i.exec(this.get('name')); if (m) { switch (m[1].toLowerCase()) { @@ -48,5 +48,5 @@ return 'handlebars'; } } - }.property('name') + }) });
4279d160bdd741ff40b6f1d0b87eccea9b16bf18
lib/commands/help.js
lib/commands/help.js
'use strict'; var Command = require('../models/command'); var lookupCommand = require('../cli/lookup-command'); var string = require('../utilities/string'); module.exports = Command.extend({ name: 'help', works: 'everywhere', description: 'Outputs the usage instructions for all commands or the provided command', aliases: [undefined, 'h', 'help', '-h', '--help'], _displayHelpForCommand: function(commandName) { var Command = this.commands[string.classify(commandName)] || lookupCommand(this.commands, commandName); var command = new Command({ ui: this.ui, project: this.project, commands: this.commands }).printUsageInstructions(); }, run: function(commandOptions, rawArgs) { if (rawArgs.length === 0) { // Display usage for all commands. this.ui.write('Available commands in ember-cli:\n'); Object.keys(this.commands).forEach(this._displayHelpForCommand.bind(this)); } else { // If args were passed to the help command, // attempt to look up the command for each of them. this.ui.write('Requested ember-cli commands:\n\n'); // Iterate through each arg beyond the initial 'help' command, // and try to display usage instructions. rawArgs.forEach(this._displayHelpForCommand.bind(this)); } }, usageInstructions: function() { return { anonymousOptions: '<command-name (Default: all)>' }; } });
'use strict'; var Command = require('../models/command'); var lookupCommand = require('../cli/lookup-command'); var string = require('../utilities/string'); module.exports = Command.extend({ name: 'help', works: 'everywhere', description: 'Outputs the usage instructions for all commands or the provided command', aliases: [undefined, 'h', 'help', '-h', '--help'], _displayHelpForCommand: function(commandName) { var Command = this.commands[string.classify(commandName)] || lookupCommand(this.commands, commandName); new Command({ ui: this.ui, project: this.project, commands: this.commands }).printUsageInstructions(); }, run: function(commandOptions, rawArgs) { if (rawArgs.length === 0) { // Display usage for all commands. this.ui.write('Available commands in ember-cli:\n'); Object.keys(this.commands).forEach(this._displayHelpForCommand.bind(this)); } else { // If args were passed to the help command, // attempt to look up the command for each of them. this.ui.write('Requested ember-cli commands:\n\n'); // Iterate through each arg beyond the initial 'help' command, // and try to display usage instructions. rawArgs.forEach(this._displayHelpForCommand.bind(this)); } }, usageInstructions: function() { return { anonymousOptions: '<command-name (Default: all)>' }; } });
Remove var command declaration (failing jshint test)
Remove var command declaration (failing jshint test)
JavaScript
mit
eliotsykes/ember-cli,szines/ember-cli,beatle/ember-cli,xiujunma/ember-cli,code0100fun/ember-cli,ServiceTo/ember-cli,typeoneerror/ember-cli,taras/ember-cli,mixonic/ember-cli,williamsbdev/ember-cli,romulomachado/ember-cli,ef4/ember-cli,quaertym/ember-cli,coderly/ember-cli,nruth/ember-cli,kriswill/ember-cli,seawatts/ember-cli,martndemus/ember-cli,xtian/ember-cli,princeofdarkness76/ember-cli,EricSchank/ember-cli,xiujunma/ember-cli,joaohornburg/ember-cli,balinterdi/ember-cli,Restuta/ember-cli,airportyh/ember-cli,princeofdarkness76/ember-cli,michael-k/ember-cli,lazybensch/ember-cli,lancedikson/ember-cli,olegdovger/ember-cli,zanemayo/ember-cli,romulomachado/ember-cli,selvagsz/ember-cli,eoinkelly/ember-cli,martndemus/ember-cli,pixelhandler/ember-cli,johnotander/ember-cli,Restuta/ember-cli,cibernox/ember-cli,seawatts/ember-cli,fpauser/ember-cli,ef4/ember-cli,jayphelps/ember-cli,martypenner/ember-cli,alexdiliberto/ember-cli,szines/ember-cli,gfvcastro/ember-cli,abuiles/ember-cli,rot26/ember-cli,ballPointPenguin/ember-cli,sivakumar-kailasam/ember-cli,nathanhammond/ember-cli,asakusuma/ember-cli,nruth/ember-cli,olegdovger/ember-cli,acorncom/ember-cli,calderas/ember-cli,tobymarsden/ember-cli,pzuraq/ember-cli,quaertym/ember-cli,beatle/ember-cli,michael-k/ember-cli,ServiceTo/ember-cli,raytiley/ember-cli,coderly/ember-cli,michael-k/ember-cli,joaohornburg/ember-cli,Turbo87/ember-cli,tsing80/ember-cli,jcope2013/ember-cli,selvagsz/ember-cli,nathanhammond/ember-cli,BrianSipple/ember-cli,lazybensch/ember-cli,rot26/ember-cli,scalus/ember-cli,taras/ember-cli,johnotander/ember-cli,scalus/ember-cli,noslouch/ember-cli,bmac/ember-cli,kellyselden/ember-cli,fpauser/ember-cli,williamsbdev/ember-cli,mohlek/ember-cli,zanemayo/ember-cli,beatle/ember-cli,givanse/ember-cli,joliss/ember-cli,jasonmit/ember-cli,romulomachado/ember-cli,lancedikson/ember-cli,balinterdi/ember-cli,pixelhandler/ember-cli,mohlek/ember-cli,asakusuma/ember-cli,scalus/ember-cli,rodyhaddad/ember-cli,kellyselden/ember-cli,eccegordo/ember-cli,tobymarsden/ember-cli,dosco/ember-cli,ember-cli/ember-cli,jasonmit/ember-cli,chadhietala/ember-cli,johanneswuerbach/ember-cli,williamsbdev/ember-cli,kanongil/ember-cli,marcioj/ember-cli,Restuta/ember-cli,yapplabs/ember-cli,jayphelps/ember-cli,coderly/ember-cli,patocallaghan/ember-cli,buschtoens/ember-cli,tobymarsden/ember-cli,szines/ember-cli,jrjohnson/ember-cli,DanielOchoa/ember-cli,maxcal/ember-cli,samselikoff/ember-cli,abuiles/ember-cli,igorT/ember-cli,pangratz/ember-cli,ianstarz/ember-cli,maxcal/ember-cli,seawatts/ember-cli,yaymukund/ember-cli,michael-k/ember-cli,martypenner/ember-cli,trentmwillis/ember-cli,comlaterra/ember-cli,akatov/ember-cli,alefteris/ember-cli,mixonic/ember-cli,rot26/ember-cli,runspired/ember-cli,mike-north/ember-cli,xiujunma/ember-cli,igorT/ember-cli,Turbo87/ember-cli,trentmwillis/ember-cli,lazybensch/ember-cli,yaymukund/ember-cli,xcambar/ember-cli,jonathanKingston/ember-cli,jonathanKingston/ember-cli,searls/ember-cli,greyhwndz/ember-cli,thoov/ember-cli,typeoneerror/ember-cli,EricSchank/ember-cli,BrianSipple/ember-cli,jasonmit/ember-cli,alefteris/ember-cli,mike-north/ember-cli,blimmer/ember-cli,slindberg/ember-cli,johanneswuerbach/ember-cli,beatle/ember-cli,eoinkelly/ember-cli,samselikoff/ember-cli,gmurphey/ember-cli,lancedikson/ember-cli,rondale-sc/ember-cli,mschinis/ember-cli,johanneswuerbach/ember-cli,josemarluedke/ember-cli,mixonic/ember-cli,scalus/ember-cli,patocallaghan/ember-cli,seanpdoyle/ember-cli,felixrieseberg/ember-cli,code0100fun/ember-cli,romulomachado/ember-cli,cibernox/ember-cli,ianstarz/ember-cli,jgwhite/ember-cli,rondale-sc/ember-cli,makepanic/ember-cli,williamsbdev/ember-cli,johnotander/ember-cli,joaohornburg/ember-cli,lazybensch/ember-cli,runspired/ember-cli,DanielOchoa/ember-cli,dosco/ember-cli,ro0gr/ember-cli,thoov/ember-cli,martypenner/ember-cli,givanse/ember-cli,rtablada/ember-cli,mschinis/ember-cli,kanongil/ember-cli,jonathanKingston/ember-cli,tobymarsden/ember-cli,abuiles/ember-cli,josemarluedke/ember-cli,fpauser/ember-cli,alexdiliberto/ember-cli,pixelhandler/ember-cli,trabus/ember-cli,ballPointPenguin/ember-cli,ember-cli/ember-cli,oss-practice/ember-cli,seanpdoyle/ember-cli,calderas/ember-cli,searls/ember-cli,xtian/ember-cli,twokul/ember-cli,HeroicEric/ember-cli,marcioj/ember-cli,dukex/ember-cli,eliotsykes/ember-cli,kamalaknn/ember-cli,kanongil/ember-cli,cibernox/ember-cli,dukex/ember-cli,zanemayo/ember-cli,twokul/ember-cli,joostdevries/ember-cli,blimmer/ember-cli,selvagsz/ember-cli,chadhietala/ember-cli,quaertym/ember-cli,josemarluedke/ember-cli,ballPointPenguin/ember-cli,joostdevries/ember-cli,supabok/ember-cli,runspired/ember-cli,runspired/ember-cli,mschinis/ember-cli,sivakumar-kailasam/ember-cli,raytiley/ember-cli,csantero/ember-cli,airportyh/ember-cli,rodyhaddad/ember-cli,taras/ember-cli,pangratz/ember-cli,trabus/ember-cli,raytiley/ember-cli,dukex/ember-cli,raytiley/ember-cli,patocallaghan/ember-cli,dukex/ember-cli,kellyselden/ember-cli,kriswill/ember-cli,searls/ember-cli,quaertym/ember-cli,airportyh/ember-cli,HeroicEric/ember-cli,xtian/ember-cli,sivakumar-kailasam/ember-cli,akatov/ember-cli,xcambar/ember-cli,eoinkelly/ember-cli,samselikoff/ember-cli,trentmwillis/ember-cli,rwjblue/ember-cli,yapplabs/ember-cli,xcambar/ember-cli,bevacqua/ember-cli,alefteris/ember-cli,martndemus/ember-cli,joostdevries/ember-cli,rtablada/ember-cli,gmurphey/ember-cli,ServiceTo/ember-cli,pzuraq/ember-cli,xtian/ember-cli,mixonic/ember-cli,ro0gr/ember-cli,rodyhaddad/ember-cli,greyhwndz/ember-cli,kriswill/ember-cli,mike-north/ember-cli,supabok/ember-cli,givanse/ember-cli,searls/ember-cli,givanse/ember-cli,eliotsykes/ember-cli,coderly/ember-cli,selvagsz/ember-cli,pzuraq/ember-cli,joostdevries/ember-cli,code0100fun/ember-cli,typeoneerror/ember-cli,gfvcastro/ember-cli,martndemus/ember-cli,dosco/ember-cli,princeofdarkness76/ember-cli,sivakumar-kailasam/ember-cli,acorncom/ember-cli,bevacqua/ember-cli,maxcal/ember-cli,bevacqua/ember-cli,buschtoens/ember-cli,gmurphey/ember-cli,pzuraq/ember-cli,gfvcastro/ember-cli,nathanhammond/ember-cli,gmurphey/ember-cli,samselikoff/ember-cli,kellyselden/ember-cli,xcambar/ember-cli,tsing80/ember-cli,joaohornburg/ember-cli,mattmarcum/ember-cli,comlaterra/ember-cli,jgwhite/ember-cli,rickharrison/ember-cli,kanongil/ember-cli,oss-practice/ember-cli,ianstarz/ember-cli,johnotander/ember-cli,gfvcastro/ember-cli,elwayman02/ember-cli,rot26/ember-cli,code0100fun/ember-cli,maxcal/ember-cli,jayphelps/ember-cli,yaymukund/ember-cli,jcope2013/ember-cli,seawatts/ember-cli,greyhwndz/ember-cli,eliotsykes/ember-cli,jcope2013/ember-cli,jasonmit/ember-cli,rtablada/ember-cli,kategengler/ember-cli,nruth/ember-cli,ServiceTo/ember-cli,twokul/ember-cli,ballPointPenguin/ember-cli,felixrieseberg/ember-cli,comlaterra/ember-cli,dschmidt/ember-cli,alexdiliberto/ember-cli,joliss/ember-cli,trabus/ember-cli,zanemayo/ember-cli,jgwhite/ember-cli,alexdiliberto/ember-cli,akatov/ember-cli,johanneswuerbach/ember-cli,rickharrison/ember-cli,seanpdoyle/ember-cli,mschinis/ember-cli,slindberg/ember-cli,eccegordo/ember-cli,felixrieseberg/ember-cli,DanielOchoa/ember-cli,calderas/ember-cli,pangratz/ember-cli,jgwhite/ember-cli,kategengler/ember-cli,DanielOchoa/ember-cli,HeroicEric/ember-cli,BrianSipple/ember-cli,cibernox/ember-cli,jonathanKingston/ember-cli,yaymukund/ember-cli,ember-cli/ember-cli,ef4/ember-cli,bmac/ember-cli,rodyhaddad/ember-cli,joliss/ember-cli,acorncom/ember-cli,eccegordo/ember-cli,mohlek/ember-cli,greyhwndz/ember-cli,csantero/ember-cli,noslouch/ember-cli,EricSchank/ember-cli,csantero/ember-cli,thoov/ember-cli,bevacqua/ember-cli,BrianSipple/ember-cli,jrjohnson/ember-cli,mattmarcum/ember-cli,seanpdoyle/ember-cli,thoov/ember-cli,dschmidt/ember-cli,eccegordo/ember-cli,kriswill/ember-cli,mohlek/ember-cli,marcioj/ember-cli,lancedikson/ember-cli,pixelhandler/ember-cli,ianstarz/ember-cli,trentmwillis/ember-cli,csantero/ember-cli,szines/ember-cli,nathanhammond/ember-cli,comlaterra/ember-cli,abuiles/ember-cli,patocallaghan/ember-cli,tsing80/ember-cli,eoinkelly/ember-cli,taras/ember-cli,noslouch/ember-cli,ro0gr/ember-cli,jayphelps/ember-cli,fpauser/ember-cli,nruth/ember-cli,trabus/ember-cli,mike-north/ember-cli,ro0gr/ember-cli,makepanic/ember-cli,olegdovger/ember-cli,kamalaknn/ember-cli,acorncom/ember-cli,ef4/ember-cli,makepanic/ember-cli,xiujunma/ember-cli,tsing80/ember-cli,kamalaknn/ember-cli,jcope2013/ember-cli,typeoneerror/ember-cli,pangratz/ember-cli,joliss/ember-cli,akatov/ember-cli,calderas/ember-cli,noslouch/ember-cli,Turbo87/ember-cli,raycohen/ember-cli,dosco/ember-cli,aceofspades/ember-cli,marcioj/ember-cli,rtablada/ember-cli,Turbo87/ember-cli,martypenner/ember-cli,airportyh/ember-cli,blimmer/ember-cli,aceofspades/ember-cli,blimmer/ember-cli,kamalaknn/ember-cli,raycohen/ember-cli,josemarluedke/ember-cli,princeofdarkness76/ember-cli,elwayman02/ember-cli,alefteris/ember-cli,makepanic/ember-cli,HeroicEric/ember-cli,twokul/ember-cli,EricSchank/ember-cli,Restuta/ember-cli,olegdovger/ember-cli
--- +++ @@ -14,7 +14,7 @@ _displayHelpForCommand: function(commandName) { var Command = this.commands[string.classify(commandName)] || lookupCommand(this.commands, commandName); - var command = new Command({ + new Command({ ui: this.ui, project: this.project, commands: this.commands
d9e767bc15f62a28bba34b139e98876fb3ad9f03
lib/commands/help.js
lib/commands/help.js
'use strict'; var fs = require('fs'); var path = require('path'); module.exports = function() { var content = fs.readFileSync(path.resolve(__dirname, '../templates/help.txt'), 'utf8'); console.log(content); };
'use strict'; var fs = require('fs'); var path = require('path'); module.exports = function() { var content = fs.readFileSync( path.resolve(__dirname, '../templates/help.txt'), 'utf8'); console.log(content); };
Break line to avoid having a line that's too long.
Break line to avoid having a line that's too long.
JavaScript
mit
stillesjo/buh
--- +++ @@ -4,6 +4,7 @@ var path = require('path'); module.exports = function() { - var content = fs.readFileSync(path.resolve(__dirname, '../templates/help.txt'), 'utf8'); + var content = fs.readFileSync( + path.resolve(__dirname, '../templates/help.txt'), 'utf8'); console.log(content); };
913c4f65c986da00961221356cc74c17ac270553
js/app.js
js/app.js
App = Ember.Application.create({}); App.IndexRoute = Ember.Route.extend({ setupController: function(controller) { controller.set('content', ['red', 'yellow', 'blue']); } });
App = Ember.Application.create(); App.Router.map(function() { // put your routes here }); App.IndexRoute = Ember.Route.extend({ model: function() { return ['red', 'yellow', 'blue']; } });
Add router stub and clean up IndexRoute
Add router stub and clean up IndexRoute
JavaScript
mit
miguelcoba/ember-intro-code,miguelcoba/ember-intro-code
--- +++ @@ -1,7 +1,11 @@ -App = Ember.Application.create({}); +App = Ember.Application.create(); + +App.Router.map(function() { + // put your routes here +}); App.IndexRoute = Ember.Route.extend({ - setupController: function(controller) { - controller.set('content', ['red', 'yellow', 'blue']); + model: function() { + return ['red', 'yellow', 'blue']; } });
1ffc1f60cb159cf47152c5d778505bd04ec71f0e
js/rts.js
js/rts.js
// Runtime //////////////////////////////////////////////////////////////////////////////// // Thunks // A thunk object function $(value) { this.forced = false; this.value = value; } // Force the thunk object $.prototype.force = function(nocache) { return nocache ? this.value() : (this.forced ? this.value : (this.value = this.value(), this.forced = true, this.value)); }; // Force a thunkish thing until WHNF function __(thunkish,nocache) { while (thunkish instanceof $) thunkish = thunkish.force(nocache); return thunkish; } // Force a thunk with no thunk updating function _(thunkish){ return __(thunkish,true); } //////////////////////////////////////////////////////////////////////////////// // Run helpers // Run the main IO function. var base$GHC$TopHandler$runMainIO = function(main){ return __(main,true); };
// Runtime //////////////////////////////////////////////////////////////////////////////// // Thunks // A thunk object function $(value) { this.forced = false; this.value = value; } // Force the thunk object $.prototype.force = function() { return this.forced ? this.value : (this.value = this.value(), this.forced = true, this.value); }; // Force a thunkish thing until WHNF function __(thunkish) { while (thunkish instanceof $) thunkish = thunkish.force(); return thunkish; } // Run a thunk with no updating function _(thunkish){ while (thunkish instanceof $) thunkish = thunkish.value(); return thunkish; } //////////////////////////////////////////////////////////////////////////////// // Run helpers // Run the main IO function. var base$GHC$TopHandler$runMainIO = function(main){ return _(main); };
Speed up by having separate thunk forcings
Speed up by having separate thunk forcings
JavaScript
bsd-3-clause
chrisdone/fore
--- +++ @@ -11,26 +11,26 @@ } // Force the thunk object -$.prototype.force = function(nocache) +$.prototype.force = function() { - return nocache ? - this.value() : - (this.forced ? - this.value : - (this.value = this.value(), this.forced = true, this.value)); + return this.forced ? + this.value : + (this.value = this.value(), this.forced = true, this.value); }; // Force a thunkish thing until WHNF -function __(thunkish,nocache) +function __(thunkish) { while (thunkish instanceof $) - thunkish = thunkish.force(nocache); + thunkish = thunkish.force(); return thunkish; } -// Force a thunk with no thunk updating +// Run a thunk with no updating function _(thunkish){ - return __(thunkish,true); + while (thunkish instanceof $) + thunkish = thunkish.value(); + return thunkish; } //////////////////////////////////////////////////////////////////////////////// @@ -38,5 +38,5 @@ // Run the main IO function. var base$GHC$TopHandler$runMainIO = function(main){ - return __(main,true); + return _(main); };
d80b1ea4db12bc7f09f57b1ce9986a0eab9aa327
src/html.js
src/html.js
import React from 'react'; import PropTypes from 'prop-types'; import Helmet from 'react-helmet'; import { ServerStyleSheet } from 'styled-components'; const HTML = props => { const head = Helmet.rewind(); const sheet = new ServerStyleSheet(); const main = sheet.collectStyles(<div id="___gatsby" dangerouslySetInnerHTML={{ __html: props.body }} />); const css = sheet.getStyleElement(); return ( <html lang="en"> <head> <meta charSet="utf-8" /> {props.headComponents} {head.title.toComponent()} {head.meta.toComponent()} {head.link.toComponent()} <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="apple-touch-icon" sizes="600x600" href="/icon.png" type="image/x-icon" /> {process.env.NODE_ENV === 'production' && css} </head> <body> {main} {props.postBodyComponents} </body> </html> ); }; HTML.propTypes = { body: PropTypes.object.isRequired, headComponents: PropTypes.object.isRequired, postBodyComponents: PropTypes.object.isRequired, }; export default HTML;
import React from 'react'; import PropTypes from 'prop-types'; import Helmet from 'react-helmet'; import { ServerStyleSheet } from 'styled-components'; const HTML = props => { const head = Helmet.rewind(); const sheet = new ServerStyleSheet(); const main = sheet.collectStyles(<div id="___gatsby" dangerouslySetInnerHTML={{ __html: props.body }} />); const css = sheet.getStyleElement(); return ( <html lang="en"> <head> <meta charSet="utf-8" /> {props.headComponents} {head.title.toComponent()} {head.meta.toComponent()} {head.link.toComponent()} <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="apple-touch-icon" sizes="600x600" href="/icon.png" type="image/x-icon" /> {process.env.NODE_ENV === 'production' && css} </head> <body> {main} {props.postBodyComponents} </body> </html> ); }; HTML.propTypes = { body: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired, headComponents: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, postBodyComponents: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, }; export default HTML;
Fix PropTypes for local dev server
Fix PropTypes for local dev server
JavaScript
mit
iiroj/iiro.fi,iiroj/iiro.fi,iiroj/iiro.fi
--- +++ @@ -34,9 +34,9 @@ }; HTML.propTypes = { - body: PropTypes.object.isRequired, - headComponents: PropTypes.object.isRequired, - postBodyComponents: PropTypes.object.isRequired, + body: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired, + headComponents: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, + postBodyComponents: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, }; export default HTML;
c4158a6e6b11915fc09336bc58376089f4fcd7d1
src/main.js
src/main.js
import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './App'; Vue.use(VueRouter); const Main = Vue.extend({}); const router = new VueRouter(); router.map({ '/': { component: App }, }); router.start(Main, 'body');
import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './App'; Vue.use(VueRouter); const Main = Vue.extend({}); const router = new VueRouter({ history: true }); router.map({ '/': { component: App }, }); router.start(Main, 'body');
Use history option for vue-router
Use history option for vue-router
JavaScript
mit
noraesae/soramaru,noraesae/soramaru
--- +++ @@ -5,7 +5,7 @@ Vue.use(VueRouter); const Main = Vue.extend({}); -const router = new VueRouter(); +const router = new VueRouter({ history: true }); router.map({ '/': { component: App },
98889b08d5dc039c5a58c522e5b2c9def1081a2d
src/util.js
src/util.js
const moment = require("moment"); let ctx; try { const chalk = require("chalk"); ctx = new chalk.constructor({enabled:true}); } catch (err) { // silent } function getTime() { const curHour = new Date().getHours() % 12 || 12; return (curHour < 10 ? " " : "") + moment().format("LTS"); } module.exports = { log(...args) { if (ctx) console.log(getTime(), "|", ctx.grey("[LOG]"), ...args); else console.log(getTime(), "|", ...args); }, warn(...args) { if (ctx) console.error(getTime(), "|", ctx.yellow("[WARN]"), ...args); else console.error(getTime(), "|", ...args); }, error(...args) { if (ctx) console.error(getTime(), "|", ctx.red("[ERROR]"), ...args); else console.error(getTime(), "|", ...args); } };
const moment = require("moment"); let ctx; try { const chalk = require("chalk"); ctx = new chalk.constructor({enabled:true}); } catch (err) { // silent } function getTime() { return (" " + moment().format("LTS")).slice(-11); } module.exports = { log(...args) { if (ctx) console.log(getTime(), "|", ctx.grey("[LOG]"), ...args); else console.log(getTime(), "|", ...args); }, warn(...args) { if (ctx) console.error(getTime(), "|", ctx.yellow("[WARN]"), ...args); else console.error(getTime(), "|", ...args); }, error(...args) { if (ctx) console.error(getTime(), "|", ctx.red("[ERROR]"), ...args); else console.error(getTime(), "|", ...args); } };
Improve time generation for logging
Improve time generation for logging
JavaScript
mit
EPICZEUS/simple-discord.js
--- +++ @@ -11,9 +11,7 @@ } function getTime() { - const curHour = new Date().getHours() % 12 || 12; - - return (curHour < 10 ? " " : "") + moment().format("LTS"); + return (" " + moment().format("LTS")).slice(-11); } module.exports = {
c7812c809faab6ff14d7125edcce9b0bb2e58abc
react-pure-function/app/index.js
react-pure-function/app/index.js
var React = require('react'); var ReactDOM = require('react-dom'); var ProfilePic = React.createClass({ render: function() { return ( <img src={'https://photo.fb.com/' + this.props.username}></img> ); } }); var ProfileLink = React.createClass({ render: function() { return ( <a href={'https://www.fb.com/' + this.props.username}> {this.props.username} </a> ); } }); var Avatar = React.createClass({ render: function() { return ( <div> <ProfilePic username={this.props.username} /> <ProfileLink username={this.props.username} /> </div> ); } }); ReactDOM.render(<Avatar username="kidchenko" />, document.getElementById('avatar'));
var React = require('react'); var ReactDOM = require('react-dom'); var ProfilePic = function(props) { return <img src={'https://twitter.com/' + this.props.username + '/profile_image?size=original'}></img> } // var ProfilePic = React.createClass({ // render: function() { // return ( // <img src={'https://twitter.com/' + this.props.username + '/profile_image?size=original'}></img> // ); // } // }); var ProfileLink = function(props) { return ( <a href={'https://www.twitter.com/' + this.props.username}> {this.props.username} </a> ); } // var ProfileLink = React.createClass({ // render: function() { // return ( // <a href={'https://www.twitter.com/' + this.props.username}> // {this.props.username} // </a> // ); // } // }); var Avatar = function(props) { return ( <a href={'https://www.twitter.com/' + this.props.username}> {this.props.username} </a> ); } // var Avatar = React.createClass({ // render: function() { // return ( // <div> // <ProfilePic username={this.props.username} /> // <ProfileLink username={this.props.username} /> // </div> // ); // } // }); ReactDOM.render(<Avatar username="kidchenko" />, document.getElementById('avatar'));
Create component using statelless component
Create component using statelless component
JavaScript
mit
kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground,kidchenko/playground
--- +++ @@ -1,33 +1,54 @@ var React = require('react'); var ReactDOM = require('react-dom'); -var ProfilePic = React.createClass({ - render: function() { - return ( - <img src={'https://photo.fb.com/' + this.props.username}></img> - ); - } -}); +var ProfilePic = function(props) { + return <img src={'https://twitter.com/' + this.props.username + '/profile_image?size=original'}></img> +} -var ProfileLink = React.createClass({ - render: function() { - return ( - <a href={'https://www.fb.com/' + this.props.username}> - {this.props.username} - </a> - ); - } -}); +// var ProfilePic = React.createClass({ +// render: function() { +// return ( +// <img src={'https://twitter.com/' + this.props.username + '/profile_image?size=original'}></img> +// ); +// } +// }); -var Avatar = React.createClass({ - render: function() { - return ( - <div> - <ProfilePic username={this.props.username} /> - <ProfileLink username={this.props.username} /> - </div> - ); - } -}); + +var ProfileLink = function(props) { + return ( + <a href={'https://www.twitter.com/' + this.props.username}> + {this.props.username} + </a> + ); +} + +// var ProfileLink = React.createClass({ +// render: function() { +// return ( +// <a href={'https://www.twitter.com/' + this.props.username}> +// {this.props.username} +// </a> +// ); +// } +// }); + +var Avatar = function(props) { + return ( + <a href={'https://www.twitter.com/' + this.props.username}> + {this.props.username} + </a> + ); +} + +// var Avatar = React.createClass({ +// render: function() { +// return ( +// <div> +// <ProfilePic username={this.props.username} /> +// <ProfileLink username={this.props.username} /> +// </div> +// ); +// } +// }); ReactDOM.render(<Avatar username="kidchenko" />, document.getElementById('avatar'));
1cf5a0fe163a7769a83abc3cf5b14b91089a5f28
lib/s3.js
lib/s3.js
var assert = require('assert') var AWS = require('aws-sdk') /** * Create s3 client * @param {Object} config AWS configuration * @returns {Object} s3 client and helpers */ module.exports = function s3Loader (config) { assert(config, 's3Loader requires config') var client = new AWS.S3(config) client.endpoint = config.endpoint return { client, uploadFilePromise, deleteObjectsPromise } function uploadFilePromise (uploadConfig) { return new Promise((resolve, reject) => { client.upload(uploadConfig, (err, data) => err ? reject(err) : resolve(data)) }) } function deleteObjectsPromise (deleteConfig) { return new Promise((resolve, reject) => { client.deleteObject(deleteConfig, (err, data) => err ? reject(err) : resolve(data)) }) } }
const assert = require('assert') const AWS = require('aws-sdk') /** * Create s3 client * @param {Object} config AWS configuration * @returns {Object} s3 client and helpers */ module.exports = function s3Loader (config) { assert(config, 's3Loader requires config') const client = new AWS.S3(config) return { client, uploadFilePromise, deleteObjectsPromise } function uploadFilePromise (uploadConfig) { return new Promise((resolve, reject) => { client.upload(uploadConfig, (err, data) => err ? reject(err) : resolve(data)) }) } function deleteObjectsPromise (deleteConfig) { return new Promise((resolve, reject) => { client.deleteObject(deleteConfig, (err, data) => err ? reject(err) : resolve(data)) }) } }
Use const and remove useless lines
Use const and remove useless lines
JavaScript
apache-2.0
cesarandreu/bshed,cesarandreu/bshed
--- +++ @@ -1,5 +1,5 @@ -var assert = require('assert') -var AWS = require('aws-sdk') +const assert = require('assert') +const AWS = require('aws-sdk') /** * Create s3 client @@ -8,9 +8,7 @@ */ module.exports = function s3Loader (config) { assert(config, 's3Loader requires config') - var client = new AWS.S3(config) - - client.endpoint = config.endpoint + const client = new AWS.S3(config) return { client,
94564b672b27eeb8229e03aa324f73d8f0339bc2
js/outputs.js
js/outputs.js
'use strict'; var OutputManager = (function () { var outputs = []; var active = []; var display = undefined; var addOutput = function(o) { outputs.push(o); }; var activateOutput = function(o) { active.push(o); }; var deactivateOutput = function(o) { var i = active.indexOf(o); active.splice(i, 1); showActiveOutputs(); }; var updateActiveOutputs = function(speed, direction) { for(var o in active) { o.update(speed, direction); } }; var showActiveOutputs = function() { display.children().each(function(i) { this.detach(); }); for(var o in active) { } }; return { setDisplayDiv: function (d) { display = d; }, add: addOutput, activate: activateOutput, deactivate: deactivateOutput, show: undefined, get outputList: { return outputs; } update: updateActiveOutputs }; })();
'use strict'; var OutputManager = (function() { var outputs = []; var active = []; var display = undefined; var addOutput = function(o) { outputs.push(o); }; var activateOutput = function(o) { active.push(o); }; var deactivateOutput = function(o) { var i = active.indexOf(o); active.splice(i, 1); showActiveOutputs(); }; var updateActiveOutputs = function(speed, direction) { for (var o in active) { o.update(speed, direction); } }; var showActiveOutputs = function() { display.children().each(function(i) { this.detach(); }); for (var o in active) { } }; return { get outputList() { return outputs; }, setDisplayDiv: function(d) { display = d; }, add: addOutput, activate: activateOutput, deactivate: deactivateOutput, show: undefined, update: updateActiveOutputs }; })();
Fix up gjshint errors in output manager
Fix up gjshint errors in output manager
JavaScript
bsd-3-clause
qdot/giftic,qdot/giftic,qdot/giftic
--- +++ @@ -1,6 +1,6 @@ 'use strict'; -var OutputManager = (function () { +var OutputManager = (function() { var outputs = []; var active = []; @@ -21,7 +21,7 @@ }; var updateActiveOutputs = function(speed, direction) { - for(var o in active) { + for (var o in active) { o.update(speed, direction); } }; @@ -30,17 +30,17 @@ display.children().each(function(i) { this.detach(); }); - for(var o in active) { + for (var o in active) { } }; return { - setDisplayDiv: function (d) { display = d; }, + get outputList() { return outputs; }, + setDisplayDiv: function(d) { display = d; }, add: addOutput, activate: activateOutput, deactivate: deactivateOutput, show: undefined, - get outputList: { return outputs; } update: updateActiveOutputs }; })();
7cf0ff5e0bcf845638d5c4bdbae06811bfc5614b
app/assets/javascripts/teikei.js
app/assets/javascripts/teikei.js
// Overwriting Backbone.Marionette.Renderer to use JST Backbone.Marionette.Renderer.render = function(template, data) { if (!JST[template]) throw "Template '" + template + "' not found!"; return JST[template](data); }; // Extend and configure backbone-forms editors var editors = Backbone.Form.editors; editors.YesNoCheckbox = editors.Checkbox.extend({ getValue: function() { return editors.Checkbox.prototype.getValue.call(this) ? "yes" : "no"; }, setValue: function(value) { editors.Checkbox.prototype.setValue.call(this, value === "yes"); } }); Teikei = new Backbone.Marionette.Application(); Teikei.addRegions({ userPopup: "#user-popups", placesPopup: "#places-popups" }); Teikei.addInitializer(function(options){ var userController = new Teikei.User.Controller(); var userRouter = new Teikei.User.Router({ controller: userController }); var placesController = new Teikei.Places.Controller(); var placesRouter = new Teikei.Places.Router({controller: placesController }); placesController.collection.once("reset", function() { Backbone.history.start(); }, this); }); $(function(){ Teikei.start(); });
// Overwriting Backbone.Marionette.Renderer to use JST Backbone.Marionette.Renderer.render = function(template, data) { if (!JST[template]) throw "Template '" + template + "' not found!"; return JST[template](data); }; // Extend and configure backbone-forms editors var editors = Backbone.Form.editors; editors.YesNoCheckbox = editors.Checkbox.extend({ getValue: function() { return editors.Checkbox.prototype.getValue.call(this) ? "yes" : "no"; }, setValue: function(value) { editors.Checkbox.prototype.setValue.call(this, value === "yes"); } }); editors.Date.monthNames =["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; Teikei = new Backbone.Marionette.Application(); Teikei.addRegions({ userPopup: "#user-popups", placesPopup: "#places-popups" }); Teikei.addInitializer(function(options){ var userController = new Teikei.User.Controller(); var userRouter = new Teikei.User.Router({ controller: userController }); var placesController = new Teikei.Places.Controller(); var placesRouter = new Teikei.Places.Router({controller: placesController }); placesController.collection.once("reset", function() { Backbone.history.start(); }, this); }); $(function(){ Teikei.start(); });
Set German month names for date editor.
Set German month names for date editor.
JavaScript
agpl-3.0
sjockers/teikei,teikei/teikei,sjockers/teikei,sjockers/teikei,teikei/teikei,teikei/teikei
--- +++ @@ -16,6 +16,8 @@ editors.Checkbox.prototype.setValue.call(this, value === "yes"); } }); + +editors.Date.monthNames =["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; Teikei = new Backbone.Marionette.Application();
458ab503f8d0f6a7cc05ec735efac7cf15f46e67
app/assets/scripts/views/home.js
app/assets/scripts/views/home.js
'use strict'; import React from 'react'; import { Link } from 'react-router'; var Home = React.createClass({ displayName: 'Home', render: function () { return ( <section> <header className='page__header--landing'> <div className='page__headline--landing'> <h1 className='page__title--landing'><img src='assets/graphics/layout/or-logo.png' width='500' height='63' alt='Open Roads logo' /><span>Welcome</span></h1> <p className='page__description--landing'>Mapping, tracking and visualizing road projects in the Philippines for inclusive growth</p> </div> </header> <div className='page__body--landing'> <div className='inner'> <h2>Access and improve Road Networks</h2> <p className='description'>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Numquam molestiae deserunt temporibus voluptate ullam doloribus quam quisquam modi recusandae debitis neque hic nam, quibusdam dolore rerum aut, eaque deleniti tenetur!</p> <Link to='/analytics' className='bttn-explore'>Explore more</Link> </div> </div> </section> ); } }); module.exports = Home;
'use strict'; import React from 'react'; import { Link } from 'react-router'; var Home = React.createClass({ displayName: 'Home', render: function () { return ( <section> <header className='page__header--landing'> <div className='page__headline--landing'> <h1 className='page__title--landing'><img src='assets/graphics/layout/or-logo.png' width='500' height='63' alt='Open Roads logo' /><span>Welcome</span></h1> <p className='page__description--landing'>Mapping, tracking and visualizing road projects in the Philippines for inclusive growth</p> </div> </header> <div className='page__body--landing'> <div className='inner'> <h2>Access and improve Road Networks</h2> <p className='description'>The Philippines has over 215 000 kilometers of road. 32 526 of these are national roads that are generally well mapped. The local road network is estimated to be well over 180 000 kilometers, but these estimates are rough since much of it remains unmapped.</p> <p className='description'>Work with the OpenRoads project to close this critical information gap and create a comprehensive road network map of the Philippines.</p> <Link to='/analytics' className='bttn-explore'>Explore more</Link> </div> </div> </section> ); } }); module.exports = Home;
Replace Lorem Ipsum with intro text
Replace Lorem Ipsum with intro text
JavaScript
bsd-2-clause
orma/openroads-vn-analytics,orma/openroads-vn-analytics,orma/openroads-vn-analytics
--- +++ @@ -18,9 +18,8 @@ <div className='page__body--landing'> <div className='inner'> <h2>Access and improve Road Networks</h2> - <p className='description'>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Numquam molestiae - deserunt temporibus voluptate ullam doloribus quam quisquam modi recusandae - debitis neque hic nam, quibusdam dolore rerum aut, eaque deleniti tenetur!</p> + <p className='description'>The Philippines has over 215 000 kilometers of road. 32 526 of these are national roads that are generally well mapped. The local road network is estimated to be well over 180 000 kilometers, but these estimates are rough since much of it remains unmapped.</p> + <p className='description'>Work with the OpenRoads project to close this critical information gap and create a comprehensive road network map of the Philippines.</p> <Link to='/analytics' className='bttn-explore'>Explore more</Link> </div> </div>
5be6cac6e0fa7d206a47329c0cbabf484b203317
src/request/repository/user-repository-internal.js
src/request/repository/user-repository-internal.js
'use strict'; var _ = require('lodash'); var glimpse = require('glimpse'); // store Found Summary (function () { function processFoundSummary(requestRepositoryPayload) { // TODO: need to update to deal with the fact that requests aren't distinct var messages = requestRepositoryPayload.newMessageTypes['user-identification']; if (messages) { var messageIndex = _.indexBy(messages, 'context.id'); var matchedData = []; _.forEach(requestRepositoryPayload.affectedRequests, function(request) { var message = messageIndex[request.id]; if (message) { matchedData.push({ request: request, user: message }); } }); var userRepositoryMessage = { userRequests: matchedData }; glimpse.emit('data.user.detail.found.internal', userRepositoryMessage); } } glimpse.on('data.request.summary.found.message', processFoundSummary); // TODO: If we switch to storing session in local storage this needs to be removed glimpse.on('data.request.summary.found.local', processFoundSummary); })();
'use strict'; var _ = require('lodash'); var glimpse = require('glimpse'); // store Found Summary (function () { function processFoundSummary(requestRepositoryPayload) { // TODO: need to update to deal with the fact that requests aren't distinct var messages = requestRepositoryPayload.newMessageTypes['user-identification']; if (messages) { var messageIndex = _.indexBy(messages, 'context.id'); var matchedData = []; _.forEach(requestRepositoryPayload.affectedRequests, function(request) { // only include if it matches our root filterset // TODO: need to make sure users matches the smae filter set as request if (request._responseContentCategory && ((request._responseContentCategory.document && !request._requestIsAjax) || request._responseContentCategory.data)) { var message = messageIndex[request.id]; if (message) { matchedData.push({ request: request, user: message }); } } }); var userRepositoryMessage = { userRequests: matchedData }; glimpse.emit('data.user.detail.found.internal', userRepositoryMessage); } } glimpse.on('data.request.summary.found.message', processFoundSummary); // TODO: If we switch to storing session in local storage this needs to be removed glimpse.on('data.request.summary.found.local', processFoundSummary); })();
Update user to only include requests that match root filter set
Update user to only include requests that match root filter set
JavaScript
unknown
Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype
--- +++ @@ -14,9 +14,16 @@ var matchedData = []; _.forEach(requestRepositoryPayload.affectedRequests, function(request) { - var message = messageIndex[request.id]; - if (message) { - matchedData.push({ request: request, user: message }); + // only include if it matches our root filterset + // TODO: need to make sure users matches the smae filter set as request + if (request._responseContentCategory + && ((request._responseContentCategory.document && !request._requestIsAjax) + || request._responseContentCategory.data)) + { + var message = messageIndex[request.id]; + if (message) { + matchedData.push({ request: request, user: message }); + } } });
61212b63fb10e5a75ac5f87685823cd1f24dab2a
app/models/coordinator.js
app/models/coordinator.js
import EmberObject from '@ember/object'; import Evented from '@ember/object/evented'; import { computed } from '@ember/object'; import ObjHash from './obj-hash'; import { unwrapper } from 'ember-drag-drop/utils/proxy-unproxy-objects'; export default EmberObject.extend(Evented, { objectMap: computed(function() { return ObjHash.create(); }), getObject: function(id,ops) { ops = ops || {}; var payload = this.get('objectMap').getObj(id); if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) { payload.ops.source.sendAction('action',payload.obj); } if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) { payload.ops.target.sendAction('action',payload.obj); } this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target}); return unwrapper(payload.obj); }, setObject: function(obj,ops) { ops = ops || {}; return this.get('objectMap').add({obj: obj, ops: ops}); } });
import EmberObject from '@ember/object'; import Evented from '@ember/object/evented'; import { computed } from '@ember/object'; import ObjHash from './obj-hash'; import { unwrapper } from 'ember-drag-drop/utils/proxy-unproxy-objects'; export default EmberObject.extend(Evented, { objectMap: computed(function() { return ObjHash.create(); }), getObject: function(id,ops) { ops = ops || {}; var payload = this.get('objectMap').getObj(id); if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) { payload.ops.source.send('action', payload.obj); } if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) { payload.ops.target.send('action', payload.obj); } this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target}); return unwrapper(payload.obj); }, setObject: function(obj,ops) { ops = ops || {}; return this.get('objectMap').add({obj: obj, ops: ops}); } });
Use send instead of sendAction
Use send instead of sendAction
JavaScript
mit
mharris717/ember-drag-drop,mharris717/ember-drag-drop
--- +++ @@ -14,11 +14,11 @@ var payload = this.get('objectMap').getObj(id); if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) { - payload.ops.source.sendAction('action',payload.obj); + payload.ops.source.send('action', payload.obj); } if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) { - payload.ops.target.sendAction('action',payload.obj); + payload.ops.target.send('action', payload.obj); } this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target});
7fbf23d3569563524f9defa413b9e59da123b04a
styleguide/devServer.js
styleguide/devServer.js
var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var config = require('./webpack-dev.config'); new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, hot: true, historyApiFallback: true }).listen(8181, 'localhost', function(err) { if (err) { console.log(err); } console.log('Listening at localhost:8181'); });
var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var config = require('./webpack-dev.config'); new WebpackDevServer(webpack(config), { publicPath: config.output.publicPath, hot: true, historyApiFallback: true }).listen(8080, 'localhost', function(err) { if (err) { console.log(err); } console.log('Listening at localhost:8080'); });
Change dev server port so less confusing
Change dev server port so less confusing
JavaScript
mit
scott-riley/loggins,PactCoffee/loggins,iest/loggins,tomgatzgates/loggins,tomgatzgates/loggins,PactCoffee/loggins,chrisspang/loggins,chrisspang/loggins,rdjpalmer/loggins,rdjpalmer/loggins,iest/loggins,scott-riley/loggins
--- +++ @@ -6,10 +6,10 @@ publicPath: config.output.publicPath, hot: true, historyApiFallback: true -}).listen(8181, 'localhost', function(err) { +}).listen(8080, 'localhost', function(err) { if (err) { console.log(err); } - console.log('Listening at localhost:8181'); + console.log('Listening at localhost:8080'); });
23e751b09f927e2826a6a4083868f7f864fbc94c
helpers.js
helpers.js
console.log("Loading helpers.js"); window.snip$ = (function() { var path = require("path"); function currEd() { return lt.objs.editor.pool.last_active.call(null); } function currPath() { return lt.objs.tabs.__GT_path(currEd()); } function hasSelection() { return lt.objs.editor.selection_QMARK_.call(null, currEd()); } function selection () { return lt.objs.editor.selection(currEd()); } function cutSelection() { lt.objs.editor.cut(currEd()); } function wrapSelection() { if(hasSelection()) { var text = selection(); cutSelection(); return text; } }; return { currPath: currPath, path: path, wrapSelection: wrapSelection } })();
console.log("Loading helpers.js"); window.snip$ = (function() { var path = require("path"); function currEd() { return lt.objs.editor.pool.last_active.call(null); } function currPath() { return lt.objs.tabs.__GT_path(currEd()); } function currFileName() { var p = currPath(); return p ? path.basename(p) : null; } function currFileNameSansExt() { var f = currFileName(); return f ? f.replace(path.extname(f), "") : null; } function hasSelection() { return lt.objs.editor.selection_QMARK_.call(null, currEd()); } function selection() { return lt.objs.editor.selection(currEd()); } function selectLine() { var ed = currEd(); var cmEd = lt.objs.editor.__GT_cm_ed.call(null, ed); var lineNo = cmEd.getCursor().line; var line = cmEd.getLine(lineNo); var length = line.length; cmEd.setSelection({line: lineNo, ch: 0}, {line: lineNo, ch: length}); cmEd.setExtending(false); } function cutSelection() { lt.objs.editor.cut(currEd()); } function wrapSelection() { if(hasSelection()) { var text = selection(); cutSelection(); return text; } } function wrapSelectionEager() { if(!hasSelection()) { selectLine(); } return wrapSelection(); } return { currPath: currPath, currFileName: currFileName, currFileNameSansExt: currFileNameSansExt, path: path, wrapSelection: wrapSelection, wrapSelectionEager: wrapSelectionEager } })();
Allow wrapping around current line even though not selected
Allow wrapping around current line even though not selected
JavaScript
mit
rundis/lt-snippets,weaver-viii/lt-snippets
--- +++ @@ -8,9 +8,31 @@ function currPath() { return lt.objs.tabs.__GT_path(currEd()); } + function currFileName() { + var p = currPath(); + return p ? path.basename(p) : null; + } + + function currFileNameSansExt() { + var f = currFileName(); + return f ? f.replace(path.extname(f), "") : null; + } + function hasSelection() { return lt.objs.editor.selection_QMARK_.call(null, currEd()); } - function selection () { return lt.objs.editor.selection(currEd()); } + function selection() { return lt.objs.editor.selection(currEd()); } + + function selectLine() { + var ed = currEd(); + var cmEd = lt.objs.editor.__GT_cm_ed.call(null, ed); + + var lineNo = cmEd.getCursor().line; + var line = cmEd.getLine(lineNo); + var length = line.length; + + cmEd.setSelection({line: lineNo, ch: 0}, {line: lineNo, ch: length}); + cmEd.setExtending(false); + } function cutSelection() { lt.objs.editor.cut(currEd()); } @@ -20,13 +42,23 @@ cutSelection(); return text; } - }; + } + + function wrapSelectionEager() { + if(!hasSelection()) { + selectLine(); + } + return wrapSelection(); + } return { currPath: currPath, + currFileName: currFileName, + currFileNameSansExt: currFileNameSansExt, path: path, - wrapSelection: wrapSelection + wrapSelection: wrapSelection, + wrapSelectionEager: wrapSelectionEager }
9a0198e14d43498ff563db56fec0747cb5419489
main/constants/ui.js
main/constants/ui.js
// Height of main input export const INPUT_HEIGHT = 45; // Heigth of default result line export const RESULT_HEIGHT = 45; // Heigth of default result line export const RESULT_WIDTH = 250; // Width of main window export const WINDOW_WIDTH = 600; // Maximum results that would be rendered export const MAX_RESULTS = 25; // Results view shows this count of resutls without scrollbar export const MIN_VISIBLE_RESULTS = 10;
// Height of main input export const INPUT_HEIGHT = 45; // Heigth of default result line export const RESULT_HEIGHT = 45; // Heigth of default result line export const RESULT_WIDTH = 250; // Width of main window export const WINDOW_WIDTH = 650; // Maximum results that would be rendered export const MAX_RESULTS = 25; // Results view shows this count of resutls without scrollbar export const MIN_VISIBLE_RESULTS = 10;
Increase width of main input to 650px
Increase width of main input to 650px
JavaScript
mit
KELiON/cerebro,KELiON/cerebro
--- +++ @@ -8,7 +8,7 @@ export const RESULT_WIDTH = 250; // Width of main window -export const WINDOW_WIDTH = 600; +export const WINDOW_WIDTH = 650; // Maximum results that would be rendered export const MAX_RESULTS = 25;
a1e304bb328a6b4ea8b136414e496929df2085a1
contrib/rethinkdb-co/index.js
contrib/rethinkdb-co/index.js
var _ = require('lodash'); var RethinkDB = require(__dirname + '/../rethinkdb'); var connex = require(__dirname + '/../../lib'); var RethinkDBCo = module.exports = function(options) { if(!(this instanceof RethinkDBCo)) { return new RethinkDBCo(options); } return RethinkDB.apply(this, arguments); }; require('util').inherits(RethinkDBCo, RethinkDB); RethinkDBCo.prototype.getHandle = function() { var handle = this.handle; return { r: this.RethinkDB, conn: handle, run: function(query) { var conn = handle; return function(done) { return query.run(conn, done); }; }, toArray: function(query) { var conn = handle; return function(done) { return query.run(conn, function(err, cursor) { if(err) return done(err); return cursor.toArray(done); }); }; } }; };
var _ = require('lodash'); var RethinkDB = require(__dirname + '/../rethinkdb'); var connex = require(__dirname + '/../../lib'); var RethinkDBCo = module.exports = function(options) { if(!(this instanceof RethinkDBCo)) { return new RethinkDBCo(options); } return RethinkDB.apply(this, arguments); }; require('util').inherits(RethinkDBCo, RethinkDB); RethinkDBCo.prototype.getHandle = function() { var handle = this.handle; return { r: this.RethinkDB, conn: handle, run: function(query, options) { var conn = handle; options = options || {}; return function(done) { return query.run(conn, options, done); }; }, toArray: function(query) { var conn = handle; return function(done) { return query.run(conn, function(err, cursor) { if(err) return done(err); return cursor.toArray(done); }); }; } }; };
Add possibility to pass options to rethinkdb-co run
Add possibility to pass options to rethinkdb-co run
JavaScript
mit
tedeh/connex
--- +++ @@ -21,9 +21,10 @@ conn: handle, - run: function(query) { + run: function(query, options) { var conn = handle; - return function(done) { return query.run(conn, done); }; + options = options || {}; + return function(done) { return query.run(conn, options, done); }; }, toArray: function(query) {
1039beba35e4eb474cb35ce300aa8f0b437a7ea0
lib/config.js
lib/config.js
'use strict'; var cc = require('config-chain'); var autoconfig = function(overrides) { var config = cc(overrides).add({ IP: process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0', PORT: process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8001, dataTopicPrefix: ':cloud:data', persistentStore: process.env.WFM_USE_MEMORY_STORE !== "true", syncOptions: { "sync_frequency" : 5, "storage_strategy": "dom", "do_console_log": false } }); return config; }; module.exports = autoconfig();
'use strict'; var cc = require('config-chain'); /** * The sync frequency to be passed to fh-wfm-sync. * Sync frequency is set individually for the client and the server. * * On the client the setting is named `sync_frequency`. * * On the server the setting is named `syncFrequency`. * It is recommended that these settings share the same value. */ var SYNC_FREQUENCY = 5; var autoconfig = function(overrides) { var config = cc(overrides).add({ IP: process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0', PORT: process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8001, dataTopicPrefix: ':cloud:data', persistentStore: process.env.WFM_USE_MEMORY_STORE !== "true", syncOptions: { "syncFrequency": SYNC_FREQUENCY, "sync_frequency" : SYNC_FREQUENCY, "storage_strategy": "dom", "do_console_log": false } }); return config; }; module.exports = autoconfig();
Update server `syncFrequency` value to match client `sync_frequency`
Update server `syncFrequency` value to match client `sync_frequency` Currently the server-side dataset sync frequencies are set to 10 seconds whereas the client-side dataset sync frequencies are set to 5 seconds. Having differing sync frequencies can cause unnecessary load on the server, causing a full sync to be performed twice for each server-side sync loop frequency. This change adds the `syncFrequency` option which will default all server-side datasets to sync every 5 seconds also. The multiple sync issue has been documented from the following two issues: * FH-3018 * FH-3062
JavaScript
mit
feedhenry-raincatcher/raincatcher-demo-cloud
--- +++ @@ -1,6 +1,15 @@ 'use strict'; var cc = require('config-chain'); + +/** + * The sync frequency to be passed to fh-wfm-sync. + * Sync frequency is set individually for the client and the server. + * * On the client the setting is named `sync_frequency`. + * * On the server the setting is named `syncFrequency`. + * It is recommended that these settings share the same value. + */ +var SYNC_FREQUENCY = 5; var autoconfig = function(overrides) { var config = cc(overrides).add({ @@ -9,7 +18,8 @@ dataTopicPrefix: ':cloud:data', persistentStore: process.env.WFM_USE_MEMORY_STORE !== "true", syncOptions: { - "sync_frequency" : 5, + "syncFrequency": SYNC_FREQUENCY, + "sync_frequency" : SYNC_FREQUENCY, "storage_strategy": "dom", "do_console_log": false }
51cf6e6bc5fab543b18c23a7698eccaf006a9ca9
generators/app/templates/_gulpfile.js
generators/app/templates/_gulpfile.js
var gulp = require('gulp'); var tslint = require('gulp-tslint'); var exec = require('child_process').exec; var jasmine = require('gulp-jasmine'); var gulp = require('gulp-help')(gulp); gulp.task('tslint', 'Lints all TypeScript source files', function(){ return gulp.src('src/**/*.ts') .pipe(tslint()) .pipe(tslint.report('verbose')); }); gulp.task('build', 'Compiles all TypeScript source files', function (cb) { exec('tsc', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }); gulp.task('test', 'Runs the Jasmine test specs', ['build'], function () { return gulp.src('test/*.js') .pipe(jasmine()); });
var gulp = require('gulp'); var tslint = require('gulp-tslint'); var exec = require('child_process').exec; var jasmine = require('gulp-jasmine'); var gulp = require('gulp-help')(gulp); var tsFilesGlob = (function(c) { return c.filesGlob || c.files || '**/*.ts'; })(require('./tsconfig.json')); gulp.task('tslint', 'Lints all TypeScript source files', function(){ return gulp.src(tsFilesGlob) .pipe(tslint()) .pipe(tslint.report('verbose')); }); gulp.task('build', 'Compiles all TypeScript source files', function (cb) { exec('tsc', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }); gulp.task('test', 'Runs the Jasmine test specs', ['build'], function () { return gulp.src('test/*.js') .pipe(jasmine()); });
Use filesGlob from tsconfig in gulp file
Use filesGlob from tsconfig in gulp file
JavaScript
mit
ospatil/generator-node-typescript,ospatil/generator-node-typescript
--- +++ @@ -4,8 +4,12 @@ var jasmine = require('gulp-jasmine'); var gulp = require('gulp-help')(gulp); +var tsFilesGlob = (function(c) { + return c.filesGlob || c.files || '**/*.ts'; +})(require('./tsconfig.json')); + gulp.task('tslint', 'Lints all TypeScript source files', function(){ - return gulp.src('src/**/*.ts') + return gulp.src(tsFilesGlob) .pipe(tslint()) .pipe(tslint.report('verbose')); });
5a5565b39d96ce64767089bab8911ed891f44374
isaac_math.js
isaac_math.js
// Math Library for ISAAC Physics. // addVector function. // Takes in two vectors, returns a new vector made by adding // the inputs together. If the two input vectors don't have the same // length, the first input vector will be returned. function addVector (vectorA, vectorB) { if(vectorA.length === vectorB.length) { var newVector = new Array(); for(position in vectorA) { newVector[position] = vectorA[position] + vectorB[position]; } return newVector; } else { return vectorA; } } // scaleVector function. // Takes in a vector and a scalar, returns a new vector made by // multiplying the scalar through the vector. function scaleVector (vector, scalar) { var newVector = new Array(); for(position in vector) { newVector[position] = vector[position] * scalar; } return newVector; } // subtractVector function. // Takes in two vectors, returns a new vector made by subtracting the // second vector from the first. If the two input vectors don't have the same // length, the first input vector will be returned. function subtractVector (vectorA, vectorB) { return addVector(vectorA, scaleVector(vectorB, -1)); }
// Math Library for ISAAC Physics. // addVector function. // Takes in two vectors, returns a new vector made by adding // the inputs together. If the two input vectors don't have the same // length, the first input vector will be returned. function addVector (vectorA, vectorB) { if(vectorA.length === vectorB.length) { var newVector = new Array(); for(position in vectorA) { newVector[position] = vectorA[position] + vectorB[position]; } return newVector; } else { return vectorA; } } // scaleVector function. // Takes in a vector and a scalar, returns a new vector made by // multiplying the scalar through the vector. function scaleVector (vector, scalar) { var newVector = new Array(); for(position in vector) { newVector[position] = vector[position] * scalar; } return newVector; } // subtractVector function. // Takes in two vectors, returns a new vector made by subtracting the // second vector from the first. If the two input vectors don't have the same // length, the first input vector will be returned. function subtractVector (vectorA, vectorB) { return addVector(vectorA, scaleVector(vectorB, -1)); } // dotProduct function. // Takes in two vectors, returns the dot product of the two. If the two input vectors // don't have the same length, -1 will be returned. function dotProduct (vectorA, vectorB) { if(vectorA.length === vectorB.length) { var sum = 0; for (position in vectorA) { sum += vectorA[position] * vectorB[position]; } return sum; } else { return -1; } }
Add dot product function to math module.
Add dot product function to math module.
JavaScript
mit
isaacjs/ISAAC
--- +++ @@ -34,3 +34,18 @@ function subtractVector (vectorA, vectorB) { return addVector(vectorA, scaleVector(vectorB, -1)); } + +// dotProduct function. +// Takes in two vectors, returns the dot product of the two. If the two input vectors +// don't have the same length, -1 will be returned. +function dotProduct (vectorA, vectorB) { + if(vectorA.length === vectorB.length) { + var sum = 0; + for (position in vectorA) { + sum += vectorA[position] * vectorB[position]; + } + return sum; + } else { + return -1; + } +}
77e033f68bc06a8b522ab1d13c43473cc22e6911
build/build.js
build/build.js
const rollup = require('rollup').rollup; const babel = require('rollup-plugin-babel'); rollup({ entry: './src/index.js', external: [ 'babel-runtime/core-js/json/stringify', 'babel-runtime/core-js/object/assign', 'babel-runtime/helpers/asyncToGenerator', 'babel-runtime/regenerator', 'fs', 'util', 'path', 'node-sass', 'rollup-pluginutils' ], plugins: [ babel({ runtimeHelpers: true }) ] }).then((bundle) => { bundle.write({ dest: 'dist/rollup-plugin-sass.cjs.js', format: 'cjs' }); bundle.write({ dest: 'dist/rollup-plugin-sass.es6.js', format: 'es6' }); }).catch(console.error);
const rollup = require('rollup').rollup; const babel = require('rollup-plugin-babel'); rollup({ entry: './src/index.js', external: [ 'babel-runtime/core-js/json/stringify', 'babel-runtime/core-js/object/assign', 'babel-runtime/helpers/asyncToGenerator', 'babel-runtime/regenerator', 'fs', 'util', 'path', 'node-sass', 'rollup-pluginutils' ], plugins: [ babel({ runtimeHelpers: true }) ] }).then(function (bundle) { bundle.write({ dest: 'dist/rollup-plugin-sass.cjs.js', format: 'cjs' }); bundle.write({ dest: 'dist/rollup-plugin-sass.es6.js', format: 'es6' }); }).catch(console.error);
Remove arrow func compatible with old version node
Remove arrow func compatible with old version node
JavaScript
mit
differui/rollup-plugin-sass,differui/rollup-plugin-sass
--- +++ @@ -19,7 +19,7 @@ runtimeHelpers: true }) ] -}).then((bundle) => { +}).then(function (bundle) { bundle.write({ dest: 'dist/rollup-plugin-sass.cjs.js', format: 'cjs'
bc629f18472ae90a87e4966a73e0cce6f0b250bf
lib/current.js
lib/current.js
// Date object that always reflects current time (with one second resolution) 'use strict'; var curry = require('es5-ext/lib/Function/prototype/curry') , update; update = function () { this.setTime(Date.now()); }; module.exports = function () { var date = new Date(); date.clear = curry.call(clearInterval, setInterval(update.bind(date), 1000)); return date; };
// Date object that always reflects current time (with one second resolution) 'use strict'; var partial = require('es5-ext/lib/Function/prototype/partial') , update; update = function () { this.setTime(Date.now()); }; module.exports = function () { var date = new Date(); date.clear = partial.call(clearInterval, setInterval(update.bind(date), 1000)); return date; };
Update up to changes in es5-ext
Update up to changes in es5-ext
JavaScript
mit
medikoo/clock
--- +++ @@ -2,7 +2,7 @@ 'use strict'; -var curry = require('es5-ext/lib/Function/prototype/curry') +var partial = require('es5-ext/lib/Function/prototype/partial') , update; @@ -12,6 +12,7 @@ module.exports = function () { var date = new Date(); - date.clear = curry.call(clearInterval, setInterval(update.bind(date), 1000)); + date.clear = partial.call(clearInterval, + setInterval(update.bind(date), 1000)); return date; };
134d89a3d6379df9cbdf2a2194a229cd2980a0f5
modules/DTMF/DTMF.js
modules/DTMF/DTMF.js
/* global APP */ /** * A module for sending DTMF tones. */ var DTMFSender; var initDtmfSender = function() { // TODO: This needs to reset this if the peerconnection changes // (e.g. the call is re-made) if (DTMFSender) return; var localAudio = APP.RTC.localAudio; if (localAudio && localAudio.getTracks().length > 0) { var peerconnection = APP.xmpp.getConnection().jingle.activecall.peerconnection.peerconnection; if (peerconnection) { DTMFSender = peerconnection.createDTMFSender(localAudio.getTracks()[0]); console.log("Initialized DTMFSender"); } else { console.log("Failed to initialize DTMFSender: no PeerConnection."); } } else { console.log("Failed to initialize DTMFSender: no audio track."); } }; var DTMF = { sendTones: function (tones) { if (!DTMFSender) initDtmfSender(); if (DTMFSender){ DTMFSender.insertDTMF(tones); } } }; module.exports = DTMF;
/* global APP */ /** * A module for sending DTMF tones. */ var DTMFSender; var initDtmfSender = function() { // TODO: This needs to reset this if the peerconnection changes // (e.g. the call is re-made) if (DTMFSender) return; var localAudio = APP.RTC.localAudio; if (localAudio && localAudio.getTracks().length > 0) { var peerconnection = APP.xmpp.getConnection().jingle.activecall.peerconnection; if (peerconnection) { DTMFSender = peerconnection.peerconnection .createDTMFSender(localAudio.getTracks()[0]); console.log("Initialized DTMFSender"); } else { console.log("Failed to initialize DTMFSender: no PeerConnection."); } } else { console.log("Failed to initialize DTMFSender: no audio track."); } }; var DTMF = { sendTones: function (tones, duration, pause) { if (!DTMFSender) initDtmfSender(); if (DTMFSender){ DTMFSender.insertDTMF(tones, (duration || 200), (pause || 200)); } } }; module.exports = DTMF;
Fix a problem with accessing peerconnection, use duration and pause in the API.
Fix a problem with accessing peerconnection, use duration and pause in the API.
JavaScript
apache-2.0
dyweb/jitsi-meet,gerges/jitsi-meet,JiYou/jitsi-meet,IpexCloud/jitsi-meet,gpolitis/jitsi-meet,jitsi/jitsi-meet,gpolitis/jitsi-meet,kosmosby/jitsi-meet,jitsi/jitsi-meet,NxTec/jitsi-meet,gpolitis/jitsi-meet,jitsi/jitsi-meet,bgrozev/jitsi-meet,jitsi/jitsi-meet,bgrozev/jitsi-meet,buzzyboy/jitsi-meet,procandi/jitsi-meet,procandi/jitsi-meet,b100w11/jitsi-meet,micahflee/jitsi-meet,Aharobot/jitsi-meet,gpolitis/jitsi-meet,Aharobot/jitsi-meet,luciash/jitsi-meet-bootstrap,gerges/jitsi-meet,NxTec/jitsi-meet,gpolitis/jitsi-meet,kosmosby/jitsi-meet,tsunli/jitsi-meet,pstros/jitsi-meet,luciash/jitsi-meet-bootstrap,JiYou/jitsi-meet,learnium/jitsi-meet,IpexCloud/jitsi-meet,bgrozev/jitsi-meet,micahflee/jitsi-meet,jitsi/jitsi-meet,gpolitis/jitsi-meet,buzzyboy/jitsi-meet,tsareg/jitsi-meet,bgrozev/jitsi-meet,dyweb/jitsi-meet,isymchych/jitsi-meet,buzzyboy/jitsi-meet,bhatvv/jitsi-meet,bgrozev/jitsi-meet,procandi/jitsi-meet,kosmosby/jitsi-meet,bickelj/jitsi-meet,bhatvv/jitsi-meet,gpolitis/jitsi-meet,pstros/jitsi-meet,NxTec/jitsi-meet,tsunli/jitsi-meet,bickelj/jitsi-meet,dyweb/jitsi-meet,bgrozev/jitsi-meet,JiYou/jitsi-meet,jitsi/jitsi-meet,gpolitis/jitsi-meet,learnium/jitsi-meet,Aharobot/jitsi-meet,b100w11/jitsi-meet,gerges/jitsi-meet,jitsi/jitsi-meet,b100w11/jitsi-meet,bhatvv/jitsi-meet,tsunli/jitsi-meet,jitsi/jitsi-meet,isymchych/jitsi-meet,learnium/jitsi-meet,tsareg/jitsi-meet
--- +++ @@ -13,11 +13,12 @@ var localAudio = APP.RTC.localAudio; if (localAudio && localAudio.getTracks().length > 0) { - var peerconnection = - APP.xmpp.getConnection().jingle.activecall.peerconnection.peerconnection; + var peerconnection + = APP.xmpp.getConnection().jingle.activecall.peerconnection; if (peerconnection) { DTMFSender = - peerconnection.createDTMFSender(localAudio.getTracks()[0]); + peerconnection.peerconnection + .createDTMFSender(localAudio.getTracks()[0]); console.log("Initialized DTMFSender"); } else { @@ -30,12 +31,14 @@ }; var DTMF = { - sendTones: function (tones) { + sendTones: function (tones, duration, pause) { if (!DTMFSender) initDtmfSender(); if (DTMFSender){ - DTMFSender.insertDTMF(tones); + DTMFSender.insertDTMF(tones, + (duration || 200), + (pause || 200)); } } };
32828677d21b5de37859289632f91485ec20a2a1
lib/router.js
lib/router.js
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); }, fastRender: true }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); } }); Router.route('/:mangasName/tome/:_id', { name: 'tomeDetails', waitOn: function() { return subscriptions.subscribe('tomeDetails', this.params._id); }, data: function() { return Mangas.findOne(this.params._id); } });
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); }, fastRender: true }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); } }); Router.route('/:mangasName/tome/:_id', { name: 'tomeDetails', waitOn: function() { return [subscriptions.subscribe('tomeDetails', this.params._id), subscriptions.subscribe('allTomes', Meteor.userId(), this.params.mangasName)]; }, data: function() { return Mangas.findOne(this.params._id); } });
Add a new subcription for the tomeDetails route
Add a new subcription for the tomeDetails route
JavaScript
mit
dexterneo/mangas,dexterneo/mangas,dexterneo/mangatek,dexterneo/mangatek
--- +++ @@ -1,32 +1,32 @@ var subscriptions = new SubsManager(); Router.configure({ - layoutTemplate: 'layout', - loadingTemplate: 'loading', - notFoundTemplate: 'notFound' + layoutTemplate: 'layout', + loadingTemplate: 'loading', + notFoundTemplate: 'notFound' }); Router.route('/', { - name: 'home', - waitOn: function() { - return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); - }, - fastRender: true + name: 'home', + waitOn: function() { + return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); + }, + fastRender: true }); Router.route('/missingMangas', { - name: 'missingMangas', - waitOn: function() { - return subscriptions.subscribe('allMissingMangas', Meteor.userId()); - } + name: 'missingMangas', + waitOn: function() { + return subscriptions.subscribe('allMissingMangas', Meteor.userId()); + } }); Router.route('/:mangasName/tome/:_id', { - name: 'tomeDetails', - waitOn: function() { - return subscriptions.subscribe('tomeDetails', this.params._id); - }, - data: function() { - return Mangas.findOne(this.params._id); - } + name: 'tomeDetails', + waitOn: function() { + return [subscriptions.subscribe('tomeDetails', this.params._id), subscriptions.subscribe('allTomes', Meteor.userId(), this.params.mangasName)]; + }, + data: function() { + return Mangas.findOne(this.params._id); + } });
6e185f1b5f34fe3416ee95a00aeeb5c5d0273fc9
lib/config.js
lib/config.js
'use strict'; var fs = require('fs'); var path = require('path'); exports.getApiConfig = function() { return Object.freeze({ port: process.env.SERVER_PORT || 4002, heartbeat: process.env.HEARTBEAT === 'true', logLevel: process.env.LOG_LEVEL || 'info', api: Object.freeze({ apiURL: process.env.API_URL || 'https://openhim-core:8080', username: process.env.API_USERNAME || 'root@openhim.org', password: process.env.API_PASSWORD || 'openhim-password', trustSelfSigned: process.env.TRUST_SELF_SIGNED === 'true' }) }); }; exports.getMediatorConfig = function() { var mediatorConfigFile = path.resolve('config', 'mediator.json'); return JSON.parse(fs.readFileSync(mediatorConfigFile)); };
'use strict'; var fs = require('fs'); var path = require('path'); exports.getApiConfig = function() { return Object.freeze({ port: process.env.SERVER_PORT || 4002, heartbeat: process.env.HEARTBEAT === 'true', logLevel: process.env.LOG_LEVEL || 'info', api: Object.freeze({ apiURL: process.env.API_URL || 'https://localhost:8080', username: process.env.API_USERNAME || 'root@openhim.org', password: process.env.API_PASSWORD || 'openhim-password', trustSelfSigned: process.env.TRUST_SELF_SIGNED === 'true' }) }); }; exports.getMediatorConfig = function() { var mediatorConfigFile = path.resolve('config', 'mediator.json'); return JSON.parse(fs.readFileSync(mediatorConfigFile)); };
Change apiURL default from docker to localhost
Change apiURL default from docker to localhost As this is a public repository, we can't assume everybody will be using docker and have the same container name. MOM-554
JavaScript
mpl-2.0
jembi/openhim-mediator-file-queue,jembi/openhim-mediator-file-queue
--- +++ @@ -9,7 +9,7 @@ heartbeat: process.env.HEARTBEAT === 'true', logLevel: process.env.LOG_LEVEL || 'info', api: Object.freeze({ - apiURL: process.env.API_URL || 'https://openhim-core:8080', + apiURL: process.env.API_URL || 'https://localhost:8080', username: process.env.API_USERNAME || 'root@openhim.org', password: process.env.API_PASSWORD || 'openhim-password', trustSelfSigned: process.env.TRUST_SELF_SIGNED === 'true'
1d158c46020f6b9d42d5043a6f84c551032003fc
lib/config.js
lib/config.js
/***************************************************************************** * utils.js * Includes various utility functions */ var path = require('path'); var fs = require('fs'); var nconf = require('nconf'); var internals = {}; internals.configInited = false; internals.Config = {} internals.Config.load = function(configFilePath) { if (!configFilePath) { var fileInfo = path.parse(process.argv[1]); configFilePath = './conf/' + fileInfo.name + '.conf.json'; } if (!fs.existsSync(configFilePath)) { var errMsg = 'Config failed to open file: ' + configFilePath; console.log(errMsg); throw new Error(errMsg); } console.log('Config loading from file: ' + configFilePath); nconf.argv() .env() .file({ file: configFilePath }); internals.configInited = true; }; internals.Config.get = function(key, defaultVal) { if (!internals.configInited) { internals.Config.load(); } return nconf.get(key) || defaultVal; }; module.exports = internals.Config;
/***************************************************************************** * utils.js * Includes various utility functions */ var path = require('path'); var fs = require('fs'); var nconf = require('nconf'); var internals = {}; internals.configInited = false; internals.Config = {} /** * Loads the config from specific file if specified * @param {string} configFilePath */ internals.Config.load = function(configFilePath) { if (!configFilePath) { var fileInfo = path.parse(process.argv[1]); configFilePath = './conf/' + fileInfo.name + '.conf.json'; } if (!fs.existsSync(configFilePath)) { var errMsg = 'Config failed to open file: ' + configFilePath; console.log(errMsg); throw new Error(errMsg); } console.log('Config loading from file: ' + configFilePath); nconf.argv() .env() .file({ file: configFilePath }); internals.configInited = true; }; /** * Retrieves a property in the config * @param {string} key - The key of the config * @param {*} defaultVal - THe default value if key is not found */ internals.Config.get = function(key, defaultVal) { if (!internals.configInited) { internals.Config.load(); } var val = nconf.get(key) if (val === undefined) { return defaultVal; } return val; }; module.exports = internals.Config;
Return default value on undefined only
Return default value on undefined only
JavaScript
mit
altenia/ecofyjs-config
--- +++ @@ -14,6 +14,10 @@ internals.Config = {} +/** + * Loads the config from specific file if specified + * @param {string} configFilePath + */ internals.Config.load = function(configFilePath) { if (!configFilePath) { @@ -34,13 +38,22 @@ internals.configInited = true; }; +/** + * Retrieves a property in the config + * @param {string} key - The key of the config + * @param {*} defaultVal - THe default value if key is not found + */ internals.Config.get = function(key, defaultVal) { if (!internals.configInited) { internals.Config.load(); } - return nconf.get(key) || defaultVal; + var val = nconf.get(key) + if (val === undefined) { + return defaultVal; + } + return val; }; module.exports = internals.Config;
9adb2f964716f4766765a566428ea101773fb878
helper/DiskDataStore.js
helper/DiskDataStore.js
var fs = require('fs'); var Settings = require('./Settings'); var DiskDataStore = {}; DiskDataStore.init = function (){ this._CACHE_PATH = Settings.get('cache_path'); fs.mkdirSync(this._CACHE_PATH); }; DiskDataStore.deleteEntry = function (key){ var fileName = this._CACHE_PATH + '/' + key; fs.unlink(fileName, function (err){ if (err) throw err; console.log('successfully deleted ' + fileName); }); }; DiskDataStore.readEntry = function (key, targetBuffer, targetOffset, sourceOffset, length){ var fileName = this._CACHE_PATH + '/' + key; var fd = fs.openSync(fileName, 'rs'); fs.readSync(fd, targetBuffer, targetOffset, length, sourceOffset); fs.closeSync(fd); }; DiskDataStore.writeEntry = function (key, data, cb){ var fileName = this._CACHE_PATH + '/' + key; fs.writeFile(fileName, data, cb); }; module.exports = DiskDataStore;
var fs = require('fs'); var Settings = require('./Settings'); var DiskDataStore = {}; var fs = require('fs'); var deleteFolderRecursive = function(path) { if( fs.existsSync(path) ) { fs.readdirSync(path).forEach(function(file,index){ var curPath = path + '/' + file; if(fs.lstatSync(curPath).isDirectory()) { // recurse deleteFolderRecursive(curPath); } else { // delete file fs.unlinkSync(curPath); } }); fs.rmdirSync(path); } }; DiskDataStore.init = function (){ this._CACHE_PATH = Settings.get('cache_path'); deleteFolderRecursive(this._CACHE_PATH); fs.mkdirSync(this._CACHE_PATH); }; DiskDataStore.deleteEntry = function (key){ var fileName = this._CACHE_PATH + '/' + key; fs.unlink(fileName, function (err){ if (err) throw err; console.log('successfully deleted ' + fileName); }); }; DiskDataStore.readEntry = function (key, targetBuffer, targetOffset, sourceOffset, length){ var fileName = this._CACHE_PATH + '/' + key; var fd = fs.openSync(fileName, 'rs'); fs.readSync(fd, targetBuffer, targetOffset, length, sourceOffset); fs.closeSync(fd); }; DiskDataStore.writeEntry = function (key, data, cb){ var fileName = this._CACHE_PATH + '/' + key; fs.writeFile(fileName, data, cb); }; module.exports = DiskDataStore;
Remove the cache folder before initializing data cache.
Remove the cache folder before initializing data cache.
JavaScript
apache-2.0
weilonge/unidisk,weilonge/unidisk,weilonge/unidisk
--- +++ @@ -3,8 +3,24 @@ var DiskDataStore = {}; +var fs = require('fs'); +var deleteFolderRecursive = function(path) { + if( fs.existsSync(path) ) { + fs.readdirSync(path).forEach(function(file,index){ + var curPath = path + '/' + file; + if(fs.lstatSync(curPath).isDirectory()) { // recurse + deleteFolderRecursive(curPath); + } else { // delete file + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(path); + } +}; + DiskDataStore.init = function (){ this._CACHE_PATH = Settings.get('cache_path'); + deleteFolderRecursive(this._CACHE_PATH); fs.mkdirSync(this._CACHE_PATH); };
92d2afce8ed638f0b8673c52ce14af955423a25c
lib/router.js
lib/router.js
Router.configure({ layoutTemplate: 'layout', waitOn: function() { return Meteor.subscribe('projects'); } }); Router.route('/', { });
Router.configure({ layoutTemplate: 'layout' }); Router.route('/', { name: 'projectsList' });
Add routes for layout and projects list
Add routes for layout and projects list
JavaScript
mit
PUMATeam/puma,PUMATeam/puma
--- +++ @@ -1,10 +1,7 @@ Router.configure({ - layoutTemplate: 'layout', - waitOn: function() { - return Meteor.subscribe('projects'); - } + layoutTemplate: 'layout' }); Router.route('/', { - + name: 'projectsList' });
2d815e46d2cde87c660f38af6ec39843470359ed
grunt/mkdir.js
grunt/mkdir.js
module.exports = { mklibdir: { options: { mode: 0644, create: ['lib/fonts', 'lib/css', 'lib/font','lib/lang', 'dist', 'dist/font','dist/lang'] } } };
module.exports = { mklibdir: { options: { mode: 0755, create: ['lib/fonts', 'lib/css', 'lib/font','lib/lang', 'dist', 'dist/font','dist/lang'] } } };
Change folder access right to 0755
Change folder access right to 0755
JavaScript
mit
stevennick/videojs-ad-scheduler,stevennick/ott-ad-scheduler,stevennick/videojs-ad-scheduler,stevennick/ott-ad-scheduler
--- +++ @@ -2,7 +2,7 @@ mklibdir: { options: { - mode: 0644, + mode: 0755, create: ['lib/fonts', 'lib/css', 'lib/font','lib/lang', 'dist', 'dist/font','dist/lang'] } }
1135366b62530ffa4ecb8e2c9505f73d79e94d7a
gulp-config.js
gulp-config.js
module.exports = { folder: { tasks: 'tasks', src: 'src', build: 'assets', prod: 'production' }, task: { htmlHint: 'html-hint', jsHint: 'js-hint', buildCustomJs: 'build-custom-js', buildJsVendors: 'build-js-vendors', buildSass: 'build-sass', buildSassProd: 'build-sass-production', buildStylesVendors: 'build-styles-vendors', imageMin: 'image-min', imageClean: 'image-clean', cleanProd: 'clean-production', copyFonts: 'copy-fonts', browserSync: 'browser-sync-server', watch: 'watch', }, autoprefixer: { versions: 'last 4 versions' }, ignore: function() { return [ '!bower/', '!bower/**/*', '!node_modules/**/*', '!node_modules/', `!${this.folder.build}/css/**.map`, `!${this.folder.build}/images/info.txt`, '!.bowerrc', '!bower.json', '!.gitignore', '!gulpfile.js', '!LICENSE', '!package.json', `!${this.folder.prod}`, '!README.md', '!CONTRIBUTING.md', '!gulp-config.js', '!docs/', '!docs/**/*' ]; } };
module.exports = { folder: { tasks: 'tasks', src: 'src', build: 'assets', prod: 'production' }, task: { htmlHint: 'html-hint', jsHint: 'js-hint', buildCustomJs: 'build-custom-js', buildJsVendors: 'build-js-vendors', buildSass: 'build-sass', buildSassProd: 'build-sass-production', buildStylesVendors: 'build-styles-vendors', imageMin: 'image-min', imageClean: 'image-clean', cleanProd: 'clean-production', copyFonts: 'copy-fonts', browserSync: 'browser-sync-server', watch: 'watch', }, autoprefixer: { versions: 'last 4 versions' }, ignore: function() { return [ `!${this.folder.src}/`, `!${this.folder.src}/**/*`, '!bower/', '!bower/**/*', '!node_modules/**/*', '!node_modules/', `!${this.folder.build}/css/**.map`, `!${this.folder.build}/images/info.txt`, '!.bowerrc', '!bower.json', '!.gitignore', '!gulpfile.js', '!LICENSE', '!package.json', `!${this.folder.prod}`, '!README.md', '!CONTRIBUTING.md', '!gulp-config.js', '!docs/', '!docs/**/*', '!tasks/', '!tasks/**/*' ]; } };
Add more files to ignore for production task
Add more files to ignore for production task
JavaScript
mit
KirillPd/web-starter-kit,KirillPd/web-starter-kit,justcoded/web-starter-kit,vodnycheck/justcoded,justcoded/web-starter-kit,vodnycheck/justcoded
--- +++ @@ -25,6 +25,8 @@ }, ignore: function() { return [ + `!${this.folder.src}/`, + `!${this.folder.src}/**/*`, '!bower/', '!bower/**/*', '!node_modules/**/*', @@ -42,7 +44,9 @@ '!CONTRIBUTING.md', '!gulp-config.js', '!docs/', - '!docs/**/*' + '!docs/**/*', + '!tasks/', + '!tasks/**/*' ]; } };
3c85a294c6173604793faa68ed829a10122efc7d
examples/babel/webpack.config.js
examples/babel/webpack.config.js
// Note: this example requires babel-loader // npm install babel-loader var path = require('path'); module.exports = { context: __dirname, entry: './file-to-annotate', output: { path: __dirname + '/dist', filename: 'build.js' }, resolveLoader: { fallback: path.resolve(__dirname, '../../') }, module: { loaders: [ {test: /\.js$/, loaders: ['loader', 'babel']}, ] }, devtool: 'source-map' }
// Note: this example babel and equires babel-loader // npm install babel babel-loader var path = require('path'); module.exports = { context: __dirname, entry: './file-to-annotate', output: { path: __dirname + '/dist', filename: 'build.js' }, resolveLoader: { fallback: path.resolve(__dirname, '../../') }, module: { loaders: [ {test: /\.js$/, loaders: ['loader', 'babel']}, ] }, devtool: 'source-map' }
Update babel example to take peer dependency to babel into account.
Update babel example to take peer dependency to babel into account. Since npm 3 peer dependencies will not be installed automatically (which was the default in npm 2.x). For this reason, running npm install babel-loader in examples/babel will throw an error when running with npm 3. This change simply updates the comment in webpack config to reflect the need to install peer dependencies manually in npm 3.
JavaScript
mit
huston007/ng-annotate-loader,huston007/ng-annotate-loader
--- +++ @@ -1,5 +1,5 @@ -// Note: this example requires babel-loader -// npm install babel-loader +// Note: this example babel and equires babel-loader +// npm install babel babel-loader var path = require('path');
2f4d3ee03667fffb105fa2080abbcefe73a10e94
src/file_seacher.js
src/file_seacher.js
/* @flow */ import _ from 'lodash' import type { OrderedMap } from 'immutable'; import type MediaFile from './media_file'; export default class FileSeacher { files: OrderedMap<number, MediaFile>; constructor(files: OrderedMap<number, MediaFile>) { this.files = files; } search(searchKeyword: string): OrderedMap<number, MediaFile> { if (_.isEmpty(searchKeyword)) return this.files; const queries = searchKeyword.split(/ +/).map(word => word.split(":")); const result = _.reduce(queries, (files, q) => { if (q.length == 1) return files.filter(f => this.isIncludeProperty(f, "basename", q)); switch (q[0]) { case "basename": return files.filter(f => this.isIncludeProperty(f, "basename", q[1])); case "fullpath": return files.filter(f => this.isIncludeProperty(f, "fullpath", q[1])); case "is": return files.filter(f => this.predicateFile(f, q[1])); } }, this.files); return result; } isIncludeProperty(f: MediaFile, propertyName: string, value: string): boolean { return f[propertyName].includes(value); } predicateFile(f: MediaFile, predicate: string): boolean { return !!f[predicate]; } }
/* @flow */ import _ from 'lodash' import type { OrderedMap } from 'immutable'; import type MediaFile from './media_file'; export default class FileSeacher { files: OrderedMap<number, MediaFile>; constructor(files: OrderedMap<number, MediaFile>) { this.files = files; } search(searchKeyword: string): OrderedMap<number, MediaFile> { if (_.isEmpty(searchKeyword)) return this.files; const queries = searchKeyword.split(/ +/).map(word => word.split(":")); const result = _.reduce(queries, (files, q) => { if (q.length == 1) return files.filter(f => this.isIncludeProperty(f, "basename", q[0])); switch (q[0]) { case "basename": return files.filter(f => this.isIncludeProperty(f, "basename", q[1])); case "fullpath": return files.filter(f => this.isIncludeProperty(f, "fullpath", q[1])); case "is": return files.filter(f => this.predicateFile(f, q[1])); } }, this.files); return result; } isIncludeProperty(f: MediaFile, propertyName: string, value: string): boolean { if (value.toLowerCase() === value) { return f[propertyName].toLowerCase().includes(value); } else { return f[propertyName].includes(value); } } predicateFile(f: MediaFile, predicate: string): boolean { return !!f[predicate]; } }
Implement smartcase matching with search keyword
Implement smartcase matching with search keyword
JavaScript
mit
joker1007/blackalbum,joker1007/blackalbum
--- +++ @@ -18,7 +18,7 @@ const queries = searchKeyword.split(/ +/).map(word => word.split(":")); const result = _.reduce(queries, (files, q) => { if (q.length == 1) - return files.filter(f => this.isIncludeProperty(f, "basename", q)); + return files.filter(f => this.isIncludeProperty(f, "basename", q[0])); switch (q[0]) { case "basename": @@ -35,7 +35,11 @@ } isIncludeProperty(f: MediaFile, propertyName: string, value: string): boolean { - return f[propertyName].includes(value); + if (value.toLowerCase() === value) { + return f[propertyName].toLowerCase().includes(value); + } else { + return f[propertyName].includes(value); + } } predicateFile(f: MediaFile, predicate: string): boolean {
3c77d4e89dc8f097810ce84608b74ba158a8deb7
src/util/compose.js
src/util/compose.js
const compose = (...functions) => { return (...initial) => { let count = functions.length; return (function accum(arg) { return count ? (count--, accum(functions[count].call(functions[count], arg))) : arg; }).apply(functions[count - 1], initial); }; }; export default compose;
const compose = (...functions) => { return (...initial) => { let count = functions.length; return (function accumulator(arg) { return count ? (count--, accumulator(functions[count].call(functions[count], arg))) : arg; }).apply(functions[count - 1], initial); }; }; export default compose;
Refactor to use a consistent name across functions
Refactor to use a consistent name across functions
JavaScript
mit
restrung/restrung-js
--- +++ @@ -2,8 +2,8 @@ return (...initial) => { let count = functions.length; - return (function accum(arg) { - return count ? (count--, accum(functions[count].call(functions[count], arg))) : arg; + return (function accumulator(arg) { + return count ? (count--, accumulator(functions[count].call(functions[count], arg))) : arg; }).apply(functions[count - 1], initial); }; };
3625063c9b71d3d45bede0bd83af2152d83cd5ee
imports/ui/components/header/drawer-navigation.js
imports/ui/components/header/drawer-navigation.js
import React from 'react'; import Drawer from 'material-ui/Drawer'; import DrawerMenuItems from '../../containers/drawer-menu-items'; import * as ImagesHelper from '../../../util/images'; export default class DrawerNavigation extends React.Component { componentDidMount() { // iubenda Privacy Policy (function(w, d) { var loader = function() { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s, tag); }; if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; } })(window, document); } render() { return ( <Drawer docked={ false } width={ 250 } open={ this.props.isOpen } onRequestChange={ isOpen => this.props.setDrawerOpen(isOpen) }> <DrawerMenuItems closeDrawer={ this.props.closeDrawer } /> <div className="iubenda-button"> <a href="//www.iubenda.com/privacy-policy/7885534" className="iubenda-white iubenda-embed" title="Privacy Policy">Privacy Policy</a> </div> </Drawer> ); } }; DrawerNavigation.propTypes = { isOpen: React.PropTypes.bool.isRequired, closeDrawer: React.PropTypes.func, };
import React from 'react'; import Drawer from 'material-ui/Drawer'; import DrawerMenuItems from '../../containers/drawer-menu-items'; import * as ImagesHelper from '../../../util/images'; export default class DrawerNavigation extends React.Component { componentDidMount() { // iubenda Privacy Policy (function(w, d) { var loader = function() { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s, tag); }; if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; } })(window, document); } render() { return ( <Drawer docked={ false } width={ 250 } open={ this.props.isOpen } onRequestChange={ isOpen => this.props.setDrawerOpen(isOpen) } containerStyle={{'overflow': 'hidden'}}> <DrawerMenuItems closeDrawer={ this.props.closeDrawer } /> <div className="iubenda-button"> <a href="//www.iubenda.com/privacy-policy/7885534" className="iubenda-white iubenda-embed" title="Privacy Policy">Privacy Policy</a> </div> </Drawer> ); } }; DrawerNavigation.propTypes = { isOpen: React.PropTypes.bool.isRequired, closeDrawer: React.PropTypes.func, };
Set overflow:hidden to hide default windows scrollbars on drawer
Set overflow:hidden to hide default windows scrollbars on drawer
JavaScript
mit
irvinlim/free4all,irvinlim/free4all
--- +++ @@ -27,7 +27,7 @@ render() { return ( - <Drawer docked={ false } width={ 250 } open={ this.props.isOpen } onRequestChange={ isOpen => this.props.setDrawerOpen(isOpen) }> + <Drawer docked={ false } width={ 250 } open={ this.props.isOpen } onRequestChange={ isOpen => this.props.setDrawerOpen(isOpen) } containerStyle={{'overflow': 'hidden'}}> <DrawerMenuItems closeDrawer={ this.props.closeDrawer } /> <div className="iubenda-button">
184ffcd99116c9053e7956a3db5f5acc152fc971
js/src/forum/components/DiscussionsUserPage.js
js/src/forum/components/DiscussionsUserPage.js
import UserPage from './UserPage'; import DiscussionList from './DiscussionList'; /** * The `DiscussionsUserPage` component shows a discussion list inside of a user * page. */ export default class DiscussionsUserPage extends UserPage { init() { super.init(); this.loadUser(m.route.param('username')); } content() { return ( <div className="DiscussionsUserPage"> {DiscussionList.component({ params: { q: 'author:' + this.user.username() } })} </div> ); } }
import UserPage from './UserPage'; import DiscussionList from './DiscussionList'; /** * The `DiscussionsUserPage` component shows a discussion list inside of a user * page. */ export default class DiscussionsUserPage extends UserPage { init() { super.init(); this.loadUser(m.route.param('username')); } content() { return ( <div className="DiscussionsUserPage"> {DiscussionList.component({ params: { q: 'author:' + this.user.username(), sort: 'newest' } })} </div> ); } }
Sort user discussion list properly
Sort user discussion list properly
JavaScript
mit
datitisev/core,datitisev/core,flarum/core,malayladu/core,datitisev/core,flarum/core,datitisev/core,malayladu/core,malayladu/core,flarum/core,malayladu/core
--- +++ @@ -17,7 +17,8 @@ <div className="DiscussionsUserPage"> {DiscussionList.component({ params: { - q: 'author:' + this.user.username() + q: 'author:' + this.user.username(), + sort: 'newest' } })} </div>
c8e673124e479dfc25a8ae0992c1e449d1d1362d
plugins/embed/gui-themes/themes/zeit-amp.js
plugins/embed/gui-themes/themes/zeit-amp.js
define([ 'plugins/post-hash', 'plugins/status', 'plugins/predefined-types', 'theme/scripts/js/plugins/ampify', 'theme/scripts/js/plugins/button-pagination', 'theme/scripts/js/plugins/social-share', 'css!theme/liveblog', 'tmpl!theme/container', 'tmpl!theme/posts-list', 'tmpl!theme/item/base', // 'tmpl!theme/item/posttype/image', 'tmpl!theme/item/predefined/scorecard', 'tmpl!theme/item/source/flickr', 'tmpl!theme/item/source/google/images', 'tmpl!theme/item/source/google/news', 'tmpl!theme/item/source/google/web', 'tmpl!theme/item/source/instagram', 'tmpl!theme/item/source/twitter', 'tmpl!theme/item/source/youtube', 'tmpl!theme/plugins/after-button-pagination', 'tmpl!theme/plugins/before-button-pagination', 'tmpl!theme/plugins/social-share' ], function() { 'use strict'; liveblog.hashmark = '?'; liveblog.hashaddition = '#livedesk-root'; return { plugins: [ 'ampify', 'button-pagination', 'social-share', 'status' ] }; });
define([ 'plugins/post-hash', 'plugins/status', 'plugins/predefined-types', 'theme/scripts/js/plugins/ampify', 'theme/scripts/js/plugins/button-pagination', 'theme/scripts/js/plugins/social-share', // 'css!theme/liveblog', 'tmpl!theme/container', 'tmpl!theme/posts-list', 'tmpl!theme/item/base', // 'tmpl!theme/item/posttype/image', 'tmpl!theme/item/predefined/scorecard', 'tmpl!theme/item/source/flickr', 'tmpl!theme/item/source/google/images', 'tmpl!theme/item/source/google/news', 'tmpl!theme/item/source/google/web', 'tmpl!theme/item/source/instagram', 'tmpl!theme/item/source/twitter', 'tmpl!theme/item/source/youtube', 'tmpl!theme/plugins/after-button-pagination', 'tmpl!theme/plugins/before-button-pagination', 'tmpl!theme/plugins/social-share' ], function() { 'use strict'; liveblog.hashmark = '?'; liveblog.hashaddition = '#livedesk-root'; return { plugins: [ 'ampify', 'button-pagination', 'social-share', 'status' ] }; });
Disable CSS for ZEIT AMP theme
Disable CSS for ZEIT AMP theme
JavaScript
agpl-3.0
superdesk/Live-Blog,superdesk/Live-Blog,superdesk/Live-Blog,superdesk/Live-Blog
--- +++ @@ -5,7 +5,7 @@ 'theme/scripts/js/plugins/ampify', 'theme/scripts/js/plugins/button-pagination', 'theme/scripts/js/plugins/social-share', - 'css!theme/liveblog', + // 'css!theme/liveblog', 'tmpl!theme/container', 'tmpl!theme/posts-list', 'tmpl!theme/item/base',
dc6833e9115f7cb61de753b928781c30b2937958
source/assets/javascripts/all.js
source/assets/javascripts/all.js
document.addEventListener("DOMContentLoaded", function(){ var select = document.querySelector('.locales select'); select.addEventListener('change', function(event){ origin = window.location.origin; languageCode = event.currentTarget.selectedOptions[0].value window.location.replace(origin + "/" + languageCode) }); var faqHeaders = document.querySelectorAll('.frequently-asked-questions h4'); for (var i = 0; i < faqHeaders.length; ++i) { header = faqHeaders[i] header.addEventListener('click', toggleVisibility); } function toggleVisibility(event) { element = event.target; element.classList.toggle('is-visible') lastParagraph = element.nextElementSibling; paragraphs = []; paragraphs.push(lastParagraph); while (lastParagraph.nextElementSibling.tagName == "P") { lastParagraph = lastParagraph.nextElementSibling; paragraphs.push(lastParagraph) } for (var i = 0; i < paragraphs.length; ++i) { paragraph = paragraphs[i] paragraph.classList.toggle('is-visible'); } } });
document.addEventListener("DOMContentLoaded", function(){ var select = document.querySelector('.locales select'); select.addEventListener('change', function(event){ origin = window.location.origin; languageCode = event.currentTarget.selectedOptions[0].value window.location.replace(origin + "/" + languageCode) }); var faqHeaders = document.querySelectorAll('.frequently-asked-questions h4'); for (var i = 0; i < faqHeaders.length; ++i) { header = faqHeaders[i] header.addEventListener('click', toggleVisibility); } function toggleVisibility(event) { element = event.target; element.classList.toggle('is-visible') lastParagraph = element.nextElementSibling; paragraphs = []; paragraphs.push(lastParagraph); while (lastParagraph.nextElementSibling && lastParagraph.nextElementSibling.tagName == "P") { lastParagraph = lastParagraph.nextElementSibling; paragraphs.push(lastParagraph) } for (var i = 0; i < paragraphs.length; ++i) { paragraph = paragraphs[i] paragraph.classList.toggle('is-visible'); } } });
Fix JS bug in FAQ
Fix JS bug in FAQ
JavaScript
mit
olivierlacan/keep-a-changelog,olivierlacan/keep-a-changelog
--- +++ @@ -21,7 +21,7 @@ paragraphs = []; paragraphs.push(lastParagraph); - while (lastParagraph.nextElementSibling.tagName == "P") { + while (lastParagraph.nextElementSibling && lastParagraph.nextElementSibling.tagName == "P") { lastParagraph = lastParagraph.nextElementSibling; paragraphs.push(lastParagraph) }
316855e8230f114bdf409b59809c86bed2dd27bc
build/wrapper.template.js
build/wrapper.template.js
(function(){var g={}; (function(window){%output%}.bind(g,this))(); if (typeof(module)!="undefined"&&module.exports)module.exports=g.shaka; else if (typeof(define)!="undefined")define(function(){return g.shaka}); else this.shaka=g.shaka; })();
(function(){var g={}; (function(window){%output%}.bind(g,this))(); if (typeof(module)!="undefined"&&module.exports)module.exports=g.shaka; else if (typeof(define)!="undefined" && define.amd)define(function(){return g.shaka}); else this.shaka=g.shaka; })();
Check for define.amd along with typeof(define)
Check for define.amd along with typeof(define) To prevent crashing with other module loaders that support `define`, but are not full AMD module loaders, check for `define.amd` as well before defining the AMD module.
JavaScript
apache-2.0
brightcove/shaka-player,priyajeet/shaka-player,priyajeet/shaka-player,baconz/shaka-player,cmgrecu/shaka-player,sanbornhnewyyz/shaka-player,Afrostream/shaka-player,treejames/shaka-player,baconz/shaka-player,vimond/shaka-player,treejames/shaka-player,tvoli/shaka-player,ustudio/shaka-player,TheModMaker/shaka-player,samdutton/shaka-player,Afrostream/shaka-player,indiereign/shaka-player,shaka-project/shaka-player,cmgrecu/shaka-player,TheModMaker/shaka-player,samdutton/shaka-player,vimond/shaka-player,ustudio/shaka-player,samdutton/shaka-player,priyajeet/shaka-player,treejames/shaka-player,Ross-cz/shaka-player,shaka-project/shaka-player,TobbeEdgeware/shaka-player,shaka-project/shaka-player,russitto/shaka-player,blinkbox/shaka-player,Ross-cz/shaka-player,indiereign/shaka-player,russitto/shaka-player,sanbornhnewyyz/shaka-player,Afrostream/shaka-player,sanbornhnewyyz/shaka-player,indiereign/shaka-player,brightcove/shaka-player,Afrostream/shaka-player,samdutton/shaka-player,tvoli/shaka-player,TheModMaker/shaka-player,blinkbox/shaka-player,baconz/shaka-player,TheModMaker/shaka-player,priyajeet/shaka-player,brightcove/shaka-player,Ross-cz/shaka-player,treejames/shaka-player,ustudio/shaka-player,TobbeEdgeware/shaka-player,tvoli/shaka-player,sanbornhnewyyz/shaka-player,tvoli/shaka-player,vimond/shaka-player,shaka-project/shaka-player,TobbeEdgeware/shaka-player,ustudio/shaka-player,blinkbox/shaka-player,blinkbox/shaka-player,russitto/shaka-player,cmgrecu/shaka-player
--- +++ @@ -1,6 +1,6 @@ (function(){var g={}; (function(window){%output%}.bind(g,this))(); if (typeof(module)!="undefined"&&module.exports)module.exports=g.shaka; -else if (typeof(define)!="undefined")define(function(){return g.shaka}); +else if (typeof(define)!="undefined" && define.amd)define(function(){return g.shaka}); else this.shaka=g.shaka; })();
cea824e63e4db6953c05ac67a1c9923f1f48abfc
test/129026_cog_sog_rapid_update.js
test/129026_cog_sog_rapid_update.js
var chai = require("chai"); chai.Should(); chai.use(require('chai-things')); describe('129026 COG & SOG, Rapid Update', function () { it('complete sentence converts', function () { var tree = require("../n2kMapper.js").toNested( JSON.parse('{"timestamp":"2014-08-15-18:00:10.005","prio":"2","src":"160","dst":"255","pgn":"129026","description":"COG & SOG, Rapid Update","fields":{"COG Reference":"True","COG":"206.1","SOG":"3.65"}}')); tree.should.have.deep.property('navigation.courseOverGroundTrue'); tree.should.have.deep.property('navigation.courseOverGroundTrue.value', 206.1); tree.should.have.deep.property('navigation.speedOverGround'); tree.should.have.deep.property('navigation.speedOverGround.value', 3.65); }); });
var chai = require("chai"); chai.Should(); chai.use(require('chai-things')); chai.use(require('signalk-schema').chaiModule); describe('129026 COG & SOG, Rapid Update', function () { it('complete sentence converts', function () { var tree = require("../n2kMapper.js").toNested( JSON.parse('{"timestamp":"2014-08-15-18:00:10.005","prio":"2","src":"160","dst":"255","pgn":"129026","description":"COG & SOG, Rapid Update","fields":{"COG Reference":"True","COG":"206.1","SOG":"3.65"}}')); tree.should.have.deep.property('navigation.courseOverGroundTrue'); tree.should.have.deep.property('navigation.courseOverGroundTrue.value', 206.1); tree.should.have.deep.property('navigation.speedOverGround'); tree.should.have.deep.property('navigation.speedOverGround.value', 3.65); tree.should.be.validSignalK; }); });
Fix 129026 COG & SOG
Fix 129026 COG & SOG
JavaScript
apache-2.0
SignalK/n2k-signalk
--- +++ @@ -1,6 +1,8 @@ var chai = require("chai"); chai.Should(); chai.use(require('chai-things')); +chai.use(require('signalk-schema').chaiModule); + describe('129026 COG & SOG, Rapid Update', function () { @@ -11,6 +13,7 @@ tree.should.have.deep.property('navigation.courseOverGroundTrue.value', 206.1); tree.should.have.deep.property('navigation.speedOverGround'); tree.should.have.deep.property('navigation.speedOverGround.value', 3.65); + tree.should.be.validSignalK; }); });
7624bbab290982806204b03df05d23e8932a11a7
test/feature/Scope/BlockBinding6.js
test/feature/Scope/BlockBinding6.js
function testBlock() { // Test function expressions. { var x = function g() { return 'g'; } || function h() { return 'h'; }; return x; } } // ---------------------------------------------------------------------------- var result = testBlock(); assertEquals('g', result()); assertEquals('g', result.name);
function testBlock() { // Test function expressions. { var x = function g() { return 'g'; } || function h() { return 'h'; }; return x; } } // ---------------------------------------------------------------------------- var result = testBlock(); assertEquals('g', result());
Remove test that tests function instance name since that is non standard
Remove test that tests function instance name since that is non standard
JavaScript
apache-2.0
ide/traceur,ide/traceur,ide/traceur
--- +++ @@ -10,4 +10,3 @@ var result = testBlock(); assertEquals('g', result()); -assertEquals('g', result.name);
49253300460d315b475feca48a0727ad50d6dd13
test/monkeyPatchSinonStackFrames.js
test/monkeyPatchSinonStackFrames.js
// Monkey-patch sinon.create to patch all created spyCall instances // so that the top stack frame is a predictable string. // Prevents every test from failing when the test suite is updated. module.exports = function (sinon) { // Copied from test/monkeyPatchSinonStackFrames.js function patchCall(call) { var getStackFrames = call && call.getStackFrames; if (getStackFrames) { call.getStackFrames = function () { return ['at theFunction (theFileName:xx:yy)']; }; } return call; } ['spy', 'stub'].forEach(function (name) { var orig = sinon[name]; sinon[name] = function () { var result = orig.apply(this, arguments); var getCall = result.getCall; result.getCall = function () { return patchCall(getCall.apply(result, arguments)); }; var getCalls = result.getCalls; result.getCalls = function () { return getCalls.call(result).map(patchCall); }; return result; }; sinon[name].create = orig.create; }); };
// Monkey-patch sinon.create to patch all created spyCall instances // so that the top stack frame is a predictable string. // Prevents every test from failing when the test suite is updated. module.exports = function (sinon) { function isSpy(value) { return value && typeof value.id === 'string' && /^spy#/.test(value.id); } function patchCall(call) { var getStackFrames = call && call.getStackFrames; if (getStackFrames) { call.getStackFrames = function () { return ['at theFunction (theFileName:xx:yy)']; }; } return call; } function patchSpy(spy) { var getCall = spy.getCall; spy.getCall = function () { return patchCall(getCall.apply(spy, arguments)); }; var getCalls = spy.getCalls; spy.getCalls = function () { return getCalls.call(spy).map(patchCall); }; } ['spy', 'stub'].forEach(function (name) { var orig = sinon[name]; sinon[name] = function () { var result = orig.apply(this, arguments); if (isSpy(result)) { patchSpy(result); } return result; }; sinon[name].create = orig.create; }); };
Test suite: Fix overeager monkey-patching of the sinon.stub return value that made sinon.createStubInstance() return an object with getCall and getCalls methods.
Test suite: Fix overeager monkey-patching of the sinon.stub return value that made sinon.createStubInstance() return an object with getCall and getCalls methods.
JavaScript
mit
unexpectedjs/unexpected-sinon,unexpectedjs/unexpected-sinon
--- +++ @@ -2,7 +2,11 @@ // so that the top stack frame is a predictable string. // Prevents every test from failing when the test suite is updated. module.exports = function (sinon) { - // Copied from test/monkeyPatchSinonStackFrames.js + function isSpy(value) { + return value && typeof value.id === 'string' && + /^spy#/.test(value.id); + } + function patchCall(call) { var getStackFrames = call && call.getStackFrames; if (getStackFrames) { @@ -13,18 +17,25 @@ return call; } + function patchSpy(spy) { + var getCall = spy.getCall; + spy.getCall = function () { + return patchCall(getCall.apply(spy, arguments)); + }; + var getCalls = spy.getCalls; + spy.getCalls = function () { + return getCalls.call(spy).map(patchCall); + }; + } + + ['spy', 'stub'].forEach(function (name) { var orig = sinon[name]; sinon[name] = function () { var result = orig.apply(this, arguments); - var getCall = result.getCall; - result.getCall = function () { - return patchCall(getCall.apply(result, arguments)); - }; - var getCalls = result.getCalls; - result.getCalls = function () { - return getCalls.call(result).map(patchCall); - }; + if (isSpy(result)) { + patchSpy(result); + } return result; }; sinon[name].create = orig.create;
84945daecb84911f27dbe4c6911f4cba4c994e78
test/specs/simulation.drone.spec.js
test/specs/simulation.drone.spec.js
const { generateRandom } = require('../../server/simulation/drone'); describe('generateRandom()', () => { const sampleArguments = {coords: {lat: 1, long: 1}, distance: 1000 }; test('returns an object', () => { expect( typeof generateRandom(sampleArguments) ).toBe('object'); }); test('returns an object with an id', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('id'); }); test('returns an object with a model', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('model'); }); test('returns an object with an icon property', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('icon'); }); test('returns an object with coords', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('coords'); }); test('returns an object with a rating attribute', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('rating'); }); test('returns an object with a missions_completed_7_days attribute', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('missions_completed_7_days'); }); });
const { generateRandom } = require('../../server/simulation/drone'); describe('generateRandom()', () => { const sampleArguments = {coords: {lat: 1, long: 1}, distance: 1000 }; test('returns an object', () => { expect( typeof generateRandom(sampleArguments) ).toBe('object'); }); test('returns an object with an id', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('id'); }); test('returns an object with a model', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('model'); }); test('returns an object with an icon property', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('icon'); }); test('returns an object with coords', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('coords'); }); test('returns an object with a rating attribute', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('rating'); }); test('returns an object with a missions_completed attribute', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('missions_completed'); }); test('returns an object with a missions_completed_7_days attribute', () => { expect( generateRandom(sampleArguments) ).toHaveProperty('missions_completed_7_days'); }); });
Add tests to check missions_completed attribute in random drone generator
Add tests to check missions_completed attribute in random drone generator
JavaScript
mit
DAVFoundation/missioncontrol,DAVFoundation/missioncontrol,DAVFoundation/missioncontrol
--- +++ @@ -40,6 +40,12 @@ ).toHaveProperty('rating'); }); + test('returns an object with a missions_completed attribute', () => { + expect( + generateRandom(sampleArguments) + ).toHaveProperty('missions_completed'); + }); + test('returns an object with a missions_completed_7_days attribute', () => { expect( generateRandom(sampleArguments)
7c2213c67cbc670a7a4aecd5dbdab47013dca4ed
test/testServer.js
test/testServer.js
/** * Created by Omnius on 18/07/2016. */ 'use strict'; const Hapi = require('hapi'); const HapiAuthBasic = require('hapi-auth-basic'); const HapiAuthHawk = require('hapi-auth-hawk'); const Inert = require('inert'); module.exports = function () { const server = new Hapi.Server(); server.connection({ host: '127.0.0.1', port: '9001' }); server.state('Hawk-Session-Token', { ttl: 24 * 60 * 60 * 1000, path: '/', isSecure: false, isHttpOnly: false, encoding: 'base64json', clearInvalid: true }); server.register([ Inert, HapiAuthBasic, HapiAuthHawk ], (err) => { if (err) { throw err; } }); return server; };
/** * Created by Omnius on 18/07/2016. */ 'use strict'; const Hapi = require('hapi'); const HapiAuthBasic = require('hapi-auth-basic'); const HapiAuthHawk = require('hapi-auth-hawk'); const Inert = require('inert'); const Handlebars = require('handlebars'); const Vision = require('vision'); const Visionary = require('visionary'); module.exports = function () { const server = new Hapi.Server(); server.connection({ host: '127.0.0.1', port: '9001' }); server.state('Hawk-Session-Token', { ttl: 24 * 60 * 60 * 1000, path: '/', isSecure: false, isHttpOnly: false, encoding: 'base64json', clearInvalid: true }); server.register([ HapiAuthBasic, HapiAuthHawk, Inert, Vision, Visionary ], (err) => { if (err) { throw err; } }); server.views({ path: 'views/layouts', partialsPath: 'views/layouts/partials', engines: {mustache: Handlebars} }); return server; };
Add view manager on test server
Add view manager on test server
JavaScript
mit
identityclash/hapi-login-test,identityclash/hapi-login-test
--- +++ @@ -7,6 +7,9 @@ const HapiAuthBasic = require('hapi-auth-basic'); const HapiAuthHawk = require('hapi-auth-hawk'); const Inert = require('inert'); +const Handlebars = require('handlebars'); +const Vision = require('vision'); +const Visionary = require('visionary'); module.exports = function () { @@ -28,9 +31,11 @@ }); server.register([ + HapiAuthBasic, + HapiAuthHawk, Inert, - HapiAuthBasic, - HapiAuthHawk + Vision, + Visionary ], (err) => { if (err) { @@ -38,5 +43,11 @@ } }); + server.views({ + path: 'views/layouts', + partialsPath: 'views/layouts/partials', + engines: {mustache: Handlebars} + }); + return server; };
a11e9cbf5006c81826fdc1d8a79680c3b5097f2e
tests/view.spec.js
tests/view.spec.js
// http://mochajs.org/ // @see http://chaijs.com/api/bdd/ describe('View', function() { var App; var View; var testView; beforeEach(function() { App = window.App; View = App.View; }); afterEach(function() { testView = undefined; App = null; View = null; }); it('should set template', function() { testView = new View('<div><%= name %></div>'); expect(typeof testView.template).to.equal('function'); }); it('should render simple template', function() { testView = new View('<div><%= name %></div>'); var testData = { name: 'test' }; var result = testView.render(testData); var reference = '<div>test</div>'; expect(result).to.equal(reference); }); });
// http://mochajs.org/ // @see http://chaijs.com/api/bdd/ describe('View', function() { var App; var View; var testView; beforeEach(function() { App = window.App; View = App.View; }); afterEach(function() { testView = undefined; App = null; View = null; }); it('should set template', function() { testView = new View('<div><%= name %></div>'); expect(typeof testView.template).to.equal('function'); }); it('should render simple template', function() { testView = new View('<div><%= name %></div>'); var testData = { name: 'test' }; var result = testView.render(testData); var reference = '<div>test</div>'; expect(result).to.equal(reference); }); it('should set tempalte (with JS code) ', function () { testView = new View ('<div><% dataItems.forEach(function(item) { %> <%= item %> <% }); %> <div>'); var testData = {dataItems: [{ item: 'testItem0'}, { item: 'testItem1'}]}; var result = testView.render(testData); var reference = '<div>testItem0<div><div>testItem1<div>'; expect(result).to.equal(reference); }); });
Add render template with js instructions
Add render template with js instructions
JavaScript
mit
easy-deep-learning/mvc-pure-js,easy-deep-learning/mvc-pure-js
--- +++ @@ -24,6 +24,7 @@ expect(typeof testView.template).to.equal('function'); }); + it('should render simple template', function() { testView = new View('<div><%= name %></div>'); @@ -34,4 +35,17 @@ expect(result).to.equal(reference); }); + + it('should set tempalte (with JS code) ', function () { + + testView = new View ('<div><% dataItems.forEach(function(item) { %> <%= item %> <% }); %> <div>'); + + var testData = {dataItems: [{ item: 'testItem0'}, { item: 'testItem1'}]}; + var result = testView.render(testData); + var reference = '<div>testItem0<div><div>testItem1<div>'; + + expect(result).to.equal(reference); + + }); + });
0e5134d71da887d125b228ee773a47935b528c8a
config/adapters.js
config/adapters.js
/** * Global adapter config * * The `adapters` configuration object lets you create different global "saved settings" * that you can mix and match in your models. The `default` option indicates which * "saved setting" should be used if a model doesn't have an adapter specified. * * Keep in mind that options you define directly in your model definitions * will override these settings. * * For more information on adapter configuration, check out: * http://sailsjs.org/#documentation */ module.exports.adapters = { // If you leave the adapter config unspecified // in a model definition, 'default' will be used. 'default': 'disk', // Persistent adapter for DEVELOPMENT ONLY // (data is preserved when the server shuts down) disk: { module: 'sails-disk' }, // MySQL is the world's most popular relational database. // Learn more: http://en.wikipedia.org/wiki/MySQL myLocalMySQLDatabase: { module: 'sails-mysql', host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', user: 'YOUR_MYSQL_USER', // Psst.. You can put your password in config/local.js instead // so you don't inadvertently push it up if you're using version control password: 'YOUR_MYSQL_PASSWORD', database: 'YOUR_MYSQL_DB' }, postgres: { config: { url: 'postgres://username:password@hostname:port/database', pool: false, ssl: false } } };
/** * Global adapter config * * The `adapters` configuration object lets you create different global "saved settings" * that you can mix and match in your models. The `default` option indicates which * "saved setting" should be used if a model doesn't have an adapter specified. * * Keep in mind that options you define directly in your model definitions * will override these settings. * * For more information on adapter configuration, check out: * http://sailsjs.org/#documentation */ var secrets = require('../secrets'); module.exports.adapters = { // If you leave the adapter config unspecified // in a model definition, 'default' will be used. 'default': 'postgres', // Persistent adapter for DEVELOPMENT ONLY // (data is preserved when the server shuts down) disk: { module: 'sails-disk' }, // MySQL is the world's most popular relational database. // Learn more: http://en.wikipedia.org/wiki/MySQL myLocalMySQLDatabase: { module: 'sails-mysql', host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', user: 'YOUR_MYSQL_USER', // Psst.. You can put your password in config/local.js instead // so you don't inadvertently push it up if you're using version control password: 'YOUR_MYSQL_PASSWORD', database: 'YOUR_MYSQL_DB' }, postgres: { module: 'sails-postgresql', url: secrets.postgresUrl(), pool: false, ssl: false } };
Change db config to use postgres. Use secret config file to load connection settings.
Change db config to use postgres. Use secret config file to load connection settings.
JavaScript
mit
thomaslangston/sailsnode
--- +++ @@ -12,11 +12,13 @@ * http://sailsjs.org/#documentation */ +var secrets = require('../secrets'); + module.exports.adapters = { // If you leave the adapter config unspecified // in a model definition, 'default' will be used. - 'default': 'disk', + 'default': 'postgres', // Persistent adapter for DEVELOPMENT ONLY // (data is preserved when the server shuts down) @@ -38,10 +40,9 @@ }, postgres: { - config: { - url: 'postgres://username:password@hostname:port/database', - pool: false, - ssl: false - } + module: 'sails-postgresql', + url: secrets.postgresUrl(), + pool: false, + ssl: false } };
62e63833c58b5ac8068199bb34897569654448e2
reviewboard/static/rb/js/utils/consoleUtils.js
reviewboard/static/rb/js/utils/consoleUtils.js
var _origAssert = console.assert; if (typeof window.console === 'undefined') { window.console = {}; } if (typeof console.log === 'undefined') { console.log = function() {} } /* * console.assert may not behave as we'd hope on all implementations. * On Chrome, for instance, it doesn't raise an exception. So, fall back * to raising one. */ console.assert = function(conditional, msg) { if (_origAssert && _origAssert.call) { _origAssert.call(console, conditional, msg); } /* If the above assert never raised an exception, raise our own. */ if (!conditional) { throw Error(msg); } } if (typeof console.assert === 'undefined') { console.log = function() {} }
var _origAssert; if (typeof window.console === 'undefined') { window.console = {}; } _origAssert = console.assert; if (typeof console.log === 'undefined') { console.log = function() {} } /* * console.assert may not behave as we'd hope on all implementations. * On Chrome, for instance, it doesn't raise an exception. So, fall back * to raising one. */ console.assert = function(conditional, msg) { if (_origAssert && _origAssert.call) { _origAssert.call(console, conditional, msg); } /* If the above assert never raised an exception, raise our own. */ if (!conditional) { throw Error(msg); } }
Fix the console fallbacks to not break older browsers.
Fix the console fallbacks to not break older browsers. The console fallbacks were designed to work if no console API was defined, but it still ended up accessing stuff inside of console. It also had some unused code at the end. This has been fixed and should restore compatibility with Firefox 3.x and IE. Fixes bug #2880
JavaScript
mit
custode/reviewboard,chipx86/reviewboard,sgallagher/reviewboard,davidt/reviewboard,custode/reviewboard,davidt/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard,1tush/reviewboard,beol/reviewboard,1tush/reviewboard,brennie/reviewboard,beol/reviewboard,custode/reviewboard,beol/reviewboard,custode/reviewboard,chipx86/reviewboard,KnowNo/reviewboard,1tush/reviewboard,KnowNo/reviewboard,brennie/reviewboard,sgallagher/reviewboard,1tush/reviewboard,sgallagher/reviewboard,sgallagher/reviewboard,brennie/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,1tush/reviewboard,1tush/reviewboard,1tush/reviewboard,brennie/reviewboard,bkochendorfer/reviewboard,KnowNo/reviewboard,KnowNo/reviewboard,1tush/reviewboard,bkochendorfer/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,bkochendorfer/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,davidt/reviewboard,beol/reviewboard,1tush/reviewboard
--- +++ @@ -1,9 +1,10 @@ -var _origAssert = console.assert; - +var _origAssert; if (typeof window.console === 'undefined') { window.console = {}; } + +_origAssert = console.assert; if (typeof console.log === 'undefined') { console.log = function() {} @@ -24,7 +25,3 @@ throw Error(msg); } } - -if (typeof console.assert === 'undefined') { - console.log = function() {} -}
d7253c7ddde991aa57eb607e8888758ff6fc27b8
client/views/home/home.js
client/views/home/home.js
Template.home.rendered = function () { initInfiniteScroll.call(this, 'topics'); }; Template.home.destroyed = function () { stopInfiniteScroll.call(this); }; Template.home.helpers({ topics: function() { return Topics.find(); }, moreTopics: function () { return Topics.find().count() > Session.get('topicsLimit'); } });
Template.home.rendered = function () { initInfiniteScroll.call(this, 'topics'); }; Template.home.destroyed = function () { stopInfiniteScroll.call(this); }; Template.home.helpers({ topics: function() { return Topics.find(); }, moreTopics: function () { return Topics.find().count() === Session.get('itemsLimit'); } });
Fix infinite scroll loading helper
Fix infinite scroll loading helper
JavaScript
mit
erasaur/binary,erasaur/binary,erasaur/binary
--- +++ @@ -11,6 +11,6 @@ return Topics.find(); }, moreTopics: function () { - return Topics.find().count() > Session.get('topicsLimit'); + return Topics.find().count() === Session.get('itemsLimit'); } });
f3c665de8dc05b474e8b7ec993b1354cf028505c
src/filters.js
src/filters.js
(function() { 'use strict'; var app = angular.module('bonito-filters', []); /** * Print large number using prefixes (k, M, G, etc.) to * keep their size short and to be friendlier to the poor non-robots. * Adapted from: https://gist.github.com/thomseddon/3511330 */ app.filter('humanNumber', function() { return function(input, precision) { input = parseFloat(input); if (isNaN(input) || !isFinite(input)) { return '-'; } var negativeSign = ''; if (input < 0) { input = -input; negativeSign = '-'; } if (typeof precision === 'undefined') { precision = 1; } var units = ['', 'k', 'M', 'G', 'T', 'P'], number = Math.floor(Math.log(input) / Math.log(1000)); return negativeSign + (input / Math.pow(1000, number)).toFixed(precision) + units[number]; }; }); })();
(function() { 'use strict'; var app = angular.module('bonito-filters', []); /** * Print large number using prefixes (k, M, G, etc.) to * keep their size short and to be friendlier to the poor non-robots. * Adapted from: https://gist.github.com/thomseddon/3511330 */ app.filter('humanNumber', function() { return function(input, precision) { input = parseFloat(input); if (isNaN(input) || !isFinite(input)) { return '-'; } if (input === 0) { return '0'; } var negativeSign = ''; if (input < 0) { input = -input; negativeSign = '-'; } if (typeof precision === 'undefined') { precision = 1; } var units = ['', 'k', 'M', 'G', 'T', 'P'], number = Math.floor(Math.log(input) / Math.log(1000)); return negativeSign + (input / Math.pow(1000, number)).toFixed(precision) + units[number]; }; }); })();
Fix NaN when input is 0
Fix NaN when input is 0
JavaScript
apache-2.0
tsg/bonito,tsg/bonito
--- +++ @@ -14,6 +14,9 @@ if (isNaN(input) || !isFinite(input)) { return '-'; } + if (input === 0) { + return '0'; + } var negativeSign = ''; if (input < 0) { input = -input;
2075a9bb23763def637f025c551e7cb1044312a8
config/mongoose.js
config/mongoose.js
const config = require('config'); const mongooseOptions = { useNewUrlParser: true, useFindAndModify: false, useCreateIndex: true, useUnifiedTopology: true, readPreference: 'secondaryPreferred', // Has MongoDB prefer secondary servers for read operations. appname: 'subscriptions', // Displays the app name in MongoDB logs, for ease of debug serverSelectionTimeoutMS: 10000, // Number of miliseconds the underlying MongoDB driver has to pick a server loggerLevel: config.get('logger.level') // Logger level to pass to the MongoDB driver }; module.exports = mongooseOptions;
const config = require('config'); const mongooseOptions = { useNewUrlParser: true, useFindAndModify: false, useCreateIndex: true, useUnifiedTopology: false, readPreference: 'secondaryPreferred', // Has MongoDB prefer secondary servers for read operations. appname: 'subscriptions', // Displays the app name in MongoDB logs, for ease of debug serverSelectionTimeoutMS: 10000, // Number of miliseconds the underlying MongoDB driver has to pick a server loggerLevel: config.get('logger.level') // Logger level to pass to the MongoDB driver }; module.exports = mongooseOptions;
Disable mongo unified topology, see what happens...
Disable mongo unified topology, see what happens...
JavaScript
mit
gfw-api/gfw-subscription-api,gfw-api/gfw-subscription-api,gfw-api/gfw-subscription-api
--- +++ @@ -4,7 +4,7 @@ useNewUrlParser: true, useFindAndModify: false, useCreateIndex: true, - useUnifiedTopology: true, + useUnifiedTopology: false, readPreference: 'secondaryPreferred', // Has MongoDB prefer secondary servers for read operations. appname: 'subscriptions', // Displays the app name in MongoDB logs, for ease of debug serverSelectionTimeoutMS: 10000, // Number of miliseconds the underlying MongoDB driver has to pick a server
59040c2d68bae66da58e4abe8c54ab0ec9142823
website/addons/googledrive/static/node-cfg.js
website/addons/googledrive/static/node-cfg.js
'use strict'; var ko = require('knockout'); var AddonNodeConfig = require('js/addonNodeConfig').AddonNodeConfig; var url = window.contextVars.node.urls.api + 'googledrive/config/'; new AddonNodeConfig('Google Drive', '#googledriveScope', url, '#googledriveGrid', { decodeFolder: (function(folder_name) { return decodeURIComponent(folder_name); }) } );
'use strict'; var AddonNodeConfig = require('js/addonNodeConfig').AddonNodeConfig; var url = window.contextVars.node.urls.api + 'googledrive/config/'; new AddonNodeConfig('Google Drive', '#googledriveScope', url, '#googledriveGrid', { decodeFolder: (function(folder_name) { return decodeURIComponent(folder_name); }) } );
Remove knockout requirement, as it is not used by the custom functions
Remove knockout requirement, as it is not used by the custom functions
JavaScript
apache-2.0
dplorimer/osf,laurenrevere/osf.io,njantrania/osf.io,hmoco/osf.io,Johnetordoff/osf.io,icereval/osf.io,barbour-em/osf.io,jolene-esposito/osf.io,caneruguz/osf.io,mattclark/osf.io,binoculars/osf.io,fabianvf/osf.io,KAsante95/osf.io,caneruguz/osf.io,HalcyonChimera/osf.io,caneruguz/osf.io,asanfilippo7/osf.io,CenterForOpenScience/osf.io,acshi/osf.io,jmcarp/osf.io,haoyuchen1992/osf.io,alexschiller/osf.io,HarryRybacki/osf.io,mluo613/osf.io,jnayak1/osf.io,emetsger/osf.io,arpitar/osf.io,reinaH/osf.io,chrisseto/osf.io,felliott/osf.io,cldershem/osf.io,mluo613/osf.io,GageGaskins/osf.io,emetsger/osf.io,jmcarp/osf.io,jinluyuan/osf.io,chennan47/osf.io,kch8qx/osf.io,petermalcolm/osf.io,cosenal/osf.io,HalcyonChimera/osf.io,ticklemepierce/osf.io,DanielSBrown/osf.io,samanehsan/osf.io,dplorimer/osf,ZobairAlijan/osf.io,ticklemepierce/osf.io,amyshi188/osf.io,CenterForOpenScience/osf.io,sbt9uc/osf.io,monikagrabowska/osf.io,jmcarp/osf.io,sbt9uc/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,chrisseto/osf.io,jnayak1/osf.io,mluke93/osf.io,HarryRybacki/osf.io,jnayak1/osf.io,lyndsysimon/osf.io,caseyrygt/osf.io,ckc6cz/osf.io,caseyrygt/osf.io,crcresearch/osf.io,ticklemepierce/osf.io,Johnetordoff/osf.io,billyhunt/osf.io,amyshi188/osf.io,caseyrollins/osf.io,mluo613/osf.io,fabianvf/osf.io,caseyrollins/osf.io,cldershem/osf.io,adlius/osf.io,wearpants/osf.io,njantrania/osf.io,zamattiac/osf.io,icereval/osf.io,jeffreyliu3230/osf.io,brandonPurvis/osf.io,aaxelb/osf.io,RomanZWang/osf.io,brianjgeiger/osf.io,chennan47/osf.io,kwierman/osf.io,arpitar/osf.io,haoyuchen1992/osf.io,jinluyuan/osf.io,SSJohns/osf.io,ckc6cz/osf.io,KAsante95/osf.io,brandonPurvis/osf.io,GageGaskins/osf.io,mluke93/osf.io,doublebits/osf.io,felliott/osf.io,rdhyee/osf.io,HarryRybacki/osf.io,bdyetton/prettychart,cosenal/osf.io,cldershem/osf.io,erinspace/osf.io,asanfilippo7/osf.io,kwierman/osf.io,samanehsan/osf.io,caseyrygt/osf.io,petermalcolm/osf.io,jeffreyliu3230/osf.io,binoculars/osf.io,rdhyee/osf.io,cwisecarver/osf.io,erinspace/osf.io,DanielSBrown/osf.io,danielneis/osf.io,ckc6cz/osf.io,dplorimer/osf,wearpants/osf.io,MerlinZhang/osf.io,brianjgeiger/osf.io,samchrisinger/osf.io,crcresearch/osf.io,cslzchen/osf.io,laurenrevere/osf.io,HarryRybacki/osf.io,caseyrollins/osf.io,MerlinZhang/osf.io,CenterForOpenScience/osf.io,monikagrabowska/osf.io,chrisseto/osf.io,baylee-d/osf.io,doublebits/osf.io,doublebits/osf.io,abought/osf.io,haoyuchen1992/osf.io,doublebits/osf.io,zachjanicki/osf.io,chennan47/osf.io,hmoco/osf.io,samanehsan/osf.io,kch8qx/osf.io,abought/osf.io,arpitar/osf.io,fabianvf/osf.io,alexschiller/osf.io,sbt9uc/osf.io,mluo613/osf.io,kch8qx/osf.io,erinspace/osf.io,monikagrabowska/osf.io,Nesiehr/osf.io,pattisdr/osf.io,Ghalko/osf.io,Nesiehr/osf.io,leb2dg/osf.io,brianjgeiger/osf.io,kwierman/osf.io,jinluyuan/osf.io,TomHeatwole/osf.io,arpitar/osf.io,brandonPurvis/osf.io,Ghalko/osf.io,billyhunt/osf.io,DanielSBrown/osf.io,binoculars/osf.io,lyndsysimon/osf.io,GageGaskins/osf.io,danielneis/osf.io,adlius/osf.io,samchrisinger/osf.io,reinaH/osf.io,Ghalko/osf.io,SSJohns/osf.io,adlius/osf.io,MerlinZhang/osf.io,leb2dg/osf.io,doublebits/osf.io,dplorimer/osf,zamattiac/osf.io,aaxelb/osf.io,mfraezz/osf.io,billyhunt/osf.io,abought/osf.io,monikagrabowska/osf.io,zachjanicki/osf.io,RomanZWang/osf.io,adlius/osf.io,TomHeatwole/osf.io,samchrisinger/osf.io,petermalcolm/osf.io,sloria/osf.io,caseyrygt/osf.io,lyndsysimon/osf.io,zamattiac/osf.io,emetsger/osf.io,mfraezz/osf.io,asanfilippo7/osf.io,RomanZWang/osf.io,brandonPurvis/osf.io,cslzchen/osf.io,zachjanicki/osf.io,cslzchen/osf.io,barbour-em/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,sloria/osf.io,bdyetton/prettychart,Nesiehr/osf.io,SSJohns/osf.io,crcresearch/osf.io,HalcyonChimera/osf.io,jolene-esposito/osf.io,TomHeatwole/osf.io,ZobairAlijan/osf.io,lyndsysimon/osf.io,petermalcolm/osf.io,leb2dg/osf.io,samanehsan/osf.io,abought/osf.io,aaxelb/osf.io,mfraezz/osf.io,reinaH/osf.io,kch8qx/osf.io,acshi/osf.io,ZobairAlijan/osf.io,ZobairAlijan/osf.io,billyhunt/osf.io,jinluyuan/osf.io,asanfilippo7/osf.io,hmoco/osf.io,mattclark/osf.io,aaxelb/osf.io,kch8qx/osf.io,barbour-em/osf.io,alexschiller/osf.io,RomanZWang/osf.io,RomanZWang/osf.io,Ghalko/osf.io,pattisdr/osf.io,ticklemepierce/osf.io,MerlinZhang/osf.io,TomHeatwole/osf.io,saradbowman/osf.io,njantrania/osf.io,jolene-esposito/osf.io,mluke93/osf.io,cslzchen/osf.io,barbour-em/osf.io,kwierman/osf.io,DanielSBrown/osf.io,KAsante95/osf.io,baylee-d/osf.io,cldershem/osf.io,jolene-esposito/osf.io,zachjanicki/osf.io,wearpants/osf.io,cosenal/osf.io,acshi/osf.io,TomBaxter/osf.io,jmcarp/osf.io,chrisseto/osf.io,amyshi188/osf.io,bdyetton/prettychart,ckc6cz/osf.io,rdhyee/osf.io,monikagrabowska/osf.io,mluke93/osf.io,cwisecarver/osf.io,rdhyee/osf.io,icereval/osf.io,felliott/osf.io,njantrania/osf.io,wearpants/osf.io,emetsger/osf.io,pattisdr/osf.io,KAsante95/osf.io,GageGaskins/osf.io,jeffreyliu3230/osf.io,cwisecarver/osf.io,alexschiller/osf.io,KAsante95/osf.io,jeffreyliu3230/osf.io,sbt9uc/osf.io,brandonPurvis/osf.io,amyshi188/osf.io,reinaH/osf.io,caneruguz/osf.io,TomBaxter/osf.io,brianjgeiger/osf.io,acshi/osf.io,leb2dg/osf.io,cwisecarver/osf.io,SSJohns/osf.io,mattclark/osf.io,baylee-d/osf.io,acshi/osf.io,danielneis/osf.io,zamattiac/osf.io,haoyuchen1992/osf.io,alexschiller/osf.io,bdyetton/prettychart,jnayak1/osf.io,mluo613/osf.io,samchrisinger/osf.io,danielneis/osf.io,fabianvf/osf.io,sloria/osf.io,GageGaskins/osf.io,hmoco/osf.io,Nesiehr/osf.io,laurenrevere/osf.io,TomBaxter/osf.io,cosenal/osf.io,billyhunt/osf.io,felliott/osf.io
--- +++ @@ -1,5 +1,5 @@ 'use strict'; -var ko = require('knockout'); + var AddonNodeConfig = require('js/addonNodeConfig').AddonNodeConfig; var url = window.contextVars.node.urls.api + 'googledrive/config/';
1d23855155e98688fc1c8b85612e5532c52cc3a3
lib/client.js
lib/client.js
var _ = require('lodash'); var Client = module.exports = function(config) { if (! config) { config = {}; } this.version = config.version || '1'; this._apiSetup(); }; Client.prototype._apiSetup = function() { var api = require('./v' + this.version + '/api.js'); // Extend the Client object with the api methods _.assign(this, api); };
var _ = require('lodash'); var Client = module.exports = function(config) { if (! config) { config = {}; } this.version = config.version || '3'; this._apiSetup(); }; Client.prototype._apiSetup = function() { var api = require('./v' + this.version + '/api.js'); // Extend the Client object with the api methods _.assign(this, api); };
Change default API version to v3
Change default API version to v3
JavaScript
mit
sungwoncho/node-ufc-api
--- +++ @@ -5,7 +5,7 @@ config = {}; } - this.version = config.version || '1'; + this.version = config.version || '3'; this._apiSetup(); };
89755b9c7da113508ccc5715d7d62a8ee44a809a
config/dependency-lint.js
config/dependency-lint.js
/* eslint-env node */ 'use strict'; module.exports = { allowedVersions: { 'ember-getowner-polyfill': '^1.0.0 || ^2.0.0', 'ember-inflector': '^1.0.0 || ^2.0.0', 'ember-runtime-enumerable-includes-polyfill': '^1.0.0 || ^2.0.0', 'ember-require-module': '^0.1', } };
/* eslint-env node */ 'use strict'; module.exports = { allowedVersions: { 'ember-cli-string-helpers': '^1.4.0', //temporary workaround for conflict with ember-light-table 'ember-getowner-polyfill': '^1.0.0 || ^2.0.0', 'ember-inflector': '^1.0.0 || ^2.0.0', 'ember-runtime-enumerable-includes-polyfill': '^1.0.0 || ^2.0.0', 'ember-require-module': '^0.1', } };
Allow multiple versions of ember-cli-string-helpers
Allow multiple versions of ember-cli-string-helpers This is a temporary workaround for a conflict with ember-light-table
JavaScript
mit
thecoolestguy/frontend,thecoolestguy/frontend,ilios/frontend,djvoa12/frontend,dartajax/frontend,ilios/frontend,jrjohnson/frontend,dartajax/frontend,jrjohnson/frontend,djvoa12/frontend
--- +++ @@ -3,6 +3,7 @@ module.exports = { allowedVersions: { + 'ember-cli-string-helpers': '^1.4.0', //temporary workaround for conflict with ember-light-table 'ember-getowner-polyfill': '^1.0.0 || ^2.0.0', 'ember-inflector': '^1.0.0 || ^2.0.0', 'ember-runtime-enumerable-includes-polyfill': '^1.0.0 || ^2.0.0',
88b360cc27fb12df1d683b3221535a0fdd36a570
web/src/js/lib/models/LayerModel.js
web/src/js/lib/models/LayerModel.js
cinema.models.LayerModel = Backbone.Model.extend({ constructor: function (defaults, options) { Backbone.Model.call(this, {}, options); if (typeof defaults === 'string') { this.setFromString(defaults); } else if (defaults) { this.set('state', defaults); } }, /** * Convert an object that maps layer identifiers to color-by values into * a single string that is consumable by other parts of the application. */ serialize: function () { var query = ''; _.each(this.attributes, function (v, k) { query += k + v; }); return query; }, /** * Convert a query string to an object that maps layer identifiers to * their color-by value. The query string is a sequence of two-character * pairs, where the first character identifies the layer ID and the second * character identifies which field it should be colored by. * * The query string is then saved to the model. */ unserialize: function (query) { var obj = {}; if (query.length % 2) { return console.error('Query string "' + query + '" has odd length.'); } for (var i = 0; i < query.length; i += 2) { obj[query[i]] = query[i + 1]; } return obj; }, /** * Set the layers by a "query string". */ setFromString: function (query) { var obj = this.unserialize(query); this.set('state', obj); } });
cinema.models.LayerModel = Backbone.Model.extend({ constructor: function (defaults, options) { Backbone.Model.call(this, {}, options); if (typeof defaults === 'string') { this.setFromString(defaults); } else if (defaults) { this.set('state', defaults); } }, /** * Convert an object that maps layer identifiers to color-by values into * a single string that is consumable by other parts of the application. */ serialize: function () { var query = ''; _.each(this.get('state'), function (v, k) { query += k + v; }); return query; }, /** * Convert a query string to an object that maps layer identifiers to * their color-by value. The query string is a sequence of two-character * pairs, where the first character identifies the layer ID and the second * character identifies which field it should be colored by. * * The query string is then saved to the model. */ unserialize: function (query) { var obj = {}; if (query.length % 2) { return console.error('Query string "' + query + '" has odd length.'); } for (var i = 0; i < query.length; i += 2) { obj[query[i]] = query[i + 1]; } return obj; }, /** * Set the layers by a "query string". */ setFromString: function (query) { var obj = this.unserialize(query); this.set('state', obj); } });
Fix layer model serialize method to use new organization
Fix layer model serialize method to use new organization
JavaScript
bsd-3-clause
Kitware/cinema,Kitware/cinema,Kitware/cinema,Kitware/cinema
--- +++ @@ -16,7 +16,7 @@ serialize: function () { var query = ''; - _.each(this.attributes, function (v, k) { + _.each(this.get('state'), function (v, k) { query += k + v; });
676117cba78bb0269ce1b8d46d760fe779e2b09e
migrations/20170329060832-rename_allowence_to_allowance.js
migrations/20170329060832-rename_allowence_to_allowance.js
'use strict'; module.exports = { up: function (queryInterface, Sequelize) { return queryInterface.renameColumn('Departments', 'allowence', 'allowance'); }, down: function (queryInterface, Sequelize) { return queryInterface.renameColumn('Departments', 'allowance', 'allowence'); } };
'use strict'; var models = require('../lib/model/db'); module.exports = { up: function (queryInterface, Sequelize) { if ('sqlite' === queryInterface.sequelize.getDialect()) { console.log('Going into SQLIite case'); return queryInterface // Create Temp Departments based on current model definitiom .createTable('Departments_backup', models.Department.attributes) .then(function(){ return queryInterface.sequelize.query('PRAGMA foreign_keys=off;'); }) // Copy data form original Departments into new Temp one .then(function(){ return queryInterface.sequelize.query( 'INSERT INTO `Departments_backup` (id, name, include_public_holidays, createdAt, updatedAt, companyId, bossId, allowance) SELECT id, name, include_public_holidays, createdAt, updatedAt, companyId, bossId, allowence FROM `'+ models.Department.tableName +'`'); }) .then(function(){ return queryInterface.dropTable( models.Department.tableName ); }) .then(function(){ return queryInterface.renameTable('Departments_backup', models.Department.tableName); }) .then(function(){ return queryInterface.sequelize.query('PRAGMA foreign_keys=on;'); }) .then(function(){ queryInterface.addIndex(models.Department.tableName, ['companyId']); }) .then(function(){ queryInterface.addIndex(models.Department.tableName, ['id']); }); } else { console.log('Generic option'); return queryInterface.renameColumn('Departments', 'allowence', 'allowance') .then(function(d){ console.dir(d) }); } }, down: function (queryInterface, Sequelize) { return queryInterface.renameColumn('Departments', 'allowance', 'allowence'); } };
Add SQLite specific logic for recent migration.
Add SQLite specific logic for recent migration. It appeared that out of box renameColumn looses some meta inforamtion for subject column.
JavaScript
mit
YulioTech/timeoff,YulioTech/timeoff,timeoff-management/application,timeoff-management/application
--- +++ @@ -1,8 +1,55 @@ 'use strict'; + +var models = require('../lib/model/db'); module.exports = { up: function (queryInterface, Sequelize) { - return queryInterface.renameColumn('Departments', 'allowence', 'allowance'); + + if ('sqlite' === queryInterface.sequelize.getDialect()) { + + console.log('Going into SQLIite case'); + + return queryInterface + // Create Temp Departments based on current model definitiom + .createTable('Departments_backup', models.Department.attributes) + + .then(function(){ + return queryInterface.sequelize.query('PRAGMA foreign_keys=off;'); + }) + + // Copy data form original Departments into new Temp one + .then(function(){ + return queryInterface.sequelize.query( + 'INSERT INTO `Departments_backup` (id, name, include_public_holidays, createdAt, updatedAt, companyId, bossId, allowance) SELECT id, name, include_public_holidays, createdAt, updatedAt, companyId, bossId, allowence FROM `'+ models.Department.tableName +'`'); + }) + + .then(function(){ + return queryInterface.dropTable( models.Department.tableName ); + }) + + .then(function(){ + return queryInterface.renameTable('Departments_backup', models.Department.tableName); + }) + + .then(function(){ + return queryInterface.sequelize.query('PRAGMA foreign_keys=on;'); + }) + + .then(function(){ + queryInterface.addIndex(models.Department.tableName, ['companyId']); + }) + + .then(function(){ + queryInterface.addIndex(models.Department.tableName, ['id']); + }); + + } else { + + console.log('Generic option'); + + return queryInterface.renameColumn('Departments', 'allowence', 'allowance') + .then(function(d){ console.dir(d) }); + } }, down: function (queryInterface, Sequelize) {
45d0b315423946df17853708bf0d48005b92544b
webroot/js/responsive/app.module.js
webroot/js/responsive/app.module.js
(function() { 'use strict'; angular .module('app', ['ngMaterial', 'ngMessages', 'ngCookies', 'ngSanitize']) .config(['$mdThemingProvider', '$mdIconProvider', '$httpProvider', function($mdThemingProvider, $mdIconProvider, $httpProvider) { $mdThemingProvider.theme('default') .primaryPalette('green') .accentPalette('grey') .warnPalette('red', {'default': '700'}); $httpProvider.defaults.transformRequest = function(data) { if (data === undefined) { return data; } return $.param(data); }; $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token'; $httpProvider.defaults.xsrfCookieName = 'csrfToken'; }]) .filter('urlEncode', function() { return function(input) { if (input) { return window.encodeURIComponent(input); } return ""; }; }); })();
(function() { 'use strict'; angular .module('app', ['ngMaterial', 'ngMessages', 'ngCookies', 'ngSanitize']) .config(['$mdThemingProvider', '$mdIconProvider', '$httpProvider', '$cookiesProvider', function( $mdThemingProvider, $mdIconProvider, $httpProvider, $cookiesProvider ) { $mdThemingProvider.theme('default') .primaryPalette('green') .accentPalette('grey') .warnPalette('red', {'default': '700'}); $httpProvider.defaults.transformRequest = function(data) { if (data === undefined) { return data; } return $.param(data); }; $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token'; $httpProvider.defaults.xsrfCookieName = 'csrfToken'; var date = new Date(); $cookiesProvider.defaults.path = '/'; $cookiesProvider.defaults.expires = new Date(date.setMonth(date.getMonth() + 1)); }]) .filter('urlEncode', function() { return function(input) { if (input) { return window.encodeURIComponent(input); } return ""; }; }); })();
Set global path and +1 month expiration date in angular cookies
Set global path and +1 month expiration date in angular cookies
JavaScript
agpl-3.0
Tatoeba/tatoeba2,Tatoeba/tatoeba2,Tatoeba/tatoeba2,Tatoeba/tatoeba2,Tatoeba/tatoeba2
--- +++ @@ -3,7 +3,9 @@ angular .module('app', ['ngMaterial', 'ngMessages', 'ngCookies', 'ngSanitize']) - .config(['$mdThemingProvider', '$mdIconProvider', '$httpProvider', function($mdThemingProvider, $mdIconProvider, $httpProvider) { + .config(['$mdThemingProvider', '$mdIconProvider', '$httpProvider', '$cookiesProvider', function( + $mdThemingProvider, $mdIconProvider, $httpProvider, $cookiesProvider + ) { $mdThemingProvider.theme('default') .primaryPalette('green') .accentPalette('grey') @@ -20,6 +22,10 @@ 'XMLHttpRequest'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token'; $httpProvider.defaults.xsrfCookieName = 'csrfToken'; + + var date = new Date(); + $cookiesProvider.defaults.path = '/'; + $cookiesProvider.defaults.expires = new Date(date.setMonth(date.getMonth() + 1)); }]) .filter('urlEncode', function() { return function(input) {
5bf9c027fa2896d8cb41750904a2631c3391b508
example/backend/passport.js
example/backend/passport.js
'use strict'; var passport = require('passport'), BitbucketTokenStrategy = require('../../lib/index'), User = require('mongoose').model('User'); module.exports = function () { passport.use(new BitbucketTokenStrategy({ clientID: 'app-id', clientSecret: 'client-secret' apiVersion: '1.0', profileWithEmail: true }, function (accessToken, refreshToken, profile, done) { User.upsertUser(accessToken, refreshToken, profile, function(err, user) { return done(err, user); }); })); };
'use strict'; var passport = require('passport'), BitbucketTokenStrategy = require('../../lib/index'), User = require('mongoose').model('User'); module.exports = function () { passport.use(new BitbucketTokenStrategy({ clientID: 'app-id', clientSecret: 'client-secret', apiVersion: '1.0', profileWithEmail: true }, function (accessToken, refreshToken, profile, done) { User.upsertUser(accessToken, refreshToken, profile, function(err, user) { return done(err, user); }); })); };
Fix type in backend example
Fix type in backend example
JavaScript
mit
GenFirst/passport-bitbucket-token
--- +++ @@ -8,7 +8,7 @@ passport.use(new BitbucketTokenStrategy({ clientID: 'app-id', - clientSecret: 'client-secret' + clientSecret: 'client-secret', apiVersion: '1.0', profileWithEmail: true },
6ca34a9c9c51ea5bc8d4abd99a78952834e04385
examples/Basic/index.ios.js
examples/Basic/index.ios.js
import React from 'react-native'; const { AppRegistry, Component, Text, View } = React; import NavigationBar from 'react-native-navbar'; class Basic extends Component { render() { return ( <View style={{ flex: 1, backgroundColor: '#ff9900' }}> <NavigationBar title={{ title: 'Title', }} leftButton={{ title: 'Back', }} rightButton={{ title: 'Forward', }} /> </View> ); } } AppRegistry.registerComponent('Basic', () => Basic);
import React from 'react-native'; const { AppRegistry, Component, Text, View } = React; import NavigationBar from 'react-native-navbar/ios'; class Basic extends Component { render() { return ( <View style={{ flex: 1, backgroundColor: '#ff9900' }}> <NavigationBar title={{ title: 'Title', }} leftButton={{ title: 'Back', }} rightButton={{ title: 'Forward', }} /> </View> ); } } AppRegistry.registerComponent('Basic', () => Basic);
Use iOS version of nabar
Use iOS version of nabar
JavaScript
mit
Kureev/react-native-navbar,react-native-fellowship/react-native-navbar
--- +++ @@ -5,7 +5,7 @@ Text, View } = React; -import NavigationBar from 'react-native-navbar'; +import NavigationBar from 'react-native-navbar/ios'; class Basic extends Component { render() {
08c8816c5a5267257cbd72b1ab292adcd219373e
backend/server/db/model/files.js
backend/server/db/model/files.js
/** * @fileOverview * @name files.js * @author V. Glenn Tarcea <glenn.tarcea@gmail.com> * @license */ module.exports = function(r) { 'use strict'; return { countInProject: countInProject }; function *countInProject(ids, projectID) { let rql = r.table('datafiles').getAll.apply(this, ids); let count = yield rql.filter({project_id: projectID}).count(); return count; } };
/** * @fileOverview * @name files.js * @author V. Glenn Tarcea <glenn.tarcea@gmail.com> * @license */ module.exports = function(r) { 'use strict'; return { countInProject: countInProject }; function *countInProject(ids, projectID) { let rql = r.table('datafiles').getAll(r.args(ids)); let count = yield rql.filter({project_id: projectID}).count(); return count; } };
Update how we call getAll to properly parse out an array of keys using r.args() rather than doing getAll.apply(this, items) (which doesn't work).
Update how we call getAll to properly parse out an array of keys using r.args() rather than doing getAll.apply(this, items) (which doesn't work).
JavaScript
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -12,7 +12,7 @@ }; function *countInProject(ids, projectID) { - let rql = r.table('datafiles').getAll.apply(this, ids); + let rql = r.table('datafiles').getAll(r.args(ids)); let count = yield rql.filter({project_id: projectID}).count(); return count; }
2d40e0c1366e403ab50be6c9aaa603a67825a4c8
packages/ember-data/lib/transforms/base.js
packages/ember-data/lib/transforms/base.js
/** The `DS.Transform` class is used to serialize and deserialize model attributes when they are saved or loaded from an adapter. Subclassing `DS.Transform` is useful for creating custom attributes. All subclasses of `DS.Transform` must implement a `serialize` and a `deserialize` method. Example ```javascript App.RawTransform = DS.Transform.extend({ deserialize: function(serialized) { return serialized; }, serialize: function(deserialized) { return deserialized; } }); ``` Usage ```javascript var attr = DS.attr; App.Requirement = DS.Model.extend({ name: attr('string'), optionsArray: attr('raw') }); ``` @class Transform @namespace DS */ var Transform = Ember.Object.extend({ /** When given a deserialized value from a record attribute this method must return the serialized value. Example ```javascript serialize: function(deserialized) { return Ember.isEmpty(deserialized) ? null : Number(deserialized); } ``` @method serialize @param deserialized The deserialized value @return The serialized value */ serialize: Ember.required(), /** When given a serialize value from a JSON object this method must return the deserialized value for the record attribute. Example ```javascript deserialize: function(serialized) { return empty(serialized) ? null : Number(serialized); } ``` @method deserialize @param serialized The serialized value @return The deserialized value */ deserialize: Ember.required() }); export default Transform;
/** The `DS.Transform` class is used to serialize and deserialize model attributes when they are saved or loaded from an adapter. Subclassing `DS.Transform` is useful for creating custom attributes. All subclasses of `DS.Transform` must implement a `serialize` and a `deserialize` method. Example ```javascript // Converts centigrade in the JSON to fahrenheit in the app App.TemperatureTransform = DS.Transform.extend({ deserialize: function(serialized) { return (serialized * 1.8) + 32; }, serialize: function(deserialized) { return (deserialized - 32) / 1.8; } }); ``` Usage ```javascript var attr = DS.attr; App.Requirement = DS.Model.extend({ name: attr('string'), optionsArray: attr('raw') }); ``` @class Transform @namespace DS */ var Transform = Ember.Object.extend({ /** When given a deserialized value from a record attribute this method must return the serialized value. Example ```javascript serialize: function(deserialized) { return Ember.isEmpty(deserialized) ? null : Number(deserialized); } ``` @method serialize @param deserialized The deserialized value @return The serialized value */ serialize: Ember.required(), /** When given a serialize value from a JSON object this method must return the deserialized value for the record attribute. Example ```javascript deserialize: function(serialized) { return empty(serialized) ? null : Number(serialized); } ``` @method deserialize @param serialized The serialized value @return The deserialized value */ deserialize: Ember.required() }); export default Transform;
Add a better transform example
Add a better transform example
JavaScript
mit
fsmanuel/data,wecc/data,lostinpatterns/data,pdud/data,hibariya/data,ryanpatrickcook/data,sammcgrail/data,eriktrom/data,swarmbox/data,duggiefresh/data,mphasize/data,bf4/data,rtablada/data,PrecisionNutrition/data,bf4/data,davidpett/data,martndemus/data,rtablada/data,swarmbox/data,heathharrelson/data,fpauser/data,funtusov/data,sebastianseilund/data,courajs/data,usecanvas/data,BBLN/data,funtusov/data,Eric-Guo/data,heathharrelson/data,in4mates/ember-data,mphasize/data,kappiah/data,stefanpenner/data,sammcgrail/data,Turbo87/ember-data,k-fish/data,nickiaconis/data,hibariya/data,wecc/data,in4mates/ember-data,arenoir/data,topaxi/data,wecc/data,jgwhite/data,HeroicEric/data,webPapaya/data,sammcgrail/data,minasmart/data,pdud/data,workmanw/data,yaymukund/data,BookingSync/data,seanpdoyle/data,funtusov/data,fpauser/data,greyhwndz/data,funtusov/data,EmberSherpa/data,arenoir/data,jmurphyau/data,yaymukund/data,gabriel-letarte/data,XrXr/data,FinSync/ember-data,Turbo87/ember-data,duggiefresh/data,yaymukund/data,BookingSync/data,yaymukund/data,simaob/data,gniquil/data,stefanpenner/data,usecanvas/data,fpauser/data,acburdine/data,jmurphyau/data,EmberSherpa/data,fpauser/data,InboxHealth/data,PrecisionNutrition/data,splattne/data,swarmbox/data,bf4/data,arenoir/data,splattne/data,gkaran/data,pdud/data,topaxi/data,kimroen/data,kappiah/data,PrecisionNutrition/data,heathharrelson/data,danmcclain/data,stefanpenner/data,gkaran/data,Kuzirashi/data,kimroen/data,andrejunges/data,whatthewhat/data,tarzan/data,tstirrat/ember-data,whatthewhat/data,gniquil/data,minasmart/data,intuitivepixel/data,BBLN/data,whatthewhat/data,sebweaver/data,seanpdoyle/data,kappiah/data,usecanvas/data,knownasilya/data,knownasilya/data,seanpdoyle/data,andrejunges/data,trisrael/em-data,Robdel12/data,tarzan/data,flowjzh/data,Kuzirashi/data,usecanvas/data,rtablada/data,Robdel12/data,courajs/data,davidpett/data,in4mates/ember-data,faizaanshamsi/data,dustinfarris/data,fsmanuel/data,thaume/data,gabriel-letarte/data,simaob/data,bf4/data,courajs/data,gabriel-letarte/data,heathharrelson/data,offirgolan/data,EmberSherpa/data,martndemus/data,acburdine/data,knownasilya/data,H1D/data,nickiaconis/data,vikram7/data,kappiah/data,BBLN/data,seanpdoyle/data,acburdine/data,nickiaconis/data,vikram7/data,minasmart/data,fsmanuel/data,gkaran/data,danmcclain/data,zoeesilcock/data,dustinfarris/data,greyhwndz/data,arenoir/data,trisrael/em-data,Robdel12/data,intuitivepixel/data,EmberSherpa/data,gniquil/data,vikram7/data,eriktrom/data,simaob/data,davidpett/data,tonywok/data,andrejunges/data,k-fish/data,lostinpatterns/data,stefanpenner/data,bcardarella/data,duggiefresh/data,wecc/data,mphasize/data,swarmbox/data,trisrael/em-data,BBLN/data,Turbo87/ember-data,andrejunges/data,offirgolan/data,mphasize/data,hibariya/data,H1D/data,martndemus/data,gkaran/data,flowjzh/data,fsmanuel/data,jgwhite/data,faizaanshamsi/data,nickiaconis/data,XrXr/data,Kuzirashi/data,Turbo87/ember-data,dustinfarris/data,webPapaya/data,jmurphyau/data,tstirrat/ember-data,davidpett/data,zoeesilcock/data,PrecisionNutrition/data,greyhwndz/data,H1D/data,martndemus/data,lostinpatterns/data,InboxHealth/data,eriktrom/data,k-fish/data,Eric-Guo/data,tstirrat/ember-data,gabriel-letarte/data,Kuzirashi/data,eriktrom/data,sebweaver/data,BookingSync/data,sammcgrail/data,rtablada/data,sebweaver/data,sebweaver/data,FinSync/ember-data,faizaanshamsi/data,workmanw/data,tonywok/data,jgwhite/data,splattne/data,tonywok/data,bcardarella/data,flowjzh/data,HeroicEric/data,FinSync/ember-data,webPapaya/data,ryanpatrickcook/data,courajs/data,HeroicEric/data,intuitivepixel/data,acburdine/data,BookingSync/data,gniquil/data,topaxi/data,bcardarella/data,intuitivepixel/data,FinSync/ember-data,InboxHealth/data,faizaanshamsi/data,flowjzh/data,workmanw/data,thaume/data,simaob/data,XrXr/data,splattne/data,sebastianseilund/data,topaxi/data,tonywok/data,greyhwndz/data,pdud/data,HeroicEric/data,ryanpatrickcook/data,webPapaya/data,thaume/data,offirgolan/data,bcardarella/data,tstirrat/ember-data,sebastianseilund/data,k-fish/data,jgwhite/data,Robdel12/data,tarzan/data,offirgolan/data,danmcclain/data,Eric-Guo/data,workmanw/data,minasmart/data,duggiefresh/data,vikram7/data,Eric-Guo/data,XrXr/data,hibariya/data,InboxHealth/data,jmurphyau/data,H1D/data,zoeesilcock/data,tarzan/data,sebastianseilund/data,danmcclain/data,thaume/data,whatthewhat/data,ryanpatrickcook/data,lostinpatterns/data,dustinfarris/data,kimroen/data,zoeesilcock/data
--- +++ @@ -8,12 +8,13 @@ Example ```javascript - App.RawTransform = DS.Transform.extend({ + // Converts centigrade in the JSON to fahrenheit in the app + App.TemperatureTransform = DS.Transform.extend({ deserialize: function(serialized) { - return serialized; + return (serialized * 1.8) + 32; }, serialize: function(deserialized) { - return deserialized; + return (deserialized - 32) / 1.8; } }); ```
784943c1278e479382c7f26f1f65aa53bb28517d
test/config.js
test/config.js
module.exports = { appKey : 'mgb7ka1nbs3wg', appSecret : 'm1Rv2MHHND', token : { userId : '0001', name : 'TestUser', portraitUri : 'http://rongcloud.cn/images/logo.png' }, message : { fromUserId : '546eb521c613156d331e91bb', toUserId : '5460603c1002a6e311f89e7f', textMsg : 'Hello, world!' }, group : { userId : '5460603c1002a6e311f89e7f', groupIdNamePairs : { 'ProgrammerGroup1' : '程序猿交流群1', 'DriverGroup1' : '赛车手爱好者2群' } } }
module.exports = { appKey : 'mgb7ka1nbs3wg', appSecret : 'm1Rv2MHHND', token : { userId : '0001', name : 'TestUser', portraitUri : 'http://rongcloud.cn/images/logo.png' }, message : { fromUserId : '546eb521c613156d331e91bb', toUserId : '5460603c1002a6e311f89e7f', textMsg : 'Hello, world!' }, group : { userId : '5460603c1002a6e311f89e7f', groupIdNamePairs : { 'ProgrammerGroup1' : '程序猿交流群1', 'DriverGroup1' : '赛车手爱好者2群' } }, chatroom : { chatroomIdNamePairs : { 'EatingFans' : '吃货大本营', 'ProCylcing' : '骑行专家', 'DriodGeek' : '手机极客', 'HackerHome' : '黑客之家' } } }
Add more chat room infos.
Add more chat room infos.
JavaScript
mit
rongcloud/server-sdk-nodejs,coocon/server-sdk-nodejs
--- +++ @@ -14,5 +14,8 @@ group : { userId : '5460603c1002a6e311f89e7f', groupIdNamePairs : { 'ProgrammerGroup1' : '程序猿交流群1', 'DriverGroup1' : '赛车手爱好者2群' } + }, + chatroom : { + chatroomIdNamePairs : { 'EatingFans' : '吃货大本营', 'ProCylcing' : '骑行专家', 'DriodGeek' : '手机极客', 'HackerHome' : '黑客之家' } } }
443be4271f06692f65b00054c2ec725b02fc6b0b
client/app/components/todos-list/component.js
client/app/components/todos-list/component.js
import Ember from 'ember'; export default Ember.Component.extend({ tagName: 'ul', channel: Ember.inject.service(), });
import Ember from 'ember'; export default Ember.Component.extend({ tagName: 'ul', channel: Ember.inject.service(), didInsertElement: function(){ var socket = this.get('channel').socket(); socket.connect(); var chan = socket.chan("todos:list", {}); chan.join().receive("ok", chan => { console.log("Success!"); }); } });
Connect to our channel:topic as really basic test.
Connect to our channel:topic as really basic test.
JavaScript
mit
cincinnati-elixir/todos_phoenix_ember_example,cincinnati-elixir/todos_phoenix_ember_example,cincinnati-elixir/todos_phoenix_ember_example
--- +++ @@ -3,4 +3,13 @@ export default Ember.Component.extend({ tagName: 'ul', channel: Ember.inject.service(), + + didInsertElement: function(){ + var socket = this.get('channel').socket(); + socket.connect(); + var chan = socket.chan("todos:list", {}); + chan.join().receive("ok", chan => { + console.log("Success!"); + }); + } });
35a09e0e9d366e06a3eacea63b5aefe6b18c6cf4
sample/testParser.js
sample/testParser.js
const AnnotationParser = require(__dirname+"/../").AnnotationParser; const Request = require(__dirname+"/myannotations/Request"); AnnotationParser.parse( __dirname+"/annotatedFile.js", __dirname+"/myannotations/", (err, annotatedElements) => { if (err) { console.log(err); } else { for (let i in annotatedElements) { if (typeof annotatedElements[i] != "function") { // TODO : Improve this feature let annotatedElement = annotatedElements[i]; console.log(annotatedElement.getName()+" : "+annotatedElement.getType()); let elementAnnotations = annotatedElement.getAnnotations(); for (let i in elementAnnotations) { console.log("\t"+JSON.stringify(elementAnnotations[i])); } console.log(); } } } });
const AnnotationParser = require(__dirname+"/../").AnnotationParser; const Request = require(__dirname+"/myannotations/Request"); try { let annotatedElements = AnnotationParser.parse(__dirname+"/annotatedFile.js", __dirname+"/myannotations/"); for (let i in annotatedElements) { if (typeof annotatedElements[i] != "function") { // TODO : Improve this feature let annotatedElement = annotatedElements[i]; console.log(annotatedElement.getName()+" : "+annotatedElement.getType()); let elementAnnotations = annotatedElement.getAnnotations(); for (let i in elementAnnotations) { console.log("\t"+JSON.stringify(elementAnnotations[i])); } console.log(); } } } catch (err) { console.log(err); }
Update to support Synchronous Parsing
Update to support Synchronous Parsing
JavaScript
mit
anupam-git/nodeannotations
--- +++ @@ -1,26 +1,23 @@ const AnnotationParser = require(__dirname+"/../").AnnotationParser; const Request = require(__dirname+"/myannotations/Request"); -AnnotationParser.parse( - __dirname+"/annotatedFile.js", - __dirname+"/myannotations/", - (err, annotatedElements) => { - if (err) { - console.log(err); - } else { - for (let i in annotatedElements) { - if (typeof annotatedElements[i] != "function") { // TODO : Improve this feature - let annotatedElement = annotatedElements[i]; - console.log(annotatedElement.getName()+" : "+annotatedElement.getType()); +try { + let annotatedElements = AnnotationParser.parse(__dirname+"/annotatedFile.js", __dirname+"/myannotations/"); - let elementAnnotations = annotatedElement.getAnnotations(); + for (let i in annotatedElements) { + if (typeof annotatedElements[i] != "function") { // TODO : Improve this feature + let annotatedElement = annotatedElements[i]; + console.log(annotatedElement.getName()+" : "+annotatedElement.getType()); - for (let i in elementAnnotations) { - console.log("\t"+JSON.stringify(elementAnnotations[i])); - } + let elementAnnotations = annotatedElement.getAnnotations(); - console.log(); - } + for (let i in elementAnnotations) { + console.log("\t"+JSON.stringify(elementAnnotations[i])); } + + console.log(); } - }); + } +} catch (err) { + console.log(err); +}
9652df246c011d31aa3b6d68ea5155d2d846dabc
src/db/user-queries.js
src/db/user-queries.js
const db = require('./db') const pgp = require('pg-promise')() const userQueries = { createUser: (name, email, password) => { return db.one(` INSERT INTO users (name, email, password) VALUES ($1, $2, $3) RETURNING id`, [name, email, password]) .then(pgp.end()) .catch((error) => { console.log("\nError in user-queries.js createUser\n") throw error }) } } module.exports = userQueries
const db = require('./db') const pgp = require('pg-promise')() // NOTE: remove pgp.end and .catch once they are handled elsewhere const userQueries = { createUser: (name, email, password) => { return db.(` INSERT INTO users (name, email, password) VALUES ($1, $2, $3) RETURNING id`, [name, email, password]) .then(pgp.end()) .catch((error) => { console.log("\nError in user-queries.js createUser\n") throw error }) } } module.exports = userQueries
Add note for refactoring once other parts are built
Add note for refactoring once other parts are built
JavaScript
mit
EmmaEm/Roam,EmmaEm/Roam
--- +++ @@ -1,9 +1,10 @@ const db = require('./db') const pgp = require('pg-promise')() +// NOTE: remove pgp.end and .catch once they are handled elsewhere const userQueries = { createUser: (name, email, password) => { - return db.one(` + return db.(` INSERT INTO users (name, email, password) VALUES ($1, $2, $3) RETURNING id`,
d4421c2a43112c2c1a702ddfd6ce9219967744c7
tests/index.js
tests/index.js
var Jasmine = require("jasmine"); var jasmine = new Jasmine(); var config = { spec_dir: "", spec_files: ["tests/**/*.js", "app/**/tests/index.js", "app/**/tests.js"], helpers: [], stopSpecOnExpectationFailure: false, random: false }; // Pass in a custom test glob for running only specific tests if (process.env.TEST) { config.spec_files = [ process.env.TEST + "**/tests/index.js", process.env.TEST + "**/tests.js" ]; console.log("Running tests from", config.spec_files); } jasmine.loadConfig(config); global.createUser = require("./helpers/createUser"); global.createBlog = require("./helpers/createBlog"); global.removeBlog = require("./helpers/removeBlog"); global.removeUser = require("./helpers/removeUser"); jasmine.execute();
var Jasmine = require("jasmine"); var jasmine = new Jasmine(); var config = { spec_dir: "", spec_files: ["tests/**/*.js", "app/**/tests/index.js", "app/**/tests.js"], helpers: [], stopSpecOnExpectationFailure: true, random: false }; // Pass in a custom test glob for running only specific tests if (process.env.TEST) { config.spec_files = [ process.env.TEST + "**/tests/index.js", process.env.TEST + "**/tests.js" ]; console.log("Running tests from", config.spec_files); } jasmine.loadConfig(config); global.createUser = require("./helpers/createUser"); global.createBlog = require("./helpers/createBlog"); global.removeBlog = require("./helpers/removeBlog"); global.removeUser = require("./helpers/removeUser"); jasmine.execute();
Stop testing spec on failure
Stop testing spec on failure
JavaScript
cc0-1.0
davidmerfield/Blot,davidmerfield/Blot,davidmerfield/Blot,davidmerfield/Blot
--- +++ @@ -4,7 +4,7 @@ spec_dir: "", spec_files: ["tests/**/*.js", "app/**/tests/index.js", "app/**/tests.js"], helpers: [], - stopSpecOnExpectationFailure: false, + stopSpecOnExpectationFailure: true, random: false };
45fcea40fe53c784145d015d30f0846926cf01f9
src/client/es6/controller/cart-blog-list.js
src/client/es6/controller/cart-blog-list.js
import CartBase from './base/cart-base.js'; class CartBlogListCtrl extends CartBase { constructor($scope, ...args) { super(...args); this.logInit('CartBlogListCtrl'); this.$scope = $scope; this.postList = []; this.init(); } init() { if (!this.apiService.isDataInitialized()) { // loading animation this.apiService.dataInit().then( () => { // end loading animation?? this.convertPostDataToViewArr(this.apiService.postMap); }, (error) => { // end loading animation?? this.msgService.error(error); } ); } else { this.convertPostDataToViewArr(this.apiService.postMap); } } categoryGetTitleViaUuid(uuid) { let name = 'N/A'; if (this.apiService.categoryMap.has(uuid)) { name = this.apiService.categoryMap.get(uuid).title; } return name; } convertPostDataToViewArr(postMap) { // pagination?? this.$scope.$apply(() => { // fix the issue: postList updated but data binding not triggered for (let [, post] of postMap) { //noinspection JSUnusedAssignment this.postList.push(post); } }); } } CartBlogListCtrl.$inject = ['$scope', ...CartBase.$inject]; export default CartBlogListCtrl;
import CartBase from './base/cart-base.js'; class CartBlogListCtrl extends CartBase { constructor($scope, $timeout, ...args) { super(...args); this.logInit('CartBlogListCtrl'); this.$scope = $scope; this.$timeout = $timeout; this.postList = []; this.init(); } init() { if (!this.apiService.isDataInitialized()) { // loading animation this.apiService.dataInit().then( () => { // end loading animation?? this.convertPostDataToViewArr(this.apiService.postMap); }, (error) => { // end loading animation?? this.msgService.error(error); } ); } else { this.convertPostDataToViewArr(this.apiService.postMap); } } categoryGetTitleViaUuid(uuid) { let name = 'N/A'; if (this.apiService.categoryMap.has(uuid)) { name = this.apiService.categoryMap.get(uuid).title; } return name; } convertPostDataToViewArr(postMap) { // pagination?? this.$timeout(() => { // fix the issue: $digest already in progress this.$scope.$apply(() => { // fix the issue: postList updated but data binding not triggered for (let [, post] of postMap) { //noinspection JSUnusedAssignment this.postList.push(post); } }); }); } } CartBlogListCtrl.$inject = ['$scope', '$timeout', ...CartBase.$inject]; export default CartBlogListCtrl;
Use $timeout to make $apply functions go to the next digest, to prevent "$digest already in progress".
Use $timeout to make $apply functions go to the next digest, to prevent "$digest already in progress".
JavaScript
mit
agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart,agreatfool/Cart
--- +++ @@ -1,11 +1,12 @@ import CartBase from './base/cart-base.js'; class CartBlogListCtrl extends CartBase { - constructor($scope, ...args) { + constructor($scope, $timeout, ...args) { super(...args); this.logInit('CartBlogListCtrl'); this.$scope = $scope; + this.$timeout = $timeout; this.postList = []; @@ -44,15 +45,17 @@ } convertPostDataToViewArr(postMap) { // pagination?? - this.$scope.$apply(() => { // fix the issue: postList updated but data binding not triggered - for (let [, post] of postMap) { - //noinspection JSUnusedAssignment - this.postList.push(post); - } + this.$timeout(() => { // fix the issue: $digest already in progress + this.$scope.$apply(() => { // fix the issue: postList updated but data binding not triggered + for (let [, post] of postMap) { + //noinspection JSUnusedAssignment + this.postList.push(post); + } + }); }); } } -CartBlogListCtrl.$inject = ['$scope', ...CartBase.$inject]; +CartBlogListCtrl.$inject = ['$scope', '$timeout', ...CartBase.$inject]; export default CartBlogListCtrl;
8cb0444c4ebd9d4ea42d92942eb02899c14e011b
src/components/providers/cdg/Prefs/Prefs.js
src/components/providers/cdg/Prefs/Prefs.js
import React from 'react' export default class Prefs extends React.Component { static propTypes = { prefs: React.PropTypes.object.isRequired, setPrefs: React.PropTypes.func.isRequired, providerRefresh: React.PropTypes.func.isRequired, } toggleEnabled = this.toggleEnabled.bind(this) handleRefresh = this.handleRefresh.bind(this) toggleEnabled(e) { e.preventDefault() let prefs = Object.assign({}, this.props.prefs) prefs.enabled = !prefs.enabled this.props.setPrefs('provider.cdg', prefs) } handleRefresh() { this.props.providerRefresh('cdg') } render() { const { prefs } = this.props if (!prefs) return null const enabled = prefs.enabled === true let paths = prefs.paths || [] paths = paths.map(path => ( <p key={path}>{path}</p> )) return ( <div> <label> <input type='checkbox' checked={enabled} onClick={this.toggleEnabled}/> <strong> CD+Graphics</strong> </label> <button onClick={this.handleRefresh}>Refresh</button> {paths} </div> ) } }
import React from 'react' export default class Prefs extends React.Component { static propTypes = { prefs: React.PropTypes.object.isRequired, setPrefs: React.PropTypes.func.isRequired, providerRefresh: React.PropTypes.func.isRequired, } setEnabled = this.setEnabled.bind(this) handleRefresh = this.handleRefresh.bind(this) setEnabled(e) { let prefs = Object.assign({}, this.props.prefs) prefs.enabled = e.target.checked this.props.setPrefs('provider.cdg', prefs) } handleRefresh() { this.props.providerRefresh('cdg') } render() { const { prefs } = this.props if (!prefs) return null const enabled = prefs.enabled === true let paths = prefs.paths || [] paths = paths.map(path => ( <p key={path}>{path}</p> )) return ( <div> <label> <input type='checkbox' checked={enabled} onChange={this.setEnabled}/> <strong> CD+Graphics</strong> </label> <button onClick={this.handleRefresh}>Refresh</button> {paths} </div> ) } }
FIx warning and remove use of preventDefault on checkbox
FIx warning and remove use of preventDefault on checkbox
JavaScript
isc
bhj/karaoke-forever,bhj/karaoke-forever
--- +++ @@ -7,13 +7,12 @@ providerRefresh: React.PropTypes.func.isRequired, } - toggleEnabled = this.toggleEnabled.bind(this) + setEnabled = this.setEnabled.bind(this) handleRefresh = this.handleRefresh.bind(this) - toggleEnabled(e) { - e.preventDefault() + setEnabled(e) { let prefs = Object.assign({}, this.props.prefs) - prefs.enabled = !prefs.enabled + prefs.enabled = e.target.checked this.props.setPrefs('provider.cdg', prefs) } @@ -35,7 +34,7 @@ return ( <div> <label> - <input type='checkbox' checked={enabled} onClick={this.toggleEnabled}/> + <input type='checkbox' checked={enabled} onChange={this.setEnabled}/> <strong> CD+Graphics</strong> </label> <button onClick={this.handleRefresh}>Refresh</button>
dade414e6dad3bae1f358f6132f30858a6958c8e
src/githubpusher/frontend/static/install.js
src/githubpusher/frontend/static/install.js
function register() { navigator.serviceWorker.register("sw.js", {scope: '/'}).then( function(serviceWorkerRegistration) { serviceWorkerRegistration.pushManager.subscribe().then( function(pushSubscription) { console.log(pushSubscription.endpoint); var data = new FormData(); data.append('endpoint', pushSubscription.endpoint); var xhr = new XMLHttpRequest(); xhr.open("POST", "/register"); xhr.onload = function () { console.log(this.responseText); window.location = "/manage" }; xhr.send(data); }, function(error) { console.log(error); } ); } ); } addEventListener("load", register, false);
function register() { navigator.serviceWorker.register("sw.js", {scope: '/'}); navigator.serviceWorker.ready.then( function(swr) { swr.pushManager.subscribe().then( function(pushSubscription) { var data = new FormData(); data.append('endpoint', pushSubscription.endpoint); var xhr = new XMLHttpRequest(); xhr.open("POST", "/register"); xhr.onload = function () { window.location = "/manage" }; xhr.send(data); }, function(error) { console.log(error); } ); } ); } addEventListener("load", register, false);
Use serviceWorker.ready.then before calling subscribe
Use serviceWorker.ready.then before calling subscribe
JavaScript
apache-2.0
dougt/githubwebpush,dougt/githubwebpush,dougt/githubwebpush
--- +++ @@ -1,22 +1,25 @@ function register() { - navigator.serviceWorker.register("sw.js", {scope: '/'}).then( - function(serviceWorkerRegistration) { - serviceWorkerRegistration.pushManager.subscribe().then( + navigator.serviceWorker.register("sw.js", {scope: '/'}); + + navigator.serviceWorker.ready.then( + function(swr) { + + swr.pushManager.subscribe().then( function(pushSubscription) { - console.log(pushSubscription.endpoint); var data = new FormData(); data.append('endpoint', pushSubscription.endpoint); var xhr = new XMLHttpRequest(); xhr.open("POST", "/register"); xhr.onload = function () { - console.log(this.responseText); window.location = "/manage" }; xhr.send(data); - }, function(error) { + }, + + function(error) { console.log(error); } );