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
|
---|---|---|---|---|---|---|---|
a0ce412d487d516146b981fd7f600e5fe043ea39
|
clean gulpfile
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp'),
merge = require('merge-stream'),
pf = require('./js/paramFiles'),
sourcemaps = require('gulp-sourcemaps'),
vulcanize = require('gulp-vulcanize'),
// css
csscomb = require('gulp-csscomb'),
autoprefixer = require('autoprefixer-core'),
csswring = require('csswring'),
postcss = require('gulp-postcss'),
// js
sass = require('gulp-sass'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
webpack = require('gulp-webpack'),
// CONSTANTS
SCSS_PATH = 'css',
JS_PATH = 'js',
COMPONENT_PATH = 'components',
PUBLIC_CSS = 'public/css',
PUBLIC_JS = 'public/js',
JS_ENTRY_POINTS = [
JS_PATH + '/main.js'
];
/**
* Linting SCSS files
* Possible send files to param -files=...
*/
gulp.task('csslint', function() {
var files = pf.paramFiles(),
stream,
global,
components;
if (files) {
stream = gulp.src(files)
.pipe(csscomb(__dirname + '/.csscomb.json'))
.pipe(gulp.dest('./'));
} else {
global = gulp.src(pf.scss(SCSS_PATH))
.pipe(csscomb(__dirname + '/.csscomb.json'))
.pipe(gulp.dest(SCSS_PATH));
components = gulp.src(pf.scss(COMPONENT_PATH))
.pipe(csscomb(__dirname + '/.csscomb.json'))
.pipe(gulp.dest(COMPONENT_PATH));
stream = merge(global, components);
}
return stream;
});
/**
* Processing SCSS files
*/
gulp.task('css', ['csslint'], function() {
var processors = [
autoprefixer({
browsers: ['last 1 version']
}),
csswring({
removeAllComments: true
})
];
return gulp.src([pf.scss(SCSS_PATH)])
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(postcss(processors))
.pipe(sourcemaps.write(PUBLIC_CSS + '/map'))
.pipe(gulp.dest(PUBLIC_CSS));
});
/**
* Linting JS files
* Possible send files to param -files=...
*/
gulp.task('jslint', function() {
var files = pf.paramFiles();
if (!files) {
files = [pf.js(JS_PATH), pf.js(COMPONENT_PATH)];
}
return gulp.src(files)
.pipe(jshint.extract())
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jscs())
.pipe(jshint.reporter('fail'));
});
/**
*
*/
gulp.task('component', function() {
return gulp.src('prototype/component.html')
.pipe(vulcanize({
dest: 'prototype/component',
strip: true,
inline: true
}))
.pipe(gulp.dest('prototype/component'));
});
/**
* Processing JS files
*/
gulp.task('js', ['jslint'], function() {
// return gulp.src(JS_ENTRY_POINTS)
// .pipe(webpack())
// .pipe(gulp.dest(PUBLIC_JS));
});
gulp.task('default', ['js', 'css']);
|
JavaScript
| 0.000001 |
@@ -489,47 +489,8 @@
'),%0A
- webpack = require('gulp-webpack'),%0A
@@ -613,95 +613,8 @@
css'
-,%0A PUBLIC_JS = 'public/js',%0A JS_ENTRY_POINTS = %5B%0A JS_PATH + '/main.js'%0A %5D
;%0A%0A/
@@ -2399,106 +2399,8 @@
) %7B%0A
- // return gulp.src(JS_ENTRY_POINTS)%0A // .pipe(webpack())%0A // .pipe(gulp.dest(PUBLIC_JS));%0A
%7D);%0A
|
b94e04bb47ef634e6680ceec4296cbeb2a8a693b
|
Add cname gulp task
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var clean = require('gulp-clean');
var cssmin = require('gulp-cssmin');
var flatten = require('gulp-flatten');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var htmlmin = require('gulp-htmlmin');
var node_modules_path = './node_modules';
var paths = {
'node': './node_modules',
'assets': './assets'
}
// remove files in the public folder
gulp.task('clean', function(){
return gulp.src('./public/**/**/*', {read: false})
.pipe(clean());
});
gulp.task('serve', function(){
browserSync.init({
server: {
baseDir: './public'
}
});
gulp.watch(paths.assets + '/pages/*' , ['pages']);
gulp.watch(paths.assets + '/images/*' , ['images']);
gulp.watch(paths.assets + '/styles/**/*.scss',['styles']);
gulp.watch(paths.assets + '/data/*', ['data']);
gulp.watch(paths.assets + '/scripts/*.js',['scripts']);
gulp.watch([paths.assets + '/data/*', paths.assets + '/styles/app.scss',
'public/*.html', paths.assets + '/scripts/**/*.js']).on('change', browserSync.reload);
});
gulp.task('pages', function(){
return gulp.src([paths.assets + '/pages/*'])
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./public'), { base: '.' });
});
// compiles styles with foundation base styles
gulp.task('styles', function(){
gulp.src(paths.assets + '/styles/app.scss')
.pipe(sass())
.pipe(cssmin())
.pipe(gulp.dest('./public/css'), { base: '.'});
});
gulp.task('images', function(){
return gulp.src([
paths.assets + '/images/**/*'
])
.pipe(flatten())
.pipe(gulp.dest('./public/assets/'));
});
gulp.task('documents', function(){
return gulp.src([
paths.assets + '/documents/*'
]).pipe(gulp.dest('./public/assets'));
})
gulp.task('data', function(){
return gulp.src([
paths.assets + '/data/*'
]).pipe(gulp.dest('./public/data'));
})
gulp.task('scripts', function(){
// index page
gulp.src(paths.assets + '/scripts/index.js')
.pipe(rename('index.min.js'))
// .pipe(uglify())
.pipe(gulp.dest('./public/js'));
// artwork page
// need foundation, the modal, and jquery
gulp.src([
paths.node + '/masonry-layout/dist/masonry.pkgd.js',
paths.assets + '/scripts/artApp.js'])
.pipe(concat('artApp.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('default', ['pages', 'images', 'styles', 'data', 'scripts', 'documents', 'serve']);
gulp.task('build', ['pages', 'images', 'styles', 'data', 'scripts', 'documents']);
|
JavaScript
| 0.000037 |
@@ -2382,24 +2382,111 @@
s'));%0A%0A%7D);%0A%0A
+gulp.task('cname', function() %7B%0A%09gulp.src('./CNAME').pipe(gulp.dest('./public'));%0A%7D);%0A%0A
gulp.task('d
@@ -2647,12 +2647,21 @@
cuments'
+, 'cname'
%5D);%0A
|
d600f10528b3a9672949a95c5c8d239a36b54d17
|
Add plugin gh-pages
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp'),
browserSync = require('browser-sync').create(),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
concat = require('gulp-concat'),
minifyHTML = require('gulp-minify-html');
gulp.task('browser-sync', function(){
browserSync.init({
server: {
baseDir: "./public"
}
});
});
gulp.task('sass', function(){
gulp.src('source/sass/**/*.scss')
.pipe(sass({
includePaths: ['scss'],
onError: browserSync.notify
}))
.pipe(autoprefixer({
browsers: ['last 12 versions'],
cascade: true
}))
.pipe(sass(({outputStyle: 'expanded'})))
.pipe(gulp.dest('./public/app/css'))
.pipe(browserSync.stream());
});
gulp.task('js', function(){
gulp.src('source/js/**/*.js')
.pipe(concat('main.js'))
.pipe(uglify())
.pipe(gulp.dest('./public/app/js'))
.pipe(browserSync.stream());
});
gulp.task('imagemin', function(){
gulp.src('source/img/**/*')
.pipe(imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{removeViewBox: false}],
}))
.pipe(gulp.dest('./public/app/img'))
});
gulp.task('fonts', function(){
gulp.src('source/fonts/**/*')
.pipe(gulp.dest('./public/app/fonts'));
});
gulp.task('minify-html', function(){
gulp.src('source/*.html')
.pipe(minifyHTML({empty: true}))
.pipe(gulp.dest('./public'))
.pipe(browserSync.stream());
});
gulp.task('watch', function() {
gulp.watch('source/sass/**/*.scss', ['sass']);
gulp.watch('source/js/**/*.js', ['js']);
gulp.watch('source/img/**/*', ['imagemin']);
gulp.watch('source/fonts/**/*', ['fonts']);
gulp.watch('source/*.html', ['minify-html']);
});
gulp.task('default', ['browser-sync', 'watch', 'imagemin', 'fonts']);
|
JavaScript
| 0.000001 |
@@ -324,16 +324,56 @@
y-html')
+%0A%09%09ghPages%09%09%09%09= require('gulp-gh-pages')
;%0A%0Agulp.
@@ -1482,32 +1482,127 @@
stream());%0A%7D);%0A%0A
+gulp.task('deploy', function() %7B%0A return gulp.src('./public/**/*')%0A .pipe(ghPages());%0A%7D);%0A%0A
gulp.task('watch
|
715ec1c36f1759b3a05e9ca75b8dcbdd12ec0f70
|
Update gulpfile.js
|
gulpfile.js
|
gulpfile.js
|
// Packages
const { src, dest, series, parallel, watch } = require("gulp");
const autoprefixer = require("autoprefixer");
const browserSync = require("browser-sync").create();
const babel = require("gulp-babel");
const del = require("del");
const fs = require("fs");
const cleanCSS = require("gulp-clean-css");
const concat = require("gulp-concat");
const config = require("./config");
const data = require("gulp-data");
const gulpif = require("gulp-if");
const header = require("gulp-header");
const imagemin = require("gulp-imagemin");
const pkg = require("./package.json");
const plumber = require("gulp-plumber");
const postcss = require("gulp-postcss");
const rename = require("gulp-rename");
const sass = require("gulp-sass")(require("node-sass"));
const sourcemaps = require("gulp-sourcemaps");
const spritesmith = require("gulp.spritesmith");
const terser = require("gulp-terser");
const twig = require("gulp-twig");
const zip = require("gulp-zip");
// File Banner
const banner = [
"/*!",
" * <%= pkg.name %> - <%= pkg.description %>",
" * @version v<%= pkg.version %>",
" * @link <%= pkg.homepage %>",
" * @license <%= pkg.license %>",
" */",
"",
].join("\n");
// Get Timestamp
const getTimestamp = () => {
let date = new Date();
let year = date.getFullYear().toString();
let month = ("0" + (date.getMonth() + 1)).slice(-2);
let day = ("0" + date.getDate()).slice(-2);
let hour = ("0" + date.getHours().toString()).slice(-2);
let minute = ("0" + date.getMinutes().toString()).slice(-2);
let second = ("0" + date.getSeconds().toString()).slice(-2);
return year + month + day + hour + minute + second;
};
// Archive pre-existing content from output folders
const archiveDist = (cb) => {
src(config.archive.input)
.pipe(zip(pkg.name + "_v" + pkg.version + "-build_" + getTimestamp() + ".zip"))
.pipe(dest(config.archive.output));
return cb();
};
// Remove pre-existing content from output folders
const cleanDist = (cb) => {
del.sync(config.clean);
return cb();
};
// Optimise GIF, JPEG, PNG and SVG images
const buildImages = () => {
return src(config.images.input)
.pipe(plumber())
.pipe(
imagemin({
interlaced: true,
progressive: true,
optimizationLevel: 5,
svgoPlugins: [
{
removeViewBox: true,
},
],
})
)
.pipe(dest(config.images.output));
};
// Concanate & minify JavaScript files
const buildScripts = () => {
return src(config.scripts.input)
.pipe(plumber())
.pipe(gulpif(process.env.NODE_ENV === "development", sourcemaps.init()))
.pipe(
babel({
presets: ["@babel/env"],
})
)
.pipe(concat("app.js"))
.pipe(header(banner, { pkg: pkg }))
.pipe(dest(config.scripts.output))
.pipe(
terser({
keep_fnames: true,
mangle: false,
})
)
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulpif(process.env.NODE_ENV === "development", sourcemaps.write(".")))
.pipe(dest(config.scripts.output));
};
// Convert a set of images into a spritesheet and CSS variables
const buildSprites = (cb) => {
const spriteData = gulp
.src(config.sprites.input)
.pipe(plumber())
.pipe(
spritesmith({
imgName: "s.png",
cssName: "_sprites.scss",
cssFormat: "scss",
cssTemplate: "src/sprites/scss.template.handlebars",
imgPath: "../images/s.png",
padding: 3,
imgOpts: {
quality: 100,
},
})
);
spriteData.img.pipe(dest(config.sprites.output));
spriteData.css.pipe(dest(config.sprites.output));
return cb();
};
// Compile, autoprefix & minify SASS files
const buildStyles = () => {
return src(config.styles.input)
.pipe(plumber())
.pipe(gulpif(process.env.NODE_ENV === "development", sourcemaps.init()))
.pipe(
sass({
outputStyle: "expanded",
})
)
.pipe(postcss([autoprefixer()]))
.pipe(header(banner, { pkg: pkg }))
.pipe(dest(config.styles.output))
.pipe(
cleanCSS({
level: {
1: {
specialComments: 0,
},
},
})
)
.pipe(header(banner, { pkg: pkg }))
.pipe(
rename({
suffix: ".min",
})
)
.pipe(gulpif(process.env.NODE_ENV === "development", sourcemaps.write(".")))
.pipe(dest(config.styles.output));
};
// Compile Twig files to HTML
const buildTemplates = () => {
return src(config.templates.input)
.pipe(plumber())
.pipe(
data((file) => {
return JSON.parse(fs.readFileSync("website.json"));
})
)
.pipe(twig())
.pipe(dest(config.templates.output));
};
// Watch for changes to the source directory
const serveDist = (cb) => {
browserSync.init({
server: {
baseDir: config.server.root,
},
});
cb();
};
// Reload the browser when files change
const reloadBrowser = (cb) => {
browserSync.reload();
cb();
};
// Watch all file changes
const watchSource = () => {
watch(config.images.watch, series(buildImages, reloadBrowser));
watch(config.scripts.watch, series(buildScripts, reloadBrowser));
watch(config.styles.watch, series(buildStyles, reloadBrowser));
watch(config.templates.watch, series(buildTemplates, reloadBrowser));
};
// Archive task
exports.archive = archiveDist;
// Clean task
exports.clean = cleanDist;
// Sprites task
exports.sprites = buildSprites;
// Build task
exports.build = series(parallel(buildScripts, buildStyles, buildTemplates), buildImages);
// Watch Task
exports.watch = watchSource;
// Default task
exports.default = series(exports.build, serveDist, watchSource);
|
JavaScript
| 0.000001 |
@@ -738,13 +738,8 @@
re(%22
-node-
sass
|
a72056ba3a37c038e5220ee83556ee248802e1a8
|
Add task for image compression
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var uglify = require('gulp-uglify');
var cleanCSS = require('gulp-clean-css');
var imagemin = require('gulp-imagemin');
var fileInclude = require('gulp-file-include');
var concat = require('gulp-concat');
// **UIKit** scripts to concatenate and minify
var UIKitScripts = ['src/uikit/js/uikit.js', 'src/uikit/js/components/slideshow.js'];
// **Other** scripts to concatenate and minify
var scripts = ['src/js/main.js'];
gulp.task('sass', function() {
return gulp.src('src/sass/main.scss')
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 3 versions']
}))
.pipe(cleanCSS())
.pipe(gulp.dest('build/css'));
});
gulp.task('uk-scripts', function() {
return gulp.src(UIKitScripts)
.pipe(concat('uikit.min.js'))
.pipe(gulp.dest('build/js'))
.pipe(uglify())
.pipe(gulp.dest('build/js'));
});
gulp.task('scripts', function() {
return gulp.src(scripts)
.pipe(concat('main.min.js'))
.pipe(gulp.dest('build/js'))
.pipe(uglify())
.pipe(gulp.dest('build/js'));
});
gulp.task('html', function() {
return gulp.src(['src/index.html'])
.pipe(fileInclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('build'));
});
gulp.task('default', ['sass', 'uk-scripts', 'scripts', 'html'], function() {
gulp.watch('src/sass/*.scss', ['sass']);
gulp.watch('src/js/*.js', ['scripts']);
gulp.watch(['src/index.html', 'src/partials/*.html'], ['html']);
gulp.src('src/img/*')
.pipe(imagemin())
.pipe(gulp.dest('build/img'));
});
|
JavaScript
| 0.999863 |
@@ -1389,32 +1389,165 @@
'build'));%0A%7D);%0A%0A
+gulp.task('img', function() %7B%0A return gulp.src('src/img/*')%0A .pipe(imagemin())%0A .pipe(gulp.dest('build/img'));%0A%7D);%0A%0A
gulp.task('defau
@@ -1591,16 +1591,23 @@
, 'html'
+, 'img'
%5D, funct
@@ -1776,99 +1776,8 @@
%5D);%0A
- gulp.src('src/img/*')%0A .pipe(imagemin())%0A .pipe(gulp.dest('build/img'));%0A
%7D);%0A
|
e779ddd2e85edc663d97c1e0572d87e884c881a5
|
fix typos
|
gulpfile.js
|
gulpfile.js
|
"use strict";
var gulp = require('gulp'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
inject = require('gulp-inject'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
es = require('event-stream'),
component = require('package.json');
var paths = {
dist: 'dist',
examples: 'example',
libs: 'app/lib',
debug: 'debug',
src: [
'app/scripts/basics/foundation.js',
'app/scripts/basics/**/*.js',
'app/scripts/game/helpers/coords_rotation_helper.js',
'app/scripts/**/*.js',
'!app/scripts/app.js'
]
};
/**
*
*
* Clean Task
*
*
*/
gulp.task('clean', function () {
return gulp.src([paths.dist, paths.examples, paths.debug], {read: false})
.pipe(clean());
});
/**
*
*
* Default Task
*
*
*/
gulp.task('default', ['clean', 'dist', 'examples']);
/**
*
*
* Distribution Tasks
*
*
*/
gulp.task('lean-dist', ['clean'], function () {
return leanDistributionStream()
.pipe(gulp.dest(paths.dist));
});
gulp.task('fat-dist', ['clean'], function () {
return fatDistributionStream()
.pipe(gulp.dest(paths.dist));
});
gulp.task('dist', ['clean', 'lean-dist', 'fat-dist']);
/**
*
*
* Task for a runnable example (including index.html and app.js for bootstrapping)
*
*
*/
gulp.task('example', ['clean', 'prepare-example', 'copy-images-to-example']);
/**
*
*
* Helper tasks
*
*
*/
gulp.task('prepare-example', function () {
var fatDist = fatDistributionStream()
.pipe(gulp.dest(paths.examples + '/scripts'))
.pipe(rename('../../scripts/' + component.name + '.fat.min.js'));
var appJs = helperJsResourcesStream()
.pipe(gulp.dest(paths.examples + '/scripts'))
.pipe(rename('../../scripts/app.js'));
var cssStream = gulp.src(['app/styles/**/*.css'])
.pipe(concat('main.css'))
.pipe(gulp.dest(paths.examples + '/styles'))
.pipe(rename('../../styles/main.css'));
return gulp.src('app/index.tpl.html')
.pipe(inject(es.merge(fatDist, appJs, cssStream), {
addRootSlash: false,
sort: ensureAppJsLastLoadedComparator // ensure that app.js is the last file to include
}))
.pipe(rename('index.html'))
.pipe(gulp.dest(paths.examples));
});
gulp.task('copy-images-to-example', function () {
return gulp.src('app/images/**/*.jpg')
.pipe(gulp.dest(paths.examples + '/images'));
});
/**
*
*
* Helper functions that return streams
*
*
*/
function preMinifiedDependenciesStream() {
return gulp.src([paths.lib + '/**/*.min.js'])
.pipe(concat('pre-minified-deps.min.js'));
}
function dependenciesToMinifyStream() {
return gulp.src([paths.lib + '/**/*.js', '!'paths.lib + '/**/*.min.js'])
.pipe(concat('deps-to-minify.min.js'));
}
function minifiedDependenciesStream() {
return es.merge(
preMinifiedDependenciesStream(),
dependenciesToMinifyStream().pipe(uglify())
).pipe(concat('all-deps.min.js'));
}
function minifiedJsResourcesStream() {
// To a certain extend we need to ensure a specific loading order.
// We can do it better in the future by using e.g. Browserify.
return gulp.src(paths.src)
.pipe(concat(component.name + '.min.js'))
.pipe(uglify());
}
function helperJsResourcesStream() {
return gulp.src(['app/scripts/app.js'])
.pipe(concat('app.js'));
}
function leanDistributionStream() {
return minifiedJsResourcesStream();
}
function fatDistributionStream() {
return es.merge(
minifiedDependenciesStream(),
minifiedJsResourcesStream()
).pipe(concat(component.name + '.fat.min.js'));
}
/**
*
*
* Other helper functions
*
*
*/
function ensureAppJsLastLoadedComparator(a, b) {
if (/app.js/.test(a.filepath)) {
return 1;
}
else if (/app.js/.test(b.filepath)) {
return -1;
}
else if (/app.js/.test(a.filepath) && /app.js/.test(b.filepath)) {
return 0;
}
else {
if (a.filepath < b.filepath)
return -1;
if (a.filepath > b.filepath)
return 1;
return 0;
}
}
/**
*
*
* Debug Tasks
*
*
*/
gulp.task('pre-min-deps', ['clean'], function () {
return preMinifiedDependenciesStream()
.pipe(gulp.dest(paths.debug + '/pre-min-deps'));
});
gulp.task('min-deps', ['clean'], function () {
return minifiedDependenciesStream()
.pipe(gulp.dest(paths.debug + '/min-deps'));
});
gulp.task('min-code', ['clean'], function () {
return minifiedJsResourcesStream()
.pipe(gulp.dest(paths.debug + '/min-code'));
});
gulp.task('deps-to-min', ['clean'], function () {
return dependenciesToMinifyStream()
.pipe(gulp.dest(paths.debug + '/deps-to-min'));
});
|
JavaScript
| 0.003148 |
@@ -264,16 +264,18 @@
equire('
+./
package.
@@ -826,17 +826,16 @@
'example
-s
'%5D);%0A%0A/*
@@ -2637,16 +2637,19 @@
js', '!'
+ +
paths.li
|
50d04dd825605ad76304c8dcd057d404cae6e627
|
Update gulp file to lint more src
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
gulp.task('jshint', function() {
return gulp.src('./lib/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('jscs', function () {
return gulp.src('./lib/*.js')
.pipe(jscs());
});
gulp.task('default', ['jshint', 'jscs']);
|
JavaScript
| 0 |
@@ -1,12 +1,27 @@
+'use strict';%0A%0A
var gulp =
@@ -107,24 +107,86 @@
lp-jscs');%0A%0A
+var src = %5B%0A './lib/*.js',%0A 'index.js',%0A 'gulpfile.js'%0A%5D;%0A%0A
gulp.task('j
@@ -220,36 +220,27 @@
rn gulp.src(
-'./lib/*.js'
+src
)%0A .pipe(
@@ -350,28 +350,19 @@
ulp.src(
-'./lib/*.js'
+src
)%0A .p
|
58e455acb7ef640bf5dc301b67d7e902976ae37c
|
add well-known task
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
babel = require("gulp-babel"),
browserify = require('gulp-browserify'),
cssnano = require('gulp-cssnano'),
imagemin = require('gulp-imagemin'),
// notify = require('gulp-notify'),
pug = require('gulp-pug'),
jshint = require('gulp-jshint'),
sass = require('gulp-sass'),
stylish = require('jshint-stylish'),
uglify = require('gulp-uglify'),
gutil = require('gulp-util'),
browserSync = require('browser-sync').create();
const SRC = './src';
const DIST = './dist';
gulp.task('scripts',() => {
return gulp.src([SRC+'/js/*.js', '!./node_modules/**', '!./dist/**'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish))
.pipe(babel({
presets: ['es2015']
}))
.pipe(browserify({
insertGlobals : true
}))
.pipe(uglify().on('error', gutil.log)) //notify(...) and continue
.pipe(gulp.dest(DIST+'/src/js'));
});
gulp.task('templates', function() {
var LOCALS = {};
gulp.src(['**/*.pug', '!./node_modules/**', '!./dist/**', '!./includes/**'])
.pipe(pug({
locals: LOCALS
}))
.pipe(gulp.dest(DIST));
});
gulp.task('images', () => {
return gulp.src([SRC+'/img/**/*', '!./node_modules/**', '!./dist/**'])
.pipe(imagemin({
optimizationLevel: 2,
progressive: true,
svgoPlugins: [
{removeViewBox: false},
{cleanupIDs: false}
]}))
.pipe(gulp.dest(DIST+'/src/img'));
});
gulp.task('sass', () => {
return gulp.src([SRC+'/scss/**/*.scss', '!./node_modules/**', '!./dist/**'])
.pipe(sass().on('error', sass.logError)) //notify(...) and continue
.pipe(autoprefixer({
browsers: ['>0.5%']
}))
// the rules here will prevent the animations from being removed
.pipe(cssnano({
discardUnused: false,
reduceIdents: false,
mergeIdents: false
}))
.pipe(gulp.dest(DIST+'/src/css'));
});
gulp.task('copy',() => {
return gulp.src(['CNAME','.well-known/**/*'])
.pipe(gulp.dest(DIST));
});
gulp.task('browser-sync', () => {
browserSync.init({
server: {
baseDir: DIST
},
notify: {
styles: {
right: 'initial',
top: 'initial',
bottom: '0',
left: '0',
borderBottomLeftRadius: 'initial',
borderTopRightRadius: '1em'
}
}
});
});
gulp.task('watch',['default','browser-sync'], () => {
gulp.watch('CNAME',['copy']);
gulp.watch('**/*.pug', ['templates']);
gulp.watch(SRC+'/scss/**/*.scss', ['sass']);
gulp.watch(SRC+'/js/**/*.js', ['scripts']);
gulp.watch(SRC+'/img/**/*', ['images']);
});
gulp.task('default', ['copy','templates','sass','scripts','images']);
|
JavaScript
| 0.999999 |
@@ -2132,17 +2132,102 @@
%5B'CNAME'
-,
+%5D)%0A .pipe(gulp.dest(DIST));%0A%7D);%0A%0Agulp.task('well-known',() =%3E %7B%0A return gulp.src(%5B
'.well-k
@@ -2255,32 +2255,49 @@
e(gulp.dest(DIST
+ + '/.well-known'
));%0A%7D);%0A%0Agulp.ta
@@ -2872,16 +2872,66 @@
ges'%5D);%0A
+ gulp.watch('.well-known/**/*', %5B'well-known'%5D);%0A
%7D);%0A%0Agul
@@ -2985,20 +2985,33 @@
cripts','images'
+,'well-known'
%5D);%0A
|
a2a29110bc3f93ce1752192e74ffa7d46b36c967
|
Fix build-prod gulp task.
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var babel = require('gulp-babel');
var eslint = require('gulp-eslint');
var flow = require('gulp-flowtype');
var notify = require('gulp-notify');
var changed = require('gulp-changed');
var clean = require('gulp-clean');
gulp.task('clean', function() {
return gulp.src('lib', { read: false })
.pipe(clean({ force: true }));
});
gulp.task('hint', function() {
return gulp.src(['src/**/*.js'], { write: false })
.pipe(eslint({
configFile: '.eslintrc',
useEslintrc: true
}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.on('error', notify.onError('<%= error.message %>'));
});
gulp.task('flow', ['hint'], function() {
return gulp.src(['src/**/*.js'], { write: false })
.pipe(flow({
all: false,
weak: false,
killFlow: false,
beep: false,
abort: false
}))
.on('error', notify.onError('<%= error.message %>'));
});
gulp.task('build-dev', ['hint'], function() {
return gulp.src(['src/**/*.js'])
.pipe(changed('lib'))
.pipe(babel({
sourceMaps: "inline"
}))
.pipe(gulp.dest('lib'));
});
gulp.task('build-prod', ['flow'], function() {
return gulp.src(['src/**/*.js'])
.pipe(babel({
sourceMaps: false,
compact: true
}))
.pipe(gulp.dest('lib'));
});
gulp.task('watch', ['build-dev'], function() {
return gulp.watch(['src/**/*.js'], ['build-dev']);
});
gulp.task('default', ['build-dev']);
|
JavaScript
| 0.000002 |
@@ -1333,20 +1333,20 @@
rod', %5B'
-flow
+hint
'%5D, func
|
445002e52eb10698076f7074ad2e71f2bce3df38
|
Use platform-based icons
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var icongen = require( 'icon-gen' );
var fs = require('fs-extra');
var packager = require('electron-packager')
gulp.task('package', function(done){
packager(
{
dir: "app",
arch: "all",
asar: true,
download: {
cache: "temp/downloads"
},
icon: "build/icons/icon.ico",
out: "dist",
overwrite: true,
platform: ["win32","linux"],
tmpdir: "temp",
version: "1.4.0"
}, function done_callback (err, appPaths) {
console.log("Done electron-packager", appPaths);
done(err);
});
});
gulp.task('generate-icons', function(done) {
fs.ensureDirSync("./build/icons");
icongen( './assets/logo.svg', './temp', { report: true } )
.then( (results) => {
results.forEach( (item) => {
if (item.endsWith("app.ico")) move(item, "./build/icon.ico")
else if (item.endsWith("app.icns")) move(item, "./build/icon.icns")
else if (item.endsWith("favicon.ico")) move(item, "./build/favicon.ico")
else if (item.endsWith(".png")) move(item, "./build/icons/"+item.replace(/^.*favicon-(\d+).png$/, "$1x$1.png"))
else console.log("Not sure what to do with {item}");
});
done();
})
.catch(done);
function move(oldname, newname)
{
console.log("Moving", oldname, "to", newname);
return fs.renameSync(oldname, newname);
}
});
gulp.task('default', ['package']);
|
JavaScript
| 0.000001 |
@@ -385,14 +385,60 @@
icon
-.ico%22,
+%22, // extension will autocomplete based on platform
%0A
|
c225c4af6492c69c6657178c8a188f48a3018d17
|
fix git task name typo
|
gulpfile.js
|
gulpfile.js
|
/*global require, Buffer*/
'use strict'
var pkg = require('./package.json')
, spawn = require('child_process').spawn
, gulp = require('gulp')
, gutil = require('gulp-util')
, plumber = require('gulp-plumber')
, jshint = require('gulp-jshint')
, stylish = require('jshint-stylish')
, uglify = require('gulp-uglify')
, imagemin = require('gulp-imagemin')
, pngquant = require('imagemin-pngquant')
, sourcemaps = require('gulp-sourcemaps')
, zip = require('gulp-zip')
, del = require('del')
, through = require('through2')
var ENC = 'ascii' // ascii is faster, I don't need utf8
, SRC = 'src'
, DEST = 'dist_'+pkg.version
// plumb everything for cleaner gulpfile & fewer gulp crashes
var gulp_src = gulp.src
gulp.srcPlumber = function plumbGulpSrc(){
return gulp_src.apply(gulp, arguments)
.pipe(plumber(function errHandle(e){
gutil.beep(); gutil.log(e)
}))
}
function replace (s, r) {
// stream vinyl contents through String.prototype.replace()
return through.obj(function (file, enc, cb){
var newfile
if (file !== null) {
newfile = file
for (var key in file) // dupe file, except for contents
if (key !== 'contents') newfile[key] = file[key]
// replace on contents then push
var contents = file.contents.toString(ENC).replace(s, r)
newfile.contents = new Buffer(contents, ENC)
this.push(newfile)
}
else this.push(null)
cb(null)
})
}
function manifest (){
// copy version from package.json to manifest.json
// this allows versioning w/ npm command
return gulp.src(SRC + '/manifest.json')
.pipe(replace('{version}', pkg.version))
.pipe(gulp.dest(DEST))
}
function img (){
// optimize images
// TODO: reduce dependencies by writing simple vinyl compatible
// wrapper for image binaries (also, maybe autogenerate from svg)
return gulp.src(SRC + '/img/**/*', {base: SRC})
.pipe(imagemin({
use: [pngquant()] // optipng also used by default
}))
.pipe(gulp.dest(DEST))
}
function scripts (evt){
// even w/ maps, uglify makes debugging harder
var devMode = // just don't uglify during dev
(evt && evt.type && evt.type==='changed')
return gulp.src(SRC + '/**/*.js')
// abort on failure w/ pretty jshint report
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'))
// uglify w/ maps
.pipe(sourcemaps.init())
.pipe(devMode ? through.obj() : uglify())
.pipe(sourcemaps.write('/maps'))
.pipe(gulp.dest(DEST))
}
function release (){
var us = '"use strict";'
, hp = 'chrome.runtime.onInstalled.addListener('
+'function(){chrome.tabs.create({url:\''+pkg.homepage
+'\'})});'
// inject code to open Clerc homepage on install
return gulp.src(DEST+'/background.js')
.pipe(replace(us, us+hp))
.pipe(gulp.dest(DEST))
// add private key for uploading to webstore
.on('end', function (){
return gulp.src('key.pem')
.pipe(gulp.dest(DEST))
// save zip file
.on('end', function (){
return gulp.src(DEST+'**/**', {base: DEST})
.pipe(zip(DEST+'.zip'))
.pipe(gulp.dest('zip'))
// remove duped private key
.on('end', function (){
del([DEST+'/*.pem'])
})
})
})
}
function git(){
// add any untracked distro files to git, log git status
var gitstatus = function(){return spawn('git',['status'])}
var status = gitstatus()
status.stdout.on('data', function(data){
var untracked = data.toString(ENC).split('Untracked')[1]
if (untracked && untracked.indexOf(DEST)){
var add = spawn('git',['add', DEST +'/*'])
add.on('data', function(data){
var status = gitstatus()
status.on('data', function(data){
gutil.log(data.toString(ENC))
})
})
}
else gutil.log(data.toString(ENC))
})
}
function dev (){
// oh how I wish I could use Clerc on itself here :)
var watcher = gulp.watch(SRC+'/**/*.js')
watcher.on('change', scripts)
}
gulp.task('manifest', manifest)
gulp.task('img', img)
gulp.task('scripts', scripts)
gulp.task('gitAdd', git)
// TODO: MAKE TESTS!!!!
// TODO: alter task structure to allow release-only
// injections before uglify
gulp.task('build', ['manifest', 'img', 'scripts'], git)
gulp.task('release', ['build'], release)
gulp.task('watch', dev)
|
JavaScript
| 0.999994 |
@@ -4113,11 +4113,8 @@
'git
-Add
', g
|
9b2beb014c13c382a7efda51d2c88eae1d77c70c
|
Include data dir in deployment files
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp');
var path = require('path');
var webserver = require('gulp-webserver');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var rimraf = require('rimraf');
var runSequence = require('run-sequence');
var ghPages = require('gulp-gh-pages');
var bootlint = require('gulp-bootlint');
var config = {
src: {
all: './',
siteFiles: ['index.html', 'src/**/*', 'bower_components/**/*'],
build: 'dist',
deploy: 'dist/**/*',
js: 'src/js/**/*.js'
}
};
/*
* jshint to check for syntax errors
*/
gulp.task('lint', function () {
return gulp.src(config.src.js)
.pipe(jshint({lookup: true}))
.pipe(jshint.reporter('default'));
});
gulp.task('bootlint', function() {
return gulp.src('./index.html')
.pipe(bootlint());
});
/*
* Clean out the build directory so we don't have any excess junk
*/
gulp.task('clean', function (cb) {
rimraf(config.src.build, cb);
});
/*
* Copy static content into a single point for deployment, without the extra cruft.
*/
gulp.task('site', function () {
return gulp.src(config.src.siteFiles, { 'base': '.' }).pipe(gulp.dest(config.src.build));
});
/*
* Runs all the required tasks to create distributable site package in output folder.
*/
gulp.task('build', function (cb) {
return runSequence(
'site',
cb);
});
//helper for the web server task
function serve(reload) {
return webserver({
path: '/usda-challenge',
livereload: reload,
defaultFile: 'index.html',
open: false
});
}
/*
* Live-reload server to make the app available (localhost:8000) and auto-refresh when files change.
*/
gulp.task('serve', function() {
gulp.src(config.src.all)
.pipe(serve(true));
});
/*
* Web server to host the app, but from output folder, replicating live deploy with built resources.
*/
gulp.task('serve-dist', function() {
gulp.src(config.src.build)
.pipe(serve(false));
});
/*
* Push the built site content to public gh-pages.
*/
gulp.task('ghpages', function () {
return gulp.src(config.src.deploy)
.pipe(ghPages());
});
/**
* Full deploy cycle.
*/
gulp.task('deploy', function (cb) {
runSequence(
'clean',
'build',
'ghpages',
cb);
});
gulp.task('test', ['lint', 'bootlint']);
gulp.task('default', ['test', 'serve']);
|
JavaScript
| 0 |
@@ -443,16 +443,29 @@
ts/**/*'
+, 'data/**/*'
%5D,%0A b
|
641c3a1fcac8940e1e8ea3132e62a305426e6eb8
|
Fix phpjs paths
|
gulpfile.js
|
gulpfile.js
|
var elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Less
| file for our application, as well as publishing vendor resources.
|
*/
var minSuffix='';
var bowerPath='../bower_components/';
if (elixir.config.production) {
minSuffix='.min';
}
elixir(function(mix) {
/**
* Combining scripts and their dependencies
*/
mix.scripts(
[
bowerPath + 'jquery-validation/dist/jquery.validate.js',
bowerPath + 'phpjs/functions/strings/strlen.js',
bowerPath + 'phpjs/functions/array/array_diff.js',
bowerPath + 'phpjs/functions/datetime/strtotime.js',
bowerPath + 'phpjs/functions/var/is_numeric.js',
bowerPath + 'php-date-formatter/js/php-date-formatter.js',
'assets/js/jsvalidation.js',
'assets/js/helpers.js',
'assets/js/timezones.js',
'assets/js/validations.js'
],
'public/js/jsvalidation' + minSuffix + '.js',
'resources'
);
mix.copy('public/js/jsvalidation'+minSuffix+'.js','../../../public/vendor/jsvalidation/js/jsvalidation'+minSuffix+'.js');
});
|
JavaScript
| 0.000784 |
@@ -809,25 +809,23 @@
'phpjs/
-functions
+src/php
/strings
@@ -876,25 +876,23 @@
'phpjs/
-functions
+src/php
/array/a
@@ -945,25 +945,23 @@
'phpjs/
-functions
+src/php
/datetim
@@ -1020,17 +1020,15 @@
pjs/
-functions
+src/php
/var
|
b5a43bfd82bbf4e326cd14936e6dd81a120f0fba
|
Fix gulp file to correctly package plugin
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var _ = require('lodash');
var path = require('path');
var mkdirp = require('mkdirp');
var Rsync = require('rsync');
var Promise = require('bluebird');
var eslint = require('gulp-eslint');
var rimraf = require('rimraf');
var zip = require('gulp-zip');
var fs = require('fs');
var spawn = require('child_process').spawn;
var minimist = require('minimist');
var pkg = require('./package.json');
var packageName = pkg.name;
// in their own sub-directory to not interfere with Gradle
var buildDir = path.resolve(__dirname, 'build/gulp');
var targetDir = path.resolve(__dirname, 'target/gulp');
var buildTarget = path.resolve(buildDir, packageName);
var include = [
'*.json',
'LICENSE',
'README.md',
'index.js',
'init.js',
'server',
'public'
];
var knownOptions = {
string: 'kibanahomepath',
default: { kibanahomepath: '../kibi-internal' }
};
var options = minimist(process.argv.slice(2), knownOptions);
var kibanaPluginDir = path.resolve(__dirname, options.kibanahomepath + '/plugins/' + packageName);
function syncPluginTo(dest, done) {
mkdirp(dest, function (err) {
if (err) return done(err);
Promise.all(include.map(function (name) {
var source = path.resolve(__dirname, name);
return new Promise(function (resolve, reject) {
var rsync = new Rsync();
rsync
.source(source)
.destination(dest)
.flags('uav')
.recursive(true)
.set('delete')
.output(function (data) {
process.stdout.write(data.toString('utf8'));
});
rsync.execute(function (err) {
if (err) {
console.log(err);
return reject(err);
}
resolve();
});
});
}))
.then(function () {
return new Promise(function (resolve, reject) {
mkdirp(path.join(buildTarget, 'node_modules'), function (err) {
if (err) return reject(err);
resolve();
});
});
})
.then(function () {
spawn('npm', ['install', '--production'], {
cwd: dest,
stdio: 'inherit'
})
.on('close', done);
})
.catch(done);
});
}
gulp.task('sync', function (done) {
syncPluginTo(kibanaPluginDir, done);
});
gulp.task('lint', function (done) {
return gulp.src([
'index.js',
'init.js',
'public/**/*.js',
'server/**/*.js',
'!**/webpackShims/**'
]).pipe(eslint())
.pipe(eslint.formatEach())
.pipe(eslint.failOnError());
});
gulp.task('clean', function (done) {
Promise.each([buildDir, targetDir], function (dir) {
return new Promise(function (resolve, reject) {
rimraf(dir, function (err) {
if (err) return reject(err);
resolve();
});
});
}).nodeify(done);
});
gulp.task('build', ['clean'], function (done) {
syncPluginTo(buildTarget, done);
});
gulp.task('package', ['build'], function (done) {
return gulp.src([
path.join(buildDir, '**', '*')
])
.pipe(zip(packageName + '.zip'))
.pipe(gulp.dest(targetDir));
});
gulp.task('dev', ['sync'], function (done) {
gulp.watch([
'index.js',
'init.js',
'*.json',
'public/**/*',
'server/**/*'
], ['sync', 'lint']);
});
gulp.task('test', ['sync'], function(done) {
spawn('grunt', ['test:server', '--grep=Sentinl'], {
cwd: options.kibanahomepath,
stdio: 'inherit'
}).on('close', done);
});
gulp.task('testdev', ['sync'], function(done) {
spawn('grunt', ['test:dev', '--browser=Chrome'], {
cwd: options.kibanahomepath,
stdio: 'inherit'
}).on('close', done);
});
gulp.task('coverage', ['sync'], function(done) {
spawn('grunt', ['test:coverage', '--grep=Sentinl'], {
cwd: options.kibanahomepath,
stdio: 'inherit'
}).on('close', done);
});
|
JavaScript
| 0.000001 |
@@ -653,16 +653,26 @@
uildDir,
+ 'kibana',
package
|
1e53087dcb03ecc96c19d7d8d29258242d098330
|
add commit fallback
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var path = require('path');
var replace = require('gulp-replace');
var child_process = require('child_process');
var fs = require('fs');
var shell = require('gulp-shell');
var jshint = require('gulp-jshint');
var jshStylish = require('jshint-stylish');
var exec = require('child_process').exec;
var runSequence = require('run-sequence');
var prompt = require('gulp-prompt');
var browserify = require('browserify');
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var gutil = require('gulp-util');
var notifier = require('node-notifier');
var derequire = require('gulp-derequire');
var version;
var browserifyOpts = {
entries: './src/index.js',
debug: true
};
var logError = function( err ){
notifier.notify({ title: 'cose-bilkent', message: 'Error: ' + err.message });
gutil.log( gutil.colors.red('Error in watch:'), gutil.colors.red(err) );
};
gulp.task('build', function(){
return browserify( browserifyOpts )
.bundle()
.on( 'error', logError )
.pipe( source('cytoscape-cose-bilkent.js') )
.pipe( buffer() )
.pipe( derequire() )
.pipe( gulp.dest('.') )
});
gulp.task('default', ['build'], function( next ){
next();
});
gulp.task('publish', [], function( next ){
runSequence('confver', 'lint', 'build', 'pkgver', 'push', 'tag', 'npm', 'spm', 'meteor', next);
});
gulp.task('confver', ['version'], function(){
return gulp.src('.')
.pipe( prompt.confirm({ message: 'Are you sure version `' + version + '` is OK to publish?' }) )
;
});
gulp.task('version', function( next ){
var now = new Date();
version = process.env['VERSION'];
if( version ){
done();
} else {
exec('git rev-parse HEAD', function( error, stdout, stderr ){
var sha = stdout.substring(0, 10); // shorten so not huge filename
version = [ 'snapshot', sha, +now ].join('-');
done();
});
}
function done(){
console.log('Using version number `%s` for building', version);
next();
}
});
gulp.task('pkgver', ['version'], function(){
return gulp.src([
'package.json',
'bower.json'
])
.pipe( replace(/\"version\"\:\s*\".*?\"/, '"version": "' + version + '"') )
.pipe( gulp.dest('./') )
;
});
gulp.task('push', shell.task([
'git add -A',
'git commit -m "pushing changes for v$VERSION release"',
'git push'
]));
gulp.task('tag', shell.task([
'git tag -a $VERSION -m "tagging v$VERSION"',
'git push origin $VERSION'
]));
gulp.task('npm', shell.task([
'npm publish .'
]));
gulp.task('spm', shell.task([
'spm publish'
]));
gulp.task('meteor', shell.task([
'meteor publish'
]));
// http://www.jshint.com/docs/options/
gulp.task('lint', function(){
return gulp.src( './src/**' )
.pipe( jshint({
funcscope: true,
laxbreak: true,
loopfunc: true,
strict: true,
unused: 'vars',
eqnull: true,
sub: true,
shadow: true,
laxcomma: true
}) )
.pipe( jshint.reporter(jshStylish) )
// TODO clean up via linting
//.pipe( jshint.reporter('fail') )
;
});
|
JavaScript
| 0.000001 |
@@ -2341,25 +2341,75 @@
release%22
-',%0A 'git
+ %7C%7C echo Nothing to commit',%0A 'git push %7C%7C echo Nothing to
push'%0A%5D
|
0f6cc2d2bf974ab118dc4a33714e4510f0497f6c
|
Disable macZip on nw-builder
|
gulpfile.js
|
gulpfile.js
|
var fs = require('fs');
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var NwBuilder = require('nw-builder');
gulp.task('sync', function() {
var package = JSON.parse(fs.readFileSync('package.json', 'utf8'));
var srcPackage = JSON.parse(fs.readFileSync('src/package.json', 'utf8'));
srcPackage.name = package.name;
srcPackage.version = package.version;
srcPackage.description = package.description;
srcPackage.repository = package.repository;
srcPackage.homepage = package.homepage;
try {
fs.writeFileSync('src/package.json', JSON.stringify(srcPackage, null, " "), 'utf8');
} catch(e) {
console.error("Failed to sync package.json");
}
});
gulp.task('clean:build', function(cb) {
del(['build'], cb);
});
var nw = function(cb, platforms) {
var nw = new NwBuilder({
files: 'src/**',
version: '0.12.1',
platforms: platforms,
build: 'build',
cacheDir: 'cache',
macCredits: 'Credits.html',
macIcns: 'src/images/jikkyo.icns',
macZip: true,
winIco: 'src/images/jikkyo.ico',
winZip: false
});
nw.on('log', function(msg) {
gutil.log('node-webkit-builder', msg);
});
nw.build(cb);
};
gulp.task('nw:release', ['clean', 'sync'], function(cb) {
nw(cb, ['win', 'osx', 'linux']);
});
gulp.task('nw:win32', function(cb) {
nw(cb, ['win32']);
});
gulp.task('nw:win64', function(cb) {
nw(cb, ['win64']);
});
gulp.task('nw:osx32', function(cb) {
nw(cb, ['osx32']);
});
gulp.task('nw:osx64', function(cb) {
nw(cb, ['osx64']);
});
gulp.task('nw:linux', function(cb) {
nw(cb, ['linux']);
});
gulp.task('clean', ['clean:build']);
gulp.task('release', ['clean', 'sync', 'nw:release']);
gulp.task('default', ['build']);
|
JavaScript
| 0 |
@@ -1032,11 +1032,12 @@
ip:
-tru
+fals
e,%0A
|
7238c6b6ce48e3aa6cbcee0947284c3f93a65801
|
Remove trailing space
|
gulpfile.js
|
gulpfile.js
|
'use strict';
/*global require */
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
less = require('gulp-less'),
minifyCss = require('gulp-minify-css'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify'),
util = require('gulp-util');
gulp.task('less', function() {
return gulp.src(['assets/styles/mashup-theme.less'])
.pipe(less({
compress: false
}))
.on('error', util.log)
.pipe(autoprefixer('ie9'))
.pipe(minifyCss())
.pipe(gulp.dest('dist/css'))
.pipe(notify('Less compiled'));
});
gulp.task('compress', function() {
return gulp.src(['assets/js/transition.js', 'assets/js/modal.js', 'assets/js/bootbox.js'])
.pipe(concat('mashup.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
|
JavaScript
| 0.000456 |
@@ -311,18 +311,16 @@
util');%0A
-
%0Agulp.ta
|
4b21385cdfca76cc819cb57b6ae8316cafeda99f
|
Remove unneeded cb's
|
gulpfile.js
|
gulpfile.js
|
/**
* The gulpfile controls the "meta" level of this project. Namely,
* coordinating, validating, etc. the various sub-projects. This file is most
* appropriate for contributors to the project as a whole, and **not**
* developers looking to use the `skeleton` or `full` implementations of
* the examples.
*/
var fs = require("fs"),
path = require("path"),
gulp = require("gulp"),
jshint = require("gulp-jshint"),
exec = require("gulp-exec"),
// Oh, gulp, you disappoint me.
runSeq = require("run-sequence");
// ----------------------------------------------------------------------------
// Helpers
// ----------------------------------------------------------------------------
// Strip comments from JsHint JSON files (naive).
var _jsonCfg = function (name) {
var raw = fs.readFileSync(name).toString();
return JSON.parse(raw.replace(/\/\/.*\n/g, ""));
};
// Wrapper for gulp-exec to bridge easily to grunt tasks.
var _execTask = function (cmd, args) {
return exec(
"echo \"Running '<%= options.cmd %> <%= options.args %>' in " +
"'<%= options.dirname(file.path) %>'\" && " +
"cd \"<%= options.dirname(file.path) %>\" && " +
"<%= options.cmd %> <%= options.args %>", {
dirname: path.dirname,
args: args,
cmd: cmd
});
};
var _gruntTask = function (name) {
return _execTask("./node_modules/.bin/grunt", name);
};
// ----------------------------------------------------------------------------
// JsHint
// ----------------------------------------------------------------------------
gulp.task("jshint:frontend", function () {
gulp
.src("*/*/Gruntfile.js")
.pipe(_gruntTask("jshint"));
});
gulp.task("jshint:backend", function () {
gulp
.src([
"*.js",
"*/*/Gruntfile.js"
])
.pipe(jshint(_jsonCfg("./_dev/.jshintrc-backend.json")))
.pipe(jshint.reporter("default"))
.pipe(jshint.reporter("fail"));
});
gulp.task("jshint", ["jshint:frontend", "jshint:backend"]);
// ----------------------------------------------------------------------------
// Builders
// ----------------------------------------------------------------------------
// Generally speaking, `full` implementations control `skeleton`
// implementations. These tasks bring the skeletons into sync with the fulls.
gulp.task("sync:amd", function (cb) {
gulp
.src([
"full/amd/{.,}*",
"!full/amd/README.md",
"full/amd/app/*.html",
"full/amd/app/js/*.js",
"full/amd/app/css/**",
"full/amd/test/*/*.html",
"full/amd/test/*/js/*.js",
"!full/amd/bower_components/{.,}**/{.,}*",
"!full/amd/node_modules/{.,}**/{.,}*"
], { base: "full/amd" })
.pipe(gulp.dest("skeleton/amd"))
.on("end", cb);
});
gulp.task("install:amd", function (cb) {
gulp
.src("*/amd/Gruntfile.js")
.pipe(_execTask("npm", "install"))
.on("end", cb);
});
// ----------------------------------------------------------------------------
// Aggregated Tasks
// ----------------------------------------------------------------------------
// No dependencies
gulp.task("check:dev", ["jshint"]);
gulp.task("check", ["check:dev"]);
gulp.task("install", ["install:amd"]);
gulp.task("sync", ["sync:amd"]);
gulp.task("default", function (cb) {
// Need tasks **completely** done to get **new** files to run tasks on.
// Wrap with a `reduceRight` and then execute the outer wrapper.
[
"sync",
"install",
"check"
].reduceRight(function (memo, name) {
return function () { runSeq([name], memo); };
}, cb)();
});
|
JavaScript
| 0.000001 |
@@ -2308,34 +2308,32 @@
amd%22, function (
-cb
) %7B%0A gulp%0A .
@@ -2705,35 +2705,16 @@
n/amd%22))
-%0A .on(%22end%22, cb)
;%0A%7D);%0A%0Ag
@@ -2743,26 +2743,24 @@
, function (
-cb
) %7B%0A gulp%0A
@@ -2831,27 +2831,8 @@
l%22))
-%0A .on(%22end%22, cb)
;%0A%7D)
|
6a71085534dc08d31c7ca6a99dd20c7dc19c6e70
|
Fix indentation
|
gulpfile.js
|
gulpfile.js
|
const gulp = require('gulp');
const path = require('path');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const webpackStream = require('webpack-stream');
const babel = require('gulp-babel');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-babel-istanbul');
const coveralls = require('gulp-coveralls');
const eslint = require('gulp-eslint');
function build() {
return gulp.src('./src/formwood.js')
.pipe(webpackStream(webpackConfig, webpack));
}
function sendToCoveralls() {
gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
}
function runMochaTests() {
return gulp.src('test/unit/**/*.js', {read: false})
.pipe(mocha({
reporter: 'dot',
ignoreLeaks: false
}));
}
function test() {
require('babel-core/register');
return gulp.src('src/**/*.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', function() {
runMochaTests()
.pipe(istanbul.writeReports())
});
}
function lint() {
return gulp.src('src/**/*')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
gulp.task('build', build);
gulp.task('test', test);
gulp.task('coveralls', sendToCoveralls);
gulp.task('lint', lint);
gulp.task('default', ['build']);
|
JavaScript
| 0.017244 |
@@ -397,17 +397,16 @@
int');%0A%0A
-%0A
function
@@ -705,17 +705,16 @@
%7B%0A
-
reporter
@@ -722,17 +722,16 @@
'dot',%0A
-
ig
|
ad9db17f97a8317abcef095b30d349e3aecb7d52
|
return gulp test
|
gulpfile.js
|
gulpfile.js
|
// See: http://gulpjs.com/
var gulp = require('gulp');
var mocha = require('gulp-mocha');
gulp.task('test', function () {
return gulp.src([
'./test/parser-test.js',
'./test/format-file-test.js',
'./test/format-file-name-test.js',
'./test/format-file-dir-test.js',
'./test/creator-test.js',
], { read: false })
.pipe(mocha({
reporter: 'nyan',
}));
});
gulp.task('watch', function () {
gulp.watch([
'./lib/**/*.js',
'./test/**/*.js',
'./test/**/*.yml',
], ['test']);
});
gulp.task('default', ['test', 'watch']);
|
JavaScript
| 0.000405 |
@@ -141,229 +141,24 @@
src(
-%5B%0A './test/parser-test.js',%0A './test/format-file-test.js',%0A './test/format-file-name-test.js',%0A './test/format-file-dir-test.js',%0A './test/creator-test.js',%0A %5D
+'./test/**/*.js'
, %7B
|
f440dc7ff86d92134e6db2987f9aa8931466a7eb
|
Create non-minified app.js for site-js gulp task.
|
gulpfile.js
|
gulpfile.js
|
var SITE_DIR = 'famous-angular-docs/';
var EXAMPLES_DIR = 'famous-angular-examples/';
var EXPRESS_PORT = 4000;
var EXPRESS_DOCS_ROOT = __dirname + '/' + SITE_DIR + '_site';
var LIVERELOAD_PORT = 35729;
// Load plugins
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
server = livereload(),
gutil = require('gulp-util'),
pkg = require('./package.json'),
exec = require('gulp-exec');
// Clean
gulp.task('clean', function() {
return gulp.src(['dist/'], {read: false})
.pipe(clean());
});
// Build for dist
gulp.task('build', ['clean'], function(event) {
var header = require('gulp-header');
var banner = ['/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
// Build the CSS
gulp.src([
'src/styles/famous-angular.css'
])
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist/'))
.pipe(minifycss())
.pipe(header(banner, { pkg : pkg } ))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
// Build the JS
return gulp.src([
'src/scripts/services/**/*.js',
'src/scripts/directives/**/*.js'
])
.pipe(concat('famous-angular.js'))
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist/'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist/'))
.pipe(notify({ message: 'Build task complete' }));
});
gulp.task('docs', ['build'], function(done) {
var dgeni = require('dgeni'),
semver = require('semver'),
argv = require('minimist')(process.argv.slice(2)),
docVersion = argv['doc-version'];
if (docVersion != 'unstable' && !semver.valid(docVersion)) {
console.log('Usage: gulp docs --doc-version=(unstable|versionName)');
if(pkg.version) {
console.log('Current package.json version is: '+pkg.version);
}
console.log('No version selected, using unstable');
docVersion = 'unstable';
}
process.env.DOC_VERSION = docVersion;
gutil.log('Generating documentation for ', gutil.colors.cyan(docVersion));
var generateDocs = dgeni.generator('docs-generation/docs.config.js');
return generateDocs().then(function() {
gutil.log('Docs for', gutil.colors.cyan(docVersion), 'generated!');
});
});
/***********************************************************************
*
* Tasks for the famous-angular-docs submodule
*
***********************************************************************/
// Main watch task for development
gulp.task('dev-site', ['build-jekyll'], function() {
var server = livereload();
// Watch source files inside site submodule
gulp.watch([
// Because .styl compiles into .css, do not watch .css, else you will
// an infinite loop
SITE_DIR + '**/*.styl',
SITE_DIR + '**/*.html',
SITE_DIR + '**/*.md',
// Only watch the js from app/
SITE_DIR + 'app/*.js',
// Do NOT watch the compile _site directory, else the watch will create
// an infinite loop
'!' + SITE_DIR + '_site/**',
'!' + SITE_DIR + 'js/**'
],
['build-jekyll']
).on('change',
function(file){
server.changed(file.path);
}
);
// Start the express server
gulp.start('site');
});
// jekyll build the docs site
gulp.task('build-jekyll', ['site-styl', 'site-js'], function() {
var jekyllCommand = 'jekyll build --source ' + SITE_DIR + ' --destination ' + SITE_DIR + '_site/';
// gulp-exec bugfix:
// Need to call gulp.src('') exactly, before using .pipe(exec())
return gulp.src('')
.pipe(exec(jekyllCommand))
.pipe(livereload(server));
});
// First generate the docs, and then run jekyll build to create a new _site
// with the fresh docs
gulp.task('build-site', ['docs'], function(done) {
return gulp.start('build-jekyll');
});
// Compile .styl for the site submodule
gulp.task('site-styl', function() {
var stylus = require('gulp-stylus');
return gulp.src(SITE_DIR + "styl/*.styl")
.pipe(stylus())
.pipe(minifycss())
.pipe(concat('main.css'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(SITE_DIR + "css/"));
});
// Concat all app/ js files and minify them
gulp.task('site-js', function() {
return gulp.src([
SITE_DIR + "app/*.js",
])
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(SITE_DIR + "js/"));
});
gulp.task('site', function(done) {
var express = require('express'),
app = express();
app.use(require('connect-livereload')());
app.use(express.static(EXPRESS_DOCS_ROOT));
app.listen(EXPRESS_PORT);
gutil.log('Server running at Docs for', gutil.colors.cyan('http://localhost:'+EXPRESS_PORT+'/'));
});
/***********************************************************************
* Watch task for developing with the famous-angular-examples submodule
***********************************************************************/
gulp.task('build-to-examples', ['clean'], function(event) {
return gulp.src([
'src/scripts/services/**/*.js',
'src/scripts/directives/**/*.js'
])
.pipe(concat('famous-angular.js'))
.pipe(gulp.dest(EXAMPLES_DIR + 'app/bower_components/famous-angular/'))
.pipe(notify({ message: 'Build task complete' }));
})
// Watch
gulp.task('watch-examples', function(event) {
var server = livereload();
// Watch .js files
gulp.watch([
'src/scripts/*/**/*.js',
EXAMPLES_DIR + 'app/*'
],
['build-to-examples']
).on('change',
function(file){
server.changed(file.path);
}
);
});
// Default task
gulp.task('dev', function() {
var express = require('express');
var app = express();
app.use(require('connect-livereload')());
app.use(express.static(EXAMPLES_DIR + 'app/'));
app.listen(EXPRESS_PORT);
gulp.start('watch-examples');
});
|
JavaScript
| 0 |
@@ -4701,24 +4701,63 @@
('app.js'))%0A
+ .pipe(gulp.dest(SITE_DIR + %22js/%22))%0A
.pipe(ug
|
1ae9c3f0c6899c3b0c422386df6b8a43f4b9e990
|
use /img instead of /images
|
gulpfile.js
|
gulpfile.js
|
// require all the plugins used --------------------------------------------------------------------
var gulp = require('gulp'),
jade = require('gulp-jade'),
compass = require('gulp-compass'),
plumber = require('gulp-plumber'),
livereload = require('gulp-livereload'),
imagemin = require('gulp-imagemin'),
svgmin = require('gulp-imagemin'),
modernizr = require('gulp-modernizr'),
uglify = require('gulp-uglify'),
include = require('gulp-include'),
coffee = require('gulp-coffee'),
// open a file or url
open = require('open'),
// http server
http = require('http'),
connect = require('connect'),
// through = stream handling
through = require('through'),
// gulp_args = argument parser
gulp_args = require('minimist')(process.argv.slice(2)),
development = gulp_args.dev,
dev = function (stream) {
return development ? stream : through();
},
CONNECT_PORT = 8000,
paths;
// saving paths ------------------------------------------------------------------------------------
paths = {
pages: './*.jade',
styles: 'app/stylesheets/',
stylesheet: 'app/stylesheets/style.sass',
stylesheets: 'app/stylesheets/**/*.{scss,sass}',
javascript: 'app/javascripts/scripts.coffee',
javascripts: 'app/javascripts/**/*.{coffee,js}',
images: 'app/images/**/*.{png,jpg,gif,jpeg}',
svg: 'app/images/**/*.svg'
};
// define tasks ------------------------------------------------------------------------------------
gulp.task('pages', function() {
var stream = gulp
.src(paths.pages)
.pipe(plumber())
.pipe(jade(dev({ pretty: true })))
.pipe(gulp.dest('./'));
if(development) {
stream = stream.pipe(livereload());
}
return stream;
});
gulp.task('styles', function() {
var stream = gulp
.src(paths.stylesheet)
.pipe(plumber())
.pipe(compass({
sass: paths.styles,
css: './',
style: development ? 'expanded' : 'compressed'
}))
.pipe(gulp.dest('./'));
if(development) {
stream = stream.pipe(livereload());
}
return stream;
});
gulp.task('scripts', function() {
var stream = gulp
.src(paths.javascript)
.pipe(plumber())
.pipe(include())
.pipe(coffee())
.pipe(uglify(dev({ compress: false })))
.pipe(gulp.dest('./js'));
if(development) {
stream = stream.pipe(livereload());
}
return stream;
});
gulp.task('modernizr', function() {
var stream = gulp
.src('./style.css')
.pipe(modernizr('modernizr-cust.js'))
.pipe(uglify())
.pipe(gulp.dest("./"));
return stream;
});
gulp.task('images', function() {
var stream = gulp
.src(paths.images)
.pipe(plumber())
.pipe(imagemin())
.pipe(gulp.dest('./images'));
if(development) {
stream = stream.pipe(livereload());
}
return stream;
});
gulp.task('svg', function() {
var stream = gulp
.src(paths.svg)
.pipe(plumber())
.pipe(svgmin())
.pipe(gulp.dest('./images'));
if(development) {
stream = stream.pipe(livereload());
}
return stream;
});
gulp.task('watch', function() {
gulp.watch(paths.pages, ['compile']);
gulp.watch(paths.stylesheets, ['styles']);
gulp.watch(paths.javascripts, ['scripts']);
gulp.watch(paths.images, ['images']);
gulp.watch(paths.svg, ['svg']);
});
gulp.task('serve', ['default'], function() {
// Start Connect server
var app = connect().use(connect.static('.'));
http.createServer(app).listen(CONNECT_PORT);
// Open local server in browser
open('http://localhost:' + CONNECT_PORT);
});
// define grouped tasks ----------------------------------------------------------------------------
gulp.task('default', ['pages', 'styles', 'scripts', 'images', 'svg', 'serve', 'watch']);
gulp.task('build', ['pages', 'styles', 'scripts', 'images', 'svg', 'modernizr']);
|
JavaScript
| 0.000002 |
@@ -2800,36 +2800,33 @@
(gulp.dest('./im
-ages
+g
'));%0A%0A if(devel
@@ -3038,20 +3038,17 @@
st('./im
-ages
+g
'));%0A%0A
|
75c31025db6ba5cd3d2bf0f335350ea042dceeb1
|
fix wrong dev. website url
|
gulpfile.js
|
gulpfile.js
|
'use strict';
const gulp = require('gulp');
const htmlmin = require('gulp-htmlmin');
const replace = require('gulp-replace-task');
const spawn = require('child_process').spawn;
const fileinclude = require('gulp-file-include');
const liveServer = require('gulp-live-server');
const runSequence = require('run-sequence');
const build = (VQ_TENANT_API_URL, env) => {
gulp.src([ 'src/**/index.html' ])
.pipe(replace({
patterns: [
{
match: 'VQ_TENANT_API_URL',
replacement: VQ_TENANT_API_URL
},
{
match: 'VQ_WEB_ENV',
replacement: env
},
{
match: 'VQ_WEB_URL',
replacement: env === 'production' ? 'https://vqmarketplace.com' : 'http://localhost:3000'
}
]
}))
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('public'));
gulp.src([ 'src/**/*.js' ])
.pipe(replace({
patterns: [
{
match: 'VQ_TENANT_API_URL',
replacement: VQ_TENANT_API_URL
},
{
match: 'VQ_WEB_ENV',
replacement: env
},
{
match: 'VQ_WEB_URL',
replacement: env === 'production' ? 'https://vqmarketplace.com' : 'http://localhost:3000'
}
]
}))
.pipe(gulp.dest('public'));
gulp.src([ 'src/**/*.css' ])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('public'))
gulp.src([ 'assets/**/*' ])
.pipe(gulp.dest('public'))
};
gulp.task('run:prod', function(cb) {
runSequence(
'build:prod',
'runServer',
cb
);
});
gulp.task('run:dev', function(cb) {
runSequence(
'build:dev',
'watch:dev',
'runServer',
cb
);
});
gulp.task('run:local', function(cb) {
runSequence(
'build:local',
'watch:local',
'runServer',
cb
);
});
gulp.task('build:prod', () => build('https://vqmarketplace.vqmarketplace.com/api', 'production'));
gulp.task('build:dev', () => build('https://vqmarketplace.vqmarketplace.com/api', 'development'));
gulp.task('build:local', () => build('http://localhost:8081/api', 'local'));
gulp.task('watch:prod', () => gulp.watch('./src/**/**', [ 'build:prod' ]));
gulp.task('watch:dev', () => gulp.watch('./src/**/**', [ 'build:dev' ]));
gulp.task('watch:local', () => gulp.watch('./src/**/**', [ 'build:local' ]));
gulp.task('runServer', function() {
var server = liveServer.static('./public');
server.start();
});
gulp.task('deploy', function() {
const args = [ './**', '--region', 'eu-central-1', '--bucket', 'vqmarketplace.com', '--gzip' ];
const npm = spawn("s3-deploy", args, { cwd: './public' });
npm.stdout.on('data', data => {
console.log(`stdout: ${data}`);
});
npm.stderr.on('data', data => {
console.log(`stderr: ${data}`);
});
npm.on('close', code => {
console.log(code !== 0 ? 'error in build' : 0);
});
});
|
JavaScript
| 0.999994 |
@@ -748,32 +748,57 @@
=== 'production'
+ %7C%7C env === 'development'
? 'https://vqma
@@ -1419,16 +1419,41 @@
duction'
+ %7C%7C env === 'development'
? 'http
|
54fa187af2e0d7525fba8f092fe647690863ee2b
|
Update npm test
|
gulpfile.js
|
gulpfile.js
|
require('babel-register')
const gulp = require('gulp')
const path = require('path')
const babel = require('gulp-babel')
const clean = require('gulp-clean')
const mocha = require('gulp-mocha')
const concat = require('gulp-concat')
const clc = require('cli-color')
const nodemon = require('gulp-nodemon')
var jsdoc = require('gulp-jsdoc3')
const handleError = function (error) {
console.log(error)
this.emit('error')
}
const main = 'index.js'
const buildDir = 'build'
const libDir = 'lib'
const testDir = 'test'
const distDir = 'dist'
const sources = [path.join(libDir, '**', '*.js')]
const tests = [path.join(testDir, '**', '*.js')]
const buildTests = tests.map(v => path.join(buildDir, v))
const buildFiles = path.join(buildDir, '**', '*.*')
const dists = [path.join(distDir, '**', '*.js')]
gulp.task('default', ['build'])
gulp.task('clean', ['clean:lib', 'clean:test'])
gulp.task('clean:lib', function () {
return gulp.src(path.join(buildDir, libDir), {read: false})
.pipe(clean())
})
gulp.task('clean:test', function () {
return gulp.src(path.join(buildDir, testDir), {read: false})
.pipe(clean())
})
gulp.task('build', ['build:lib', 'build:test'])
gulp.task('build:lib', ['clean:lib'], function () {
return gulp.src(sources)
.pipe(babel())
.pipe(gulp.dest(path.join(buildDir, libDir)))
.pipe(gulp.dest(path.join(distDir)))
})
gulp.task('build:test', ['clean:test'], function () {
return gulp.src(tests)
.pipe(babel())
.pipe(gulp.dest(path.join(buildDir, testDir)))
})
gulp.task('test', ['build'], function () {
gulp.src(buildTests)
.pipe(mocha({
reporter: 'dot'
}))
.on('error', function (e) {
if (typeof e.stack === 'undefined') return
console.log(clc.red(`[ERROR] ${e.stack}`))
this.emit(e)
})
})
gulp.task('watch:test', ['test'], function () {
gulp.watch([].concat(sources, tests), ['test'])
})
gulp.task('watch:build', ['build'], function () {
gulp.watch([].concat(sources, tests), ['build'])
})
gulp.task('server', ['build:lib'], function () {
nodemon({
script: path.join(buildDir, libDir, 'index.js'),
ext: 'js',
ignore: ['gulpfile.js'].concat(buildFiles, tests, dists),
env: {
'NODE_ENV': 'development'
},
tasks: ['build:lib']
})
})
|
JavaScript
| 0.000001 |
@@ -1676,16 +1676,139 @@
%7D))%0A
+%7D)%0Agulp.task('test:force', %5B'build'%5D, function () %7B%0A gulp.src(buildTests)%0A .pipe(mocha(%7B%0A reporter: 'dot'%0A %7D))%0A
.on(
@@ -1984,24 +1984,30 @@
est', %5B'test
+:force
'%5D, function
@@ -2438,12 +2438,13 @@
ib'%5D%0A %7D)%0A%7D)
+%0A
|
22218b09a554562c5292b49754fd84bc5700ce23
|
copy over git repo in order for sem-rel to process
|
gulpfile.js
|
gulpfile.js
|
/*
* Main build file for fabric8-planner.
* ---
* Each main task has parametric handlers to achieve different result.
* Check out the sections for task variants & accepted task arguments.
*/
// Require primitives
var del = require('del')
, path = require('path')
, argv = require('yargs').argv
, proc = require('child_process')
;
// Require gulp & its extension modules
var gulp = require('gulp')
, ngc = require('gulp-ngc')
, less = require('gulp-less')
, util = require('gulp-util')
, changed = require('gulp-changed')
, lesshint = require('gulp-lesshint')
, concat = require('gulp-concat-css')
, srcmaps = require('gulp-sourcemaps')
, replace = require('gulp-string-replace')
;
// Requirements with special treatments
var KarmaServer = require('karma').Server
, LessAutoprefix = require('less-plugin-autoprefix')
, autoprefix = new LessAutoprefix({ browsers: ['last 2 versions'] })
;
// Not sure if var or const
var appSrc = 'src';
var distPath = 'dist';
/*
* Utility functions
*/
// Global namespace to contain the reusable utility routines
let mach = {};
// Serialized typescript compile and post-compile steps
mach.transpileTS = function () {
return (gulp.series(function () {
return ngc('tsconfig.json');
}, function () {
// FIXME: why do we need that?
// Replace templateURL/styleURL with require statements in js.
return gulp.src(['dist/app/**/*.js'])
.pipe(replace(/templateUrl:\s/g, "template: require("))
.pipe(replace(/\.html',/g, ".html'),"))
.pipe(replace(/styleUrls: \[/g, "styles: [require("))
.pipe(replace(/\.less']/g, ".css').toString()]"))
.pipe(gulp.dest(function (file) {
return file.base; // because of Angular 2's encapsulation, it's natural to save the css where the less-file was
}));
}))();
}
// Copy files to the distPath
mach.copyToDist = function (srcArr) {
return gulp.src(srcArr)
.pipe(gulp.dest(function (file) {
// Save directly to dist; @TODO: rethink the path evaluation strategy
return distPath + file.base.slice(__dirname.length + 'src/'.length);
}));
}
// Transpile given LESS source(s) to CSS, storing results to distPath.
mach.transpileLESS = function (src, debug) {
var opts = {
// THIS IS NEEDED FOR REFERENCE
// paths: [ path.join(__dirname, 'less', 'includes') ]
}
return gulp.src(src)
.pipe(less({
plugins: [autoprefix]
}))
.pipe(lesshint({
configPath: './.lesshintrc' // Options
}))
.pipe(lesshint.reporter()) // Leave empty to use the default, "stylish"
.pipe(lesshint.failOnError()) // Use this to fail the task on lint errors
.pipe(srcmaps.init())
.pipe(less(opts))
//.pipe(concat('styles.css'))
.pipe(srcmaps.write())
.pipe(gulp.dest(function (file) {
return distPath + file.base.slice(__dirname.length + 'src/'.length);
}));
}
/*
* Task declarations
*/
// Build
gulp.task('build', function (done) {
// app (default)
mach.transpileTS(); // Transpile *.ts to *.js; _then_ post-process require statements to load templates
mach.transpileLESS(appSrc + '/**/*.less'); // Transpile and minify less, storing results in distPath.
mach.copyToDist(['src/**/*.html']); // Copy template html files to distPath
gulp.src(['LICENSE', 'README.adoc', 'package.json']).pipe(gulp.dest(distPath)); // Copy static assets to distPath
// image
// tarball
// validate
// watch
if (argv.watch) {
gulp.watch([appSrc + '/app/**/*.ts', '!' + appSrc + '/app/**/*.spec.ts']).on('change', function (e) {
util.log(util.colors.cyan(e) + ' has been changed. Compiling TypeScript.');
mach.transpileTS();
});
gulp.watch(appSrc + '/app/**/*.less').on('change', function (e) {
util.log(util.colors.cyan(e) + ' has been changed. Compiling LESS.');
mach.transpileLESS(e);
});
gulp.watch(appSrc + '/app/**/*.html').on('change', function (e) {
util.log(util.colors.cyan(e) + ' has been changed. Compiling HTML.');
mach.copyToDist(e);
});
util.log('Now run');
util.log('');
util.log(util.colors.red(' npm link', path.resolve(distPath)));
util.log('');
util.log('in the npm module you want to link this one to');
}
done();
});
// Clean
gulp.task('clean', function (done) {
// all (default): set flags to validate following conditional cleanups
if (
!argv.cache &&
!argv.config &&
!argv.dist &&
!argv.images &&
!argv.modules &&
!argv.temp) {
// if none of the known sub-task parameters for `clean` was provided
// i.e. only `gulp clean` was called, then set default --all flag ON
argv.all = true;
}
if (argv.all) {
// Exclusively set all subroutine parameters ON for `gulp clean --all`
argv.cache = argv.config = argv.dist = argv.images = argv.modules = argv.temp = true;
}
// cache
if (argv.cache) proc.exec('npm cache clean');
// config
// if (argv.config) { subroutine to clean config - not yet needed }
// dist
if (argv.dist) del([distPath]);
// images
if (argv.images) {
// Get ID of the images having 'fabric8-planner' in its name
proc.exec('sudo docker ps -aq --filter "name=fabric8-planner"', function (e, containerID) {
if (e) {
console.log(e);
return;
}
// @TODO: wrap this in a try-catch block to avoid unexpected behavior
proc.exec('sudo docker stop ' + containerID);
proc.exec('sudo docker rm ' + containerID);
// Container has been killed, safe to remove image(s) with 'fabric8-planner-*' as part of their ref
proc.exec('sudo docker images -aq --filter "reference=fabric8-planner-*"', function (e, imageID) {
if (e) {
console.log(e);
return;
}
// @TODO: wrap this in a try-catch block to avoid unexpected behavior
proc.exec('sudo docker rmi ' + imageID);
});
});
}
// modules
if (argv.modules) del(['node_modules']);
// temp
if (argv.temp) del(['tmp', 'coverage', 'typings', '.sass-cache']);
done();
});
// Release
gulp.task('release', function (done) {
proc.exec('$(npm bin)/semantic-release', function(error, stdout) {
console.log("error: ", error);
console.log(stdout);
});
done();
});
// Test
gulp.task('tests', function (done) {
// unit
if (argv.unit) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, function (code) {
process.exit(code);
}).start();
}
// func
if (argv.func) {
// subroutine to run functional tests
}
// smok
if (argv.smok) {
// subroutine to run smoke tests
}
done();
});
|
JavaScript
| 0 |
@@ -6147,16 +6147,72 @@
done) %7B%0A
+ gulp.src(%5B'.git/**/*'%5D).pipe(gulp.dest('dist/.git'));%0A
proc.e
|
3beea77e47fb846942308cb41ed7831d54053854
|
serve task
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
require('./tasks/build');
require('./tasks/sass');
require('./tasks/watch');
require('./tasks/test');
gulp.task('build', ['browserify', 'sass', 'fonts', 'assets','templates']);
gulp.task('release', ['browserify:release', 'sass', 'fonts', 'assets','templates']);
gulp.task('default', ['sass']);
|
JavaScript
| 0.999999 |
@@ -123,16 +123,43 @@
/test');
+%0Arequire('./tasks/server');
%0A%0Agulp.t
|
27c600518889b7ae77aa1af94c4ffad4c8fdcd83
|
Fix gulpfile to work with gulp 4.0
|
gulpfile.js
|
gulpfile.js
|
var browserify = require('browserify'),
concat = require('gulp-concat'),
eslint = require('gulp-eslint'),
gulp = require('gulp'),
insert = require('gulp-insert'),
karma = require('karma'),
package = require('./package.json'),
path = require('path'),
replace = require('gulp-replace'),
source = require('vinyl-source-stream');
streamify = require('gulp-streamify'),
uglify = require('gulp-uglify'),
yargs = require('yargs');
var srcDir = './src/';
var srcFiles = srcDir + '**.js';
var buildDir = './';
var docsDir = './docs/';
var header = "/*!\n\
* chartjs-chart-financial\n\
* Version: {{ version }}\n\
*\n\
* Copyright 2017 chartjs-chart-financial contributors\n\
* Released under the MIT license\n\
* https://github.com/chartjs/chartjs-chart-financial/blob/master/LICENSE.md\n\
*/\n";
gulp.task('default', ['build', 'watch']);
gulp.task('build', buildTask);
gulp.task('lint', lintTask);
gulp.task('watch', watchTask);
gulp.task('test', ['lint', 'unittest']);
gulp.task('unittest', unittestTask);
var argv = yargs
.option('force-output', {default: false})
.option('silent-errors', {default: false})
.option('verbose', {default: false})
.argv;
function buildTask() {
var nonBundled = browserify('./src/index.js')
.ignore('chart.js')
.bundle()
.pipe(source('Chart.Financial.js'))
.pipe(insert.prepend(header))
.pipe(streamify(replace('{{ version }}', package.version)))
.pipe(gulp.dest(buildDir))
.pipe(gulp.dest(docsDir))
.pipe(streamify(uglify()))
.pipe(streamify(concat('Chart.Financial.min.js')))
.pipe(gulp.dest(buildDir));
return nonBundled;
}
function lintTask() {
var files = [
// 'docs/**/*.js',
'src/**/*.js'
// 'test/**/*.js'
];
// NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict
// compare to what the current codebase can support, and since it's not straightforward
// to fix, let's turn them as warnings and rewrite code later progressively.
var options = {
rules: {
'complexity': [1, 10],
'max-statements': [1, 30]
}
};
return gulp.src(files)
.pipe(eslint(options))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function startTest() {
return [
'./node_modules/moment/min/moment.min.js',
'./test/jasmine.index.js',
'./src/**/*.js',
].concat(
['./test/specs/**/*.js']
);
}
function unittestTask(done) {
new karma.Server({
configFile: path.join(__dirname, 'karma.conf.js'),
singleRun: !argv.watch,
files: startTest(),
args: {
coverage: !!argv.coverage
}
},
// https://github.com/karma-runner/gulp-karma/issues/18
function(error) {
error = error ? new Error('Karma returned with the error code: ' + error) : undefined;
done(error);
}).start();
}
function watchTask() {
return gulp.watch(srcFiles, ['build']);
}
|
JavaScript
| 0.000001 |
@@ -819,50 +819,8 @@
%22;%0A%0A
-gulp.task('default', %5B'build', 'watch'%5D);%0A
gulp
@@ -890,21 +890,27 @@
sk('
-watch', watch
+unittest', unittest
Task
@@ -930,17 +930,30 @@
'test',
-%5B
+gulp.parallel(
'lint',
@@ -962,17 +962,17 @@
nittest'
-%5D
+)
);%0Agulp.
@@ -977,39 +977,79 @@
p.task('
-unittest', unittestTask
+watch', watchTask);%0Agulp.task('default', gulp.parallel('build')
);%0A%0Avar
|
6d78fcd6c9d67bc50a2f060e43d3fec49a847c9c
|
Enable imagemin
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var jsonminify = require('gulp-jsonminify');
var minifycss = require('gulp-minify-css');
var minifyhtml = require('gulp-minify-html');
var nib = require('nib');
var stylus = require('gulp-stylus');
var zip = require('gulp-zip');
var version = '1.0.4';
var paths = {
html: './*.html',
stylus: './css/*.styl',
js: './js/*.js',
json: 'manifest.json',
img: './img/*.png',
vendor: [
'./bower_components/angular/angular-csp.css',
'./bower_components/jquery/dist/jquery.min.js',
'./bower_components/angular/angular.min.js',
'./bower_components/Sortable/Sortable.min.js',
'./bower_components/Sortable/ng-sortable.js'
]
};
var dest = './dist';
gulp.task('html', function () {
return gulp.src(paths.html)
.pipe(minifyhtml())
.pipe(gulp.dest(dest));
});
gulp.task('css', function () {
return gulp.src(paths.stylus)
.pipe(stylus({use: [nib()], errors: true}))
.pipe(minifycss())
.pipe(gulp.dest(dest));
});
gulp.task('js', function () {
return gulp.src(paths.js)
.pipe(gulp.dest(dest));
});
gulp.task('json', function () {
return gulp.src(paths.json)
.pipe(jsonminify())
.pipe(gulp.dest(dest));
})
gulp.task('img', function () {
return gulp.src(paths.img)
// .pipe(imagemin())
.pipe(gulp.dest(dest + '/img'));
});
gulp.task('vendor', function () {
return gulp.src(paths.vendor)
.pipe(gulp.dest(dest + '/vendor'));
});
gulp.task('watch', function () {
gulp.watch(paths.html, ['html']);
gulp.watch(paths.stylus, ['css']);
gulp.watch(paths.js, ['js']);
gulp.watch(paths.json, ['json']);
gulp.watch(paths.img, ['img']);
gulp.watch(paths.vendor, ['vendor']);
})
gulp.task('build', ['watch', 'html', 'css', 'js', 'json', 'img', 'vendor']);
gulp.task('zip', function () {
return gulp.src(dest + '/*')
.pipe(zip('tabio-' + version + '.zip'))
.pipe(gulp.dest(dest));
});
/*
gulp.task('stylus', function () {
gulp.src(paths.stylus)
.pipe(stylus({use: [nib()], errors: true}))
.pipe(gulp.dest('./css'));
});
gulp.task('minify', function() {
gulp.src(paths.css)
.pipe(minify())
.pipe(gulp.dest('./css'));
});
gulp.task('watch', function () {
gulp.watch(paths.stylus, ['stylus']);
gulp.watch(paths.css, ['minify']);
});
gulp.task('default', ['watch', 'stylus', 'minify']);
*/
|
JavaScript
| 0.000003 |
@@ -1295,10 +1295,8 @@
mg)%0A
-//
|
d4a71aef0b8f2d8e2da12b848650d13a998b95f0
|
Copy uncompiled JS to the dist folder
|
gulpfile.js
|
gulpfile.js
|
'use strict'
const packageJson = require('./package.json')
const version = packageJson.version
// Gulp utility
const gulp = require('gulp')
const del = require('del')
const rename = require('gulp-rename')
const runSequence = require('run-sequence')
// Templates
const transpiler = require('./lib/transpilation/transpiler.js')
// Styles
const sass = require('gulp-sass')
const sasslint = require('gulp-sass-lint')
const nano = require('gulp-cssnano')
// Javascript
const standard = require('gulp-standard')
const rollup = require('rollup-stream')
const vinylSource = require('vinyl-source-stream')
const vinylBuffer = require('vinyl-buffer')
const uglify = require('gulp-uglify')
const uglifySaveLicense = require('uglify-save-license')
// Testing
const mocha = require('gulp-mocha')
// Configuration
const paths = require('./config/paths.js')
// Task for cleaning the distribution
gulp.task('clean', () => {
return del([paths.dist + '*'])
})
// Task for transpiling the templates
let transpileRunner = templateLanguage => {
return gulp.src(paths.templates + '*.html')
.pipe(transpiler(templateLanguage, version))
.pipe(rename({extname: '.html.' + templateLanguage}))
.pipe(gulp.dest(paths.distTemplates))
}
gulp.task('build:templates', ['build:templates:nunjucks', 'build:templates:erb', 'build:templates:handlebars', 'build:templates:django'])
gulp.task('build:templates:nunjucks', transpileRunner.bind(null, 'nunjucks'))
gulp.task('build:templates:erb', transpileRunner.bind(null, 'erb'))
gulp.task('build:templates:handlebars', transpileRunner.bind(null, 'handlebars'))
gulp.task('build:templates:django', transpileRunner.bind(null, 'django'))
// Compile Sass to CSS
gulp.task('build:styles', cb => {
runSequence('build:styles:lint', ['build:styles:compile', 'build:styles:copy'], cb)
})
gulp.task('build:styles:lint', () => {
gulp.src(paths.assetsScss + '**/*.scss')
.pipe(sasslint({
config: paths.config + '.sass-lint.yml'
}))
.pipe(sasslint.format())
.pipe(sasslint.failOnError())
})
gulp.task('build:styles:compile', () => {
gulp.src(paths.assetsScss + '**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(paths.distCSS))
.pipe(rename({ suffix: '.min' }))
.pipe(nano())
.pipe(gulp.dest(paths.distCSS))
})
gulp.task('build:styles:copy', () => {
gulp.src(paths.assetsScss + '**/*.scss')
.pipe(gulp.dest(paths.distScss))
})
// Build single Javascript file from modules
let scriptsBuilder = fileName => {
return rollup({
entry: paths.assetsJs + 'template/' + fileName + '.js',
context: 'window'
})
.pipe(vinylSource(fileName + '.js'))
.pipe(gulp.dest(paths.distJs))
.pipe(vinylBuffer())
.pipe(rename({ suffix: '.min' }))
.pipe(uglify({
preserveComments: uglifySaveLicense
}))
.pipe(gulp.dest(paths.distJs))
}
gulp.task('build:scripts', cb => {
runSequence('build:scripts:lint', ['build:scripts:govuk-template', 'build:scripts:govuk-template-ie'], cb)
})
gulp.task('build:scripts:lint', () => {
gulp.src([
'!' + paths.assetsJs + '**/vendor/**/*.js',
paths.assetsJs + '**/*.js'
])
.pipe(standard())
.pipe(standard.reporter('default', {
breakOnError: true,
quiet: true
}))
})
gulp.task('build:scripts:govuk-template', scriptsBuilder.bind(null, 'govuk-template'))
gulp.task('build:scripts:govuk-template-ie', scriptsBuilder.bind(null, 'govuk-template-ie'))
// Task to run the tests
gulp.task('test', () => gulp.src(paths.specs + '*.js', {read: false})
.pipe(mocha())
)
// Build distribution
gulp.task('build', cb => {
runSequence('clean', ['build:templates', 'build:styles', 'build:scripts'], cb)
})
|
JavaScript
| 0 |
@@ -1775,21 +1775,18 @@
tyles:co
-mpile
+py
', 'buil
@@ -1796,18 +1796,21 @@
tyles:co
-py
+mpile
'%5D, cb)%0A
@@ -2913,32 +2913,54 @@
scripts:lint', %5B
+'build:scripts:copy',
'build:scripts:g
@@ -3452,16 +3452,133 @@
te-ie'))
+%0Agulp.task('build:scripts:copy', () =%3E %7B%0A gulp.src(paths.assetsJs + '**/*.js')%0A .pipe(gulp.dest(paths.distJs))%0A%7D)
%0A%0A// Tas
|
3794e6ac3e863c7a4c884fedde46603b8f2215ec
|
remove refs to removed gulp testing modules
|
gulpfile.js
|
gulpfile.js
|
var _ = require('underscore'),
gulp = require('gulp'),
cover = require('gulp-coverage'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha'),
gutil = require('gulp-util'),
watch = require('gulp-watch'),
browserify = require('browserify'),
literalify = require('literalify'),
watchify = require('watchify'),
reactify = require('reactify'),
source = require('vinyl-source-stream'),
chalk = require('chalk'),
del = require('del');
/**
* Build Tasks
*/
// build scripts with browserify and react / jsx transforms
gulp.task('build-scripts', function() {
return browserify({
standalone: 'App'
})
.add('./admin/src/app.js')
.transform(reactify)
.transform(literalify.configure({
tinymce: "window.tinymce"
}))
.bundle()
.on('error', function(e) {
gutil.log('Browserify Error', e);
})
.pipe(source('app.js'))
.pipe(gulp.dest('./public/build/js'));
});
// watch scripts & build with debug features
gulp.task('watch-scripts', function() {
var b = browserify(_.defaults({
standalone: 'App'
}, watchify.args))
.add('./admin/src/app.js')
.transform(reactify)
.transform(literalify.configure({
tinymce: "window.tinymce"
}));
var w = watchify(b)
.on('update', function (scriptIds) {
scriptIds = scriptIds
.filter(function(i) { return i.substr(0,2) !== './' })
.map(function(i) { return chalk.blue(i.replace(__dirname, '')) });
if (scriptIds.length > 1) {
gutil.log(scriptIds.length + ' Scripts updated:\n* ' + scriptIds.join('\n* ') + '\nrebuilding...');
} else {
gutil.log(scriptIds[0] + ' updated, rebuilding...');
}
rebundle();
})
.on('time', function (time) {
gutil.log(chalk.green('Scripts built in ' + (Math.round(time / 10) / 100) + 's'));
});
function rebundle() {
w.bundle()
.on('error', function(e) {
gutil.log('Browserify Error', e);
})
.pipe(source('app.js'))
.pipe(gulp.dest('./public/build/js'));
}
return rebundle();
});
|
JavaScript
| 0 |
@@ -53,109 +53,8 @@
'),%0A
-%09cover = require('gulp-coverage'),%0A%09jshint = require('gulp-jshint'),%0A%09mocha = require('gulp-mocha'),%0A
%09gut
|
07c935bb646052cd2dfc48e72eff9b753390a002
|
fix watch task in gulpfile
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var hbsfy = require('hbsfy');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var appDir = '.'
var dstDir = './build'
gulp.task('build:js', function() {
return browserify(appDir + '/app.js')
.transform(hbsfy)
.bundle()
.pipe(source('main.js'))
.pipe(buffer())
.pipe(plugins.uglify())
.pipe(gulp.dest(dstDir + '/js'));
});
gulp.task('build:html', function() {
return gulp.src(appDir + '/index.html')
.pipe(gulp.dest(dstDir));
});
gulp.task('build', ['build:js', 'build:html']);
gulp.task('watch', ['build'], function() {
gulp.watch(appDir + '/**/*.js', ['build:js'])
gulp.watch(appDir + '/**/*.html', ['build:html'])
});
gulp.task('default', ['watch']);
|
JavaScript
| 0.000603 |
@@ -758,20 +758,19 @@
Dir + '/
-**/*
+app
.js', %5B'
@@ -811,12 +811,13 @@
+ '/
-**/*
+index
.htm
|
ab810eeabe0031ba05227c7967803d4827d74678
|
Remove 'test' task from scss Gulp watcher
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var autoprefix = require('gulp-autoprefixer');
var eslint = require('gulp-eslint');
var qunit = require('gulp-qunit');
var pack = require('./package.json');
var utils = require('./config/utils.js');
gulp.task('compress', ['lint', 'commonjs', 'dev', 'production']);
gulp.task('lint', function() {
return gulp.src(['src/**/*.js', 'test/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('commonjs', function() {
return utils.packageRollup({
dest: 'dist/' + pack.name + '.common.js',
format: 'cjs'
});
});
gulp.task('dev', function() {
return utils.packageRollup({
dest: 'dist/' + pack.name + '.js',
format: 'umd'
});
});
gulp.task('test', function() {
return gulp.src('./test/test-runner.html')
.pipe(qunit())
.on('error', function(err){ // avoid the ugly error message on failing
if (process.env.CI) { // but still fail if we're running in a CI
throw err;
}
this.emit('end');
});
});
gulp.task('production', function() {
return utils.packageRollup({
dest: 'dist/' + pack.name + '.min.js',
format: 'umd',
minify: true
}).then(utils.zip);
});
gulp.task('sass', function() {
gulp.src('src/sweetalert2.scss')
.pipe(sass())
.pipe(autoprefix())
.pipe(gulp.dest('dist'))
.pipe(cleanCSS())
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest('dist'));
gulp.src('docs/example.scss')
.pipe(sass())
.pipe(autoprefix())
.pipe(gulp.dest('docs'));
});
gulp.task('default', ['compress', 'sass']);
gulp.task('watch', function() {
gulp.watch([
'src/**/*.js',
'test/*.js',
], ['compress', 'test']);
gulp.watch([
'src/sweetalert2.scss',
'docs/example.scss'
], ['sass', 'test']);
});
|
JavaScript
| 0.001765 |
@@ -991,16 +991,17 @@
ion(err)
+
%7B // avo
@@ -1812,17 +1812,16 @@
st/*.js'
-,
%0A %5D, %5B'
@@ -1921,24 +1921,16 @@
%5B'sass'
-, 'test'
%5D);%0A%7D);%0A
|
d9ea0950a0206274c656571487f3f5175c9af9f8
|
Fix remaining gulp 3.x syntax
|
gulpfile.js
|
gulpfile.js
|
// grab our gulp packages
var gulp = require("gulp");
var gutil = require("gulp-util");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
gulp.task("concat", function() {
return gulp.src(["bliss.shy.js", "bliss._.js"])
.pipe(concat("bliss.js"))
.pipe(gulp.dest("."));
});
gulp.task("minify", function() {
var u = uglify();
u.on("error", function(error) {
console.error(error);
u.end();
});
return gulp.src(["bliss.shy.js", "bliss.js"])
.pipe(u)
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest("."));
});
gulp.task("watch", function() {
gulp.watch(["*.js", "!bliss.js", "!*.min.js"], ["concat", "minify"]);
});
gulp.task("default", gulp.series("concat", "minify"));
|
JavaScript
| 0.00001 |
@@ -660,17 +660,28 @@
n.js%22%5D,
-%5B
+gulp.series(
%22concat%22
@@ -690,17 +690,17 @@
%22minify%22
-%5D
+)
);%0A%7D);%0A%0A
|
2d6cf215afd05d5a25756419eee8f27746fc1c55
|
Update gulpfile.js
|
gulpfile.js
|
gulpfile.js
|
const gulp = require('gulp')
const cssnano = require('cssnano')
const mqpacker = require('css-mqpacker')
const scss = require('postcss-scss')
const nested = require('postcss-nested')
const cssnext = require('postcss-cssnext')
const atImport = require('postcss-import')
const focus = require('postcss-focus')
const postcss = require('gulp-postcss')
gulp.task('css', () => {
var processors = [
atImport,
cssnext({ browsers: ['last 2 versions'] }),
focus,
nested,
mqpacker,
cssnano({ autoprefixer: false })
]
return gulp.src('src/css/main.css')
.pipe(postcss(processors, { syntax: scss }))
.pipe(gulp.dest('css'))
})
gulp.task('default')
|
JavaScript
| 0.000001 |
@@ -663,14 +663,99 @@
sk('
-default'
+watch', () =%3E gulp.watch('src/css/**/*.css', %5B'css'%5D))%0A%0Agulp.task('default', %5B'css', 'watch'%5D
)%0A
|
84ae1d7cae238d71714768e62a6b513db493adab
|
Add comment
|
gulpfile.js
|
gulpfile.js
|
'use strict'
const { src, dest, watch, series, parallel } = require('gulp')
const gulpUglify = require('gulp-uglify')
const gulpSass = require('gulp-sass')
const del = require('del')
const SRC_DIR = 'src'
const BUILD_DIR = 'build'
const JS_FILES = `${SRC_DIR}/**/*.js`
const SASS_FILES = `${SRC_DIR}/**/*.scss`
const OTHER_FILES = [
`${SRC_DIR}/{images,libs,fonts}/**`,
`${SRC_DIR}/favicon.ico`,
`${SRC_DIR}/index.html`,
]
const clean = async function() {
await del(BUILD_DIR)
}
const uglify = function() {
return src(JS_FILES)
.pipe(gulpUglify())
.pipe(dest(BUILD_DIR))
}
const sass = function() {
return src(SASS_FILES)
.pipe(
gulpSass({ outputStyle: 'compressed' }).on('error', gulpSass.logError),
)
.pipe(dest(BUILD_DIR))
}
const move = function() {
return src(OTHER_FILES).pipe(dest(BUILD_DIR))
}
const build = series(clean, move, parallel([uglify, sass]))
const watchTask = function() {
return watch(`${SRC_DIR}/**`, build)
}
module.exports = {
build,
watch: watchTask,
}
|
JavaScript
| 0 |
@@ -458,16 +458,127 @@
ion() %7B%0A
+ // TODO: replace with %60promisify(fs.rmdir)(..., %7Brecursive: true%7D)%60 after%0A // dropping support for Node %3C12%0A
await
|
ad531d2b6eb477e1c2c84a7fb593a107251e42d1
|
build html and css when loading gulp
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp'),
connect = require('gulp-connect'),
livereload = require('gulp-livereload'),
sass = require('gulp-ruby-sass');
gulp.task('sass', function() {
return sass('src/stylesheets/', {
style: 'compressed',
loadPath: [
'./src/stylesheets',
'./bower_components/bootstrap-sass-official/assets/stylesheets',
'./bower_components/fontawesome/scss'
]})
.pipe(gulp.dest('build/css'))
.pipe(livereload());
});
gulp.task('connect', function() {
connect.server({
port: 3005,
root: 'build',
livereload: true
});
});
gulp.task('js', function () {
gulp.src('./src/javascripts/*.js')
.pipe(gulp.dest('./build/js'))
.pipe(livereload());
});
gulp.task('html', function () {
gulp.src('./src/*.html')
.pipe(gulp.dest('./build'))
.pipe(livereload());
});
gulp.task('watch', function () {
livereload.listen();
gulp.watch(['./src/stylesheets/*.scss'], ['sass']);
gulp.watch(['./src/javascripts/*.js'], ['js']);
gulp.watch(['./src/*.html'], ['html']);
});
gulp.task('icons', function() {
return gulp.src('./bower_components/fontawesome/fonts/**.*')
.pipe(gulp.dest('./build/fonts'));
});
gulp.task('default', ['connect', 'watch']);
|
JavaScript
| 0.000001 |
@@ -1207,16 +1207,32 @@
ault', %5B
+'html', 'sass',
'connect
|
f1f35b8ed7c4833331dc9dee2db6702cad61d4ce
|
Fix watcher
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp'),
traceur = require('gulp-traceur'),
connect = require('gulp-connect'),
open = require('open');
gulp.task('connect', function () {
var livereloadPort = 39729;
connect.server({
port: 8080,
livereload: {
port: livereloadPort
},
middleware: function (connect) {
function mountFolder(connect, dir) {
return connect.static(require('path').resolve(dir));
}
return [
require('connect-livereload')({ port: livereloadPort }),
mountFolder(connect, 'app')
];
}
});
});
gulp.task('watch', function () {
gulp.watch([
'app/**/*.html',
'app/**/*.js',
'!app/compiled/**'
], function (event) {
return gulp.src(event.path)
.pipe(connect.reload());
});
gulp.watch([
'app/**/*.js'
], ['compile']);
});
gulp.task('compile', function () {
return gulp.src([
'app/**/*.js',
'!app/compiled/**'
])
.pipe(traceur())
.pipe(gulp.dest('app/compiled'));
});
gulp.task('open', ['connect'], function () {
require('open')('http://localhost:9421');
});
gulp.task('serve', function () {
gulp.start('connect', 'watch', 'compile', 'open');
});
|
JavaScript
| 0.000001 |
@@ -532,16 +532,74 @@
ort %7D),%0A
+ mountFolder(connect, 'node_modules/traceur/bin'),%0A
@@ -625,16 +625,17 @@
, 'app')
+,
%0A %5D
@@ -1172,12 +1172,12 @@
ost:
-9421
+8080
');%0A
|
a6e37f2ab0a2c473b9593d70ba1617bbcbe87b27
|
update build
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var git = require('gulp-git');
var del = require('del');
var header = require('gulp-header');
var rename = require("gulp-rename");
var runSequence = require('run-sequence');
var pkg = require('./bower.json');
var banner = [
'/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @copyright <%= pkg.authors %> ' + (new Date()).getFullYear(),
' * @license <%= pkg.license %>',
' */',
''
].join('\n');
var paths = {
json: ['./bower.json', './package.json'],
js: ['./src/extend.js']
};
gulp.task('clean', function(cb) {
del(['./dist'], cb);
});
gulp.task('bump-patch', function(){
return gulp.src(paths.json)
.pipe(bump())
.pipe(gulp.dest('./'))
.pipe(git.add())
.pipe(git.commit('Bump version to ' + require('./bower.json').version));
});
gulp.task('bump-minor', function(){
return gulp.src(paths.json)
.pipe(bump({ type: 'minor' }))
.pipe(gulp.dest('./'))
.pipe(git.add())
.pipe(git.commit('Bump version to ' + require('./bower.json').version));
});
gulp.task('bump-major', function(){
return gulp.src(paths.json)
.pipe(bump({ type: 'major' }))
.pipe(gulp.dest('./'))
.pipe(git.add())
.pipe(git.commit('Bump version to ' + require('./bower.json').version));
});
gulp.task('tag', function() {
git.tag('v' + require('./bower.json').version, function(err) {
if (err) {
throw err;
}
});
});
gulp.task('js', ['clean'], function() {
return gulp.src(paths.js)
.pipe(header(banner, { pkg : pkg }))
.pipe(gulp.dest('./dist'));
});
gulp.task('js_min', ['clean'], function() {
return gulp.src(paths.js)
.pipe(uglify())
.pipe(header(banner, { pkg : pkg }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('default', function(cb){
runSequence('clean', ['js', 'js_min'], cb);
});
|
JavaScript
| 0.000001 |
@@ -91,24 +91,57 @@
p-uglify');%0A
+var bump = require('gulp-bump');%0A
var git = re
@@ -846,107 +846,10 @@
/'))
-%0A .pipe(git.add())%0A .pipe(git.commit('Bump version to ' + require('./bower.json').version))
;%0A
+
%7D);%0A
@@ -981,105 +981,8 @@
/'))
-%0A .pipe(git.add())%0A .pipe(git.commit('Bump version to ' + require('./bower.json').version))
;%0A%7D)
@@ -1078,32 +1078,32 @@
pe: 'major' %7D))%0A
-
.pipe(gulp.d
@@ -1112,16 +1112,90 @@
t('./'))
+;%0A%7D);%0A%0Agulp.task('commit-bump', function() %7B%0A return gulp.src(paths.json)
%0A .pi
|
31afa807c952440b8b2674d7da3864377a34575f
|
Add deploy details for prooduction server
|
gulpfile.js
|
gulpfile.js
|
// Module Dependencies
var cp = require('child_process'),
gulp = require('gulp'),
browserSync = require('browser-sync'),
sass = require('gulp-sass'),
autoprefix = require('gulp-autoprefixer');
gutil = require('gulp-util');
argv = require('minimist')(process.argv);
gulpif = require('gulp-if');
prompt = require('gulp-prompt');
rsync = require('gulp-rsync');
var paths = {
siteDir: '_site/',
sassDir: '_sass/',
cssDir: 'assets/stylesheets/',
jsDir: 'assets/javascripts/'
};
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
// Wait for jekyll:devbuild, then launch the Server
gulp.task('browser-sync', ['sass', 'jekyll:devbuild'], function () {
browserSync({
server: { baseDir: paths.siteDir },
notify: false
});
});
// Build the Jekyll Site for development
gulp.task('jekyll:devbuild', function (done) {
return cp.spawn(jekyll, ['build', '--config', ['_config.yml', '_config.dev.yml']], {
stdio: 'inherit'
})
.on('close', done);
});
// Build the Jekyll Site for production
gulp.task('jekyll:build', function (done) {
return cp.spawn(jekyll, ['build'], {
stdio: 'inherit'
})
.on('close', done);
});
// Rebuild Jekyll and reload page
gulp.task('jekyll:rebuild', ['jekyll:devbuild'], function () {
browserSync.reload();
});
// Compile files from _scss into both _site/css (for live injecting)
// and site (for future jekyll builds)
gulp.task('sass', function () {
return gulp
.src(paths.sassDir + '*.scss')
.pipe(sass({
includePaths: [paths.sassDir]
}))
.on('error', sass.logError)
.pipe(autoprefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {
cascade: true
}))
.pipe(gulp.dest(paths.siteDir + paths.cssDir))
.pipe(browserSync.reload({ stream: true }))
.pipe(gulp.dest(paths.cssDir));
});
// Reload browsersync without rebuilding
gulp.task('reload', function () {
browserSync.reload();
});
// Watch scss files for changes & recompile
// Watch html/md files, run jekyll & reload BrowserSync
gulp.task('watch', function () {
gulp.watch(paths.sassDir + '**/*.scss', ['sass']);
gulp.watch([
'*.html',
'_layouts/*.html',
'_includes/**/*.html',
'_posts/*.md',
'assets/images/**/*',
'*.yml'
], ['jekyll:rebuild']);
});
// Build site without starting server and watching for changes.
gulp.task('build', ['sass', 'jekyll:build']);
gulp.task('deploy', function() {
// Dirs and Files to sync
rsyncPaths = [paths.siteDir + '*.html', paths.siteDir + '**/*'];
// Default options for rsync
rsyncConf = {
progress: true,
root: "_site/",
incremental: true,
relative: true,
emptyDirectories: true,
recursive: true,
clean: true,
exclude: [],
};
// Staging
if (argv.staging) {
rsyncConf.hostname = 'new.codaye.com'; // hostname
rsyncConf.username = 'codayetest'; // ssh username
rsyncConf.destination = '/home/codayetest/new.codaye.com'; // path where uploaded files go
// Production
} else if (argv.production) {
rsyncConf.hostname = ''; // hostname
rsyncConf.username = ''; // ssh username
rsyncConf.destination = ''; // path where uploaded files go
// Missing/Invalid Target
} else {
throwError('deploy', gutil.colors.red('Missing or invalid target'));
}
// Use gulp-rsync to sync the files
return gulp.src(rsyncPaths)
.pipe(gulpif(
argv.production,
prompt.confirm({
message: 'Heads Up! Are you SURE you want to push to PRODUCTION?',
default: false
})
))
.pipe(rsync(rsyncConf));
});
function throwError(taskName, msg) {
throw new gutil.PluginError({
plugin: taskName,
message: msg
});
}
// Default task, running just `gulp` will compile the sass,
// compile the jekyll site, launch BrowserSync & watch files.
gulp.task('default', ['browser-sync', 'watch']);
|
JavaScript
| 0 |
@@ -3270,24 +3270,34 @@
hostname = '
+codaye.com
'; // hostna
@@ -3322,24 +3322,31 @@
username = '
+steama4
'; // ssh us
@@ -3382,16 +3382,40 @@
tion = '
+/home/steama4/codaye.com
'; // pa
|
93859fc8a792ff780188c78631646ef5c44c978a
|
add description for export task
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
// public/lib配下に展開したいnpmのパッケージ名
var modules = ['bootstrap-switch'];
gulp.task('export', function() {
modules.map(function(name, index) {
gulp.src('node_modules/' + name + '/**/*')
.pipe(gulp.dest('public/packages/' + name));
});
});
gulp.task('default', ['export']);
|
JavaScript
| 0.000001 |
@@ -36,11 +36,16 @@
lic/
-lib
+packages
%E9%85%8D%E4%B8%8B%E3%81%AB%E5%B1%95
@@ -96,16 +96,64 @@
tch'%5D;%0A%0A
+// modules%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%9Fnpm%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%82%92public/packages%E9%85%8D%E4%B8%8B%E3%81%AB%E5%B1%95%E9%96%8B%E3%81%99%E3%82%8B%0A
gulp.tas
|
83f59e655bfc313c40abe4da988414488ae2f6f5
|
Add umd support
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var concat = require('gulp-concat');
var less = require('gulp-less');
var webpackConf = require('./webpack.config.js');
var babel = require('gulp-babel');
var connect = require('gulp-connect');
gulp.task("webpack", function() {
return gulp.src('./examples/**/js/main.js')
.pipe(webpack( webpackConf ))
.pipe(concat('main.js'))
.pipe(gulp.dest('../'))
.pipe(connect.reload());
});
gulp.task('build-less', function(){
return gulp.src('./src/less/**/*.less')
.pipe(less())
.pipe(gulp.dest('./dist/css'))
.pipe(connect.reload());
});
gulp.task('build-less-example', function(){
return gulp.src('./examples/**/less/**/*.less')
.pipe(less())
.pipe(gulp.dest('../'))
.pipe(connect.reload());
});
gulp.task("connect", function(){
connect.server({
root: 'dist',
livereload: true,
port: 8003
});
});
gulp.task('babel', function(){
return gulp.src('src/js/*.*')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['build-less', 'copy']);
gulp.task('default', ['build-less', 'babel', 'build-less-example', 'webpack']);
gulp.task('watch', function() {
connect.server({
root: 'examples/basic',
livereload: true,
port: 8003
});
gulp.watch('src/**/*.less', ['build-less']);
gulp.watch(['src/**/*.js', 'src/**/*.jsx'], ['babel', 'webpack']);
gulp.watch(['examples/**/js/**/*.js', 'examples/**/*.jsx'], ['webpack']);
gulp.watch('examples/**/*.less', ['build-less-example']);
});
|
JavaScript
| 0 |
@@ -1066,16 +1066,32 @@
e(babel(
+%7Bmodules: 'umd'%7D
))%0A
|
a687666428f5d411355eef85c85f1d37928b0593
|
add gulp watch task - finally :grin:
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var sass = require('gulp-sass');
var jsoncombine = require('gulp-jsoncombine');
var del = require('del');
var runSequence = require('run-sequence');
var paths = {
files: ['images/**/*', 'js/**/*'],
sass: 'sass/main.scss',
manifest: 'manifest.json',
ffmanifest: 'firefox-manifest.json',
dest: {
chrome: 'dist/chrome',
firefox: 'dist/firefox'
}
};
var ffmanifest = {
"applications": {
"gecko": {
"id": "[email protected]"
}
}
}
function clean() {
return del('dist');
}
function copyFiles() {
return gulp.src(paths.files, { "base": "."})
.pipe(gulp.dest(paths.dest.chrome))
.pipe(gulp.dest(paths.dest.firefox));
}
function sassTask() {
return gulp.src(paths.sass)
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest(paths.dest.chrome + '/css'))
.pipe(gulp.dest(paths.dest.firefox + '/css'));
}
function firefoxManifest(data, meta) {
data.manifest.applications = ffmanifest.applications;
return new Buffer(JSON.stringify(data.manifest));
}
function copyManifest() {
return gulp.src(paths.manifest)
.pipe(gulp.dest(paths.dest.chrome))
.pipe(jsoncombine('manifest.json', firefoxManifest))
.pipe(gulp.dest(paths.dest.firefox));
}
gulp.task('clean', clean);
gulp.task('copy', copyFiles);
gulp.task('sass', sassTask);
gulp.task('manifest', copyManifest);
gulp.task('default', function(done) {
runSequence('clean', 'copy', 'sass', 'manifest', done);
});
|
JavaScript
| 0.000001 |
@@ -1553,8 +1553,138 @@
ne);%0A%7D);
+%0A%0Agulp.task('watch', function() %7B%0A gulp.watch(%5B'sass/**/*.scss', 'js/**/*.js', 'images/**/*', 'manifest.json'%5D, %5B'default'%5D);%0A%7D);
|
9d6b100a4ae77c6bcd2aaccf3c0245e0cf4d686b
|
Update gulpfile.js
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var wrap = require('gulp-wrap');
var del = require('del');
var nib = require('nib');
var stylus = require('gulp-stylus');
gulp.task('javascript', function() {
return gulp.src('assets/javascript/*.js')
.pipe(concat('main.js'))
.pipe(wrap('(function(a, window){<%= contents %>}(angular, window));'))
.pipe(gulp.dest('public/javascript'))
.pipe(rename({
suffix: '.min'
}))
.pipe(uglify())
.pipe(gulp.dest('public/javascript'))
.pipe(notify({ message: 'Scripts task complete' }));
});
gulp.task('css', function() {
return gulp.src('assets/style/*.styl')
.pipe(stylus({
use: nib()
}))
.pipe(gulp.dest('public/css'))
.pipe(notify({ message: 'CSS task complete' }));
});
gulp.task('default', function() {
gulp.start('javascript');
gulp.start('css');
});
gulp.task('watch', function() {
gulp.watch('assets/javascript/*.js', ['javascript']);
gulp.watch('assets/style/*.styl', ['css']);
});
|
JavaScript
| 0 |
@@ -969,17 +969,18 @@
ript');%0A
-%09
+
gulp.sta
@@ -1087,9 +1087,10 @@
%5D);%0A
-%09
+
gulp
|
4c12e40667a95a7d8ed9ad7850a399be018ea81e
|
Refactor GOPATH calculation in gulpfile
|
gulpfile.js
|
gulpfile.js
|
var path = require('path');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var bower_components = require('main-bower-files')();
var newenv = process.env;
var gpm_dir = __dirname + path.sep + '.godeps';
if (newenv.GOPATH.split(path.delimiter).indexOf(gpm_dir) == -1) {
newenv.GOPATH = gpm_dir + path.delimiter + newenv.GOPATH;
}
gulp.task('css', function() {
return gulp.src(bower_components)
.pipe($.filter('**/*.css'))
.pipe($.concat('main.css'))
.pipe($.minifyCss())
.pipe(gulp.dest('./public'));
});
gulp.task('js', function() {
return gulp.src(bower_components)
.pipe($.filter('**/*.js'))
.pipe($.concat('main.js'))
.pipe($.uglify())
.pipe(gulp.dest('./public'));
});
gulp.task('go', function() {
return $.run('go build', {env: newenv}).exec();
});
gulp.task('default', function() {
// place code for your default task here
});
|
JavaScript
| 0 |
@@ -153,30 +153,32 @@
var
-newenv = process.env;%0A
+gopath = function() %7B%0A
var
@@ -225,15 +225,22 @@
s';%0A
+
if (
-new
+process.
env.
@@ -285,17 +285,17 @@
pm_dir)
-=
+!
= -1) %7B%0A
@@ -300,23 +300,49 @@
%7B%0A
-newenv.GOPATH =
+ return process.env.GOPATH;%0A %7D%0A return
gpm
@@ -365,19 +365,24 @@
miter +
-new
+process.
env.GOPA
@@ -791,32 +791,88 @@
', function() %7B%0A
+ var newenv = process.env;%0A newenv.GOPATH = gopath();%0A
return $.run('
|
6a5ba7975f9c7b9d5df05ed0e694cd9bb73f440b
|
write the default gulp task
|
gulpfile.js
|
gulpfile.js
|
// jchck_'s gulpfile
//
// gulp plugin registry
//
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var cssnext = require('postcss-cssnext');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var atImport = require('postcss-import');
var mqpacker = require('css-mqpacker');
var cssnano = require('cssnano');
var size = require('gulp-size');
var cssvariables = require('postcss-css-variables');
var browserSync = require('browser-sync').create();
var devUrl = 'http://vagrant.local/jchck/';
//
// css processing task
//
// $ gulp css
//
gulp.task('css', function(){
// postcss plugin registry
var postcssPlugins = [
atImport,
cssvariables,
cssnano,
autoprefixer({
browsers: ['last 2 versions']
}),
cssnext,
mqpacker,
precss
];
// processing plumbing
return gulp.src('./src/css/jchck_.css')
// postcss it
.pipe(postcss(postcssPlugins))
// what's the size?
.pipe(size({gzip: false, showFiles: true, title: 'Processed!'}))
.pipe(size({gzip: true, showFiles: true, title: 'Processed & gZipped!'}))
// spit it out
.pipe(gulp.dest('./dest'))
.pipe(browserSync.stream());
});
//
// watch task
//
// $ gulp watch
//
gulp.task('watch', function(){
browserSync.init({
// the php files to watch
files: [
'{lib,templates}/**/*.php',
'*.php'
],
// the url getting proxied, defined above
proxy: devUrl,
// @see https://www.browsersync.io/docs/options/#option-snippetOptions
snippetOptions: {
whitelist: ['/wp-admin/admin-ajax.php'],
blacklist: ['/wp-admin/**']
}
});
// the css files to watch on change runs the css processing task
gulp.watch(['./src/css/*'], ['css']);
});
|
JavaScript
| 0.000347 |
@@ -1714,16 +1714,92 @@
%5B'css'%5D);%0A%7D);%0A%0A%0A
+//%0A// default task%0A//%0A// $ gulp%0A//%0A%0Agulp.task('default', %5B'css', 'watch'%5D);%0A
|
4291b4d738e4cb62611bcb24300941ca71da8d34
|
update keys (#2290)
|
lib/api/protocol/keys.js
|
lib/api/protocol/keys.js
|
const ProtocolAction = require('./_base-action.js');
/**
* Send a sequence of key strokes to the active element. The sequence is defined in the same format as the `sendKeys` command.
* An object map with available keys and their respective UTF-8 characters, as defined on [W3C WebDriver draft spec](https://www.w3.org/TR/webdriver/#character-types), is loaded onto the main Nightwatch instance as `client.Keys`.
*
* Rather than the `setValue`, the modifiers are not released at the end of the call. The state of the modifier keys is kept between calls, so mouse interactions can be performed while modifier keys are depressed.
*
* @example
* module.exports = {
* 'demo Test': function(browser) {
* browser
* .setValue('input[type=search]', 'nightwatch')
* .keys(browser.Keys.ENTER)
* }
* }
*
* @param {Array|string} keysToSend The keys sequence to be sent.
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api protocol.useractions
*/
module.exports = class Session extends ProtocolAction {
command(keysToSend, callback) {
if (!Array.isArray(keysToSend)) {
keysToSend = [keysToSend];
}
return this.transportActions.sendKeys(keysToSend, callback);
}
};
|
JavaScript
| 0 |
@@ -624,17 +624,84 @@
pressed.
+ Pass %60client.keys.NULL%60 to the keys function to release modifiers.
%0A
-
*%0A * @e
@@ -793,50 +793,84 @@
.
-setValue('input%5Btype=search%5D', 'nightwatch
+keys(browser.Keys.CONTROL) // hold down CONTROL key%0A * .click('#element
')%0A
@@ -899,14 +899,33 @@
eys.
-ENTER)
+NULL) // release all keys
%0A *
|
84c58a1655b8b183de0a3efb909a86e921d7ba7a
|
Remove Syntax-Error and require to deleted PageInitializer.js
|
lib/client/Page.class.js
|
lib/client/Page.class.js
|
"use strict"; // run code in ES5 strict mode
var Class = require("nodeclass").Class,
is = require("nodeclass").is,
DisplayObject = require("./DisplayObject.class.js"),
PageInitializer = require("./PageInitializer.class.js"),
resolvePageURLs = require("../shared/helpers/resolvePaths.js").resolvePageURLs,
pageRegistry = require("../shared/registries/pageRegistry.js"),
_ = require("underscore");
/**
* The currentLoadId is incremented every time Page.load() is called.
* This is necessary to abort callbacks when Page.load() itself has been called in the meantime.
*
* @type {Number}
*/
var currentLoadId = -1;
var Page = new Class({
Extends: DisplayObject,
//Change it from public to private as it was use as private in setSubPage()
__subPage: null, //Do you mean current subPage? It is possible that there are more subPages.
$main: null, //Is this the reference to the main page?
$load: function (pageURL, params) {
var pageURLs;
params = params || {};
currentLoadId++;
pageURLs = resolvePageURLs(pageURL);
changePages(pageURLs, params, currentLoadId);
},
/**
* @param {Page} subPage
*/
setSubPage: function (subPage) {
var self;
if (is(subPage).notInstanceOf(Page)) {
throw new TypeError("(alamid) Cannot set new subpage: The subpage must be an instance of Page");
}
//Why should the page be completely destroyed. I think it is useful to keep it somewhere.
//This way the page mustn't be loaded again on "back-button"
if (this.__subPage) {
this.__subPage.dispose();
}
//@TODO: two event listeners are needed here if the DisplayObject is not refactored
// https://github.com/peerigon/alamid/issues/54
subPage.once("destroy", function onDestroy() {
self.__subPage = null;
});
this.Super._append(subPage).at("page");
this.__subPage = subPage; //I've added this line, because otherwise __subPage won't be never set.
this.Super.emit("subPageChanged", subPage);
},
getAllSubPages: function () {
//TODO invokes getAllSubPages() recursively on the sub page and returns an array with all sub pages
}
});
//@TODO Make this function static
//That should be not a part of the page
}
module.exports = Page;
|
JavaScript
| 0 |
@@ -174,69 +174,8 @@
%22),%0A
- PageInitializer = require(%22./PageInitializer.class.js%22),%0A
@@ -2230,86 +2230,8 @@
);%0A%0A
-//@TODO Make this function static%0A//That should be not a part of the page%0A%0A%7D%0A%0A
modu
|
a1919827ebc5707edc934dc233aac61a261c325a
|
Improve output in case of unresolved links
|
lib/dump-error-buffer.js
|
lib/dump-error-buffer.js
|
import {get} from 'lodash/object'
import {partialRight} from 'lodash/function'
import log from 'npmlog'
import fs from 'fs'
import errorBuffer from 'contentful-batch-libs/utils/error-buffer'
export default function dumpErrorBuffer (params, message = 'Additional errors were found') {
const {destinationSpace, sourceSpace, errorLogFile} = params
const loggedErrors = errorBuffer.drain()
if (loggedErrors.length > 0) {
const errors = loggedErrors.reduce(partialRight(logErrorsWithAppLinks, sourceSpace, destinationSpace), '')
fs.writeFileSync(errorLogFile, errors)
log.warn(message)
log.warn(`Check ${errorLogFile} for details.`)
}
}
function logErrorsWithAppLinks (accumulatedErrorStr, err, idx, loggedErrors, sourceSpace, destinationSpace) {
const requestUri = get(err, 'request.uri')
if (requestUri) {
return accumulatedErrorStr +
`Error ${idx + 1}:\n` +
'in ' + parseEntityUrl(sourceSpace, destinationSpace, requestUri) +
'\n' +
JSON.stringify(err, null, ' ') +
'\n\n'
} else {
return accumulatedErrorStr +
`Error ${idx + 1}:\n` +
JSON.stringify(err, null, ' ') +
'\n\n'
}
}
function parseEntityUrl (sourceSpace, destinationSpace, url) {
return url.replace(/api.contentful/, 'app.contentful')
.replace(/:443/, '')
.replace(destinationSpace, sourceSpace)
.split('/').splice(0, 7).join('/')
}
|
JavaScript
| 0.000007 |
@@ -72,16 +72,55 @@
nction'%0A
+import %7Bfind%7D from 'lodash/collection'%0A
import l
@@ -136,16 +136,16 @@
npmlog'%0A
-
import f
@@ -452,24 +452,101 @@
ngth %3E 0) %7B%0A
+ const errorOutputPrefix = additionalInfoForUnresolvedLinks(loggedErrors)%0A
const er
@@ -572,16 +572,23 @@
.reduce(
+%0A
partialR
@@ -646,16 +646,43 @@
nSpace),
+%0A errorOutputPrefix %7C%7C
'')%0A
@@ -1518,16 +1518,16 @@
eSpace)%0A
-
@@ -1567,8 +1567,374 @@
('/')%0A%7D%0A
+%0Afunction additionalInfoForUnresolvedLinks (errors) %7B%0A if (find(errors, %7Bname: 'UnresolvedLinks'%7D)) %7B%0A return 'Unresolved links were found in your entries. See below for more details.%5Cn' +%0A 'Look at https://github.com/contentful/contentful-link-cleaner if you%5C'd like ' +%0A 'a quicker way to fix all unresolved links in your space.%5Cn%5Cn'%0A %7D%0A%7D%0A
|
ce69619266357cada2efa3508ae036b9e483a726
|
Use req.param() instead of req.params + req.mixinParams() for filter() as well. Introduce new updateParam() method to replace params with the filtered version See #1
|
lib/express_validator.js
|
lib/express_validator.js
|
/*
* This binds the node-validator library to the req object so that
* the validation / sanitization methods can be called on parameter
* names rather than the actual strings.
*
* 1. Be sure to include `req.mixinParams()` as middleware to merge
* query string, body and named parameters into `req.params`
*
* 2. To validate parameters, use `req.check(param_name, [err_message])`
* e.g. req.check('param1').len(1, 6).isInt();
* e.g. req.checkHeader('referer').contains('mydomain.com');
*
* Each call to `check()` will throw an exception by default. To
* specify a custom err handler, use `req.onValidationError(errback)`
* where errback receives a parameter containing the error message
*
* 3. To sanitize parameters, use `req.sanitize(param_name)`
* e.g. req.sanitize('large_text').xss();
* e.g. req.sanitize('param2').toInt();
*
* 4. Done! Access your validated and sanitized paramaters through the
* `req.params` object
*/
var Validator = require('validator').Validator,
Filter = require('validator').Filter;
var validator = new Validator();
var expressValidator = function(req, res, next) {
req.mixinParams = function() {
this.params = this.params || {};
// this.params is an array, we want an object instead
if (Array.isArray(this.params)) {
var params = {};
for (var c in this.params) {
params[c] = this.params[c];
}
this.params = params;
}
this.query = this.query || {};
this.body = this.body || {};
// Merge params from the query string
for (var i in this.query) {
if (typeof this.params[i] === 'undefined') {
this.params[i] = this.query[i];
}
}
// Merge params from the request body
for (var j in this.body) {
if (typeof this.params[j] === 'undefined') {
this.params[j] = this.body[j];
}
}
};
req.check = function(param, fail_msg) {
return validator.check(this.param(param), fail_msg);
};
req.checkHeader = function(param, fail_msg) {
var to_check;
if (header === 'referrer' || header === 'referer') {
to_check = this.headers.referer;
} else {
to_check = this.headers[header];
}
return validator.check(to_check || '', fail_msg);
};
req.onValidationError = function(errback) {
validator.error = errback;
};
req.filter = function(param) {
var self = this;
var filter = new Filter();
filter.modify = function(str) {
this.str = str;
self.params[param] = str; // Replace the param with the filtered version
};
return filter.sanitize(this.params[param]);
};
// Create some aliases - might help with code readability
req.sanitize = req.filter;
req.assert = req.check;
return next();
};
module.exports = expressValidator;
|
JavaScript
| 0 |
@@ -1890,24 +1890,529 @@
%7D%0A %7D;%0A%0A
+ req.updateParam = function(name, value) %7B%0A // route params like /user/:id%0A if (this.params && this.params.hasOwnProperty(name) && undefined !== this.params%5Bname%5D) %7B%0A return this.params%5Bname%5D = value;%0A %7D%0A // query string params%0A if (undefined !== this.query%5Bname%5D) %7B%0A return this.query%5Bname%5D = value;%0A %7D%0A // request body params via connect.bodyParser%0A if (this.body && undefined !== this.body%5Bname%5D) %7B%0A return this.body%5Bname%5D = value;%0A %7D%0A return false;%0A %7D;%0A%0A
req.check
@@ -3025,27 +3025,31 @@
elf.
-p
+updateP
aram
-s%5B
+(
param
-%5D =
+,
str
+)
; //
@@ -3141,16 +3141,15 @@
aram
-s%5B
+(
param
-%5D
+)
);%0A
|
bc5e4e7688aff1f36c431daa2d321956a033a822
|
return scope when no query is given and fix style issues
|
lib/findBy/perm/index.js
|
lib/findBy/perm/index.js
|
var Promise = require('bluebird')
var inspect = require('eyes').inspector()
var _ = require('lodash')
var xml2js = Promise.promisifyAll(require('xml2js'));
module.exports = {
init: init,
find: find
}
function init(env){
return Promise.resolve(env)
}
var _ = require('lodash')
var Promise = require('bluebird')
var fs = Promise.promisifyAll(require('fs'))
function unpickle(src){
return fs.readFileAsync(src, 'utf8')
.then(function(contents){
var data = []
var JSONPickle = function(o){
data.push(o)
}
eval(contents)
var gs = _.groupBy(data, '$type')
return {
appData: gs['edu.colorado.permgrep.appData'][0],
perms: gs['edu.colorado.permgrep.onePerm']
}
})
}
function find(env, query, options) {
return xml2js
.parseStringAsync(query)
.then(function(parsedQuery){
return Promise.all(options.scope.map(_.partial(match, env, parsedQuery)))
})
.then(_.compact)
.then(function(results){
return results
})
}
// q must be parsed
function match(env, q, item){
var methodNamePattern = q.callpath.$['from']
var permissionPattern = q.callpath.$['uses-permission'] || '.'
return env.apps
.get(item.id, {perm: true})
.then(function(app){
var o = app.perm
var matches = _(o.perms)
.map(function(p) {
var permission = p.permissions.elems[0].value
if (permission.match(permissionPattern)) {
var rs = _.map(p.path.elems, function (e) {
return e.methodName.methodName.match(methodNamePattern) ?
e : null
})
rs = _.compact(rs)
if (rs.length > 0) {
return {permission: p.permissions.elems, views: rs}
}
}
})
.compact()
.value()
if (matches.length > 0){
item.perm = matches
return item
}
})
}
|
JavaScript
| 0 |
@@ -22,24 +22,25 @@
('bluebird')
+;
%0Avar inspect
@@ -69,16 +69,17 @@
pector()
+;
%0Avar _ =
@@ -96,16 +96,17 @@
lodash')
+;
%0A%0Avar xm
@@ -205,16 +205,17 @@
: find%0A%7D
+;
%0A%0Afuncti
@@ -226,16 +226,17 @@
nit(env)
+
%7B%0A re
@@ -289,16 +289,17 @@
lodash')
+;
%0Avar Pro
@@ -324,16 +324,17 @@
uebird')
+;
%0Avar fs
@@ -370,16 +370,17 @@
e('fs'))
+;
%0A%0Afuncti
@@ -395,16 +395,17 @@
kle(src)
+
%7B%0A%0A r
@@ -462,16 +462,17 @@
function
+
(content
@@ -473,16 +473,17 @@
ontents)
+
%7B%0A%0A
@@ -502,16 +502,17 @@
ata = %5B%5D
+;
%0A
@@ -541,19 +541,21 @@
function
+
(o)
+
%7B%0A
@@ -582,32 +582,33 @@
o)%0A %7D
+;
%0A eva
@@ -618,16 +618,17 @@
ontents)
+;
%0A%0A
@@ -666,16 +666,17 @@
'$type')
+;
%0A
@@ -876,24 +876,156 @@
options) %7B%0A%0A
+ // If query is not specified, return everything in scope%0A if (!query) %7B%0A return Promise.resolve(options.scope);%0A %7D%0A
return x
@@ -1085,16 +1085,17 @@
function
+
(parsedQ
@@ -1099,16 +1099,17 @@
edQuery)
+
%7B%0A
@@ -1246,16 +1246,17 @@
function
+
(results
@@ -1256,16 +1256,17 @@
results)
+
%7B%0A
@@ -1348,16 +1348,17 @@
q, item)
+
%7B%0A%0A v
@@ -1370,33 +1370,32 @@
thodNamePattern
-
= q.callpath.$%5B'
@@ -1400,16 +1400,17 @@
%5B'from'%5D
+;
%0A var
@@ -1428,17 +1428,16 @@
Pattern
-
= q.call
@@ -1468,16 +1468,17 @@
%5D %7C%7C '.'
+;
%0A%0A re
@@ -1512,11 +1512,8 @@
item
-.id
, %7Bp
@@ -1550,13 +1550,15 @@
tion
+
(app)
+
%7B%0A%0A
@@ -1584,16 +1584,17 @@
app.perm
+;
%0A%0A
@@ -1653,16 +1653,17 @@
function
+
(p) %7B%0A%0A
@@ -1726,16 +1726,17 @@
0%5D.value
+;
%0A%0A
@@ -2014,16 +2014,17 @@
%7D)
+;
%0A%0A
@@ -2059,16 +2059,17 @@
pact(rs)
+;
%0A
@@ -2304,16 +2304,17 @@
.value()
+;
%0A%0A
@@ -2342,16 +2342,17 @@
gth %3E 0)
+
%7B%0A
@@ -2380,16 +2380,17 @@
matches
+;
%0A
|
f00fa148f2fc005c95e1b3e796b85234ba1f61a8
|
Update lib: Add `.isValidAirlineCode()`
|
lib/flight-designator.js
|
lib/flight-designator.js
|
/**
* FlightDesignator
* @constructor
* @param {String} airline
* @param {String} number
* @param {String} suffix
* @return {FlightDesignator}
*/
function FlightDesignator( airline, number, suffix ) {
if( !(this instanceof FlightDesignator) )
return new FlightDesignator( airline, number, suffix )
this.airlineCode = airline || ''
this.flightNumber = number || ''
this.operationalSuffix = suffix || ''
}
/**
* Flight designator pattern (IATA/ICAO)
* @type {RegExp}
*/
FlightDesignator.pattern = /^([A-Z0-9]{2}[A-Z]?)\s*([0-9]{1,4})\s*([A-Z]?)$/i
/**
* Parses a flight designator
* @param {String} value
* @return {FlightDesignator}
*/
FlightDesignator.parse = function( value ) {
try { return new FlightDesignator().parse( value ) }
catch( e ) { return null }
}
/**
* FlightDesignator prototype
* @type {Object}
*/
FlightDesignator.prototype = {
constructor: FlightDesignator,
parse: function( value ) {
var parts = ( value + '' )
.match( FlightDesignator.pattern )
if( parts == null || /^0{1,4}$/.test( parts[2] ) )
throw new Error( 'Invalid flight designator "' + value + '"' )
this.operationalSuffix = parts.pop()
this.flightNumber = parts.pop()
this.airlineCode = parts.pop()
return this
},
toString: function( spaces ) {
return [
this.airlineCode,
this.flightNumber,
this.operationalSuffix
].join( spaces ? ' ' : '' )
},
}
// Exports
module.exports = FlightDesignator
|
JavaScript
| 0 |
@@ -572,16 +572,254 @@
%5D?)$/i%0A%0A
+/**%0A * Determines whether the input is a valid airline code%0A * @param %7BString%7D airlineCode%0A * @return %7BBoolean%7D%0A */%0AFlightDesignator.isValidAirlineCode = function( airlineCode ) %7B%0A return /%5E(%5BA-Z0-9%5D%7B2%7D%5BA-Z%5D?)$/i.test( airlineCode )%0A%7D%0A%0A
/**%0A * P
|
b5aeb7eca5454c4f870d64b2cb90ea048b2d3652
|
make sure block props are passed down
|
draft-js-resizeable-plugin/src/createDecorator.js
|
draft-js-resizeable-plugin/src/createDecorator.js
|
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
const getDisplayName = (WrappedComponent) => {
const component = WrappedComponent.WrappedComponent || WrappedComponent;
return component.displayName || component.name || 'Component';
};
const round = (x, steps) => Math.ceil(x / steps) * steps;
export default ({ config, store }) => (WrappedComponent) => class BlockResizeableDecorator extends Component {
static displayName = `BlockDraggable(${getDisplayName(WrappedComponent)})`;
static WrappedComponent = WrappedComponent.WrappedComponent || WrappedComponent;
static defaultProps = {
horizontal: 'relative',
vertical: false,
resizeSteps: 1,
...config
};
state = {
hoverPosition: {},
clicked: false,
};
setEntityData = (data) => {
this.props.blockProps.setResizeData(data);
}
mouseLeave = () => {
if (!this.state.clicked) {
this.setState({ hoverPosition: {} });
}
}
mouseMove = (evt) => {
const { vertical, horizontal } = this.props;
const hoverPosition = this.state.hoverPosition;
const tolerance = 6;
// TODO figure out if and how to achieve this without fetching the DOM node
// eslint-disable-next-line react/no-find-dom-node
const pane = ReactDOM.findDOMNode(this);
const b = pane.getBoundingClientRect();
const x = evt.clientX - b.left;
const y = evt.clientY - b.top;
const isTop = vertical && vertical !== 'auto' ? y < tolerance : false;
const isLeft = horizontal ? x < tolerance : false;
const isRight = horizontal ? x >= b.width - tolerance : false;
const isBottom = vertical && vertical !== 'auto' ? y >= b.height - tolerance && y < b.height : false;
const canResize = isTop || isLeft || isRight || isBottom;
const newHoverPosition = {
isTop, isLeft, isRight, isBottom, canResize
};
const hasNewHoverPositions = Object.keys(newHoverPosition).filter(
(key) => hoverPosition[key] !== newHoverPosition[key]
);
if (hasNewHoverPositions.length) {
this.setState({ hoverPosition: newHoverPosition });
}
}
// Handle mousedown for resizing
mouseDown = (event) => {
// No mouse-hover-position data? Nothing to resize!
if (!this.state.hoverPosition.canResize) {
return;
}
const { resizeSteps, vertical, horizontal } = this.props;
const { hoverPosition } = this.state;
const { isTop, isLeft, isRight, isBottom } = hoverPosition;
// TODO figure out how to achieve this without fetching the DOM node
// eslint-disable-next-line react/no-find-dom-node
const pane = ReactDOM.findDOMNode(this);
const startX = event.clientX;
const startY = event.clientY;
const startWidth = parseInt(document.defaultView.getComputedStyle(pane).width, 10);
const startHeight = parseInt(document.defaultView.getComputedStyle(pane).height, 10);
// Do the actual drag operation
const doDrag = (dragEvent) => {
let width = (startWidth + dragEvent.clientX) - startX;
let height = (startHeight + dragEvent.clientY) - startY;
const block = store.getEditorRef().refs.editor;
width = block.clientWidth < width ? block.clientWidth : width;
height = block.clientHeight < height ? block.clientHeight : height;
const widthPerc = (100 / block.clientWidth) * width;
const heightPerc = (100 / block.clientHeight) * height;
const newState = {};
if ((isLeft || isRight) && horizontal === 'relative') {
newState.width = resizeSteps ? round(widthPerc, resizeSteps) : widthPerc;
} else if ((isLeft || isRight) && horizontal === 'absolute') {
newState.width = resizeSteps ? round(width, resizeSteps) : width;
}
if ((isTop || isBottom) && vertical === 'relative') {
newState.height = resizeSteps ? round(heightPerc, resizeSteps) : heightPerc;
} else if ((isTop || isBottom) && vertical === 'absolute') {
newState.height = resizeSteps ? round(height, resizeSteps) : height;
}
this.setState(newState);
};
// Finished dragging
const stopDrag = () => {
// TODO clean up event listeners
document.removeEventListener('mousemove', doDrag, false);
document.removeEventListener('mouseup', stopDrag, false);
const { width, height } = this.state;
this.setState({ clicked: false });
// TODO check if timeout is necessary
setTimeout(() => {
this.setEntityData({ width, height });
});
};
// TODO clean up event listeners
document.addEventListener('mousemove', doDrag, false);
document.addEventListener('mouseup', stopDrag, false);
this.setState({ clicked: true });
}
render() {
const {
blockProps,
vertical,
horizontal,
style,
// using destructuring to make sure unused props are not passed down to the block
resizeSteps, // eslint-disable-line no-unused-vars
...elementProps
} = this.props;
const { width, height, hoverPosition } = this.state;
const { isTop, isLeft, isRight, isBottom } = hoverPosition;
const styles = { position: 'relative', ...style };
if (horizontal === 'auto') {
styles.width = 'auto';
} else if (horizontal === 'relative') {
styles.width = `${(width || blockProps.resizeData.width || 40)}%`;
} else if (horizontal === 'absolute') {
styles.width = `${(width || blockProps.resizeData.width || 40)}px`;
}
if (vertical === 'auto') {
styles.height = 'auto';
} else if (vertical === 'relative') {
styles.height = `${(height || blockProps.resizeData.height || 40)}%`;
} else if (vertical === 'absolute') {
styles.height = `${(height || blockProps.resizeData.height || 40)}px`;
}
// Handle cursor
if ((isRight && isBottom) || (isLeft && isTop)) {
styles.cursor = 'nwse-resize';
} else if ((isRight && isTop) || (isBottom && isLeft)) {
styles.cursor = 'nesw-resize';
} else if (isRight || isLeft) {
styles.cursor = 'ew-resize';
} else if (isBottom || isTop) {
styles.cursor = 'ns-resize';
} else {
styles.cursor = 'default';
}
const interactionProps = store.getReadOnly()
? {}
: {
onMouseDown: this.mouseDown,
onMouseMove: this.mouseMove,
onMouseLeave: this.mouseLeave,
};
return (
<WrappedComponent
{...elementProps}
{...interactionProps}
ref={(element) => { this.wrapper = element; }}
style={styles}
/>
);
}
};
|
JavaScript
| 0 |
@@ -6448,24 +6448,56 @@
ctionProps%7D%0A
+ blockProps=%7BblockProps%7D%0A
ref=
|
daf25233283f6edc346dc0bef3afbc3ce5b1aa7f
|
Remove the temp file after deployment.
|
deployer.js
|
deployer.js
|
var fs = require('fs'),
sys = require('sys'),
exec = require('child_process').exec;
var deployer = exports.deployer = function (project, callback) {
var tempFile = __dirname + '/tmp/' + Math.random() + '.js';
fs.writeFile(tempFile, project.lastHandler.code, function(err) {
if (err) throw err;
console.log(sys.inspect('node '+tempFile));
node = exec('node '+tempFile, function (error, stdout, stderr) {
sys.print('stdout: ' + stdout);
sys.print('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
callback(stdout, stderr);
});
});
}
|
JavaScript
| 0 |
@@ -301,54 +301,8 @@
rr;%0A
-%09%09console.log(sys.inspect('node '+tempFile));%0A
%09%09no
@@ -318,17 +318,19 @@
('node '
-+
+ +
tempFile
@@ -373,146 +373,186 @@
%0A%09%09%09
-sys.print('stdout: ' + stdout);%0A%09%09%09sys.print('stderr: ' + stderr);%0A%09%09%09if (error !== null) %7B%0A%09%09%09%09console.log('exec error: ' + error);%0A%09%09%09%7D%0A
+if (error !== null) %7B%0A%09%09%09%09console.log('exec error: ' + error);%0A%09%09%09%7D%0A%09%09%09fs.unlink(tempFile, function (err) %7B%0A%09%09%09%09if (err)%0A%09%09%09%09%09console.log(%22Unable to delete %22 + tempFile + %22.%22);%0A%09
%09%09%09c
@@ -576,16 +576,23 @@
tderr);%0A
+%09%09%09%7D);%0A
%09%09%7D);%0A%09%7D
|
afdca1e1c6c0f0e78c245d6687b72f1c2c2430ee
|
set body font-size to 14px + antialiased fonts
|
src/styles/index.js
|
src/styles/index.js
|
import { injectGlobal } from 'styled-components';
const globalStyles = injectGlobal`
html,
body {
height: 100%;
}
body {
box-sizing: border-box;
color: #1f2228;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
margin: 0;
overflow-y: hidden;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
a[href]:not([class]) {
color: #3685d6;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
a > svg {
vertical-align: text-bottom;
}
`;
export default globalStyles;
|
JavaScript
| 0 |
@@ -343,17 +343,17 @@
-size: 1
-6
+4
px;%0A%09%09ma
@@ -384,16 +384,173 @@
hidden;
+%0A%0A -webkit-font-smoothing: antialiased;%0A text-rendering: optimizeLegibility;%0A -moz-osx-font-smoothing: grayscale;%0A font-feature-settings: 'liga';
%0A%09%7D%0A%0A *
|
5878ac20a47ed230b4c9d77d7f4f2e48d46905f4
|
Reset icon classes before updating them
|
lib/get-icon-services.js
|
lib/get-icon-services.js
|
const DefaultFileIcons = require('./default-file-icons')
const {Emitter, CompositeDisposable} = require('atom')
const {repoForPath} = require('./helpers')
let iconServices
module.exports = function getIconServices () {
if (!iconServices) iconServices = new IconServices()
return iconServices
}
class IconServices {
constructor () {
this.emitter = new Emitter()
this.elementIcons = null
this.elementIconDisposables = new CompositeDisposable()
this.fileIcons = DefaultFileIcons
}
onDidChange (callback) {
return this.emitter.on('did-change', callback)
}
resetElementIcons () {
this.setElementIcons(null)
}
resetFileIcons () {
this.setFileIcons(DefaultFileIcons)
}
setElementIcons (service) {
if (service !== this.elementIcons) {
if (this.elementIconDisposables != null) {
this.elementIconDisposables.dispose()
}
if (service) {
this.elementIconDisposables = new CompositeDisposable()
}
this.elementIcons = service
this.emitter.emit('did-change')
}
}
setFileIcons (service) {
if (service !== this.fileIcons) {
this.fileIcons = service
this.emitter.emit('did-change')
}
}
updateDirectoryIcon (view) {
if (this.elementIcons) {
const disposable = this.elementIcons(view.directoryName, view.directory.path)
this.elementIconDisposables.add(disposable)
} else {
let iconClass
if (view.directory.symlink) {
iconClass = 'icon-file-symlink-directory'
} else {
iconClass = 'icon-file-directory'
if (view.directory.isRoot) {
const repo = repoForPath(view.directory.path)
if (repo && repo.isProjectAtRoot()) iconClass = 'icon-repo'
} else {
if (view.directory.submodule) iconClass = 'icon-file-submodule'
}
}
view.directoryName.classList.add(iconClass)
}
}
updateFileIcon (view) {
const classes = ['name', 'icon']
let iconClass
if (this.elementIcons) {
const disposable = this.elementIcons(view.fileName, view.file.path)
this.elementIconDisposables.add(disposable)
} else {
iconClass = this.fileIcons.iconClassForPath(view.file.path, 'tree-view')
}
if (iconClass) {
if (!Array.isArray(iconClass)) {
iconClass = iconClass.toString().split(/\s+/g)
} classes.push(...iconClass)
}
view.fileName.classList.add(...classes)
}
}
|
JavaScript
| 0 |
@@ -1231,24 +1231,100 @@
on (view) %7B%0A
+ view.directoryName.className = ''%0A%0A const classes = %5B'name', 'icon'%5D%0A
if (this
@@ -1332,32 +1332,32 @@
elementIcons) %7B%0A
-
const disp
@@ -1918,24 +1918,54 @@
%7D%0A %7D%0A
+ classes.push(iconClass)%0A
view.d
@@ -1991,25 +1991,26 @@
ist.add(
-iconC
+...c
lass
+es
)%0A %7D%0A
@@ -2036,24 +2036,58 @@
on (view) %7B%0A
+ view.fileName.className = ''%0A%0A
const cl
@@ -2495,23 +2495,29 @@
/%5Cs+/g)%0A
-
%7D
+%0A
classes
|
cd60b38df298e6d2b12d846ec64cd9bc29b3cc63
|
Update toloka.js
|
web.to.plex/plugins/toloka.js
|
web.to.plex/plugins/toloka.js
|
/* Web to Plex - Toloka Plugin
* Aurthor(s) - @chmez (2017)
*/
// REQUIRED [var plugin:object]: The plugin variable, must be a variable
var plugin = {
// REQUIRED [plugin.url]: this is what you ask Web to Plex access to; currently limited to a single domain
url: "https://toloka.to/t*",
// OPTIONAL: this is purely for your code functionality
getID: () => {
let links = document.querySelectorAll('.postlink'),
regex = /^https?\:\/\/(?:w{3}\.)?imdb\.com\/title\/(tt\d+)/i;
for(let link in links)
if(regex.test(links[link]))
return RegExp.$1;
},
// REQUIRED [plugin.init]: this is what Web to Plex will call on when the url is detected
// it will always be fired after the page and Web to Plex have been loaded
init: (IMDbID) => {
let title = document.querySelector('.maintitle').textContent.replace(/^[^\/]+\/\s+([^\(]+)\(([\d]{4})/, '$1').trim(),
// REQUIRED [title:string]
year = RegExp.$2,
// PREFERRED [year:number, null, undefined]
image = document.querySelector('.postbody img').src;
// OPTIONAL [image:string]
// REQUIRED [{ type:'movie', 'show'; title:string; year:number; target:'web-to-plex' }]
// PREFERRED [{ image:string; IMDbID:string; TMDbID:string, number; TVDbID:string, number }]
window.postMessage({ type: 'movie', title, year, image, IMDbID, target: 'web-to-plex' }, '*');
}
};
// the rest of the code is up to you, but should be limited to a layout similar to this
var id = plugin.getID();
if(id)
plugin.init(id);
|
JavaScript
| 0 |
@@ -103,24 +103,24 @@
plugin
-variable
+constant
, must b
@@ -127,20 +127,22 @@
e a
-variable%0Avar
+constant%0Aconst
plu
@@ -1584,19 +1584,19 @@
to this%0A
-var
+let
id = pl
|
8d9826d6fe4bd51ad687adf91e895ef0fd259b6f
|
add padding
|
src/app/pages/common/Editor/Header/elements.js
|
src/app/pages/common/Editor/Header/elements.js
|
import styled from "styled-components";
export const DetailHeaderContainer = styled.div`
min-height: ${props => props.height? props.height : '44.2vh'};
width: 100%;
/* background: #297AFF; */
background: ${props => props.bgUrl? `url("${props.bgUrl}")` : "transparent"};
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
display: flex;
align-items: center;
position: relative;
max-height: 18rem;
.title {
font-size: 2rem;
height: auto;
color: ${props => props.theme.black.lighten(.15)};
padding: 1rem 0 3rem 5rem;
font-weight: 600;
/* background: rgba(0, 0, 0, .2); */
width: 100%;
@media (max-width: 467px) {
padding: 1rem 1rem 3rem 1rem;
}
}
.title::before {
color: #FFF;
}
.title::before:hover {
color: red;
}
`;
export const BottomContainer = styled.div`
position: absolute;
width: 100%;
display: flex;
justify-content: flex-end;
flex-direction: row;
box-sizing: border-box;
bottom: 1.8rem;
padding: .5rem;
color: #969696;
.it:nth-child(n) {
margin-left: 1rem;
}
.ed {
display: flex;
align-items: center;
transition: .2s all ease-in-out;
border: .1em solid transparent;
}
.ed:hover {
background: white;
padding: .1em;
border: none;
box-sizing: content-box;
}
.it {
display: flex;
flex-direction: row;
cursor: pointer;
}
.it .tx {
margin-left: .2rem;
}
`;
export const BottomTagsContainer = styled(BottomContainer)`
padding-right: 2rem;
bottom: 0;
`;
|
JavaScript
| 0.000001 |
@@ -1036,16 +1036,39 @@
.5rem;%0A
+ padding-right: 1rem;%0A
color:
@@ -1560,17 +1560,17 @@
-right:
-2
+1
rem;%0A b
|
185c83ff8d677c8478e4af31d58055e46ef10265
|
fix bug with single image tilesets and stop lowercasing tiledProperties component properties to fix 2nd loading bug
|
lib/import-from-tiled.js
|
lib/import-from-tiled.js
|
"use strict";
/** <p>Import an orthogonal tilemap from
* <a href="http://www.mapeditor.org/" target="_blank">Tiled: Map Editor</a> and draw on the screen.</p>
* <h5>To Do</h5>
* <ul>
* <li><b>Image Layer</b></li>
* <li><b>Ellipse and Polygon Objects</b></li>
* </ul>
* @module Import From Tiled
*/
/** @function ImportTilemap
* @param {Object} file JSON file exported from Tiled. This should be required in a scene enter
* script and passed to the function.
* @param {EntityPool} entities EntityPool from game.entities
*/
function ImportTilemap(file, entities) { // eslint-disable-line no-unused-vars
var tile, image, image_index, tile_pos, cols, tileset, tileset_index = 0;
var layer, object, entity;
for (var i = 0; i < file.layers.length; i++) {
layer = file.layers[i];
// Render Tile Layers
if (layer.type == "tilelayer") {
for (j = 0; j < layer.data.length; j++) {
// Select tileset index based on firstgid and image index
// Set image index minus firstgid for positioning math
for (var k = 0; k < file.tilesets.length; k++) {
if (layer.data[j] > file.tilesets[k].firstgid) {
tileset_index = k;
}
}
cols = file.tilesets[tileset_index].imagewidth / file.tilesets[tileset_index].tilewidth;
image_index = layer.data[j] - file.tilesets[tileset_index].firstgid;
tileset = file.tilesets[tileset_index];
if (image_index >= 0) {
// Create tile and get properties
tile = entities.create();
entities.set(tile, "name", "tile");
entities.set(tile, "tile", true);
entities.set(tile, "image", { "name": "" });
entities.set(tile, "position", { "x": 0, "y": 0 });
image = entities.get(tile, "image");
tile_pos = entities.get(tile, "position");
// Position based on index
tile_pos.x = (j % file.width) * file.tilewidth;
tile_pos.y = Math.floor(j / file.width) * file.tileheight;
// Character position z: 1 so anything without background true will layer over player
tile_pos.z = (layer.properties.Background == "True") ? -1 : 2;
// Select which "tile" of the tileset image to render
image.name = tileset.image;
image.sourceWidth = tileset.tilewidth;
image.sourceHeight = tileset.tileheight;
image.destinationWidth = tileset.tilewidth;
image.destinationHeight = tileset.tileheight;
image.sourceX = (image_index % cols) * tileset.tilewidth + ((image_index % cols) * tileset.spacing) + tileset.margin;
image.sourceY = Math.floor(image_index / cols) * tileset.tileheight + (Math.floor(image_index / cols) * tileset.spacing) + tileset.margin;
}
}
}
/**
* @member {Entity} Object Entities
* <p>Create Entity with size and position components</p>
* <p><b>Collidable</b>: True or False <br />Add collision component to entity.
* Currently collisions are handled as a simulation system in the project.</p>
* <p><b>Spawn</b>: True or False <br />Creates an entity with a "spawn" boolean
* component allowing you to use <code>game.entities.find("spawn");</code> to find the spawn point for this map.</p>
* <br />All other properties end up in a "tiledProperties" component to be handled on a per-game basis.
*/
// Loop object layer for collisions and spawn point
if (layer.type == "objectgroup") {
for (var j = 0; j < layer.objects.length; j++) {
object = layer.objects[j];
entity = entities.create();
entities.set(entity, "size", { "width": object.width, "height": object.height });
entities.set(entity, "position", { "x": object.x, "y": object.y });
entities.set(entity, "collisions", []);
Object.keys(object.properties).forEach(function(key) {
if (!isNaN(object.properties[key])) {
object.properties[key] = parseInt(object.properties[key], 10);
}
if (new String(object.properties[key]).toLowerCase() == "true" || object.properties[key] == "1") {
object.properties[key] = true;
}
if (new String(object.properties[key]).toLowerCase() == "false" || object.properties[key] == "0") {
object.properties[key] = false;
}
var new_key = new String(key).toLowerCase();
object.properties[new_key] = object.properties[key];
delete object.properties[key];
});
// Spawn points
if (object.properties.spawn) {
entities.set(entity, "spawn", true);
}
entities.set(entity, "tiledProperties", object.properties);
}
}
}
/**
* @member {Entity} Container Entity
* Created automatically allowing you to use
* <code>game.entities.find("container");</code> to get a constrainPosition ID</p>
*/
var map_size = {
"width": file.width * file.tilewidth,
"height": file.height * file.tileheight
};
var container = entities.create();
entities.set(container, "name", "container");
entities.set(container, "container", true);
entities.set(container, "position", { "x": 0, "y": 0 });
entities.set(container, "size", map_size);
}
module.exports = ImportTilemap;
|
JavaScript
| 0 |
@@ -1091,16 +1091,17 @@
ata%5Bj%5D %3E
+=
file.ti
@@ -1118,24 +1118,24 @@
firstgid) %7B%0A
-
%09%09%09%09%09%09tilese
@@ -2463,16 +2463,109 @@
margin;%0A
+%09%09%09%09%09if(tileset.tileheight == tileset.imageheight) %7B%0A%09%09%09%09%09%09image.sourceY = 0;%0A%09%09%09%09%09%7D else %7B%0A%09
%09%09%09%09%09ima
@@ -2699,16 +2699,23 @@
.margin;
+%0A%09%09%09%09%09%7D
%0A%0A%09%09%09%09%7D%0A
@@ -4187,159 +4187,15 @@
se;%0A
+
%09%09%09%09%09%7D%0A
-%09%09%09%09%09var new_key = new String(key).toLowerCase();%0A%09%09%09%09%09object.properties%5Bnew_key%5D = object.properties%5Bkey%5D;%0A%09%09%09%09%09delete object.properties%5Bkey%5D;%0A
%09%09%09%09
|
c8d747783eb54d2940d51bcf92a07d949fe7bafa
|
one timeout is ok
|
src/async-status-indicator/examples/default.js
|
src/async-status-indicator/examples/default.js
|
const labels = {
success: 'Success',
error: 'Error',
ready: 'Ready',
processing: 'Processing'
};
const icons = {
success: <Icon icon='check2' />,
error: <Icon icon='x' />,
processing: <LoadingSpinner size='1em' overlayColor='transparent' />
}
class Example extends React.Component {
state = { state: 'ready' }
onClick = () => {
if (this.timeout) {
return;
}
this.setState({ state: 'processing'});
this.timeout1 = setTimeout(() => {
this.setState({ state: Math.random() > .5 ? 'success' : 'error'});
this.timeout2 = setTimeout(() => {
this.setState({ state: 'ready' });
clearTimeout(this.timeout1);
clearTimeout(this.timeout2);
}, 1987);
}, 1987);
}
render = () => (
<FlexView>
<FlexView marginRight={30}>
<button onClick={this.onClick}>click!</button>
</FlexView>
<FlexView>
<AsyncStatusIndicator
state={this.state.state}
icons={icons}
labels={labels}
/>
</FlexView>
</FlexView>
);
}
|
JavaScript
| 0.99984 |
@@ -446,17 +446,16 @@
.timeout
-1
= setTi
@@ -464,24 +464,24 @@
out(() =%3E %7B%0A
+
this.s
@@ -559,17 +559,16 @@
.timeout
-2
= setTi
@@ -620,24 +620,24 @@
'ready' %7D);%0A
+
clea
@@ -661,46 +661,8 @@
eout
-1);%0A clearTimeout(this.timeout2
);%0A
|
4cfcea7fc9ab29989797501baeaf0cda8d84da77
|
Update controllerUtils.js
|
src/backend/rest/subscriber/controllerUtils.js
|
src/backend/rest/subscriber/controllerUtils.js
|
var validator = require('validator');
function invalidEmail(email){
//use node-enfore library
return !validator.isEmail(email);
}
function invalidPassword(password){
var min = 8;
var max = 16;
//return !validator.isLength(password, min, max);
return !(password.length<=max&&password.length>=min);
}
//function validToken(token){
// checks.add("testToken", enforce.ranges.length(36, 36, "bad token"))
// checks.check({
// testToken : token
// }, function (err) {
// console.log(err);
// });
//}
exports.invalidPassword = invalidPassword;
exports.invalidEmail = invalidEmail;
//exports.validToken = validToken;
|
JavaScript
| 0.000001 |
@@ -273,15 +273,18 @@
ngth
+
%3C=max
+
&&
+
pass
@@ -298,10 +298,12 @@
ngth
+
%3E=
+
min)
|
fa7fe64b6a58ceaed6f9f2fd909ca966ccd0fc10
|
change tagui_header to support config file
|
src/tagui_header.js
|
src/tagui_header.js
|
/* OUTPUT CASPERJS SCRIPT FOR TA.GUI FRAMEWORK ~ TEBEL.SG */
// casperjs (phantomjs) browser settings
var x = require('casper').selectXPath;
var casper = require('casper').create({
verbose: false, logLevel: 'debug',
waitTimeout: 10000,
viewportSize: {width: 1366, height: 768},
pageSettings: {loadImages: true, loadPlugins: true,
localToRemoteUrlAccessEnabled: false, webSecurityEnabled: true, ignoreSslErrors: false}});
// assign parameters to p1-p9 variables
var p1 = casper.cli.raw.get(0); var p2 = casper.cli.raw.get(1); var p3 = casper.cli.raw.get(2);
var p4 = casper.cli.raw.get(3); var p5 = casper.cli.raw.get(4); var p6 = casper.cli.raw.get(5);
var p7 = casper.cli.raw.get(6); var p8 = casper.cli.raw.get(7); var p9 = casper.cli.raw.get(8);
// save start time to measure execution time
var automation_start_time = Date.now(); casper.echo('\nSTART - automation started - ' + Date().toLocaleString());
// initialise other global variables
var save_text_count = 0; var snap_image_count = 0;
// for saving text information to file
function save_text(file_name,info_text) {
if (!file_name) {save_text_count++; file_name = 'text' + save_text_count.toString() + '.txt';}
var fs = require('fs'); fs.write(file_name, info_text, 'w');}
// for saving snapshots of website to file
function snap_image() {snap_image_count++; return ('image' + snap_image_count.toString() + '.png');}
// for adding synchronous suspend capability
function sleep(delay_in_ms) {var start_time = new Date().getTime();
for (var sleep_count = 0; sleep_count < 1e7; sleep_count++)
{if ((new Date().getTime() - start_time) > delay_in_ms) break;}}
// finding best match for given locator
function tx(locator) {
if (casper.exists(x(locator))) return x(locator);
if (casper.exists(x('//*[contains(@id,"'+locator+'")]'))) return x('//*[contains(@id,"'+locator+'")]');
if (casper.exists(x('//*[contains(@name,"'+locator+'")]'))) return x('//*[contains(@name,"'+locator+'")]');
if (casper.exists(x('//*[contains(@class,"'+locator+'")]'))) return x('//*[contains(@class,"'+locator+'")]');
if (casper.exists(x('//*[contains(@title,"'+locator+'")]'))) return x('//*[contains(@title,"'+locator+'")]');
if (casper.exists(x('//*[contains(text(),"'+locator+'")]'))) return x('//*[contains(text(),"'+locator+'")]');
else return x('/html');}
// checking if given locator is found
function check_tx(locator) {
if (casper.exists(x(locator))) return true;
if (casper.exists(x('//*[contains(@id,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[contains(@name,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[contains(@class,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[contains(@title,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[contains(text(),"'+locator+'")]'))) return true;
else return false;}
|
JavaScript
| 0 |
@@ -210,16 +210,26 @@
debug',%0A
+tagui.cfg.
waitTime
@@ -237,13 +237,8 @@
ut:
-10000
,%0Avi
@@ -254,29 +254,45 @@
e: %7B
-width: 1366,
+tagui.cfg.width: , tagui.cfg.
height:
768%7D
@@ -291,11 +291,8 @@
ht:
-768
%7D,%0Ap
@@ -305,16 +305,26 @@
tings: %7B
+tagui.cfg.
loadImag
@@ -327,22 +327,28 @@
Images:
-true,
+, tagui.cfg.
loadPlug
@@ -356,14 +356,20 @@
ns:
-true,%0A
+,%0Atagui.cfg.
loca
@@ -395,23 +395,28 @@
nabled:
-false,
+, tagui.cfg.
webSecur
@@ -431,14 +431,20 @@
ed:
-true,
+, tagui.cfg.
igno
@@ -456,21 +456,16 @@
Errors:
-false
%7D%7D);%0A%0A//
|
f6a95642eecffa45a209b131fbbcc1bda62d8c58
|
add path for electron.
|
src-script/script-util.js
|
src-script/script-util.js
|
/**
*
* Copyright (c) 2020 Silicon Labs
*
* 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.
*/
const { spawn } = require('cross-spawn')
const folderHash = require('folder-hash')
const hashOptions = {}
const spaDir = 'spa'
const fs = require('fs')
const path = require('path')
const scriptUtil = require('./script-util.js')
const spaHashFileName = path.join(spaDir, 'hash.json')
// Utilities shared by scripts.
function executeCmd(ctx, cmd, args) {
return new Promise((resolve, reject) => {
console.log(`🚀 Executing: ${cmd} ${args.join(' ')}`)
var c = spawn(cmd, args)
c.on('exit', (code) => {
if (code == 0) resolve(ctx)
else {
console.log(`👎 Program ${cmd} exited with error code: ${code}`)
reject(code)
}
})
c.stdout.on('data', (data) => {
process.stdout.write(data)
})
c.stderr.on('data', (data) => {
process.stderr.write('⇝ ' + data)
})
})
}
/**
* Resolves into a context object.
* Check for context.needsRebuild
*
* @returns
*/
function rebuildSpaIfNeeded() {
return folderHash
.hashElement('src', hashOptions)
.then((currentHash) => {
console.log(`🔍 Current hash: ${currentHash.hash}`)
return {
currentHash: currentHash,
}
})
.then(
(ctx) =>
new Promise((resolve, reject) => {
fs.readFile(spaHashFileName, (err, data) => {
var oldHash = null
if (err) {
console.log(`👎 Error reading old hash file: ${spaHashFileName}`)
ctx.needsRebuild = true
} else {
oldHash = JSON.parse(data)
console.log(`🔍 Previous hash: ${oldHash.hash}`)
ctx.needsRebuild = oldHash.hash != ctx.currentHash.hash
}
if (ctx.needsRebuild) {
console.log(
`🐝 Front-end code changed, so we need to rebuild SPA.`
)
} else {
console.log(
`👍 There were no changes to front-end code, so we don't have to rebuild the SPA.`
)
}
resolve(ctx)
})
})
)
.then((ctx) => {
if (ctx.needsRebuild)
return scriptUtil.executeCmd(ctx, 'quasar', ['build'])
else return Promise.resolve(ctx)
})
.then(
(ctx) =>
new Promise((resolve, reject) => {
if (ctx.needsRebuild) {
console.log('✍ Writing out new hash file.')
fs.writeFile(
spaHashFileName,
JSON.stringify(ctx.currentHash),
(err) => {
if (err) reject(err)
else resolve(ctx)
}
)
} else {
resolve(ctx)
}
})
)
}
exports.executeCmd = executeCmd
exports.rebuildSpaIfNeeded = rebuildSpaIfNeeded
|
JavaScript
| 0 |
@@ -909,16 +909,78 @@
h.json')
+%0Aprocess.env.PATH = process.env.PATH + ':./node_modules/.bin/'
%0A%0A// Uti
|
e7ad36f2b3993b9862a37abf3ca42dd7e5313e8e
|
load profile explicity after a stub profile is created
|
src/client/modules/app/services/userprofile.js
|
src/client/modules/app/services/userprofile.js
|
/*global define */
/*jslint browser: true, white: true */
define([
'promise',
'kb/common/observed',
'kb/service/userProfile',
'kb/common/lang'
], function (
Promise,
observed,
userProfile,
lang
) {
'use strict';
function factory(config) {
var runtime = config.runtime,
state = observed.make();
function loadProfile() {
return Promise.try(function () {
var username = runtime.getService('session').getUsername();
if (username) {
return Object.create(userProfile).init({
username: username,
runtime: runtime
}).loadProfile();
}
throw new lang.UIError({
type: 'RuntimeError',
reason: 'UsernameMissingFromSession',
message: 'The username was not found in the session.'
});
});
}
// list for request fetch the user profile
function start() {
runtime.recv('profile', 'check', function () {
return loadProfile()
.then(function (profile) {
state.setItem('userprofile', profile);
runtime.send('profile', 'loaded', profile);
})
.done();
});
runtime.getService('session').onChange(function (loggedIn) {
if (loggedIn) {
loadProfile()
.then(function (profile) {
var profileState = profile.getProfileStatus();
switch (profileState) {
case 'stub':
case 'profile':
state.setItem('userprofile', profile);
// AppState.setItem('userprofile', profile);
// Postal.channel('session').publish('profile.loaded', {profile: profile});
break;
case 'none':
return profile.createStubProfile({createdBy: 'session'})
.then(function (profile) {
state.setItem('userprofile', profile);
//AppState.setItem('userprofile', profile);
//Postal.channel('session').publish('profile.loaded', {profile: profile});
})
.catch(function (err) {
// Postal.channel('session').publish('profile.loadfailure', {error: err});
// TODO: global error handler!?!?!?
// Send to alert?
console.error(err);
runtime.send('ui', 'alert', {
type: 'error',
message: 'Error loading profile - could not create stub'
});
});
break;
default:
runtime.send('ui', 'alert', 'Error loading profile - invalid state ' + profileState);
}
})
.catch(function (err) {
console.error('ERROR starting profile app service');
console.error(err);
});
} else {
state.setItem('userprofile', null);
}
});
return true;
}
function stop() {
return Promise.try(function () {
state.setItem('userprofile', null);
});
}
function getRealname() {
var profile = state.getItem('userprofile');
if (profile) {
return profile.getProp('user.realname');
}
}
//runtime.recv('session', 'loggedin', function () {
// loadSession();
//});
// send out message when the profile has been received
function onChange(fun, errFun) {
state.listen('userprofile', {
onSet: function (value) {
fun(value);
},
onError: function (err) {
console.error('ERROR in user profile service');
console.error(err);
if (errFun) {
errFun(err);
}
}
});
}
function whenChange() {
return state.whenItem('userprofile')
}
return {
// lifecycle api
start: start,
stop: stop,
// useful api
onChange: onChange,
whenChange: whenChange,
getRealname: getRealname
};
}
return {
make: function (config) {
return factory(config);
}
};
});
|
JavaScript
| 0 |
@@ -2284,16 +2284,193 @@
sion'%7D)%0A
+ .then(function () %7B%0A return profile.loadProfile();%0A %7D)%0A
|
c9393976b9eb61cac121c341af0c8ba4b9563b80
|
remove debugging
|
lib/manifest/get-tags.js
|
lib/manifest/get-tags.js
|
/**
* Get the tags data from the KA api
*/
var request = require('superagent');
function getTags(next) {
request.get('http://www.khanacademy.org/api/v1/assessment_items/tags')
.end(function (err, res) {
next(err, res.body);
});
}
module.exports = getTags;
/* */
module.exports = function (next) {
next(null, require('../../data/tags.json'));
};
/* */
|
JavaScript
| 0.000065 |
@@ -290,104 +290,4 @@
gs;%0A
-%0A/* */%0Amodule.exports = function (next) %7B%0A next(null, require('../../data/tags.json'));%0A%7D;%0A/* */%0A
|
66810f70f47b67163b4a2ea79f195caabb9a7bd5
|
increase proxy tile zoom ranges
|
src/tile_pyramid.js
|
src/tile_pyramid.js
|
import Tile from './tile';
export default class TilePyramid {
constructor() {
this.tiles = {};
this.max_proxy_descendant_depth = 3; // # of levels to search up/down for proxy tiles
this.max_proxy_ancestor_depth = 5;
}
addTile(tile) {
// Add target tile
this.tiles[tile.key] = this.tiles[tile.key] || { descendants: 0 };
this.tiles[tile.key].tile = tile;
// Add to parents
while (tile.style_zoom >= 0) {
tile = Tile.parentInfo(tile);
if (!tile) {
return;
}
if (!this.tiles[tile.key]) {
this.tiles[tile.key] = { descendants: 0 };
}
this.tiles[tile.key].descendants++;
}
}
removeTile(tile) {
// Remove target tile
if (this.tiles[tile.key]) {
delete this.tiles[tile.key].tile;
if (this.tiles[tile.key].descendants === 0) {
delete this.tiles[tile.key]; // remove whole tile in tree
}
}
// Decrement reference count up the tile pyramid
while (tile.style_zoom >= 0) {
tile = Tile.parentInfo(tile);
if (!tile) {
return;
}
if (this.tiles[tile.key] && this.tiles[tile.key].descendants > 0) {
this.tiles[tile.key].descendants--;
if (this.tiles[tile.key].descendants === 0 && !this.tiles[tile.key].tile) {
delete this.tiles[tile.key]; // remove whole tile in tree
}
}
}
}
// Find the parent tile for a given tile and style zoom level
getAncestor (tile) {
let level = 0;
while (level < this.max_proxy_ancestor_depth) {
const last_z = tile.coords.z;
tile = Tile.parentInfo(tile);
if (!tile) {
return;
}
if (this.tiles[tile.key] &&
this.tiles[tile.key].tile &&
this.tiles[tile.key].tile.loaded) {
return this.tiles[tile.key].tile;
}
if (tile.coords.z !== last_z) {
level++;
}
}
}
// Find the descendant tiles for a given tile and style zoom level
getDescendants (tile, level = 0) {
let descendants = [];
if (level < this.max_proxy_descendant_depth) {
let tiles = Tile.childrenInfo(tile);
if (!tiles) {
return;
}
tiles.forEach(t => {
if (this.tiles[t.key]) {
if (this.tiles[t.key].tile &&
this.tiles[t.key].tile.loaded) {
descendants.push(this.tiles[t.key].tile);
}
else if (this.tiles[t.key].descendants > 0) { // didn't find any children, try next level
descendants.push(...this.getDescendants(t, level + (t.coords.z !== tile.coords.z)));
}
}
});
}
return descendants;
}
}
|
JavaScript
| 0 |
@@ -148,9 +148,9 @@
h =
-3
+6
; //
@@ -240,9 +240,9 @@
h =
-5
+7
;%0A
|
76e5cb767031b3d969dbda7c732374c8f5bd60a8
|
Change to root git directory before executing hooks
|
node/lib/util/hook.js
|
node/lib/util/hook.js
|
/*
* Copyright (c) 2018, Two Sigma Open Source
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of git-meta nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
const assert = require("chai").assert;
const ChildProcess = require("child-process-promise");
const co = require("co");
const path = require("path");
const GitUtil = require("../util/git_util");
/**
* Run git-meta hook with given hook name.
* @async
* @param {String} name
* @param {String[]} args
* @return {String}
*/
exports.execHook = co.wrap(function *(name, args=[]) {
assert.isString(name);
const hookPath = path.join(GitUtil.getRootGitDirectory(), ".git/hooks");
const absPath = path.resolve(hookPath, name);
try {
const result = yield ChildProcess.execFile(absPath, args);
return result.stdout;
} catch (e) {
// ignore the exception
// Fixme: Need to be sync with git. If the hook is not executable,
// should give user hints.
}
});
|
JavaScript
| 0 |
@@ -1792,16 +1792,54 @@
_util%22);
+%0Aconst process = require(%22process%22);
%0A%0A/**%0A *
@@ -2060,29 +2060,24 @@
nst
-hookPath = path.join(
+rootDirectory =
GitU
@@ -2101,16 +2101,62 @@
ectory()
+;%0A const hookPath = path.join(rootDirectory
, %22.git/
@@ -2211,24 +2211,24 @@
th, name);%0A%0A
-
try %7B%0A
@@ -2225,16 +2225,54 @@
try %7B%0A
+ process.chdir(rootDirectory);%0A
|
e1c34971c2400fa4c235d440bb3d9223fdeb4a4e
|
remove clientside logging for debug
|
node/public/js/app.js
|
node/public/js/app.js
|
$(document).ready(function () {
new Clipboard('.btn');
$(".btn-login").click(function () {
var $btn = $(this);
var $form = $(".login-form");
$btn.html('<i class="fa fa-refresh fa-spin"></i>');
console.log($form.val());
// send login information to server and validate
var code = {
"code": $(".login-form").val()
};
console.log(code);
$.ajax({
url: "/login",
method: "POST",
data: code,
success: function (res) {
// success: log user in, disable VIP Code input
if (res.err) {
notie.alert("error", res.err, 2);
$btn.html('<i class="fa fa-sign-in" aria-hidden="true"></i>');
} else {
notie.alert("success", "You can now use Premium features", 2);
// refresh page
setTimeout(location.reload.bind(location), 1000);
}
},
error: function (req, status, err) {
// unknown error: show error message, reset inputs
notie.alert("error", req.responseText, 2);
$btn.html('<i class="fa fa-sign-in" aria-hidden="true"></i>');
}
});
});
// VIP CODE: listen for enter key press
$(".login-form").keypress(function (e) {
if (e.keyCode == 13)
$('.btn-login').click();
});
// make request to shorten link on button click
$(".btn-shorten").click(function () {
var url = $(".input-url").val();
var customLink = $(".input-custom-link").val();
if(customLink == undefined)
customLink = "";
console.log(url);
console.log(customLink);
var json = {
"shortlink": customLink,
"longlink": url
}
// validate url
if (isURL(url)) {
$.ajax({
url: "/link",
method: "POST",
data: json,
dataType: "json",
success: function (res, status) {
console.log(res);
if (!res.error) {
$(".input-url").val(res.shortLink);
$(".input-url").select();
// create well for first shortened link
if (!$(".result").hasClass("well")) {
$(".result").addClass("well");
}
displayShortenedLink(res.longLink, res.shortLink, res.shortURL);
} else {
notie.alert("error", res.error, 2);
}
},
error: function (obj, status, err) {
if (err === "") {
err = "An error occured while processing your request.";
}
notie.alert('error', err, 2);
}
});
} else {
notie.alert('error', 'Unable to shorten that link. It is not a valid url.', 2);
}
});
// listen for enter keypress
$('.input-url').keypress(function (e) {
if (e.keyCode == 13)
$('.btn-shorten').click();
});
$('.input-custom-link').keypress(function (e) {
if (e.keyCode == 13)
$('.btn-shorten').click();
});
var count = 36187;
setInterval(function () {
var rnd = Math.floor(Math.random() * 100);
count += rnd;
$(".count").html(count);
}, 1000);
// Admin functionality
$(".btn-generate").click(function () {
// TODO: generate random Premium Code
$(".input-code").val(token());
});
$('#input-password').keypress(function (e) {
if (e.keyCode == 13)
$('.btn-signin').click();
});
$('.input-code').keypress(function (e) {
if (e.keyCode == 13)
$('.btn-code').click();
});
// Admin Page SignIn
$(".btn-signin").click(function () {
var passwd = {
password: $("#input-password").val()
};
$.ajax({
url: "/admin",
data: passwd,
method: "POST",
success: function (data) {
if (!data.err) {
location.reload();
} else {
notie.alert("error", data.err, 2)
}
}
});
});
// Submit new Premium Code
$(".btn-code").click(function () {
var code = {
"code": $(".input-code").val()
};
$.ajax({
url: "/code",
data: code,
method: "POST",
success: function (data) {
if (!data.err) {
notie.alert("success", "Succesfully created Premium Code '" + data.code + "'", 2);
} else {
notie.alert("error", data.err, 2)
}
}
});
});
});
// validates a URL
function isURL(str) {
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
return pattern.test(str);
}
function displayShortenedLink(long, short, shortUrl) {
$(".result").append("<div class='row'>");
$(".result").append("<div>" + long + ": " + "<a href='" + short + "'>" + short + "</a></div>");
$(".result").append('<div> QR Code: <img src=' +
'"https://api.qrserver.com/v1/create-qr-code/?size=150x150&bgcolor=f5f5f5&data=' + short +'"></div>');
$(".result").append(' <div type="button" class="btn btn-default pull-right" data-clipboard-text="' + shortUrl + '">Copy</div>');
$(".result").append('<a class="btn btn-default" href="/detail'+short+'" role="button">Statistiken zum Link</a>');
$(".result").append("</div>");
}
var rand = function() {
return Math.random().toString(36).substr(20); // remove `0.`
};
var token = function() {
return rand() + rand(); // to make it longer
};
|
JavaScript
| 0.000001 |
@@ -222,42 +222,8 @@
');%0A
- console.log($form.val());%0A
@@ -317,31 +317,20 @@
code%22: $
-(%22.login-
form
-%22)
.val()%0A
@@ -343,35 +343,8 @@
%7D;%0A
- console.log(code);%0A
@@ -1666,67 +1666,8 @@
%22%22;%0A
- console.log(url);%0A console.log(customLink);%0A
|
2cfca8408c94984440ef0058b28157f9e225952a
|
fix answer
|
node/routes/answer.js
|
node/routes/answer.js
|
var express = require('express');
var router = express.Router();
var result = require('./result');
//TODO
var source_url = {sick: '/gakf/askDoctor.html', doctor: '/gakf/question.html'};
var target_url = {sick: '/gakf/askDoctor.html', doctor: '/gakf/question.html'};
router.get('/message', function (req, res, next) {
var session_id = req.param('session_id');
var pageNo = req.param('page_no') || 0;
var pageSize = req.param('page_no') || 10;
req.models.message.find({session_id: 'session_id'}).order("-id")
.limit(pageSize).offset(pageNo * pageSize).run(function (err, data) {
if (err) {
res.json(result(false, '', err));
} else {
res.json(result(true, '', data));
}
});
});
router.get('/session', function (req, res, next) {
var sick_id = req.param('sick_id');
var doctor_id = req.param('doctor_id');
var pageNo = req.param('page_no') || 0, pageSize = req.param('page_size') || 10;
console.info('sick_id=' + sick_id + ",doctor_id=" + doctor_id
+ ",page_no=" + pageNo + ",pageSize=" + pageSize);
var query = {};
if (sick_id) {
query.sick_id = sick_id;
}
if (doctor_id) {
query.doctor_id = doctor_id;
}
req.models.message_session.find(query).order("-id").limit(pageSize).offset(pageNo * pageSize)
.run(function (err, data) {
if (err) {
console.error(err);
res.json(result(false, '', {}));
} else {
res.json(result(true, '', data));
}
});
});
router.post('/speak', function (req, res, next) {
//生成multiparty对象,并配置下载目标路径
var form = new multiparty.Form({uploadDir: './public/images/'});
//下载后处理
form.parse(req, function (err, fields, files) {
var filesTmp = JSON.stringify(files, null, 2);
var session_id, sick_id, doctor_id, name, id, content, title, type;
try {
session_id = fields['session_id'];
sick_id = fields['sick_id'];
doctor_id = fields['doctor_id'];
name = fields['name'];
content = fields['content'];
title = fields['title'];
id = sick_id || doctor_id;
type = sick_id ? "sick" : "doctor";
} catch (e) {
console.error(e);
err = e;
}
if (err) {
console.log('parse image error: ' + err);
res.redirect(source_url[type] + "?err=1");
} else {
console.log('parse files: ' + filesTmp);
var pic = [];
for (var i = 0; i < files.inputFile.length; i++) {
pic[i] = files.inputFile[i].path;
}
if (!session_id) {
var msg = {
day: new Date(),
title: title,
content: content,
speaker: name,
speaker_id: id
};
req.models.message_session.create({
day: new Date(),
sick_id: id,
doctor_id: doctor_id,
message: msg
}, function (err, item) {
msg.session_id = item.id;
req.models.message.create(msg, function (err) {
if (err) {
res.redirect(source_url[type] + "?err=2");
} else {
res.redirect(target_url[type]);
}
});
});
} else {
req.models.message.create({
session_id: session_id,
day: new Date(),
title: title,
content: content,
speaker: name,
speaker_id: id
}, function (err, item) {
if (err) {
res.redirect(source_url[type] + "?err=2");
} else {
res.redirect(target_url[type]);
}
});
}
}
});
});
module.exports = router;
|
JavaScript
| 0.999999 |
@@ -1418,44 +1418,8 @@
) %7B%0A
- console.error(err);%0A
|
561105c1cf3a17a1fef87ce4102f029f846c649c
|
Add default material for the pile area
|
src/components/fragments/fragments-defaults.js
|
src/components/fragments/fragments-defaults.js
|
import * as THREE from 'three';
import threeLine2d from 'three-line-2d';
import threeLine2dShader from 'three-line-2d-shader';
import COLOR from 'configs/colors';
import pileColors from 'components/fragments/pile-colors';
export const ANIMATION = true;
export const ARRANGE_MEASURES = [];
export const CAT_DATASET = 'dataset';
export const CAT_ZOOMOUT_LEVEL = 'zoomout-level';
export const CELL_SIZE = 6;
export const CELL_SIZE_HALF = CELL_SIZE / 2;
export const CELL_THRESHOLD = 0.0; // only cells above are shown
export const CLICK_DELAY_TIME = 300;
export const CLUSTER_TSNE = '_cluster_tsne';
export const DBL_CLICK_DELAY_TIME = 250;
/**
* External config to initialize fragments.
*
* @description
* The config is different from the visual state of the app.
*
* @type {Object}
*/
export const CONFIG = {};
export const DIAGONAL_VALUE = 0.11;
export const DURATION = 250;
export const FONT_URL = 'src/assets/fonts/rubik-regular.json';
export const FPS = 25;
export const GRID_CELL_SIZE_LOCK = true;
export const GRID_SIZE = CELL_SIZE;
export const HILBERT_CURVE = false;
export const HIGHLIGHT_FRAME_LINE_WIDTH = 5;
export const HIGLASS_SUB_SELECTION = true;
export const LABEL_DIST = 60;
export const LABEL_WIDTH = 130;
export const LABEL_TEXT_SPEC = {
size: 6,
height: 1,
curveSegments: 3
};
export const LASSO_IS_ROUND = true;
export const LINE = threeLine2d(THREE);
export const LINE_SHADER = threeLine2dShader(THREE);
export const LASSO_LINE_WIDTH = 2;
export const LASSO_MIN_MOVE = 0.033;
export const LASSO_SHADER = threeLine2dShader(THREE)({
side: THREE.DoubleSide,
diffuse: COLOR.PRIMARY,
thickness: LASSO_LINE_WIDTH
});
export const LASSO_MATERIAL = new THREE.ShaderMaterial(LASSO_SHADER);
export const LETTER_SPACE = 6;
export const MARGIN_BOTTOM = 2;
export const MARGIN_LEFT = 2;
export const MARGIN_RIGHT = 2;
export const MARGIN_TOP = 2;
export const MATRICES_COLORS = {};
export const MATRIX_FRAME_ENCODING = null;
export const MATRIX_FRAME_THICKNESS = 2;
export const MATRIX_FRAME_THICKNESS_MAX = 10;
export const MATRIX_GAP_HORIZONTAL = 6;
export const MATRIX_GAP_VERTICAL = 6;
export const MATRIX_ORIENTATION_UNDEF = 0;
export const MATRIX_ORIENTATION_INITIAL = 1;
export const MATRIX_ORIENTATION_5_TO_3 = 2;
export const MATRIX_ORIENTATION_3_TO_5 = 3;
/**
* Mean
*
* @type {Number}
*/
export const MODE_MEAN = 0;
/**
* Mean average deviation
*
* @type {Number}
*/
export const MODE_MAD = 1;
/**
* Standard deviaton
*
* @type {Number}
*/
export const MODE_STD = 2;
export const ORDER_DATA = 0;
export const ORDER_GLOBAL = 1;
export const ORDER_LOCAL = 2;
export const PILE_LABEL_HEIGHT = 10;
export const PILE_MENU_CLOSING_DELAY = 200;
export const PILES = {};
export const PILE_COLORS_CATEGORICAL = pileColors.categorical.length;
export const PREVIEW_SIZE = 2;
export const PREVIEW_MAX = 8;
export const SHADER_ATTRIBUTES = {
customColor: { type: 'c', value: [] }
};
export const SHOW_MATRICES = 1000;
export const SHOW_SPECIAL_CELLS = false;
export const SVG_MENU_HEIGHT = 30;
export const TIMELINE_HEIGHT = 130;
/**
* Three.js's WebGL config
*
* @type {Object}
*/
export const WEB_GL_CONFIG = {
alpha: true,
antialias: true
};
export const Z_BASE = 1;
export const Z_DRAG = 2;
export const Z_HIGHLIGHT = 1.5;
export const Z_LASSO = 2;
export const Z_MENU = 4;
export const Z_STACK_PILE_TARGET = 2;
export const ZOOM_DELAY_TIME = 500;
|
JavaScript
| 0 |
@@ -133,16 +133,17 @@
rt COLOR
+S
from 'c
@@ -1635,16 +1635,17 @@
e: COLOR
+S
.PRIMARY
@@ -1938,32 +1938,443 @@
S_COLORS = %7B%7D;%0A%0A
+export const PILE_AREA_BG = new THREE.MeshBasicMaterial(%7B%0A color: COLORS.PRIMARY,%0A transparent: true,%0A opacity: 0.2%0A%7D);%0A%0Aexport const PILE_AREA_BORDER = new THREE.ShaderMaterial(LINE_SHADER(%7B%0A side: THREE.DoubleSide,%0A diffuse: COLORS.PRIMARY,%0A thickness: 1,%0A opacity: 0.5%0A%7D));%0A%0Aexport const PILE_AREA_POINTS = new THREE.MeshBasicMaterial(%7B%0A color: COLORS.PRIMARY,%0A transparent: true,%0A opacity: 1%0A%7D);%0A%0A
export const MAT
@@ -3747,17 +3747,53 @@
LIGHT =
-1
+3;%0A%0Aexport const Z_HIGHLIGHT_AREA = 2
.5;%0A%0Aexp
@@ -3812,17 +3812,17 @@
LASSO =
-2
+9
;%0A%0Aexpor
@@ -3842,9 +3842,9 @@
U =
-4
+9
;%0A%0Ae
|
01bc69839c6b20ba4c3327f7382a445dbd37962b
|
enable desktop ga
|
src/ui/analytics.js
|
src/ui/analytics.js
|
// @flow
import { Lbryio } from 'lbryinc';
import ReactGA from 'react-ga';
import { history } from './store';
type Analytics = {
pageView: string => void,
setUser: Object => void,
toggle: (boolean, ?boolean) => void,
apiLogView: (string, string, string, ?number, ?() => void) => void,
apiLogPublish: () => void,
};
let analyticsEnabled: boolean = true;
const analytics: Analytics = {
pageView: path => {
if (analyticsEnabled) {
ReactGA.pageview(path, IS_WEB ? ['web'] : ['desktop']);
}
},
setUser: user => {
// Commented out because currently there is some delay before we know the user
// We should retrieve this server side so we have it immediately
// if (analyticsEnabled && user.id) {
// ReactGA.set('userId', user.id);
// }
},
toggle: (enabled: boolean): void => {
// Always collect analytics on lbry.tv
// @if TARGET='app'
analyticsEnabled = enabled;
// @endif
},
apiLogView: (uri, outpoint, claimId, timeToStart, onSuccessCb) => {
if (analyticsEnabled) {
const params: {
uri: string,
outpoint: string,
claim_id: string,
time_to_start?: number,
} = {
uri,
outpoint,
claim_id: claimId,
};
if (timeToStart) {
params.time_to_start = timeToStart;
}
Lbryio.call('file', 'view', params)
.then(() => {
if (onSuccessCb) {
onSuccessCb();
}
})
.catch(() => {});
}
},
apiLogSearch: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'search');
}
},
apiLogPublish: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'publish');
}
},
apiSearchFeedback: (query, vote) => {
// We don't need to worry about analytics enabled here because users manually click on the button to provide feedback
Lbryio.call('feedback', 'search', { query, vote });
},
};
// Initialize google analytics
// Set `debug: true` for debug info
// Will change once we have separate ids for desktop/web
const UA_ID = IS_WEB ? 'UA-60403362-12' : 'UA-60403362-12';
ReactGA.initialize(UA_ID, {
gaOptions: { name: IS_WEB ? 'web' : 'desktop' },
testMode: process.env.NODE_ENV !== 'production',
// debug: true,
});
// Manually call the first page view
// React Router doesn't include this on `history.listen`
analytics.pageView(window.location.pathname + window.location.search);
// Listen for url changes and report
// This will include search queries
history.listen(location => {
const { pathname, search } = location;
const page = `${pathname}${search}`;
analytics.pageView(page);
});
export default analytics;
|
JavaScript
| 0.000001 |
@@ -2114,17 +2114,17 @@
403362-1
-2
+3
';%0A%0AReac
|
3bdb5afcc88ef9dcdfef47434633abdc4a0ca77f
|
Fix Queue test.
|
prolific.queue/t/queue.t.js
|
prolific.queue/t/queue.t.js
|
require('proof')(2, require('cadence')(prove))
function prove (async, assert) {
var stream = require('stream')
var Queue = require('../queue')
var queue
async(function () {
queue = new Queue(new stream.PassThrough)
queue.write(1 + '\n')
queue.write(2 + '\n')
queue.write(3 + '\n')
queue.flush(async())
}, function () {
var chunk = queue._stream.read().toString()
assert(chunk, '% 0 aaaaaaaa 811c9dc5 1\n% 1 811c9dc5 fdaf7437 6\n1\n2\n3\n', 'initialize')
queue.flush(async())
}, function () {
queue.exit(null)
queue.exit(null)
queue.flush(async())
}, function () {
queue = new Queue(new stream.PassThrough)
var stderr = new stream.PassThrough
queue.exit(stderr)
var chunk = stderr.read().toString()
assert(chunk, '% 0 aaaaaaaa 811c9dc5 0\n% 0 aaaaaaaa 811c9dc5 1\n', 'exit')
})
}
|
JavaScript
| 0 |
@@ -888,32 +888,32 @@
9dc5 0%5Cn%25 0
-aaaaaaaa
+811c9dc5
811c9dc5 1%5C
|
2809b585a576459257467d016ecb9707734c76a6
|
Exit completion mode when a completion is made
|
src/search_form.js
|
src/search_form.js
|
// SearchFormView
define(function (require) {
var _ = require('underscore'),
$ = require('jquery'),
Backbone = require('backbone'),
Handlebars = require('handlebars'),
search_form_tmpl = require('text!./tmpl/search_form.html'),
filter_to_matching_stems = require('./filter_to_matching_stems'),
SuggestionsView = require('./suggestions');
var SearchFormView = Backbone.View.extend({
tagName: 'form',
className: 'navbar-form navbar-left',
template: Handlebars.compile(search_form_tmpl),
events: {
'change input': 'set_query',
'keyup input': 'set_query',
'input input': 'set_query',
'keydown input': 'domain_match'
},
initialize: function(options) {
var t = this;
t.query_model = options.query_model;
t.domain_list_model = options.domain_list_model;
_.bindAll(t, 'set_query');
t.listenTo(t.query_model, 'change:domain', t.render);
t.suggestions_model = new Backbone.Model();
t.suggestions_view = new SuggestionsView({
suggestions_model: t.suggestions_model
});
},
render: function() {
var t = this;
t.$el.html(t.template(t.query_model.toJSON()));
t.$el.append(t.suggestions_view.render().el);
// Determine size of domain bubble and adjust input width
var bubble = t.$('.domain-bubble');
if (bubble.length > 0) {
var bubble_width = bubble.outerWidth();
t.$('input').css('padding-left', bubble_width + 6);
}
return t;
},
domain_match: function(e) {
// If tab is pressed, check for a domain match.
var t = this;
var search_val = t.$('input').val();
// If we don't already have a domain filter, try to complete one.
if (!t.query_model.get('domain')) {
// Step 1: Filter to domains with stems matching the search string.
var domains_matching_stem = filter_to_matching_stems({
search: search_val,
array: t.domain_list_model.get('domains')
});
if (e.keyCode == '9') {
e.preventDefault();
// Step 2: Set domain on query model if exact match
// and if this is the second time the user hits tab after
// a completion.
if (t.in_completion) {
if (domains_matching_stem.length === 1) {
t.query_model.set('domain', search_val);
t.$('input').val('');
t.suggestions_model.unset('suggestions');
return;
} else {
// Render a list of suggestions if multiple matches
t.suggestions_model.set('suggestions', domains_matching_stem);
}
}
// Keep track of when we are in the middle of a completion.
if (domains_matching_stem.length > 0) {
t.in_completion = true;
// Step 3: Find longest stem matching all filtered domains.
var initial_stem_length = search_val.length + 1;
var domain_match = domains_matching_stem[0];
var max_stem_length = domain_match.length;
var longest_matching_stem = search_val;
console.log(domains_matching_stem);
for (var i = initial_stem_length; i < max_stem_length; i++) {
var new_stem = domain_match.slice(0, i);
var all_matching = _.all(domains_matching_stem, function(domain) {
return new_stem === domain.slice(0, i);
});
if (!all_matching) {
break;
} else {
longest_matching_stem = new_stem;
}
}
console.log(longest_matching_stem);
t.$('input').val(longest_matching_stem);
}
} else {
// If tab is not pressed, remove suggestions.
t.suggestions_model.unset('suggestions');
// If we are in the middle of a completion, and space
// is pressed...
if (t.in_completion && e.keyCode == '32') {
console.log('in completion, space pressed');
// And the matches contain an exact match, finish the completion
// with the search value.
if (_.contains(domains_matching_stem, search_val)) {
e.preventDefault();
t.query_model.set('domain', search_val.trim());
t.$('input').val('');
return;
}
}
t.in_completion = false;
}
}
},
set_query: function() {
var t = this;
var search_val = t.$('input').val();
if (search_val.length > 2 && !t.in_completion) {
t.query_model.set('search', search_val);
} else {
// Unset the search if there are fewer than 3 characters
// or if we are in the middle of a completion.
t.query_model.set('search', undefined);
}
}
});
return SearchFormView;
});
|
JavaScript
| 0.000001 |
@@ -2497,32 +2497,72 @@
'suggestions');%0A
+ t.in_completion = false;%0A
r
@@ -4500,39 +4500,16 @@
al('');%0A
- return;%0A
|
e405749fe5ab5e5fe518fdf3ce0c38b301f0ad8c
|
Move the onClick from the wrapper to the status bullet
|
src/components/progressTracker/ProgressStep.js
|
src/components/progressTracker/ProgressStep.js
|
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import theme from './theme.css';
import Box from '../box';
import { TextSmall } from '../typography';
class ProgressStep extends PureComponent {
render() {
const { label, active, completed, onClick } = this.props;
const classNames = cx(theme['step'], {
[theme['is-active']]: active,
[theme['is-completed']]: completed,
[theme['is-clickable']]: onClick,
});
return (
<Box className={classNames} onClick={onClick}>
<TextSmall className={theme['step-label']}>{label}</TextSmall>
<span className={theme['status-bullet']} />
</Box>
);
}
}
ProgressStep.propTypes = {
/** The label for the progress step */
label: PropTypes.string.isRequired,
/** Whether or not the step is active */
active: PropTypes.bool.isRequired,
/** Whether or not the step has been completed */
completed: PropTypes.bool.isRequired,
/** Callback function that is fired when the progress step is clicked */
onClick: PropTypes.func,
};
ProgressStep.defaultProps = {
active: false,
completed: false,
};
export default ProgressStep;
|
JavaScript
| 0.000001 |
@@ -545,26 +545,8 @@
mes%7D
- onClick=%7BonClick%7D
%3E%0A
@@ -662,16 +662,34 @@
ullet'%5D%7D
+ onClick=%7BonClick%7D
/%3E%0A
|
f39dd81176d5a0d1d543261d0be13750244c4067
|
Add placeholder abilities route callback.
|
inspect.js
|
inspect.js
|
module.exports = function(app, settings) {
app.get('/status.json', function(req, res) {
res.send({ status: 'true' });
});
/**
* Inspect fields
*/
app.get('/:mapfile_64/fields.json', function(req, res) {
});
/**
* Inspect data
*/
app.get('/:mapfile_64/data.json', function(req, res) {
});
/**
* Inspect layer
*/
app.get('/:mapfile_64/:layer_64/layer.json', function(req, res) {
});
/**
* Inspect field values
*/
app.get('/:mapfile_64/:layer_64/:feature_64/values.json', function(req, res) {
});
}
|
JavaScript
| 0 |
@@ -124,32 +124,203 @@
e' %7D);%0A %7D);%0A%0A
+ /**%0A * @TODO expose available fonts (and other 'abilities').%0A */%0A app.get('/abilities.json', function(req, res) %7B%0A res.send(%7B fonts: %5B%5D %7D);%0A %7D);%0A%0A
/**%0A * I
|
78baf93f29c3bbb10f1544a0b6749d2ba2c52c95
|
Verify dependency for "Typosquatting Tier 1" is leaked
|
test/api/ftpFolderSpec.js
|
test/api/ftpFolderSpec.js
|
const frisby = require('frisby')
const URL = 'http://localhost:3000'
describe('/ftp', () => {
it('GET serves a directory listing', () => {
return frisby.get(URL + '/ftp')
.expect('status', 200)
.expect('header', 'content-type', /text\/html/)
.expect('bodyContains', '<title>listing directory /ftp</title>')
})
it('GET a non-existing Markdown file in /ftp will return a 404 error', () => {
return frisby.get(URL + '/ftp/doesnotexist.md')
.expect('status', 404)
})
it('GET a non-existing PDF file in /ftp will return a 404 error', () => {
return frisby.get(URL + '/ftp/doesnotexist.pdf')
.expect('status', 404)
})
it('GET a non-existing file in /ftp will return a 403 error for invalid file type', () => {
return frisby.get(URL + '/ftp/doesnotexist.exe')
.expect('status', 403)
})
it('GET an existing file in /ftp will return a 403 error for invalid file type .gg', () => {
return frisby.get(URL + '/ftp/eastere.gg')
.expect('status', 403)
})
it('GET existing file /ftp/coupons_2013.md.bak will return a 403 error for invalid file type .bak', () => {
return frisby.get(URL + '/ftp/coupons_2013.md.bak')
.expect('status', 403)
})
it('GET existing file /ftp/package.json.bak will return a 403 error for invalid file type .bak', () => {
return frisby.get(URL + '/ftp/package.json.bak')
.expect('status', 403)
})
it('GET existing file /ftp/suspicious_errors.yml will return a 403 error for invalid file type .yml', () => {
return frisby.get(URL + '/ftp/suspicious_errors.yml')
.expect('status', 403)
})
it('GET the confidential file in /ftp', () => {
return frisby.get(URL + '/ftp/acquisitions.md')
.expect('status', 200)
.expect('bodyContains', '# Planned Acquisitions')
})
it('GET the KeePass database in /ftp', () => {
return frisby.get(URL + '/ftp/incident-support.kdbx')
.expect('status', 200)
})
it('GET the easter egg file by using Poison Null Byte attack with .pdf suffix', () => {
return frisby.get(URL + '/ftp/eastere.gg%00.pdf')
.expect('status', 200)
.expect('bodyContains', 'Congratulations, you found the easter egg!')
})
it('GET the easter egg file by using Poison Null Byte attack with .md suffix', () => {
return frisby.get(URL + '/ftp/eastere.gg%00.md')
.expect('status', 200)
.expect('bodyContains', 'Congratulations, you found the easter egg!')
})
it('GET the SIEM signature file by using Poison Null Byte attack with .pdf suffix', () => {
return frisby.get(URL + '/ftp/suspicious_errors.yml%00.pdf')
.expect('status', 200)
.expect('bodyContains', 'Suspicious error messages specific to the application')
})
it('GET the SIEM signature file by using Poison Null Byte attack with .md suffix', () => {
return frisby.get(URL + '/ftp/suspicious_errors.yml%00.md')
.expect('status', 200)
.expect('bodyContains', 'Suspicious error messages specific to the application')
})
it('GET the 2013 coupon code file by using Poison Null Byte attack with .pdf suffix', () => {
return frisby.get(URL + '/ftp/coupons_2013.md.bak%00.pdf')
.expect('status', 200)
.expect('bodyContains', 'n<MibgC7sn')
})
it('GET the 2013 coupon code file by using an Poison Null Byte attack with .md suffix', () => {
return frisby.get(URL + '/ftp/coupons_2013.md.bak%00.md')
.expect('status', 200)
.expect('bodyContains', 'n<MibgC7sn')
})
it('GET the package.json file by using Poison Null Byte attack with .pdf suffix', () => {
return frisby.get(URL + '/ftp/package.json.bak%00.pdf')
.expect('status', 200)
.expect('bodyContains', '"name": "juice-shop",')
})
it('GET the package.json file by using Poison Null Byte attack with .md suffix', () => {
return frisby.get(URL + '/ftp/package.json.bak%00.md')
.expect('status', 200)
.expect('bodyContains', '"name": "juice-shop",')
})
it('GET a restricted file directly from file system path on server by tricking route definitions fails with 403 error', () => {
return frisby.get(URL + '/ftp///eastere.gg')
.expect('status', 403)
})
it('GET a restricted file directly from file system path on server by appending URL parameter fails with 403 error', () => {
return frisby.get(URL + '/ftp/eastere.gg?.md')
.expect('status', 403)
})
it('GET a file whose name contains a "/" fails with a 403 error', () => {
frisby.fetch(URL + '/ftp/%2fetc%2fos-release%2500.md', {}, { urlEncode: false })
.expect('status', 403)
.expect('bodyContains', 'Error: File names cannot contain forward slashes!')
})
it('GET an accessible file directly from file system path on server', () => {
return frisby.get(URL + '/ftp/legal.md')
.expect('status', 200)
.expect('bodyContains', '# Legal Information')
})
it('GET a non-existing file via direct server file path /ftp will return a 404 error', () => {
return frisby.get(URL + '/ftp/doesnotexist.md')
.expect('status', 404)
})
})
|
JavaScript
| 0 |
@@ -3521,32 +3521,36 @@
the package.json
+.bak
file by using P
@@ -3775,16 +3775,20 @@
age.json
+.bak
file by
@@ -5094,12 +5094,282 @@
04)%0A %7D)
+%0A%0A it('GET the package.json.bak file contains a dependency on epilogue-js for %22Typosquatting Tier 1%22 challenge', () =%3E %7B%0A return frisby.get(URL + '/ftp/package.json.bak%2500.md')%0A .expect('status', 200)%0A .expect('bodyContains', '%22epilogue-js%22: %22~0.7%22,')%0A %7D)
%0A%7D)%0A
|
f86cd214bfa96389082b40fca0334db45731cfaf
|
fix postinstall path issue
|
install.js
|
install.js
|
var fs = require('fs')
fs.writeFile(__dirname + '/gulpfile.js', 'console.log("Hello, World!")', function (err) {
if (err) {
return console.log(err)
}
console.log('Gulpfile created!')
})
|
JavaScript
| 0.000001 |
@@ -16,16 +16,52 @@
e('fs')%0A
+console.log('dir: ' + process.cwd())
%0Afs.writ
@@ -70,17 +70,21 @@
ile(
-__dirname
+process.cwd()
+ '
|
1f3b63673fd4302276191f91aaf8694c629c7fdf
|
Use SSH to clone project
|
install.js
|
install.js
|
const fs = require("fs"),
exec = require('child_process').exec,
modules = [
"stc",
"stc-eslint",
"stc-babel",
"stc-typescript",
"stc-uglify",
"stc-dep-parser",
"stc-plugin",
"stc-file",
"stc-cluster",
"stc-cache",
"stc-demo",
"stc-plugin-invoke",
"stc-helper",
"stc-replace",
"stc-cli",
"stc-log",
"stc-css-combine"
],
STR_DASH = "========================================",
REG_LOCAL = /^stc[\w-]*$/,
REG_DEMO_DIR = /stc-demo$/;
var currentJob = "",
totalPassed = 0;
Promise.resolve()
.then(curryTask("Making stcjs dir", () => {
if (isInStcDemo()) {
console.log("In dir stc-demo, doesn't require so.");
return;
}
return folderExistsPromise('stcjs')
.catch(() => execPromise("mkdir stcjs"));
}))
.then(curryTask("Switching folder to stcjs", () => {
if (isInStcDemo()) {
process.chdir('../');
} else {
process.chdir('stcjs');
}
console.log('Current directory: ' + process.cwd());
}))
.then(curryTask("Git Cloning or pulling", () => {
return Promise.all(modules.map((name) => {
return folderExistsPromise(name, true)
.then(() => execPromise('git branch | grep "* master" && git pull origin master', { cwd: name }).catch(() => {
console.log(`${name} is not on master branch, ignore.`)
}))
.catch(() => execPromise(`git clone https://github.com/stcjs/${name}/`));
}))
}))
.then(curryTask("Making folder node_modules", () => {
return folderExistsPromise('node_modules')
.catch(() => execPromise("mkdir node_modules")); // todo using `fs.mkdir`
}))
.then(curryTask("Making symbol link for stc projects in node_modules", () => {
return Promise.all(modules.map((name) => {
return folderExistsPromise(`node_modules/${name}`)
.catch(() => execPromise(`ln -s ../${name} ${name}`, {
cwd: `node_modules`
}));
}));
}))
.then(curryTask("Resolving all `package.json` & generating one", () => {
return resolvePackageJSON()
}))
.then(curryTask("Installing npm package", () => {
return execPromise("npm install --registry=https://registry.npm.taobao.org", {
pipe: true
})
}))
.then(() => {
console.log(`${STR_DASH}\nAll done.`);
})
.catch((err) => {
console.error(`${STR_DASH}\nError during task: ${currentJob}`);
console.error(err);
});
function isInStcDemo() {
return REG_DEMO_DIR.test(process.cwd());
}
function curryTask(taskName, fn) {
return function () {
var startTime = +new Date();
currentJob = taskName;
console.log(`${STR_DASH}\nTask start: ${currentJob}`);
return (fn() || Promise.resolve())
.then(() => {
var passed = new Date() - startTime;
totalPassed += passed;
console.log(`Task done after: ${passed}ms, total passed time: ${totalPassed}ms.`)
});
}
}
function resolvePackageJSON() {
var package = {
dependencies: {},
devDependencies: {}
};
return Promise.all(
modules.map((name) => {
var dir = `${name}/package.json`;
return readJSONPromise(dir)
.then((data) => {
setKey(data, "dependencies");
setKey(data, "devDependencies");
})
.then(() => {
console.log(`Parsed\t${dir}`);
})
.catch((err) => {
console.log(`Error\t${dir}`);
// console.error(err);
});
})
).then(() => writeJSONPromise(`package.json`, package));
function setKey(data, base) {
for (var key in data[base]) {
if (REG_LOCAL.test(key)) {
continue;
}
if (!package[base][key] || package[base][key] > data[base][key]) {
package[base][key] = data[base][key];
}
}
}
function readJSONPromise(file) {
return new Promise((resolve, reject) => {
fs.readFile(file, "utf-8", (err, data) => {
if (err) {
reject(err);
return;
}
resolve(
JSON.parse(data.toString())
);
});
});
}
function writeJSONPromise(file, json) {
return new Promise((resolve, reject) => {
fs.writeFile(file, JSON.stringify(json, null, '\t'), "utf-8", (err, data) => {
if (err) {
reject(err);
return;
}
resolve();
});
});
}
}
function folderExistsPromise(folder, mute) {
return new Promise((resolve, reject) => {
fs.access(folder, fs.R_OK, (err) => {
if (err) {
reject(err);
return;
}
resolve();
});
}).then(() => {
!mute && console.log(`Folder "${folder}" exists.`);
});
}
function execPromise(cmd, options) {
console.log(`${cmd}${options && options.cwd && ("\t@" + options.cwd) || ""}`);
var promise = new Promise((resolve, reject) => {
var event = exec(cmd, options, (err, stdout, stderr) => {
if (err) {
reject(err);
return;
}
resolve();
});
if (options && options.pipe) {
event.stdout.pipe(process.stdout);
event.stderr.pipe(process.stderr);
}
});
return promise;
}
|
JavaScript
| 0 |
@@ -1313,24 +1313,20 @@
t clone
-https://
+git@
github.c
@@ -1327,17 +1327,17 @@
thub.com
-/
+:
stcjs/$%7B
|
19ed82f2eab0d677e67b364c5bde5ed78f509c19
|
change untested methods to TODOs
|
test/connectionmanager.js
|
test/connectionmanager.js
|
describe('ConnectionManager', function() {
it('constructor');
it('inherits from EventEmitter');
it('initialize', function() {
});
it('_startPeerConnection', function() {
});
it('_processQueue', function() {
});
it('_setupIce', function() {
});
it('_setupNegotiationHandler', function() {
});
it('_setupDataChannel', function() {
});
it('_makeOffer', function() {
});
it('_makeAnswer', function() {
});
it('_cleanup', function() {
});
it('_attachConnectionListeners', function() {
});
it('handleSDP', function() {
});
it('handleCandidate', function() {
});
it('handleLeave', function() {
});
it('close', function() {
});
it('connect', function() {
});
it('update', function() {
});
});
|
JavaScript
| 0.000001 |
@@ -106,271 +106,26 @@
it('
-initialize', function() %7B%0A%0A %7D);%0A%0A it('_startPeerConnection', function() %7B%0A%0A %7D);%0A%0A it('_processQueue', function() %7B%0A%0A %7D);%0A%0A it('_setupIce', function() %7B%0A%0A %7D);%0A%0A it('_setupNegotiationHandler', function() %7B%0A%0A %7D);%0A%0A it('_setupDataChannel', function() %7B%0A%0A %7D
+_setupDataChannel'
);%0A%0A
@@ -141,35 +141,16 @@
keOffer'
-, function() %7B%0A%0A %7D
);%0A%0A it
@@ -167,65 +167,27 @@
wer'
-, function() %7B%0A%0A %7D);%0A%0A it('_cleanup', function() %7B%0A%0A %7D
+);%0A%0A it('_cleanup'
);%0A%0A
@@ -219,35 +219,16 @@
steners'
-, function() %7B%0A%0A %7D
);%0A%0A it
@@ -239,35 +239,16 @@
ndleSDP'
-, function() %7B%0A%0A %7D
);%0A%0A it
@@ -265,35 +265,16 @@
ndidate'
-, function() %7B%0A%0A %7D
);%0A%0A it
@@ -291,135 +291,59 @@
ave'
-, function() %7B%0A%0A %7D);%0A%0A it('close', function() %7B%0A%0A %7D);%0A%0A it('connect', function() %7B%0A%0A %7D);%0A%0A it('update', function() %7B%0A%0A %7D
+);%0A%0A it('close');%0A%0A it('connect');%0A%0A it('update'
);%0A%0A
|
c843a4431354da1f7b47dc940238270455a22a77
|
Fix test
|
test/extract_spec/sail.js
|
test/extract_spec/sail.js
|
'use strict'
var should = require('should')
var lodash = require('lodash')
module.exports = function (extract) {
describe('sails', function () {
it('brand with model', function () {
[
'loftsails racing blade',
'loft sails racingblade',
'loft racing blade'
].forEach(function (title) {
extract.sail(title).should.be.eql({
brand: 'Loft Sails',
model: 'Racing Blade'
})
})
})
it('size', function () {
var size = lodash.get(extract.sail(''), 'size')
should(size).be.undefined()
;[
'7 0',
'7.0',
'7,0',
"7'0",
'7.0m',
'7,0m',
"7'0m"
].forEach(function (sailSize) {
var size = lodash.get(extract.sail(sailSize), 'size')
size.should.be.equal('7.0')
})
})
})
}
|
JavaScript
| 0.000004 |
@@ -392,14 +392,8 @@
Loft
- Sails
',%0A
|
f069c5c7c7ef52248c842d784ac8bb746281d442
|
add in MQTT bindings through cfg certs
|
homestar.js
|
homestar.js
|
/*
* homestar.js
*
* David Janes
* IOTDB.org
* 2016-03-16
*
* Copyright [2013-2016] [David P. Janes]
*
* 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";
const iotdb = require('iotdb');
const _ = iotdb._;
const cfg = iotdb.cfg;
const path = require('path')
const fs = require('fs')
const url = require('url')
const MQTTTransport = require('iotdb-transport-mqtt').Transport;
const IOTDBTransport = require('iotdb-transport-iotdb').Transport;
const logger = iotdb.logger({
name: 'homestar-homestar',
module: 'homestar',
});
/*
var transport = new MQTTTransport({
host: "A1GOKL7JWGA91X.iot.us-east-1.amazonaws.com",
prefix: "iotdb/homestar/0/81EA6324-418D-459C-A9C4-D430F30021C7/alexa",
ca: path.join(__dirname, "certs/rootCA.pem"),
cert: path.join(__dirname, "certs/cert.pem"),
key: path.join(__dirname, "certs/private.pem"),
allow_updated: true,
});
*/
const mqtt_transport = function(locals) {
const certificate_id = _.d.get(locals.homestar.settings, "aws/mqtt/certificate_id");
if (!certificate_id) {
logger.error({
method: "mqtt_transport",
cause: "likely you haven't set up module homestar-homestar correctly",
}, "missing settings.aws.mqtt.certificate_id");
return null;
}
const search = [".iotdb", "$HOME/.iotdb", ];
const folder_name = path.join("certs", certificate_id);
const folders = cfg.cfg_find(cfg.cfg_envd(), search, folder_name);
if (folders.length === 0) {
logger.error({
method: "mqtt_transport",
search: [".iotdb", "$HOME/.iotdb", ],
folder_name: path.join("certs", certificate_id),
cause: "are you running in the wrong folder - check .iotdb/certs",
}, "could not find the 'certs' folder");
return null;
}
const cert_folder = folders[0];
const aws_url = _.d.get(locals.homestar.settings, "aws/mqtt/url");
const aws_urlp = url.parse(aws_url);
return new MQTTTransport({
host: aws_urlp.host,
prefix: aws_urlp.path.replace(/^\//, ''),
ca: path.join(cert_folder, "rootCA.pem"),
cert: path.join(cert_folder, "cert.pem"),
key: path.join(cert_folder, "private.pem"),
allow_updated: true,
});
};
/**
* Functions defined in index.setup
*/
var on_ready = function(locals) {
console.log("on_ready");
// console.log("HERE:XXX", locals.homestar.settings.aws);
// console.log(locals.homestar.things);
// console.log(locals.homestar.recipes);
mqtt_transport(locals);
process.exit();
/*
transport.updated({
id: 'FirstIntent',
band: 'command',
}, function(error, ud) {
if (error) {
console.log("#", error);
return;
}
console.log("+", ud.value);
});
*/
};
exports.on_ready = on_ready;
|
JavaScript
| 0 |
@@ -849,16 +849,68 @@
'url')%0A%0A
+const iotdb_transport = require('iotdb-transport');%0A
const MQ
@@ -1487,16 +1487,21 @@
%0A%0Aconst
+make_
mqtt_tra
@@ -1506,16 +1506,18 @@
ransport
+er
= funct
@@ -1682,32 +1682,37 @@
method: %22
+make_
mqtt_transport%22,
@@ -1701,32 +1701,34 @@
e_mqtt_transport
+er
%22,%0A c
@@ -2137,16 +2137,21 @@
ethod: %22
+make_
mqtt_tra
@@ -2156,16 +2156,18 @@
ransport
+er
%22,%0A
@@ -2971,99 +2971,64 @@
cons
-ole.log(%22on_ready%22);%0A // console.log(%22HERE:XXX%22, locals.homestar.settings.aw
+t mqtt_transporter = make_mqtt_transporter(local
s);%0A
@@ -3027,215 +3027,190 @@
-
- // console.log(locals.homestar.things);%0A // console.log(locals.homestar.recipes);%0A mqtt_transport(locals);%0A process.exit();%0A%0A /*%0A transport.updated(%7B%0A id: 'FirstIntent',
+const iotdb_transporter = locals.homestar.things.make_transporter();%0A const owner = locals.homestar.users.owner();%0A%0A iotdb_transport.bind(iotdb_transporter, mqtt_transporter, %7B
%0A
@@ -3222,190 +3222,163 @@
band
+s
:
-'command',%0A %7D, function(error, ud) %7B%0A if (error) %7B%0A console.log(%22#%22, error);%0A return;%0A %7D%0A%0A console.log(%22+%22, ud.value);%0A %7D);%0A */
+%5B %22meta%22, %22istate%22, %22ostate%22, %22model%22, %5D,%0A user: owner,%0A %7D);%0A%0A logger.info(%7B%0A method: %22on_ready%22,%0A %7D, %22connected AWS to Things%22);
%0A%7D;%0A
|
623d0b962a12cc603e1a45fb60c16e4ca5677cba
|
Order photos by date
|
src/actions/photo-actions.js
|
src/actions/photo-actions.js
|
import alt from './../alt';
import Photo from './../models/photo';
import Tag from './../models/tag';
class PhotoActions {
constructor() {
this.generateActions(
'getPhotosSuccess',
'getDatesSuccess',
'setDateFilterSuccess',
'updatedPhotoSuccess',
'setImporting'
);
}
updatedPhoto(e, version) {
console.log('photo actions new version', version, this);
new Photo({ id: version.attributes.photo_id })
.fetch({ withRelated: ['versions', 'tags'] })
.then((photo) => {
this.actions.updatedPhotoSuccess(photo);
});
}
getPhotos() {
Photo
.query(function (qb) {
qb.limit(100).offset(0);
})
.fetchAll({ withRelated: ['versions', 'tags'] })
.then((photos) => {
this.actions.getPhotosSuccess(photos);
});
}
getDates() {
Photo.getDates().then((dates) => {
this.actions.getDatesSuccess(dates);
});
}
getFlagged() {
new Photo()
.where({ flag: true })
.fetchAll({ withRelated: ['versions', 'tags'] })
.then((photos) => {
this.actions.getPhotosSuccess(photos);
});
}
setDateFilter(date) {
new Photo()
.where({ date: date })
.fetchAll({ withRelated: ['versions', 'tags'] })
.then((photos) => {
this.actions.getPhotosSuccess(photos);
});
}
setTagFilter(tag) {
new Tag({ id: tag.id })
.fetch({ withRelated: ['photos'] })
.then((tag) => {
let photos = tag.related('photos');
this.actions.getPhotosSuccess(photos);
});
}
startImport() {
this.actions.setImporting(true);
}
toggleFlag(photo) {
console.log('photo', photo);
new Photo({ id: photo.id })
.save('flag', !photo.flag, { patch: true })
.then(() => {
return new Photo({ id: photo.id })
.fetch({ withRelated: ['versions', 'tags'] });
})
.then((photoModel) => {
this.actions.updatedPhotoSuccess(photoModel);
})
.catch((err) => {
console.log('err toggle flag', err);
});
}
}
export default alt.createActions(PhotoActions);
|
JavaScript
| 0 |
@@ -675,16 +675,46 @@
ffset(0)
+.orderBy('created_at', 'desc')
;%0A
|
f70ab05a142c4af0eaf7d3b2ca52b9ef5fd187cf
|
fix default find breadcrumb
|
lib/router/breadcrumb.js
|
lib/router/breadcrumb.js
|
/**
* Breadcrumb handlers
*/
module.exports = {
/**
* Middleware for select the breadcrumb middleware handler
*/
middleware: function metatagMiddleware(req, res, next) {
if (res.locals.breadcrumbHandler) {
if (typeof res.locals.breadcrumbHandler === 'function') {
return res.locals.breadcrumbHandler(req, res, next);
} else if (req.we.router.breadcrumb.middlewares[res.locals.breadcrumbHandler]) {
return req.we.router.breadcrumb.middlewares[res.locals.breadcrumbHandler](req, res, next);
}
}
next();
},
/**
* Middleware handlers
*
* @type {Object}
*/
middlewares: {
/**
* Default create breadcrumb function
* @return {Array} Links array with href and text
*/
create: function createBreadcrumb(req, res, next) {
res.locals.breadcrumb =
'<ol class="breadcrumb">'+
'<li><a href="/">'+res.locals.__('Home')+'</a></li>'+
'<li><a href="'+
req.we.router.urlTo(res.locals.resourceName + '.find', req.paramsArray)+
'">'+res.locals.__(res.locals.resourceName + '.find')+'</a></li>'+
'<li class="active">'+res.locals.__(res.locals.resourceName + '.create')+'</li>'+
'</ol>';
next();
},
/**
* Default find breadcrumb function
* @return {Array} Links array with href and text
*/
find: function findBreadcrumb(req, res, next) {
res.locals.breadcrumb =
'<ol class="breadcrumb">'+
'<li href="/">'+res.locals.__('Home')+'</li>'+
'<li class="active">'+res.locals.__(res.locals.resourceName + '.find')+'</li>'+
'</ol>';
next();
},
/**
* Default findOne breadcrumb function
* @return {Array} Links array with href and text
*/
findOne: function findOneBreadcrumb(req, res, next) {
res.locals.breadcrumb =
'<ol class="breadcrumb">'+
'<li><a href="/">'+res.locals.__('Home')+'</a></li>'+
'<li><a href="'+
req.we.router.urlTo(res.locals.resourceName + '.find', req.paramsArray)+
'">'+res.locals.__(res.locals.resourceName + '.find')+'</a></li>'+
'<li class="active">'+req.we.utils.string(res.locals.title || '').truncate(25).s+'</li>'+
'</ol>';
next();
},
/**
* Default edit / update breadcrumb function
* @return {Array} Links array with href and text
*/
edit: function editBreadcrumb(req, res, next) {
if (!res.locals.data) return next();
res.locals.breadcrumb =
'<ol class="breadcrumb">'+
'<li><a href="/">'+res.locals.__('Home')+'</a></li>'+
'<li><a href="'+
req.we.router.urlTo(res.locals.resourceName + '.find', req.paramsArray)+
'">'+res.locals.__(res.locals.resourceName + '.find')+'</a></li>'+
'<li><a href="'+res.locals.data.getUrlPathAlias()+'">'+
req.we.utils.string(res.locals.title || '').truncate(25).s+
'</a></li>'+
'<li class="active">'+res.locals.__('edit')+'</li>'+
'</ol>';
next();
},
/**
* Default delete breadcrumb function
* @return {Array} Links array with href and text
*/
delete: function deleteBreadcrumb(req, res, next) {
if (!res.locals.data) return next();
res.locals.breadcrumb =
'<ol class="breadcrumb">'+
'<li><a href="/">'+res.locals.__('Home')+'</a></li>'+
'<li><a href="'+
req.we.router.urlTo(res.locals.resourceName + '.find', req.paramsArray)+
'">'+res.locals.__(res.locals.resourceName + '.find')+'</a></li>'+
'<li><a href="'+res.locals.data.getUrlPathAlias()+'">'+
req.we.utils.string(res.locals.title || '').truncate(25).s+
'</a></li>'+
'<li class="active">'+res.locals.__('delete')+'</li>'+
'</ol>';
next();
}
}
}
|
JavaScript
| 0.000005 |
@@ -1498,16 +1498,19 @@
'%3Cli
+%3E%3Ca
href=%22/
@@ -1534,24 +1534,28 @@
('Home')+'%3C/
+a%3E%3C/
li%3E'+%0A
|
2717469daf714768a1d9a48cc36cc279002b13c0
|
remove extra functions from list.test.js
|
lib/routes/lists.test.js
|
lib/routes/lists.test.js
|
'use strict';
var _ = require('lodash'),
filename = __filename.split('/').pop().split('.').shift(),
lib = require('./' + filename),
responses = require('../responses'),
sinon = require('sinon'),
log = require('../log');
describe(_.startCase(filename), function () {
var sandbox;
function createMockReq() {
return {};
}
function createMockRes() {
return {};
}
/**
* Fail unit test immediately with message;
* @param {string} msg
* @param {string} [actual]
* @param {string} [expected]
* @param {string} [operator]
*/
function fail(msg, actual, expected, operator) {
require('chai').assert.fail(actual, expected, msg, operator);
}
/**
* Shortcut
*/
function expectNoLogging() {
var logExpectations = sandbox.mock(log);
logExpectations.expects('info').never();
logExpectations.expects('warn').never();
logExpectations.expects('error').never();
}
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
describe('onlyJSONLists', function () {
var fn = lib[this.title];
it('allows undefined body', function (done) {
var req = createMockReq(),
res = createMockRes();
expectNoLogging();
sandbox.mock(responses).expects('clientError').never();
fn(req, res, function () {
done();
});
sandbox.verify();
});
it('allows array body', function (done) {
var req = createMockReq(),
res = createMockRes();
expectNoLogging();
req.body = [];
sandbox.mock(responses).expects('clientError').never();
fn(req, res, function () {
done();
});
sandbox.verify();
});
it('error when req.body is object', function () {
var req = createMockReq(),
res = createMockRes();
expectNoLogging();
req.body = {};
sandbox.mock(responses).expects('clientError').once();
fn(req, res, function () {
fail('next() should not be called.');
});
sandbox.verify();
});
});
});
|
JavaScript
| 0.000013 |
@@ -197,16 +197,51 @@
inon'),%0A
+ expect = require('chai').expect,%0A
log =
@@ -326,405 +326,8 @@
x;%0A%0A
- function createMockReq() %7B%0A return %7B%7D;%0A %7D%0A%0A function createMockRes() %7B%0A return %7B%7D;%0A %7D%0A%0A /**%0A * Fail unit test immediately with message;%0A * @param %7Bstring%7D msg%0A * @param %7Bstring%7D %5Bactual%5D%0A * @param %7Bstring%7D %5Bexpected%5D%0A * @param %7Bstring%7D %5Boperator%5D%0A */%0A function fail(msg, actual, expected, operator) %7B%0A require('chai').assert.fail(actual, expected, msg, operator);%0A %7D%0A%0A
/*
@@ -800,36 +800,32 @@
ody', function (
-done
) %7B%0A var re
@@ -822,35 +822,34 @@
var
-req = createMockReq
+next = sandbox.spy
(),%0A
@@ -854,35 +854,40 @@
re
-s = createMockRes()
+q = %7B%7D,%0A res = %7B%7D
;%0A%0A
@@ -912,36 +912,36 @@
;%0A sandbox.
-mock
+stub
(responses).expe
@@ -930,34 +930,26 @@
ub(responses
-).expects(
+,
'clientError
@@ -946,32 +946,24 @@
lientError')
-.never()
;%0A%0A fn(
@@ -976,70 +976,115 @@
es,
-function () %7B%0A done();%0A %7D);%0A%0A sandbox.verify(
+next);%0A%0A expect(next.called).to.equal(true);%0A expect(responses.clientError.called).to.equal(false
);%0A
@@ -1129,20 +1129,16 @@
nction (
-done
) %7B%0A
@@ -1143,35 +1143,34 @@
var
-req = createMockReq
+next = sandbox.spy
(),%0A
@@ -1175,35 +1175,40 @@
re
-s = createMockRes()
+q = %7B%7D,%0A res = %7B%7D
;%0A%0A
@@ -1254,36 +1254,36 @@
;%0A sandbox.
-mock
+stub
(responses).expe
@@ -1272,34 +1272,26 @@
ub(responses
-).expects(
+,
'clientError
@@ -1292,24 +1292,16 @@
tError')
-.never()
;%0A%0A
@@ -1318,70 +1318,115 @@
es,
-function () %7B%0A done();%0A %7D);%0A%0A sandbox.verify(
+next);%0A%0A expect(next.called).to.equal(true);%0A expect(responses.clientError.called).to.equal(false
);%0A
@@ -1501,27 +1501,26 @@
var
-req = createMockReq
+next = sandbox.spy
(),%0A
@@ -1533,27 +1533,32 @@
re
-s = createMockRes()
+q = %7B%7D,%0A res = %7B%7D
;%0A%0A
@@ -1616,20 +1616,20 @@
sandbox.
-mock
+stub
(respons
@@ -1634,18 +1634,10 @@
nses
-).expects(
+,
'cli
@@ -1650,15 +1650,8 @@
or')
-.once()
;%0A%0A
@@ -1672,100 +1672,115 @@
es,
-function () %7B%0A fail('next() should not be called.');%0A %7D);%0A%0A sandbox.verify(
+next);%0A%0A expect(next.called).to.equal(false);%0A expect(responses.clientError.callCount).to.equal(1
);%0A
|
a0833bfac62059cd3e24aa10a149df2fd0e84b1b
|
Update mark.js
|
lib/rules_inline/mark.js
|
lib/rules_inline/mark.js
|
// Process ==highlighted text==
'use strict';
module.exports = function del(state, silent) {
var found,
pos,
stack,
max = state.posMax,
start = state.pos,
lastChar,
nextChar;
if (state.src.charCodeAt(start) !== 0x3D/* = */) { return false; }
if (silent) { return false; } // don't run any pairs in validation mode
if (start + 4 >= max) { return false; }
if (state.src.charCodeAt(start + 1) !== 0x3D/* = */) { return false; }
if (state.level >= state.options.maxNesting) { return false; }
lastChar = start > 0 ? state.src.charCodeAt(start - 1) : -1;
nextChar = state.src.charCodeAt(start + 2);
if (lastChar === 0x3D/* = */) { return false; }
if (nextChar === 0x3D/* = */) { return false; }
if (nextChar === 0x20 || nextChar === 0x0A) { return false; }
pos = start + 2;
while (pos < max && state.src.charCodeAt(pos) === 0x3D/* = */) { pos++; }
if (pos !== start + 2) {
// sequence of 3+ markers taking as literal, same as in a emphasis
state.pos += pos - start;
if (!silent) { state.pending += state.src.slice(start, pos); }
return true;
}
state.pos = start + 2;
stack = 1;
while (state.pos + 1 < max) {
if (state.src.charCodeAt(state.pos) === 0x3D/* = */) {
if (state.src.charCodeAt(state.pos + 1) === 0x3D/* = */) {
lastChar = state.src.charCodeAt(state.pos - 1);
nextChar = state.pos + 2 < max ? state.src.charCodeAt(state.pos + 2) : -1;
if (nextChar !== 0x3D/* = */ && lastChar !== 0x3D/* = */) {
if (lastChar !== 0x20 && lastChar !== 0x0A) {
// closing '=='
stack--;
} else if (nextChar !== 0x20 && nextChar !== 0x0A) {
// opening '=='
stack++;
} // else {
// // standalone ' == ' indented with spaces
// }
if (stack <= 0) {
found = true;
break;
}
}
}
}
state.parser.skipToken(state);
}
if (!found) {
// parser failed to find ending tag, so it's not valid emphasis
state.pos = start;
return false;
}
// found!
state.posMax = state.pos;
state.pos = start + 2;
if (!silent) {
state.push({ type: 'mark_open', level: state.level++ });
state.parser.tokenize(state);
state.push({ type: 'mark_close', level: --state.level });
}
state.pos = state.posMax + 2;
state.posMax = max;
return true;
};
|
JavaScript
| 0 |
@@ -71,11 +71,12 @@
ion
-del
+mark
(sta
|
6fcc6cb99485e853e65a787bb00ef74730a38a7c
|
update frontend variables to reflect backend
|
public/angular/js/config.js
|
public/angular/js/config.js
|
angular.module('Aggie')
.value('mediaOptions', ['twitter', 'facebook', 'rss', 'elmo', 'smsgh', 'whatsapp'])
.value('apiSettingsOptions', ['twitter', 'facebook', 'elmo', 'gplaces'])
.value('widgetSettingsOptions', ['incident map'])
.value('statusOptions', ['Read', 'Unread', 'Flagged', 'Unflagged', 'Read & Unflagged'])
.value('linkedtoIncidentOptions', [{ _id: 'any', title: '* Any Incident' },
{ _id: 'none', title: '* Without Incident' }])
.value('userRoles', ['viewer', 'monitor', 'admin'])
.value('incidentStatusOptions', ['open', 'closed'])
.value('veracityOptions', ['unconfirmed', 'confirmed true', 'confirmed false'])
.value('escalatedOptions', ['escalated', 'unescalated'])
.value('publicOptions', ['public', 'private'])
.value('paginationOptions', { perPage: 25 })
.value('emailTransportOptions', {
SES: ['accessKeyId', 'secretAccessKey', 'region'],
SMTP: ['host', 'port', 'secure', 'user', 'pass'],
SendGrid: ['api_key'] });
|
JavaScript
| 0.000001 |
@@ -975,10 +975,9 @@
'api
-_k
+K
ey'%5D
|
5965cc63c62ca6944182967939a386702d19f6e2
|
Fix unit test expected result
|
test/functional/format.js
|
test/functional/format.js
|
import expect from 'expect';
import expectJSX from 'expect-jsx';
import React from 'react';
import {createRenderer} from 'react-addons-test-utils';
expect.extend(expectJSX);
export default function (ReactIntl) {
describe('format', () => {
const {
IntlProvider,
FormattedDate,
FormattedTime,
FormattedRelative,
FormattedNumber,
FormattedMessage,
} = ReactIntl;
let renderer;
let intlProvider;
beforeEach(() => {
renderer = createRenderer();
intlProvider = new IntlProvider({locale: 'en'}, {});
});
it('formats dates', () => {
const date = new Date();
const el = <FormattedDate value={date} month="numeric" />;
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>{date.getMonth() + 1}</span>
);
});
it('formats times', () => {
const date = new Date();
const el = <FormattedTime value={date} />;
const hours = date.getHours();
const minutes = date.getMinutes();
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>
{`${hours > 12 ? (hours % 12) : hours}:${minutes} ${hours < 12 ? 'AM' : 'PM'}`}
</span>
);
});
it('formats dates relative to "now"', () => {
const now = Date.now();
const el = <FormattedRelative value={now - 1000} initialNow={now} />;
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>1 second ago</span>
);
});
it('formats numbers with thousands separators', () => {
const el = <FormattedNumber value={1000} />;
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>1,000</span>
);
});
it('formats numbers with decimal separators', () => {
const el = <FormattedNumber value={0.1} minimumFractionDigits={2} />;
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>0.10</span>
);
});
it('pluralizes labels in strings', () => {
const el = (
<FormattedMessage
id="num_emails"
defaultMessage="You have {emails, plural, one {# email} other {# emails}}."
values={{
emails: 1000,
}}
/>
);
renderer.render(el, intlProvider.getChildContext());
expect(renderer.getRenderOutput()).toEqualJSX(
<span>You have 1,000 emails.</span>
);
});
});
}
|
JavaScript
| 0.000002 |
@@ -1389,16 +1389,41 @@
%7B
+%0A
%60$%7Bhours
@@ -1456,19 +1456,108 @@
rs%7D:
-$%7Bminutes%7D
+%60 +%0A %60$%7Bminutes %3C 10 ? %600$%7Bminutes%7D%60 : minutes%7D %60 +%0A %60
$%7Bho
@@ -1580,16 +1580,37 @@
: 'PM'%7D%60
+%0A
%7D%0A
|
8ee99a2492dc1daa55b64a8e60a4d010a28a3da6
|
use scoped variables for mock clock
|
lib/spec-helper/clock.js
|
lib/spec-helper/clock.js
|
"use babel";
/* globals jasmine, spyOn, beforeEach */
import _ from "underscore-plus";
window.__realSetTimeout = window.setTimeout;
window.__realClearTimeout = window.clearTimeout;
window.__real__Now = _._.now;
window.__realSetInterval = window.setInterval;
window.__realClearInterval = window.clearInterval;
jasmine.useMockClock = function () {
spyOn(window, "setInterval").and.callFake(window.fakeSetInterval);
spyOn(window, "clearInterval").and.callFake(window.fakeClearInterval);
spyOn(_._, "now").and.callFake(() => window.now);
spyOn(window, "setTimeout").and.callFake(window.fakeSetTimeout);
spyOn(window, "clearTimeout").and.callFake(window.fakeClearTimeout);
};
jasmine.useRealClock = function () {
window.setTimeout = window.__realSetTimeout;
window.clearTimeout = window.__realClearTimeout;
_._.now = window.__real__Now;
window.setInterval = window.__realSetInterval;
window.clearInterval = window.__realClearInterval;
};
window.resetTimeouts = function () {
window.now = 0;
window.timeoutCount = 0;
window.intervalCount = 0;
window.timeouts = [];
window.intervalTimeouts = {};
};
window.fakeSetTimeout = function (callback, ms) {
if (!ms) { ms = 0; }
const id = ++window.timeoutCount;
window.timeouts.push([id, window.now + ms, callback]);
return id;
};
window.fakeClearTimeout = function (idToClear) {
window.timeouts = window.timeouts.filter(([id]) => id !== idToClear);
};
window.fakeSetInterval = function (callback, ms) {
const id = ++window.intervalCount;
var action = function () {
callback();
return window.intervalTimeouts[id] = window.fakeSetTimeout(action, ms);
};
window.intervalTimeouts[id] = window.fakeSetTimeout(action, ms);
return id;
};
window.fakeClearInterval = function (idToClear) {
window.fakeClearTimeout(this.intervalTimeouts[idToClear]);
};
window.advanceClock = function (delta) {
if (!delta) { delta = 1; }
window.now += delta;
window.timeouts = window.timeouts.filter(([, strikeTime, callback]) => {
if (strikeTime <= window.now) {
callback();
return false;
}
return true;
});
};
beforeEach(function () {
window.resetTimeouts();
window.useMockClock();
window.advanceClock(1000);
});
|
JavaScript
| 0 |
@@ -82,23 +82,22 @@
plus%22;%0A%0A
-window.
+const
__realSe
@@ -122,31 +122,30 @@
setTimeout;%0A
-window.
+const
__realClearT
@@ -174,23 +174,22 @@
imeout;%0A
-window.
+const
__real__
@@ -203,23 +203,22 @@
._.now;%0A
-window.
+const
__realSe
@@ -249,23 +249,22 @@
terval;%0A
-window.
+const
__realCl
@@ -299,16 +299,17 @@
terval;%0A
+%0A
jasmine.
@@ -667,16 +667,17 @@
ut);%0A%7D;%0A
+%0A
jasmine.
@@ -722,31 +722,24 @@
etTimeout =
-window.
__realSetTim
@@ -767,23 +767,16 @@
meout =
-window.
__realCl
@@ -798,23 +798,16 @@
_.now =
-window.
__real__
@@ -829,31 +829,24 @@
tInterval =
-window.
__realSetInt
@@ -876,23 +876,16 @@
erval =
-window.
__realCl
|
3bd8e73958245268edbaa265aac10764a3eb5b82
|
Fix labels in rules to be consistent with stat labels.
|
src/mist/io/static/js/app/controllers/rules.js
|
src/mist/io/static/js/app/controllers/rules.js
|
define('app/controllers/rules', [
'app/models/rule',
'ember',
'jquery'
],
/**
*
* Rules controller
*
* @returns Class
*/
function(Rule) {
return Ember.ArrayController.extend({
command: null,
commandRule: null,
metricList: [
'load',
'cpu',
'ram',
'disk',
'network'
],
operatorList: [
{'title': 'gt', 'symbol': '>'},
{'title': 'lt', 'symbol': '<'}
],
actionList: [
'alert',
'reboot',
'destroy',
//'launch',
'command'
],
getRuleById: function(ruleId){
for (var i = 0; i < this.content.length; i++){
if (this.content[i].id == ruleId) {
return this.content[i];
}
}
},
getOperatorByTitle: function(title){
var ret = null;
this.operatorList.forEach(function(op){
if (op.title == title){
ret = op;
}
});
return ret;
},
newRule: function(machine, metric, operator, value, actionToTake) {
var rule = Rule.create({
'machine': machine,
'metric': metric,
'operator': operator,
'value': value,
'actionToTake': actionToTake
});
var that = this;
rule.set('id', 'new');
that.pushObject(rule);
that.redrawRules();
setTimeout(function() {
$('#new .delete-rule-container').hide()
$('#new .ajax-loader').show()
}, 100)
payload = {
'backendId': machine.backend.id,
'machineId': machine.id,
'metric': metric,
'operator': operator.title,
'value': value,
'action': actionToTake
}
$('#add-rule-button').button('disable');
$('#add-rule-button').button('refresh');
$.ajax({
url: 'rules',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(payload),
success: function(data) {
info('Successfully created rule ', data['id']);
rule.set('id', data['id']);
$('#new').attr('id', data['id']);
$('.rule-box').last().find('.delete-rule-container').show()
$('.rule-box').last().find('.ajax-loader').hide()
$('#add-rule-button').button('enable');
$('#add-rule-button').button('refresh');
},
error: function(jqXHR, textstate, errorThrown) {
Mist.notificationController.notify('Error while creating rule');
error(textstate, errorThrown, 'while creating rule');
that.removeObject(rule);
that.redrawRules();
$('#add-rule-button').button('enable');
$('#add-rule-button').button('refresh');
}
});
return rule.id;
},
saveCommand: function() {
var oldAction = this.commandRule.get('actionToTake');
var oldCommand = this.commandRule.get('command');
$('.rule-command-popup').popup('close');
if (this.command == oldCommand) {
return false;
}
warn('setting command for '+ this.commandRule.id + ' to ' + this.command);
this.commandRule.set('actionToTake', 'command');
this.commandRule.set('command', this.command);
var payload = {
'id' : this.commandRule.id,
'action' : 'command',
'command': this.command
}
var that = this;
$.ajax({
url: 'rules',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(payload),
success: function(data) {
info('Successfully updated rule', that.commandRule.id);
},
error: function(jqXHR, textstate, errorThrown) {
Mist.notificationController.notify('Error while updating rule');
error(textstate, errorThrown, 'while updating rule');
that.commandRule.set('actionToTake', oldAction);
that.commandRule.set('command', oldCommand);
that.command.set(oldCommand);
}
});
},
redrawRules: function(){
var that = this;
Ember.run.next(function() {
$('.rule-button.metric').each(function(i, el){
$(el).button();
});
$('.rule-metric-popup').each(function(i, el){
$(el).popup();
});
$('.rule-metric-list').each(function(i, el){
$(el).listview();
});
$('.rule-button.operator').each(function(i, el){
$(el).button();
});
$('.rule-operator-popup').each(function(i, el){
$(el).popup();
});
$('.rule-operator-list').each(function(i, el){
$(el).listview();
});
$('.rule-value').each(function(i, el){
$(el).slider();
});
$('input.rule-value').each(function(i, el){
$(el).textinput();
});
$('.rule-button.action').each(function(i, el){
$(el).button();
});
$('.rule-action-popup').each(function(i, el){
$(el).popup();
});
$('.rule-command-content').each(function(i, el){
$(el).textinput();
});
$('.rule-command-popup a').each(function(i, el){
$(el).button();
});
$('.rule-command-popup').each(function(i, el){
$(el).popup();
});
$('.rule-action-list').each(function(i, el){
$(el).listview();
});
$('.rules-container .delete-rule-button').each(function(i, el){
$(el).button();
});
function showRuleSlider(event) {
$(event.currentTarget).find('.ui-slider-track').css('width', $(window).width()*0.3);
$(event.currentTarget).find('.ui-slider-track').fadeIn(100);
}
function hideRuleSlider(event){
$(event.currentTarget).find('.ui-slider-track').css('width','');
$(event.currentTarget).find('.ui-slider-track').fadeOut(100);
if (($(event.currentTarget).attr('id') != 'new') && ($(event.currentTarget).attr('id'))) {
var rule_id = $(event.currentTarget).attr('id');
var rule_value = $(event.currentTarget).find('.ui-slider-handle').attr('aria-valuenow');
var rule = that.getRuleById(rule_id);
if (rule.value != rule_value) {
var payload = {
'id' : rule.id,
'value' : rule_value
}
$('#' + rule.id + ' .delete-rule-container').hide();
$('#' + rule.id + ' .ajax-loader').show();
$.ajax({
url: 'rules',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(payload),
success: function(data) {
info('Successfully updated rule ', rule.id);
rule.set('value', rule_value);
$('#' + rule.id + ' .ajax-loader').hide();
$('#' + rule.id + ' .delete-rule-container').show();
},
error: function(jqXHR, textstate, errorThrown) {
Mist.notificationController.notify('Error while updating rule');
error(textstate, errorThrown, 'while updating rule');
$('#' + rule.id + ' .ajax-loader').hide();
$('#' + rule.id + ' .delete-rule-container').show();
}
});
}
}
}
$('.ui-slider').off('mouseover');
$('.ui-slider').on('mouseover', showRuleSlider);
$('.ui-slider').on('click', showRuleSlider);
$('.ui-slider').on('tap', showRuleSlider);
$('.rule-box').on('mouseleave', hideRuleSlider);
$('#single-machine').on('tap', hideRuleSlider);
});
},
});
}
);
|
JavaScript
| 0 |
@@ -402,16 +402,22 @@
'disk
+-write
',%0A
@@ -435,16 +435,19 @@
'network
+-tx
'%0A
|
daad3b83c2ea69bf44724d7c6d540611eedd60a5
|
Tweak karma regex to be more accepting, fix small user comparitor bug
|
src/behaviors/karma/karma.js
|
src/behaviors/karma/karma.js
|
import Behavior from '../behavior.js';
import Karma from './models/karma.js';
const USER_KARMA_REGEX = /^<@(\w+)>(\+\+|\-\-)(?:\s?#\s?((?:[\s\S])+))?/gi,
USER_REGEX = /<@(\w+)>/gi;
const BEATZ_ID = 'D2HRBHJ7R';
class KarmaBehavior extends Behavior {
constructor(settings) {
settings.name = 'Karma';
settings.description = 'Karma is fun, `++` or `--` people, places, or things!';
super(settings);
this.commands.push({
tag: 'explain',
description: 'Displays the karma for the provided users (e.g. `!karma @beatz-bot`)'
});
this.commands.push({
tag: 'list',
description: 'Displays the top or bottom 10 karma users (e.g. `!list top` or `!list bottom`'
});
}
initialize(bot) {
bot.on('message', messageData => {
if (messageData.text && messageData.text.match(USER_KARMA_REGEX)) {
const [, userId, type, reason] = USER_KARMA_REGEX.exec(messageData.text),
channel = messageData.channel;
// Trying to give yourself karma? tsk tsk. Not gonna fly.
if (userId === messageData.user) {
if (type === '++') {
this.bot.postMessage(channel, `Aww, that's cute <@${messageData.user}>, thinking you can give yourself karma.`, {
icon_emoji: ':patpat:'
});
return;
}
}
if (channel === BEATZ_ID) {
this.bot.postMessage(channel, `Tut tut, <@${messageData.user}>, if you're going to give or take karma, do it in public.`, {
icon_emoji: ':patpat:'
});
return;
}
this._getKarmaAndUser(userId).then(data => {
const user = data.user,
karma = data.karma,
shouldIncrement = type === '++',
method = shouldIncrement ? 'increment' : 'decrement';
let message = '';
if (karma[method]) {
karma[method](1, reason);
karma.save();
}
// If you wanna take karma away from yourself, who am I to stop you?
if (userId === user.id) {
message = `¯\\_(ツ)_/¯ it's your funeral, <@${user.id}|${user.name}>. `;
}
message += `<@${user.id}|${user.name}>'s karma has changed to ${karma.karma}.`;
this.bot.postMessage(channel, message, {
icon_emoji: shouldIncrement ? ':karma:' : ':discentia:'
});
});
}
});
}
execute(command, message, channel) {
switch (command) {
case 'explain':
this.giveKarma(message, channel);
break;
case 'list':
this.listKarma(message, channel);
break;
default:
break;
}
}
listKarma(message, channel) {
if (message.startsWith('!list top')) {
Karma.list('desc').then(karmaList => {
let karmaMessage = `The people with the most karma:\n\n`;
karmaList.forEach(karma => {
karmaMessage += `${karma.karma} <@${karma.entityName}>\n`;
});
this.bot.postMessage(channel, karmaMessage, {
icon_emoji: ':karma:'
});
});
}
else if (message.startsWith('!list bottom')) {
Karma.list('asc').then(karmaList => {
let karmaMessage = `The people with the least karma:\n\n`;
karmaList.forEach(karma => {
karmaMessage += `${karma.karma} <@${karma.entityName}>\n`;
});
this.bot.postMessage(channel, karmaMessage, {
icon_emoji: ':discentia:'
});
});
}
}
giveKarma(message, channel) {
const [, userId] = USER_REGEX.exec(message);
this.bot.users = undefined;
this._getKarmaAndUser(userId).then(data => {
const user = data.user,
karma = data.karma,
positive = karma.sample(5, 'positive').map(reason => reason.reason).join('; '),
negative = karma.sample(5, 'negative').map(reason => reason.reason).join('; ');
let karmaMessage = `<@${user.id}|${user.name}> has ${karma.karma} karma. The highest it's ` +
`ever been was ${karma.highest} and the lowest it's ever been was ${karma.lowest}.\n\n`;
if (positive) {
karmaMessage += `Positive: ${positive}\n`;
}
if (negative) {
karmaMessage += `Negative: ${negative}\n`;
}
this.bot.postMessage(channel, karmaMessage, {
icon_emoji: ':karma:'
});
});
}
_getKarmaAndUser(userId) {
return new Promise(resolve => {
this.bot.getUserById(userId).then(user => {
Karma.findOrCreate({
entityId: `person|${user.id}`
}).then(karma => {
resolve({
karma,
user
});
});
});
});
}
}
export default KarmaBehavior;
|
JavaScript
| 0 |
@@ -108,16 +108,27 @@
@(%5Cw+)%3E(
+?:%5B%5Cs%5C:%5D*)(
%5C+%5C+%7C%5C-%5C
@@ -2059,23 +2059,32 @@
rId ===
+messageData.
user
-.id
) %7B%0A
|
386edcb6f57b9e63de00ee4d5cd8b140984c6b3f
|
Update BSTNode to accept _store payload on construction
|
src/binary_trees/BSTNode.es6
|
src/binary_trees/BSTNode.es6
|
import 'core-js/shim';
const IM = require('immutable');
export default class BSTNode {
constructor(key, value, left, right, id) {
this._store = IM.Map({ '_key': key, '_value': value, '_left': left, '_right': right, '_id': id });
Object.freeze(this);
}
get store() {
return this._store;
}
get key() {
return this.store.get('_key');
}
get value() {
return this.store.get('_value');
}
get left() {
return this.store.get('_left', null);
}
get right() {
return this.store.get('_right', null);
}
get id() {
return this.store.get('_id');
}
}
|
JavaScript
| 0 |
@@ -124,24 +124,93 @@
ight, id) %7B%0A
+ if (IM.Map.isMap(key)) %7B%0A this._store = key;%0A %7D else %7B%0A
this._st
@@ -300,16 +300,22 @@
id %7D);%0A
+ %7D%0A
Obje
|
cf8ef13793e5d50b8dfa7993bdc824df452a4925
|
add redirect to signin page if server resource is not available (due to user not being authenticated
|
public/js/modules/events.js
|
public/js/modules/events.js
|
angular.module('eventsInfo', [])
.constant('moment', moment)
.controller('eventsController', function($scope, $state, Eventstored, moment, $interval, $window) {
$scope.eve = {};
$scope.eve.eventDate = '';
$scope.eve.eventDescription = '';
$scope.eve.eventAlert = '';
$scope.eve.eventTime = '';
$scope.eve.roomName = '';
$scope.eve.houseName = 'Hacker House';
$scope.ifValue = true;
$scope.showIf = function() {
return $scope.ifValue;
};
$scope.hideIf = function() {
return !$scope.ifValue;
};
$scope.refreshEvents = function() {
Eventstored.getData().then(function(events) {
var allEvents = events.data;
//console.log(allEvents);
var today = moment().dayOfYear();
for (var i = 0; i < allEvents.length; i++) {
var eachDib = moment(allEvents[i].eventDate).dayOfYear();
var diff = eachDib - today;
allEvents[i].diff = diff;
//console.log('This is the flag', diff);
}
var formattedEvents = Eventstored.formatData(events);
$scope.bookedEvents = formattedEvents;
});
};
$scope.renderSideDashboard = function() {
$state.go('dashboardPage.events');
Eventstored.getData().then(function(events) {
var allEvents = events.data;
//console.log(allEvents);
var today = moment().dayOfYear();
for (var i = 0; i < allEvents.length; i++) {
var eachDib = moment(allEvents[i].eventDate).dayOfYear();
var diff = eachDib - today;
allEvents[i].diff = diff;
//console.log('This is the flag', diff);
}
var formattedEvents = Eventstored.formatData(events);
$scope.bookedEvents = formattedEvents;
});
// removing past daily dibs every 30s
//$scope.refreshEvents();
};
$scope.renderSideDashboardChart = function() {
$state.go('dashboardPage.eventsChart');
};
$scope.highlightEvents = function(event) {
//console.log('test', event.diff);
if (event.diff <= 1) {
//console.log(true);
return true;
} else {
//console.log(false);
return false;
}
};
$scope.eventSubmit = function() {
var $events = $scope.eve;
Eventstored.eventData($events)
.then(function(message) {
if (!message.data.result) {
alert('Someone else called Dibs!');
}
});
// Eventstored.getData();
$scope.refreshEvents();
$scope.renderSideDashboard();
};
$scope.signout = function() {
//remove jwt here
console.log("I'm signing out");
$window.localStorage.clear();
$state.go('signupPage');
};
//TIME ADDON
$scope.eve.eventDate = new Date();
$scope.hstep = 1;
$scope.mstep = 1;
$scope.options = {
hstep: [1, 2, 3],
mstep: [1, 5, 10, 15, 25, 30]
};
$scope.ismeridian = true;
$scope.toggleMode = function() {
$scope.ismeridian = !$scope.ismeridian;
};
$scope.update = function() {
var d = $scope.eve.eventDate;
d.setHours(15);
d.setMinutes(0);
// $scope.eve.eventDate = d;
};
// used to help render the date
$scope.dt = +new Date();
$scope.today = function() {
$scope.eve.eventDate = new Date();
};
$scope.today();
$scope.clear = function() {
$scope.eve.eventDate = null;
};
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.maxDate = new Date(2020, 5, 22);
$scope.open = function($event) {
$scope.status.opened = true;
};
$scope.setDate = function(year, month, day) {
$scope.eve.eventDate = new Date(year, month, day);
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
$scope.status = {
opened: false
};
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var afterTomorrow = new Date();
afterTomorrow.setDate(tomorrow.getDate() + 2);
$scope.events = [{
date: tomorrow,
status: 'full'
}, {
date: afterTomorrow,
status: 'partially'
}];
$scope.getDayClass = function(date, mode) {
if (mode === 'day') {
var dayToCheck = new Date(date).setHours(0, 0, 0, 0);
for (var i = 0; i < $scope.events.length; i++) {
var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0);
if (dayToCheck === currentDay) {
return $scope.events[i].status;
}
}
}
return '';
};
});
|
JavaScript
| 0 |
@@ -643,16 +643,25 @@
vents) %7B
+%0A
%0A%0A
@@ -1271,32 +1271,48 @@
().then(function
+ successCallback
(events) %7B%0A
@@ -1730,32 +1730,32 @@
atData(events);%0A
-
$scope.b
@@ -1777,32 +1777,276 @@
ormattedEvents;%0A
+ %7D,function errorCallback(response) %7B%0A%0A //do not have access to events resource%0A //user must not be logged in%0A //redirect to signup%0A%0A $state.go('signupPage');%0A %0A console.log(%22RESPONSE%22,response);%0A%0A
%7D);%0A%0A
|
99b41aced5950b8b29f652da807f9c320c1b58a7
|
Update API Url
|
src/utils/config.js
|
src/utils/config.js
|
export default {
title: 'zsx\'s Blog',
author: 'zsx',
github: 'https://github.com/zsxsoft',
themeUrl: 'https://github.com/zsxsoft/blog.zsxsoft.com',
apiUrl: 'https://blog.zsxsoft.com/api',
titleOnlyCategoires: ['5', '6', '7'],
analytics: {
google: 'UA-128215311-1',
tencent: '21682966',
baidu: 'e676290db1a063d7eabcc30211f4000b'
},
filing: {
icp: '闽ICP备15006942号',
security: {
text: '闽公网安备 35010302000147 号',
link: 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=35010302000147'
}
}
}
|
JavaScript
| 0 |
@@ -160,22 +160,72 @@
apiUrl:
+process.browser ? 'https://blog.zsxsoft.com/api' :
'http
-s
://blog.
|
869dca79cb7e3e30606b9a294adef8442c6d7f85
|
change right on stat
|
src/stats/stats.js
|
src/stats/stats.js
|
angular.module('angular-login.stats', ['angular-login.grandfather'])
.config(function ($stateProvider) {
$stateProvider
.state('app.stats', {
url: '/stats',
templateUrl: 'stats/stats.tpl.html',
controller: 'StatsController',
controllerAs: 'statfmt',
accessLevel: accessLevels.dlaf
})
.state('app.statsmaraude', {
url: '/statsmaraude',
templateUrl: 'stats/statsmaraude.tpl.html',
controller: 'StatsMaraudeController',
controllerAs: 'statmrd',
accessLevel: accessLevels.public
})
.state('app.statsfc', {
url: '/statsfc',
templateUrl: 'stats/statsfc.tpl.html',
controller: 'StatsFCController',
controllerAs: 'statfcc',
accessLevel: accessLevels.dlaf
})
})
.controller('StatsController', function ($scope, loginService, $http, $log, NgTableParams) {
$scope.year = 2016;
$scope.wait = false;
var self = this;
$scope.getDonne = function () {
$scope.wait = true;
var url_search = 'http://' + $scope.url + '/stats/formations?year=' + $scope.year + '&F5_ST=' + loginService.user.F5_ST + '&LastMRH_Session=' + loginService.user.LastMRH_Session + '&MRHSession=' + loginService.user.MRHSession + '&ul=' + loginService.user.utilisateur.structure.id;
$log.info('URI: ' + url_search);
$http.get(url_search).
success(function (response) {
$scope.donnee = angular.fromJson(response);
$scope.wait = false;
self.tableformateurs = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.formateurs.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.formateurs
}
);
self.tableassistants = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.assistants.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.assistants
}
);
});
};
$scope.getDonne();
})
.controller('StatsMaraudeController', function ($scope, loginService, $http, $log, NgTableParams) {
$scope.year = 2016;
$scope.wait = false;
var self = this;
$scope.getDonne = function () {
$scope.wait = true;
var url_search = 'http://' + $scope.url + '/stats/maraude?year=' + $scope.year + '&F5_ST=' + loginService.user.F5_ST + '&LastMRH_Session=' + loginService.user.LastMRH_Session + '&MRHSession=' + loginService.user.MRHSession + '&ul=' + loginService.user.utilisateur.structure.id;
$log.info('URI: ' + url_search);
$http.get(url_search).
success(function (response) {
$scope.donnee = angular.fromJson(response);
$scope.wait = false;
self.tablechef = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.chef.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.chef
}
);
self.tablemaraudeur = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.maraudeur.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.maraudeur
}
);
});
};
$scope.getDonne();
})
.controller('StatsFCController', function ($scope, loginService, $http, $log, NgTableParams) {
$scope.year = 2016;
var self = this;
$scope.wait = false;
$scope.getDonne = function () {
$scope.wait = true;
var url_search = 'http://' + $scope.url + '/stats/fc?year=' + $scope.year + '&F5_ST=' + loginService.user.F5_ST + '&LastMRH_Session=' + loginService.user.LastMRH_Session + '&MRHSession=' + loginService.user.MRHSession + '&ul=' + loginService.user.utilisateur.structure.id;
$log.info('URI: ' + url_search);
$http.get(url_search).
success(function (response) {
$scope.donnee = angular.fromJson(response);
$scope.wait = false;
self.tableformateurs = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.formateurs.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.formateurs
}
);
self.tableparticipants = new NgTableParams(
{
sorting: { nombre: "desc" },
page: 1,
count: $scope.donnee.participants.length
},{
counts: [], // hide page counts control
total: 1, // value less than count hide pagination
dataset: $scope.donnee.participants
}
);
});
};
$scope.getDonne();
});
|
JavaScript
| 0.000001 |
@@ -365,36 +365,38 @@
l: accessLevels.
-dlaf
+public
%0A %7D)%0A
@@ -953,12 +953,14 @@
els.
-dlaf
+public
%0A
|
68d5dcacca1fdea8309c39b019a90edc8515f9aa
|
Fix bug
|
src/utils/config.js
|
src/utils/config.js
|
import * as fs from 'fs';
import * as yaml from 'js-yaml';
import * as inquirer from 'inquirer';
export const configDirPath = `${__dirname}/../../.config`;
export const configPath = `${configDirPath}/config.yml`;
const form = [
{
type: 'input',
name: 'maintainer',
message: 'Maintainer name(and email address):'
},
{
type: 'input',
name: 'url',
message: 'PRIMARY URL:'
},
{
type: 'input',
name: 'secondary_url',
message: 'SECONDARY URL:'
},
{
type: 'input',
name: 'port',
message: 'Listen port:'
},
{
type: 'confirm',
name: 'https',
message: 'Use TLS?',
default: false
},
{
type: 'input',
name: 'https_key',
message: 'Path of tls key:',
when: ctx => ctx.https
},
{
type: 'input',
name: 'https_cert',
message: 'Path of tls cert:',
when: ctx => ctx.https
},
{
type: 'input',
name: 'https_ca',
message: 'Path of tls ca:',
when: ctx => ctx.https
},
{
type: 'input',
name: 'mongo_host',
message: 'MongoDB\'s host:',
default: 'localhost'
},
{
type: 'input',
name: 'mongo_port',
message: 'MongoDB\'s port:',
default: '27017'
},
{
type: 'input',
name: 'mongo_db',
message: 'MongoDB\'s db:',
default: 'misskey'
},
{
type: 'input',
name: 'mongo_user',
message: 'MongoDB\'s user:'
},
{
type: 'password',
name: 'mongo_pass',
message: 'MongoDB\'s password:'
},
{
type: 'input',
name: 'redis_host',
message: 'Redis\'s host:',
default: 'localhost'
},
{
type: 'input',
name: 'redis_port',
message: 'Redis\'s port:',
default: '6379'
},
{
type: 'password',
name: 'redis_pass',
message: 'Redis\'s password:'
},
{
type: 'confirm',
name: 'elasticsearch',
message: 'Use Elasticsearch?',
default: false
},
{
type: 'input',
name: 'es_host',
message: 'Elasticsearch\'s host:',
default: 'localhost',
when: ctx => ctx.elasticsearch
},
{
type: 'input',
name: 'es_port',
message: 'Elasticsearch\'s port:',
default: '9200',
when: ctx => ctx.elasticsearch
},
{
type: 'password',
name: 'es_pass',
message: 'Elasticsearch\'s password:',
when: ctx => ctx.elasticsearch
},
{
type: 'input',
name: 'recaptcha_site',
message: 'reCAPTCHA\'s site key:'
},
{
type: 'input',
name: 'recaptcha_secret',
message: 'reCAPTCHA\'s secret key:'
}
];
inquirer.prompt(form).then(as => {
// Mapping answers
const conf = {
maintainer: as['maintainer'],
url: as['url'],
secondary_url: as['secondary_url'],
port: parseInt(as['port'], 10),
https: {
enable: as['https'],
key: as['https_key'] || null,
cert: as['https_cert'] || null,
ca: as['https_ca'] || null
},
mongodb: {
host: as['mongo_host'],
port: parseInt(as['mongo_port'], 10),
db: as['mongo_db'],
user: as['mongo_user'],
pass: as['mongo_pass']
},
redis: {
host: as['redis_host'],
port: parseInt(as['redis_port'], 10),
pass: as['redis_pass']
},
elasticsearch: {
enable: as['elasticsearch'],
host: as['es_host'] || null,
port: parseInt(as['es_port'], 10) || null,
pass: as['es_pass'] || null
},
recaptcha: {
siteKey: as['recaptcha_site'],
secretKey: as['recaptcha_secret']
}
};
console.log('Thanks. Writing the configuration to a file...');
try {
fs.mkdirSync(configDirPath);
fs.writeFileSync(configPath, yaml.dump(conf));
console.log('Well done.');
} catch (e) {
console.error(e);
}
});
|
JavaScript
| 0.000001 |
@@ -1,52 +1,51 @@
-import * as fs from
+const fs = require(
'fs'
+)
;%0A
-import * as yaml from
+const yaml = require(
'js-
@@ -53,36 +53,36 @@
aml'
+)
;%0A
-import * as inquirer from
+const inquirer = require(
'inq
@@ -91,18 +91,12 @@
rer'
+)
;%0A%0A
-export
cons
@@ -147,15 +147,8 @@
g%60;%0A
-export
cons
|
c8e847240b1d356e1ae3e41280980a952eb96572
|
add logger back in
|
src/store/index.js
|
src/store/index.js
|
import {
createStore,
applyMiddleware,
combineReducers,
compose,
} from 'redux';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger';
import {
routerReducer as routing,
routerMiddleware,
} from 'react-router-redux';
import { browserHistory } from 'react-router';
import app from 'reducers';
const loggerMiddleware = createLogger();
const reducer = combineReducers({
app,
routing,
});
export default createStore(reducer, compose(
applyMiddleware(thunkMiddleware),
// applyMiddleware(loggerMiddleware),
applyMiddleware(routerMiddleware(browserHistory)),
// This enables the redux dev tools extension, or does nothing if not installed
window.devToolsExtension ? window.devToolsExtension() : f => f
));
|
JavaScript
| 0.000001 |
@@ -509,19 +509,16 @@
ware),%0A
- //
applyMi
|
b5399158e00b3e6806b1b6cd0680dd458e442cb5
|
Return null for no data
|
src/store/utils.js
|
src/store/utils.js
|
// Utilities
/**
* Return values scaled by baseline
*/
export const baselineScale = (values, baseline) => {
return values.map(d => {
return {
week: d.week,
data: baseline ? ((d.data / baseline) - 1) * 100 : -1
}
})
}
/**
* Get data with maximum lag
* First element of the lag array
*/
export const getMaxLagData = actual => {
return actual.map(d => {
let dataToReturn = -1
// Handle zero length values
if (d.data.length !== 0) {
dataToReturn = d.data[0].value
}
return {
week: d.week,
data: dataToReturn
}
})
}
/**
* Trim history data to fit in length 'numWeeks'
*/
export const trimHistory = (historyActual, numWeeks) => {
let historyTrimmed = historyActual.slice()
if (numWeeks === 52) {
// Clip everyone else to remove 53rd week
historyTrimmed = historyTrimmed.filter(d => d.week % 100 !== 53)
} else if (historyTrimmed.length === 52) {
// Expand to add 53rd week
// Adding a dummy year 1000, this will also help identify the adjustment
historyTrimmed.splice(23, 0, {
week: 100053,
data: (historyTrimmed[22].data + historyTrimmed[23].data) / 2.0
})
}
return historyTrimmed
}
/**
* Return range for choropleth color scale
*/
export const choroplethDataRange = (state, getters) => {
let maxVals = []
let minVals = []
state.data.map(region => {
region.seasons.map(season => {
let actual = getMaxLagData(season.actual).map(d => d.data).filter(d => d !== -1)
if (getters['switches/choroplethRelative']) {
// Use baseline scaled data
maxVals.push(Math.max(...actual.map(d => ((d / season.baseline) - 1) * 100)))
minVals.push(Math.min(...actual.map(d => ((d / season.baseline) - 1) * 100)))
} else {
maxVals.push(Math.max(...actual))
minVals.push(Math.min(...actual))
}
})
})
return [Math.min(...minVals), Math.max(...maxVals)]
}
|
JavaScript
| 0.000196 |
@@ -400,18 +400,20 @@
eturn =
--1
+null
%0A //
|
4aca9e7d512b9666f36d37b6526a11931876be32
|
Add grid boundaries
|
public/js/states/running.js
|
public/js/states/running.js
|
/**
* running.js
* Running game state
*/
var RunningState = function(){
var RunningStateClass = function(){
}
RunningStateClass.prototype.preload = function(){}
RunningStateClass.prototype.create = function(){
this.game.stage.backgroundColor = '#FAED95'
var self = this;
require(['js/utils/polygons.js'], function(polygons){
self.Polygons = polygons.getInstance();
drawGrid(self)
})
}
RunningStateClass.prototype.update = function(){
}
/**
* Privated method that draws a parallel lines from to a given direction
* @param self context object
* @param params {step, style : {lineWidth, color}, bound}
* @param getDrawDirectionParams function(updatedStep)
*/
function drawGridDirection(self, params, getDrawDirectionParams){
var dirStep = params.step
var style = params.style
while(dirStep < params.bound){
var dirParams = getDrawDirectionParams(dirStep)
self.Polygons.drawLine(self.grid.ctx, dirParams.from, dirParams.to, style)
dirStep += params.step
}
}
/**
* Privated method that draws a Grid into the canvas based on its height and width
* @param self context object
*/
function drawGrid(self){
self.grid = self.game.add.bitmapData(self.game.stage.width, self.game.stage.height)
self.game.add.sprite(0, 0, self.grid)
var style = {'lineWidth' : 0.5, 'color' : '#FCDB73'}
//First we draw Y direction
var paramY = {'step' : 10, 'style' : style, 'bound' : self.game.stage.height};
drawGridDirection(self, paramY, function(step){
return {
'from' : {'x' : 0, 'y' : step},
'to' : {'x' : self.game.stage.width, 'y' : step}
}
})
//Then we draw X direction
var paramX = {'step' : 10, 'style' : style, 'bound' : self.game.stage.width};
drawGridDirection(self, paramX, function(step){
return {
'from' : {'x' : step, 'y' : 0},
'to' : {'x' : step, 'y' : self.stage.height}
}
})
}
return new RunningStateClass();
}
//define module export
define(function () {
return {
getState: function () {
return new RunningState();
}
};
});
|
JavaScript
| 0.000001 |
@@ -463,16 +463,158 @@
d(self)%0A
+ %0A this.numberOfCells = this.game.stage.width*this.game.stage.height*0.01;%0A console.log(this.numberOfCells);%0A
@@ -1495,32 +1495,60 @@
(self)%7B%0A
+var stage = self.game.stage;
%0A self.gr
@@ -1738,32 +1738,33 @@
FCDB73'%7D%0A
+
%0A //First
@@ -1842,34 +1842,24 @@
, 'bound' :
-self.game.
stage.height
@@ -2013,34 +2013,24 @@
o' : %7B'x' :
-self.game.
stage.width,
@@ -2173,26 +2173,16 @@
ound' :
-self.game.
stage.wi
@@ -2355,21 +2355,16 @@
, 'y' :
-self.
stage.he
@@ -2402,16 +2402,551 @@
+%0A //And finally we draw the grid bounds%0A self.Polygons.drawLine(self.grid.ctx, %7B'x' : 0, 'y' : 0.5%7D, %7B'x' : stage.width, 'y' : 0.5%7D, style)%0A self.Polygons.drawLine(self.grid.ctx, %7B'x' : 0, 'y' : stage.height-0.5%7D, %7B'x' : stage.width, 'y' : stage.height-0.5%7D, style)%0A self.Polygons.drawLine(self.grid.ctx, %7B'x' : 0.5, 'y' : 0%7D, %7B'x' : 0.5, 'y' : stage.height%7D, style)%0A self.Polygons.drawLine(self.grid.ctx, %7B'x' : stage.width-0.5, 'y' : 0%7D, %7B'x' : stage.width-0.5, 'y' : stage.height%7D, style)%0A
%0A%0A %7D%0A
|
a4cd3d4cbe5d7c3ef7781e25b368df894e0cf60d
|
update time automagically.
|
public/js/views/universe.js
|
public/js/views/universe.js
|
window.UniverseListView = function(options){
var draggable = 'draggable' in options ? options['draggable'] : false;
var collection = options['collection'];
var el = $('#content');
if(options['el'])
el = options['el'];
this.collection = collection;
this.el = el;
el.html(template.universe({draggable: draggable}));
console.log('UV2');
var UniItemViewModel = kb.ViewModel.extend({
constructor: function(model) {
kb.ViewModel.prototype.constructor.apply(this, arguments);
options = options || {};
options['keys'] = ['collection', 'name'];
this.medias = kb.collectionObservable(model.models);
this.total_time = ko.computed(function(){
return model.pretty_duration();
}, model);
this.id = ko.observable(model.id);
},
});
var UniverseListViewModel = kb.ViewModel.extend({
constructor: function(model) {
kb.ViewModel.prototype.constructor.apply(this, arguments);
var self = this;
this.filter = ko.observable('');
this.playlists = kb.collectionObservable(collection, {
view_model: UniItemViewModel,
filters: function(model) {
var filter;
filter = self.filter();
if (!filter) return false;
var re = new RegExp(filter,"i");
return model.get('name').search(re) < 0;
},
});
}
});
new SearchView({el: $('#playlist-search',el), type: 'playlist' });
this.view_model = new UniverseListViewModel(this.collection);
this.destroy = function () {
kb.release(this.view_model);
ko.cleanNode(this.el);
this.el.html('');
}
ko.applyBindings(this.view_model, el[0]);
}
|
JavaScript
| 0 |
@@ -450,32 +450,61 @@
nction(model) %7B%0A
+ var self = this;%0A
kb.V
@@ -550,32 +550,32 @@
is, arguments);%0A
-
opti
@@ -710,14 +710,25 @@
del.
-models
+get('collection')
);%0A
@@ -780,16 +780,147 @@
tion()%7B%0A
+//XXX: keep this, it tells KO to update total_time when something happens to the collection%0A var x = self.medias();%0A
|
2607d2c0758697cb6a6fa5fff324508afed8979a
|
Allow setting of styles on empty Groups.
|
src/style/Style.js
|
src/style/Style.js
|
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2013, Juerg Lehni & Jonathan Puckey
* http://lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
/**
* @name Style
*
* @class Internal base-class for all style objects, e.g. PathStyle,
* CharacterStyle, PargraphStyle.
*
* @private
*/
var Style = Base.extend({
initialize: function(style) {
// If the passed style object is also a Style, clone its clonable
// fields rather than simply copying them.
var clone = style instanceof Style;
// Note: This relies on bean getters and setters that get implicetly
// called when getting from style[key] and setting on this[key].
return Base.each(this._defaults, function(value, key) {
value = style && style[key] || value;
this[key] = value && clone && value.clone
? value.clone() : value;
}, this);
},
/**
* Returns the children to be used to unify style attributes, if any.
*/
_getChildren: function() {
// Only unify styles on children of Group items, excluding CompoundPath.
return this._item instanceof Group && this._item._children;
},
statics: {
create: function(item) {
var style = Base.create(this);
style._item = item;
return style;
},
extend: function(src) {
// Inject style getters and setters into the 'owning' class, which
// redirect calls to the linked style objects through their internal
// property on the instances of that class, as defined by _style.
var styleKey = '_' + src._style,
stylePart = Base.capitalize(src._style),
flags = src._flags || {},
owner = {};
// Define accessor on owner class for this style:
owner['get' + stylePart] = function() {
return this[styleKey];
};
owner['set' + stylePart] = function(style) {
this[styleKey].initialize(style);
};
Base.each(src._defaults, function(value, key) {
var isColor = /Color$/.test(key),
part = Base.capitalize(key),
set = 'set' + part,
get = 'get' + part;
// Simply extend src with these getters and setters, to be
// injected into this class using this.base() further down.
src[set] = function(value) {
var children = this._getChildren();
// Clone color objects since they reference their owner
value = isColor ? Color.read(arguments, 0, 0, true) : value;
if (children) {
for (var i = 0, l = children.length; i < l; i++)
children[i][styleKey][set](value);
} else {
var old = this['_' + key];
if (!Base.equals(old, value)) {
if (isColor) {
if (old)
delete old._owner;
if (value) {
value._owner = this._item;
}
}
this['_' + key] = value;
// Notify the item of the style change STYLE is
// always set, additional flags come from _flags,
// as used for STROKE:
if (this._item)
this._item._changed(flags[key] || /*#=*/ Change.STYLE);
}
}
};
src[get] = function() {
var children = this._getChildren(),
style;
// If this item has children, walk through all of them and
// see if they all have the same style.
if (!children)
return this['_' + key];
for (var i = 0, l = children.length; i < l; i++) {
var childStyle = children[i][styleKey][get]();
if (!style) {
style = childStyle;
} else if (!Base.equals(style, childStyle)) {
// If there is another item with a different
// style, the style is not defined:
return undefined;
}
}
return style;
};
// Style-getters and setters for owner class:
owner[set] = function(value) {
this[styleKey][set](value);
return this;
};
owner[get] = function() {
return this[styleKey][get]();
};
});
src._owner.inject(owner);
// Pass on to base()
return this.base.apply(this, arguments);
}
}
});
|
JavaScript
| 0 |
@@ -2457,16 +2457,39 @@
children
+ && children.length %3E 0
) %7B%0A%09%09%09%09
@@ -3301,16 +3301,41 @@
children
+ %7C%7C children.length === 0
)%0A%09%09%09%09%09%09
|
dcbe5a564b56eed96eaa45395d929937b8d8674c
|
Fix links in 'drop/ship' pages
|
public/scripts/drop/ship.js
|
public/scripts/drop/ship.js
|
function loadData(query) {
$.getJSON('/drop/ship/' + query.id + "/" + query.rank + ".json", function(obj) {
var table = $('table');
items = [];
$.each(obj.data, function(map, val) {
items.push({
quest: map,
totalCount: val.totalCount,
sCount: val.rankCount ? val.rankCount[0] : 0,
aCount: val.rankCount ? val.rankCount[1] : 0,
bCount: val.rankCount ? val.rankCount[2] : 0,
hqLvRange: val.hqLv.join(' ~ '),
dropRate: val.rate
});
});
items.sort(function(a, b) {
return a.rate - b.rate;
});
table.bootstrapTable().bootstrapTable('append', items);
$('#cache-time').html(obj.generateTime);
$('#query-count').html(obj.totalCount);
$('.fixed-table-toolbar > div:nth-of-type(2)')
.append("<a class='btn btn-default' href='http://zh.kcwiki.moe/wiki/" +
query.name + "' target='_blank'>查看百科</a>");
$('.busy-indicator').hide();
$('div.row.hidden').removeClass('hidden');
});
}
function questFormatter(value) {
return '<a href="#">' + value + '</a>';
}
function dropRateFormatter(value) {
return value + "%";
}
|
JavaScript
| 0.000001 |
@@ -1,16 +1,32 @@
+var rank = '';%0A%0A
function loadDat
@@ -147,16 +147,39 @@
able');%0A
+ rank = query.rank;%0A
%0A
@@ -1088,26 +1088,222 @@
%7B%0A
-return '%3Ca href=%22#
+var val = value.replace('(Boss)', '').replace('%E7%94%B2', 3).replace('%E4%B9%99', 2).replace('%E4%B8%99', 1).split('-');%0A return '%3Ca href=%22/drop/map/' + val%5B0%5D + val%5B1%5D + (val%5B3%5D ? %22/%22 + val%5B3%5D : %22%22) + '/' + val%5B2%5D + '-' + rank + '.html
%22%3E'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.