commit
stringlengths
40
40
subject
stringlengths
1
3.25k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
old_contents
stringlengths
0
26.3k
lang
stringclasses
3 values
proba
float64
0
1
diff
stringlengths
0
7.82k
f0e0d07053f5dfcf1f5ad7df3647c93d1ce64615
Remove unncescary watch
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var open = require('open'); var bowerFiles = require('main-bower-files'); var series = require('stream-series'); var runSequence = require('run-sequence'); var webpack = require('webpack-stream'); gulp.task('watch', ['server'], function() { $.livereload.listen(); gulp.start('test:watch'); gulp.watch('src/*.js', ['eslint', 'webpack']); gulp.watch(['./index.html', './webpack/**']).on('change', $.livereload.changed); }); gulp.task('server', function() { $.connect.server({ root: ['./'], port: 8000, livereload: false }); open('http://localhost:8000'); }); gulp.task('webpack', function() { return gulp.src('src/angular-bluebird-promises.js') .pipe(webpack({ output: { filename: 'angular-bluebird-promises.js' }, externals: { angular: 'angular', bluebird: 'Promise' }, devtool: 'source-map' })) .pipe(gulp.dest('webpack')); }); var pkg = require('./bower.json'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' * @license <%= pkg.license %>', ' */', ''].join('\n'); gulp.task('build', ['webpack'], function() { return gulp.src('webpack/*.js') .pipe($.sourcemaps.init({ loadMaps: true })) .pipe($.header(banner, { pkg : pkg } )) .pipe($.ngAnnotate()) .pipe(gulp.dest('dist')) .pipe($.rename('angular-bluebird-promises.min.js')) .pipe($.uglify()) .pipe($.header(banner, { pkg : pkg } )) .pipe($.sourcemaps.write('.')) .pipe(gulp.dest('dist')); }); gulp.task('default', ['build']); function runTests(action, onDistCode) { var vendorJs = gulp.src(bowerFiles({includeDev: true})); if (onDistCode) { var appJs = gulp.src('dist/angular-bluebird-promises.min.js'); } else { var appJs = gulp.src('webpack/angular-bluebird-promises.js'); } var test = gulp.src('test/angular-bluebird-promises.spec.js'); return series(vendorJs, appJs, test) .pipe($.karma({ configFile: 'karma.conf.js', action: action })); } gulp.task('test:src', ['webpack'], function() { return runTests('run').on('error', function(err) { throw err; }); }); gulp.task('test:dist', function() { return runTests('run', true).on('error', function(err) { throw err; }); }); gulp.task('test:watch', function() { gulp.watch('src/*.js', ['eslint', 'webpack']); return runTests('watch'); }); function eslint(failOnError) { var stream = gulp.src(['src/*.js']) .pipe($.eslint()) .pipe($.eslint.format()); if (failOnError) { return stream.pipe($.eslint.failOnError()); } else { return stream; } } gulp.task('eslint', function() { return eslint(); }); gulp.task('ci:eslint', function() { return eslint(true); }); gulp.task('ci', function(done) { runSequence('ci:eslint', 'build', 'test:dist', done); });
JavaScript
0.000001
@@ -2442,57 +2442,8 @@ ) %7B%0A - gulp.watch('src/*.js', %5B'eslint', 'webpack'%5D);%0A re
1f4c2336bf472a309ee871196ef5daeb21738384
Correct package path
gulpfile.js
gulpfile.js
require('gulp-coffee/node_modules/coffee-script/register'); require('./gulp.coffee');
JavaScript
0.000007
@@ -6,33 +6,8 @@ re(' -gulp-coffee/node_modules/ coff
86b1b1759f2c0c7a525d8b36452770bb827cae90
fix gulpfile error
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var rename = require("gulp-rename"); var webpack = require('gulp-webpack'); gulp.task('default', function() { return gulp.src('myComponents.js') .pipe(webpack({ watch: true, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?stage=0&optional[]=runtime&loose=true' }, { test: /bootstrap/, loader: 'babel-loader?stage=0&optional[]=runtime&loose=true&nonStandard=true' } ], }, })) .pipe(rename('myComponents.js')) .pipe(gulp.dest('dist/')); });
JavaScript
0.000003
@@ -311,129 +311,8 @@ s/,%0A - loader: 'babel-loader?stage=0&optional%5B%5D=runtime&loose=true'%0A %7D,%0A %7B%0A test: /bootstrap/,%0A
1e4accc29107cc3ec8fcfe66e7cda947e2d990a4
normalize the replace pattern
gulpfile.js
gulpfile.js
var inject = require('gulp-inject'), gulp = require('gulp'), path = require('path'); gulp.task('build', function () { views(); }); gulp.task('views', views); function views() { gulp.src(path.normalize('./frontend/src/*.js')) .pipe(gulp.dest(path.normalize('./build/static'))); gulp.src(path.normalize('./app/index.html')) .pipe(inject( gulp.src([path.normalize('./frontend/src/*.js')], {read: false}), { transform : function ( filePath, file, i, length ) { var newPath = filePath.replace('/frontend/src', ''); console.log('inject script = '+ newPath); return '<script src="/static' + newPath + '"></script>'; } } )) .pipe(gulp.dest('./build')); }
JavaScript
0.993033
@@ -560,16 +560,31 @@ replace( +path.normalize( '/fronte @@ -590,16 +590,17 @@ end/src' +) , '');%0A
161a3268a7df5d0a2ea3dc94859fa1c128f926b3
teste bower
gulpfile.js
gulpfile.js
var gulp = require('gulp'), autoprefixer = require('gulp-autoprefixer'), uglify = require('gulp-uglify'), rename = require('gulp-rename'), notify = require('gulp-notify'); gulp.task('default', function () { return gulp.src('cronapi.js') .pipe(uglify()) .pipe(rename('cronapi.min.js')) .pipe(gulp.dest('dist/')); //.pipe(notify({ message: 'CronApi-JS build finished' })); }); gulp.task('i18n', function() { return gulp.src('i18n/') .pipe(gulp.dest('i18n/')) .pipe(notify({ message: 'CronApi-JS build finished' })); });
JavaScript
0.000001
@@ -180,16 +180,70 @@ otify'); +%0A//gulp.task('default', gulp.series('minify', 'i18n')) %0A%0Agulp.t @@ -475,16 +475,18 @@ ));%0A%7D);%0A +/* gulp.tas @@ -609,28 +609,30 @@ -JS build finished' %7D));%0A%7D); +*/
3d6bac40daf87e64da2770ec6a63ab709fdab820
Update own gulpfile to use new metadata interface
gulpfile.js
gulpfile.js
var _ = require('lodash'), path = require('path'), gulp = require('gulp'), gutil = require('gulp-util'), args = require('yargs').argv, runSequence = require('run-sequence'), jshint = require('gulp-jshint'), jscs = require('gulp-jscs'), jsonlint = require('gulp-json-lint'), jshintReporter = require('reporter-plus/jshint'), jscsReporter = require('reporter-plus/jscs'), jsonlintReporter = require('reporter-plus/jsonlint'), gulpMetadata = require('./tools/gulp-metadata.js')(gulp); /*--- Check Tasks ---*/ gulp.task('check-tools', function() { return gulp.src(path.join('tools', '*.js')) .pipe(jshint(_.merge( {lookup: false}, require('./runcoms/rc.jshint.json') ))) .pipe(jshint.reporter(jshintReporter)) .pipe(jscs({ configPath: path.join(__dirname, '.', 'runcoms', 'rc.jscs.json') })) .pipe(jscs.reporter(jscsReporter.path)); }); gulpMetadata.addTask('check-tools', { description: 'Run all tool files through JSHint and JSCS', category: 'checker' }); gulp.task('check-runcoms', function() { return gulp.src(path.join('runcoms', '*.json')) .pipe(jsonlint()) .pipe(jsonlint.report(jsonlintReporter)); }); gulpMetadata.addTask('check-runcoms', { description: 'Run all runcom files through JSONLint', category: 'checker' }); /*--- Default Task --*/ gulp.task('default', function(done) { runSequence( 'check-tools', 'check-runcoms', done ); }); gulpMetadata.addTask('default', { description: 'Run the most important tasks for developing this project', category: 'main', weight: 0 }); /*--- Versioning Task ---*/ gulp.task('version', function() { var versionBump = require('./tools/version-bump.js'); return gulp.src(path.join('.', 'package.json'), {base: '.'}) .pipe(versionBump(args.bump)) .pipe(gulp.dest('.')); }); gulpMetadata.addTask('version', { description: 'Bump this project\'s semantic version number.', category: 'misc', arguments: { 'bump': '[Optional] Specifies which part of the version number (major, minor, patch) should be bumped.' } }); /*--- Help task ---*/ gulp.task('help', function() { gutil.log(gulpMetadata.describeAll()); }); gulpMetadata.addTask('help', { description: 'List all available Gulp tasks and arguments.', category: 'misc', weight: 999 });
JavaScript
0
@@ -519,16 +519,24 @@ js') +.applyTo (gulp);%0A %0A/*- @@ -531,16 +531,16 @@ (gulp);%0A - %0A/*--- C @@ -630,16 +630,22 @@ 'tools', + '**', '*.js') @@ -944,45 +944,8 @@ );%0A%7D -);%0AgulpMetadata.addTask('check-tools' , %7B%0A @@ -1195,47 +1195,8 @@ );%0A%7D -);%0AgulpMetadata.addTask('check-runcoms' , %7B%0A @@ -1414,41 +1414,8 @@ );%0A%7D -);%0AgulpMetadata.addTask('default' , %7B%0A @@ -1625,16 +1625,21 @@ ./tools/ +misc/ version- @@ -1779,41 +1779,8 @@ );%0A%7D -);%0AgulpMetadata.addTask('version' , %7B%0A @@ -2097,39 +2097,9 @@ ));%0A + %7D -);%0AgulpMetadata.addTask('help' , %7B%0A
9bbe7dd83118170fb5bc8f9aad3f18c41a0482b0
add views in Jobs
server/src/plugins/job/JobModel.js
server/src/plugins/job/JobModel.js
module.exports = function(sequelize, DataTypes) { const Job = sequelize.define( "Job", { title: DataTypes.TEXT, description: DataTypes.TEXT, company_name: DataTypes.TEXT, company_url: DataTypes.TEXT, company_info: DataTypes.TEXT, business_type: DataTypes.TEXT, company_logo_url: DataTypes.TEXT, start_date: DataTypes.DATE, end_date: DataTypes.DATE, sector: DataTypes.TEXT, location: DataTypes.JSONB, meta: DataTypes.JSONB, geo: DataTypes.GEOGRAPHY, picture: DataTypes.JSONB }, { tableName: "job", underscored: true, indexes: [ { using: "gist", fields: ["geo"] }, { fields: ["sector"] } ] } ); Job.associate = function(models) { Job.belongsTo(models.User, { foreignKey: { name: "user_id", allowNull: false } }); models.User.hasMany(models.Job, { foreignKey: { name: "user_id", allowNull: true } }); }; return Job; };
JavaScript
0
@@ -545,31 +545,163 @@ icture: -DataTypes.JSONB +%7B%0A type: DataTypes.JSONB,%0A defaultValue: %7B%7D%0A %7D,%0A views: %7B%0A type: DataTypes.INTEGER,%0A defaultValue: 0%0A %7D, %0A %7D,%0A
d3365d7606ce9e8873b2a9fd44af395d5ea858ad
Fix typo in variable name
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var watch = require('gulp-watch'); var harp = require('harp'); var browserSync = require('browser-sync'); var ghPages = require('gulp-gh-pages'); var harpServerOptions = { port: 9000 }; var browserSynceOptions = { open: false, proxy: 'localhost:' + harpServerOptions.port, notify: false, port: 3000 }; var harpConfig = { prod: { siteUrl: "http://tech.joshegan.com", siteEnvironment: "PRODUCTION" }, dev: { siteUrl: "http://localhost:" + browserSynceOptions.port, siteEnvironment: "DEV" } }; var paths = { projectDir: './', outputDir: './dist', outputFiles: './dist/**/*', srcFiles: './public/**/*' }; gulp.task('default', ['watch']); gulp.task('deploy', ['build-for-prod'], function () { return gulp.src(paths.outputFiles) .pipe(ghPages()); }); gulp.task('build-for-prod', function (done) { applyHarpConfig(harpConfig.prod); harp.compile(paths.projectDir, paths.outputDir, done); }); gulp.task('watch', ['dev-server'], function () { browserSync(browserSynceOptions); gulp.src(paths.srcFiles) .pipe(watch(paths.srcFiles, {verbose: true})) .pipe(browserSync.reload({stream: true})); }); gulp.task('dev-server', function (done) { applyHarpConfig(harpConfig.dev); harp.server(__dirname, harpServerOptions, done); }); function applyHarpConfig(config){ process.env.SITE_URL = config.siteUrl; process.env.SITE_ENVIRONMENT = config.siteEnvironment; }
JavaScript
0.998497
@@ -237,25 +237,24 @@ browserSync -e Options = %7B%0A @@ -510,25 +510,24 @@ browserSync -e Options.port @@ -1052,17 +1052,16 @@ wserSync -e Options) @@ -1123,16 +1123,23 @@ Files, %7B +%0A verbose: @@ -1143,16 +1143,21 @@ se: true +%0A %7D))%0A @@ -1182,16 +1182,23 @@ reload(%7B +%0A stream: @@ -1201,16 +1201,21 @@ am: true +%0A %7D));%0A%7D); @@ -1381,16 +1381,17 @@ (config) + %7B%0A proc
6e8f8e06f7a3b2e71146899a150ada7e5c2a88a2
use es6 for testSubscriber.js
server/test/jobs/testSubscriber.js
server/test/jobs/testSubscriber.js
var assert = require('assert'); var _ = require('lodash'); var Subscriber = require("rabbitmq-pubsub").Subscriber; var Publisher = require("rabbitmq-pubsub").Publisher; describe('PublisherSubscriber', function() { "use strict"; this.timeout(15e3); var TestManager = require('../testManager'); var testMngr = new TestManager(); var publisher; before(function(done) { testMngr.start().then(done, done); }); after(function(done) { testMngr.stop().then(done, done); }); describe('StartStop', function() { it.skip('should start and stop the publisher', function(done) { publisher = new Publisher({exchange:"user.new"}); publisher.start().delay(1e3).then(publisher.stop).then(done, done); }); }); });
JavaScript
0
@@ -1,107 +1,13 @@ -var assert = require('assert');%0Avar _ = require('lodash');%0Avar Subscriber = require(%22rabbitmq-pubsub%22). +%0Aimport %7B Subs @@ -16,13 +16,9 @@ iber -;%0Avar +, Pub @@ -27,20 +27,16 @@ sher - = require(%22 +%7D from ' rabb @@ -50,21 +50,11 @@ bsub -%22).Publisher; +';%0A %0A%0Ade @@ -100,24 +100,8 @@ ) %7B%0A - %22use strict%22;%0A th
38ba0972f4d83f97ea07dbfcaf9c47d66d0afec5
Remove pesky z-index optimizer
gulpfile.js
gulpfile.js
'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); var cssnano = require('gulp-cssnano'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); gulp.task('workflow', function () { gulp.src('./src/scss/**/*.scss') .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({ browsers: ['last 2 versions'], cascade: false })) .pipe(cssnano()) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css/')) }); //Watch task gulp.task('default', function () { gulp.watch('./src/scss/**/*.scss', ['workflow']); });
JavaScript
0.000003
@@ -457,16 +457,31 @@ cssnano( +%7Bzindex: false%7D ))%0A .
3d9756c49354d5de0397a3c2ab52b1e4d9ee3e07
change default task
gulpfile.js
gulpfile.js
var gulp = require('gulp'); var path = require('path'); var fs = require('fs'); var glob = require("glob"); var through2 = require('through2'); var runSequence = require('run-sequence'); var exec = require('child_process').exec; var uiIndex = require('./lib/findBy/tagname/searchIndex/build-stream'); var codeIndex = require('./lib/findBy/code/searchIndex/build-stream'); var Promise = require("bluebird"); var execAsync = Promise.promisify(exec); var config = require("config"); var mongo = require('./lib/db/connection'); var DATASET_ROOT = config.get('dataset.root'); gulp.task('index:ui', function () { gulp.src(path.join(DATASET_ROOT, 'ui', '*.xml')) .pipe(uiIndex()) .pipe(gulp.dest('indexes/tagname')); }); gulp.task('solr:indexCode', function (callback) { glob(path.join(DATASET_ROOT, 'code', '*.txt'), function (er, files) { codeIndex.index(files); callback(); }); }); gulp.task('solr:commit', function () { codeIndex.commit(); }); gulp.task('extract:archives', function (done) { var untarListings = 'tar xvjf ' + path.join(DATASET_ROOT, 'listing', 'listing.tar.bz2') + ' -C ' + path.join(DATASET_ROOT, 'listing'); var untarUI = 'tar xvjf ' + path.join(DATASET_ROOT, 'ui', 'ui-xml.tar.bz2') + ' -C ' + path.join(DATASET_ROOT, 'ui'); var untarCode = 'tar xvjf ' + path.join(DATASET_ROOT, 'code', 'smali-invoked-methods.tar.bz2') + ' -C ' + path.join(DATASET_ROOT, 'code'); console.log("Extracting listing details json files..."); execAsync(untarListings) .then(function () { console.log("Extracting UI xml files..."); return execAsync(untarUI); }) .then(function () { console.log("Extracting code text files..."); return execAsync(untarCode); }) .then(function () { console.log("All archives have been extracted."); done(); }) .error(function (error) { console.error(error); done(error); }); }); gulp.task('start:db', function (callback) { try { fs.mkdirSync(path.join(DATASET_ROOT, 'db')); } catch (error) { if (error.code != 'EEXIST') callback(error); } // start Solr in SolrCloud mode as a daemon var solr = 'solr start -cloud -V -h ' + config.get('dbConfig.solr.host') + ' -p ' + config.get('dbConfig.solr.port'); console.log("Starting Solr server in SolrCloud mode. " + solr); exec(solr, function (error, stdout, stderr) { console.log(stdout); console.log(stderr); callback(stderr); }); // start MongoDB var mongod = 'mongod --port ' + config.get('dbConfig.mongo.port') + ' --config ' + config.get('dbConfig.mongo.config') + ' --dbpath ' + path.join(DATASET_ROOT, 'db'); console.log("Starting MongoDB server: " + mongod); exec(mongod, function (error, stdout, stderr) { console.log(stdout); console.log(stderr); callback(stderr); }); }); gulp.task('mongo:insertListing', function (done) { gulp.src(path.join(DATASET_ROOT, 'listing', '*.json')) .pipe(new through2.obj(function (file, enc, cb) { var doc = JSON.parse(file.contents); doc['id'] = doc['n'] + '-' + doc['verc']; mongo.upsertOne('listings', doc, doc) .then(function () { cb(); }) .error(function (e) { console.error('Error in insert:listing task: ' + e.message); }); }, function () { done(); })); }); gulp.task('mongo:indexListing', function (done) { mongo.createIndex('listings', {id: 1}, {unique: true}) .then(function () { done(); }) .error(function (e) { console.error('Error in mongoIndex task: ' + e.message); }) }); gulp.task('mongo:close', function () { mongo.close(); }); gulp.task('load:db', function (callback) { runSequence('mongo:insertListing', 'mongo:indexListing', 'mongo:close', callback) }); gulp.task('default', function (callback) { runSequence('extract:archives', 'index:ui', 'solr:indexCode', 'solr:commit', 'load:db', callback); });
JavaScript
0.000004
@@ -4278,61 +4278,8 @@ es', - 'index:ui', 'solr:indexCode', 'solr:commit',%0A 'lo
cd5e3b75d89e06f27530648766001cceafdbe43d
update order processing to save shipping address and other feilds
services/order-processing/index.js
services/order-processing/index.js
'use strict'; const db = require('../../db/data-service'); const _ = require('lodash'); const superagent = require('superagent-promise')(require('superagent'), Promise); function recordPayment() { // contact AIS team to create a payment transaction // this is Group 1 return superagent .post('52.168.10.209:1337/transaction') .send({ subledgerId: 6, // for sales revenue amount: 550, // this should really be passed in date: (new Date).toISOString(), description: "testing sales team integration" }) .set('Content-Type', 'application/json') .catch((err) => { throw new Error('Failed to record payment with AIS: ' + err); }); // group 2 is pending // return Promise.resolve('successfully recorded the payment'); } function scheduleDelivery() { // contact SCM team to schedule a delivery return Promise.resolve('successfully scheduled a delivery'); //@TODO:this needs to be a POST request to SCM team // return Promise.reject(new Error('SCM goes boom!')); } function saveOrder(params) { // save the order data to our own database const orderObject = _.pick(params, ['user_id', 'product_id', 'salesperson_id', 'quantity']); return db .putItem({ database: 'Orders', table: 'table1', item: orderObject }) .then(() => { const salesObject = { date: parseInt(Date.now() / 1000, 10), item: params.product_id, quantity: params.quantity, discount: 0, location: 'N/A', channel: 1, // retail promotion: 4 // personal selling }; return db.putItem({ database: 'Marketing', table: 'sales', item: salesObject }); }) .catch((err) => { throw new Error('Failed to save order to DB: ' + err); // this is impossible }); } function newOrder(params) { return recordPayment() .then(() => { return scheduleDelivery() .then(() => { return saveOrder(params); }); }); } module.exports = { newOrder };
JavaScript
0
@@ -187,16 +187,22 @@ Payment( +params ) %7B%0A // @@ -409,11 +409,26 @@ nt: -550 +params.price_total , // @@ -519,40 +519,115 @@ on: -%22testing sales team integration%22 +%60Sale of $%7Bparams.quantity%7D unit of '$%7Bparams.product_name%7D' to user_$%7Bparams.user_id%7D:$%7Bparams.user_name%7D%60 %0A @@ -894,16 +894,22 @@ elivery( +params ) %7B%0A // @@ -949,16 +949,188 @@ elivery%0A + // console.log(%7B%0A // order_id: params.orderId,%0A // shipping_address: params.ship_addr,%0A // model: params.product_name,%0A // quantity: params.quantity%0A // %7D);%0A return @@ -1382,252 +1382,24 @@ nst -orderObject = _.pick(params, %5B'user_id', 'product_id', 'salesperson_id', 'quantity'%5D);%0A return db%0A .putItem(%7B%0A database: 'Orders',%0A table: 'table1',%0A item: orderObject%0A %7D)%0A .then(() +salesObject = -%3E %7B%0A - const salesObject = %7B%0A @@ -1437,28 +1437,24 @@ 0, 10),%0A - - item: params @@ -1470,20 +1470,16 @@ id,%0A - - quantity @@ -1501,20 +1501,16 @@ ty,%0A - - discount @@ -1514,20 +1514,16 @@ unt: 0,%0A - loca @@ -1539,20 +1539,16 @@ A',%0A - - channel: @@ -1561,20 +1561,16 @@ retail%0A - prom @@ -1602,21 +1602,14 @@ ing%0A - %7D;%0A - +%0A re @@ -1615,16 +1615,21 @@ eturn db +%0A .putItem @@ -1631,18 +1631,16 @@ tItem(%7B%0A - da @@ -1666,18 +1666,16 @@ ,%0A - - table: ' @@ -1682,18 +1682,16 @@ sales',%0A - it @@ -1706,16 +1706,141 @@ sObject%0A + %7D)%0A .then(() =%3E %7B%0A return db.putItem(%7B%0A database: 'Orders',%0A table: 'table1',%0A item: params%0A %7D) @@ -2001,30 +2001,32 @@ return -recordPayment( +saveOrder(params )%0A .t @@ -2022,32 +2022,41 @@ ams)%0A .then(( +orderItem ) =%3E %7B%0A ret @@ -2056,32 +2056,72 @@ -return scheduleDelivery( +params.orderId = orderItem.id;%0A return recordPayment(params )%0A @@ -2154,32 +2154,39 @@ return s -aveOrd +cheduleDeliv er +y (params);%0A
c9100a152be888507e21a80b8cfcf032fc36c856
Fix bad JavaScript practices and avoid declaration of 2 global variables.
share/www/script/test/bulk_docs.js
share/www/script/test/bulk_docs.js
// Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. couchTests.bulk_docs = function(debug) { var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"}); db.deleteDb(); db.createDb(); if (debug) debugger; var docs = makeDocs(5); // Create the docs var results = db.bulkSave(docs); T(results.length == 5); for (var i = 0; i < 5; i++) { T(results[i].id == docs[i]._id); T(results[i].rev); // Update the doc docs[i].string = docs[i].string + ".00"; } // Save the docs results = db.bulkSave(docs); T(results.length == 5); for (i = 0; i < 5; i++) { T(results[i].id == i.toString()); // set the delete flag to delete the docs in the next step docs[i]._deleted = true; } // now test a bulk update with a conflict // open and save var doc = db.open("0"); db.save(doc); // Now bulk delete the docs results = db.bulkSave(docs); // doc "0" should be a conflict T(results.length == 5); T(results[0].id == "0"); T(results[0].error == "conflict"); T(results[0].rev === undefined); // no rev member when a conflict // but the rest are not for (i = 1; i < 5; i++) { T(results[i].id == i.toString()); T(results[i].rev) T(db.open(docs[i]._id) == null); } // now force a conflict to to save // save doc 0, this will cause a conflict when we save docs[0] var doc = db.open("0"); docs[0] = db.open("0"); db.save(doc); docs[0].shooby = "dooby"; // Now save the bulk docs, When we use all_or_nothing, we don't get conflict // checking, all docs are saved regardless of conflict status, or none are // saved. results = db.bulkSave(docs,{all_or_nothing:true}); T(results.error === undefined); var doc = db.open("0", {conflicts:true}); var docConflict = db.open("0", {rev:doc._conflicts[0]}); T(doc.shooby == "dooby" || docConflict.shooby == "dooby"); // verify creating a document with no id returns a new id var req = CouchDB.request("POST", "/test_suite_db/_bulk_docs", { body: JSON.stringify({"docs": [{"foo":"bar"}]}) }); results = JSON.parse(req.responseText); T(results[0].id != ""); T(results[0].rev != ""); // Regression test for failure on update/delete var newdoc = {"_id": "foobar", "body": "baz"}; T(db.save(newdoc).ok); update = {"_id": newdoc._id, "_rev": newdoc._rev, "body": "blam"}; torem = {"_id": newdoc._id, "_rev": newdoc._rev, "_deleted": true}; results = db.bulkSave([update, torem]); T(results[0].error == "conflict" || results[1].error == "conflict"); };
JavaScript
0.99967
@@ -1522,32 +1522,39 @@ conflict%22);%0A T( +typeof results%5B0%5D.rev = @@ -1552,24 +1552,25 @@ %5B0%5D.rev === +%22 undefined); @@ -1566,16 +1566,17 @@ ndefined +%22 ); // no @@ -1717,16 +1717,17 @@ %5Bi%5D.rev) +; %0A T(d @@ -2793,16 +2793,20 @@ .ok);%0A +var update = @@ -2866,16 +2866,20 @@ am%22%7D;%0A +var torem =
c9926da671607c6972dde7c651da74341e629188
test change
demos/KitchenSink/Resources/examples/map_view2.js
demos/KitchenSink/Resources/examples/map_view2.js
var win = Titanium.UI.currentWindow; var annotation = Titanium.Map.createAnnotation({ latitude:42.334537, longitude:-71.170101, title:"Boston College", subtitle:'Newton Campus, Chestnut Hill, MA', animate:true, image:"../images/boston_college.png" }); var boston = {latitude:42.334537,longitude:-71.170101,latitudeDelta:0.010, longitudeDelta:0.018}; // // CREATE MAP VIEW // var mapview = Titanium.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region: boston, animate:true, regionFit:true, userLocation:true, annotations:[annotation] }); // read in our routes from a comma-separated file var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'examples','route.csv'); var csv = f.read(); var points = []; var lines = csv.toString().split("\n"); for (var c=0;c<lines.length;c++) { var line = lines[c]; var latlong = line.split(","); if (latlong.length > 1) { var lat = latlong[0]; var lon = latlong[1]; var entry = {latitude:lat,longitude:lon}; points[c]=entry; } } // route object var route = { name:"boston", points:points, color:"red", width:4 }; // add a route mapview.addRoute(route); win.add(mapview); // when you click the logo, remove the route annotation.addEventListener('click',function() { mapview.removeRoute(route); });
JavaScript
0.000002
@@ -210,16 +210,53 @@ e:true,%0A +%09leftButton:'../images/atlanta.jpg',%0A %09image:%22 @@ -1313,12 +1313,193 @@ route);%0A%7D);%0A +%0A// map view click event listener%0Amapview.addEventListener('click',function(evt)%0A%7B%0A%09var clickSource = evt.clicksource;%0A%09Ti.API.info('mapview click clicksource = ' + clickSource)%0A%7D);
6b243df642189c566eba7a74a4dd571084afa1c1
fix some bugs
ChartGenerator/Repositories/UploadRepository.js
ChartGenerator/Repositories/UploadRepository.js
let Promise = require('bluebird') let model = require('../connect') let upload = function (id, table, path, field) { return new Promise((resolve, reject) => { model.knex(table + id).del().then(() => { let query = 'ALTER TABLE ' + table + id + ' AUTO_INCREMENT = 1' return model.knex.raw(query) }).then(() => { let query = "LOAD DATA LOCAL INFILE '" + path + "' INTO TABLE " + table + id + " TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 ROWS (" + field + ")" return model.knex.raw(query) }).then(() => { resolve() }).catch(error => { console.log(error) reject() }) }) } module.exports = { upload: upload }
JavaScript
0.000008
@@ -494,11 +494,12 @@ E 1 -ROW +LINE S (%22
0f8eccd592060bcd3bb3e911551a0033353a9477
Check if refId exists
migrations/teacher.js
migrations/teacher.js
/* eslint no-console: 0 */ /* eslint no-confusing-arrow: 0 */ const ran = false; // set to true to exclude migration const name = 'Fix access rights for teachers on homework submitted files.'; const mongoose = require('mongoose'); const { submissionModel } = require('../src/services/homework/model.js'); const { FileModel } = require('../src/services/fileStorage/model.js'); mongoose.Promise = global.Promise; const run = async (dry) => { mongoose.connect(process.env.DB_URL || 'mongodb://localhost:27017/schulcloud', { user: process.env.DB_USERNAME, pass: process.env.DB_PASSWORD }); const errorHandler = (e) => { console.log('Error', e); return undefined; }; const submissionWithFiles = await submissionModel .find({ fileIds: { $exists: true, $not: { $size: 0 } } }) .populate('homeworkId') .populate('fileIds') .exec() .catch(errorHandler); if (!submissionWithFiles.length) { return Promise.resolve(); } const promises = submissionWithFiles .map((sub) => { const { teacherId } = sub.homeworkId || {}; if (!teacherId) { return Promise.resolve(); } const buggyFiles = sub.fileIds .filter(file => !file.permissions .find(perm => perm.refId.toString() === teacherId.toString())); if (!buggyFiles.length) { return Promise.resolve(); } console.log('Update permissions of files:'); console.log(buggyFiles.map(file => file._id)); console.log(`with access rights for teacher: ${teacherId}`); const filePromises = buggyFiles.map(file => dry ? Promise.resolve() : FileModel.update({ _id: file._id }, { $set: { permissions: [...file.permissions, { refId: teacherId, refPermModel: 'user', write: false, read: true, create: false, delete: false, }], }, }).exec().catch(errorHandler)); return Promise.all(filePromises); }); return Promise.all(promises); }; module.exports = { ran, name, run, };
JavaScript
0.000002
@@ -1182,16 +1182,30 @@ (perm =%3E + perm.refId && perm.re
62da1a658850b6a5e73d28d1629033de21f79d00
Update exercise.js
starter_code/exercise.js
starter_code/exercise.js
var input = require('./digits.js'); var exercise = {}; exercise.one = function(){ //------------------- //---- Your Code ---- //------------------- return 'Error: 1st function not implementeded'; }; exercise.two = function(data){ //------------------- //---- Your Code ---- //------------------- return 'Error: 2nd function not implemented'; }; exercise.three = function(data){ //------------------- //---- Your Code ---- //------------------- return 'Error: 3rd function not implemented'; }; exercise.four = function(data){ //------------------- //---- Your Code ---- //------------------- return 'Error: 4th function not implemented'; }; exercise.five = function(data){ //------------------- //---- Your Code ---- //------------------- return 'Error: 5th function not implemented'; }; module.exports = exercise;
JavaScript
0.000001
@@ -204,18 +204,16 @@ lemented -ed ';%0A%7D;%0A%0Ae
514bb1103675173513e0e9038a1848084b921172
Add failing tests.
tests/spec/DeepCopy.js
tests/spec/DeepCopy.js
describe("DeepCopy", function () { var myVect1 = me.Vector2d.extend({ a : new me.Vector2d(0.5, 0.5), b : [1,2,3] }); var myVect2 = myVect1.extend({ a : new me.Vector2d(1.5, 1.5), }); var vec1 = new myVect1(25, 25); var vec2 = new myVect2(50, 50); it("is an instance of me.Vector2d", function () { expect(vec1).toBeInstanceOf(me.Vector2d); expect(vec2).toBeInstanceOf(me.Vector2d); }); it("is not an instance of myVect2", function () { expect(vec1).not.toBeInstanceOf(myVect2); }); it("is an instance of myVect1", function () { expect(vec2).toBeInstanceOf(myVect1); }); it("is not the same object", function () { expect(vec1.a).not.toBe(vec2.a); expect(vec1.b).not.toBe(vec2.b); }); it("does not affect the other when changed", function () { vec2.b[0] = 3; expect(vec1.b[0]).not.toEqual(vec2.b[0]); }); });
JavaScript
0.000002
@@ -664,32 +664,350 @@ ect1);%0A %7D);%0A%0A + it(%22has an instance of me.Vector2d%22, function () %7B%0A expect(vec1.a).toBeInstanceOf(me.Vector2d);%0A expect(vec2.a).toBeInstanceOf(me.Vector2d);%0A %7D);%0A%0A it(%22has an instance of Array%22, function () %7B%0A expect(vec1.b).toBeInstanceOf(Array);%0A expect(vec2.b).toBeInstanceOf(Array);%0A %7D);%0A%0A it(%22is not t
24d23d8e55928c4cef3de11071bf2eb9ea0766ce
Increase timeout
tests/electron_tests/spec.js
tests/electron_tests/spec.js
const Application = require('spectron').Application const assert = require('assert') const electronPath = require('electron') // Require Electron from the binaries included in node_modules. const path = require('path') describe('Application launch', function () { this.timeout(10000) beforeEach(function () { this.app = new Application({ path: electronPath, args: [path.join(__dirname, '../..')], requireName: 'electronRequire' }) return this.app.start() }) afterEach(function () { if (this.app && this.app.isRunning()) { return this.app.stop() } }) it('shows an initial window', function () { return this.app.client.getWindowCount().then(function (count) { assert.equal(count, 1) }) }) })
JavaScript
0.000002
@@ -273,17 +273,17 @@ timeout( -1 +3 0000)%0A%0A
29aad3ece2a27d135f3e646358a8c188019668da
Use fafafa for background white
client/mobile/test/src/components/StartClassView.js
client/mobile/test/src/components/StartClassView.js
import React from "react-native"; const { View, Text, StyleSheet, Navigator, TouchableOpacity, ScrollView, ListView } = React; class StartClassView extends React.Component { constructor(props) { super(props); this.state = { classes: [{id: 1, name:'Quick Class'}, {id:2, name:'CS 101'}, {id:3, name: 'CS 201'}], }; } selectClass(classId) { api.getLessons(classId) .then((response) => { if(response.status === 500){ console.error('err getting class data'); } else if(response.status === 200) { var lessons = JSON.parse(response._bodyText); this.socket = io(server, {jsonp: false}); this.socket.emit('teacherConnect' , {classId: classId}); this.props.navigator.push({ component: SelectLessonView, classId: classId, lessons: lessons, socket: this.socket, sceneConfig: { ...Navigator.SceneConfigs.FloatFromRight, gestures: {} } }); } }) .catch((err) => { console.error(err); }); } renderClasses(classes) { return classes.map((cls, index) => { return ( <View style={styles.buttonContainer} key={index}> <TouchableOpacity onPress={this.selectClass.bind(this, cls.id)} style={styles.button}> <Text style={styles.buttonText}> {cls.name} </Text> </TouchableOpacity> </View> ) }) } render() { return ( <View style={{flex: 1, backgroundColor: '#ededed'}}> <View style={styles.viewContainer}> <View style={styles.titleContainer}> <Text style={styles.pageText}> Your classes </Text> </View> <ScrollView> <View style={styles.buttonsContainer}> {this.renderClasses(this.state.classes)} </View> </ScrollView> </View> </View> ) } } const styles = StyleSheet.create({ viewContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, pageText: { fontSize: 20 }, buttonsContainer: { padding: 20 }, buttonContainer: { margin: 20 }, button: { }, buttonText: { fontSize: 20 } });
JavaScript
0
@@ -2093,14 +2093,14 @@ : '# -F5FCFF +fafafa ',%0A
a1187a9f707f60bb2859abe62b7ac3fd884361a4
fix append
static/js/currentData.js
static/js/currentData.js
/** * Created by remy on 01/05/15. */ function getCurBattery(callback) { var data; jQuery.ajax({ url: "http://idp-api.herokuapp.com/spin/latest/batterij", type: "GET", dataType: 'json', success: function (resultData) { callback(resultData); //console.log(resultData); }, error: function (jqXHR, textStatus, errorThrown) { callback(null); console.log(errorThrown); } }); } function getCurMode(callback) { var data; jQuery.ajax({ url: "http://idp-api.herokuapp.com/spin/latest/mode", type: "GET", dataType: 'json', success: function (resultData) { callback(resultData); }, error: function (jqXHR, textStatus, errorThrown) { callback(null); console.log(errorThrown); } }); } function insertData() { var modus = $(".modus"); var batterij = $(".batterij"); getCurBattery(function (data) { batterij.each(function () { $(this).append("<h1>"+ data +"%</h1>"); }); }); getCurMode(function (modeData) { modus.append("<h1>"+ modeData +"</h1>"); }); }
JavaScript
0.998546
@@ -1060,22 +1060,20 @@ $(this). -append +html (%22%3Ch1%3E%22+ @@ -1167,14 +1167,12 @@ dus. -append +html (%22%3Ch
ddf2aa3e6036947e7024752a9a4a92930e4864ae
Update compare.js
tests/utils/compare.js
tests/utils/compare.js
/* global XMLHttpRequest, expect */ function loadBinaryResource (url) { const req = new XMLHttpRequest() req.open('GET', url, false) // XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] req.overrideMimeType('text\/plain; charset=x-user-defined'); req.send(null) if (req.status !== 200) { throw new Error('Unable to load file') } return unescape(encodeURIComponent(req.response)); } function sendReference (filename, data) { const req = new XMLHttpRequest() req.open('POST', `http://localhost:9090/${filename}`, true) req.onload = e => { console.log(e) } req.send(data) } const resetCreationDate = input => input.replace( /\/CreationDate \(D:(.*?)\)/, '/CreationDate (D:19871210000000+00\'00\'\)' ) /** * Find a better way to set this * @type {Boolean} */ window.comparePdf = (actual, expectedFile, suite) => { let pdf try { pdf = loadBinaryResource(`/base/tests/${suite}/reference/${expectedFile}`) } catch (error) { sendReference(`/tests/${suite}/reference/${expectedFile}`, resetCreationDate(actual)) pdf = actual } const expected = resetCreationDate(pdf).trim() actual = resetCreationDate(actual.trim()) expect(actual).toEqual(expected) }
JavaScript
0.000001
@@ -372,56 +372,311 @@ %7D%0A -return unescape(encodeURIComponent(req.response) + var responseText = req.responseText;%0A var responseTextLen = req.length;%0A var binary = ''%0A for (var j = 0; j %3C responseTextLen; j+=1) %7B%0A binary += String.fromCharCode(responseText.charCodeAt(j) & 0xff)%0A %7D %0A var base64data = window.btoa(binary);%0A return window.atob(base64data );%0A%7D
1fff0ef54ca6a9960118e213e3de9a84e085361b
Update custom.js
assets/js/custom.js
assets/js/custom.js
/** * Template Name: Eventoz * Version: 1.0 * Template Scripts * Author: MarkUps * Author URI: http://www.markups.io/ Custom JS 1. FIXED MENU 2. EVENT TIME COUNTER 3. MENU SMOOTH SCROLLING 4. VIDEO POPUP 5. SPEAKERS SLIDEER ( SLICK SLIDER ) 6. BOOTSTRAP ACCORDION 7. MOBILE MENU CLOSE **/ (function( $ ){ /* ----------------------------------------------------------- */ /* 1. FIXED MENU /* ----------------------------------------------------------- */ jQuery(window).bind('scroll', function () { if ($(window).scrollTop() > 150) { $('.mu-navbar').addClass('mu-nav-show'); } else { $('.mu-navbar').removeClass('mu-nav-show'); } }); /* ----------------------------------------------------------- */ /* 2. EVENT TIME COUNTER /* ----------------------------------------------------------- */ $('#mu-event-counter').countdown('2019/03/16').on('update.countdown', function(event) { var $this = $(this).html(event.strftime('' + '<span class="mu-event-counter-block"><span>%D</span> Days</span> ' + '<span class="mu-event-counter-block"><span>%H</span> Hours</span> ' + '<span class="mu-event-counter-block"><span>%M</span> Mins</span> ' + '<span class="mu-event-counter-block"><span>%S</span> Secs</span>')); }); /* ----------------------------------------------------------- */ /* 3. MENU SMOOTH SCROLLING /* ----------------------------------------------------------- */ //MENU SCROLLING WITH ACTIVE ITEM SELECTED // Cache selectors var lastId, topMenu = $(".mu-menu"), topMenuHeight = topMenu.outerHeight()+13, // All list items menuItems = topMenu.find('a[href^=\\#]'), // Anchors corresponding to menu items scrollItems = menuItems.map(function(){ var item = $($(this).attr("href")); if (item.length) { return item; } }); // Bind click handler to menu items // so we can get a fancy scroll animation menuItems.click(function(e){ var href = $(this).attr("href"), offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+22; jQuery('html, body').stop().animate({ scrollTop: offsetTop }, 1500); e.preventDefault(); }); // Bind to scroll jQuery(window).scroll(function(){ // Get container scroll position var fromTop = $(this).scrollTop()+topMenuHeight; // Get id of current scroll item var cur = scrollItems.map(function(){ if ($(this).offset().top < fromTop) return this; }); // Get the id of the current element cur = cur[cur.length-1]; var id = cur && cur.length ? cur[0].id : ""; if (lastId !== id) { lastId = id; // Set/remove active class menuItems .parent().removeClass("active") .end().filter("[href=\\#"+id+"]").parent().addClass("active"); } }) /* ----------------------------------------------------------- */ /* 4. VIDEO POPUP /* ----------------------------------------------------------- */ $('.mu-video-play-btn').on('click', function(event) { event.preventDefault(); $('.mu-video-iframe-area').addClass('mu-video-iframe-display'); }); // when click the close btn // disappear iframe window $('.mu-video-close-btn').on('click', function(event) { event.preventDefault(); $('.mu-video-iframe-area').removeClass('mu-video-iframe-display'); }); // stop iframe if it is play while close the iframe window $('.mu-video-close-btn').click(function(){ $('.mu-video-iframe').attr('src', $('.mu-video-iframe').attr('src')); }); // when click overlay area $('.mu-video-iframe-area').on('click', function(event) { event.preventDefault(); $('.mu-video-iframe-area').removeClass('mu-video-iframe-display'); }); $('.mu-video-iframe-area, .mu-video-iframe').on('click', function(e){ e.stopPropagation(); }); /* ----------------------------------------------------------- */ /* 5. SPEAKERS SLIDEER ( SLICK SLIDER ) /* ----------------------------------------------------------- */ $('.mu-speakers-slider').slick({ slidesToShow: 4, responsive: [ { breakpoint: 768, settings: { arrows: true, slidesToShow: 4 } }, { breakpoint: 480, settings: { arrows: true, slidesToShow: 4 } } ] }); /* ----------------------------------------------------------- */ /* 6. BOOTSTRAP ACCORDION /* ----------------------------------------------------------- */ /* Start for accordion #1*/ $('#accordion .panel-collapse').on('shown.bs.collapse', function () { $(this).prev().find(".fa").removeClass("fa-angle-up").addClass("fa-angle-down"); }); //The reverse of the above on hidden event: $('#accordion .panel-collapse').on('hidden.bs.collapse', function () { $(this).prev().find(".fa").removeClass("fa-angle-down").addClass("fa-angle-up"); }); /* ----------------------------------------------------------- */ /* 7. MOBILE MENU CLOSE /* ----------------------------------------------------------- */ jQuery('.mu-menu').on('click', 'li a', function() { $('.mu-navbar .in').collapse('hide'); }); })( jQuery );
JavaScript
0.000001
@@ -916,10 +916,10 @@ /03/ -16 +24 ').o @@ -5350,12 +5350,13 @@ y );%0A%0A%0A%0A %0A%09 +%0A
7cd3cd32e7574f24b37d01edd19ca3d7bd214438
version in templates in angular-route
assets/js/routes.js
assets/js/routes.js
/** * routes.js * Provides the routes for our frontend. * * @author Jason Valdron <[email protected]> * @package valdron */ (function(){ "use strict"; app.config([ '$routeProvider', function($routeProvider){ $routeProvider // GET / - Redirect to intro page. .when('/', { redirectTo: '/intro', key: 'intro' }) // GET /intro - Intro page - Quick overview of the portfolio. .when('/intro', { templateUrl: cdn + 'views/pages/intro.html', key: 'intro' }) // GET /resume - Resume page - Gets the resume information from the backend. .when('/resume', { templateUrl: cdn + 'views/pages/resume.html', controller: 'ResumeCtrl', key: 'resume' }) // GET /about/me - About page - More information about Jason Valdron. .when('/about/me', { templateUrl: cdn + 'views/pages/about/me.html', controller: 'AboutMeCtrl', key: 'about-me' }) // GET /about/portfolio - About page - More information about the portfolio. .when('/about/portfolio', { templateUrl: cdn + 'views/pages/about/portfolio.html', key: 'about-portfolio' }) // GET /projects - Projects page - Gets a listing of all the projects. .when('/projects', { templateUrl: cdn + 'views/pages/projects.html', controller: 'ProjectsCtrl', key: 'projects' }) // GET /experiences - Experiences page - Gets information from life/volunteer experiences. .when('/experiences', { templateUrl: cdn + 'views/pages/experiences.html', controller: 'ExperiencesCtrl', key: 'experiences' }) // GET /experience/:id - Experience page - Gets detailled information from one life/volunteer experience. .when('/experience/:id', { templateUrl: cdn + 'views/pages/experience-detailled.html', controller: 'ExperienceDetailledCtrl', key: 'experiences' }) // GET /errors/404 - Page Not Found. .when('/errors/404', { templateUrl: cdn + 'views/errors/404.html', key: 'error' }) .otherwise({ redirectTo: '/errors/404' }); }]); // Dynamically adjust the titles and propagate the current page to the rootScope. app.run([ '$rootScope', 'i18ng', function($rootScope, i18ng){ $rootScope.$on('$routeChangeSuccess', function(e, current, previous){ document.title = i18ng.t(current.$$route.key + '.title'); $rootScope.currentPage = current.$$route.key; $('body').trigger('routeChange'); }); }]); })();
JavaScript
0
@@ -517,25 +517,38 @@ s/intro.html -' +?v=' + version ,%0D%0A k @@ -729,25 +729,38 @@ /resume.html -' +?v=' + version ,%0D%0A c @@ -974,25 +974,38 @@ bout/me.html -' +?v=' + version ,%0D%0A c @@ -1243,25 +1243,38 @@ rtfolio.html -' +?v=' + version ,%0D%0A k @@ -1463,25 +1463,38 @@ rojects.html -' +?v=' + version ,%0D%0A c @@ -1739,25 +1739,38 @@ riences.html -' +?v=' + version ,%0D%0A c @@ -2048,25 +2048,38 @@ tailled.html -' +?v=' + version ,%0D%0A c @@ -2280,17 +2280,30 @@ 404.html -' +?v=' + version ,%0D%0A
3902ea9d09bcc62b4f923b876110542a38fabea9
Test skip_neutral_temps mode (#140)
tests/set-temp-basal.test.js
tests/set-temp-basal.test.js
'use strict'; require('should'); describe('setTempBasal', function ( ) { var setTempBasal = require('../lib/basal-set-temp'); //function setTempBasal(rate, duration, profile, requestedTemp) var profile = { "current_basal":0.8,"max_daily_basal":1.3,"max_basal":3.0 }; var rt = {}; it('should cancel temp', function () { var requestedTemp = setTempBasal(0, 0, profile, rt); requestedTemp.rate.should.equal(0); requestedTemp.duration.should.equal(0); }); it('should set zero temp', function () { var requestedTemp = setTempBasal(0, 30, profile, rt); requestedTemp.rate.should.equal(0); requestedTemp.duration.should.equal(30); }); it('should set high temp', function () { var requestedTemp = setTempBasal(2, 30, profile, rt); requestedTemp.rate.should.equal(2); requestedTemp.duration.should.equal(30); }); it('should limit high temp to max_basal', function () { var requestedTemp = setTempBasal(4, 30, profile, rt); requestedTemp.rate.should.equal(3); requestedTemp.duration.should.equal(30); }); it('should limit high temp to 3 * max_daily_basal', function () { var profile = { "current_basal":1.0,"max_daily_basal":1.3,"max_basal":10.0 }; var requestedTemp = setTempBasal(6, 30, profile, rt); requestedTemp.rate.should.equal(3.9); requestedTemp.duration.should.equal(30); }); it('should limit high temp to 4 * current_basal', function () { var profile = { "current_basal":0.7,"max_daily_basal":1.3,"max_basal":10.0 }; var requestedTemp = setTempBasal(6, 30, profile, rt); requestedTemp.rate.should.equal(2.8); requestedTemp.duration.should.equal(30); }); it('should temp to 0 when requested rate is less then 0 * current_basal', function () { var profile = { "current_basal":0.7,"max_daily_basal":1.3,"max_basal":10.0 }; var requestedTemp = setTempBasal(-1, 30, profile, rt); requestedTemp.rate.should.equal(0); requestedTemp.duration.should.equal(30); }); });
JavaScript
0
@@ -908,32 +908,521 @@ l(30);%0A %7D);%0A%0A + it('should not set basal on skip neutral mode', function () %7B%0A profile.skip_neutral_temps = true;%0A var rt2 = %7B%7D;%0A var current = %7Bduration: 10%7D;%0A var requestedTemp = setTempBasal(0.8, 30, profile, rt2, current);%0A requestedTemp.duration.should.equal(0);%0A var requestedTemp = setTempBasal(0.8, 30, profile, %7B%7D);%0A requestedTemp.reason.should.equal('Suggested rate is same as profile rate, no temp basal is active, doing nothing');%0A %7D);%0A%0A it('should l
3ff24938832dea32a89bec3a97cf9a24868ad843
Update search.js
assets/js/search.js
assets/js/search.js
var searchData; $(document).ready(function() { window.idx = lunr(function () { this.field('title'); this.field('excerpt'); this.field('content', {boost: 10}); }); window.data = $.getJSON('/searchposts.json'); searchData = window.data; window.data.then(function(loaded_data){ $.each(loaded_data, function(index, value){ window.idx.add($.extend({ "id": index }, value)); }); }); $("#search-box").keydown(function(event) { // event.preventDefault(); var query = $("#search-box").val(); var results = window.idx.search(query); var resultsdiv = $("#search-results") resultsdiv.empty(); var id; var fragment; var data; results.forEach(function(element) { id = element.ref; data = window.data[id]; fragment = '<div class="result-item">' + '<div class="search-result-item-title"><a href="' + data.url + '">' + data.title + '</a></div>' + '<div class="search-result-item-excerpt">' + data.excerpt + '</div>' + '</div>'; resultsdiv.append(fragment); }); }); });
JavaScript
0.000001
@@ -229,16 +229,68 @@ '); %0A + $.getJSON('/searchposts.json', function(json) %7B%0A search @@ -296,27 +296,26 @@ hData = -window.data +json;%0A %7D) ;%0A %0A w
b07b2bd7f2740c66f540da15e3855158c92315a0
add ajax request to retrieve the tasks of the active folder in Folders view
client/index.js
client/index.js
var index = { 'folderList': '.row > .col-md-6:first-child > ul', 'taskList': '.row > .col-md-6:nth-child(2) > ul' } $(document).ready(function() { $('#folderSave').on('click', function() { $.ajax({ url: '/api/folders/add', type: 'post', data: {"folder": $('#folderName').val()}, statusCode: { 200: function(res) { console.log("Valid directory!"); }, 201: function(res) { console.log("Valid directory!"); }, 400: function(res) { console.log("Not a valid directory!"); }, 420: function(res) { console.log("Not a valid directory"); } } }); }); $('#taskSave').on('click', function() { var folderName = $(index.folderList).children().find('.active-folder').find('h3').html(); var folderPath = $(index.folderList).children().find('.active-folder').find('p').find('i').html(); var rules = []; $('#ruleList').children().each(function() { var selects = $(this).find('select'); var self = this; rules.push({ "type": $(selects[0]).val(), "comparator": $(selects[1]).val(), "reference": $(self).find('input').val(); }); }); $.ajax({ url: '/api/tasks/add', type: 'post', dataType: 'json', data: { "folderName": folderName, "folderPath": folderPath, "taskName": $('#taskName').val(), "taskDescription": $('#taskDescription').val(), "matchAll": $('#taskMatch').val() === 'All', "interval": $('#taskInterval').val(), "rules": JSON.stringify(rules) }, statusCode: { 200: function(res) { console.log("Task saved!"); } } }); }); $(index.folderList).children().each(function() { $(this).on('click', function() { console.log($(this).siblings()); $(this).siblings().find('div').removeClass('active-folder'); $(this).find('div').addClass('active-folder'); }); }); $('#addRule').on('click', function() { console.log($('#ruleList')); $('#ruleList') .append('<li>'+ '<button role="button" class="pull-left btn btn-danger"> - </button>'+ '<select class="col-md-3">'+ '<option value="filename"> Filename </option>'+ '<option value="extension"> Extension </option>'+ '</select>'+ '<select class="col-md-3">'+ '<option value="equals"> Equals </option>'+ '<option value="contains"> Contains </option>'+ '<option value="doesNotEquals"> Does not equals </option>'+ '<option value="doesNotContain"> Does not contain </option>'+ '</select>'+ '<input type="text" placeholder="Match">'+ '</li>' ); //Add eventlistener on each new delete button $('#ruleList').last().find('button').each(function() { $(this).on('click', function() { $(this).parent().remove(); }) }) }); });
JavaScript
0
@@ -2012,24 +2012,607 @@ ve-folder'); +%0A%0A var folderName = $(index.folderList).children().find('.active-folder').find('h3').html();%0A var folderPath = $(index.folderList).children().find('.active-folder').find('p').find('i').html();%0A%0A var query = $.param(%7B%0A %22folderName%22: folderName,%0A %22folderPath%22: folderPath%0A %7D);%0A%0A console.log(query);%0A%0A $.ajax(%7B%0A url: '/api/tasks/get?'+query,%0A type: 'get',%0A statusCode: %7B%0A 200: function(res) %7B%0A console.log(%22Loaded tasks!%22);%0A console.log(JSON.parse(res)%5B0%5D);%0A%0A %7D%0A %7D%0A %7D); %0A %7D);%0A %7D
feafe5753a6012514a56bec8252b55589c0e048d
Handle meatspace active counts.
client/index.js
client/index.js
var $ = require('jquery') , io = require('socket.io-client')() , initWebrtc = require('./init-webrtc') , captureFrames = require('./capture-frames') , cuid = require('cuid') , Fingerprint = require('fingerprintjs') io.on('connect', function() { io.emit('fingerprint', new Fingerprint({ canvas: true }).get()) // TODO(tec27): Pick this based on browser/OS considerations io.emit('join', 'webm') }) var MESSAGE_LIMIT = 30 var messageList = $('#message-list') io.on('chat', function(chat) { var listItem = $('<li/>') , video = $('<video autoplay loop />') , chatText = $('<p/>') , colorId = $('<div class="color-id" />') var blob = new Blob([ chat.video ], { type: chat.videoMime }) , url = window.URL.createObjectURL(blob) video.attr('src', url) colorId.css('background-color', '#' + chat.userId.substring(0, 6)) chatText.text(chat.text) listItem.append(video).append(chatText).append(colorId) var autoScroll = $(window).scrollTop() + $(window).height() + 32 > $(document).height() messageList.append(listItem) if (autoScroll) { var children = messageList.children() if (children.length > MESSAGE_LIMIT) { children.slice(0, children.length - MESSAGE_LIMIT).each(function() { $(this).remove() }) } listItem[0].scrollIntoView() } }).on('active', function(numActive) { $('#active-users').text(numActive) }) var messageInput = $('#message') , awaitingAck = null $('form').on('submit', function(event) { event.preventDefault() captureFrames($('#preview')[0], { format: 'image/jpeg' }, function(err, frames) { if (err) { return console.error(err) } awaitingAck = cuid() var message = { text: messageInput.val(), format: 'image/jpeg', ack: awaitingAck } io.emit('chat', message, frames) messageInput.val('') }).on('progress', function(percentDone) { console.log('progress: ' + percentDone) }) }) io.on('ack', function(ack) { if (awaitingAck && awaitingAck == ack.key) { awaitingAck = null if (ack.err) { // TODO(tec27): display to user console.log('Error: ' + ack.err) } } }) initWebrtc($('#preview')[0], 200, 150, function(err, stream) { if (err) { // TODO(tec27): display something to user depending on error type console.dir(err) return } // TODO(tec27): save stream so it can be stopped later to allow for camera switches })
JavaScript
0
@@ -219,16 +219,55 @@ ntjs')%0A%0A +var active = 0%0A , meatspaceActive = 0%0A io.on('c @@ -443,16 +443,106 @@ 'webm')%0A +%7D).on('disconnect', function() %7B%0A active = 0%0A meatspaceActive = 0%0A updateActiveUsers()%0A %7D)%0A%0Avar @@ -560,17 +560,16 @@ IT = 30%0A -%0A var mess @@ -1481,16 +1481,314 @@ tive) %7B%0A + active = numActive%0A updateActiveUsers()%0A%7D).on('meatspaceActive', function(numActive) %7B%0A meatspaceActive = numActive%0A updateActiveUsers()%0A%7D).on('meatspace', function(status) %7B%0A if (status != 'connected') %7B%0A meatspaceActive = 0%0A updateActiveUsers()%0A %7D%0A%7D)%0A%0Afunction updateActiveUsers() %7B%0A $('#ac @@ -1803,27 +1803,136 @@ rs') +%0A .text( -numActive +active + meatspaceActive)%0A .attr('title', active + ' active seat.camp users, ' + meatspaceActive + ' meatspace' )%0A%7D -) %0A%0Ava
485c8e50189903b4f100a03fb95528fca5d0818b
check broadcastEvent
plugins/broadcaster/broadcastEventListener.js
plugins/broadcaster/broadcastEventListener.js
/** * Created by michael on 4/16/15. */ var broadcastEventListener = function($){ 'use strict'; var startIframeBroadcastListener = function() { var iframeBroadCastListener = function(event){ if (event.origin === window.location.origin) { if(event.data!=undefined && event.data.type=="eventBroadcast") { console.log("got eventBroadcast event:"+JSON.stringify(event.data)); if (broadcastMapper[event.data.data.event] != undefined) { broadcastMapper[event.data.data.event](event.data.data.optionalParams); } else { console.info("broadcastMapper doesn't have " + event.data.data.event + " mapping"); } } } }; if (window.addEventListener) { addEventListener("message", iframeBroadCastListener, false) } else { attachEvent("onmessage", iframeBroadCastListener) } }; return { startIframeBroadcastListener:startIframeBroadcastListener } }(jQuery);
JavaScript
0
@@ -698,16 +698,23 @@ r) %7B%0A%09%09%09 +window. addEvent @@ -764,16 +764,17 @@ , false) +; %0A%09%09%7D els @@ -780,16 +780,23 @@ se %7B%0A%09%09%09 +window. attachEv @@ -836,16 +836,17 @@ istener) +; %0A%09%09%7D%0A%09%7D;
c0da8d1466c46224ff866b4d17e7568fdb4d7e95
add booleanCheckboxFa cmTemplate
plugins/jQuery.jqGrid.checkboxFontAwesome4.js
plugins/jQuery.jqGrid.checkboxFontAwesome4.js
/** * Copyright (c) 2013, Oleg Kiriljuk, [email protected] * Dual licensed under the MIT and GPL licenses * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl-2.0.html * Date: 2012-01-19 * see http://stackoverflow.com/a/20165553/315935 for more details */ /*global jQuery */ (function ($) { "use strict"; /*jslint unparam: true */ $.extend($.fn.fmatter, { checkboxFontAwesome4: function (cellValue, options) { var title = options.colModel.title !== false ? ' title="' + (options.colName || options.colModel.label || options.colModel.name) + '"' : '', strCellValue = String(cellValue).toLowerCase(), editoptions = options.colModel.editoptions, editYes = editoptions != null && typeof editoptions.value === "string" ? editoptions.value.split(":")[0] : "yes"; return (cellValue === 1 || strCellValue === "1" || cellValue === true || strCellValue === "true" || strCellValue === "yes" || strCellValue === editYes) ? '<i class="fa fa-check-square-o fa-lg"' + title + '></i>' : '<i class="fa fa-square-o fa-lg"' + title + '></i>'; } }); $.extend($.fn.fmatter.checkboxFontAwesome4, { unformat: function (cellValue, options, elem) { var cbv = (options.colModel.editoptions != null && options.colModel.editoptions.value) ? options.colModel.editoptions.value.split(":") : ["Yes", "No"]; return $(">i", elem).hasClass("fa-check-square-o") ? cbv[0] : cbv[1]; } }); }(jQuery));
JavaScript
0.000001
@@ -1177,16 +1177,782 @@ %7D);%0A +%09$.extend(true,$.jgrid, %7B%0A%09%09cmTemplate: %7B%0A%09%09%09booleanCheckboxFa: %7B%0A%09%09%09%09align: %22center%22, formatter: %22checkboxFontAwesome4%22,%0A%09%09%09%09edittype: %22checkbox%22, editoptions: %7Bvalue: %22true:false%22, defaultValue: %22false%22%7D,%0A%09%09%09%09convertOnSave: function (nData, cm) %7B%0A%09%09%09%09%09var lnData = String(nData).toLowerCase(),%0A%09%09%09%09%09%09cbv = cm.editoptions != null && typeof cm.editoptions.value === %22string%22 ?%0A%09%09%09%09%09%09%09cm.editoptions.value.split(%22:%22) : %5B%22yes%22,%22no%22%5D;%0A%0A%09%09%09%09%09if ($.inArray(lnData, %5B%221%22, %22true%22, cbv%5B0%5D.toLowerCase()%5D) %3E= 0) %7B%0A%09%09%09%09%09%09nData = true;%0A%09%09%09%09%09%7D else if ($.inArray(lnData, %5B%220%22, %22false%22, cbv%5B1%5D.toLowerCase()%5D) %3E= 0) %7B%0A%09%09%09%09%09%09nData = false;%0A%09%09%09%09%09%7D%0A%09%09%09%09%09return nData;%0A%09%09%09%09%7D,%0A%09%09%09%09stype: %22select%22, searchoptions: %7B sopt: %5B%22eq%22, %22ne%22%5D, value: %22:Any;true:Yes;false:No%22 %7D%0A%09%09%09%7D,%0A%09%09%7D%0A%09%7D);%0A $.ex
e4c800d6c251fc6126cd32cec4101b7098392c9d
update bucketMetadata (#2031)
samples/bucketMetadata.js
samples/bucketMetadata.js
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. 'use strict'; // sample-metadata: // title: Storage Get Bucket Metadata. // description: Get bucket metadata. // usage: node bucketMetadata.js <BUCKET_NAME> function main(bucketName = 'my-bucket') { // [START storage_get_bucket_metadata] // Imports the Google Cloud client library const {Storage} = require('@google-cloud/storage'); // Creates a client const storage = new Storage(); async function getBucketMetadata() { /** * TODO(developer): Uncomment the following lines before running the sample. */ // The ID of your GCS bucket // const bucketName = 'your-unique-bucket-name'; // Get Bucket Metadata const [metadata] = await storage.bucket(bucketName).getMetadata(); for (const [key, value] of Object.entries(metadata)) { console.log(`${key}: ${value}`); } } // [END storage_get_bucket_metadata] getBucketMetadata().catch(console.error); } main(...process.argv.slice(2));
JavaScript
0
@@ -1316,107 +1316,55 @@ -for (const %5Bkey, value%5D of Object.entries(metadata)) %7B%0A console.log(%60$%7Bkey%7D: $%7Bvalue%7D%60);%0A %7D +console.log(JSON.stringify(metadata, null, 2)); %0A %7D
8224f7d31e749a0362a5d6673849db8cfa79fd7a
use $(target).offset().top instead of $(target)[0].getBoundingClientRect().top
pontus/dace_ui_extension/static/daceui/api.js
pontus/dace_ui_extension/static/daceui/api.js
function after_execution(url){ $.getJSON(url, {}, function(data) {}); }; function update_action(url){ var toreplay = $(this).closest('.dace-action').data('toreplay'); var target = $(this).closest('.dace-action').data('target')+'-modal'; if (Boolean(toreplay)){$(target).modal('show'); return false} var url = $(this).closest('.dace-action').data('updateurl'); $.getJSON(url,{tomerge:'True', coordinates:'main'}, function(data) { var action_body = data['body']; if (action_body){ $($(target).find('.modal-body')).html(action_body); $(target).modal('show'); try { deform.processCallbacks(); } catch(err) {}; }else{ location.reload(); return false } }); return false; }; $(function() { $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) { // Avoid following the href location when clicking event.preventDefault(); // Avoid having the menu to close when clicking event.stopPropagation(); // If a menu is already open we close it //$('ul.dropdown-menu [data-toggle=dropdown]').parent().removeClass('open'); // opening the one you clicked on $(this).parent().addClass('open'); var menu = $(this).parent().find("ul"); var menupos = menu.offset(); if ((menupos.left + menu.width()) + 30 > $(window).width()) { var newpos = - menu.width(); } else { var newpos = $(this).parent().width(); } menu.css({ left:newpos }); }); $(document).on('click', '.pager li a', function() { var target = $(this).closest('.pager').data('target'); var url = $(this).attr('href'); $.get(url, {}, function(data) { $(target).html($(data).find(target).html()); $("html, body").animate({ scrollTop: $(target)[0].getBoundingClientRect().top }, "slow"); }); return false; }); $(document).on('click', '.dace-action', update_action); $('.current-iteration').addClass('success'); $('.toggle').on('click', function() { $($(this).data('target')).toggle().toggleClass('out').toggleClass('in'); }); $($('.toggle').data('target')+'.out').hide(); });
JavaScript
0.000005
@@ -499,18 +499,17 @@ (data) %7B - %0A + @@ -1185,17 +1185,16 @@ fault(); - %0A // @@ -1266,17 +1266,16 @@ ation(); - %0A // @@ -1548,19 +1548,17 @@ fset();%0A - %0A + if ( @@ -1651,22 +1651,16 @@ width(); - %0A %7D e @@ -2087,32 +2087,14 @@ get) -%5B0%5D.getBoundingClientRec +.offse t().
fa85252d487ac17eb8abd04ca1e0afa2bd28f3bb
fix keepFirstIntermediateValue test
tests/unit/buffering-test.js
tests/unit/buffering-test.js
import Ember from 'ember'; import { forEach } from 'ember-concurrency'; import { interval, dropIntermediateValues, keepFirstIntermediateValue } from 'ember-concurrency'; const Observable = window.Rx.Observable; const { range, just, } = Observable; // 1 2 3 4 5 (150ms) 101 102 103 104 105 let rangeObservable = Observable.concat( range(1,5), range(101,5).delay(150) ); // 1 (5ms) 2 3 (100ms) 4 5 6 let sporadicObservable = Observable.concat( just(1), just(2).delay(5), just(3), just(4).delay(100), just(5), just(6) ); module('Unit: buffering'); function doBufferingTest(description, observable, bufferPolicyFn, expectations) { test(description, function(assert) { QUnit.stop(); assert.expect(1); let last = expectations[expectations.length-1]; let arr = []; Ember.run(() => { let obj = Ember.Object.create(); forEach(observable, function * (v) { bufferPolicyFn(); arr.push(v); yield interval(10); if (v === last) { Ember.run.later(() => { QUnit.start(); assert.deepEqual(arr, expectations); }, 20); } }).attach(obj); }); }); } doBufferingTest("no buffering: ranges", rangeObservable, Ember.K, [1,2,3,4,5,101,102,103,104,105]); doBufferingTest("no buffering: sporadic", sporadicObservable, Ember.K, [1,2,3,4,5,6]); doBufferingTest("dropIntermediateValues: ranges", rangeObservable, dropIntermediateValues, [1,101]); doBufferingTest("dropIntermediateValues: sporadic", sporadicObservable, dropIntermediateValues, [1,4]); doBufferingTest("keepFirstIntermediateValue: ranges", rangeObservable, keepFirstIntermediateValue, [1, 2, 101, 102]); doBufferingTest("keepFirstIntermediateValue: ranges", rangeObservable, dropIntermediateValues, [1,101]);
JavaScript
0
@@ -380,17 +380,17 @@ %0A%0A// 1 ( -5 +2 ms) 2 3 @@ -1755,36 +1755,41 @@ angeObservable, -drop +keepFirst IntermediateValu @@ -1785,26 +1785,31 @@ mediateValue -s , %5B1, +2, 101 +,102 %5D);%0A%0A
854b8ace10699da3a47752a1c9c4441ddd0701ab
Update moves.js
mods/priomon/moves.js
mods/priomon/moves.js
exports.BattleMovedex = { "flameshot": { num: 2000, accuracy: 100, basePower: 40, category: "Physical", desc: "Deals damage to one adjacent target. Priority +1.", shortDesc: "Usually goes first.", id: "Flame Shot", isViable: true, name: "Flame Shot", pp: 30, priority: 1, secondary: false, target: "normal", type: "Fire" }, "sapblast": { num: 2001, accuracy: 100, basePower: 40, category: "Physical", desc: "Deals damage to one adjacent target. Priority +1.", shortDesc: "Usually goes first.", id: "Sap Blast", isViable: true, name: "Sap Blast", pp: 30, priority: 1, secondary: false, target: "normal", type: "Grass" }, "kineticforce": { num: 2002, accuracy: 100, basePower: 40, category: "Special", desc: "Deals damage to one adjacent target. Priority +1.", shortDesc: "Usually goes first.", id: "Kinetic Force", isViable: true, name: "Kinetic Force", pp: 30, priority: 1, secondary: false, target: "normal", type: "Psychic" }, "stonespine": { num: 2003, accuracy: 90, basePower: 55, category: "Physical", desc: "Deals damage to one adjacent target. Priority +1.", shortDesc: "Usually goes first.", id: "Stone Spine", isViable: true, name: "Stone Spine", pp: 30, priority: 1, secondary: false, target: "normal", type: "Rock" }, "dracocrash": { num: 2004, accuracy: 90, basePower: 50, category: "Physical", desc: "Deals damage to one adjacent target. Priority +1.", shortDesc: "Usually goes first.", id: "Draco Crash", isViable: true, name: "Draco Crash", pp: 30, priority: 2, secondary: false, target: "normal", type: "Dragon" }, "fairywind": { num: 584, accuracy: 100, basePower: 40, category: "Special", desc: "Deals damage to one adjacent target.", shortDesc: "No additional effect.", id: "fairywind", name: "Fairy Wind", pp: 30, priority: 1, secondary: false, target: "normal", type: "Fairy" }, };
JavaScript
0.000001
@@ -1733,32 +1733,439 @@ agon%22%0A%09 %7D,%0A +%09 %22venomstrike%22: %7B%0A%09%09num: 2005,%0A%09%09accuracy: 100,%0A%09%09basePower: 30,%0A%09%09category: %22Physical%22,%0A%09%09desc: %22Deals damage to one adjacent target.%22,%0A%09%09shortDesc: %22Usually goes first, 30%25 chance to badly poison the target.%22,%0A%09%09id: %22Venom Strike%22,%0A%09%09name: %22Venom Strike%22,%0A%09%09pp: 30,%0A%09%09priority: 1,%0A%09%09isContact: true,%0A%09%09secondary: %7B%0A%09%09%09chance: 30,%0A%09%09%09status: 'tox'%0A%09%09%7D,%0A%09%09target: %22normal%22,%0A%09%09type: %22Poison%22%0A%09 %7D,%0A %09 %22fairywin @@ -2166,24 +2166,24 @@ irywind%22: %7B%0A - %09%09num: 584,%0A @@ -2305,27 +2305,25 @@ c: %22 -No additional effec +Usually goes firs t.%22,
27f8d6247dd304864f49b3dae45813fd539fe6f9
Fix mail sending when rendering the ejs
services/boot/sendgrid.js
services/boot/sendgrid.js
/* Copyright 2017 Agneta Network Applications, LLC. * * Source file: services/boot/sendgrid.js * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var DataSource = require('loopback-datasource-juggler').DataSource; var utils = require('loopback/lib/utils'); var _ = require('lodash'); module.exports = function(app) { var config = app.get('email'); if (!config) { throw new Error('No Email config is present'); } //-------------------------------------------------------------- var subjectPrefix = _.get(config,'subject.prefix') || ''; //-------------------------------------------------------------- var dataSource; if (config.sendgrid) { dataSource = new DataSource('loopback-connector-sendgrid', { api_key: config.sendgrid.apiKey }); } if (!dataSource) { throw new Error('Must have an email datasource'); } app.loopback.Email.attachTo(dataSource); var emailSend = app.loopback.Email.send; app.loopback.Email.send = function(options, cb) { cb = cb || utils.createPromiseCallback(); options.from = options.from || config.contacts.default; //------- if (!options.req) { return cb(new Error('Must have a request object to send email')); } options.language = app.getLng(options.req); //------- options.sender = options.from; if (_.isString(options.from)) { options.sender = { email: options.from }; } options.from = options.sender.email; //------- options.receiver = options.to; if (_.isString(options.to)) { options.receiver = { email: options.to }; } options.to = options.receiver.email; //------- _.extend(options.data, { info: config.info, language: options.language }); /////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////// var template = config.templates[options.templateName]; if (template) { template.render(options.data) .then(function(renderResult) { options.html = renderResult.html; options.text = renderResult.text; send(); }) .catch(cb); } else { send(); } /////////////////////////////////////////////////////////////// function send() { options.text = options.text || config.text(options.html); //---------------------------------- var subject = options.subject || template.data.subject; if (_.isObject(subject)) { subject = app.lng(subject, options.language); } options.subject = app.lng(subjectPrefix,options.language) + subject; //---------------------------------- emailSend.call(app.loopback.Email, options) .catch(function(err) { console.error(err); }); } return cb.promise; }; };
JavaScript
0.000001
@@ -2532,16 +2532,35 @@ %7B%0A + var renderResult = templat @@ -2585,53 +2585,11 @@ ata) -%0A .then(function(renderResult) %7B%0A%0A +;%0A%0A @@ -2630,20 +2630,16 @@ ;%0A - - options. @@ -2673,69 +2673,11 @@ - send();%0A %7D)%0A .catch(cb);%0A%0A %7D else %7B%0A +%7D %0A @@ -2683,22 +2683,16 @@ send(); -%0A %7D %0A%0A //
a3551fa8199b2878379f545eb2842adcdb7a2604
Allow browsing of all mDNS services if no type specified
clients/mdns.js
clients/mdns.js
var mdns = require('mdns'), EventEmitter = require('events').EventEmitter, serviceType = mdns.makeServiceType({name: 'http', protocol: 'tcp'}); module.exports.create = function (urn) { var instance = new EventEmitter(), urn = urn ? urn : serviceType, browser = urn ? mdns.createBrowser(urn) : mdns.browseThemAll(), started = false; browser.on('serviceUp', function(msg) { // console.log(msg); var output = { id: msg.fullname, type: msg.type.toString(), location: msg.addresses ? msg.addresses[1] : '', server: msg.host, timestamp: new Date(), state: 'serviceup', protocol: 'MDNS' }; if(output.id) { instance.emit('*', output); } }); browser.on('serviceDown', function(msg) { // console.log(msg); var output = { id: msg.name + '.' + msg.type.toString() + msg.replyDomain, type: msg.type.toString(), location: msg.addresses ? msg.addresses[1] : '', server: msg.host, timestamp: new Date(), state: 'servicedown', protocol: 'MDNS' }; if(output.id) { instance.emit('*', output); } }); instance.start = function () { if(!started) { browser.start(); started = true; } } return instance; }
JavaScript
0
@@ -72,16 +72,35 @@ mitter,%0A + browsers = %7B%7D;%0A serv @@ -199,19 +199,23 @@ nction ( -urn +service ) %7B%0A va @@ -257,207 +257,1488 @@ -urn = urn ? urn : serviceType,%0A browser = urn ? mdns.createBrowser(urn) : mdns.browseThemAll(),%0A started = false;%0A%0A browser.on('serviceUp', function(msg) %7B%0A // console.log +browser,%0A started;%0A%0A // If browser exists for service%0A if ( service && browsers%5Bservice%5D ) %7B%0A browsers%5Bservice%5D.on('serviceUp', createServiceUpHandler(instance));%0A browsers%5Bservice%5D.on('serviceDown', createServiceDownHandler(instance));%0A // If no browser for service%0A %7D else if ( service ) %7B%0A browsers%5Bservice%5D = createBrowserWithHandlers(service, instance);%0A // Browse everything %0A %7D else %7B%0A service = '*';%0A browsers%5Bservice%5D = mdns.browseThemAll();%0A browsers%5Bservice%5D.on('serviceUp', function (msg) %7B%0A var service = mdns.makeServiceType(%0A %7B name: msg.type.name, protocol: msg.type.protocol %7D%0A );%0A browsers%5Bservice%5D = createBrowserWithHandlers(service, instance);%0A if (started) %7B%0A browsers%5Bservice%5D.start();%0A browsers%5Bservice%5D.started = true;%0A %7D%0A %7D);%0A %7D%0A%0A instance.start = function () %7B%0A Object.keys(browsers).forEach(function (service) %7B%0A if(!browsers%5Bservice%5D.started) %7B%0A browsers%5Bservice%5D.start();%0A browsers%5Bservice%5D.started = true; %0A %7D%0A %7D);%0A started = true;%0A %7D%0A%0A return instance;%0A%7D%0A%0Afunction createBrowserWithHandlers(service, instance) %7B%0A var type = mdns.makeServiceType(service);%0A var browser = mdns.createBrowser(type);%0A browser.on('serviceUp', createServiceUpHandler(instance));%0A browser.on('serviceDown', createServiceDownHandler(instance));%0A return browser;%0A%7D%0A%0Afunction createServiceUpHandler(instance) %7B%0A return function serviceUp (msg) -;%0A + %7B %0A @@ -2042,81 +2042,94 @@ %0A %7D -);%0A%0A browser.on('serviceDown', function(msg) %7B%0A // console.log +%0A%7D%0A%0Afunction createServiceDownHandler(instance) %7B%0A return function serviceDown (msg) -;%0A + %7B %0A @@ -2477,139 +2477,7 @@ %0A %7D -);%0A %0A instance.start = function () %7B%0A if(!started) %7B%0A browser.start();%0A started = true; %0A %7D%0A %7D%0A %0A return instance; %0A%7D +%0A
92513a0bd9d4f40d0cb1817ce17add3588d756a9
Fix broken test
source/components/Editable.test.js
source/components/Editable.test.js
import React from 'react' import ReactDOM from 'react-dom' import { Simulate } from 'react-dom/test-utils' import Editable from './Editable' describe('Editable', () => { let parent = null let component = null let rendered = null function render(element) { ReactDOM.render(element, parent) } beforeEach(() => { parent = document.createElement('div') component = ReactDOM.render(<Editable />, parent) // eslint-disable-next-line react/no-find-dom-node rendered = () => ReactDOM.findDOMNode(component) }) it('renders classes properly', () => { render(<Editable className="test-class" />) expect(rendered().classList.contains('editable')).toEqual(true) expect(rendered().classList.contains('test-class')).toEqual(true) render(<Editable readonly />) expect(rendered().classList.contains('readonly')).toEqual(true) }) it('raises change events properly', () => { const onChange = jest.genMockFunction() render(<Editable value="first" onChange={onChange} />) component.handleToggleEditing() const editor = rendered().children[0] expect(editor.value).toEqual('first') Simulate.change(editor, { target: { value: 'second' } }) Simulate.blur(editor) expect(onChange).toBeCalledWith('second', 'first') }) it('renders checkboxes properly', () => { const onChange = jest.fn() function validateCheckbox() { expect(rendered().children.length).toEqual(1) const checkbox = rendered().children[0] expect(checkbox.tagName).toEqual('INPUT') expect(checkbox.type).toEqual('checkbox') return checkbox } // eslint-disable-next-line react/jsx-boolean-value render(<Editable value={true} onChange={onChange} />) expect(component.getEditorType()).toEqual('boolean') validateCheckbox() render(<Editable value="test" type="boolean" onChange={onChange} />) expect(component.getEditorType()).toEqual('boolean') const checkbox = validateCheckbox() Simulate.change(checkbox, { target: { value: false } }) expect(onChange).toBeCalledWith(false, 'test') }) })
JavaScript
0.000255
@@ -939,22 +939,9 @@ est. -genMockFunctio +f n()%0A
9e3b9748de1a1114d17fe1dcb634056941ae191c
Update how we set the dirty state in form-server-validation component.
components/form/form-server-validation-directive.js
components/form/form-server-validation-directive.js
angular.module( 'gj.Form' ).directive( 'gjFormServerValidation', function() { // Don't create a new scope. // This allows it to work with other directives. return { restrict: 'A', require: 'ngModel', link: function( scope, elem, attr, ngModel ) { /** * Any time the server response updates, check to see if this form control is invalid. * If it is, we set it as invalid. */ scope.$watchCollection( attr.gjFormServerValidation, function( serverResponse ) { if ( angular.isDefined( serverResponse ) && serverResponse ) { if ( angular.isDefined( attr.name ) && angular.isDefined( serverResponse[attr.name] ) ) { // Set the 'server' key as invalid. // This is a generic key saying that the server rejected the value. ngModel.$setValidity( 'server', false ); // We set the view value to itself to set it as dirty. // This will force show the server error message since it thinks that it's invalid // and the value has changed. ngModel.$setViewValue( ngModel.$viewValue ); } } } ); /** * Any time the value of the input changes, simply set the validity back to true. * This clears out the server error whenever they change it. */ ngModel.$viewChangeListeners.push( function() { if ( angular.isDefined( ngModel.$error.server ) && ngModel.$error.server ) { ngModel.$setValidity( 'server', true ); // Clear out the actual error from the serverErrors object now that we've dealt with it. if ( angular.isDefined( scope[attr.gjFormServerValidation] ) ) { if ( angular.isDefined( attr.name ) && angular.isDefined( scope[attr.gjFormServerValidation][attr.name] ) ) { delete scope[attr.gjFormServerValidation][attr.name]; } } } } ); } }; } );
JavaScript
0
@@ -493,47 +493,8 @@ if ( - angular.isDefined( serverResponse ) && ser @@ -793,38 +793,13 @@ the -view value to itself to set it +model as @@ -952,38 +952,14 @@ $set -ViewValue( ngModel.$viewValue +Dirty( );%0A%09 @@ -1701,12 +1701,13 @@ %09%09%7D%0A%09%7D;%0A%7D ); +%0A
6af46ce028634e36f9773d79c518b349e9853827
Use Model.remoteMethod instead of loopback's fn.
models/todo.js
models/todo.js
var loopback = require('loopback'); var async = require('async'); module.exports = function(Todo/*, Base*/) { Todo.definition.properties.created.default = Date.now; Todo.beforeSave = function(next, model) { if (!model.id) model.id = 't-' + Math.floor(Math.random() * 10000).toString(); next(); }; Todo.stats = function(filter, cb) { var stats = {}; cb = arguments[arguments.length - 1]; var Todo = this; async.parallel([ countComplete, count ], function(err) { if (err) return cb(err); stats.remaining = stats.total - stats.completed; cb(null, stats); }); function countComplete(cb) { Todo.count({completed: true}, function(err, count) { stats.completed = count; cb(err); }); } function count(cb) { Todo.count(function(err, count) { stats.total = count; cb(err); }); } }; loopback.remoteMethod(Todo.stats, { accepts: {arg: 'filter', type: 'object'}, returns: {arg: 'stats', type: 'object'} }); };
JavaScript
0
@@ -919,24 +919,20 @@ %7D;%0A%0A -loopback +Todo .remoteM @@ -937,26 +937,23 @@ eMethod( -Todo. +' stats +' , %7B%0A @@ -1037,18 +1037,60 @@ object'%7D -%0A %7D +,%0A http: %7B path: '/stats' %7D%0A %7D, Todo.stats );%0A%7D;%0A
9396104badc77689a45bb88892cb8936bf24f00b
Update subscription.js
MobileApp/mstudentApp/modules/subscription.js
MobileApp/mstudentApp/modules/subscription.js
import {Platform} from 'react-native'; import FCM from 'react-native-fcm'; const API_KEY = 'AAAA1i1g05s:APA91bEm3cI3lCflqY74PSH3O-3RGUk4H9kGqXKB1NfhT9igNntvDSSqWDBxajEK-rsbFovPVJzTJojx4Q-SlgFs-7D2fT2dmdw_0ii_5jodpn__jahPlKE1UL-HibRkSO8_6WL88B3D'; var icube = []; var loaded = false; module.exports = { //gets subscription data get_iCube: function(callback) { if(!loaded) { //process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; //var url = Platform.OS === 'ios' ? 'https://mobile-api.innovate.fresnostate.edu/icube' : 'http://mobile-api.innovate.fresnostate.edu/icube'; //var url = 'https://mobile-api.innovate.fresnostate.edu/icube'; var url = 'http://mobile-api.innovate.fresnostate.edu/icube'; fetch(url) .then(function (response) { return response.json(); }).then(function (json) { loaded = true; icube = json.icube; callback(icube); }).catch(function (err) { console.log("GET TOPICS ERR", err); }); } else{ callback(icube); } }, //gets array of topic keys of currently subscribed subjects getSubscribed: function(callback){ FCM.getFCMToken().then((token) => { fetch('https://iid.googleapis.com/iid/info/'+token+'?details=true', { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'key='+API_KEY } }).then(function(response) { return response.json(); }).then(function(subscribed) { if(subscribed.rel && subscribed.rel.topics){ callback(Object.keys(subscribed.rel.topics)); } else{ callback([]); } }).catch(function(err){ console.log("GET SUBS ERR", err); }); }); }, //updates subject data to have a boolean field for whether a subject is currently subscribed to mergeSubData: function(subjects, subscribed, callback){ subjects.forEach(function (subject) { subject["subscribed"] = subscribed.indexOf(subject.topic_key) >=0; }); callback(subjects); }, //takes subject data and returns only those currently subscribed to mergeMySubData: function(subjects, subscribed, callback){ var mySubjects = []; subjects.forEach(function (subject) { if(subscribed.indexOf(subject.topic_key) >=0){ subject["subscribed"] = true; mySubjects.push(subject); } }); callback(mySubjects); }, //returns boolean in cb for whether a subject is currently subscribed to checkIfSubscribed(topic_key, callback){ this.getSubscribed((subjects)=>{ var subscribed = false; for(var i=0; i<subjects.length; ++i){ if(subjects[i].indexOf(topic_key) >=0){ subscribed = true; break; } } callback(subscribed); }) }, //gets subscription info for a single subject by looking up the topic_key getSubscriptionInfo(topic_key, callback){ this.get_iCube((channels)=>{ let found = false; var subInfo = { channel: 'Channel', area: 'Area', subject: 'Subject', subscribed: false }; //parse topic key to get subscription IDs var channel_id = topic_key.split("-")[0]; var area_id = topic_key.split("-")[1]; var subject_id = topic_key.split("-")[2]; //get subscription/icube names from IDs for(var i=0; i<channels.length; ++i){ if(channels[i]._id === channel_id){ for(var j=0; j<channels[i].areas.length; ++j){ if(channels[i].areas[j].id === area_id){ for(var k=0; k<channels[i].areas[j].subjects.length; ++k){ if(channels[i].areas[j].subjects[k].id === subject_id){ found = true; subInfo.channel = channels[i].name; subInfo.area = channels[i].areas[j].name; subInfo.subject = channels[i].areas[j].subjects[k].name; subInfo.level = channels[i].areas[j].subjects[k].opt.level; break; } } } } } } if(found){ this.checkIfSubscribed(topic_key, (subscribed)=> { subInfo.subscribed = subscribed; callback(subInfo); }); } else{ callback(subInfo); } }); }, subscribe: function(topic_key){ FCM.subscribeToTopic('/topics/'+topic_key); }, unsubscribe: function(topic_key){ //add check here for safeguarding against removing required/forced topics FCM.unsubscribeFromTopic('/topics/'+topic_key); } };
JavaScript
0.000001
@@ -90,160 +90,15 @@ = ' -AAAA1i1g05s:APA91bEm3cI3lCflqY74PSH3O-3RGUk4H9kGqXKB1NfhT9igNntvDSSqWDBxajEK-rsbFovPVJzTJojx4Q-SlgFs-7D2fT2dmdw_0ii_5jodpn__jahPlKE1UL-HibRkSO8_6WL88B3D +api-key ';%0Av
528cac7ed25bda531b44d6d5b222186ac5ec6225
debug file
cloud/weixin.js
cloud/weixin.js
var crypto = require('crypto'); var config = require('cloud/config/weixin.js'); var debug = require('debug')('AV:weixin'); exports.exec = function(params, cb) { if (params.signature) { checkSignature(params.signature, params.timestamp, params.nonce, params.echostr, cb); } else { receiveMessage(params, cb) } } // 验证签名 var checkSignature = function(signature, timestamp, nonce, echostr, cb) { var oriStr = [config.token, timestamp, nonce].sort().join('') var code = crypto.createHash('sha1').update(oriStr).digest('hex'); debug('code:', code) if (code == signature) { cb(null, echostr); } else { var err = new Error('Unauthorized'); err.code = 401; cb(err); } } // 接收普通消息 var receiveMessage = function(msg, cb) { //console.log('weixin Event:', msg.xml.Event); var content = ''; if(msg.xml.MsgType == 'event')//操作事件 { if (msg.xml.Event == 'CLICK') { if(msg.xml.EventKey == 'KEY_I_LIKE') { content = '谢谢点赞!' }else if(msg.xml.EventKey == 'KEY_USER_GUID') { content = '爆料方式简单、迅速,全程使用微信操作。\n\n第一步,拍摄实物照片(可以拍摄多张照片,至少1张,最多5张)\n\n第二步,发送当前门店所在的位置信息,以便准确前往。\n\n第三步,用简短的文字描述一下优惠内容。如(蛇口沃尔玛旁氏洗面奶满50减20活动,速来。)' }else if(msg.xml.EventKey == 'KEY_INPUT_TEXT') { content = '↙点击左下角的键盘图标可切换输入模式 :)'; } } }else if(msg.xml.MsgType == 'image') { var fs = require('fs'); var file = AV.File.withURL(msg.xml.FromUserName, msg.xml.PicUrl); file.save(); content = '(1/3) 收到您的照片,如果有多个,请继续拍摄,最多不超过5张。发送当前门店地理位置进行下一步。'; }else if(msg.xml.MsgType == 'text') { content = '(2/3) 爆料成功!你可以在菜单[我自己->我的爆料]查看,审核通过后即出现在优惠榜单上。'; }else if(msg.xml.MsgType == 'location') { content = '(3/3) 请用简短的文字描述一下优惠内容。如(蛇口沃尔玛洗面奶满50减20活动,速来。)'; } var result = { xml: { ToUserName: msg.xml.FromUserName[0], FromUserName: '' + msg.xml.ToUserName + '', CreateTime: new Date().getTime(), MsgType: 'text', Content: content } } cb(null, result); }
JavaScript
0.000002
@@ -1475,24 +1475,83 @@ uire('fs');%0A + console.log(msg.xml.FromUserName, msg.xml.PicUrl);%0A var @@ -1624,20 +1624,126 @@ -file.save(); +console.log(file);%0A file.save().then(function(result)%7Bconsole.log(result)%7D,function(error)%7Bconsole.log(error)%7D) %0A%0A
11521fde02277055acec26fb141b8e5e49ce5295
add test
frontend/src/js/__tests__/BuildStepOutput.test.js
frontend/src/js/__tests__/BuildStepOutput.test.js
/* globals describe it expect */ import * as subject from "../BuildStepOutput.es6"; import {shallow} from "enzyme"; describe("Output presentation", () => { it("should be hidden when output is false", () => { const input = {showOutput: false}; expect(subject.BuildStepOutput(input)).toBe(null); }); it("should display output of step if not hidden", () => { const input = {showOutput: true, buildId: 1, stepName: "meinStep", output: "hierTestOutput"}; const component = shallow(subject.BuildStepOutput(input)); expect(component.find("#outputHeader__buildId").text()).toBe("1"); expect(component.find("#outputHeader__stepName").text()).toBe("meinStep"); expect(component.find("#outputContent").text()).toBe("hierTestOutput"); }); }); describe("Output redux", () => { it("should not output render props if hidden", () => { expect(subject.mapStateToProps({output: {showOutput: false}},{})).toEqual({showOutput:false}); }); it("should get output from buildstep", () => { const state = { buildDetails: {1: {steps: [{stepId: "1", name: "myStep", output:["line1"]}]}}, output: {showOutput:true, buildId: 1, stepId: "1"} }; const expected = {buildId: 1, stepId: "1", stepName: "myStep", output: ["line1"], showOutput: true}; expect(subject.mapStateToProps(state)).toEqual(expected); }); });
JavaScript
0.000002
@@ -1356,12 +1356,391 @@ %0A %7D);%0A%0A + it(%22should get undefined from buildstep if no output exists%22, () =%3E %7B%0A const state = %7B%0A buildDetails: %7B1: %7Bsteps: %5B%7BstepId: %221%22, name: %22myStep%22%7D%5D%7D%7D,%0A output: %7BshowOutput:true, buildId: 1, stepId: %221%22%7D%0A %7D;%0A const expected = %7BbuildId: 1, stepId: %221%22, stepName: %22myStep%22, showOutput: true%7D;%0A%0A expect(subject.mapStateToProps(state)).toEqual(expected);%0A %7D);%0A%0A %7D);%0A
2e65013368c04543529cb729ecfea876e545391a
Fix check-boilerplatate-package
.tools/check-boilerplate-packages.js
.tools/check-boilerplate-packages.js
const request = require('request-json'); const client = request.createClient('https://raw.githubusercontent.com'); const boilerplatePackagesPath = "/SC5/sc5-serverless-boilerplate/master/package.json"; const currentPackages = require('../package.json'); client.get(boilerplatePackagesPath, function(err, res, body) { const boilerPackages = body; console.log('DEVDEPENDENCIES'); const devPackages = Object.keys(boilerPackages.devDependencies); devPackages.forEach((pkg) => { if (boilerPackages.devDependencies[pkg] != currentPackages.devDependencies[pkg]) { console.log(` ${pkg}: ${boilerPackages.devDependencies[pkg]} <=> ${currentPackages.devDependencies[pkg]}`); } }); console.log('DEPENDENCIES'); const prodPackages = Object.keys(boilerPackages.dependencies); prodPackages.forEach((pkg) => { if (boilerPackages.dependencies[pkg] != currentPackages.dependencies[pkg]) { console.log(` ${pkg}: ${boilerPackages.dependencies[pkg]} <=> ${currentPackages.dependencies[pkg]}`); } }); console.log('SCRIPTS'); const scripts = Object.keys(boilerPackages.scripts); scripts.forEach((script) => { if (boilerPackages.scripts[script] != currentPackages.scripts[script]) { console.log(` ${script}: ${boilerPackages.scripts[script]} <=> ${currentPackages.scripts[script]}`); } }); });
JavaScript
0.000001
@@ -146,16 +146,18 @@ = %22/ -SC5/sc5- +nordcloud/ serv
4530c89114d3e87db5561ac2aedcd9e0cb993b50
Fix strings.
scripts/dikmax/cookies.js
scripts/dikmax/cookies.js
export default function initCookies() { const cc = initCookieConsent(); cc.run({ current_lang: 'ru', page_scripts: true, cookie_expiration: 182, languages: { 'ru': { consent_modal: { title: 'Переходи на тёмную стороу, у нас есть 🍪', description: "Блог использует Google Analytics для статистики, чтобы понимать, кто его читает. " + "Поэтому мне нужно ваше разрешение на использование соотвествующих куков. " + "<a href=\"/privacy/\" class=\"cc-link\">Политика конфиденциальности (на английском)</a>.", primary_btn: { text: 'Согласен', role: 'accept_all' //'accept_selected' or 'accept_all' }, secondary_btn: { text: 'Настройки', role: 'settings' //'settings' or 'accept_necessary' }, }, settings_modal: { title: 'Настройки', save_settings_btn: 'Сохранить', accept_all_btn: 'Принять все', reject_all_btn: 'Отклонить все', close_btn_label: 'Закрыть', blocks: [ { title: 'Аналитика', description: 'С помощью этих куков собирается информация, как вы пользуетесь сайтом, какие страницы ' + 'посещаете и какие ссылки нажимаете. Все данные обезличены и не могут быть использованы для ' + 'вашей идентификации.', toggle: { value: 'analytics', enabled: false, readonly: false }, }, { title: 'Остались вопросы?', description: 'Посмотрите <a href="/privacy/" class="cc-link">политику конфиденциальности</a> или <a class="cc-link" href="mailto:[email protected]?subject=Cookies">напишите мне</a>.', } ] } } } }); }
JavaScript
0.000362
@@ -252,16 +252,17 @@ %D1%83%D1%8E %D1%81%D1%82%D0%BE%D1%80%D0%BE +%D0%BD %D1%83, %D1%83 %D0%BD%D0%B0%D1%81 @@ -622,16 +622,15 @@ t: ' -%D0%A1%D0%BE%D0%B3%D0%BB%D0%B0%D1%81%D0%B5%D0%BD +%D0%9F%D1%80%D0%B8%D0%BD%D1%8F%D1%82%D1%8C ',%0A
1a064c62f0153565d19f1c26b4fe2e61aef56be4
fix map chart controller test
frontend/test/unit/Controller/MapChartControllerSpec.js
frontend/test/unit/Controller/MapChartControllerSpec.js
/*jshint node: true */ 'use strict'; /* * Name : MapChartController.js * Module : UnitTest * Location : /frontend/test/unit/Controller * * History : * Version Date Programmer Description * ================================================================================================= * 0.1.0 2015-05-25 Maria Giovanna Chinellato Add all attributes and all methods * * 0.0.1 2015-05-25 Maria Giovanna Chinellato Initial code * ================================================================================================= * */ describe('MapChartController', function() { /*var scope, $location, $controller; beforeEach(angular.mock.module('norris-nrti')); beforeEach(inject(function($rootScope, _$controller_, _$location_){ $controller = _$controller_ $location = _$location_; scope = $rootScope.$new(); createController = function() { return $controller('MapChartController', { '$scope': scope }); }; })); it('should have a method to check if the path is active', function() { var controller = createController(); expect(scope.mapChart).toBeDefined(); }); }); describe('MapChartController', function(){ beforeEach(angular.mock.module('norris-nrti')); var scope; var controller; var MapChartFactory; //var notify; var json = { 'title' : 'graficonuovo', 'url' : 'localhost', 'height' : 400, 'width' : 400, 'enabledLegend' : false, 'horizontalGrid' : false, 'verticalGrid' : false, 'legendOnPoint' : false, 'latitude' : 3, 'longitude' : 3, 'scale' : 999, 'mapType' : 'terrain', 'zoom' : false, 'flows' : [{'ID' : '1'},{'ID' : '2'},{'ID' : '3'}] }; describe('listenOnEvent', function(){ beforeEach(inject(function ($rootScope, $controller, $injector) { MapChartFactory = $injector.get('MapChartFactory'); scope = $rootScope.$new(); scope.mapChart = MapChartFactory.build(json); //notify = _notify_; controller = $controller('MapChartController', { // "lo conosci il MapChartController?" cit. Barney $scope : scope }); })); it ('listenOnEvent works fine', function(){ expect(scope.mapChart).toBeDefined(); expect(scope.mapChart.getTitle()).toEqual('graficonuovo'); /*notify.receive('configGraph',{ 'properties' : { 'title' : 'titolocambiato' }, 'data' : data }); expect(scope.mapChart.getTitle()).toEqual('titolocambiato'); expect(scope.mapChart.getFlowList()[0].flow.getData()[0].value[0]).toEqual(0); }); }); //describe('socketConnection', function(){ //}); describe('listenOnEvent', function(){ var data = [ { 'ID' : '1', 'records' : [{ 'NorrisRecordID' : '234321', 'value' : [0,1]},{}] } ]; beforeEach(function(){ scope.mapChart = MapChartFactory.build(json); }); it ('listenOnEvent works fine', function(){ controller('MapChartController', {$scope : scope}); expect(scope.mapChart.getTitle()).toEqual('graficonuovo'); notify.receive('configGraph',{ 'properties' : { 'title' : 'titolocambiato' }, 'data' : data }); expect(scope.mapChart.getTitle()).toEqual('titolocambiato'); expect(scope.mapChart.getFlowList()[0].flow.getData()[0].value[0]).toEqual(0); }); }); */ });
JavaScript
0
@@ -634,18 +634,16 @@ ) %7B%0A -/* var scop @@ -827,16 +827,17 @@ troller_ +; %0A @@ -1241,16 +1241,18 @@ );%0A%7D);%0A%0A +/* describe @@ -3408,11 +3408,10 @@ );%0A%09 -*/ %0A%7D); -%0A +*/
d6f1430b26399ecf58317992eaecd6e393ddafdf
add a default wallpaper (Pleiades)
sources/common/js/configuration.js
sources/common/js/configuration.js
(function() { // Set in define(). let Ordering; const configuration = {}; // Version operations: { // Creates a new version identifier. function create(major, minor = 0, patch = 0, beta = 0) { return { major: major, minor: minor, patch: patch, beta : beta }; } // Returns true iff the specified object is a (non-strict) positive integer. function is_positive_integer(obj) { return Number.isInteger(obj) && obj >= 0; } // Returns true iff the specified object is a valid version identifier. function is_valid(obj) { return ( is_positive_integer(obj.major) && is_positive_integer(obj.minor) && is_positive_integer(obj.patch) && is_positive_integer(obj.beta) ); } // Returns an Ordering relating two version identifiers. function compare(a, b) { const components_a = [a.major, a.minor, a.patch, a.beta], components_b = [b.major, b.minor, b.patch, b.beta]; for (let i = 0; i < 4; ++i) { const component_a = components_a[i], component_b = components_b[i]; if (component_a > component_b) { return Ordering.Greater; } else if (component_a < component_b) { return Ordering.Less; } } return Ordering.Equal; } // Builds a string representation of the specified version identifier. function as_string(id, include_patch = true, include_beta = true) { let result = `${id.major}.${id.minor}`; if (include_patch) { result += `.${id.patch}`; } if (include_beta && id.beta > 0) { result += `b${id.beta}`; } return result; } configuration.version = { CURRENT: create(1, 7, 0, 2), HAS_RELEASE_NOTES: false, create: create, is_valid: is_valid, compare: compare, as_string: as_string }; } // Storage layout: { const version = configuration.version; // Enumerates possible tab behaviors. const TabBehavior = { // Redirection to a specified URL. Redirect: "redirect", // Display of a custom page with user-specified background color and wallpaper image. DisplayCustomPage: "display-custom-page" }; configuration.TabBehavior = TabBehavior; // Enumerates option-ui themes. const Theme = { Light: "light", Dark: "dark" }; configuration.Theme = Theme; // Enumerates (wallpaper) scaling methods. const Scaling = { // Chooses the best method based on the dimensions of the image vs. those of the screen. Automatic: "automatic", // Tightly fit inside bounds. Fit: "fit", // Fill bounds. Fill: "fill", // No scaling. None: "none", }; configuration.Scaling = Scaling; // Enumerates top site visibility conditions. const TopSitesVisibility = { // Show always. Show: "show-always", // Show only after the user indicates so. ShowOnRequest: "show-on-request", // Hide always. Hide: "hide-always" }; configuration.TopSitesVisibility = TopSitesVisibility; // The default configuration. configuration.create_default = function() { return { version: version.create(version.CURRENT.major, version.CURRENT.minor), notification: { new_features: true }, new_tab: { behavior: TabBehavior.DisplayCustomPage, redirect: { url: "" }, custom_page: { background: { color: "#2d2d2d", do_animate: true, animation_duration: 0.5 }, wallpaper: { is_enabled: false, urls: [], scaling: Scaling.Automatic, do_animate: true, animation_duration: 1.5 }, top_sites: { visibility: TopSitesVisibility.ShowOnRequest } } }, options_ui: { theme: Theme.Light } }; }; } // Updates: { const version = configuration.version; const migration = { "1.4": cfg => // migrates 1.4 to 1.5 { cfg.version = version.create(1, 5); const page = cfg.new_tab.custom_page; const bg = page.background; const wp = page.wallpaper; bg.do_animate = bg.animation_duration > 0; bg.animation_duration = Math.max(bg.animation_duration, 0.1); wp.do_animate = wp.animation_duration > 0; wp.animation_duration = Math.max(wp.animation_duration, 0.1); cfg.options_ui = { theme: configuration.Theme.Light }; }, "1.5": cfg => // migrates 1.5 to 1.6 { cfg.version = version.create(1, 6); cfg.new_tab.custom_page.wallpaper.scaling = configuration.Scaling.Fit; }, "1.6": cfg => // migrates 1.6 to 1.7 { cfg.version = version.create(1, 7); cfg.new_tab.custom_page.top_sites.visibility = configuration.TopSitesVisibility.ShowOnRequest; } }; // Updates the configuration object layout. configuration.update = function(cfg) { let version_string = version.as_string(cfg.version, false, false); while (migration.hasOwnProperty(version_string)) { migration[version_string](cfg); version_string = version.as_string(cfg.version, false, false); } cfg.version = version.create( version.CURRENT.major, version.CURRENT.minor ); return cfg; }; } // Read/write: { // The key to the configuration object in local storage. const KEY = "configuration@new-tab-tweaker"; // Loads the configuration from storage asynchronously (returns a promise). // // Note: If no configuration object is detected, returns one with default values. function load() { return browser.storage.local.get(KEY).then(item => { if (item.hasOwnProperty(KEY)) { return item[KEY]; } else { return configuration.create_default(); } }); } // Saves a configuration to storage asynchronously (returns a promise). function save(cfg) { const item = {}; item[KEY] = cfg; return browser.storage.local.set(item); } configuration.storage = { KEY: KEY, load: load, save: save }; } define(["./ordering"], function(ordering) { Ordering = ordering; return configuration; }); })();
JavaScript
0
@@ -4660,20 +4660,19 @@ nabled: -fals +tru e,%0A%0A @@ -4702,16 +4702,120 @@ urls: %5B +%22https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Pleiades_large.jpg/1280px-Pleiades_large.jpg%22 %5D,%0A%0A
cf03a326477f53467fd85981243b7ab92e10c601
Fix chart export function
static/js/libs/highcharts.csv-export.js
static/js/libs/highcharts.csv-export.js
/** * A small plugin for getting the CSV of a categorized chart * Based on https://github.com/highslide-software/export-csv */ (function (Highcharts) { var each = Highcharts.each; Highcharts.Chart.prototype.getCSV = function () { var columns = [], line, tempLine, csv = "", row, col, options = (this.options.exporting || {}).csv || {}, // Options dateFormat = options.dateFormat || '%Y-%m-%d %H:%M:%S', itemDelimiter = options.itemDelimiter || ',', // use ';' for direct import to Excel lineDelimiter = options.lineDelimeter || '\n'; each (this.series, function (series) { if (series.options.includeInCSVExport !== false) { if (series.xAxis) { var xData = series.xData.slice(), xTitle = 'X values'; if (series.xAxis.isDatetimeAxis) { xData = Highcharts.map(xData, function (x) { return Highcharts.dateFormat(dateFormat, x) }); xTitle = 'DateTime'; } else if (series.xAxis.categories) { xData = Highcharts.map(xData, function (x) { return Highcharts.pick(series.xAxis.categories[x], x); }); xTitle = 'Category'; } columns.push(xData); columns[columns.length - 1].unshift(xTitle); } columns.push(series.yData.slice()); columns[columns.length - 1].unshift(series.name); } }); // Transform the columns to CSV for (row = 0; row < columns[0].length; row++) { line = []; for (col = 0; col < columns.length; col++) { line.push(columns[col][row]); } csv += line.join(itemDelimiter) + lineDelimiter; } return csv; }; if (Highcharts.getOptions().exporting) { Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({ text: Highcharts.getOptions().lang.downloadCSV || "Download CSV", onclick: function () { Highcharts.post('/export/csv/', { csv: this.getCSV() }); } }); } }(Highcharts));
JavaScript
0.000002
@@ -2374,16 +2374,19 @@ st(' +api /export/ csv/ @@ -2385,12 +2385,8 @@ ort/ -csv/ ', %7B
e684f8096943947ed55257fe1aa631217179b337
Remove try/catch
lib/node_modules/@stdlib/math/base/blas/dasum/test/test.dasum.native.js
lib/node_modules/@stdlib/math/base/blas/dasum/test/test.dasum.native.js
'use strict'; // MODULES // var tape = require( 'tape' ); var floor = require( '@stdlib/math/base/special/floor' ); var randu = require( '@stdlib/math/base/random/randu' ); var dasum; var opts; opts = {}; try { dasum = require( './../lib/dasum.native.js' ); } catch ( error ) { // eslint-disable-line no-unused-vars // Unable to load native addon: opts.skip = true; } // TESTS // tape( 'main export is a function', opts, function test( t ) { t.ok( true, __filename ); t.strictEqual( typeof dasum, 'function', 'main export is a function' ); t.end(); }); tape( 'the function computes the sum of absolute values', opts, function test( t ) { var x; var y; x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] ); y = dasum( x.length, x, 1 ); t.strictEqual( y, 15.0, 'returns 15' ); t.end(); }); tape( 'the function supports an `x` stride', opts, function test( t ) { var x; var y; var N; x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] ); N = 3; y = dasum( N, x, 2 ); t.strictEqual( y, 9.0, 'returns 9' ); t.end(); }); tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) { var x; var y; x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] ); y = dasum( 0, x, 1 ); t.strictEqual( y, 0.0, 'returns 0' ); t.end(); }); tape( 'if provided a `stride` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) { var x; var y; x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] ); y = dasum( x.length, x, -1 ); t.strictEqual( y, 0.0, 'returns 0' ); t.end(); }); tape( 'the function supports view offsets', opts, function test( t ) { var x0; var x1; var y; var N; // Initial array... x0 = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); // Create an offset view... x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element N = floor( x0.length / 2 ); y = dasum( N, x1, 2 ); t.strictEqual( y, 12.0, 'returns 12' ); t.end(); }); tape( 'if the stride equals `1`, the function efficiently sums the absolute values', opts, function test( t ) { var sign; var x; var y; var i; x = new Float64Array( 100 ); for ( i = 0; i < x.length; i++ ) { sign = randu(); if ( sign < 0.5 ) { sign = -1.0; } else { sign = 1.0; } x[ i ] = sign * (i+1); } y = dasum( x.length, x, 1 ); // Compare to closed-form formula: t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); x = new Float64Array( 240 ); for ( i = 0; i < x.length; i++ ) { sign = randu(); if ( sign < 0.5 ) { sign = -1.0; } else { sign = 1.0; } x[ i ] = sign * (i+1); } y = dasum( x.length, x, 1 ); // Compare to closed-form formula: t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); t.end(); });
JavaScript
0.000006
@@ -172,207 +172,187 @@ );%0A -%0A var -dasum;%0Avar opts;%0A%0Aopts = %7B%7D;%0Atry %7B%0A%09dasum = require( './../lib/dasum.native.js' );%0A%7D catch ( error ) %7B // eslint-disable-line no-unused-vars%0A%09// Unable to load native addon:%0A%09opts.skip = true; +hasNative = require( './../lib/has_native.js' );%0A%0A%0A// VARIABLES //%0A%0Avar dasum = ( hasNative ) ? require( './../lib/dasum.native.js' ) : false;%0Avar opts = %7B%0A%09'skip': !!dasum %0A%7D +; %0A%0A%0A/
26f5820c95d51163f068a30c9c934a351a256fa2
Fix an issue with custom arrows example
examples/CustomArrows.js
examples/CustomArrows.js
import React, { Component } from 'react' import createReactClass from 'create-react-class' import Slider from '../src/slider' var SampleNextArrow = createReactClass({ render: function() { return <div {...this.props} style={{display: 'block', background: 'red'}}></div>; } }); var SamplePrevArrow = createReactClass({ render: function() { return ( <div {...this.props} style={{display: 'block', background: 'red'}}></div> ); } }); export default class CustomArrows extends Component { render() { const settings = { dots: true, infinite: true, slidesToShow: 3, slidesToScroll: 1, nextArrow: <SampleNextArrow />, prevArrow: <SamplePrevArrow /> }; return ( <div> <h2>Custom Arrows</h2> <Slider {...settings}> <div><h3>1</h3></div> <div><h3>2</h3></div> <div><h3>3</h3></div> <div><h3>4</h3></div> <div><h3>5</h3></div> <div><h3>6</h3></div> </Slider> </div> ); } }
JavaScript
0.000001
@@ -192,44 +192,135 @@ -return %3Cdiv %7B...this.props%7D style=%7B%7B +const %7BclassName, style, onClick%7D = this.props%0A return (%0A %3Cdiv%0A className=%7BclassName%7D%0A style=%7B%7B...style, disp @@ -352,23 +352,62 @@ 'red'%7D%7D +%0A onClick=%7BonClick%7D%0A %3E%3C/div%3E +%0A ) ;%0A %7D%0A%7D) @@ -481,52 +481,135 @@ -return (%0A %3Cdiv %7B...this.props%7D style=%7B%7B +const %7BclassName, style, onClick%7D = this.props%0A return (%0A %3Cdiv%0A className=%7BclassName%7D%0A style=%7B%7B...style, disp @@ -635,22 +635,57 @@ round: ' +g re -d +en '%7D%7D +%0A onClick=%7BonClick%7D%0A %3E%3C/div%3E%0A @@ -1266,24 +1266,25 @@ %3C/div%3E%0A );%0A %7D%0A%7D +%0A
f68c5050ae3e626a01b0591e68f7ea7eeae4c36d
attach the auth bearer token to `request.app`
policies/isAuthenticated.js
policies/isAuthenticated.js
const Boom = require('boom'); const needsAPI = function(request, reply, next) { const authorization = request.headers.authorization; const bearer = authorization && authorization.split(' ')[1]; // verify existence of Bearer token if (!bearer) { return next(Boom.unauthorized(), false); } // attach new API client to current request request.app.api = require('../lib/api-client')(bearer); next(null, true); }; // These are optional needsAPI.pre = true; // default needsAPI.post = false; // default module.exports = needsAPI;
JavaScript
0
@@ -344,16 +344,47 @@ request%0A + request.app.bearer = bearer;%0A reques
a22de22e00793ed5715750f6ccda9d5ba8a51afd
Fix label on angular example's describe block
examples/angular/test.js
examples/angular/test.js
'use strict'; var expect = require('chai').expect; var sinon = require('sinon'); var sinonAsPromised = require('sinon-as-promised'); var angular = require('angular'); describe('sinon-as-promised node example', function () { var $timeout; beforeEach(angular.mock.inject(function ($rootScope, $q, _$timeout_) { sinonAsPromised($q); sinonAsPromised.setScheduler(function (fn) { $rootScope.$evalAsync(fn); }); $timeout = _$timeout_; })); it('can create a stub that resolves', function () { var stub = sinon.stub().resolves('value'); var fulfilled = false; stub().then(function (value) { fulfilled = true; expect(value).to.equal('value'); }); expect(fulfilled).to.be.false; $timeout.flush(); expect(fulfilled).to.be.true; }); });
JavaScript
0
@@ -221,12 +221,15 @@ sed -node +angular exa @@ -824,8 +824,9 @@ %7D);%0A%0A%7D); +%0A
9c34731eb01908f09a6faeac64899626b7c38e20
Update BuiltinBaseJoke.js
skills/BuiltinBaseJoke.js
skills/BuiltinBaseJoke.js
module.exports = function(skill, info, bot, message) { bot.reply(message, 'What did the bot say to the other bot?'); bot.reply(message, '```\n01001111 01101110 01101100 01111001 00100000 01101110 01100101 01110010 01100100 01110011 00100000 01101100 01101111 01101111 01101011 00100000 01110101 01110000 00100000 01110111 01101000 01100001 01110100 00100000 01110100 01101000 01101001 01110011 00100000 01110011 01100001 01111001 01110011 00100001\n```'); };
JavaScript
0
@@ -44,16 +44,20 @@ message +, db ) %7B%0A bo
b94d1c92d57783a1ad634b56aa75d93453fca0ab
Add jsdoc-style comments.
redux-query-sync.js
redux-query-sync.js
import createHistory from 'history/createBrowserHistory' // Helps to keep configured query parameters of the window location in sync // (bidirectionally) with values in the Redux store. function ReduxQuerySync({ store, params, replaceState, initialTruth, }) { const { dispatch } = store const history = createHistory() const updateLocation = replaceState ? history.replace.bind(history) : history.push.bind(history) // A bit of state used to not respond to self-induced location updates. let ignoreLocationUpdate = false // Keeps the last seen values for comparing what has changed. let lastQueryValues = {} function getQueryValues(location) { const locationParams = new URL('http://bogus' + location.search).searchParams const queryValues = {} Object.keys(params).forEach(param => { const { defaultValue } = params[param] let value = locationParams.get(param) if (value === null) { value = defaultValue } queryValues[param] = value }) return queryValues } function handleLocationUpdate(location) { // Ignore the event if the location update was induced by ourselves. if (ignoreLocationUpdate) return const state = store.getState() // Read the values of the watched parameters const queryValues = getQueryValues(location) // For each parameter value that changed, call the corresponding action. Object.keys(queryValues).forEach(param => { const value = queryValues[param] if (value !== lastQueryValues[param]) { const { selector, action } = params[param] lastQueryValues[param] = value // Dispatch the action to update the state if needed. // (except on initialisation, this should always be needed) if (selector(state) !== value) { dispatch(action(value)) } } }) } function handleStateUpdate() { const state = store.getState() const location = history.location // Parse the current location's query string. const locationParams = new URL('http://bogus' + location.search).searchParams // Replace each configured parameter with its value in the state. Object.keys(params).forEach(param => { const { selector, defaultValue } = params[param] const value = selector(state) if (value === defaultValue) { locationParams.delete(param) } else { locationParams.set(param, value) } }) const newLocationSearchString = `?${locationParams}` // Only update location if anything changed. if (newLocationSearchString !== location.search) { // Update location (but prevent triggering a state update). ignoreLocationUpdate = true updateLocation({search: newLocationSearchString}) ignoreLocationUpdate = false } } // Sync location to store on every location change, and vice versa. const unsubscribeFromLocation = history.listen(handleLocationUpdate) const unsubscribeFromStore = store.subscribe(handleStateUpdate) // Sync location to store now, or vice versa, or neither. if (initialTruth === 'location') { handleLocationUpdate(history.location) } else { // Just set the last seen values to later compare what changed. lastQueryValues = getQueryValues(history.location) } if (initialTruth === 'store') { handleStateUpdate() } return function unsubscribe() { unsubscribeFromLocation() unsubscribeFromStore() } } // Also offer the function as a store enhancer for convenience. function makeStoreEnhancer(config) { return storeCreator => (reducer, initialState, enhancer) => { // Create the store as usual. const store = storeCreator(reducer, initialState, enhancer) // Hook up our listeners. ReduxQuerySync({store, ...config}) return store } } ReduxQuerySync.enhancer = makeStoreEnhancer export default ReduxQuerySync
JavaScript
0
@@ -56,135 +56,965 @@ '%0A%0A/ -/ Helps to keep configured query parameters of the window location in sync%0A// (bidirectionally) with values in the Redux store. +**%0A * Sets up bidirectional synchronisation between a Redux store and window%0A * location query parameters.%0A *%0A * @param %7BObject%7D options.store - The redux store object (= an object %60%7Bdispatch, getState%7D%60).%0A * @param %7BObject%7D options.params - The query parameters in the location to keep in sync.%0A * @param %7B*%7D options.params%5B%5D.defaultValue - The value corresponding to absence of the%0A * parameter.%0A * @param %7Bfunction%7D options.params%5B%5D.action - The action creator to be invoked with the parameter%0A * value to set it in the store.%0A * @param %7Bfunction%7D options.params%5B%5D.selector - The function that gets the value given the state.%0A * @param %7Bboolean%7D options.replaceState - If truthy, update location using%0A * history.replaceState instead of history.pushState, to not fill the browser history.%0A * @param %7Bstring%7D options.initialTruth - If set, indicates whose values to sync to the other,%0A * initially. Can be either 'location' or 'store'.%0A */ %0Afun @@ -4677,71 +4677,416 @@ %7D%0A%0A/ -/ Also offer the function as a store enhancer for convenience.%0A +**%0A * For convenience, one can set up the synchronisation by passing this enhancer to createStore.%0A *%0A * @example%0A *%0A * const storeEnhancer = ReduxQuerySync.enhancer(%7Bparams, initialTruth: 'location'%7D)%0A * const store = createStore(reducer, initialState, storeEnhancer)%0A *%0A * Arguments are equal to those of ReduxQuerySync itself, except that %60store%60 can now be omitted.%0A */%0AReduxQuerySync.enhancer = func @@ -5400,56 +5400,11 @@ %7D%0A + %7D%0A%0A -ReduxQuerySync.enhancer = makeStoreEnhancer%0A%0A expo
59860986c648cf2744f2a292d5e83f7e5e0a1481
Add a note to remind me of how this will work at some point. Woops.
commands/get.js
commands/get.js
'use strict'; const l10nFile = __dirname + '/../l10n/commands/get.yml'; const l10n = require('../src/l10n')(l10nFile); const CommandUtil = require('../src/command_util').CommandUtil; const util = require('util'); exports.command = (rooms, items, players, npcs, Commands) => (args, player) => { player.emit('action', 0); // No picking stuff up in combat if (player.isInCombat()) { player.warn("You cannot do that while you're fighting."); return; } const room = rooms.getAt(player.getLocation()); const playerName = player.getName(); if (args.toLowerCase() === "all") { getAllItems(room); return; } const itemFound = CommandUtil.findItemInRoom(items, args, room, player); if (!itemFound) { return player.warn(`You find no ${args} here`); } const item = items.get(itemFound); return tryToPickUp(item); // -- Handy McHelpertons... function tryToPickUp(item) { const canPickUp = inventoryFull(item) .every( predicate => predicate === true ); if (canPickUp) { return pickUp(item); } else { const message = getFailureMessage(canPickUp); return player.warn(message); } } function pickUp(item) { player.sayL10n(l10n, 'ITEM_PICKUP', item.getShortDesc('en')); item.setRoom(null); item.setHolder(playerName); player.addItem(item); room.removeItem(item.getUuid()); util.log(playerName + ' picked up ' + item.getShortDesc('en')); players.eachIf( p => CommandUtil.inSameRoom(p, player), p => p.sayL10n(l10n, 'OTHER_PICKUP', playerName, item.getShortDesc(p.getLocale())) ); } function getFailureMessage(predicates, item) { const itemName = item.getShortDesc(); const [ tooLarge, tooHeavy ] = predicates; if (tooLarge) { return `${itemName} will not fit in your inventory, it is too large.`; } if (tooHeavy) { return `${itemName} is too heavy for you to carry at the moment.`; } return `You cannot pick up ${itemName} right now.`; } function getAllItems(room) { const itemsInRoom = room.getItems().map( id => items.get(id) ); itemsInRoom.forEach( item => tryToPickUp(item) ); } function inventoryFull(item) { const inventory = player.getInventory(); return [ tooLarge(inventory, item) , tooHeavy(inventory, item) ]; } //TODO: Extract all of these vvv to ItemUtils.js to use in take/put commands as well. function tooLarge(inventory) { const itemWeight = item.getWeight(); if (itemWeight === Infinity) { return true; } const carriedWeight = player.getCarriedWeight(); const maxCarryWeight = player.getMaxCarryWeight(); return (carriedWeight + itemWeight) > maxCarryWeight; } function tooHeavy(inventory, item) { const itemWeight = item.getWeight(); if (itemWeight === Infinity) { return true; } const carriedWeight = player.getCarriedWeight(); const maxCarryWeight = player.getMaxCarryWeight(); return (carriedWeight + itemWeight) > maxCarryWeight; } };
JavaScript
0
@@ -2531,16 +2531,178 @@ well.%0A%0A + //TODO: Eventually, this should check for a container or containers that can fit it, and return that, so that the item%0A // Can be added to this container.%0A func @@ -2736,38 +2736,36 @@ const item -Weight +Size = item.getWeigh @@ -2751,38 +2751,36 @@ mSize = item.get -Weight +Size ();%0A if (it @@ -2773,38 +2773,36 @@ ;%0A if (item -Weight +Size === Infinity) %7B @@ -2829,38 +2829,36 @@ const carried -Weight +Size = player.getCa @@ -2854,38 +2854,36 @@ layer.getCarried -Weight +Size ();%0A const @@ -2882,38 +2882,36 @@ const maxCarry -Weight +Size = player.getMax @@ -2907,38 +2907,36 @@ ayer.getMaxCarry -Weight +Size ();%0A%0A retur
1b6b587800c563a072f1c5cd1bc70ce3f1068a39
Add skip and count options
importer.js
importer.js
#!/usr/bin/env node /** * Command line utility to import JSON objects * and push each one into any endpoint of an HTTP API. * * @author nfantone */ 'use strict'; var winston = require('winston'); var argv = require('yargs') .usage('Usage: $0 [-X method] <url> [options]') .demand(['data']) .describe('data', 'Path to .json file or inline JSON data') .nargs('data', 1) .alias('d', 'data') .describe('X', 'Specify request method to use') .default('X', 'POST') .describe('H', 'Pass custom header to server') .array('H') .count('verbose') .alias('v', 'verbose') .describe('v', 'Sets the verbosity level for log messages') .help('h') .alias('h', 'help') .version(function() { return require('./package').version; }) .alias('V', 'version') .epilog('https://github.com/nfantone').argv; argv.verbose = Math.min(argv.verbose + winston.config.cli.levels.info, winston.config.cli.levels.silly); var start = Date.now(); var moment = require('moment'); var async = require('async'); var util = require('util'); var shortid = require('shortid'); var invert = require('lodash.invert'); var url = require('valid-url'); var path = require('path'); var request = require('request'); var log = new winston.Logger({ transports: [ new winston.transports.Console({ colorize: true, level: invert(winston.config.cli.levels)[argv.verbose], label: 'importer.js' }) ] }); log.cli(); var data; var requests = []; var headers = {}; var apiEndpointUrl = argv._[0]; function exit() { log.info("try './importer.js --help' for more information"); log.debug('Done'); return process.exit(); } // Validate URL positional argument if (!url.isWebUri(apiEndpointUrl)) { log.error('Invalid or no URL provided: <%s>', apiEndpointUrl); exit(); } // Fetch data from json file try { data = require(argv.data); log.info('Loaded file [%s]', path.resolve(argv.data)); } catch (e) { log.verbose('File not found [%s]', argv.data); try { // Not a file, try inlined data data = JSON.parse(argv.data); } catch (r) { log.error('Failed to parse inline data: %s', r.message); exit(); } } log.debug('Found %s data entries', data.length); data = util.isArray(data) ? data : [data]; // Generate headers object if (argv.H) { for (var i = argv.H.length - 1; i >= 0; i--) { var h = argv.H[i].split(/\s*:\s*/); headers[h[0]] = h[1]; } } // Make requests to endpoint data.forEach(function(d, i) { var reqId = shortid.generate(); requests.push(function(cb) { log.info('{req-%s} [%s] %s [%s/%s]', reqId, argv.X, apiEndpointUrl, i + 1, data.length); log.verbose('{req-%s} Request body: %s', reqId, JSON.stringify(d)); request({ method: argv.X, url: apiEndpointUrl, json: true, headers: headers, body: d }, function(err, res, body) { if (err) { log.error('{req-%s} Request failed', reqId, err); } else { if (res.statusCode >= 400) { log.warn('{req-%s} Request failed (%s - %s)', reqId, res.statusCode, res.statusMessage); } else { log.debug('{req-%s} Request successful (%s - %s)', reqId, res.statusCode, res.statusMessage); } log.verbose('{req-%s} Got response back: %s', reqId, JSON.stringify(body)); } return cb(err); }); }); }); // Wait for requests to complete async.parallel(requests, function(err) { if (err) { log.warn('There were errors on some requests (see above)'); } log.info('%s request%s completed %s', requests.length, requests.length > 1 ? 's' : '', moment.duration(moment().diff(start)).humanize(true)); });
JavaScript
0.000001
@@ -398,16 +398,222 @@ 'data')%0A + .describe('count', 'Max number of request to send')%0A .alias('count', 'c')%0A .describe('skip', 'Number of ignored entries in the data array (starting from 0)')%0A .alias('skip', 's')%0A .default('skip', 0)%0A .descr @@ -2495,19 +2495,19 @@ %0A for ( -var +let i = arg @@ -2617,69 +2617,205 @@ %0A// -Make requests to endpoint%0Adata.forEach(function(d, i +Set number of request to perform (equals length of data array, by default)%0Aargv.count = argv.count %7C%7C data.length;%0A%0A// Make requests to endpoint%0Afor (let j = argv.skip; j %3C argv.count; j++ ) %7B%0A -var +let req @@ -2839,16 +2839,35 @@ rate();%0A + let d = data%5Bj%5D;%0A reques @@ -2965,26 +2965,25 @@ rl, -i +j + 1, -data.length +argv.count );%0A @@ -3692,18 +3692,16 @@ %0A %7D);%0A%7D -); %0A%0A// Wai
cebf3e67d4b94952bfb0285c2b878114072b63e2
fix loading library from examples
generators/react/templates/root/examples/example/app.js
generators/react/templates/root/examples/example/app.js
import React, {Component} from 'react'; import ReactDOM from 'react-dom'; import {Dummy} from '../..'; const App = class App extends Component { constructor(props) { super(props); this.state = {}; } render() { return ( <div> <Dummy></Dummy> </div> ); } }; ReactDOM.render( <App />, document.getElementById('example') );
JavaScript
0
@@ -94,16 +94,20 @@ m '../.. +/src ';%0A%0Acons
299a0c04fcb6802e1af6719e0faae9289cf5e278
Change database table initialisation and naming
db/index.js
db/index.js
/* Core database initiation and connection */ const async = require('async'), config = require('../config'), redisDB = require('redis'), r = require('rethinkdb'); const dbVersion = 2; let rcon; // Buffers commands, so no need for callback function redisClient() { const client = redisDB.createClient({ host: config.redis_host, port: config.REDIS_PORT }); client.select(config.redis_database || 0); return client; } exports.redisClient = redisClient; const redis = global.redis = redisClient(); redis.on('error', err => winston.error('Redis error:', err)); // Establish rethinkDB connection and intialize the database function init(cb) { async.waterfall([ next => r.connect({ host: config.rethink_host, port: config.rethinkdb_port }, next), (conn, next) => { rcon = global.rcon = conn; // Check if database exists r.dbList().contains('meguca').do(exists => r.branch(exists, {dbs_created: 0}, r.dbCreate('meguca')) ).run(rcon, next); }, (res, next) => { rcon.use('meguca'); createTables(['main'], next); }, (res, next) => r.table('main').get('info').run(rcon, next), // Intialize main table or check version (info, next) => { if (info) { verifyVersion(info.dbVersion, 'RethinkDB'); next(null, null); } else { r.table('main').insert([ {id: 'info', dbVersion}, {id: 'post_ctr'}, {id: 'cache'} ]).run(rcon, next); } }, // Check redis version (res, next) => redis.get('dbVersion', next), (version, next) => { if (version) verifyVersion(parseInt(version), 'Redis'); next(); }, initBoards // Pass connection to callback ], err => cb(err, rcon)); } exports.init = init; // Create tables, if they don't exist function createTables(tables, cb) { r.expr(tables) .difference(r.tableList()) .forEach(name => r.tableCreate(name)) .run(rcon, cb); } function verifyVersion(version, dbms) { if (version !== dbVersion) { throw new Error(`Incompatible ${dbms} database version: ${version} ;` + 'See docs/migration.md'); } } function initBoards(cb) { createTables(config.BOARDS.map((board => '_' + board)), err => cb(err)) }
JavaScript
0
@@ -918,37 +918,13 @@ sts, -%0A%09%09%09%09%09%7Bdbs_created: 0%7D,%0A%09%09%09%09%09 + %7B%7D, r.db @@ -1009,16 +1009,49 @@ eguca'); +%0A%0A%09%09%09// Create all tables at once %0A%09%09%09crea @@ -1065,14 +1065,37 @@ s(%5B' +_ main'%5D +.concat(config.BOARDS) , ne @@ -1129,24 +1129,25 @@ %09%09%09r.table(' +_ main').get(' @@ -1346,16 +1346,17 @@ .table(' +_ main').i @@ -1365,15 +1365,8 @@ ert( -%5B%0A%09%09%09%09%09 %7Bid: @@ -1388,58 +1388,15 @@ ion%7D -, +) %0A%09%09%09%09%09 -%7Bid: 'post_ctr'%7D,%0A%09%09%09%09%09%7Bid: 'cache'%7D%0A%09%09%09%09%5D) .run @@ -1598,22 +1598,8 @@ %0A%09%09%7D -,%0A%09%09initBoards %0A%09%09/ @@ -2001,10 +2001,10 @@ ion%7D - ; + %60%0A%09%09 @@ -2041,106 +2041,4 @@ %7D%0A%7D%0A -%0Afunction initBoards(cb) %7B%0A%09createTables(config.BOARDS.map((board =%3E '_' + board)), err =%3E cb(err))%0A%7D%0A
597902a420b8fe323238fd3f82cc412256d46f21
support sorting of keys
tasks/lib/update_json.js
tasks/lib/update_json.js
/* * grunt-update-json * https://github.com/andreaspizsa/grunt-update-json * * Copyright (c) 2013 * Licensed under the MIT license. */ 'use strict'; var _ = require('lodash'), pointer = require('json-pointer'), // avoid the lint demons jsonPath = require('JSONPath')["eval".slice()]; var re = { PATH_POINT: /^(\\)?((\$\.|\/)?.*)/, DELIM: /\s*,\s*/, RENAME: /^(.*?)\s*>\s*(.*?)$/ }; var taskName = 'update_json', taskDescription = 'Update JSON files with data from other JSON files'; // Parse a fieldspec, like ["field", "to<from", {"to": "from"}] function mergeField(memo, key){ var result = {}, match; if(_.isPlainObject(key)){ result = key; }else if(_.isString(key) && (match = key.match(re.RENAME))){ result[match[2]] = match[1]; }else{ result[key] = null; } return _.merge(memo, result); } // factory for a reduce function, bound to the input, that can get // the value out of the input function expandField(input, grunt){ var get = pointer(input); return function(memo, fin, fout){ if(_.isString(fin)){ var match = fin.match(re.PATH_POINT); // matched ...with a `$.` ...but not with a `\` if(match && match[3] === '$.' && !match[1]){ // field name, starts with an unescaped `$`, treat as JSON Path memo[fout] = jsonPath(input, match[2]); }else if(match && match[3] === '/' && !match[1]){ // field name, treat as a JSON pointer memo[fout] = get(match[2]); }else{ memo[fout] = input[match[2]]; } }else if(_.isFunction(fin)){ // call a function memo[fout] = fin(input); }else if(_.isArray(fin)){ // pick out the values memo[fout] = _.map(fin, function(value){ return expandField(input)({}, value, "dummy")["dummy"]; }); }else if(_.isObject(fin)){ // build up an object of something else memo[fout] = _.reduce(fin, expandField(input, grunt), {}); }else if(_.isNull(fin)){ // copy the value memo[fout] = input[fout]; }else{ grunt.fail.warn('Could not map `' + JSON.stringify(fin) + '` to `' + JSON.stringify(fout) + '`'); } return memo; }; } function normalizeFields(fields){ // put fields in canonical (key-value object) form // first, break up a single string, if found if(_.isString(fields)){ fields = fields.split(re.DELIM); } // then, turn an array of fieldspecs: // ["field", "from>to", {"from": "to"}] if(_.isArray(fields)){ fields = _.reduce(fields, mergeField, {}); } return fields; } function updateJSON(grunt, files, fields, options){ fields = normalizeFields(fields); options = options || {}; files.forEach(function(file){ var src = file.src; if(!src || _.isEmpty(src)){ src = options.src; if(!src || _.isEmpty(src = grunt.file.expand(src))){ grunt.fail.warn('No data found from which to update.'); } } // load the current output, if it exists var output = grunt.file.exists(file.dest) ? grunt.file.readJSON(file.dest) : {}, // build up a union object of src files input = src.reduce(function(data, src){ return _.merge(data, grunt.file.readJSON(src)); }, {}); var copied = _.reduce(fields, expandField(input, grunt), {}); grunt.file.write( file.dest, JSON.stringify(_.merge(output, copied), null, options.indent) + '\n' ); }); } updateJSON.taskName = taskName; updateJSON.taskDescription = taskDescription; module.exports = exports = updateJSON;
JavaScript
0.000002
@@ -289,16 +289,64 @@ slice()%5D +,%0A stringify = require('json-stable-stringify') ;%0A%0A%0Avar @@ -3364,55 +3364,269 @@ %7B%7D) -;%0A%0A grunt.file.write(%0A file.dest,%0A +,%0A jsonStr;%0A%0A // if sorting was requested%0A if (options.sort) %7B%0A // do stringify of the passed object with sort%0A jsonStr = stringify(_.merge(output, copied), %7B space: options.indent %7D);%0A %7D else %7B%0A // do stringify only%0A jsonStr = JSO @@ -3687,20 +3687,62 @@ ent) +;%0A %7D%0A grunt.file.write(file.dest, jsonStr + '%5Cn' -%0A );%0A
123f5221644500a6bc7c4cdf8f9e24bb68eadb5d
Fix dualcam example
examples/dualcam/main.js
examples/dualcam/main.js
'use strict'; var viewer; var OSG = window.OSG; OSG.globalify(); var osg = window.osg; var osgGA = window.osgGA; var osgUtil = window.osgUtil; var osgDB = window.osgDB; var osgViewer = window.osgViewer; var viewer; function setupScene( viewer, sceneData ) { // load scene... as usual viewer.setSceneData( sceneData ); // setup manipulator viewer.setupManipulator( new osgGA.OrbitManipulator() ); viewer.getManipulator().setNode( viewer.getSceneData() ); viewer.getManipulator().computeHomePosition(); viewer.getManipulator().setEyePosition( [ 0, -10, 5 ] ); viewer.run(); } function onSceneLoaded( viewer, data ) { new Q( osgDB.parseSceneGraph( data ) ).then( function ( sceneData ) { setupScene( viewer, sceneData ); } ); } function onURLloaded( url, viewer ) { osg.log( 'loading ' + url ); var req = new XMLHttpRequest(); req.open( 'GET', url, true ); req.onload = function () { onSceneLoaded( viewer, JSON.parse( req.responseText ) ); osg.log( 'success ' + url ); }; req.onerror = function () { osg.log( 'error ' + url ); }; req.send( null ); } // Find the right method, call on correct element function launchFullscreen( element, hmd ) { if ( element.requestFullscreen ) { element.requestFullscreen( hmd ); } else if ( element.mozRequestFullScreen ) { element.mozRequestFullScreen( hmd ); } else if ( element.webkitRequestFullscreen ) { element.webkitRequestFullscreen( hmd ); } else if ( element.msRequestFullscreen ) { element.msRequestFullscreen( hmd ); } } function exitFullscreen() { if ( document.exitFullscreen ) { document.exitFullscreen(); } else if ( document.mozCancelFullScreen ) { document.mozCancelFullScreen(); } else if ( document.webkitExitFullscreen ) { document.webkitExitFullscreen(); } } var vrNode; var modelNode; var vrState = false; var fullscreen = false; function toggleVR() { var sceneData = viewer.getSceneData(); // Enable VR if ( !vrState ) { // Detach the model from sceneData and cache it modelNode = sceneData.getChildren()[ 0 ]; sceneData.removeChild( modelNode ); // If no vrNode (first time vr is toggled), create one // The modelNode will be attached to it if ( !vrNode ) { if ( navigator.getVRDevices ) vrNode = osgUtil.WebVR.createScene( viewer, modelNode, viewer._eventProxy.Oculus._hmd ); else vrNode = osgUtil.Oculus.createScene( viewer, modelNode ); } // Attach the vrNode to sceneData instead of the model sceneData.addChild( vrNode ); } // Disable VR else { // Detach the vrNode and reattach the modelNode sceneData.removeChild( vrNode ); sceneData.addChild( modelNode ); } vrState = !vrState; } // On some platforms, (chrome * android), this event is fired too early // And the WebVR retrieve the canvas size before the canvas gets resized to fullscreen // So we could add a little delay via setTimeout to ensure we get the fullscreen size // Prefixed on Firefox up to v33 document.addEventListener( 'mozfullscreenchange', function () { toggleVR(); fullscreen = !fullscreen; } ); // Prefixed on Chrome up to v38 document.addEventListener( 'webkitfullscreenchange', function () { setTimeout( toggleVR, 500 ); fullscreen = !fullscreen; } ); document.addEventListener( 'msfullscreenchange', function () { toggleVR(); fullscreen = !fullscreen; }, false ); document.addEventListener( 'fullscreenchange', function () { toggleVR(); fullscreen = !fullscreen; } ); function requestVRFullscreen() { if ( !navigator.getVRDevices ) { osg.log( 'WebVR Api is not supported by your navigator' ); } var canvas = viewer.getGraphicContext().canvas; if ( fullscreen === false ) launchFullscreen( canvas, { vrDisplay: viewer._eventProxy.Oculus.getHmd(); } ); else exitFullscreen(); // var fullscreenRect = canvas.getBoundingClientRect(); // console.log(fullscreenRect.width, fullscreenRect.height); } function init() { var canvas = document.getElementById( 'View' ); viewer = new osgViewer.Viewer( canvas ); viewer.init(); viewer.setLightingMode( osgViewer.View.LightingMode.SKYLIGHT ); // onSceneLoaded( viewer, getPokerScene() ); // setupScene( viewer, getSimpleScene() ); onURLloaded( 'models/ogre.osgjs', viewer ); var button = document.getElementById( 'button' ); button.addEventListener( 'click', requestVRFullscreen, false ); window.addEventListener( 'keypress', function ( event ) { if ( event.charCode === 'f'.charCodeAt( 0 ) ) requestVRFullscreen(); }, true ); } window.addEventListener( 'load', init, true );
JavaScript
0
@@ -2423,16 +2423,45 @@ Devices +%7C%7C navigator.mozGetVRDevices )%0A @@ -2555,12 +2555,16 @@ lus. -_hmd +getHmd() );%0A @@ -3835,16 +3835,46 @@ Devices +&& !navigator.mozGetVRDevices ) %7B%0A @@ -4121,17 +4121,16 @@ getHmd() -; %0A
67e00488165cf40bf46157e0555e76d6adced1e8
Update self service example
examples/self-service.js
examples/self-service.js
/* jshint node: true */ "use strict"; var MUN = require(".."); var username = "YOUR MUN STUDENT NUMBER"; var password = "YOUR SELF SERVICE PIN #"; MUN.selfService.finalExamSchedule([ username, password ]) .then( function (results) { var exams = JSON.parse(results[0]); console.log(exams); }, function (error) { console.error(error); } );
JavaScript
0
@@ -143,16 +143,163 @@ IN #%22;%0A%0A +/**%0A * The MUN.selfService object exposes:%0A *%0A * .finalExamSchedule(%5B username, password %5D)%0A * .academicRecord(%5B username, password %5D)%0A */%0A MUN.self
0d4ebcdfeda1e2b8ca43cb03aae864affcefcabe
Fix map focus with multiple polygons
mainapp/assets/js/createMap.js
mainapp/assets/js/createMap.js
import L from "leaflet"; import {CooperativeScrollWheelZoom} from "./LeafletCooperativeScrollWheelZoom"; const outlineStroke = { weight: 1, fillColor: "#ffffff", fillOpacity: 0.75, stroke: true, color: "#0000ff", opacity: 0.5, dashArray: [2, 4] }; function coordsToPolygon(coords) { return coords[0].map((lnglat) => L.latLng(lnglat[1], lnglat[0])); } function getOutlineAsPolygons(outline) { let polygons = []; if (typeof (outline) === "string") { outline = JSON.parse(outline); } // The shape of the city itself is the "hole" in the polygon if (outline["type"] && outline["type"] === "Polygon") { polygons.push(coordsToPolygon(outline["coordinates"])); } if (outline["features"]) { outline["features"].forEach((feature) => { if (feature["geometry"]["type"] === "MultiPolygon") { feature["geometry"]["coordinates"].forEach((coords) => polygons.push(coordsToPolygon(coords))); } if (feature["geometry"]["type"] === "Polygon") { polygons.push(coordsToPolygon(feature["geometry"]["coordinates"])); } }); } return polygons; } function setTiles(leaflet, initData) { let tiles = initData["tiles"]; switch (tiles["provider"]) { case "OSM": L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { attribution: 'Map data © <a href="https://www.openstreetmap.org">OpenStreetMap</a>', }).addTo(leaflet); break; case "Mapbox": let tileUrl = (tiles["tileUrl"] ? tiles["tileUrl"] : "https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}{highres}.png?access_token={accessToken}"); L.tileLayer(tileUrl, { attribution: 'Map data &copy; <a href="https://www.openstreetmap.org">OpenStreetMap</a>, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com">Mapbox</a>', accessToken: tiles['token'], highres: (window.devicePixelRatio > 1.5 ? '@2x' : '') }).addTo(leaflet); break; } } function setBoundsAndOutline(leaflet, polygons) { let cityBounds = L.polygon(polygons[0]).getBounds(); let paddedBounds = cityBounds.pad(1); // View is limit to the city and a bit of surrounding area leaflet.setMaxBounds(paddedBounds); // Sets the initial zoom leaflet.fitBounds(cityBounds); // We don"t want the user to be able zoom out so far he can see we"re using a bounding box leaflet.setMinZoom(leaflet.getBoundsZoom(paddedBounds, true)); // The white-ishly blurred area is paddedBounds as polygon let blurringBounds = [ paddedBounds.getNorthEast(), paddedBounds.getNorthWest(), paddedBounds.getSouthWest(), paddedBounds.getSouthEast(), ]; // This will make the inner part by normal and outer surrounding area white-ish polygons.unshift(blurringBounds); let polygonLayer = L.polygon(polygons, outlineStroke); leaflet.addLayer(polygonLayer); } function setZoomBehavior(leaflet) { leaflet.addHandler("cooperativezoom", CooperativeScrollWheelZoom); leaflet.cooperativezoom.enable(); } function setScrollingBehavior(noTouchDrag, leaflet, $map_element) { if (noTouchDrag === true) { setZoomBehavior(leaflet); let mouseMode = false; $map_element.one("mousedown mousemove", (ev) => { if (ev.originalEvent.sourceCapabilities && ev.originalEvent.sourceCapabilities.firesTouchEvents === true) { // Ghost event triggered by touching the map return; } leaflet.dragging.enable(); mouseMode = true; }); $map_element.on("focus", () => { if (!mouseMode) { leaflet.dragging.enable(); } }); $map_element.on("blur", () => { if (!mouseMode) { leaflet.dragging.disable(); } }); } } export default function ($map_element, initData, noTouchDrag) { // noTouchDrag: Dragging is disabled by default. // For mouse users, it is enabled once the first mouse-typical event occurs // For touch users, it is enabled as long as the map has the focus // This behavior is enabled for maps that are shown by default. Drop-down-maps keep leaflet"s default behavior. let leaflet = L.map($map_element.attr("id"), { maxBoundsViscosity: 1, maxZoom: 19, scrollWheelZoom: !(noTouchDrag === true), dragging: !(noTouchDrag === true), zoomSnap: 0.1, }); setTiles(leaflet, initData); if (initData["outline"]) { let polygons = getOutlineAsPolygons(initData["outline"]); setBoundsAndOutline(leaflet, polygons); } else { // If nothing else is said explicitly, we"re probably talking about the Tokyo Tower let initCenter = L.latLng(35.658611, 139.745556); let initZoom = 15; leaflet.setView(initCenter, initZoom); } setScrollingBehavior(noTouchDrag, leaflet, $map_element); return leaflet; };
JavaScript
0
@@ -2239,24 +2239,66 @@ polygons) %7B%0A + // Create a bound around all polygons%0A let city @@ -2338,24 +2338,138 @@ etBounds();%0A + for (let polygon of polygons) %7B%0A cityBounds = cityBounds.extend(L.polygon(polygon).getBounds());%0A %7D%0A let padd
a225b484821ae0bb334a44ffc558093536783350
introduce a temporary patch to make node_modules/rxjs compile with typescript 2.7 (#22669)
tools/postinstall-patches.js
tools/postinstall-patches.js
const {set, cd, sed} = require('shelljs'); const path = require('path'); console.log('===== about to run the postinstall.js script ====='); // fail on first error set('-e'); // print commands as being executed set('-v'); // jump to project root cd(path.join(__dirname, '../')); console.log('===== finished running the postinstall.js script =====');
JavaScript
0
@@ -277,16 +277,380 @@ ./'));%0A%0A +// https://github.com/ReactiveX/rxjs/pull/3302%0A// make node_modules/rxjs compilable with Typescript 2.7%0A// remove when we update to rxjs v6%0Aconsole.log('%5Cn# patch: reactivex/rxjs#3302 make node_modules/rxjs compilable with Typescript 2.7')%0Ased('-i', %22('response' in xhr)%22, %22('response' in (xhr as any))%22, %22node_modules/rxjs/src/observable/dom/AjaxObservable.ts%22)%0A%0A %0Aconsole
7ad013522e879870a1829252abb65b818bb437db
Add default STATIC_CACHE_AGE to server.site.js
tools/servers/server.site.js
tools/servers/server.site.js
var _ = require('lodash'), express = require('express'); module.exports = function confgureServer(config, app) { var app = app || express(); if (_.get(config, 'server.options.logs')) { app.use(require('morgan')('dev')); } if (_.get(config, 'server.options.gzip')) { app.use(require('compression')()); } app.use('\.html$', express.static(config.destPath)); app.use(express.static(config.destPath, { maxAge: _.get(config, 'server.options.cacheAge'), index: false })); // Fall back to serving index, if no file is found app.get('/', function serveIndex(request, response) { return response.sendFile('index.html', { root: config.appAssets.html.dest }); }); return app; };
JavaScript
0
@@ -52,16 +52,77 @@ xpress') +,%0A STATIC_CACHE_AGE = 365 * 24 * 60 * 60 * 1000; // 1 year ;%0A%0Amodul @@ -534,16 +534,34 @@ acheAge' +, STATIC_CACHE_AGE ),%0A i
9945a2889413ccf4c97f878d0a18f8e3afad75f8
Rename internal variable
symphony/assets/symphony.collapsible.js
symphony/assets/symphony.collapsible.js
/** * @package assets */ (function($) { /** * This plugin makes items collapsible. * * @name $.symphonyCollapsible * @class * * @param {Object} options An object specifying containing the attributes specified below * @param {String} [options.items='.instance'] Selector to find collapsible items within the container * @param {String} [options.handles='.header:first'] Selector to find clickable handles to trigger interaction * @param {String} [options.content='.content'] Selector to find hideable content area * @param {String} [options.controls=true] Add controls to collapse/expand all instances * @param {String} [options.save_state=true] Stores states of instances using local storage * @param {String} [options.storage='symphony.collapsible.id.env'] Namespace used for local storage * * @example var collapsible = $('#duplicator').symphonyCollapsible({ items: '.instance', handles: '.header span' }); collapsible.collapseAll(); */ $.fn.symphonyCollapsible = function(options) { var objects = this, settings = { items: '.instance', handles: '.header:first', content: '.content', controls: true, save_state: true, storage: 'symphony.collapsible.' + $('body').attr('id') + (Symphony.Context.get('env')[1] ? '.' + Symphony.Context.get('env')[1] : '') }; $.extend(settings, options); /*-----------------------------------------------------------------------*/ // Language strings Symphony.Language.add({ 'Expand all': false, 'Collapse all': false }); /*-----------------------------------------------------------------------*/ objects.each(function(index) { var object = $(this), storage = settings.storage + '.' + index + '.collapsed'; /*-------------------------------------------------------------------*/ // Collapse item object.on('collapse.collapsible', settings.items, function(event, imediate) { var item = $(this), content = item.find(settings.content), speed = 'fast'; // Imediate switch? if(imediate === true) { speed = 0; } // Collapse item item.trigger('collapsestart.collapsible'); content.slideUp(speed, function() { item.addClass('collapsed'); item.trigger('collapsestop.collapsible'); }); }); // Expand item object.on('expand.collapsible', settings.items, function(event) { var item = $(this), content = item.find(settings.content); // Collapse item item.trigger('expandstart.collapsible'); content.slideDown('fast', function() { item.removeClass('collapsed'); item.trigger('expandstop.collapsible'); }); }); // Toggle single item object.on('click.collapsible', settings.handles, function() { var handle = $(this), item = handle.parents(settings.items); // Expand if(item.is('.collapsed')) { item.trigger('expand.collapsible'); } // Collapse else { item.trigger('collapse.collapsible'); } }); // Toggle all object.on('click.collapsible', 'a.collapser', function(event) { var collapser = $(this), items = object.find(settings.items); // Collapse all if(collapser.text() == Symphony.Language.get('Collapse all')) { items.trigger('collapse.collapsible'); } // Expand all else { items.trigger('expand.collapsible'); } }); // Update controls to expand all object.on('collapsestop.collapsible', settings.items, function(event) { var item = $(this); if(item.siblings().filter(':not(.collapsed)').size() == 0) { object.find('a.collapser').text(Symphony.Language.get('Expand all')); } }); // Update controls to collapse all object.on('expandstop.collapsible', settings.items, function(event) { var item = $(this); if(item.siblings().filter('.collapsed').size() == 0) { object.find('a.collapser').text(Symphony.Language.get('Collapse all')); } }); // Save states object.on('collapsestop.collapsible expandstop.collapsible', settings.items, function(event) { if(settings.save_state === true && Symphony.Support.localStorage === true) { var collapsed = object.find(settings.items).map(function(index) { if($(this).is('.collapsed')) { return index; }; }); localStorage[storage] = collapsed.get().join(','); } }); // Restore states object.on('restore.collapsible', function(event) { if(settings.save_state === true && Symphony.Support.localStorage === true && localStorage[storage]) { $.each(localStorage[storage].split(','), function(index, value) { object.find(settings.items).eq(value).trigger('collapse.collapsible', [true]); }); } }); /*-------------------------------------------------------------------*/ // Prepare interface object.addClass('collapsible'); // Build controls if(settings.controls === true) { var top = object.find('> :first-child'), bottom = object.find('> :last-child'), collapser = $('<a />', { class: 'collapser', text: Symphony.Language.get('Collapse all') }), controls = $('<div />', { class: 'controls' }).append(collapser.clone()); // Existing top controls if(top.is('.controls')) { top.prepend(collapser); } // Create missing top controls else { object.prepend(controls.addClass('top')); } // Existing bottom controls if(bottom.is('.controls')) { bottom.prepend(collapser); } // Create missing bottom controls else { object.append(controls); } } // Restore states object.trigger('restore.collapsible'); }); /*-----------------------------------------------------------------------*/ return objects; }; })(jQuery.noConflict());
JavaScript
0.000003
@@ -1942,23 +1942,24 @@ event, i -mediate +nstantly ) %7B%0A%09%09%09%09 @@ -2052,23 +2052,22 @@ %09%09%09%09// I -mediate +nstant switch? @@ -2079,15 +2079,16 @@ if(i -mediate +nstantly ===
86d5a54356e0bc93ab4e0ba141415c749cfcd311
Remove un-needed things from app_stub.js
backend/app_stub.js
backend/app_stub.js
/* * Modules */ var express = require('express'); var Q = require('q'); var http = require('http'); var fs = require('fs'); //var powernode = require('./lib/powernode'); /* * Configuration */ var config = JSON.parse(fs.readFileSync('config.json')); //var secrets = JSON.parse(fs.readFileSync('secrets.json')); var version = JSON.parse(fs.readFileSync('package.json')).version; //powernode.setAppString('CenterScout v' + version); /* * ExpressJS Setup */ // Create ExpressJS instance var app = express(); // Default port is 8080 app.set('port', process.env.PORT || 8080); // Define static/ folder app.use(express.static('./static')); // Middleware for POST requests app.use(express.json()); app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); next(); }); /* * API Endpoints */ var data = [ { 'name': 'Chapter 12 TEST', 'class': 'Math', 'date': '02/15', 'percent': '98%', 'fraction': '49/50' }, { 'name': 'Chapter 12 Homework', 'class': 'Math', 'date': '05/29', 'percent': '100%', 'fraction': '24/24' }, { 'name': 'Chapter 12.3 Quiz', 'class': 'Math', 'date': '05/30', 'percent': '86%', 'fraction': '26/30' }, { 'name': 'Phone Case Project', 'class': 'CAD', 'date': '06/01', 'percent': '100%', 'fraction': '30/30' }, { 'name': 'Machine Vise Project', 'class': 'CAD', 'date': '03/16', 'percent': '100%', 'fraction': '30/30' }, { 'name': 'Portfolio Project', 'class': 'English', 'date': '02/15', 'percent': '98%', 'fraction': '49/50' }, { 'name': 'Odyssey TEST', 'class': 'English', 'date': '10/15', 'percent': '94%', 'fraction': '94/100' }, { 'name': 'Odyssey Project', 'class': 'English', 'date': '10/20', 'percent': '100%', 'fraction': '50/50' }, { 'name': 'Chapter 12 TEST', 'class': 'History', 'date': '06/01', 'percent': '90%', 'fraction': '45/50' }, { 'name': 'Chapter 13 TEST', 'class': 'History', 'date': '03/16', 'percent': '96%', 'fraction': '46/50' } ]; // Get PowerSchool(R) data app.get('/api/grades', function(req, res) { var username = req.body.username; var password = req.body.password; res.writeHead(200, { 'Content-Type': 'application/json' }); // powernode // .getStudentData('chsd115.lfschools.net', username, password) // .then(JSON.stringify).then(res.end); res.end(JSON.stringify(data)); }); // Get assignments from www.lakeforestschools.org app.get('/api/assignments', function(req, res) { }); /* * NodeJS Setup */ // Create and start HTTP server // TODO: Use HTTPS http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener http.createServer(app).listen(app.get('port'), function() { console.log('Server started.'); });
JavaScript
0.000005
@@ -10,25 +10,24 @@ Modules%0A */%0A -%0A var express @@ -52,30 +52,8 @@ ');%0A -var Q = require('q');%0A var @@ -103,54 +103,8 @@ s'); -%0A//var powernode = require('./lib/powernode'); %0A%0A/* @@ -191,69 +191,8 @@ ));%0A -//var secrets = JSON.parse(fs.readFileSync('secrets.json'));%0A var @@ -259,62 +259,8 @@ n;%0A%0A -//powernode.setAppString('CenterScout v' + version);%0A%0A /*%0A @@ -2743,145 +2743,8 @@ %7D);%0A - // powernode%0A // .getStudentData('chsd115.lfschools.net', username, password)%0A // .then(JSON.stringify).then(res.end);%0A @@ -2915,141 +2915,8 @@ */%0A%0A -// Create and start HTTP server%0A// TODO: Use HTTPS http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener%0A http
6409e65d4ad0f189d4e09d2a8e31b254ba72afec
Set `this.isEmpty = true` in `Dropdown.empty()`
src/typeahead/dropdown.js
src/typeahead/dropdown.js
/* * typeahead.js * https://github.com/twitter/typeahead.js * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT */ var Dropdown = (function() { // constructor // ----------- function Dropdown(o) { var that = this, onSuggestionClick, onSuggestionMouseEnter, onSuggestionMouseLeave; o = o || {}; if (!o.menu) { $.error('menu is required'); } this.isOpen = false; this.isEmpty = true; this.datasets = _.map(o.datasets, initializeDataset); // bound functions onSuggestionClick = _.bind(this._onSuggestionClick, this); onSuggestionMouseEnter = _.bind(this._onSuggestionMouseEnter, this); onSuggestionMouseLeave = _.bind(this._onSuggestionMouseLeave, this); this.$menu = $(o.menu) .on('click.tt', '.tt-suggestion', onSuggestionClick) .on('mouseenter.tt', '.tt-suggestion', onSuggestionMouseEnter) .on('mouseleave.tt', '.tt-suggestion', onSuggestionMouseLeave); _.each(this.datasets, function(dataset) { that.$menu.append(dataset.getRoot()); dataset.onSync('rendered', that._onRendered, that); }); } // instance methods // ---------------- _.mixin(Dropdown.prototype, EventEmitter, { // ### private _onSuggestionClick: function onSuggestionClick($e) { this.trigger('suggestionClicked', $($e.currentTarget)); }, _onSuggestionMouseEnter: function onSuggestionMouseEnter($e) { this._removeCursor(); this._setCursor($($e.currentTarget), true); }, _onSuggestionMouseLeave: function onSuggestionMouseLeave($e) { this._removeCursor(); }, _onRendered: function onRendered() { this.isEmpty = _.every(this.datasets, isDatasetEmpty); this.isEmpty ? this._hide() : (this.isOpen && this._show()); this.trigger('datasetRendered'); function isDatasetEmpty(dataset) { return dataset.isEmpty(); } }, _hide: function() { this.$menu.hide(); }, _show: function() { // can't use jQuery#show because $menu is a span element we want // display: block; not dislay: inline; this.$menu.css('display', 'block'); }, _getSuggestions: function getSuggestions() { return this.$menu.find('.tt-suggestion'); }, _getCursor: function getCursor() { return this.$menu.find('.tt-cursor').first(); }, _setCursor: function setCursor($el, silent) { $el.first().addClass('tt-cursor'); !silent && this.trigger('cursorMoved'); }, _removeCursor: function removeCursor() { this._getCursor().removeClass('tt-cursor'); }, _moveCursor: function moveCursor(increment) { var $suggestions, $oldCursor, newCursorIndex, $newCursor; if (!this.isOpen) { return; } $oldCursor = this._getCursor(); $suggestions = this._getSuggestions(); this._removeCursor(); // shifting before and after modulo to deal with -1 index newCursorIndex = $suggestions.index($oldCursor) + increment; newCursorIndex = (newCursorIndex + 1) % ($suggestions.length + 1) - 1; if (newCursorIndex === -1) { this.trigger('cursorRemoved'); return; } else if (newCursorIndex < -1) { newCursorIndex = $suggestions.length - 1; } this._setCursor($newCursor = $suggestions.eq(newCursorIndex)); // in the case of scrollable overflow // make sure the cursor is visible in the menu this._ensureVisible($newCursor); }, _ensureVisible: function ensureVisible($el) { var elTop, elBottom, menuScrollTop, menuHeight; elTop = $el.position().top; elBottom = elTop + $el.outerHeight(true); menuScrollTop = this.$menu.scrollTop(); menuHeight = this.$menu.height() + parseInt(this.$menu.css('paddingTop'), 10) + parseInt(this.$menu.css('paddingBottom'), 10); if (elTop < 0) { this.$menu.scrollTop(menuScrollTop + elTop); } else if (menuHeight < elBottom) { this.$menu.scrollTop(menuScrollTop + (elBottom - menuHeight)); } }, // ### public close: function close() { if (this.isOpen) { this.isOpen = false; this._removeCursor(); this._hide(); this.trigger('closed'); } }, open: function open() { if (!this.isOpen) { this.isOpen = true; !this.isEmpty && this._show(); this.trigger('opened'); } }, setLanguageDirection: function setLanguageDirection(dir) { this.$menu.css(dir === 'ltr' ? css.ltr : css.rtl); }, moveCursorUp: function moveCursorUp() { this._moveCursor(-1); }, moveCursorDown: function moveCursorDown() { this._moveCursor(+1); }, getDatumForSuggestion: function getDatumForSuggestion($el) { var datum = null; if ($el.length) { datum = { raw: Dataset.extractDatum($el), value: Dataset.extractValue($el), datasetName: Dataset.extractDatasetName($el) }; } return datum; }, getDatumForCursor: function getDatumForCursor() { return this.getDatumForSuggestion(this._getCursor().first()); }, getDatumForTopSuggestion: function getDatumForTopSuggestion() { return this.getDatumForSuggestion(this._getSuggestions().first()); }, update: function update(query) { _.each(this.datasets, updateDataset); function updateDataset(dataset) { dataset.update(query); } }, empty: function empty() { _.each(this.datasets, clearDataset); function clearDataset(dataset) { dataset.clear(); } }, isVisible: function isVisible() { return this.isOpen && !this.isEmpty; }, destroy: function destroy() { this.$menu.off('.tt'); this.$menu = null; _.each(this.datasets, destroyDataset); function destroyDataset(dataset) { dataset.destroy(); } } }); return Dropdown; // helper functions // ---------------- function initializeDataset(oDataset) { return new Dataset(oDataset); } })();
JavaScript
0.997792
@@ -5569,32 +5569,59 @@ , clearDataset); +%0A this.isEmpty = true; %0A%0A function
6ea250f02d2d60b17aaaa6e736d44996f4aa7fcd
Change config.database.deliveryRecordsExpire to 2
src/util/config/schema.js
src/util/config/schema.js
const Joi = require('@hapi/joi') const decodeValidator = require('./validation/decode.js') const timezoneValidator = require('./validation/timezone.js') const localeValidator = require('./validation/locale.js') const logSchema = Joi.object({ level: Joi.string().strict().valid('silent', 'trace', 'debug', 'info', 'owner', 'warn', 'error', 'fatal').default('info'), destination: Joi.string().allow('').default(''), linkErrs: Joi.bool().strict().default(true), unfiltered: Joi.bool().strict().default(true), failedFeeds: Joi.bool().strict().default(true) }) const botSchema = Joi.object({ token: Joi.string().strict().default(''), locale: localeValidator.config().locale(), enableCommands: Joi.bool().strict().default(true), prefix: Joi.string().strict().default('rss.'), status: Joi.string().valid('online', 'dnd', 'invisible', 'idle').default('online'), activityType: Joi.string().valid('', 'PLAYING', 'STREAMING', 'LISTENING', 'WATCHING').default(''), activityName: Joi.string().strict().allow('').default(''), streamActivityURL: Joi.string().strict().allow('').default(''), ownerIDs: Joi.array().items(Joi.string().strict()).default([]), menuColor: Joi.number().strict().greater(0).default(5285609), deleteMenus: Joi.bool().strict().default(true), runSchedulesOnStart: Joi.bool().strict().default(true), exitOnSocketIssues: Joi.bool().strict().default(true) }) const databaseSchema = Joi.object({ uri: Joi.string().strict().default('mongodb://localhost:27017/rss'), redis: Joi.string().strict().allow('').default(''), connection: Joi.object().default({}), articlesExpire: Joi.number().strict().greater(-1).default(14), deliveryRecordsExpire: Joi.number().strict().greater(-1).default(5) }) const feedsSchema = Joi.object({ refreshRateMinutes: Joi.number().strict().greater(0).default(10), articleRateLimit: Joi.number().strict().greater(-1).default(0), timezone: timezoneValidator.config().timezone(), dateFormat: Joi.string().strict().default('ddd, D MMMM YYYY, h:mm A z'), dateLanguage: Joi.string().strict().default('en'), dateLanguageList: Joi.array().items(Joi.string().strict()).min(1).default(['en']), dateFallback: Joi.bool().strict().default(false), timeFallback: Joi.bool().strict().default(false), max: Joi.number().strict().greater(-1).default(0), hoursUntilFail: Joi.number().strict().default(0), notifyFail: Joi.bool().strict().default(true), sendFirstCycle: Joi.bool().strict().default(true), cycleMaxAge: Joi.number().strict().default(1), defaultText: Joi.string().default(':newspaper: | **{title}**\n\n{link}\n\n{subscribers}'), imgPreviews: Joi.bool().strict().default(true), imgLinksExistence: Joi.bool().strict().default(true), checkDates: Joi.bool().strict().default(true), formatTables: Joi.bool().strict().default(false), directSubscribers: Joi.bool().strict().default(false), decode: decodeValidator.config().encoding() }) const advancedSchema = Joi.object({ shards: Joi.number().greater(-1).strict().default(0), batchSize: Joi.number().greater(0).strict().default(400), parallelBatches: Joi.number().greater(0).strict().default(1), parallelRuns: Joi.number().greater(0).strict().default(1) }) const schema = Joi.object({ dev: Joi.number().strict().greater(-1), _vip: Joi.bool().strict(), _vipRefreshRateMinutes: Joi.number().strict(), log: logSchema.default(logSchema.validate({}).value), bot: botSchema.default(botSchema.validate({}).value), database: databaseSchema.default(databaseSchema.validate({}).value), feeds: feedsSchema.default(feedsSchema.validate({}).value), advanced: advancedSchema.default(advancedSchema.validate({}).value), webURL: Joi.string().strict().allow('').default('') }) module.exports = { schemas: { log: logSchema, bot: botSchema, database: databaseSchema, feeds: feedsSchema, advanced: advancedSchema, config: schema }, defaults: schema.validate({}).value, validate: config => { const results = schema.validate(config, { abortEarly: false }) if (results.error) { const str = results.error.details .map(d => d.message) .join('\n') throw new TypeError(`Bot config validation failed\n\n${str}\n`) } } }
JavaScript
0.000001
@@ -1728,17 +1728,17 @@ default( -5 +2 )%0A%7D)%0A%0Aco
b2d185388972b7cf8f0b32c48d2c55e68eb13b21
Annotate commit message with version.
Gruntfile.js
Gruntfile.js
// Gruntfile for VexFlow. // Mohit Muthanna Cheppudira <[email protected]> module.exports = function(grunt) { var L = grunt.log.writeln; var BANNER = '/**\n' + ' * VexFlow <%= pkg.version %> built on <%= grunt.template.today("yyyy-mm-dd") %>.\n' + ' * Copyright (c) 2010 Mohit Muthanna Cheppudira <[email protected]>\n' + ' *\n' + ' * http://www.vexflow.com http://github.com/0xfe/vexflow\n' + ' */\n'; var BUILD_DIR = 'build'; var RELEASE_DIR = 'releases'; var TARGET_RAW = BUILD_DIR + '/vexflow-debug.js'; var TARGET_MIN = BUILD_DIR + '/vexflow-min.js'; var SOURCES = [ "src/vex.js", "src/flow.js", "src/fraction.js", "src/tables.js", "src/fonts/vexflow_font.js", "src/glyph.js", "src/stave.js", "src/staveconnector.js", "src/tabstave.js", "src/tickcontext.js", "src/tickable.js", "src/note.js", "src/notehead.js", "src/stem.js", "src/stemmablenote.js", "src/stavenote.js", "src/tabnote.js", "src/ghostnote.js", "src/clefnote.js", "src/timesignote.js", "src/beam.js", "src/voice.js", "src/voicegroup.js", "src/modifier.js", "src/modifiercontext.js", "src/accidental.js", "src/dot.js", "src/formatter.js", "src/stavetie.js", "src/tabtie.js", "src/tabslide.js", "src/bend.js", "src/vibrato.js", "src/annotation.js", "src/articulation.js", "src/tuning.js", "src/stavemodifier.js", "src/keysignature.js", "src/timesignature.js", "src/clef.js", "src/music.js", "src/keymanager.js", "src/renderer.js", "src/raphaelcontext.js", "src/canvascontext.js", "src/stavebarline.js", "src/stavehairpin.js", "src/stavevolta.js", "src/staverepetition.js", "src/stavesection.js", "src/stavetempo.js", "src/stavetext.js", "src/barnote.js", "src/tremolo.js", "src/tuplet.js", "src/boundingbox.js", "src/textnote.js", "src/frethandfinger.js", "src/stringnumber.js", "src/strokes.js", "src/curve.js", "src/staveline.js", "src/crescendo.js", "src/ornament.js", "src/pedalmarking.js", "src/textbracket.js", "src/textdynamics.js", "src/*.js", "!src/header.js", "!src/container.js"]; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { banner: BANNER }, build: { src: SOURCES, dest: TARGET_RAW } }, uglify: { options: { banner: BANNER, sourceMap: true }, build: { src: SOURCES, dest: TARGET_MIN } }, jshint: { files: SOURCES, options: { eqnull: true, // allow == and ~= for nulls sub: true, // don't enforce dot notation trailing: true, // no more trailing spaces globals: { "Vex": false, "Raphael": false } } }, qunit: { files: ['tests/flow.html'] }, watch: { files: SOURCES, tasks: ['concat'] }, copy: { release: { files: [ { expand: true, dest: RELEASE_DIR, cwd: BUILD_DIR, src : ['*.js', 'docs/**', '*.map'] } ] } }, docco: { src: SOURCES, options: { layout: 'linear', output: 'build/docs' } }, gitcommit: { releases: { options: { message: "Committing release binaries for new version", verbose: true }, files: [ { src: [RELEASE_DIR + "/*.js", RELEASE_DIR + "/*.map"], expand: true } ] } }, bump: { options: { files: ['package.json', 'component.json'], commitFiles: ['package.json', 'component.json'], updateConfigs: ['pkg'], createTag: false, push: false } }, release: { options: { bump: false, commit: false } }, clean: [BUILD_DIR, RELEASE_DIR], }); // Load the plugin that provides the "uglify" task. grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-docco'); grunt.loadNpmTasks('grunt-release'); grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-git'); // Default task(s). grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'docco']); grunt.registerTask('test', 'Run qunit tests.', function() { grunt.task.run('qunit'); }); // Release current build. grunt.registerTask('stage', 'Stage current binaries to releases/.', function() { grunt.task.run('default'); grunt.task.run('copy:release'); }); // Increment package version and publish to NPM. grunt.registerTask('publish', 'Publish VexFlow NPM.', function() { grunt.task.run('bump'); grunt.task.run('stage'); grunt.task.run('test'); grunt.task.run('gitcommit:releases'); grunt.task.run('release'); }); };
JavaScript
0
@@ -4505,16 +4505,36 @@ version +: %3C%25= pkg.version %25%3E %22,%0A
fe643bfb386707b20860df32548f2bde09727aff
Fix globbing patterns in Grunt JSCS target
Gruntfile.js
Gruntfile.js
'use strict'; /* jshint camelcase: false */ module.exports = function ( grunt ) { require( 'load-grunt-tasks' )( grunt ); require( 'time-grunt' )( grunt ); // Define the configuration for all the tasks grunt.initConfig( { pkg: grunt.file.readJSON( 'package.json' ), licenseHeaderLong: [ '/**', ' * Copyright (C) <%= grunt.template.today("yyyy") %>, Symantec Corporation', ' * All rights reserved.', ' *', ' * This source code is licensed under the MIT license found in the', ' * LICENSE file in the root directory of this source tree', ' */', '' ].join( '\n' ), licenseHeaderShort: [ '/*!', ' * Copyright (C) <%= grunt.template.today("yyyy") %>, Symantec Corporation', ' * All rights reserved.', ' * <%= pkg.name %> v<%= pkg.version %>', ' */', '' ].join( '\n' ), jshint: { options: { jshintrc: '.jshintrc', reporter: require( 'jshint-stylish' ) }, all: [ 'Gruntfile.js', 'src/js/{,*/}*.js' ], test: { options: { jshintrc: 'test/.jshintrc' }, src: [ 'test/spec/{,*/}*.js' ] } }, // Empties folders to start fresh clean: { dist: { files: [ { dot: true, src: [ '.tmp', 'dist/*', 'docs', 'publish_docs', '!dist/.git*' ] } ] }, server: '.tmp' }, // Add vendor prefixed styles autoprefixer: { options: { browsers: [ 'last 2 version' ] }, dist: { files: [ { expand: true, cwd: '.tmp/css/', src: '{,*/}*.css', dest: '.tmp/css/' } ] } }, // Compiles Sass to CSS and generates necessary files if requested sass: { options: { }, dist: { files: { '.tmp/css/zeus-viz.css': 'src/sass/index.scss' } } }, concat: { options: { banner: '<%= licenseHeaderShort %>' }, dist_js: { src: [ 'src/js/index.js', 'src/js/*.js' ], dest: '.tmp/js/zeus-viz.js' } }, jscs: { src: [ 'app/js/{,*/}*.js', 'test/spec/{,*/}*.js' ], options: { config: '.jscsrc' } }, uglify: { options: { banner: '<%= licenseHeaderShort %>', compress: { drop_console: true }, preserveComments: false }, dist: { files: { 'dist/js/zeus-viz.min.js': [ '.tmp/js/zeus-viz.js' ] } } }, // The following *-min tasks produce minified files in the dist folder cssmin: { options: { root: '.', keepSpecialComments: 0, banner: '/*! Copyright (C) <%= grunt.template.today("yyyy") %>. ' + 'Symantec Corporation \n' + '<%= pkg.name %> - v<%= pkg.version %>.' + '<%= process.env.BUILD_NUMBER %> */\n' }, target: { files: { 'dist/css/zeus-viz.min.css': [ '.tmp/css/*.css' ] } } }, // ng-annotate tries to make the code safe for minification automatically // by using the Angular long form for dependency injection. ngAnnotate: { dist: { files: [ { expand: true, cwd: '.tmp/js', src: '*.js', dest: '.tmp/js' } ] } }, ngdocs: { options: { dest: 'docs', html5Mode: false, title: 'Zeus Viz', startPage: '/api', editExample: false, styles: [ 'dist/css/zeus-viz.css' ], scripts: [ 'extern/libs/jquery.js', 'extern/libs/d3.js', 'extern/libs/d3_tip.js', 'extern/libs/angular.js', 'extern/libs/angular-animate.js', 'dist/js/zeus-viz.js' ] }, api: [ 'src/js/*.js' ] }, sloc: { javascript: { files: { src: [ 'js/**/*.js', 'js/*.js' ] } }, styles: { files: { src: [ 'sass/**/*.scss', 'sass/*.scss' ] } } }, // Copies remaining files to places other tasks can use copy: { // docs: { // files: [ // { // expand: true, // flatten: true, // cwd: '.tmp/concat/scripts', // dest: 'docs/js', // src: [ '*.js' ] // }, // { // expand: true, // flatten: true, // cwd: 'dist/css', // dest: 'docs/css', // src: [ '*.css' ] // } ] // }, build: { files: [ { expand: true, flatten: true, cwd: 'src/sass', dest: 'dist/sass', src: [ '*.scss' ] }, { expand: true, flatten: true, cwd: '.tmp/css', dest: 'dist/css', src: [ '*.css' ] }, { expand: true, flatten: true, cwd: 'src/html', dest: 'dist/html', src: [ '*.html' ] }, { expand: true, flatten: true, cwd: '.tmp/js', dest: 'dist/js', src: [ '*.js' ] } ] } }, // Test settings karma: { unit: { configFile: 'karma.conf.js', singleRun: true } }, connect: { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: 'localhost', livereload: 35729 }, livereload: { options: { open: true, base: [ '.tmp', 'src' ] } }, test: { options: { port: 9001, base: [ '.tmp', 'test', 'dist' ] } }, dist: { options: { base: 'dist' } } } } ); grunt.registerTask( 'lint', [ 'jscs', 'jshint:all' ] ); grunt.registerTask( 'test', [ 'lint', 'jshint:test' // 'karma' ] ); grunt.registerTask( 'docs', [ 'ngdocs' ] ); grunt.registerTask( 'build', [ 'lint', // 'karma', 'clean', 'sass', 'autoprefixer', 'concat', 'ngAnnotate', 'copy:build', 'cssmin', 'uglify', 'docs', 'sloc' ] ); };
JavaScript
0.000002
@@ -2771,11 +2771,11 @@ ' -app +src /js/
65171e61602eb3552fb249ac2b8287a1c07e2d21
Fix scss compression
Gruntfile.js
Gruntfile.js
module.exports = function (grunt) { 'use strict'; grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-contrib-pug'); grunt.loadNpmTasks('grunt-sass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-concurrent'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-copy'); var coffeeFiles = [ ]; // Project configuration grunt.initConfig({ coffee: { dev: { options: { bare: true, join: true }, files: { 'dev/all.js': coffeeFiles } }, prod: { options: { bare: true, join: true }, files: { 'prod/all_original.js': coffeeFiles } } }, pug: { dev: { options: { pretty: true }, files: { 'dev/index.html': 'pug/index.pug' } }, prod: { options: { pretty: false, outputStyle: 'compressed' }, files: { 'prod/index.html': 'pug/index.pug' } } }, sass: { dev: { options: { sourcemap: 'none' }, files: { 'dev/all.css': 'sass/all.scss' } }, prod: { options: { sourcemap: 'none' }, files: { 'prod/all.css': 'sass/all.scss' } } }, watch: { coffee: { files: 'coffee/**/*.coffee', tasks: ['coffee:dev'], options: { interrupt: true, atBegin: true } }, pug: { files: 'pug/**/*.pug', tasks: ['pug:dev'], options: { interrupt: true, atBegin: true } }, sass: { files: 'sass/**/*.scss', tasks: ['sass:dev'], options: { interrupt: true, atBegin: true } } }, concurrent: { dist: { tasks: ['watch:coffee', 'watch:sass', 'watch:pug'], options: { logConcurrentOutput: true, limit: 3 } } }, uglify: { dist: { files: { 'prod/all.js': 'prod/all_original.js' } } }, copy: { dev: { src: ['imgs/**', 'favicon/**'], dest: 'dev/', expand: true, flatten: true }, prod: { src: ['imgs/**', 'favicon/**'], dest: 'prod/', expand: true, flatten: true }, } }); grunt.registerTask('default', 'concurrent'); grunt.registerTask('dev', [ 'coffee:dev', 'pug:dev', 'sass:dev', 'copy:dev', ]); grunt.registerTask('prod', [ 'coffee:prod', 'pug:prod', 'sass:prod', 'copy:prod' ]); };
JavaScript
0.000331
@@ -1262,55 +1262,8 @@ alse -,%0A outputStyle: 'compressed' %0A @@ -1705,32 +1705,79 @@ ourcemap: 'none' +,%0A outputStyle: 'compressed' %0A
f2fabcd0980bec974cff896b175f0981444f0d18
update docs
Gruntfile.js
Gruntfile.js
// Helpers for custom tasks, mainly around promises / exec var exec = require('faithful-exec'); var shjs = require('shelljs'); module.exports = function (grunt) { // URI paths for our tasks to use grunt.dist = './dist/'; grunt.uriTask = './grunt/'; grunt.uriSrc = './src/UI'; grunt.uriBuild = './build/'; function promising(task, promise) { var done = task.async(); promise.then(function () { done(); }, function (error) { grunt.log.write(error + '\n'); done(false); }); } function system(cmd) { grunt.log.write('% ' + cmd + '\n'); return exec(cmd).then(function (result) { grunt.log.write(result.stderr + result.stdout); }, function (error) { grunt.log.write(error.stderr + '\n'); throw 'Failed to run \'' + cmd + '\''; }); } function ensureCleanMaster() { return exec('git symbolic-ref HEAD').then(function (result) { if (result.stdout.trim() !== 'refs/heads/master') throw 'Not on master branch, aborting'; return exec('git status --porcelain'); }).then(function (result) { if (result.stdout.trim() !== '') throw 'Working copy is dirty, aborting'; }); } // Each task has it's own JS file. var tasks = {}; tasks.pkg = grunt.file.readJSON('package.json'); // General tasks tasks = require(grunt.uriTask + 'clean.js')(grunt, tasks); tasks = require(grunt.uriTask + 'watch.js')(grunt, tasks); // Concatenation Tasks tasks = require(grunt.uriTask + 'concat-js.js')(grunt, tasks); // Documentation Generator tasks = require(grunt.uriTask + 'ngdocs.js')(grunt, tasks); // Compass Tasks tasks = require(grunt.uriTask + 'sass.js')(grunt, tasks); // Minify Tasks tasks = require(grunt.uriTask + 'minify-html.js')(grunt, tasks); tasks = require(grunt.uriTask + 'minify-js.js')(grunt, tasks); grunt.registerTask('docs', 'Generate documentation', [ 'ngdocs' ]); grunt.registerTask('build', 'Perform a normal build', [ 'clean', 'sass:prod', 'sass:dev', 'htmlmin:prod', 'concat:js', 'uglify:js', 'ngdocs' ]); grunt.registerTask('default', [ 'build' ]); grunt.registerTask('publish', 'Publish a clean build, docs, and sample to github.io', function () { promising(this, ensureCleanMaster() .then(function () { return system('cp -R -u -v docs/* build/docs'); }).then(function () { return system('git checkout gh-pages'); }).then(function () { return system('rm -rf css'); }).then(function () { return system('rm -rf font'); }).then(function () { return system('rm -rf js'); }).then(function () { return system('rm -rf partials'); }).then(function () { return system('cp -R -u -v build/docs/* .'); }).then(function () { return system('git add --all'); }).then(function () { return system('git commit -m "Automatic gh-pages build"'); }).then(function () { return system('git push'); }).then(function () { return system('git checkout master'); }) ); }); // Initialize The Grunt Configuration grunt.initConfig(tasks); };
JavaScript
0.000001
@@ -1739,32 +1739,37 @@ grunt, tasks);%0A%0A + %0A // Compass T
d49001c473121de4de16b227bd71d39360fdc2a5
Exclude directories during copy process
Gruntfile.js
Gruntfile.js
module.exports = function( grunt ) { "use strict"; var pkg = grunt.file.readJSON( "package.json" ); grunt.initConfig( { pkg: pkg, clean: [ "dist/" ], copy: { build: { options: { process: function( content ) { return content.replace( /@VERSION/g, pkg.version ); } }, files: [ { expand: true, flatten: true, cwd: "src/", src: [ "**" ], dest: "dist/" } ] } }, uglify: { options: { banner: "/*! <%=pkg.name %> | <%= pkg.version %> | <%= grunt.template.today('yyyy-mm-dd') %> */\n" }, build: { files: { "dist/jquery.ui.pinpad.min.js": "dist/jquery.ui.pinpad.js" } } }, cssmin: { build: { src: "dist/jquery.ui.pinpad.css", dest: "dist/jquery.ui.pinpad.min.css" } } }); grunt.loadNpmTasks( "grunt-contrib-clean" ); grunt.loadNpmTasks( "grunt-contrib-copy" ); grunt.loadNpmTasks( "grunt-contrib-uglify" ); grunt.loadNpmTasks( "grunt-contrib-cssmin" ); grunt.registerTask( "default", [ "clean", "copy", "uglify", "cssmin" ] ); };
JavaScript
0
@@ -525,32 +525,74 @@ flatten: true,%0A + filter: %22isFile%22,%0A
534fbf17227a295d1aee6c5de6d5d65894ec3268
use the short version and not the long version_name for git tags
Gruntfile.js
Gruntfile.js
const fs = require('fs'); module.exports = function(grunt) { // Programatically find out what packages we include. This is used to factor // out our node packages from our actual code. const pkg = grunt.file.readJSON('./package.json'); const dependencies = Object.keys(pkg.dependencies); let product = grunt.option('product') || process.env.MACHETE_PRODUCT; if (!['seller', 'sp'].includes(product)) { throw new Error('unknown product: ' + product); } let sourceDirs = { sp: ['background', 'campaign', 'dashboard'], seller: ['seller-background', 'seller-dash'], }; const releaseTag = grunt.option('release') ? 'release' : 'beta'; const targetJson = `config/${product}-${releaseTag}.json`; const env = grunt.file.readJSON(targetJson); if (grunt.option('noDebug')) { env.NODE_ENV = 'production'; } const manifest = grunt.file.readJSON(`${product}-manifest.json`); const local = grunt.option('local') || process.env.MACHETE_LOCAL; if (local) { env.MACHETE_LOCAL = 1; } let vendorTransforms = []; if (releaseTag == 'release') { vendorTransforms = [ ['envify', Object.assign({ global: true }, env)], ['uglifyify', { global: true }], ['babelify', { presets: ['react'] }] ]; } else { vendorTransforms = [ ['envify', Object.assign({ global: true }, env)], ['babelify', { presets: ['react'] }] ]; } const pkgPath = `machete-${product}-${releaseTag}.zip`; const gruntConfig = { pkg, execute: { manifest: { call: (grunt, options) => { manifest.name = env.NAME; manifest.permissions.push(`https://${env.HOSTNAME}/*`); grunt.file.write(`out/${product}/manifest.json`, JSON.stringify(manifest)); }, } }, eslint: { options: { extensions: ['.js', '.jsx'] }, components: ['src/components'], common: ['src/common'], /* More targets created programatically */ }, browserify: { vendor: { src: [], dest: `out/${product}/src/vendor.js`, options: { require: dependencies, transform: vendorTransforms, }, }, /* More targets created programatically */ }, copy: { css: { expand: true, src: 'css/**', dest: `out/${product}`, }, img: { expand: true, src: 'images/**', dest: `out/${product}`, }, html: { expand: true, flatten: true, src: `html/${product}/**`, dest: `out/${product}/html`, }, datepickerCss: { src: 'node_modules/react-datepicker/dist/react-datepicker.css', dest: `out/${product}/css/react-datepicker.css` }, tableCss: { src: 'node_modules/react-table/react-table.css', dest: `out/${product}/css/react-table.css` }, selectCss: { src: 'node_modules/react-select/dist/react-select.min.css', dest: `out/${product}/css/react-select.css` }, }, watch: { components: { files: ['src/components/*.jsx'], tasks: ['eslint:components', 'app'] }, common: { files: ['src/common/*.js'], tasks: ['eslint:common', 'app'] }, copy: { files: ['css/**', 'images/**', 'html/**'], tasks: ['copy'], }, manifest: { files: [`${product}-manifest.json`], tasks: ['execute:manifest'] }, /* Targets created programatically */ }, zip: { [pkgPath]: [`out/${product}/**`], }, run: { publish: { cmd: 'node', args: ['upload-package.js', env.APP_ID, pkgPath], } }, gittag: { publish: { options: { tag: manifest.version_name, } } }, gitpush: { github: { options: { remote: 'github', tags: true, } }, origin: { options: { remote: 'origin', tags: true, } } } }; // Handle JS source directories. For each such directory aside from // 'common', create a watch, browserify, and eslint task const nobuild = ['common', 'components']; for (name of sourceDirs[product]) { gruntConfig.eslint[name] = [`src/${name}`]; gruntConfig.browserify[name] = { src: [`src/${name}/*.js`], dest: `out/${product}/src/${name}.js`, options: { external: dependencies, transform: [ ['babelify', {presets: ['react']}], ['envify', env], ] }, }; gruntConfig.watch[`${name}-eslint`] = { files: [`src/${name}/**`], tasks: [`eslint:${name}`, `browserify:${name}`] }; } grunt.initConfig(gruntConfig); grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-eslint'); grunt.loadNpmTasks('grunt-zip'); grunt.loadNpmTasks('grunt-execute'); grunt.loadNpmTasks('grunt-run'); grunt.loadNpmTasks('grunt-git'); grunt.registerTask('app', ['execute', ...sourceDirs[product].map(x => `browserify:${x}`)]); grunt.registerTask('default', ['execute', 'eslint', 'browserify', 'copy', 'zip']); const publishTasks = ['default', 'run:publish', 'gittag:publish', 'gitpush:origin']; if (releaseTag == 'release') pushTasks.push('gitpush:github'); grunt.registerTask('publish', publishTasks); };
JavaScript
0.000004
@@ -4162,13 +4162,8 @@ sion -_name ,%0A
af144e9e15c40db8aa9bd6bbbb4a93fded1e095f
Fix more problems with Gruntfile.js
Gruntfile.js
Gruntfile.js
/* Gruntfile.js * * A Gruntfile defines automated tasks for the command-line tool grunt. You use a Gruntfile to specify everything that needs * to happen for your project to be built. Here, we're configuring grunt to compile our SASS files into CSS as part of the default task. * * You can find instructions for installing grunt on your computer here: http://gruntjs.com/installing-grunt * */ module.exports = function(Grunt) { /* * Configuration options for grunt. */ Grunt.initConfig({ /* * Tell grunt where to find the package.json file. * This line is optional, because grunt knows to look for package.json in the project root, but it's good to be explicit. */ pkg: Grunt.file.readJSON('package.json'), /* * Configuration options for grunt-contrib-sass. * * https://github.com/gruntjs/grunt-contrib-sass/blob/master/README.md */ sass: { <<<<<<< HEAD dist: { options: { /* * Output our CSS in exapanded form so that it's easy to read. * In a production environment, you would want to change this option to compressed, to save space. */ style: 'expanded' }, files: { /* * Tells grunt where our sass files are, and where to put the converted CSS files. */ "css/main.css": "sass/main.sass" } } ======= options: { /* * Output our CSS in exapanded form so that it's easy to read. * In a production environment, you would want to change this option to compressed, to save space. */ style: 'expanded' }, files: [{ /* * Tells grunt where our sass files are, and where to put the converted CSS files. */ expand: true, cwd: 'sass', src: ['*.sass'], dest: '../css', ext: '.css' }] >>>>>>> 7cb452ca6cd76baf88dd3e41fb9f3542a5506e34 } }); Grunt.loadNpmTasks('grunt-contrib-sass'); Grunt.registerTask('default', ['sass']); }
JavaScript
0.000001
@@ -883,21 +883,8 @@ : %7B%0A -%3C%3C%3C%3C%3C%3C%3C HEAD%0A %09%09%09d @@ -1295,507 +1295,8 @@ %09%09%7D%0A -=======%0A%09%09%09%09%09%09options: %7B%0A%09%09%09%09/*%0A%09%09%09%09 * Output our CSS in exapanded form so that it's easy to read.%0A%09%09%09%09 * In a production environment, you would want to change this option to compressed, to save space.%0A%09%09%09%09 */%0A%09%09%09%09style: 'expanded'%0A%09%09%09%7D,%0A%09%09%09files: %5B%7B%0A%09%09%09%09/*%0A%09%09%09%09 * Tells grunt where our sass files are, and where to put the converted CSS files.%0A%09%09%09%09 */%0A%09%09%09%09expand: true,%0A%09%09%09%09cwd: 'sass',%0A%09%09%09%09src: %5B'*.sass'%5D,%0A%09%09%09%09dest: '../css',%0A%09%09%09%09ext: '.css'%0A%09%09%09%7D%5D%0A%3E%3E%3E%3E%3E%3E%3E 7cb452ca6cd76baf88dd3e41fb9f3542a5506e34 %0A%09%09%7D
36ac41773cd36bf02475a04cfed66cb36d63b23f
Add settings for watch & load task
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { "use strict"; var browserifyFiles = { "./dist/build.js": "./src/*.js" }; grunt.initConfig({ pkg: grunt.file.readJSON("package.json"), browserify: { prod: { files: browserifyFiles } } }); grunt.loadNpmTasks("grunt-browserify"); grunt.registerTask("build", ["browserify:prod"]); };
JavaScript
0
@@ -288,24 +288,159 @@ %7D%0A + %7D,%0A watch: %7B%0A scripts: %7B%0A files: %5B%22src/*.js%22%5D,%0A tasks: %5B%22build%22%5D%0A %7D%0A %7D%0A @@ -489,16 +489,63 @@ erify%22); +%0A grunt.loadNpmTasks(%22grunt-contrib-watch%22); %0A%0A gr
d85b0fd608825e0be0b29eae635d0fb87cdecc03
Configure Grunt to watch and copy asset files
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ browserify: { dist: { options: { transform: [ ['babelify', { presets: 'es2015' } ] ] }, files: { 'dist/client.js': ['src/js/main.js'] } } }, bowercopy: { dist: { options: { srcPrefix: 'bower_components', destPrefix: 'dist' }, files: { 'pixi.js': 'pixi.js/bin/pixi.js', 'pixi.min.js': 'pixi.js/bin/pixi.min.js', 'howler.js': 'howler.js/howler.js', 'howler.min.js': 'howler.js/howler.min.js' } } }, copy: { index: { src: 'src/index.html', dest: 'dist/index.html' } }, watch: { js: { files: ['src/js/**/*.js'], tasks: ['browserify'] }, index: { files: ['src/index.html'], tasks: ['copy:index'] } }, connect: { server: { options: { port: 8080, base: 'dist' } } } }); grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-bowercopy'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.registerTask('default', ['browserify', 'bowercopy', 'copy', 'connect', 'watch']); };
JavaScript
0
@@ -1001,16 +1001,128 @@ x.html'%0A + %7D,%0A media: %7B%0A src: 'media/assets/*',%0A dest: 'dist/assets/'%0A @@ -1371,16 +1371,199 @@ index'%5D%0A + %7D,%0A media: %7B%0A files: %5B'media/assets/*'%5D,%0A tasks: %5B'copy:media'%5D // TODO: This could be modified to copy only the modified file(s)%0A
a2b2ab5dadb4c141e735f12b9add52c247b2480f
Fix W099: Mixed spaces and tabs error
Gruntfile.js
Gruntfile.js
/* * logsearch-website * * Ryan Holder * https://github.com/ryanholder/logsearch-website * * Copyright (c) 2014 * Licensed under the MIT license. */ module.exports = function (grunt) { 'use strict'; // Delete after first run if (!grunt.file.exists('vendor/bootstrap')) { grunt.fail.fatal('>> Please run "bower install" before continuing.'); } // Project configuration. grunt.initConfig({ // Project metadata pkg: grunt.file.readJSON('package.json'), vendor: grunt.file.readJSON('.bowerrc').directory, site: grunt.file.readYAML('_config.yml'), bootstrap: '<%= vendor %>/bootstrap', // Before generating any new files, remove files from previous build. clean: { example: ['<%= site.dest %>/*.html'], }, // Lint JavaScript jshint: { all: ['Gruntfile.js', 'templates/helpers/*.js'], options: { jshintrc: '.jshintrc' } }, // Build HTML from templates and data assemble: { options: { flatten: true, production: false, assets: '<%= site.assets %>', postprocess: require('pretty'), // Metadata pkg: '<%= pkg %>', site: '<%= site %>', data: ['<%= site.data %>'], // Templates partials: '<%= site.includes %>', layoutdir: '<%= site.layouts %>', layout: '<%= site.layout %>', // Extensions helpers: '<%= site.helpers %>', plugins: '<%= site.plugins %>' }, example: { files: {'<%= site.dest %>/': ['<%= site.templates %>/*.hbs']} } }, // Compile LESS to CSS less: { options: { vendor: 'vendor', paths: [ '<%= site.theme %>', '<%= site.theme %>/bootstrap', '<%= site.theme %>/components', '<%= site.theme %>/utils' ], }, site: { src: ['<%= site.theme %>/site.less'], dest: '<%= site.assets %>/css/site.css' } }, // Copy Bootstrap's assets to site assets copy: { // Keep this target as a getting started point assets: { files: [ {expand: true, cwd: '<%= site.images %>', src: ['*.*'], dest: '<%= site.assets %>/images/'}, {expand: true, cwd: '<%= bootstrap %>/dist/fonts', src: ['*.*'], dest: '<%= site.assets %>/fonts/'}, {expand: true, cwd: '<%= bootstrap %>/dist/js', src: ['*.*'], dest: '<%= site.assets %>/js/'} ] }, docs: { files: [ {expand: true, cwd: '<%= site.docs %>', src: ['**/*'], dest: '<%= site.dest %>/docs/'} ] } }, watch: { all: { files: ['<%= jshint.all %>'], tasks: ['jshint', 'nodeunit'] }, site: { files: ['Gruntfile.js', '<%= less.options.paths %>/*.less', 'templates/**/*.hbs', 'docs/**/*'], tasks: ['design'] } }, connect: { server: { options: { useAvailablePort: true, base: '_gh_pages' } } } }); // Load npm plugins to provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-readme'); grunt.loadNpmTasks('grunt-sync-pkg'); grunt.loadNpmTasks('assemble-less'); grunt.loadNpmTasks('assemble'); // Build HTML, compile LESS and watch for changes. You must first run "bower install" // or install Bootstrap to the "vendor" directory before running this command. grunt.registerTask('design', ['clean', 'assemble', 'less:site', 'watch:site']); grunt.registerTask('server', ['clean', 'assemble', 'less:site', 'connect:server', 'watch:site']); grunt.registerTask('docs', ['readme', 'sync']); // Use this going forward. grunt.registerTask('default', ['clean', 'jshint', 'copy', 'assemble', 'less', 'docs']); };
JavaScript
0
@@ -2651,17 +2651,16 @@ %09%7D%0A%09%09%7D,%0A -%0A %09%09connec @@ -2664,20 +2664,16 @@ nect: %7B%0A - %09%09%09serve @@ -2677,22 +2677,17 @@ rver: %7B%0A - +%09 %09%09%09%09opti @@ -2693,24 +2693,18 @@ ions: %7B%0A - +%09%09 %09%09%09%09useA @@ -2723,24 +2723,18 @@ : true,%0A - +%09%09 %09%09%09%09base @@ -2751,31 +2751,19 @@ es'%0A - %09%09%09%09%7D%0A - %09%09%09%7D%0A - %09%09%7D%0A
f67b5d006063a38f3b8fa5413ac98905c9fe81c4
Set ‘build’ as the default Grunt task
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ bowerPkg: grunt.file.readJSON('bower.json'), karma: { unit: { configFile: 'karma.conf.js', singleRun: true, browsers: ['PhantomJS'] } }, cssmin: { build: { options: { banner: '/* <%= bowerPkg.name %> v<%= bowerPkg.version %> (<%= bowerPkg.homepage %>) */' }, src: 'src/progress-button.css', dest: 'dist/progress-button.min.css' } }, uglify: { options: { banner: '/* <%= bowerPkg.name %> v<%= bowerPkg.version %> (<%= bowerPkg.homepage %>) */\n' }, build: { src: 'src/progress-button.js', dest: 'dist/progress-button.min.js' } } }) grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-uglify') grunt.loadNpmTasks('grunt-karma') grunt.registerTask('build', ['cssmin', 'uglify']) grunt.registerTask('test', ['karma']) grunt.registerTask('default', []) }
JavaScript
0
@@ -911,13 +911,20 @@ ault', %5B +'build' %5D)%0A%7D%0A
c0f90beb7c008e0f4a552679627763e4ca2b0f7f
Rename 'Chat' to 'Gitter Chat'
erpnext/public/js/conf.js
erpnext/public/js/conf.js
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt frappe.provide('erpnext'); // add toolbar icon $(document).bind('toolbar_setup', function() { frappe.app.name = "ERPNext"; frappe.help_feedback_link = '<p><a class="text-muted" \ href="https://discuss.erpnext.com">Feedback</a></p>' $('.navbar-home').html('<img class="erpnext-icon" src="'+ frappe.urllib.get_base_url()+'/assets/erpnext/images/erp-icon.svg" />'); $('[data-link="docs"]').attr("href", "https://frappe.github.io/erpnext/") $('[data-link="issues"]').attr("href", "https://github.com/frappe/erpnext/issues") // default documentation goes to erpnext // $('[data-link-type="documentation"]').attr('data-path', '/erpnext/manual/index'); // additional help links for erpnext var $help_menu = $('.dropdown-help ul .documentation-links'); $('<li><a data-link-type="forum" href="https://discuss.erpnext.com" \ target="_blank">'+__('User Forum')+'</a></li>').insertBefore($help_menu); $('<li><a href="https://gitter.im/frappe/erpnext" \ target="_blank">'+__('Chat')+'</a></li>').insertBefore($help_menu); $('<li><a href="https://github.com/frappe/erpnext/issues" \ target="_blank">'+__('Report an Issue')+'</a></li>').insertBefore($help_menu); }); // doctypes created via tree $.extend(frappe.create_routes, { "Customer Group": "Tree/Customer Group", "Territory": "Tree/Territory", "Item Group": "Tree/Item Group", "Sales Person": "Tree/Sales Person", "Account": "Tree/Account", "Cost Center": "Tree/Cost Center" }); // preferred modules for breadcrumbs $.extend(frappe.breadcrumbs.preferred, { "Item Group": "Stock", "Customer Group": "Selling", "Supplier Group": "Buying", "Territory": "Selling", "Sales Person": "Selling", "Sales Partner": "Selling", "Brand": "Selling" });
JavaScript
0.999999
@@ -1037,32 +1037,57 @@ p_menu);%0A%09$('%3Cli + class=%22gitter-chat-link%22 %3E%3Ca href=%22https: @@ -1140,16 +1140,23 @@ %22%3E'+__(' +Gitter Chat')+'
98affab59b9e94aec86ae0c2b592138d1b4ce05b
Set main field on bower.json
Gruntfile.js
Gruntfile.js
/* * (C) Copyright 2014 Kurento (http://kurento.org/) * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-2.1.html * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * */ module.exports = function(grunt) { var DIST_DIR = 'dist'; var pkg = grunt.file.readJSON('package.json'); var bower = { TOKEN: process.env.TOKEN, repository: 'git://github.com/Kurento/<%= pkg.name %>-bower.git' }; // Project configuration. grunt.initConfig( { pkg: pkg, bower: bower, // Plugins configuration clean: { generated_code: [DIST_DIR, 'src'], generated_doc: '<%= jsdoc.all.dest %>' }, // Generate documentation jsdoc: { all: { src: ['README.md', 'lib/**/*.js', 'test/*.js'], dest: 'doc/jsdoc' } }, curl: { 'shims/sockjs-0.3.js': 'http://cdn.sockjs.org/sockjs-0.3.js' }, // Generate browser versions and mapping debug file browserify: { require: { src: '<%= pkg.main %>', dest: DIST_DIR+'/<%= pkg.name %>_require.js' }, standalone: { src: '<%= pkg.main %>', dest: DIST_DIR+'/<%= pkg.name %>.js', options: { bundleOptions: { standalone: 'KwsMedia' } } }, 'require minified': { src: '<%= pkg.main %>', dest: DIST_DIR+'/<%= pkg.name %>_require.min.js', options: { debug: true, plugin: [ ['minifyify', { compressPath: DIST_DIR, map: '<%= pkg.name %>.map' }] ] } }, 'standalone minified': { src: '<%= pkg.main %>', dest: DIST_DIR+'/<%= pkg.name %>.min.js', options: { debug: true, bundleOptions: { standalone: 'KwsMedia' }, plugin: [ ['minifyify', { compressPath: DIST_DIR, map: '<%= pkg.name %>.map', output: DIST_DIR+'/<%= pkg.name %>.map' }] ] } } }, // Generate bower.json file from package.json data sync: { bower: { options: { sync: [ 'name', 'description', 'license', 'keywords', 'homepage', 'repository' ], overrides: { authors: (pkg.author ? [pkg.author] : []).concat(pkg.contributors || []) } } } }, // Publish / update package info in Bower shell: { bower: { command: [ 'curl -X DELETE "https://bower.herokuapp.com/packages/<%= pkg.name %>?auth_token=<%= bower.TOKEN %>"', 'node_modules/.bin/bower register <%= pkg.name %> <%= bower.repository %>', 'node_modules/.bin/bower cache clean' ].join('&&') } } }); // Load plugins grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-curl'); grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-npm2bower-sync'); grunt.loadNpmTasks('grunt-shell'); // Alias tasks grunt.registerTask('default', ['clean', 'jsdoc', 'curl', 'browserify']); grunt.registerTask('bower', ['sync:bower', 'shell:bower']); };
JavaScript
0.000002
@@ -1174,17 +1174,16 @@ /*.js'%5D, - %0A @@ -2948,16 +2948,59 @@ s %7C%7C %5B%5D) +,%0A main: 'js/%3C%25= pkg.name %25%3E.js' %0A
f79f6ebd0667ba56a3aa71beed0b8195cb5787ae
Standardize Gruntfile
Gruntfile.js
Gruntfile.js
/*global module:false*/ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON('package.json'), banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', // Custome Paths srcFiles: ['src/js/thbarjs.js'], // source files componentsDir: 'src/js/components', // bower components testFiles: ['spec/*.spec.js'], // test files (jasmine specs) // Task configuration. jshint: { // check javascript syntax and errors options: { curly: true, eqeqeq: true, immed: true, latedef: true, newcap: true, noarg: true, sub: true, undef: true, unused: true, boss: true, eqnull: true, browser: true, globals: { jQuery: true, $: true, viewerjs: true, X: true, dicomParser: true, console: true, alert: true, require: true, describe: true, it: true, expect: true, beforeEach: true, afterEach: true, define: true } }, source: { src: '<%= srcFiles %>' }, gruntfile: { src: 'Gruntfile.js' }, test: { src: '<%= testFiles %>' } }, jasmine: { // run tests test: { //src: '<%= jshint.source.src %>', this line must be commented when using the define function within the specs files options: { specs: '<%= jshint.test.src %>', template: require('grunt-template-jasmine-requirejs'), templateOptions: { version: '<%= componentsDir %>/requirejs/require.js', requireConfigFile: 'src/main.js', // requireJS's config file requireConfig: { baseUrl: '<%= componentsDir %>' // change base url to execute tests from local FS } } } } }, requirejs: { // concat and minimize AMD modules compile: { options: { baseUrl: '<%= componentsDir %>', paths: { jquery: 'empty:', // does not include jquery in the output jquery_ui: 'empty:', // does not include jquery_ui in the output }, name: 'thbarjs', mainConfigFile: 'src/main.js', out: 'dist/js/<%= pkg.name %>.min.js' } } }, cssmin: { // concat and minimize css dist: { files: { 'dist/styles/thbarjs.css': ['src/styles/**/*.css'] } } }, copy: { components: { // copy requiered bower components which were not concatenated files: [ { expand: true, cwd: '<%= componentsDir %>', src: ['requirejs/require.js', 'jquery/dist/jquery.min.js', 'jquery-ui/jquery-ui.min.js', 'jquery-ui/themes/smoothness/**'], dest: 'dist/js/components' }] } }, watch: { source: { files: '<%= jshint.source.src %>', tasks: ['jshint:source'] }, gruntfile: { files: '<%= jshint.gruntfile.src %>', tasks: ['jshint:gruntfile'] }, test: { files: '<%= jshint.test.src %>', tasks: ['jshint:test', 'jasmine'] } } }); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.registerTask('watch', ['watch']); // Test task. grunt.registerTask('test', ['jshint', 'jasmine']); // Build task. grunt.registerTask('build', ['cssmin', 'jshint', 'jasmine', 'requirejs', 'copy']); // Default task. grunt.registerTask('default', ['build']); };
JavaScript
0.000001
@@ -562,23 +562,17 @@ 'src/js/ -thbarjs +* .js'%5D, / @@ -2472,23 +2472,31 @@ name: ' -thbarjs +%3C%25= pkg.name %25%3E ',%0A @@ -2704,15 +2704,23 @@ les/ -thbarjs +%3C%25= pkg.name %25%3E .css
00e3159e0418d58de3f1185ac8664b19a299ec8a
Bump node-webkit version
Gruntfile.js
Gruntfile.js
/* jshint node: true */ module.exports = function(grunt) { var NW_VERSION = '0.8.3'; // linudev.so.0 workaround, see README.md process.env.LD_LIBRARY_PATH = '.:' + process.env.LD_LIBRARY_PATH; grunt.initConfig({ run: { options: { nwArgs: ['.'], downloadDir: 'node-webkit', runtimeVersion: NW_VERSION, forceDownload: false, forceExtract: false } }, build: { options: { downloadDir: 'node-webkit', runtimeVersion: NW_VERSION, forceDownload: false, forceExtract: false, linux_ia32: true, linux_x64: true, win: true, osx: false, packageOverride: { window: { toolbar: false } } } } }); grunt.loadTasks('tasks'); };
JavaScript
0
@@ -79,11 +79,11 @@ '0. -8.3 +9.2 ';%0A%0A
ff89afabfe510c7dfcac17bc3fde93d857950dc6
update pushTo option for bump
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { dist: { src: [ 'node_modules/marked/lib/marked.js', 'src/jquery.gh-readme.js' ], dest: 'dist/jquery.gh-readme.full.js' } }, uglify: { options: { banner: '/*! <%= pkg.name %> v<%= pkg.version %> */\n' }, build: { src: 'dist/jquery.gh-readme.full.js', dest: 'dist/jquery.gh-readme.min.js' } }, mocha: { test: { src: [ 'tests/**/*.html' ], options: { run: true } } }, jshint: { files: ['gruntfile.js', 'src/*.js', 'tests/**/*.js'], options: { globals: { jQuery: true, console: true, module: true } } }, bump: { options: { files: [ 'package.json', 'bower.json' ], commit: true, commitMessage: 'increment version to %VERSION%', commitFiles: [ 'package.json', 'bower.json' ], createTag: true, push: true, pushTo: 'master' } } }); // Load the plugins grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-mocha'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-bump'); // Default tasks grunt.registerTask('default', ['concat', 'uglify', 'mocha', 'jshint']); };
JavaScript
0
@@ -1130,14 +1130,14 @@ o: ' -master +origin '%0A
10f520ab51c4145653a90563a27eed196d309185
Include es6 files for jshint
Gruntfile.js
Gruntfile.js
'use strict'; module.exports = function (grunt) { require('time-grunt')(grunt); var config = { watch: { babel: { files: ['**/*.es6.js'], tasks: ['babel'] }, express: { files: ['**/*.js', '!**/*.es6.js', 'bin/www'], tasks: ['express:dev'], options: { livereload: true, spawn: false } }, staticFiles: { files: ['public/**/*.css', 'public/**/*.js'], options: { livereload: true } } }, express: { options: { port: 3000, debug: true }, dev: { options: { script: 'bin/www' } } }, babel: { options: { plugins: ['uglify:after'], sourceMap: true }, dist: { files: [{ expand: true, cwd: './', src: '**/*.es6.js', dest: './', ext: '.js' }] } }, clean: { dist: { files: [{ dot: true, src: [ '**/*.map', '**/*.js', '!node_modules/**/*', '!public/**/*', '!**/*.es6.js', '!Gruntfile.js', './*.tgz' ] }] } }, jshint: { options: { jshintrc: '.jshintrc', reporter: require('jshint-stylish') }, all: [ '**/*.js' ] }, mochaTest: { all: { options: { require: 'babel/register' }, src: ['test/**/*.js'] } }, }; grunt.initConfig(config); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-mocha-test'); grunt.loadNpmTasks('grunt-express-server'); grunt.registerTask('test', [ 'babel', 'jshint', 'mochaTest' ]); grunt.registerTask('build', [ 'clean', 'babel', ]); grunt.registerTask('default', [ 'test', 'build' ]); grunt.registerTask('serv', [ 'express:dev', 'watch' ]); };
JavaScript
0
@@ -1430,16 +1430,20 @@ '**/*. +es6. js'%0A
138a5635211e71b31431a08a6de7364f93761720
fix running-job check
ui/client/js/routes.js
ui/client/js/routes.js
// Applications page Router.route("/", { waitOn: function() { return Meteor.subscribe("apps"); }, action:function() { this.render('appsPage', { data: { apps: Applications.find() } }); } }); // Application/Jobs page Router.route("/a/:_appId", { waitOn: function() { return Meteor.subscribe("jobs-page", this.params._appId); }, action: function() { var jobs = Jobs.find().map(function(job) { var lastStage = Stages.findOne({ jobId: job.id }, { sort: { id: -1 } }); job.name = lastStage && lastStage.name || ""; return job; }); var completedJobs = jobs.filter(function(job) { return job.succeeded; }); var activeJobs = jobs.filter(function(job) { return job.started && !job.ended; }); var failedJobs = jobs.filter(function(job) { return job.succeeded == false; }); this.render('jobsPage', { data: { appId: this.params._appId, app: Applications.findOne(), completed: { jobs: completedJobs, num: completedJobs.length }, active: { jobs: activeJobs, num: activeJobs.length }, failed: { jobs: failedJobs, num: failedJobs.length }, env: Environment.findOne(), jobsTab: 1 } }); } }); function getStagesData() { var attempts = StageAttempts.find().map(identity); var completed = attempts.filter(function(attempt) { return (attempt.ended || (attempt.time && attempt.time.end)) && !attempt.skipped && attempt.status == SUCCEEDED; }); var active = attempts.filter(function(attempt) { return attempt.started && !attempt.ended; }); var pending = attempts.filter(function(attempt) { return !attempt.started && !attempt.skipped; }); var skipped = attempts.filter(function(attempt) { return attempt.skipped; }); var failed = attempts.filter(function(attempt) { return attempt.ended && attempt.status == FAILED; }); return { completed: { stages: completed, num: completed.length }, active: { stages: active, num: active.length }, pending: { stages: pending, num: pending.length }, skipped: { stages: skipped, num: skipped.length }, failed: { stages: failed, num: failed.length } }; } // Job page Router.route("/a/:_appId/job/:_jobId", { waitOn: function() { return Meteor.subscribe('job-page', this.params._appId, parseInt(this.params._jobId)); }, action: function() { this.render('jobPage', { data: jQuery.extend(getStagesData(), { appId: this.params._appId, app: Applications.findOne(), job: Jobs.findOne(), jobsTab: 1 }) }); } }); // Stages page Router.route("/a/:_appId/stages", { waitOn: function() { return Meteor.subscribe('stages-page', this.params._appId); }, action: function() { this.render('stagesPage', { data: jQuery.extend(getStagesData(), { appId: this.params._appId, app: Applications.findOne(), stagesTab: 1 }) }); } }); function sortNumber(a,b) { return a - b; } function makeSummaryStats(name, arr) { var n = arr.length; return { name: name, stats: [ arr[0], arr[Math.floor(n/4)], arr[Math.floor(n/2)], arr[Math.floor(3*n/4)], arr[n-1] ] } } // StageAttempt page Router.route("/a/:_appId/stage/:_stageId", { waitOn: function() { return Meteor.subscribe( 'stage-page', this.params._appId, parseInt(this.params._stageId), this.params.query.attempt ? parseInt(this.params.query.attempt) : 0 ); }, action: function() { var stage = Stages.findOne(); var stageAttempt = StageAttempts.findOne(); var executors = Executors.find().map(function(e) { e.metrics = e.stages[stage.id][stageAttempt.id].metrics; e.taskCounts = e.stages[stage.id][stageAttempt.id].taskCounts; delete e['stages']; return e; }); this.render('stagePage', { data: { appId: this.params._appId, app: Applications.findOne(), stage: stage, stageAttempt: stageAttempt, tasks: Tasks.find(), taskAttempts: TaskAttempts.find().map(function(task) { var executor = Executors.findOne({ id: task.execId }); task.host = executor.host; task.port = executor.port; return task; }), executors: executors, stagesTab: 1 } }); } }); // Storage page Router.route("/a/:_appId/storage", { waitOn: function() { return Meteor.subscribe("rdds-page", this.params._appId); }, action: function() { this.render('storagePage', { data: { appId: this.params._appId, app: Applications.findOne(), rdds: RDDs.find(), storageTab: 1 } }); } }); // RDD Page Router.route("/a/:_appId/rdd/:_rddId", { waitOn: function() { return Meteor.subscribe('rdd-page', this.params._appId, parseInt(this.params._rddId)); }, action: function() { var executors = Executors.find().map(function(executor) { var executorRDD = executor.blocks.rdd[this.params._rddId]; ['MemorySize', 'ExternalBlockStoreSize', 'DiskSize', 'numBlocks'].forEach(function(key) { if (key in executorRDD) { executor[key] = executorRDD[key]; } }.bind(this)); if ('blocks' in executorRDD) { executor['blocks'] = executorRDD['blocks']; } else { delete executor['blocks']; } return executor; }.bind(this)); this.render('rddPage', { data: { appId: this.params._appId, app: Applications.findOne(), rdd: RDDs.findOne(), executors: executors, storageTab: 1 } }); } }); // Environment Page Router.route("/a/:_appId/environment", { waitOn: function() { return Meteor.subscribe('environment-page', this.params._appId); }, action: function() { this.render("environmentPage", { data: { appId: this.params._appId, app: Applications.findOne(), env: Environment.findOne(), environmentTab: 1 } }); } }); // Executors Page Router.route("/a/:_appId/executors", { waitOn: function() { return Meteor.subscribe('executors-page', this.params._appId); }, action: function() { this.render("executorsPage", { data: { appId: this.params._appId, app: Applications.findOne(), executors: Executors.find(), executorsTab: 1 } }); } });
JavaScript
0.000005
@@ -702,24 +702,25 @@ b) %7B return +( job.started @@ -714,24 +714,43 @@ (job.started + %7C%7C job.time.start) && !job.end
5262a21990f87ffa05eedb246fc96943bdd9ff20
copy sourcemap with dev build The sourcemap points to the intermediate main_config.js so that needs to be copied over too.
Gruntfile.js
Gruntfile.js
/* eslint object-property-newline: "off" */ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Metadata. pkg: grunt.file.readJSON("package.json"), cfg: grunt.file.readJSON("config.json"), // Task configuration. clean: { // Clean up build files and source maps. src: [ "src/js/main_config.js", "src/js/main.min.js", "src/js/main.min.js.map", "src/js/lib/portal.min.js", "src/js/lib/portal.min.js.map" ], build: ["build/**"] }, eslint: { // Validate the javascripts. options: { useEslintrc: true }, all: ["src/js/*.js", "src/js/portal/*.js"] }, "string-replace": { js: { files: { "src/js/main_config.js": "src/js/main.js" }, options: { replacements: [ { pattern: "<config.appId>", replacement: "<%= cfg.appId %>" }, { pattern: "<config.portalUrl>", replacement: "<%= cfg.portalUrl %>" } ] } } }, concat: { // Combine files where it makes sense. options: { separator: ";" }, build_index: { src: ["src/index.html", "src/templates.html"], dest: "build/index.html" } }, uglify: { // Minify the javascript files. // Production build removes console statements and source maps. options: { banner: "/*! <%= pkg.name %> <%= pkg.version %> */\n" }, prod: { options: { preserveComments: false, sourceMap: false }, files: { "src/js/main.min.js": ["src/js/main_config.js"] } }, dev: { // Dev build includes source maps and console statements. options: { preserveComments: "all", report: "gzip", sourceMap: true }, files: { "src/js/main.min.js": ["src/js/main_config.js"] } } }, copy: { // Copy everything to the build directory for testing. main: { files: [ {expand: true, cwd: "src/", src: ["oauth-callback.html"], dest: "build/"}, {expand: true, cwd: "src/", src: ["assets/**"], dest: "build/"}, {expand: true, cwd: "src/", src: ["css/**"], dest: "build/"}, {expand: true, cwd: "src/", src: ["js/main.min.js"], dest: "build/"}, {expand: true, cwd: "src/", src: ["js/lib/**"], dest: "build/"} ] } }, shell: { // Use rollup from the command line since grunt-rollup didn't work. command: "rollup -c" }, "http-server": { dev: { root: "build", host: "0.0.0.0", port: 8080, openBrowser: true } } }); // These plugins provide necessary tasks. grunt.loadNpmTasks("grunt-contrib-clean"); grunt.loadNpmTasks("grunt-contrib-concat"); grunt.loadNpmTasks("grunt-contrib-copy"); grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.loadNpmTasks("grunt-eslint"); grunt.loadNpmTasks("grunt-http-server"); grunt.loadNpmTasks("grunt-shell"); grunt.loadNpmTasks("grunt-string-replace"); // Default task. grunt.registerTask("default", ["clean", "string-replace", "eslint", "shell", "concat", "uglify:prod", "copy", "clean:src"]); grunt.registerTask("dev", ["clean", "string-replace", "eslint", "shell", "concat", "uglify:dev", "copy", "clean:src", "http-server"]); grunt.registerTask("lint", ["eslint"]); grunt.registerTask("serve", ["http-server"]); grunt.registerTask("cleanup", ["clean"]); };
JavaScript
0
@@ -2758,20 +2758,20 @@ -main +prod : %7B%0A @@ -3237,32 +3237,192 @@ %5D%0A + %7D,%0A dev: %7B%0A files: %5B%0A %7Bexpand: true, cwd: %22src/%22, src: %5B%22js/main*%22%5D, dest: %22build/%22%7D%0A %5D%0A %7D%0A @@ -4306,32 +4306,37 @@ ify:prod%22, %22copy +:prod %22, %22clean:src%22%5D) @@ -4443,16 +4443,33 @@ %22, %22copy +:prod%22, %22copy:dev %22, %22clea
e6ad5e04b104d6977c61897d7f20a495f14faa1b
Improve Grunt watch configuration
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { 'use strict'; grunt.initConfig({ /** * Pull in the package.json file so we can read its metadata. */ pkg: grunt.file.readJSON('package.json'), /** * Here's a banner with some template variables. * We'll be inserting it at the top of minified assets. */ banner: '/*\n' + ' * /|\n' + ' * / | |\\\n' + ' * / | | \\\n' + ' * / | \\ \\\n' + ' * / /| | \\ \\\n' + ' * / / | | \\ \\\n' + ' * / / \\ \\ \\ \\\n' + ' * / / \\/ \\ \\\n' + ' * /_/ /\\ ______\\ \\\n' + ' * ________/ / / ________\\\n' + ' * \\ ______/ / / __\n' + ' * \\ \\ \\/ / /\n' + ' * \\ \\ /\\ / /\n' + ' * \\ \\ \\ \\ / /\n' + ' * \\ \\ | | / /\n' + ' * \\ \\ | |/ /\n' + ' * \\ \\ | /\n' + ' * \\ | | /\n' + ' * \\| | /\n' + ' * |/\n' + ' *\n' + ' * <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + ' * <%= pkg.description %>\n' + ' * <%= pkg.homepage ? pkg.homepage + "\\n" : "" %>\n' + ' * License: Public Domain\n' + ' */\n\n', /** * Less: https://github.com/gruntjs/grunt-contrib-less * * Compile, concat and compress Less files. * Make sure to add any other CSS libraries/files you'll be using. * We are excluding minified files with the final ! pattern. */ less: { dist: { src: ['<%= banner %>', 'static/css/main.less', '!static/css/*.min.css'], dest: 'static/css/main.min.css', options: { compile: true, compress: true } } }, /** * Uglify: https://github.com/gruntjs/grunt-contrib-uglify * * Minify JS files. * Make sure to add any other JS libraries/files you'll be using. * We are excluding minified files with the final ! pattern. */ uglify: { options: { banner: '<%= banner %>' }, dist: { src: ['static/js/vendor/jquery-1.9.1.js', 'static/js/vendor/holder.js', 'static/js/*.js', '!static/js/*.min.js'], dest: 'static/js/main.min.js' } }, /** * JSHint: https://github.com/gruntjs/grunt-contrib-jshint * * Validate files with JSHint. * Below are options that conform to idiomatic.js standards. * Feel free to add/remove your favorites: http://www.jshint.com/docs/#options */ jshint: { options: { camelcase: true, curly: true, eqeqeq: true, forin: true, immed: true, latedef: true, newcap: true, noarg: true, quotmark: true, sub: true, undef: true, unused: true, boss: true, eqnull: true, browser: true, globals: { jQuery: true, $: true, Backbone: true, _: true, module: true, Highcharts: true } }, all: ['static/js/<%= pkg.name %>.js'] }, /** * Watch: https://github.com/gruntjs/grunt-contrib-watch * * Run predefined tasks whenever watched file patterns are added, changed or deleted. * Add files to monitor below. */ watch: { gruntfile: { files: ['Gruntfile.js', '<%= less.dist.src %>', '<%= uglify.dist.src %>'], tasks: ['default'] } } }); /** * Loading tasks */ grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); /** * Task aliases */ grunt.registerTask('default', ['less', 'jshint', 'uglify']); };
JavaScript
0
@@ -337,17 +337,16 @@ banner: - %0A ' @@ -1440,25 +1440,24 @@ -less%0A * - %0A * Comp @@ -1953,25 +1953,24 @@ glify%0A * - %0A * Mini @@ -2460,25 +2460,24 @@ shint%0A * - %0A * Vali @@ -3318,17 +3318,16 @@ h%0A * - %0A * @@ -3475,100 +3475,305 @@ -gruntfile: %7B%0A files: %5B'Gruntfile.js', '%3C%25= less.dist.src %25%3E', '%3C%25= uglify.dist.src %25%3E +options: %7B%0A livereload: true%0A %7D,%0A gruntfile: %7B%0A files: %5B'Gruntfile.js'%5D,%0A tasks: %5B'default'%5D%0A %7D,%0A less: %7B%0A files: %5B'**/*.html', 'static/css/*.less'%5D,%0A tasks: %5B'less'%5D%0A %7D,%0A js: %7B%0A files: %5B'static/js/*.js', '!static/js/*.min.js '%5D,%0A @@ -3781,39 +3781,48 @@ tasks: %5B' -default +jshint', 'uglify '%5D%0A %7D%0A %7D
ef9d4368326f0a0127dfd47bfcd4b2ac7966737b
Fix gruntfile
Gruntfile.js
Gruntfile.js
"use strict"; module.exports = ( grunt ) => { require( "load-grunt-tasks" )( grunt ); grunt.initConfig( { "eslint": { "src": [ "src/**/*.js" ] }, "babel": { "options": { "presets": [ "es2015" ], // "plugins": [ "transform-es2015-modules-umd" ] }, "src": { "files": [ { "expand": true, "cwd": "src/", "src": [ "**/*.js" ], "dest": "lib/" } ] } }, "nodeunit": { "files": [ "test/**/*_test.js" ] }, "watch": { "src": { "files": "src/**/¨.js", "tasks": [ "default" ] } } } ); grunt.registerTask( "test", [ "nodeunit" ] ); grunt.registerTask( "default", [ "eslint", "babel", "test" ] ); grunt.registerTask( "work", [ "default", "watch" ] ); };
JavaScript
0.00001
@@ -25,16 +25,24 @@ ports = +function ( grunt @@ -46,11 +46,8 @@ nt ) - =%3E %7B%0A%0A
f2fb64422fbf722fbe18f12b7fd60f9c48913cff
Add db.js to jshint task
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { 'use strict'; // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jshint: { all: [ 'Gruntfile.js', 'app.js', 'lib/**/*.js', 'routes/*.js', 'test/*.js', 'public/js/three-script.js' ] }, stylus: { compile : { files : { 'public/css/style.css' : 'public/css/*.styl' } } } }); // Load the plugins. grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-stylus'); // Default task(s). grunt.registerTask('default', ['jshint', 'stylus']); };
JavaScript
0.000002
@@ -205,24 +205,41 @@ 'app.js',%0A + 'db.js',%0A 'lib
42bebe305bf43a04dccdb50d27d29620c7ddf52e
this is a message
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { // Option functionality not yet added for karma file patterns function karmaGenerateLoadedFiles (sources) { function karmaPatternize (src, options) { return { pattern: src, watched: true, included: true, served: true, }; } var files = Array.prototype.map.call(sources, function (value) { return karmaPatternize(value); }); files.push(karmaPatternize("spec/unit/**/*.js")); return files; } // Sources are loaded each time this grunt task is started // If deps.src is empty another pattern should be generated var deps = grunt.file.readJSON('package.json'); // var depsPrefixed = deps.dirs.src.map(prefixWith('src/')); var karmaFiles = karmaGenerateLoadedFiles(deps.dirs.src); var conf = { // Get filepaths from package.json file. The files are set up in the setup task. watch: { files: ["src/**/*.js"], tasks: ["jshint:sources", "karma:unit"], options: { debounceDelay: 1000 } }, jshint: { options: { sub: false }, sources: ["src/**/*.js"], build: ["build/**/*.js"] }, clean: { reports: ["reports/**"], build: ["build/js/**"] }, compile: { options: { compilation_level: 'ADVANCED_OPTIMIZATIONS', language_in: 'ECMASCRIPT5_STRICT', warning_level: 'VERBOSE', formatting: 'PRETTY_PRINT', debug: true, externs: 'externs/' }, comp : { // Destination : Source files: {'build/gcc_src.js' : 'src/**/*.js'} } }, jsdoc : { makedoc : { src: ['src/**/*.js'], options: { destination: 'reports/jsdoc' } } }, shell: { test: { options: { stdout: true }, command: 'echo test' } }, // Karma is always used for unit tests karma: { unit: { configFile: 'karma.conf.js', singleRun: true, files: karmaFiles, }, report: { reporters: ['progress', 'coverage'], configFile: 'karma.conf.js', singleRun: true, preprocessors: { 'src/**/*.js': ['coverage'] }, coverageReporter: { type : 'html', dir : 'reports/' }, files: karmaFiles, } }, exec: { casp: { command: 'casperjs', stdout: false, stderr: false } }, express: { build: { options: { port: 9876, bases: 'build/', server: 'build.js' } }, create: { options: { port: 6789, bases: 'create/', server: 'create.js' } } }, casperjs: { options: { async: { parallel: false } }, files: ['spec/e2e/**/*.js'] }, }; // Project configuration. grunt.initConfig(conf); grunt.registerTask('build', ['express:build', 'express-keepalive']); grunt.registerTask('create', ['express:create', 'express-keepalive']); grunt.loadNpmTasks('grunt-express'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-closurecompiler'); grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-casperjs'); grunt.renameTask('closurecompiler', 'compile'); // grunt.registerTask('e2e', []); // Runs e2e tests on deployed instance grunt.registerTask('deploy', ['compile']); // Compiles the app and deploys an html file grunt.registerTask('unit', ['jshint:sources', 'karma:unit']); // Runs unit tests on local code grunt.registerTask('unitreport', ['jshint:sources', 'karma:report', 'jsdoc']); // Runs unit tests and generates a coverage report, used for jenkins grunt.registerTask('default', ['clean', 'jshint:sources', 'deploy']); grunt.registerTask('server', ['express', 'express-keepalive']); };
JavaScript
0.999955
@@ -2714,150 +2714,8 @@ f);%0A -%09grunt.registerTask('build', %5B'express:build', 'express-keepalive'%5D);%0A%09grunt.registerTask('create', %5B'express:create', 'express-keepalive'%5D);%0A %09gru @@ -2744,24 +2744,24 @@ -express');%0A + %09grunt.loadN @@ -3102,18 +3102,16 @@ pile');%0A -%09%0A %09// grun @@ -3201,76 +3201,128 @@ sk(' -deploy', %5B'compile'%5D); // Compiles the app and deploys an html file +build', %5B'express:build', 'express-keepalive'%5D);%0A%09grunt.registerTask('create', %5B'express:create', 'express-keepalive'%5D); %0A%09gr @@ -3347,34 +3347,16 @@ unit', %5B -'jshint:sources', 'karma:u @@ -3421,40 +3421,20 @@ sk(' -unitreport', %5B'jshint:sources', +coverage', %5B 'kar @@ -3447,17 +3447,8 @@ ort' -, 'jsdoc' %5D); @@ -3541,118 +3541,113 @@ sk(' -default', %5B'clean', 'jshint:sources', 'deploy'%5D);%0A%09grunt.registerTask('server', %5B'express', 'express-keepalive +server', %5B'express', 'express-keepalive'%5D);%0A%09grunt.registerTask('default', %5B'jshint:sources', 'karma:unit '%5D);
93ea67f21f4d549330edeac983d70dbdbfd13a60
Fix mocha-browserify issue
Gruntfile.js
Gruntfile.js
var _ = require('underscore'); var logger = require('morgan'); var mockApi = require('./mock-api'); module.exports = function (grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), version: '<%= pkg.version %>', jshint: { javascripts: { src: ['src/**/*.js'] }, tests: { options: { jshintrc: 'test/.jshintrc' }, src: ['test/**/*.js'] } }, browserify: { dist: { files: { 'dist/bundle.js': ['./src/main.js'] } }, watch: { options: { keepAlive: true, watch: true }, files: { 'dist/bundle.js': ['./src/main.js'] } } }, connect: { server: { options: { port: 9000, keepalive: true, base: 'dist', middleware: function (connect, options, middlewares) { middlewares.unshift(logger('dev')); middlewares.push(mockApi); return middlewares; } } } }, clean: { dist: ['dist'] }, copy: { views: { expand: true, cwd: 'src/', src: '**/*.html', dest: 'dist/', filter: 'isFile' } }, less: { dist: { src: 'src/main.less', dest: 'dist/bundle.css' } }, autoprefixer: { dist: { src: 'dist/bundle.css', dest: 'dist/bundle.css' } }, mochaTest: { tests: { options: { require: 'test/setup/node.js', reporter: 'dot', clearRequireCache: true, mocha: require('mocha') }, src: [ 'test/setup/helpers.js', 'test/unit/**/*.spec.js' ] } }, concurrent: { options: { logConcurrentOutput: true }, watchers: [ 'watch', 'browserify:watch', 'connect' ] }, watch: { options: { livereload: true, spawn: false }, javascripts: { files: ['src/**/*.js', 'src/**/*.hbs'], tasks: ['jshint:javascripts', 'mochaTest'] }, views: { files: 'src/**/*.html', tasks: ['copy:views'] }, stylesheets: { files: 'src/**/*.less', tasks: ['less', 'autoprefixer'] }, tests: { files: 'test/unit/**/*.spec.js', tasks: ['jshint:tests', 'mochaTest'] } } }); grunt.registerTask('build', [ 'test', 'clean:dist', 'copy:views', 'less', 'autoprefixer', 'browserify:dist' ]); grunt.registerTask('test', [ 'jshint', 'mochaTest' ]); grunt.registerTask('serve', [ 'concurrent' ]); grunt.registerTask('default', [ 'build', 'serve' ]); require('./tasks/events')(grunt); };
JavaScript
0.000097
@@ -2591,20 +2591,8 @@ , %5B%0A - 'test',%0A @@ -2676,16 +2676,28 @@ fy:dist' +,%0A 'test' %0A %5D);%0A%0A
b98427df7892c4e2f9991cff834e6176ea1912c3
Fix uglify:jsPlugins task and jsPlugins watcher. Resolves #2
Gruntfile.js
Gruntfile.js
/*jshint node: true */ module.exports = function(grunt) { 'use strict'; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), banner: '/** \n' + ' * Automatically Generated - DO NOT EDIT \n' + ' * <%= pkg.name %> / v<%= pkg.version %> / <%= grunt.template.today("yyyy-mm-dd") %> \n' + ' */ \n\n', sourcePath: 'src', distPath: 'dist', templateDir: 'templates', assetDir: 'assets', watch: { js: { files: '<%= sourcePath %>/<%= assetDir %>/js/*.js', tasks: ['uglify:js', 'copy:assets'] }, jsPlugins: { files: '<%= sourcePath %>/<%= assetDir %>/js/plugins/*.js', tasks: ['uglify:jsPlugins', 'copy:assets'] }, sass: { files: '<%= sourcePath %>/<%= assetDir %>/scss/**/*.scss', tasks: ['compass:dist', 'usebanner', 'copy:assets'] }, css: { files: '<%= sourcePath %>/<%= assetDir %>/css/**/*.css', options: { livereload: true } }, html: { files: '<%= sourcePath %>/<%= templateDir %>/**/*.hbs', tasks: ['assemble', 'prettify:dist'] } }, compass: { dist: { options: { config: 'config.rb' } } }, uglify: { js: { options : { banner: '<%= banner %>', beautify : { ascii_only : true, quote_keys: true } }, files: [{ expand: true, cwd: '<%= sourcePath %>/<%= assetDir %>/js', src: '*.js', dest: '<%= sourcePath %>/<%= assetDir %>/js/min' }] }, jsPlugins: { options : { beautify : { ascii_only : true, quote_keys: true } }, files: { '<%= sourcePath %>/<%= assetDir %>/js/min/plugins.js': ['assets/js/plugins/*.js'], } } }, smushit: { dist: { src: ['<%= sourcePath %>/<%= assetDir %>/img/**/*.png', '<%= sourcePath %>/<%= assetDir %>/img/**/*.jpg'], dest: '<%= distPath %>/<%= assetDir %>/img' } }, usebanner: { screenCSS: { options: { position: 'top', banner: '<%= banner %>', linebreak: true }, files: { src: [ '<%= sourcePath %>/<%= assetDir %>/css/screen.css' ] } } }, assemble: { options: { assets: '<%= distPath %>/<%= assetDir %>', layoutdir: '<%= sourcePath %>/<%= templateDir %>/layouts', partials: ['<%= sourcePath %>/<%= templateDir %>/partials/**/*.hbs'], flatten: true, }, site: { options: { layout: 'default.hbs' }, src: ['<%= sourcePath %>/<%= templateDir %>/*.hbs'], dest: '<%= distPath %>' } }, copy: { assets: { files: [{ expand: true, cwd: '<%= sourcePath %>/<%= assetDir %>/', src: ['**', '!scss/**'], dest: '<%= distPath %>/<%= assetDir %>/' }] } }, prettify: { options: { indent: 1, indent_char: ' ', brace_style: 'expand', unformatted: ['a', 'code', 'pre'] }, dist: { expand: true, cwd: '<%= distPath %>', ext: '.html', src: ['*.html'], dest: '<%= distPath %>' } } }); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-prettify'); grunt.loadNpmTasks('grunt-banner'); grunt.loadNpmTasks('grunt-smushit'); grunt.loadNpmTasks('assemble'); grunt.registerTask('default', ['uglify', 'compass', 'usebanner', 'assemble', 'prettify:dist', 'copy:assets']); };
JavaScript
0.000006
@@ -549,32 +549,33 @@ s: %7B%0A%09%09%09%09files: +%5B '%3C%25= sourcePath @@ -596,29 +596,89 @@ r %25%3E/js/ -plugins +vendor/**/*.js', '!%3C%25= sourcePath %25%3E/%3C%25= assetDir %25%3E/js/vendor/min /*.js' +%5D ,%0A%09%09%09%09ta @@ -1667,16 +1667,23 @@ r %25%3E/js/ +vendor/ min/plug @@ -1697,25 +1697,111 @@ : %5B' -assets/js/plug +%3C%25= sourcePath %25%3E/%3C%25= assetDir %25%3E/js/vendor/**/*.js', '!%3C%25= sourcePath %25%3E/%3C%25= assetDir %25%3E/js/vendor/m in -s /*.j
82a213d3278dfdf0c581c6cea924ffa4678f7736
Modify css support check to work better with SSR
src/utils/css-supports.js
src/utils/css-supports.js
export function cssSupports (property, value) { if (CSS) { return CSS.supports(property, value) } return toCamelCase(property) in document.body.style } export function toCamelCase (cssProperty) { cssProperty = cssProperty .split('-') .filter(word => !!word) .map(word => word[0].toUpperCase() + word.substr(1)) .join('') return cssProperty[0].toLowerCase() + cssProperty.substr(1) }
JavaScript
0
@@ -47,19 +47,42 @@ %7B%0A if ( -CSS +typeof CSS !== 'undefined' ) %7B%0A @@ -123,16 +123,80 @@ e)%0A %7D%0A%0A + if (typeof document === 'undefined') %7B%0A return false;%0A %7D%0A%0A return
d25a45d6122abde56f647a4c37c98cc5fb4e1505
Handle undefined environment variables in resolveJoins
src/utils/resolveJoins.js
src/utils/resolveJoins.js
// Used to resolve Fn::Join in environment variables export default function resolveJoins(environment) { if (!environment) { return undefined } const newEnv = {} Object.keys(environment).forEach((key) => { const value = environment[key] const joinArray = value['Fn::Join'] const isJoin = Boolean(joinArray) if (isJoin) { const separator = joinArray[0] const joined = joinArray[1].join(separator) newEnv[key] = joined } else { newEnv[key] = value } }) return newEnv }
JavaScript
0.999999
@@ -248,16 +248,84 @@ nt%5Bkey%5D%0A + if (!value) %7B%0A newEnv%5Bkey%5D = value%0A return%0A %7D%0A %0A cons
50bb2e8a9d2afd61c333371a5b2e05255c5116d2
SAUCELABS_ prefix
test/acceptance/index.js
test/acceptance/index.js
// Docs aren't that great to find. Mostly JAVA based. Here are few helpful resources: // - https://www.browserstack.com/automate/node#testing-frameworks // - http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index_exports_Driver.html // - https://github.com/SeleniumHQ/selenium/blob/c10e8a955883f004452cdde18096d70738397788/javascript/node/selenium-webdriver/test/upload_test.js // // - https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs // - http://seleniumhq.github.io/selenium/docs/api/javascript/ // - http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/firefox/index.html // - http://selenium.googlecode.com/git/docs/api/javascript/namespace_webdriver_By.html // - http://selenium.googlecode.com/git/docs/api/javascript/class_webdriver_WebElement.html require('babel-register') var webdriver = require('selenium-webdriver') var remote = require('selenium-webdriver/remote') var username = process.env.USERNAME var accessKey = process.env.ACCESS_KEY // if accessKey is supplied as env variable, this is a remote Saucelabs test var isRemoteTest = accessKey ? true : '' var host = isRemoteTest ? 'http://uppy.io' : 'http://localhost:4000' // FYI: old Chrome on Windows XP, // Opera 12 on Linux — didn’t pass var platforms = [ // { browser: 'Opera', version: '12', os: 'Linux' }, // { browser: 'iphone', version: '9.2', os: 'OS X 10.10' }, { browser: 'firefox', version: '34.0', os: 'Windows 7' }, { browser: 'chrome', version: '48.0', os: 'Windows XP' } ] var tests = [ require('./multipart.spec.js'), require('./i18n.spec.js') // require('./dragdrop.spec.js') ] function buildDriver (platform) { var driver if (isRemoteTest) { driver = new webdriver .Builder() .withCapabilities({ 'browserName': platform.browser, 'platform': platform.os, 'version': platform.version, 'username': username, 'accessKey': accessKey }) .usingServer('http://' + username + ':' + accessKey + '@ondemand.saucelabs.com:80/wd/hub') .build() driver.setFileDetector(new remote.FileDetector()) } else { driver = new webdriver .Builder() .forBrowser('firefox') .build() } return driver } if (isRemoteTest) { platforms.forEach(function (platform) { tests.forEach(function (test) { var driver = buildDriver(platform) test(driver, platform, host) }) }) } else { tests.forEach(function (test) { var driver = buildDriver() test(driver, { browser: 'Firefox', version: 'Version', os: 'Local' }, host) }) }
JavaScript
0.999995
@@ -979,16 +979,26 @@ ess.env. +SAUCELABS_ USERNAME @@ -1026,16 +1026,26 @@ ess.env. +SAUCELABS_ ACCESS_K @@ -1454,17 +1454,17 @@ owser: ' -f +F irefox', @@ -1514,17 +1514,17 @@ owser: ' -c +C hrome', @@ -1637,21 +1637,19 @@ pec.js') +, %0A - // require
70fbb29f4be30b7bf1affb7e176fa996f4e1912a
Merge into develop
Gruntfile.js
Gruntfile.js
'use strict'; module.exports = function (grunt) { // Load grunt tasks automatically require('load-grunt-tasks')(grunt); grunt.initConfig({ sg_release: { release: { options: { skipBowerInstall: true, files: ['package.json'], commitMessagePrefix: '', pushTo: 'origin', commitFiles: ['-a'] } } } }); grunt.registerTask('release', 'Makes a new release tag of your application to your Git repo', [ 'sg_release' ]); }
JavaScript
0
@@ -229,16 +229,49 @@ : true,%0A + tagName: 'v%25VERSION%25',%0A
1e55ec611bfedc764bb97ff498f5096a469d96d7
Fix a bug that `vivliostyle.sizing.getSize` fails in vertical writing mode on IE
src/vivliostyle/sizing.js
src/vivliostyle/sizing.js
/** * Copyright 2015 Vivliostyle Inc. * @fileoverview CSS Intrinsic & Extrinsic Sizing */ goog.provide("vivliostyle.sizing"); goog.require("adapt.base"); goog.require("adapt.vtree"); /** * Box sizes defined in css-sizing. * @enum {string} */ vivliostyle.sizing.Size = { FILL_AVAILABLE_INLINE_SIZE: "fill-available inline size", FILL_AVAILABLE_BLOCK_SIZE: "fill-available block size", FILL_AVAILABLE_WIDTH: "fill-available width", FILL_AVAILABLE_HEIGHT: "fill-available height", MAX_CONTENT_INLINE_SIZE: "max-content inline size", MAX_CONTENT_BLOCK_SIZE: "max-content block size", MAX_CONTENT_WIDTH: "max-content width", MAX_CONTENT_HEIGHT: "max-content height", MIN_CONTENT_INLINE_SIZE: "min-content inline size", MIN_CONTENT_BLOCK_SIZE: "min-content block size", MIN_CONTENT_WIDTH: "min-content width", MIN_CONTENT_HEIGHT: "min-content height", FIT_CONTENT_INLINE_SIZE: "fit-content inline size", FIT_CONTENT_BLOCK_SIZE: "fit-content block size", FIT_CONTENT_WIDTH: "fit-content width", FIT_CONTENT_HEIGHT: "fit-content height" }; /** * Get specified sizes for the element. * @param {adapt.vtree.ClientLayout} clientLayout * @param {Element} element * @param {!Array.<vivliostyle.sizing.Size>} sizes * @returns {!Object.<vivliostyle.sizing.Size, number>} */ vivliostyle.sizing.getSize = function(clientLayout, element, sizes) { var original = { display: element.style.display, position: element.style.position, width: /** @type {string} */ (element.style.width), height: /** @type {string} */ (element.style.height) }; var doc = element.ownerDocument; var parent = element.parentNode; // wrap the element with a dummy container element var container = doc.createElement("div"); adapt.base.setCSSProperty(container, "position", original.position); parent.insertBefore(container, element); container.appendChild(element); adapt.base.setCSSProperty(element, "width", "auto"); adapt.base.setCSSProperty(element, "height", "auto"); /** * @param {string} name * @returns {string} */ function getComputedValue(name) { return clientLayout.getElementComputedStyle(element).getPropertyValue(name); } var writingMode = getComputedValue( adapt.base.propNameMap["writing-mode"] || "writing-mode"); var isVertical = writingMode === "vertical-rl" || writingMode === "vertical-lr"; var inlineSizeName = isVertical ? "height" : "width"; var blockSizeName = isVertical ? "width" : "height"; /** @returns {string} */ function getFillAvailableInline() { adapt.base.setCSSProperty(element, "display", "block"); adapt.base.setCSSProperty(element, "position", "static"); return getComputedValue(inlineSizeName); } // Inline size of an inline-block element is the fit-content (shrink-to-fit) inline size. /** @returns {string} */ function getMaxContentInline() { adapt.base.setCSSProperty(element, "display", "inline-block"); // When the available inline size is sufficiently large, the fit-content inline size equals to the max-content inline size. adapt.base.setCSSProperty(container, inlineSizeName, "99999999px"); // 'sufficiently large' value var r = getComputedValue(inlineSizeName); adapt.base.setCSSProperty(container, inlineSizeName, ""); return r; } /** @returns {string} */ function getMinContentInline() { adapt.base.setCSSProperty(element, "display", "inline-block"); // When the available inline size is zero, the fit-content inline size equals to the min-content inline size. adapt.base.setCSSProperty(container, inlineSizeName, "0"); var r = getComputedValue(inlineSizeName); adapt.base.setCSSProperty(container, inlineSizeName, ""); return r; } /** @returns {string} */ function getFitContentInline() { adapt.base.setCSSProperty(element, "display", "inline-block"); return getComputedValue(inlineSizeName); } /** @returns {string} */ function getIdealBlock() { return getComputedValue(blockSizeName); } /** @returns {string} */ function getFillAvailableBlock() { throw new Error("Getting fill-available block size is not implemented"); } var result = /** @type {!Object.<vivliostyle.sizing.Size, number>} */ ({}); sizes.forEach(function(size) { /** @type {string} */ var r; switch (size) { case vivliostyle.sizing.Size.FILL_AVAILABLE_INLINE_SIZE: r = getFillAvailableInline(); break; case vivliostyle.sizing.Size.MAX_CONTENT_INLINE_SIZE: r = getMaxContentInline(); break; case vivliostyle.sizing.Size.MIN_CONTENT_INLINE_SIZE: r = getMinContentInline(); break; case vivliostyle.sizing.Size.FIT_CONTENT_INLINE_SIZE: r = getFitContentInline(); break; case vivliostyle.sizing.Size.FILL_AVAILABLE_BLOCK_SIZE: r = getFillAvailableBlock(); break; case vivliostyle.sizing.Size.MAX_CONTENT_BLOCK_SIZE: case vivliostyle.sizing.Size.MIN_CONTENT_BLOCK_SIZE: case vivliostyle.sizing.Size.FIT_CONTENT_BLOCK_SIZE: r = getIdealBlock(); break; case vivliostyle.sizing.Size.FILL_AVAILABLE_WIDTH: r = isVertical ? getFillAvailableBlock() : getFillAvailableInline(); break; case vivliostyle.sizing.Size.FILL_AVAILABLE_HEIGHT: r = isVertical ? getFillAvailableInline() : getFillAvailableBlock(); break; case vivliostyle.sizing.Size.MAX_CONTENT_WIDTH: r = isVertical ? getIdealBlock() : getMaxContentInline(); break; case vivliostyle.sizing.Size.MAX_CONTENT_HEIGHT: r = isVertical ? getMaxContentInline() : getIdealBlock(); break; case vivliostyle.sizing.Size.MIN_CONTENT_WIDTH: r = isVertical ? getIdealBlock() : getMinContentInline(); break; case vivliostyle.sizing.Size.MIN_CONTENT_HEIGHT: r = isVertical ? getMinContentInline() : getIdealBlock(); break; case vivliostyle.sizing.Size.FIT_CONTENT_WIDTH: r = isVertical ? getIdealBlock() : getFitContentInline(); break; case vivliostyle.sizing.Size.FIT_CONTENT_HEIGHT: r = isVertical ? getFitContentInline() : getIdealBlock(); break; } result[size] = parseFloat(r); adapt.base.setCSSProperty(element, "position", original.position); adapt.base.setCSSProperty(element, "display", original.display); }); adapt.base.setCSSProperty(element, "width", original.width); adapt.base.setCSSProperty(element, "height", original.height); parent.insertBefore(element, container); parent.removeChild(container); return result; };
JavaScript
0.000008
@@ -2456,24 +2456,99 @@ de === %22 -vertical +tb-rl%22 %7C%7C%0A writingMode === %22vertical-lr%22 %7C%7C writingMode === %22tb -lr%22;%0A
de617a40856efadf2a4537148d478ac476fe86ed
Make sure to use the right version of nwjs
Gruntfile.js
Gruntfile.js
module.exports = function(grunt) { // TODO: platforms shouldn't be hardcoded here var platforms = ['win64']; // Build up array of destinations for Twister deamon files var destinations = {files: []}; platforms.forEach(function (platform) { destinations.files.push({ expand: true, src: ['./twister-data/**'], dest: './builds/Twisting/' + platform + '/' }); }); // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), nodewebkit: { options: { platforms: platforms, buildDir: './builds' }, src: ['./src/**/*', '!./src/twister-data/**/*', '!./src/*.exe', '!./src/*.pak', '!./src/*.dll'] }, copy: { twister: destinations }, less: { development: { files: { "./src/app/styles/style.css": "./src/app/styles/main.less" } } }, auto_install: { subdir: { options: { cwd: 'src', stdout: true, stderr: true, failOnError: true, } } }, }); grunt.loadNpmTasks('grunt-node-webkit-builder'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-auto-install'); grunt.registerTask('build', ['less', 'nodewebkit', 'copy:twister']); grunt.registerTask('compile', ['less']); grunt.registerTask('postinstall', ['auto_install']); };
JavaScript
0
@@ -630,16 +630,52 @@ tforms,%0A + version: 'v0.12.1',%0A
beb98007f2718f10570462bf94decd929f9eb708
Fix grunt protractor task
Gruntfile.js
Gruntfile.js
var srcFiles = 'app/**/*.js'; var specFiles = 'spec/**/*.js'; var specE2eFiles = 'spec-e2e/**/*.js'; module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-protractor-webdriver'); grunt.loadNpmTasks('grunt-protractor-runner'); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jasmine: { src: srcFiles, options: { specs: specFiles, // helpers: 'spec/*Helper.js', // template: 'custom.tmpl' } }, watch: { files: [srcFiles, specFiles], tasks: 'karma:spec:run' }, jshint: { all: ['*.js', srcFiles, specFiles] }, karma: { spec: { autoWatch: false, singleRun: true, options: { files : [ './bower_components/angular/angular.js', './bower_components/angular-mocks/angular-mocks.js', srcFiles, specFiles ], frameworks: ['jasmine'], browsers : ['PhantomJS'], plugins : [ 'karma-chrome-launcher', 'karma-phantomjs-launcher', 'karma-firefox-launcher', 'karma-jasmine' ], } }, }, protractor: { options: { keepAlive: true, // If false, the grunt process stops when the test fails. noColor: false, // If true, protractor will not use colors in its output. args: { specs: [ specE2eFiles ], capabilities: { 'browserName': 'chrome' }, seleniumAddress: "127.0.0.1:4444/wd/hub", // seleniumServerJar: "" // Arguments passed to the command framework: "jasmine", jasmineNodeOpts: { showColors: true, // Use colors in the command line report. } } }, }, protractor_webdriver: { startSelenium: { options: { command: 'webdriver-manager start' }, }, } }); grunt.registerTask('default', ['karma:spec', 'jshint']); };
JavaScript
0.999095
@@ -1383,32 +1383,73 @@ options: %7B%0A + configFile: %22protractorConf.js%22,%0A keepAliv @@ -1537,17 +1537,16 @@ r: false -, // If t @@ -1606,423 +1606,89 @@ - args: %7B%0A specs: %5B specE2eFiles %5D,%0A capabilities: %7B%0A 'browserName': 'chrome'%0A %7D,%0A seleniumAddress: %22127.0.0.1:4444/wd/hub%22,%0A // seleniumServerJar: %22%22%0A // Arguments pass +%7D,%0A all: %7B%7D, // A target ne ed +s to -the command%0A framework: %22jasmine%22,%0A jasmineNodeOpts: %7B%0A showColors: true, // Use colors in the command line report.%0A %7D%0A %7D%0A %7D, +be defined, otherwise protractor won't run %0A
16a3879e073d46c3f4e2536b0380913c90145492
Remove unused tasks
Gruntfile.js
Gruntfile.js
/** * @file Gruntfile.js * @version 0.0.1 * * @copyright 2014 CoNWeT Lab., Universidad Politécnica de Madrid * @license Apache v2 (https://github.com/Wirecloud/room-manager-src/blob/master/LICENSE) */ module.exports = function(grunt) { 'use strict'; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), banner: ' * @version <%= pkg.version %>\n' + ' * \n' + ' * @copyright 2014 <%= pkg.author %>\n' + ' * @license <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + ' */', compress: { widget: { options: { mode: 'zip', archive: 'build/<%= pkg.vendor %>_<%= pkg.name %>_<%= pkg.version %>-dev.wgt' }, files: [ {expand: true, src: ['lib/**/*', 'config.xml', 'index.html'], cwd: 'src'}, {expand: true, src: ['js/**/*', 'css/**/*'], cwd: 'build'}, {expand: true, src: ['jquery.min.map', 'jquery.min.js'], dest: 'lib/js', cwd: 'node_modules/jquery/dist'} ] } }, jasmine: { src: ['src/js/*.js'], options: { specs: 'src/test/js/*Spec.js', helpers: ['src/test/helpers/*.js'], vendor: ['node_modules/jquery/dist/jquery.js', 'src/lib/js/jquery.dataTables.js', 'node_modules/jasmine-jquery/lib/jasmine-jquery.js'] } }, replace: { version: { src: ['src/config.xml'], overwrite: true, replacements: [{ from: /version=\"[0-9]+\.[0-9]+\.[0-9]+(-dev)?\"/g, to: 'version="<%= pkg.version %>"' }] } }, clean: ['build'], jshint: { all: ['src/js/**/*', 'src/test/**/*', 'Gruntfile.js'] } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jasmine'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-text-replace'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.registerTask('js', ['concat:dist', 'uglify:dist']); grunt.registerTask('jsConcat', 'concat:dist'); grunt.registerTask('css', ['less:dist', 'cssmin:dist']); grunt.registerTask('zip', 'compress:widget'); grunt.registerTask('version', ['replace:version']); // grunt.registerTask('default', ['jshint', 'js', 'css', 'version', 'jasmine', 'zip']); grunt.registerTask('default', ['jshint', 'jsConcat', 'css', 'version', 'jasmine', 'zip']); };
JavaScript
0.000058
@@ -1714,24 +1714,47 @@ runtfile.js' +, '!src/test/fixtures/' %5D%0A %7D%0A%0A %7D @@ -2174,176 +2174,8 @@ );%0A%0A - grunt.registerTask('js', %5B'concat:dist', 'uglify:dist'%5D);%0A grunt.registerTask('jsConcat', 'concat:dist');%0A grunt.registerTask('css', %5B'less:dist', 'cssmin:dist'%5D);%0A gr @@ -2278,11 +2278,8 @@ ;%0A%0A - // gru @@ -2319,114 +2319,8 @@ nt', - 'js', 'css', 'version', 'jasmine', 'zip'%5D);%0A grunt.registerTask('default', %5B'jshint', 'jsConcat', 'css', 've