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
|
---|---|---|---|---|---|---|---|
7be2f73b2254250416031d0dc0704ee212f40a5f
|
Change ci alias to point to travisMatrix:v4
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-mocha-cov');
grunt.loadNpmTasks('grunt-exec');
grunt.loadTasks('tasks');
grunt.initConfig({
jshint: {
all: ['tasks/*.js'],
options: {
reporter: require('jshint-stylish'),
eqeqeq: true,
es3: true,
indent: 2,
newcap: true,
quotmark: 'single',
boss: true
}
},
mochacov: {
lcov: {
options: {
reporter: 'mocha-lcov-reporter',
instrument: true,
ui: 'mocha-given',
require: ['coffee-script/register', 'should', 'should-sinon'],
output: 'coverage/coverage.lcov'
},
src: ['test/**/*.coffee'],
},
html: {
options: {
reporter: 'html-cov',
ui: 'mocha-given',
require: ['coffee-script/register', 'should', 'should-sinon'],
output: 'coverage/coverage.html'
},
src: ['test/**/*.coffee']
}
},
mochaTest: {
options: {
reporter: 'spec',
ui: 'mocha-given',
require: ['coffee-script/register', 'should', 'should-sinon']
},
test: {
src: ['test/**/*.coffee']
}
},
travisMatrix: {
v4: {
test: function() {
return /^v4/.test(process.version);
},
tasks: ['mochacov:lcov', 'exec:codeclimate']
}
},
exec: {
codeclimate: 'codeclimate-test-reporter < coverage/lcov.info'
}
});
grunt.registerTask('mocha', ['mochaTest']);
grunt.registerTask('default', ['jshint:all', 'mocha']);
grunt.registerTask('coverage', ['mochacov:html']);
grunt.registerTask('ci', ['jshint:all', 'mocha', 'travis']);
};
|
JavaScript
| 0 |
@@ -1803,16 +1803,25 @@
'travis
+Matrix:v4
'%5D);%0A%7D;%0A
|
7948975cd76f7deaf676124376ab6736a424426a
|
fix use strict statement
|
Gruntfile.js
|
Gruntfile.js
|
'use strict;'
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-jscs");
var srcFiles = ["app/**/*.js", "lib/**/*.js", "server.js"];
grunt.initConfig({
jshint: {
files: srcFiles,
options: {
globalstrict: true,
quotmark: false,
smarttabs: true,
trailing: true,
undef: true,
unused: true,
indent: 2,
node: true,
globals: {
$: true
}
}
},
jscs: {
src: srcFiles,
options: {
preset: "airbnb",
requireDotNotation: null,
disallowMultipleVarDecl: null,
requireMultipleVarDecl: null
}
}
});
grunt.registerTask("default", [ "jshint", "jscs"]);
};
|
JavaScript
| 0.000043 |
@@ -8,10 +8,10 @@
rict
-;
'
+;
%0A%0Amo
|
3c128d36edd761bcd354e98e61f2e8d646cb738d
|
remove console.log statement
|
src/jquery.viafauto.js
|
src/jquery.viafauto.js
|
/*
* A jQuery UI widget for getting VIAF identifiers via autosuggest
* h/t to Matthew Hailwood http://jquery.webspirited.com/author/Hailwood/ for his
* most excellent jquery UI widget framework at
* http://jquery.webspirited.com/2011/03/jquery-ui-widget-development-skeleton/#more-109
*/
/*
* Depends on jQuery UI version 1.8.1 or higher
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.position.js
* jquery.ui.button.js
* jquery.ui.dialog.js
* jquery.ui.autocomplete.js
*
* Assumes jQuery UI css, images, etc.
*
* Make sure you load the right version of jQuery for your version of jQuery UI!!
*/
/*
* We can use $ as an alias to jQuery in a closure/wrapper avoiding conflict w/ prototype et al.
*/
(function($) {
$.widget("ui.viafauto", $.ui.autocomplete, {
options: {
// select: function(event, ui) { alert("Selected!"); return this._super(event, ui); },
source: function(request, response) {
var term = $.trim(request.term);
var url = "http://viaf.org/viaf/AutoSuggest?query=" + term;
var me = this;
$.ajax({
url: url,
dataType: "jsonp",
success: function(data) {
if (data.result) {
response( $.map( data.result, function(item) {
var retLbl = item.term + " [" + item.nametype + "]";
return {
label: retLbl,
value: item.term,
id: item.viafid,
nametype: item.nametype
}
}));
} else {
console.log(me);
me._trigger('nomatch', null, {term: term});
}
},
}); // end of $.ajax()
}}, // end of source:, options
/*
* Punt a few fundamental tasks to the parent class
*/
_create: function() {
return this._super();
},
_setOption: function( key, value ) {
this._super( key, value );
},
_setOptions: function( options ) {
this._super( options );
}
});
})(jQuery);
|
JavaScript
| 0.000035 |
@@ -1655,45 +1655,8 @@
e %7B%0A
- console.log(me);%0A
|
cdeb1e77e4e9944605f2e77edaf773aaadd30cec
|
fix location for hogan.js
|
configured-tasks.js
|
configured-tasks.js
|
var wrap = require('gulp-wrap-amd');
var dest = require('gulp-dest');
var rename = require('gulp-rename');
module.exports = {};
module.exports.bootstrap = function(builder) {
var srcPath;
try {
srcPath = require('path').resolve(builder.resolveModule('bootstrap'), '..', '..', 'js');
} catch (exc) {
srcPath = builder.resolveModule('bootstrap-sass')+'/bootstrap';
}
builder.add('js', 'bootstrap')
.src([srcPath+'/*.js', '!**/popover.js'])
.pipe(wrap, {
deps: ['jquery'],
params: ['jQuery'],
exports: 'jQuery'
})
.pipe(dest, 'bootstrap');
builder.add('js', 'bootstrap-popover')
.src(srcPath+'/popover.js')
.pipe(wrap, {
deps: ['jquery', './tooltip'],
params: ['jQuery'],
exports: 'jQuery'
})
.pipe(dest, 'bootstrap');
};
module.exports.amplify = function(builder, config) {
if (config && config.shimney) {
builder.add('js', 'amplify')
.src(builder.resolveModule('shimney-amplify')+'/main.js')
.pipe(rename, 'amplify.js');
} else {
throw new Error('cannot build amplify from npm :(. use { shimney: true } for config');
/*
builder.add('js', 'amplify')
.src([builder.resolveModule('amplify')+'/lib/amplify/amplify.js'])
.pipe(wrap, {
deps: [],
params: [],
exports: 'amplify'
});
*/
}
};
module.exports.jquery = function(builder) {
return builder.add('js', 'jquery')
.src(builder.resolveModule('jquery')+'/jquery.js')
};
module.exports.knockout = function(builder, config) {
return builder.add('js', 'knockout')
.src(builder.resolveModule('knockout')+'/knockout-latest'+(config.debug ? '.debug' : '' )+'.js')
.pipe(rename, 'knockout.js');
};
module.exports['knockout-mapping'] = module.exports.knockoutMapping = function(builder) {
return builder.add('js', 'knockout-mapping')
.src(builder.resolveModule('knockout-mapping')+'/knockout.mapping.js')
.pipe(rename, 'knockout-mapping.js');
};
module.exports.moment = function(builder) {
return builder.add('js', 'moment')
.src(builder.resolveModule('moment')+'/moment.js')
};
module.exports['font-awesome'] = function(builder) {
return builder.add('fonts', 'font-awesome')
.src([builder.resolveModule('font-awesome')+'/fonts/**/*']);
};
module.exports.sammy = function(builder) {
return builder.add('js', 'sammy')
.src(builder.resolveModule('shimney-sammy')+'/main.js')
.pipe(rename, 'sammy.js');
};
module.exports['cookie-monster'] = function(builder) {
return builder.add('js', 'cookie-monster')
.src(builder.resolveModule('shimney-cookie-monster')+'/main.js')
.pipe(rename, 'cookie-monster.js');
};
module.exports.hogan = function(builder, config) {
var version = config.version || '2.0.0';
return builder.add('js', 'hogan')
.src(builder.resolveModule('hogan.js')+'/web/builds/'+version+'/hogan-'+version+'.amd.js')
.pipe(rename, 'hogan.js');
};
module.exports.lodash = function(builder, config) {
if (config && config.shimney) {
return builder.add('js', 'lodash')
.src(builder.resolveModule('shimney-lodash')+'/main.js')
.pipe(rename, 'lodash.js');
} else {
return builder.add('js', 'lodash')
.src(builder.resolveModule('lodash')+'/lodash.compat.js')
.pipe(rename, 'lodash.js');
}
};
module.exports.json = function(builder, config) {
return builder.add('js', 'json')
.src(builder.resolveModule('shimney-json')+'/main.js')
.pipe(rename, 'JSON.js');
};
module.exports.superagent = function(builder, config) {
if (config && config.shimney) {
return builder.add('js', 'superagent')
.src(builder.resolveModule('shimney-superagent')+'/main.js')
.pipe(rename, 'superagent.js');
} else {
var execSync = require('child_process').execSync;
var modulePath = builder.resolveModule('superagent');
execSync('browserify --standalone superagent --outfile superagent.js .', {'cwd': modulePath});
return builder.add('js', 'superagent')
.src(modulePath+'/superagent.js')
}
};
module.exports['webforge-js-components'] = function(builder, config) {
var modulePath = builder.resolveModule('webforge-js-components');
builder.add('js', 'webforge-js-components')
.src(modulePath+'/src/js/Webforge/**/*.js')
.pipe(builder.dest, 'Webforge')
builder.add('js', 'webforge-js-components-modules')
.src(modulePath+'/src/js/default-modules/**/*.js')
.pipe(builder.dest, 'modules')
};
module.exports.accounting = function(builder, config) {
return builder.add('js', 'accounting')
.src(builder.resolveModule('accounting')+'/accounting.js')
//.pipe(rename, '.js');
};
module.exports['knockout-collection'] = function(builder, config) {
return builder.add('js', 'knockout-collection')
.src(builder.resolveModule('knockout-collection')+'/index.js')
.pipe(rename, 'knockout-collection.js');
};
|
JavaScript
| 0.000006 |
@@ -2856,16 +2856,19 @@
.js')+'/
+../
web/buil
|
515e5c22f26c2a7bf514f8045478342822521ced
|
Add support to an onDestroy event callback
|
src/js/base/Context.js
|
src/js/base/Context.js
|
define([
'jquery',
'summernote/base/core/func',
'summernote/base/core/list',
'summernote/base/core/dom'
], function ($, func, list, dom) {
/**
* @param {jQuery} $note
* @param {Object} options
* @return {Context}
*/
var Context = function ($note, options) {
var self = this;
var ui = $.summernote.ui;
this.memos = {};
this.modules = {};
this.layoutInfo = {};
this.options = options;
/**
* create layout and initialize modules and other resources
*/
this.initialize = function () {
this.layoutInfo = ui.createLayout($note, options);
this._initialize();
$note.hide();
return this;
};
/**
* destroy modules and other resources and remove layout
*/
this.destroy = function () {
this._destroy();
$note.removeData('summernote');
ui.removeLayout($note, this.layoutInfo);
};
/**
* destory modules and other resources and initialize it again
*/
this.reset = function () {
var disabled = self.isDisabled();
this.code(dom.emptyPara);
this._destroy();
this._initialize();
if (disabled) {
self.disable();
}
};
this._initialize = function () {
// add optional buttons
var buttons = $.extend({}, this.options.buttons);
Object.keys(buttons).forEach(function (key) {
self.memo('button.' + key, buttons[key]);
});
var modules = $.extend({}, this.options.modules, $.summernote.plugins || {});
// add and initialize modules
Object.keys(modules).forEach(function (key) {
self.module(key, modules[key], true);
});
Object.keys(this.modules).forEach(function (key) {
self.initializeModule(key);
});
};
this._destroy = function () {
// destroy modules with reversed order
Object.keys(this.modules).reverse().forEach(function (key) {
self.removeModule(key);
});
Object.keys(this.memos).forEach(function (key) {
self.removeMemo(key);
});
};
this.code = function (html) {
var isActivated = this.invoke('codeview.isActivated');
if (html === undefined) {
this.invoke('codeview.sync');
return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html();
} else {
if (isActivated) {
this.layoutInfo.codable.val(html);
} else {
this.layoutInfo.editable.html(html);
}
$note.val(html);
this.triggerEvent('change', html);
}
};
this.isDisabled = function () {
return this.layoutInfo.editable.attr('contenteditable') === 'false';
};
this.enable = function () {
this.layoutInfo.editable.attr('contenteditable', true);
this.invoke('toolbar.activate', true);
};
this.disable = function () {
// close codeview if codeview is opend
if (this.invoke('codeview.isActivated')) {
this.invoke('codeview.deactivate');
}
this.layoutInfo.editable.attr('contenteditable', false);
this.invoke('toolbar.deactivate', true);
};
this.triggerEvent = function () {
var namespace = list.head(arguments);
var args = list.tail(list.from(arguments));
var callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')];
if (callback) {
callback.apply($note[0], args);
}
$note.trigger('summernote.' + namespace, args);
};
this.initializeModule = function (key) {
var module = this.modules[key];
module.shouldInitialize = module.shouldInitialize || func.ok;
if (!module.shouldInitialize()) {
return;
}
// initialize module
if (module.initialize) {
module.initialize();
}
// attach events
if (module.events) {
dom.attachEvents($note, module.events);
}
};
this.module = function (key, ModuleClass, withoutIntialize) {
if (arguments.length === 1) {
return this.modules[key];
}
this.modules[key] = new ModuleClass(this);
if (!withoutIntialize) {
this.initializeModule(key);
}
};
this.removeModule = function (key) {
var module = this.modules[key];
if (module.shouldInitialize()) {
if (module.events) {
dom.detachEvents($note, module.events);
}
if (module.destroy) {
module.destroy();
}
}
delete this.modules[key];
};
this.memo = function (key, obj) {
if (arguments.length === 1) {
return this.memos[key];
}
this.memos[key] = obj;
};
this.removeMemo = function (key) {
if (this.memos[key] && this.memos[key].destroy) {
this.memos[key].destroy();
}
delete this.memos[key];
};
this.createInvokeHandler = function (namespace, value) {
return function (event) {
event.preventDefault();
self.invoke(namespace, value || $(event.target).closest('[data-value]').data('value'));
};
};
this.invoke = function () {
var namespace = list.head(arguments);
var args = list.tail(list.from(arguments));
var splits = namespace.split('.');
var hasSeparator = splits.length > 1;
var moduleName = hasSeparator && list.head(splits);
var methodName = hasSeparator ? list.last(splits) : list.head(splits);
var module = this.modules[moduleName || 'editor'];
if (!moduleName && this[methodName]) {
return this[methodName].apply(this, args);
} else if (module && module[methodName] && module.shouldInitialize()) {
return module[methodName].apply(module, args);
}
};
return this.initialize();
};
return Context;
});
|
JavaScript
| 0.000001 |
@@ -2049,32 +2049,117 @@
key);%0A %7D);%0A
+ // trigger custom onDestroy callback%0A this.triggerEvent('destroy', this);%0A
%7D;%0A%0A this
|
4f7fe3fb0c101ecc4e0f4b64fcda05e58c446a6b
|
Add more zipup tasks for further testing
|
Gruntfile.js
|
Gruntfile.js
|
/*
* Copyright (c) 2013, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-mochaccino');
grunt.loadTasks('tasks');
grunt.initConfig({
jshint: {
all: ['tasks/**'],
// see http://jshint.com/docs/
options: {
camelcase: true,
curly: true,
eqeqeq: true,
forin: true,
immed: true,
indent: 2,
noempty: true,
quotmark: 'single',
undef: true,
globals: {
'require': false,
'module': false,
'process': false,
'__dirname': false,
'console': false
},
unused: true,
browser: true,
strict: true,
trailing: true,
maxdepth: 2,
newcap: false
}
},
release: {
options: {
add: false,
commit: false,
push: false,
bump: true,
tag: true,
pushTags: true,
npm: true,
folder: '.',
tagName: '<%= version %>',
tagMessage: 'Version <%= version %>'
}
},
// the tasks below are used to test _this_ plugin
clean: ['build'],
zipup: {
tizen_tiny_app_wgt: {
appName: 'tizen-tiny-app',
suffix: 'wgt',
version: '0.1.0',
files: [
{
cwd: 'test/fixtures',
expand: true,
src: 'tizen-tiny-app/**'
}
],
outDir: 'build'
},
specific_files: {
appName: 'specific-files',
version: '0.2.0',
files: [
{ src: 'test/fixtures/specific-files/app/lib/test1.js' },
{ src: 'test/fixtures/specific-files/app/lib/test2.js' },
{ src: 'test/fixtures/specific-files/app/src/test3.js' },
{ src: 'test/fixtures/specific-files/app/src/test4.js' }
],
outDir: 'build'
}
},
mochaccino: {
all: {
files: { src: 'test/*.test.js' },
reporter: 'dot'
}
}
});
grunt.registerTask('default', [
'jshint',
'clean',
'zipup',
'mochaccino:all'
]);
};
|
JavaScript
| 0 |
@@ -2195,24 +2195,561 @@
ir: 'build'%0A
+ %7D,%0A%0A commit_id: %7B%0A appName: 'commit-id',%0A version: '0.3.0',%0A addGitCommitId: true,%0A files: %5B%0A %7B src: 'test/fixtures/specific-files/**', expand: true %7D%0A %5D,%0A outDir: 'build'%0A %7D,%0A%0A custom_dest: %7B%0A appName: 'custom-dest',%0A version: '0.4.0',%0A files: %5B%0A %7B%0A cwd: 'test/fixtures/specific-files/app',%0A src: '**',%0A expand: true,%0A dest: 'custom_dest_app'%0A %7D%0A %5D,%0A outDir: 'build'%0A
%7D%0A
|
618e572a701d298a99cce65c119d39dd948029c8
|
Edit Gruntfile paths
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['src/**/*.js'],
dest: 'js/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
build: {
files: {
'js/npm.min.js': 'js/npm.js',
'js/jquery.min.js': 'js/jquery.js',
}
},
dist: {
files: {
'js/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
imagemin: {
png: {
options: {
optimizationLevel: 7
},
files: [
{
expand: true,
cwd: 'images/',
src: ['**/*.png'],
dest: 'images/',
ext: '.png'
}
]
},
jpg: {
options: {
optimizationLevel: 7
},
files: [
{
expand: true,
cwd: 'images/',
src: ['**/*.jpg'],
dest: 'images/',
ext: '.jpg'
}
]
}
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'qunit']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('test', ['jshint', 'qunit']);
grunt.registerTask('imagemin', ['imagemin']);
grunt.registerTask('imagepng', ['imagemin:png']);
grunt.registerTask('imagejpg', ['imagemin:jpg']);
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
};
|
JavaScript
| 0.000001 |
@@ -188,19 +188,18 @@
src: %5B'
+j
s
-rc
/**/*.js
@@ -376,24 +376,131 @@
n'%0A %7D,%0A
+ dist: %7B%0A src: 'js/%3C%25= pkg.name %25%3E.js',%0A dest: 'js/%3C%25= pkg.name %25%3E.min.js'%0A %7D,%0A
build:
@@ -619,125 +619,8 @@
%7D%0A
- %7D,%0A dist: %7B%0A files: %7B%0A 'js/%3C%25= pkg.name %25%3E.min.js': %5B'%3C%25= concat.dist.dest %25%3E'%5D%0A %7D%0A
|
7ff1f1649ea7e081d5ef0b67b486f60787500f95
|
fix modal/offcanvas style scope support
|
src/js/mixins/modal.js
|
src/js/mixins/modal.js
|
import { on, offAll } from 'src/js/util/index'
const doc = document.documentElement
const body = document.body
let active
let activeCount
on(doc, 'click', e => {
if (active && !active.$refs.panel.contains(e.target)) {
active.$emit('click-out', e)
}
})
on(doc, 'keyup', e => {
if (e.keyCode === 27 && active) {
e.preventDefault()
active.$emit('key-esc', e)
}
})
export default {
props: {
show: {
type: Boolean,
default: false
},
overlay: {
type: Boolean,
default: true
}
},
data: () => ({
active,
activeCount
}),
mounted () {
// move dom to body
body.appendChild(this.$el)
},
methods: {
_beforeEnter () {
if (!active) {
body.style['overflow-y'] = this.getScrollbarWidth() && this.overlay ? 'scroll' : ''
}
},
_afterEnter () {
// if any previous modal active
// emit event for further actions
if (active) {
active.$emit('inactive')
}
// change current active modal
active = this
activeCount++
},
_afterLeave () {
activeCount--
// if no active modals left
if (!activeCount) {
body.style['overflow-y'] = ''
}
if (active === this) {
active = null
}
},
getScrollbarWidth () {
const width = doc.style.width
doc.style.width = ''
const scrollbarWidth = window.innerWidth - doc.offsetWidth
if (width) {
doc.style.width = width
}
return scrollbarWidth
}
},
beforeDestroy () {
offAll(this._uid)
if (this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el)
}
}
}
|
JavaScript
| 0 |
@@ -590,83 +590,8 @@
%7D),%0A
- mounted () %7B%0A // move dom to body%0A body.appendChild(this.$el)%0A %7D,%0A
me
|
7f45819cb75fe7ac9b784162b287d9c6c9708ec8
|
use bowser package
|
src/js/utils/common.js
|
src/js/utils/common.js
|
import * as constants from '../services/constants';
import {detect} from "detect-browser"
export function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
export function getActiveLanguage(langs){
for (var i = 0; i< langs.length; i++){
if (langs[i].active){
return langs[i].code
}
}
return "en"
}
export function getPath(path, listParams){
var index = 0
listParams.map(param => {
var value = getParameterByName(param.key)
if (!value) return
if (value === param.default) return
if (index === 0) {
path += `?${param.key}=${value}`
index ++
return
}
path += `&${param.key}=${value}`
})
return path
}
export var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
const browser = detect()
export var checkBrowser = {
isFirefox: function() {
return browser.name && browser.name === "firefox"
},
isChrome: function() {
return browser.name && browser.name === "chrome"
},
isSafari: function() {
return navigator.userAgent.indexOf("Safari") != -1
},
isNotFCSBrowser: function() {
return !this.isFirefox && !this.isChrome && !this.isSafari;
}
}
export function getAssetUrl(uri = "") {
return constants.ASSET_URL + uri.toLowerCase();
}
export function isUserEurope(){
var isEurope = getCookie("is_europe")
return isEurope === true || isEurope === 'true'
}
export function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
export function timeout(ms, promise) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject(new Error("timeout"))
}, ms)
promise.then(resolve, reject)
})
}
|
JavaScript
| 0 |
@@ -56,38 +56,33 @@
ort
-%7Bdetect%7D from %22detect-br
+* as bowser from 'b
owser
-%22
+'
%0A%0Aex
@@ -1697,33 +1697,8 @@
%7D;%0A%0A
-const browser = detect()%0A
expo
@@ -1768,50 +1768,24 @@
urn
+!!
b
-r
owser.
-name && browser.name === %22
firefox
-%22
%0A
@@ -1834,49 +1834,23 @@
urn
-browser.name && browser.name === %22
+!!bowser.
chrome
-%22
%0A
@@ -1899,51 +1899,23 @@
urn
-navigator.userAgent.indexOf(%22Safari%22) != -1
+!!bowser.safari
%0A
|
dca1e42c3fec66e4a6a8b8dfee7b70fc7acbfec6
|
Add back testrunner.html test javascript file
|
Gruntfile.js
|
Gruntfile.js
|
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> Nicole Sullivan and Nicholas C. Zakas;\n' +
'* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> <%= _.pluck(pkg.licenses, "url").join(", ") %> */\n',
//Parser lib copy for verions that can't user requirejs
parserlib: 'node_modules/parserlib/lib/node-parserlib.js',
//Core CSSLint files used by most versions
csslint_files: [
'src/core/CSSLint.js',
'src/core/*.js',
'src/rules/*.js',
'src/formatters/*.js'
],
//Core fileset used by most versions
core_files: [
'<%= parserlib %>',
'<%= csslint_files %>'
],
// Task configuration.
concat: {
core: {
options: {
banner: '<%= banner %>\n' +
//Hack for using the node version of parserlib
'var exports = exports || {};\n' +
'var CSSLint = (function(){\n',
footer: '\nreturn CSSLint;\n})();'
},
src: [
'<%= core_files %>'
],
dest: 'build/<%= pkg.name %>.js'
},//Build environment workers
rhino: {
options: {
banner: 'var exports = exports || {};\n' //Hack for using the node version of parserlib
},
src: [
'<%= concat.core.dest %>',
'src/cli/{common, rhino}.js'
],
dest: 'build/<%= pkg.name %>-rhino.js'
},
node: {
options: {
banner: '<%= banner %>',
footer: '\nexports.CSSLint = CSSLint;'
},
files: {
'build/<%= pkg.name %>-node.js': ['<%= core_files %>'],
'build/npm/lib/<%= pkg.name %>-node.js': ['<%= core_files %>']
}
},
node_cli: {
options: {
banner: '#!/usr/bin/env node\n<%= banner %>'
},
src: [
'src/cli/{common, node}.js'
],
dest: 'build/npm/cli.js'
},
worker: {
options: {
banner: '<%= banner %>\n' +
//Hack for using the node version of parserlib
'var exports = exports || {};\n'
},
src: [
'<%= core_files %>',
'src/worker/*.js'
],
dest: 'build/<%= pkg.name %>-worker.js'
},
wsh: {
options: {
banner: '<%= banner %>\n' +
//Hack for using the node version of parserlib
'var exports = exports || {};\n'
},
src: [
'<%= core_files %>',
'src/cli/{common, wsh}.js'
],
dest: 'build/<%= pkg.name %>-wsh.js'
}
},
jshint: {
options: {
curly: true,
//eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
//unused: true,
boss: true,
eqnull: true,
// Copied from build.xml
forin: true,
noempty: true,
rhino: false,
// Temporary to suppress warnings that exist when using the latest JSHint
eqeqeq: false,
unused: false,
globals: {
jQuery: true
}
},
gruntfile: {
src: 'Gruntfile.js'
},
all: {
src: ['src/**/*.js']
},
tests: {
src: ['tests/**/*.js']
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint']
},
src: {
files: '<%= jshint.all.src %>',
tasks: ['jshint:all']
},
lib_test: {
files: '<%= jshint.tests.src %>',
tasks: ['jshint:tests']
}
},
yuitest: {
tests: {
src: [
'tests/**/*.js'
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task.
grunt.registerTask('default', ['test']);
grunt.registerTask('test', ['jshint', 'concat', 'yuitest']);
//Run the YUITest suite
grunt.registerMultiTask('yuitest', 'Run the YUITests for the project', function() {
/*jshint evil:true, node: true */
var start = Date.now();
var YUITest = require("yuitest");
var CSSLint = require('./build/csslint-node').CSSLint;
var files = this.filesSrc;
var TestRunner = YUITest.TestRunner;
var done = this.async();
//Eval each file so the tests are brought into this scope were CSSLint and YUITest are loaded already
files.forEach(function(filepath) {
eval(grunt.file.read(filepath));
});
//Generic test event handler for individual test
function handleTestResult(data){
switch(data.type) {
case TestRunner.TEST_FAIL_EVENT:
grunt.verbose.fail("Test named '" + data.testName + "' failed with message: '" + data.error.message + "'.").or.write(".".red);
break;
case TestRunner.TEST_PASS_EVENT:
grunt.verbose.ok("Test named '" + data.testName + "' passed.").or.write(".".green);
break;
case TestRunner.TEST_IGNORE_EVENT:
grunt.verbose.warn("Test named '" + data.testName + "' was ignored.").or.write(".".yellow);
break;
}
}
//Event to execute after all tests suites are finished
function reportResults(allsuites) {
var end = Date.now();
var elapsed = end - start;
grunt.log.writeln().write("Finished in " + (elapsed / 1000) + " seconds").writeln();
if (allsuites.results.failed > 0) {
grunt.fail.warn(allsuites.results.failed + "/" + allsuites.results.total + "tests failed");
} else {
grunt.log.ok(allsuites.results.passed + "/" + allsuites.results.total + "tests passed");
if (allsuites.results.ignored > 0) {
grunt.log.warn("Ignored: " + allsuites.results.ignored);
}
}
//Tell grunt we're done the async testing
done();
}
//Add event listeners
TestRunner.subscribe(TestRunner.TEST_FAIL_EVENT, handleTestResult);
TestRunner.subscribe(TestRunner.TEST_IGNORE_EVENT, handleTestResult);
TestRunner.subscribe(TestRunner.TEST_PASS_EVENT, handleTestResult);
TestRunner.subscribe(TestRunner.COMPLETE_EVENT, reportResults);
TestRunner.run();
});
};
|
JavaScript
| 0.000001 |
@@ -2760,32 +2760,244 @@
%0A %7D,%0A
+ tests: %7B%0A src: %5B%0A '!tests/all-rules.js',%0A 'tests/**/*.js'%0A %5D,%0A dest: 'build/%3C%25= pkg.name %25%3E-tests.js'%0A %7D,%0A
work
|
5f0a555a9ed760c32a72a33cf115f7f529ed114b
|
Remove box prefix from config
|
config/default.js
|
config/default.js
|
/*
* Things Gateway Default Configuration.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
module.exports = {
// Expose CLI
cli: true,
ports: {
https: 4443,
http: 8080
},
adapters : {
gpio: {
enabled: false,
path: './adapters/gpio',
pins: {
18: {
name: 'led',
direction: 'out', // 'in' or 'out'
value: 0 // value on required when 'direction' is 'out'
},
}
},
zigbee: {
enabled: true,
path: './adapters/zigbee',
},
zwave: {
enabled: true,
path: './adapters/zwave',
}
},
adapterManager: {
pairingTimeout: 3 * 60, // seconds
},
database: {
filename: './db.sqlite3',
removeBeforeOpen: false,
},
authentication: {
enabled: true,
defaultUser: null,
secret: 'top secret 51' // DO NOT USE THIS IN PRODUCTION
},
ssltunnel: {
enabled: true,
registration_endpoint: 'mozilla-iot.org',
domain: 'box.mozilla-iot.org',
pagekite_cmd: './pagekite.py',
port: 443
}
};
|
JavaScript
| 0.000002 |
@@ -1167,12 +1167,8 @@
n: '
-box.
mozi
|
caa58d79bb4838030e4b710564f1ffe528a73240
|
Correct includePaths
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
grunt.initConfig({
// Builds Sass
sass: {
dev: {
files: {
'public/stylesheets/main.css': 'public/sass/main.scss',
'public/stylesheets/main-ie6.css': 'public/sass/main-ie6.scss',
'public/stylesheets/main-ie7.css': 'public/sass/main-ie7.scss',
'public/stylesheets/main-ie8.css': 'public/sass/main-ie8.scss',
'public/stylesheets/elements-page.css': 'public/sass/elements-page.scss',
'public/stylesheets/elements-page-ie6.css': 'public/sass/elements-page-ie6.scss',
'public/stylesheets/elements-page-ie7.css': 'public/sass/elements-page-ie7.scss',
'public/stylesheets/elements-page-ie8.css': 'public/sass/elements-page-ie8.scss',
'public/stylesheets/prism.css': 'public/sass/prism.scss',
},
options: {
includePaths: ['govuk_modules/public/sass'],
outputStyle: 'expanded',
imagePath: '../images'
}
}
},
// Copies templates and assets from external modules and dirs
copy: {
assets: {
files: [{
expand: true,
cwd: 'app/assets/',
src: ['**/*', '!sass/**'],
dest: 'public/'
}]
},
govuk: {
files: [{
expand: true,
cwd: 'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit',
src: '**',
dest: 'govuk_modules/govuk_frontend_toolkit/'
},
{
expand: true,
cwd: 'node_modules/govuk_template_mustache/',
src: '**',
dest: 'govuk_modules/govuk_template/'
}]
},
},
// workaround for libsass
replace: {
fixSass: {
src: ['govuk_modules/public/sass/**/*.scss'],
overwrite: true,
replacements: [{
from: /filter:chroma(.*);/g,
to: 'filter:unquote("chroma$1");'
}]
}
},
// Watches styles and specs for changes
watch: {
css: {
files: ['public/sass/**/*.scss'],
tasks: ['sass'],
options: { nospawn: true }
}
},
// nodemon watches for changes and restarts app
nodemon: {
dev: {
script: 'server.js',
options: {
ext: 'html, js'
}
}
},
concurrent: {
target: {
tasks: ['watch', 'nodemon'],
options: {
logConcurrentOutput: true
}
}
},
// Lint scss files
shell: {
multiple: {
command: [
'bundle',
'bundle exec govuk-lint-sass public/sass/elements/'
].join('&&')
}
}
});
[
'grunt-contrib-copy',
'grunt-contrib-watch',
'grunt-sass',
'grunt-nodemon',
'grunt-text-replace',
'grunt-concurrent',
'grunt-shell'
].forEach(function (task) {
grunt.loadNpmTasks(task);
});
grunt.registerTask(
'convert_template',
'Converts the govuk_template to use mustache inheritance',
function () {
var script = require(__dirname + '/lib/template-conversion.js');
script.convert();
grunt.log.writeln('govuk_template converted');
}
);
grunt.registerTask('default', [
'copy',
'convert_template',
'replace',
'sass',
'concurrent:target'
]);
grunt.registerTask(
'test_default',
'Test that the default task runs the app',
[
'copy',
'convert_template',
'replace',
'sass'
]
);
grunt.registerTask(
'lint',
'Use govuk-scss-lint to lint the sass files',
function() {
grunt.task.run('shell', 'lint_message');
}
);
grunt.registerTask(
'lint_message',
'Output a message once linting is complete',
function() {
grunt.log.write("scss lint is complete, without errors.");
}
);
grunt.registerTask(
'test',
'Lint the Sass files, then check the app runs',
function() {
grunt.task.run('lint', 'test_default', 'test_message');
}
);
grunt.registerTask(
'test_message',
'Output a message once the tests are complete',
function() {
grunt.log.write("scss lint is complete and the app runs, without errors.");
}
);
};
|
JavaScript
| 0 |
@@ -884,16 +884,29 @@
Paths: %5B
+%0A
'govuk_m
@@ -916,20 +916,117 @@
les/
-public/sass'
+govuk_template/assets/stylesheets',%0A 'govuk_modules/govuk_frontend_toolkit/stylesheets'%0A
%5D,%0A
|
1c4e23ae08d84354574112131d5cbc19871cef57
|
Add more NPM release commands.
|
Gruntfile.js
|
Gruntfile.js
|
// Generated on 2014-07-07 using generator-nodejs 2.0.0
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js',
'test/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
jison: {
all : {
files: { 'lib/parser.js': 'data/grypher.jison' }
}
},
coffeelint: {
all: ['src/*.coffee', 'test/*.coffee'],
options: {
configFile: 'coffeelint.json'
}
},
coffee: {
src: {
files: [
{ expand: true, src: ['**.coffee'], cwd: 'src/', dest: 'lib/', ext: '.js' }
]
},
test: {
files: [
{ expand: true, src: ['**.test.coffee'], cwd: 'test/', dest: 'test/', ext: '.test.cpl.js' }
]
},
e2e: {
files: [
{ expand: true, src: ['**.e2e.coffee'], cwd: 'test/', dest: 'test/', ext: '.e2e.cpl.js' }
]
},
options: {
sourceMap: true
}
},
mochacov: {
test: {
options: {
reporter: 'spec',
ui: 'tdd'
}
},
travis: {
options: {
coveralls: true
}
},
local: {
options: {
reporter: 'html-cov',
output: 'coverage/coverage.html'
}
},
options: {
files: ['test/**/*.test.js', 'test/**/*.test.*.js']
}
},
execute: {
e2e: {
src: ['test/*.e2e.js', 'test/*.e2e.*.js']
}
},
copy: {
sources: {
files: [
{ expand: true, src: ['**.js'], cwd: 'src/', dest: 'lib/' }
],
mode: true
}
},
clean: {
lib: ['lib/'],
doc: ['doc/'],
test: ['test/**/*.cpl.js', 'test/tmp/'],
sourceMaps: ['**/*.js.map', '!node_modules/**/*.js']
},
codo: {
options: {
name: 'Node Grypher',
title: 'Node.js parser from Grypher to JSON Schema',
extra: [ 'LICENSE-MIT' ],
undocumented: true,
stats: false
},
src: [ 'src/' ]
},
watch: {
all: {
files: ['**/*.js', '**/*.coffee', 'data/*.jison', 'test/fixtures/*.*', '!node_modules/**/*.js', '!lib/**/*.js'],
tasks: ['default'] ,
options: {
nospawn: true
}
}
}
});
// Send coverage report to Coveralls.io only for Travis CI builds.
var mochaCoverageTask = 'mochacov:' + (process.env.TRAVIS ? 'travis' : 'local');
grunt.loadNpmTasks('grunt-jison');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-cov');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-codo');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.registerTask('compile', ['clean', 'jshint', 'jison', 'coffeelint', 'coffee', 'copy:sources']);
grunt.registerTask('document', ['clean:doc', 'codo']);
grunt.registerTask('e2e', ['execute:e2e']);
grunt.registerTask('test', ['mochacov:test', 'e2e']);
grunt.registerTask('test-ci', [mochaCoverageTask, 'e2e']);
grunt.registerTask('ci', ['compile', 'test-ci']);
grunt.registerTask('default', ['compile', 'test', 'document', 'watch']);
grunt.registerTask('publish', ['ci', 'release']);
};
|
JavaScript
| 0 |
@@ -4061,16 +4061,36 @@
test-ci'
+, 'clean:sourceMaps'
%5D);%0A
@@ -4216,11 +4216,79 @@
ase'%5D);%0A
+ grunt.registerTask('prerelease', %5B'ci', 'release:prerelease'%5D);%0A
%7D;%0A
|
39642ee9e2708081e4984355bab4ba43c983a38d
|
Declare Media namespace
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * peeracle v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
' * Copyright 2015\n' +
' * Licensed under <%= pkg.license %>\n' +
' */\n',
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
concat: {
options: {
banner: '<%= banner %>\n' +
'\'use strict\';\n' +
'var Peeracle = Peeracle || {};\n',
process: function(src, filepath) {
return src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1')
.replace(/(^|\n)[ \t]*(var Peeracle = Peeracle \|\| {});?\s*/g, '$1')
.replace(/module.exports = (.*);/g, 'Peeracle.$1 = $1;');
},
stripBanners: false
},
dist: {
src: [
'src/utils.js',
'src/file.js',
'src/media.js',
'src/media.webm.js',
'src/metadata.js',
'src/mediachannel.js',
'src/signalchannel.js',
'src/peer.js',
'src/tracker.js'
],
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
}
},
preprocess: {
inline: {
src: ['dist/*.js'],
options: {
inline: true,
context: {
DEBUG: false
}
}
}
},
uglify: {
options: {
preserveComments: 'some'
},
build: {
src: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-preprocess');
// Default task(s).
grunt.registerTask('default', ['concat', 'preprocess', 'karma', 'uglify']);
// Build only task
grunt.registerTask('dist', ['concat', 'preprocess', 'uglify']);
};
|
JavaScript
| 0.000094 |
@@ -521,19 +521,42 @@
e =
-Peeracle %7C%7C
+%7B%7D;%5Cn' +%0A 'Peeracle.Media =
%7B%7D;
@@ -586,16 +586,17 @@
function
+
(src, fi
|
3c72c4f7ea241e14450f9ecdc9d3f1650fabbe56
|
Add target to grunt.
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
strip: {
util: {
src: ['src/util/core.js', 'src/util/dom.js'],
dest: 'dest/util',
},
sites: {
src: ['src/sites/*/*.js'],
dest: 'dest/sites',
},
},
concat: {
meta: {
options: {
banner: '// ==UserScript==\n',
footer: '// ==/UserScript==\n',
process: true,
},
src: ['src/util/metadata.js'],
dest: 'dest/nopicads.meta.js',
},
user: {
src: ['dest/nopicads.meta.js', 'dest/util/core.js', 'dest/util/dom.js', 'dest/sites/*.js', 'src/util/main.js'],
dest: 'dest/nopicads.user.js',
},
},
clean: ['dest'],
mochaTest: {
test: {
options: {
reporter: 'spec',
require: 'tests/misc/coverage',
},
src: ['tests/*.js'],
},
coverage: {
options: {
reporter: 'html-cov',
quiet: true,
captureFile: 'dest/coverage.html',
},
src: ['tests/*.js'],
},
},
});
grunt.registerMultiTask('strip', function () {
this.files.forEach(function (f) {
grunt.file.mkdir(f.dest);
f.src.forEach(function (filepath) {
var script_file = f.dest + '/' + baseName(filepath) + '.js';
var source = grunt.file.read(filepath);
var script = removeModelines(source);
script = removeSingleLineComments(script);
script = removeEmptyLines(script);
script = script.trim() + '\n';
grunt.file.write(script_file, script);
});
});
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('default', ['clean', 'strip', 'concat']);
grunt.registerTask('test', 'mochaTest');
function removeModelines (s) {
return s.replace(/^\/\/\s*.+:.*[\r\n]+/gm, '');
}
function removeSingleLineComments (s) {
return s.replace(/^\s*\/\/.*[\r\n]+/gm, '');
}
function removeEmptyLines (s) {
return s.replace(/^\s*[\r\n]+/gm, '');
}
function baseName (s) {
var m = s.match(/([^\/]+)\.js$/);
return m[1];
}
};
// ex: ts=2 sts=2 sw=2 et
// sublime: tab_size 2; translate_tabs_to_spaces true; detect_indentation false; use_tab_stops true;
// kate: space-indent on; indent-width 2;
|
JavaScript
| 0 |
@@ -46,16 +46,117 @@
rict';%0A%0A
+ var wintersmith = require('wintersmith');%0A var os = require('os');%0A var path = require('path');%0A%0A
grunt.
@@ -168,16 +168,16 @@
onfig(%7B%0A
-
pkg:
@@ -1250,16 +1250,245 @@
%0A %7D,%0A
+ pages: %7B%0A options: %7B%0A config: 'pages/config.json',%0A changelog: 'CHANGELOG.md',%0A readme: 'README.md',%0A userjs: 'dest/nopicads.user.js',%0A metajs: 'dest/nopicads.meta.js',%0A %7D,%0A %7D,%0A
%7D);%0A%0A
@@ -2010,32 +2010,1223 @@
%0A %7D);%0A %7D);%0A%0A
+ grunt.registerTask('pages', function () %7B%0A var options = this.options();%0A var rootPath = 'pages/contents';%0A var releasePath = path.join(rootPath, 'releases');%0A var outPath = path.join(os.tmpdir(), 'nopicads_pages');%0A var done = this.async();%0A%0A // copy changelog and readme%0A grunt.file.copy(options.changelog, path.join(rootPath, path.basename(options.changelog)));%0A grunt.file.copy(options.readme, path.join(rootPath, path.basename(options.readme)));%0A // copy compiled files%0A grunt.file.copy(options.userjs, path.join(releasePath, path.basename(options.userjs)));%0A grunt.file.copy(options.metajs, path.join(releasePath, path.basename(options.metajs)));%0A%0A var env = wintersmith(options.config);%0A env.build(outPath, function (error) %7B%0A if (error) %7B%0A throw error;%0A %7D%0A%0A // clear files%0A grunt.file.delete(path.join(rootPath, path.basename(options.changelog)));%0A grunt.file.delete(path.join(rootPath, path.basename(options.readme)));%0A grunt.file.delete(path.join(releasePath, path.basename(options.userjs)));%0A grunt.file.delete(path.join(releasePath, path.basename(options.metajs)));%0A%0A done();%0A %7D);%0A %7D);%0A%0A
grunt.loadNpmT
@@ -3406,16 +3406,16 @@
cat'%5D);%0A
-
grunt.
@@ -3444,24 +3444,78 @@
mochaTest');
+%0A grunt.registerTask('deploy', %5B'default', 'pages'%5D);
%0A%0A function
|
762cce454f45578a458f90d06154f73479e2eab7
|
fix grunt ngtemplates
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt){
grunt.initConfig({
uglify: {
options: {
banner: '/*\n evid\n Copyright (C) 2015 Christoph Kappestein\n License: MIT\n*/\n',
mangle: false
},
dist: {
files: {
'./build/evid-app.min.js': [
'./app/components/definition.js',
'./app/components/registry.js',
'./app/components/schema.js',
'./app/api.js',
'./app/page.js',
'./app/app.js'
]
}
}
},
concat: {
dist_js: {
options: {
separator: ';\n',
process: function(src, filepath) {
return '// Source: ' + filepath + '\n' +
src.replace(/\/\/# sourceMappingURL=([A-z0-9\-\.\_]+)/g, '').trim();
},
},
src: [
'./app/bower_components/highlightjs/highlight.pack.min.js',
'./app/bower_components/angular/angular.min.js',
'./app/bower_components/angular-animate/angular-animate.min.js',
'./app/bower_components/angular-aria/angular-aria.min.js',
'./app/bower_components/angular-loader/angular-loader.min.js',
'./app/bower_components/angular-material/angular-material.min.js',
'./app/bower_components/angular-route/angular-route.min.js',
'./app/bower_components/angular-sanitize/angular-sanitize.min.js',
'./app/bower_components/angular-highlightjs/angular-highlightjs.min.js',
'./build/evid-app.min.js',
'./build/evid-templates.min.js'
],
dest: './build/evid.min.js'
},
dist_css: {
options: {
separator: '\n',
process: function(src, filepath) {
return '/* Source: ' + filepath + '*/\n' +
src.trim();
},
},
src: [
'./app/bower_components/angular-material/angular-material.css',
'./app/bower_components/highlightjs/styles/github.css',
'./app/app.css'
],
dest: './build/evid.min.css'
}
},
cssmin: {
compress_css: {
src: './build/evid.min.css',
dest: './build/evid.min.css'
}
},
ngtemplates: {
evid: {
src: 'app/partials/*.html',
dest: './build/evid-templates.min.js',
options: {
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.registerTask('default', ['uglify', 'ngtemplates', 'concat', 'cssmin']);
};
|
JavaScript
| 0.000001 |
@@ -2241,18 +2241,34 @@
-src
+cwd
: 'app
-/
+',%0A src: '
part
|
b44065d29dd13b61bbc346b7831dea4d718fbe47
|
add changelog.options.repository
|
Gruntfile.js
|
Gruntfile.js
|
var cp = require('child_process');
var buildConfig = require('./config/build');
module.exports = function(grunt) {
grunt.initConfig({
concat: {
options: {
separator: ';\n'
},
dist: {
src: buildConfig.ionicFiles,
dest: 'dist/js/ionic.js'
},
distangular: {
src: buildConfig.angularIonicFiles,
dest: 'dist/js/ionic-angular.js'
},
bundle: {
options: {
banner:
'/*!\n' +
' * ionic.bundle.js is a concatenation of:\n' +
' * ionic.js, angular.js, angular-animate.js,\n'+
' * angular-ui-router.js, and ionic-angular.js\n'+
' */\n\n'
},
src: [
'dist/js/ionic.js',
'config/lib/js/angular/angular.js',
'config/lib/js/angular/angular-animate.js',
'config/lib/js/angular-ui/angular-ui-router.js',
'dist/js/ionic-angular.js'
],
dest: 'dist/js/ionic.bundle.js'
},
bundlemin: {
options: {
banner: '<%= concat.bundle.options.banner %>'
},
src: [
'dist/js/ionic.min.js',
'config/lib/js/angular/angular.min.js',
'config/lib/js/angular/angular-animate.min.js',
'config/lib/js/angular-ui/angular-ui-router.min.js',
'dist/js/ionic-angular.min.js'
],
dest: 'dist/js/ionic.bundle.min.js'
}
},
version: {
dist: {
dest: 'dist/version.json'
}
},
copy: {
dist: {
files: [{
expand: true,
cwd: './config/lib/',
src: buildConfig.vendorFiles,
dest: './dist/'
}]
}
},
//Used by CI to check for temporary test code
//xit, iit, ddescribe, xdescribe
'ddescribe-iit': ['js/**/*.js'],
'merge-conflict': ['js/**/*.js'],
'removelogging': {
dist: {
files: {
'dist/js/ionic.js': 'dist/js/ionic.js',
'dist/js/ionic.bundle.js': 'dist/js/ionic.bundle.js',
'dist/js/ionic-angular.js': 'dist/js/ionic-angular.js'
},
options: {
methods: 'log assert count clear group groupEnd groupCollapsed trace debug dir dirxml profile profileEnd time timeEnd timeStamp table exception'.split(' ')
}
}
},
jshint: {
files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
karma: {
options: {
configFile: 'config/karma.conf.js'
},
single: {
options: {
singleRun: true
}
},
sauce: {
options: {
singleRun: true,
configFile: 'config/karma-sauce.conf.js'
}
},
watch: {
}
},
uglify: {
dist: {
files: {
'dist/js/ionic.min.js': 'dist/js/ionic.js',
'dist/js/ionic-angular.min.js': 'dist/js/ionic-angular.js'
}
},
options: {
preserveComments: 'some'
}
},
sass: {
dist: {
files: {
'dist/css/ionic.css': 'scss/ionic.scss',
}
}
},
cssmin: {
dist: {
files: {
'dist/css/ionic.min.css': 'dist/css/ionic.css',
}
}
},
'string-replace': {
version: {
files: {
'dist/js/ionic.js': 'dist/js/ionic.js',
'dist/js/ionic-angular.js': 'dist/js/ionic-angular.js',
'dist/css/ionic.css': 'dist/css/ionic.css',
},
options: {
replacements: [{
pattern: /{{ VERSION }}/g,
replacement: '<%= pkg.version %>'
}]
}
}
},
bump: {
options: {
files: ['package.json'],
commit: false,
createTag: false,
push: false
}
},
watch: {
scripts: {
files: ['js/**/*.js', 'ext/**/*.js'],
tasks: ['concat:dist', 'concat:distangular', 'concat:bundle'],
options: {
spawn: false
}
},
sass: {
files: ['scss/**/*.scss'],
tasks: ['sass'],
options: {
spawn: false
}
}
},
pkg: grunt.file.readJSON('package.json')
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', [
'jshint',
'build'
]);
grunt.registerTask('build', [
'sass',
'cssmin',
'concat:dist',
'concat:distangular',
'copy',
'string-replace',
'uglify',
'version',
'concat:bundle',
'concat:bundlemin'
]);
grunt.registerMultiTask('karma', 'Run karma', function() {
var done = this.async();
var options = this.options();
var config = options.configFile;
var browsers = grunt.option('browsers');
var singleRun = grunt.option('singleRun') || options.singleRun;
var reporters = grunt.option('reporters');
cp.spawn('node', ['node_modules/karma/bin/karma', 'start', config,
browsers ? '--browsers=' + browsers : '',
singleRun ? '--single-run=' + singleRun : '',
reporters ? '--reporters=' + reporters : ''
], { stdio: 'inherit' })
.on('exit', function(code) {
if (code) return grunt.fail.warn('Karma test(s) failed. Exit code: ' + code);
done();
});
});
grunt.registerMultiTask('version', 'Generate version JSON', function() {
var pkg = grunt.config('pkg');
this.files.forEach(function(file) {
var dest = file.dest;
var d = new Date();
var version = {
version: pkg.version,
codename: pkg.codename,
date: grunt.template.today('yyyy-mm-dd'),
time: d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds()
};
grunt.file.write(dest, JSON.stringify(version, null, 2));
});
});
};
|
JavaScript
| 0.000002 |
@@ -1432,24 +1432,130 @@
%7D%0A %7D,%0A%0A
+ changelog: %7B%0A options: %7B%0A repository: 'https://github.com/driftyco/ionic'%0A %7D%0A %7D,%0A%0A
version:
|
2229196f64c66f5fe2d109b6089a895a016b9ed8
|
Update to Gruntfile.js
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
var config = {};
config.compile = {
"dummy": {
wrap: 'obogo', // this is your global namespace
name: "app",
filename: 'dummy',
build: 'dist',
scripts: {
src: ['src/widgets/dummy/**/*.js'], // search through all JS file in src src directory
import: ['dummy.*', 'hbd.cloak'], // what files should we import and compile
// includes: ['src/sideclick/vendor/rocket.js'],
export: ['dummy'] // hide all from view
},
styles: {
options: {
paths: ["**/*.less"],
strictImports: true,
syncImport: true
},
files: {
'dist/dummy.css': [
"src/widgets/dummy/**/*.less"
]
}
},
templates: [{
cwd: 'src/widgets',
src: 'dummy/**/**.html'
}],
},
"widgets": {
wrap: 'obogo', // this is your global namespace
name: "app",
filename: 'widgets',
build: 'dist',
scripts: {
src: ['src/widgets/**/*.js', 'src/shared/**/*.js', '!src/widgets/*/bootstrap.js'], // search through all JS file in src src directory
import: ['widgets.*', 'shared.*', 'hbd.cloak'], // what files should we import and compile
export: [''] // hide all from view
},
styles: {
options: {
paths: ["**/*.less"],
strictImports: true,
syncImport: true
},
files: {
'dist/widgets.css': [
"src/**/*.less"
]
}
},
templates: [{
cwd: 'src/widgets',
src: '**/**.html',
options: {
interval: 500
}
}],
},
"application": {
wrap: 'application', // this is your global namespace
name: "app",
filename: 'application.dist',
build: 'dist',
scripts: {
src: ['src/application/**/*.js', 'src/shared/**/*.js', '!src/application/widgets/*/bootstrap.js'], // search through all JS file in src src directory
import: ['application.*', 'hbd.cloak'], // what files should we import and compile
export: [''] // hide all from global namespace
},
styles: {
options: {
paths: ["application/**/*.less"],
strictImports: true,
syncImport: true
},
files: {
'dist/application.css': [
"src/application/**/*.less"
]
}
},
templates: [{
cwd: 'src/application',
src: '**/**.html',
options: {
interval: 500
}
}],
loader: {
url: "/dist/application.dist.js",
api: "boot",
filename: "application"
},
}
};
config.clean = {
dist: ['dist']
};
// This is used to copy dist directory into bower_components for sandbox
config.copy = {
main: {
files: [{
expand: true,
src: 'dist/**',
dest: 'bower_components/hammer-dummy/'
}]
}
};
// Bumps the version on certain files, puahses changes and tags package
// IF YOU TOUCH THIS MAKE SURE YOU KNOW WHAT YOU'RE DOING
// See "grunt-bump" for more information
config.bump = {
options: {
files: ['bower.json', 'dist/package.json', 'dist/dummy.js', 'dist/dummy.min.js'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json', 'dist/package.json', 'dist/dummy.js', 'dist/dummy.min.js'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
};
// To watch for changes
// $ grunt watch
config.watch = {
scripts: {
files: ['src/**/*'],
tasks: ['default']
},
};
// Unit Tests
config.jasmine = {
dummy: {
src: [
'node_modules/angular/angular.js',
'dist/dummy.js'
],
options: {
specs: ['src/score/test/dummy.js']
}
}
};
// initialize config
grunt.initConfig(config);
// register tasks
grunt.registerTask('default', ['clean:dist', 'compile', 'copy']);
grunt.registerTask('test', 'jasmine');
};
|
JavaScript
| 0.000001 |
@@ -4374,16 +4374,23 @@
ile'
+%5D); //
, 'copy'
%5D);%0A
@@ -4385,19 +4385,16 @@
, 'copy'
-%5D);
%0A grunt
|
1a2be1217f45e718c48d5f476c662839f7c25048
|
Introduce `grunt rebuild`
|
Gruntfile.js
|
Gruntfile.js
|
var os = require("os");
var now = new Date().toISOString();
function shallowCopy(obj) {
var result = {};
Object.keys(obj).forEach(function(key) {
result[key] = obj[key];
});
return result;
}
function getBuildVersion(version) {
var buildVersion = version !== undefined ? version : process.env["BUILD_NUMBER"];
if (process.env["BUILD_CAUSE_GHPRBCAUSE"]) {
buildVersion = "PR" + buildVersion;
}
return buildVersion;
}
module.exports = function(grunt) {
// Windows cmd does not accept paths with / and unix shell does not accept paths with \\ and we need to execute from a sub-dir.
// To circumvent the issue, hack our environment's PATH and let the OS deal with it, which in practice works
process.env.path = process.env.path + (os.platform() === "win32" ? ";" : ":") + "node_modules/.bin";
var defaultEnvironment = "sit";
// When there are node_modules inside lib\common directory, CLI behaves incorrectly, so delete this dir.
var path = require("path");
var commonLibNodeModules = path.join("lib", "common", "node_modules");
if(require("fs").existsSync(commonLibNodeModules)) {
grunt.file.delete(commonLibNodeModules);
}
grunt.file.write(path.join("lib", "common", ".d.ts"), "");
grunt.initConfig({
deploymentEnvironment: process.env["DeploymentEnvironment"] || defaultEnvironment,
resourceDownloadEnvironment: process.env["ResourceDownloadEnvironment"] || defaultEnvironment,
jobName: process.env["JOB_NAME"] || defaultEnvironment,
buildNumber: process.env["BUILD_NUMBER"] || "non-ci",
dateString: now.substr(0, now.indexOf("T")),
pkg: grunt.file.readJSON("package.json"),
ts: {
options: {
target: 'es5',
module: 'commonjs',
sourceMap: true,
declaration: false,
removeComments: false,
noImplicitAny: true,
experimentalDecorators: true
},
devlib: {
src: ["lib/**/*.ts", "!lib/common/node_modules/**/*.ts", "!lib/common/messages/**/*.ts"],
reference: "lib/.d.ts"
},
devall: {
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "lib/common/test/unit-tests/**/*.ts", "definitions/**/*.ts", "!lib/common/test/.d.ts", "!lib/common/messages/**/*.ts"],
reference: "lib/.d.ts"
},
release_build: {
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "!lib/common/messages/**/*.ts"],
reference: "lib/.d.ts",
options: {
sourceMap: false,
removeComments: true
}
}
},
tslint: {
build: {
files: {
src: ["lib/**/*.ts", "test/**/*.ts", "!lib/common/node_modules/**/*.ts", "!lib/common/messages/**/*.ts", "lib/common/test/unit-tests/**/*.ts", "definitions/**/*.ts", "!**/*.d.ts"]
},
options: {
configuration: grunt.file.readJSON("./tslint.json")
}
}
},
watch: {
devall: {
files: ["lib/**/*.ts", 'test/**/*.ts', "!lib/common/node_modules/**/*.ts", "!lib/common/messages/**/*.ts"],
tasks: ['ts:devall'],
options: {
atBegin: true,
interrupt: true
}
}
},
shell: {
options: {
stdout: true,
stderr: true
},
apply_resources_environment: {
command: "node bin/appbuilder.js dev-config-apply <%= resourceDownloadEnvironment %>"
},
prepare_resources: {
command: "node bin/appbuilder.js dev-prepackage"
},
ci_unit_tests: {
command: "npm test",
options: {
execOptions: {
env: (function() {
var env = shallowCopy(process.env);
env["XUNIT_FILE"] = "test-reports.xml";
env["LOG_XUNIT"] = "true";
return env;
})()
}
}
},
apply_deployment_environment: {
command: "node bin/appbuilder.js dev-config-apply <%= deploymentEnvironment %>"
},
build_package: {
command: "npm pack",
options: {
execOptions: {
env: (function() {
var env = shallowCopy(process.env);
env["APPBUILDER_SKIP_POSTINSTALL_TASKS"] = "1";
return env;
})()
}
}
}
},
clean: {
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/common/vendor/*.js", "!lib/hooks/**/*.js", "!lib/common/**/*.json", "!lib/common/Gruntfile.js", "!lib/common/node_modules/**/*", "!lib/common/hooks/**/*.js", "!lib/common/bin/*.js", "*.tgz"]
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-tslint");
grunt.registerTask("set_package_version", function(version) {
var buildVersion = getBuildVersion(version);
var packageJson = grunt.file.readJSON("package.json");
packageJson.buildVersion = buildVersion;
grunt.file.write("package.json", JSON.stringify(packageJson, null, " "));
});
grunt.registerTask("setPackageName", function (version) {
var fs = require("fs");
var fileExtension = ".tgz";
var buildVersion = getBuildVersion(version);
var packageJson = grunt.file.readJSON("package.json");
var oldFileName = packageJson.name + "-" + packageJson.version;
var newFileName = oldFileName + "-" + buildVersion;
fs.renameSync(oldFileName + fileExtension, newFileName + fileExtension);
});
grunt.registerTask("delete_coverage_dir", function() {
var done = this.async();
var rimraf = require("rimraf");
rimraf("coverage", function(err) {
if(err) {
console.log("Error while deleting coverage directory from the package.");
done(false);
}
done();
});
});
grunt.registerTask("test", ["ts:devall", "shell:ci_unit_tests"]);
grunt.registerTask("pack", [
"ts:release_build",
"shell:apply_resources_environment",
"shell:prepare_resources",
"shell:apply_deployment_environment",
"shell:ci_unit_tests",
"set_package_version",
"delete_coverage_dir",
"shell:build_package",
"setPackageName"
]);
grunt.registerTask("lint", ["tslint:build"]);
grunt.registerTask("all", ["clean", "test", "lint"]);
grunt.registerTask("default", "ts:devlib");
};
|
JavaScript
| 0 |
@@ -5947,24 +5947,80 @@
, %22lint%22%5D);%0A
+%09grunt.registerTask(%22rebuild%22, %5B%22clean%22, %22ts:devlib%22%5D);%0A
%09grunt.regis
|
a24eb6364ba9e8b0eaa4d560bcf65161011bbfef
|
Fix quotes
|
Gruntfile.js
|
Gruntfile.js
|
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
version: '<%= pkg.version %>',
banner:
'// Backbone.Minionette\n' +
'// -------------------\n' +
'// v<%= pkg.version %>\n' +
'//\n' +
'// Copyright (c)<%= grunt.template.today("yyyy") %> Justin Ridgewell\n' +
'// Distributed under MIT license\n' +
'//\n' +
'// https://github.com/jridgewell/minionette\n' +
'\n'
},
preprocess: {
build: {
files: {
'lib/minionette.js' : 'src/build/minionette.js'
}
}
},
uglify : {
options: {
banner: "<%= meta.banner %>"
},
core : {
src : 'lib/minionette.js',
dest : 'lib/minionette-min.js',
}
},
jshint: {
options: {
jshintrc : '.jshintrc'
},
minionette : [ 'src/*.js' ],
test : [ 'spec/*.js', 'spec/specs/*.js' ],
},
plato: {
minionette : {
src : 'src/*.js',
dest : 'reports',
options : {
jshint : false
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
},
coverage: {
configFile: 'karma.conf.js',
reporters: ['coverage'],
preprocessors: {
'src/*.js': 'coverage'
},
coverageReporter: {
type: "lcov",
dir: "coverage/"
}
}
},
coveralls: {
options: {
coverage_dir: 'coverage',
force: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls');
// Default task.
grunt.registerTask('lint-test', 'jshint:test');
grunt.registerTask('test', 'karma:unit');
grunt.registerTask('coverage', ['karma:coverage', 'coveralls']);
grunt.registerTask('travis', ['jshint:minionette', 'test']);
grunt.registerTask('default', ['jshint:minionette', 'test', 'preprocess', 'uglify']);
};
|
JavaScript
| 0.000002 |
@@ -1874,14 +1874,14 @@
pe:
-%22
+'
lcov
-%22
+'
,%0A
@@ -1903,17 +1903,17 @@
dir:
-%22
+'
coverage
@@ -1913,17 +1913,17 @@
overage/
-%22
+'
%0A
|
461cc0d117f051eecefd4ae0c209ab0c3c71de13
|
Remove commented code
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
paths: {
src: {
app: {
clinic: 'src/clinic.js',
chw: 'src/chw.js',
personal: 'src/personal.js',
optout: 'src/optout.js',
smsinbound: 'src/smsinbound.js',
servicerating: 'src/servicerating.js'
},
clinic: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.clinic %>',
'src/init.js'
],
chw: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.chw %>',
'src/init.js'
],
personal: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.personal %>',
'src/init.js'
],
optout: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.optout %>',
'src/init.js'
],
smsinbound: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.smsinbound %>',
'src/init.js'
],
servicerating: [
'src/index.js',
'src/utils.js',
'<%= paths.src.app.servicerating %>',
'src/init.js'
],
all: [
'src/**/*.js'
]
},
dest: {
clinic: 'go-app-clinic.js',
chw: 'go-app-chw.js',
personal: 'go-app-personal.js',
optout: 'go-app-optout.js',
smsinbound: 'go-app-smsinbound.js',
servicerating: 'go-app-servicerating.js'
},
test: {
clinic: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.clinic %>',
'test/clinic.test.js'
],
chw: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.chw %>',
'test/chw.test.js'
],
personal: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.personal %>',
'test/personal.test.js'
],
optout: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.optout %>',
'test/optout.test.js'
],
smsinbound: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.smsinbound %>',
'test/smsinbound.test.js'
],
servicerating: [
'test/setup.js',
'src/utils.js',
'<%= paths.src.app.servicerating %>',
'test/servicerating.test.js'
]
}
},
jshint: {
options: {jshintrc: '.jshintrc'},
all: [
'Gruntfile.js',
'<%= paths.src.all %>'
]
},
watch: {
src: {
files: ['<%= paths.src.all %>'],
tasks: ['build']
}
},
concat: {
clinic: {
src: ['<%= paths.src.clinic %>'],
dest: '<%= paths.dest.clinic %>'
},
chw: {
src: ['<%= paths.src.chw %>'],
dest: '<%= paths.dest.chw %>'
},
personal: {
src: ['<%= paths.src.personal %>'],
dest: '<%= paths.dest.personal %>'
},
optout: {
src: ['<%= paths.src.optout %>'],
dest: '<%= paths.dest.optout %>'
},
smsinbound: {
src: ['<%= paths.src.smsinbound %>'],
dest: '<%= paths.dest.smsinbound %>'
},
servicerating: {
src: ['<%= paths.src.servicerating %>'],
dest: '<%= paths.dest.servicerating %>'
}
},
mochaTest: {
options: {
reporter: 'spec'
},
// test_clinic: {
// src: ['<%= paths.test.clinic %>']
// },
test_chw: {
src: ['<%= paths.test.chw %>']
},
test_personal: {
src: ['<%= paths.test.personal %>']
},
test_optout: {
src: ['<%= paths.test.optout %>']
},
test_smsinbound: {
src: ['<%= paths.test.smsinbound %>']
},
test_servicerating: {
src: ['<%= paths.test.servicerating %>']
}
}
});
grunt.registerTask('test', [
'jshint',
'build',
'mochaTest'
]);
grunt.registerTask('build', [
'concat'
]);
grunt.registerTask('default', [
'build',
'test'
]);
};
|
JavaScript
| 0 |
@@ -4892,19 +4892,16 @@
- //
test_cl
@@ -4919,19 +4919,16 @@
- //
src
@@ -4973,11 +4973,8 @@
- //
%7D,%0A
|
20249e60e98a2bc3665d33ac53b4040586b0425e
|
rename index file to bloxed
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
'copy': {
dev: {
files: [
{
expand: true,
src: './images/*',
dest: './gh-pages/'
},
{
src: './index.html',
dest: './gh-pages/index.html'
},
{
src: './js/pixi.min.js',
dest: './gh-pages//js/pixi.min.js'
}
]
}
},
uglify: {
options: {
mangle: true,
report: "gzip"
},
my_target: {
files: [
{
'gh-pages/js/bloxed.js': ['js/bloxed.js']
},
{
'gh-pages/js/levels.js': ['js/levels.js']
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify', 'copy']);
};
|
JavaScript
| 0.000003 |
@@ -273,21 +273,22 @@
h-pages/
-index
+bloxed
.html'
|
b00a65d842ef0bb9358016bf940a39bb3e262a68
|
Add test task
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
nodeunit: {
files: ['test/node/*_test.js']
},
qunit: {
files: ['test/qunit/*.html']
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/**/*.js']
},
test: {
src: ['test/qunit/*.js']
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: ['jshint:lib', 'qunit', 'nodeunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit', 'nodeunit']
}
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task.
grunt.registerTask('default', ['jshint', 'qunit', 'nodeunit']);
};
|
JavaScript
| 0.999992 |
@@ -1127,13 +1127,66 @@
unit'%5D);
+%0A grunt.registerTask('test', %5B'qunit', 'nodeunit'%5D);
%0A%0A%7D;%0A
|
d0391d5efabccdf331bb98d890142c5df421f84d
|
ADD dynamic file matching for sass files
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function (grunt) {
[
'grunt-contrib-clean',
'grunt-contrib-copy',
'grunt-contrib-jshint',
'grunt-contrib-sass'
].forEach(grunt.loadNpmTasks);
// put your sass files (not partials!) here
// remember that you can import files from sass with @import
var sassFiles = [
//'sample.sass',
'main.sass'
].reduce(function (result, item) {
var src = 'app/styles/';
var dest = 'app/.tmp/styles/';
result[dest + item.replace(/\..*$/, '.css')] = src + item;
return result;
}, {});
grunt.initConfig({
// JS linter config
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'app/scripts/**/*.js',
'!app/scripts/vendor/**/*'
]
},
// SASS config
sass: {
options: {
cacheLocation: 'app/.tmp/.sass-cache'
},
dev: {
options: {
style: 'expanded',
lineComments: true
},
files: sassFiles
},
dist: {
options: {
style: 'compressed'
},
files: sassFiles
}
},
// clean config
clean: ['build', 'app/.tmp'],
// copy config
copy: {
build: {
files: [
{
expand: true,
dot: true,
cwd: 'app',
src: [
'.tmp/styles/**/*.css',
'scripts/**/*.js',
'icons/**/*.{png,jpg,jpeg}',
'images/**/*.{png,gif,jpg,jpeg}',
'*.html',
'manifest.webapp'
],
dest: 'build'
}
]
}
}
});
grunt.registerTask('build', 'Build app', ['sass:dev', 'copy:build']);
grunt.registerTask('default', 'Default task', [
'clean',
'build'
]);
};
|
JavaScript
| 0 |
@@ -194,252 +194,158 @@
%0A%0A
-// put you
+va
r sass
- f
+F
iles
-(not partials!) here%0A // remember that you can import files from sass with @import%0A var sassFiles = %5B%0A //'sample.sass',%0A 'main.sass'%0A %5D.reduce(function (result, item) %7B%0A var src = 'app/styles/';
+= %5B%7B%0A expand: true,%0A cwd: 'app/styles/',%0A src: %5B'**/*.%7Bsass,scss%7D', '!**/_*'%5D, // take sass files and ignore partials
%0A
-var
dest
- =
+:
'ap
@@ -363,100 +363,30 @@
es/'
-;
+,
%0A
-result%5Bdest + item.replace(/%5C..*$/, '.css')%5D = src + item;%0A return result;%0A %7D, %7B%7D)
+ext: '.css'%0A %7D%5D
;%0A%0A
|
091af6b353e4b4c83422ea09e85e4850f1e12962
|
Update Gulpfile
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: [
'/*!',
' * <%= pkg.name %> v<%= pkg.version %> (<%= pkg.homepage %>)',
' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %>',
' * Licensed under the <%= pkg.license %> license',
' */'
].join('\n') + '\n',
clean: {
dist: [
'dist',
'*-dist.zip'
]
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: [
'js/<%= pkg.name %>.js'
],
dest: 'dist/js/<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/js/<%= pkg.name %>.min.js'
},
},
qunit: {
files: 'js/tests/index.html'
},
jshint: {
options: {
jshintrc: 'js/.jshintrc'
},
gruntfile: {
options: {
jshintrc: 'grunt/.jshintrc'
},
src: 'Gruntfile.js'
},
core: {
src: 'js/*.js'
},
test: {
options: {
jshintrc: 'js/tests/unit/.jshintrc'
},
src: 'js/tests/unit/*.js'
},
},
less: {
core: {
options: {
sourceMap: true,
sourceMapURL: 'bootstrap-spinner.css.map',
outputSourceFiles: true
},
src: 'less/bootstrap-spinner.less',
dest: 'dist/css/bootstrap-spinner.css'
}
},
cssmin: {
core: {
options: {
compatibility: 'ie8'
},
expand: true,
src: 'dist/css/*.css',
ext: '.min.css'
}
},
compress: {
dist: {
options: {
archive: '<%= compress.dist.dest %>.zip'
},
expand: true,
cwd: 'dist',
src: '**',
dest: '<%= pkg.name %>-<%= pkg.version %>-dist'
}
}
});
// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt, {
scope: 'devDependencies'
});
grunt.registerTask('default', [
'jshint',
'qunit',
'clean',
'concat',
'uglify',
'less',
'cssmin',
]);
grunt.registerTask('prep-release', [
'default',
'compress'
]);
};
|
JavaScript
| 0.000001 |
@@ -763,16 +763,40 @@
nner %25%3E'
+,%0A report: 'none'
%0A %7D
|
c7d5b561b8ae90f581998c1f0ce86ccaa9b8b6d2
|
fix indentation
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
var fs = require('fs');
var path = require('path');
var glob = require('glob');
var through = require('through');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
function globalJQ(rules) {
return function(file) {
var filename = file.replace(/\\/g, '/');
var matched = rules.some(function(rule) {
if (rule instanceof RegExp && rule.test(filename) || typeof rule === 'string' && ~filename.indexOf(rule))
return true;
});
if (!matched)
return through();
var stream = through(write, end);
var data = ';(function(__ojq__, __jq__) {\nwindow.jQuery = window.$ = __jq__;\n';
function write(buf) {
data += buf;
}
function end() {
data += '\n;window.jQuery = window.$ = __ojq__;\n}).call(window, window.jQuery, require(\'jquery\'));';
stream.queue(data);
stream.queue(null);
}
return stream;
};
}
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
githooks: {
setup: {
'pre-commit': 'git-pre-commit'
}
},
jshint: {
options: {
jshintrc: true,
reporter: require('jshint-stylish')
},
all: {
src: [
'*.js',
'src/**/*.js'
]
}
},
uglify: {
dist: {
options: {
sourceMap: false
},
files: {
'dist/scripts/main.js': ['dist/scripts/main.js']
}
}
},
browserify: {
dist: {
options: {
transform: [globalJQ(['jquery-ui', 'fotorama', 'sticky-kit']), 'browserify-shim', 'debowerify']
},
files: {
'dist/scripts/main.js': ['src/scripts/main.js']
}
}
},
watch: {
styles: {
files: ['src/styles/*.scss'],
tasks: ['sass:dev', 'autoprefixer']
},
scripts: {
files: ['*.js', 'src/scripts/{pages/,}*.js', '!src/scripts/all-plugins.js'],
tasks: ['jshint', 'browserify']
},
plugins: {
files: ['src/scripts/plugins/*.js'],
tasks: ['plugin-require', 'jshint', 'browserify']
}
},
clean: {
dist: {
files: {
src: 'dist/*'
}
}
},
sass_imports: {
options: {
banner: ''
},
dist: {
files: {
'src/styles/_imports.scss': [
'bower_components/jquery-ui/themes/base/{core,draggable,resizable}.css',
'bower_components/fotorama/fotorama.css',
'bower_components/toastr/toastr.css'
]
}
}
},
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'dist/styles/main.css': [
'src/styles/main.scss'
]
}
},
dev: {
files: {
'dist/styles/main.css': [
'src/styles/main.scss'
]
}
}
},
autoprefixer: {
options: {
browsers: ['last 2 version']
},
file: {
expand: true,
flatten: true,
src: 'dist/styles/*.css',
dest: 'dist/styles/'
},
},
copy: {
dist: {
files: [{
expand: true,
cwd: 'bower_components/fotorama',
src: ['*.png'],
dest: 'dist/styles'
}, {
expand: true,
cwd: 'src/styles',
src: ['*.{gif,jpg,png}'],
dest: 'dist/styles'
}, {
expand: true,
cwd: 'bower_components/zeroclipboard/dist',
src: ['*.swf'],
dest: 'dist/scripts'
}, {
expand: true,
cwd: 'bower_components/bootstrap-sass-official/assets',
src: ['fonts/**'],
dest: 'dist'
}]
}
}
});
grunt.registerTask('plugin-require', function() {
var dir = 'src/scripts';
var files = glob.sync(dir + '/plugins/*.js');
var reqs = files.map(function(file) {
return 'require(\'' + file.replace(dir, '.') + '\');';
});
var body = '\'use strict\';\n\n// Auto generated. See grunt "plugin-require" task.\n' + reqs.join('\n') + '\n';
var filename = path.join(dir, 'all-plugins.js');
fs.writeFileSync(filename, body);
console.log('File "' + filename + '" created.');
});
grunt.registerTask('build', [
'jshint',
'clean',
'plugin-require',
'browserify',
'uglify',
'sass_imports',
'sass:dist',
'autoprefixer',
'copy:dist'
]);
grunt.registerTask('git-pre-commit', [
'jshint'
]);
grunt.registerTask('default', [
'build',
]);
};
|
JavaScript
| 0.000358 |
@@ -2815,32 +2815,34 @@
s': %5B%0A
+
'src/styles/main
@@ -2937,32 +2937,34 @@
es/main.css': %5B%0A
+
'src/s
|
5302782c0842b26a151fd382b3bc9ba679c8a232
|
Drop removed amd task from watch list
|
Gruntfile.js
|
Gruntfile.js
|
/* eslint-disable no-process-env */
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
options: {
},
files: [
'*.js',
'bench/**/*.js',
'tasks/**/*.js',
'lib/**/!(*.min|parser).js',
'spec/**/!(*.amd|json2|require).js'
]
},
clean: ['tmp', 'dist', 'lib/handlebars/compiler/parser.js'],
copy: {
dist: {
options: {
processContent: function(content) {
return grunt.template.process('/*!\n\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n@license\n*/\n')
+ content;
}
},
files: [
{expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/'}
]
},
cdnjs: {
files: [
{expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/cdnjs'}
]
},
components: {
files: [
{expand: true, cwd: 'components/', src: ['**'], dest: 'dist/components'},
{expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/components'}
]
}
},
babel: {
options: {
sourceMaps: 'inline',
loose: ['es6.modules'],
auxiliaryCommentBefore: 'istanbul ignore next'
},
cjs: {
options: {
modules: 'common'
},
files: [{
cwd: 'lib/',
expand: true,
src: '**/!(index).js',
dest: 'dist/cjs/'
}]
}
},
webpack: {
options: {
context: __dirname,
module: {
loaders: [
// the optional 'runtime' transformer tells babel to require the runtime instead of inlining it.
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader?optional=runtime&loose=es6.modules&auxiliaryCommentBefore=istanbul%20ignore%20next' }
]
},
output: {
path: 'dist/',
library: 'Handlebars',
libraryTarget: 'umd'
}
},
handlebars: {
entry: './lib/handlebars.js',
output: {
filename: 'handlebars.js'
}
},
runtime: {
entry: './lib/handlebars.runtime.js',
output: {
filename: 'handlebars.runtime.js'
}
}
},
uglify: {
options: {
mangle: true,
compress: true,
preserveComments: /(?:^!|@(?:license|preserve|cc_on))/
},
dist: {
files: [{
cwd: 'dist/',
expand: true,
src: ['handlebars*.js', '!*.min.js'],
dest: 'dist/',
rename: function(dest, src) {
return dest + src.replace(/\.js$/, '.min.js');
}
}]
}
},
concat: {
tests: {
src: ['spec/!(require).js'],
dest: 'tmp/tests.js'
}
},
connect: {
server: {
options: {
base: '.',
hostname: '*',
port: 9999
}
}
},
'saucelabs-mocha': {
all: {
options: {
build: process.env.TRAVIS_JOB_ID,
urls: ['http://localhost:9999/spec/?headless=true'],
detailedError: true,
concurrency: 4,
browsers: [
{browserName: 'chrome'},
{browserName: 'firefox', platform: 'Linux'},
{browserName: 'safari', version: 9, platform: 'OS X 10.11'},
{browserName: 'safari', version: 8, platform: 'OS X 10.10'},
{browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'},
{browserName: 'internet explorer', version: 10, platform: 'Windows 8'}
]
}
},
sanity: {
options: {
build: process.env.TRAVIS_JOB_ID,
urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
detailedError: true,
concurrency: 2,
browsers: [
{browserName: 'chrome'},
{browserName: 'internet explorer', version: 10, platform: 'Windows 8'}
]
}
}
},
watch: {
scripts: {
options: {
atBegin: true
},
files: ['src/*', 'lib/**/*.js', 'spec/**/*.js'],
tasks: ['build', 'amd', 'tests', 'test']
}
}
});
// Build a new version of the library
this.registerTask('build', 'Builds a distributable version of the current project', [
'eslint',
'parser',
'node',
'globals']);
this.registerTask('node', ['babel:cjs']);
this.registerTask('globals', ['webpack']);
this.registerTask('tests', ['concat:tests']);
this.registerTask('release', 'Build final packages', ['eslint', 'uglify', 'test:min', 'copy:dist', 'copy:components', 'copy:cdnjs']);
// Load tasks from npm
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-webpack');
grunt.task.loadTasks('tasks');
grunt.registerTask('bench', ['metrics']);
grunt.registerTask('sauce', process.env.SAUCE_USERNAME ? ['tests', 'connect', 'saucelabs-mocha'] : []);
grunt.registerTask('travis', process.env.PUBLISH ? ['default', 'sauce', 'metrics', 'publish:latest'] : ['default']);
grunt.registerTask('dev', ['clean', 'connect', 'watch']);
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
};
|
JavaScript
| 0 |
@@ -4332,15 +4332,8 @@
ld',
- 'amd',
'te
|
63bdd1fed813c864eed8220e4194f0ea781d462d
|
Revert "update: compiled the dropdown directive"
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('load-grunt-tasks')(grunt);
// configurable paths
var yeomanConfig = {
app: 'app',
dist: 'dist',
tmp: '.tmp'
};
try {
yeomanConfig.app = require('./component.json').appPath || yeomanConfig.app;
} catch (e) {
}
grunt.initConfig({
yeoman: yeomanConfig,
watch: {
less: {
files: ['<%= yeoman.app %>/styles/{,*/}*.less'],
tasks: ['less', 'copy:styles'],
options: {
nospawn: true
}
},
styles: {
files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
tasks: ['copy:styles']
},
livereload: {
files: [
'<%= yeoman.app %>/{,*/}*.html',
'<%= yeoman.tmp %>/styles/{,*/}*.css',
'{<%= yeoman.tmp %>,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
less: {
options: {
compile: true
},
dist: {
files: [
{
expand: true,
cwd: '<%= yeoman.app %>/styles',
src: 'style.less',
dest: '<%= yeoman.tmp %>/styles/',
ext: '.css'
}
]
}
},
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
lrSnippet,
mountFolder(connect, yeomanConfig.tmp),
mountFolder(connect, yeomanConfig.app)
];
}
}
},
test: {
options: {
middleware: function (connect) {
return [
mountFolder(connect, yeomanConfig.tmp),
mountFolder(connect, 'test')
];
}
}
}
},
open: {
server: {
url: 'http://localhost:<%= connect.options.port %>'
}
},
clean: {
dist: {
files: [
{
dot: false,
src: [
'<%= yeoman.tmp %>',
'<%= yeoman.dist %>'
]
}
]
},
server: '<%= yeoman.tmp %>'
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
},
cssmin: {
dist: {
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.css', '!*.min.css'],
dest: '<%= yeoman.dist %>',
ext: '.min.css'
}
},
ngmin: {
dist: {
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.js', '!*.min.js'],
dest: '<%= yeoman.dist %>',
ext: '.min.js'
}
},
uglify: {
dist: {
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.min.js'],
dest: '<%= yeoman.dist %>',
ext: '.min.js'
}
},
copy: {
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '<%= yeoman.tmp %>/styles/',
src: '{,*/}*.css'
}
},
ngtemplates: {
dist: {
options: {
base: '<%= yeoman.app %>',
module: 'datePicker'
},
src: '<%= yeoman.app %>/templates/*.html',
dest: '<%= yeoman.tmp %>/templates.js'
}
},
concurrent: {
server: [
'less',
'copy:styles'
],
test: [
'copy:styles'
],
dist: [
'copy:styles'
]
},
concat: {
options: {
separator: '\n'
},
js: {
src: ['<%= yeoman.app %>/scripts/{datePicker,input,dateRange,datePickerUtils,dropdown}.js', '<%= yeoman.tmp %>/templates.js'],
dest: '<%= yeoman.dist %>/index.js',
options: {
banner:'\'use strict\';\n(function(angular){\n',
footer:'})(angular);',
// Replace all 'use strict' statements in the code with a single one at the top
process: function(src) {
return src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
}
}
},
css: {
src: ['<%= yeoman.tmp %>/{,*/}*.css'],
dest: '<%= yeoman.dist %>/index.css'
}
}
});
grunt.renameTask('regarde', 'watch');
grunt.registerTask('server', [
'clean:server',
'less',
'concurrent:server',
'connect:livereload',
'open',
'watch'
]);
grunt.registerTask('test', [
'clean:server',
'connect:test',
'karma'
]);
grunt.registerTask('build', [
'jshint',
'clean:dist',
'less',
'ngtemplates',
'concat',
'cssmin',
'ngmin',
'uglify'
]);
grunt.registerTask('default', ['build']);
};
|
JavaScript
| 0 |
@@ -4113,17 +4113,8 @@
tils
-,dropdown
%7D.js
|
2d8a6ce56f8773051d45449bae38209ccdd5aa36
|
remove bower_components from getting copied into dist via htmlmin in grunt production command
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-karma');
var allJavaScriptFilePaths = ['app/js/**/*.js','models/**/*.js','routes/**/*.js', 'server.js'];
grunt.initConfig({
clean: {
dev: {
src: 'build/'
},
frontend: {
expand: true,
cwd: 'build/',
src: ['**/*.html', 'css/**/*.*']
},
dist: {
src: 'dist/'
}
},
copy: {
dev: {
expand: true,
cwd: 'app/',
src: ['*.html', 'css/**/*.*', 'views/**/*.html'],
dest: 'build/',
filter: 'isFile'
},
distfonts: {
expand: true,
cwd: 'app/css/fonts/',
src: '**/*',
dest: 'dist/css/fonts/',
filter: 'isFile'
}
},
jshint: {
all: allJavaScriptFilePaths,
options: {
jshintrc: true
}
},
browserify: {
dev: {
options: {
transform: ['debowerify', 'browserify-ngannotate'],
debug: true
},
src: ['app/js/**/*.js'],
dest: 'build/bundle.js'
},
angulartest: {
options: {
transform: ['debowerify'],
debug: true
},
src: ['test/angular/**/*test.js'],
dest: 'test/angular-testbundle.js'
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
},
continuous: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: [ 'PhantomJS' ]
}
},
simplemocha: {
all: {
src: ['test/mocha/api/**/*.js']
}
},
uglify: {
options: {
mangle: false
},
dist: {
files: {
'dist/bundle.js': ['build/bundle.js']
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: [{
expand: true,
cwd: 'app/',
src: ['**/*.html'],
dest: 'dist'
}]
}
},
cssmin: {
dist: {
files: [{
expand: true,
cwd: 'app/css/',
src: ['**/*.css'],
dest: 'dist/css/'
}]
}
},
express: {
options: {
port: 3000
},
dev: {
options: {
script: 'server.js'
}
}
},
watch: {
dev: {
files: ['server.js', 'routes/**/*.js', 'app/js/**/*', 'app/**/*.html', 'app/css/**/*'],
tasks: ['build']
},
frontend: {
files: ['server.js', 'routes/**/*.js', 'app/js/**/*', 'app/**/*.html', 'app/css/**/*'],
tasks: ['build:frontend']
}
}
});
grunt.registerTask('build', ['clean:dev', 'browserify:dev', 'copy:dev']);
grunt.registerTask('build:frontend', ['clean:frontend', 'copy:dev']);
grunt.registerTask('default', ['build', 'express:dev', 'watch:dev']);
grunt.registerTask('serve', ['default']);
grunt.registerTask('frontend', ['build:frontend', 'express:dev', 'watch:frontend']);
grunt.registerTask('test', ['jshint', 'browserify:angulartest', 'karma:unit', 'simplemocha']);
grunt.registerTask('shrink', ['browserify:dev', 'uglify', 'htmlmin:dist', 'cssmin:dist']);
grunt.registerTask('production', ['clean:dist', 'shrink', 'copy:distfonts']);
};
|
JavaScript
| 0 |
@@ -2457,32 +2457,48 @@
src: %5B'*
+.html', 'views/*
*/*.html'%5D,%0A
|
dc7d99eac25e6f5ce4cb3e0ab0a6e3e1a95559ff
|
Remove whitespace
|
Gruntfile.js
|
Gruntfile.js
|
/*global module:false*/
module.exports = function(grunt) {
var tilde = require('tilde-expansion'),
s3Credentials;
tilde('~/.gallery-css-s3-credentials', function ( path ) {
s3Credentials = grunt.file.readJSON( path );
}),
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: ['sass/*.scss', 'index.html'],
tasks: ['sass']
},
sass: {
main: {
options: {
style: 'expanded',
precision: 1
},
files: {
'dist/<%= pkg.name %>.css': 'sass/<%= pkg.name %>.build.scss'
}
},
theme: {
options: {
style: 'expanded'
},
files: {
'dist/<%= pkg.name %>.theme.css': 'sass/<%= pkg.name %>.theme.scss'
}
}
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
dist: {
src: ['dist/*.css']
}
},
recess: {
dist: {
options: {
noOverqualifying: false
},
src: ['dist/<%= pkg.name %>.css', 'dist/<%= pkg.name %>.theme.css']
}
},
rework: {
'dist/<%= pkg.name %>.prefixed.css': 'dist/<%= pkg.name %>.css',
options: {
use: [
['rework.keyframes'],
['rework.prefix', 'animation'],
['rework.prefix', 'animation-delay'],
['rework.prefix', 'transition']
],
vendors: ['-moz-', '-webkit-', '-o-']
}
},
cssmin: {
unprefixed: {
src: 'dist/<%= pkg.name %>.css',
dest: 'dist/<%= pkg.name %>.min.css'
},
prefixed: {
src: 'dist/<%= pkg.name %>.prefixed.css',
dest: 'dist/<%= pkg.name %>.prefixed.min.css'
}
},
s3: {
options: {
key: s3Credentials.key,
secret: s3Credentials.secret,
bucket: 'gallery-css',
access: 'public-read'
},
dist: {
upload: [
{
src: 'dist/*.css',
dest: './'
}
]
}
},
connect: {
server: {
options: {
port: 3000,
base: './'
}
}
}
});
// Default task.
grunt.registerTask('default', ['sass', 'rework', 'csslint', 'recess', 'cssmin']);
// Use for development
grunt.registerTask('dev', ['connect', 'watch']);
// S3 credentials required to run this
grunt.registerTask('release', ['default', 's3']);
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
};
|
JavaScript
| 0.999999 |
@@ -94,17 +94,16 @@
nsion'),
-
%0A s
@@ -2052,22 +2052,16 @@
%0A %7D
-
%0A %7D,%0A
|
12feeeb25c1559b03b024847c31964001a076f89
|
disable key spacing for gruntfile
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function(grunt) {
grunt.option('stack', true);
require('time-grunt')(grunt);
require('jit-grunt')(grunt, {
simplemocha: 'grunt-simple-mocha',
express: 'grunt-express-server'
});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
project: {
app: ['app'],
scss: ['<%= project.app %>/sass/style.scss'],
css: ['<%= project.app %>/css/**/*.css'],
alljs: [
'<%= project.app %>/js/**/*.js',
'<%= project.app %>/js/**/*.jsx'
]
},
clean: {
dev: {
src: ['build/']
}
},
copy: {
dev: {
expand: true,
cwd: 'app/',
src: ['*.html', 'css/*.css', 'css/*.css.map', 'assets/**/*'],
dest: 'build/',
filter: 'isFile'
}
},
eslint: {
options: {
configFile: '.eslintrc'
},
target: [
'*.js',
'app/js/*.js',
'test/acceptance/*-spec.js',
'test/front-end/*-spec.js',
'test/server/heartbeat-spec.js'
]
},
mochacov: {
coverage: {
options: {
reporter: 'mocha-term-cov-reporter',
coverage: true
}
},
coveralls: {
options: {
coveralls: {
serviceName: 'travis-ci'
}
}
},
unit: {
options: {
reporter: 'spec',
require: ['chai']
}
},
html: {
options: {
reporter: 'html-cov',
require: ['chai']
}
},
options: {
files: 'test/server/*-spec.js',
ui: 'bdd',
colors: true
}
},
simplemocha: {
all: {
options: {
},
src: ['test/server/**/*-spec.js']
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
},
chrome: {
configFile: 'karma.conf.js',
browsers: ['Chrome']
},
continuous: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}
},
webdriver: {
acceptance: {
tests: ['test/acceptance/*-spec.js'],
options: {
timeout: 10000,
desiredCapabilities: {
browserName: 'chrome'
}
}
}
},
browserify: {
dev: {
src: ['app/**/*.js'],
dest: 'build/js/bundle.js',
options: {
browserifyOptions: {
debug: true
},
transform: ['6to5ify']
}
},
watchify: {
src: ['app/**/*.js'],
dest: 'build/js/bundle.js',
options: {
watch: true,
keepAlive: true,
browserifyOptions: {
debug: true
},
transform: ['6to5ify']
}
}
},
sass: {
dev: {
options: {
style: 'expanded',
compass: false
},
files: {
'build/css/style.css': '<%= project.scss %>'
}
}
},
express: {
options: {
// Override defaults here
output: 'listening'
//background: true
},
dev: {
options: {
script: 'server.js'
}
},
/*eslint-disable */
prod: {
options: {
script: 'server.js',
node_env: 'production'
}
},
test: {
options: {
script: 'server.js',
node_env: 'test'
}
}
/*eslint-enable */
},
concurrent: {
watch: {
tasks: ['watch', 'browserify:watchify'],
options: {
logConcurrentOutput: true
}
}
},
watch: {
sass: {
files: '<%= project.app %>/sass/{,*/}*.{scss,sass}',
tasks: ['sass:dev']
},
copy: {
files: ['<%= project.app %>/*.html', '<%= project.app %>/assets/**/*'],
tasks: ['copy:dev']
},
express: {
files: [ 'server.js'],
tasks: [ 'express:dev:stop', 'express:dev' ],
options: {
spawn: false
}
},
testServer: {
files: ['test/server/**/*.js'],
tasks: ['simplemocha']
},
testFrontEnd: {
files: ['test/front-end/**/*.js'],
tasks: ['karma:unit']
}
}
}); //end initConfig
grunt.registerTask('build', ['clean:dev', 'sass:dev', 'copy:dev', 'browserify:dev']);
grunt.registerTask('test:acceptance', ['build', 'express:dev', 'webdriver']);
grunt.registerTask('test', ['eslint', 'build', 'simplemocha', 'express:dev', 'webdriver', 'karma:unit']);
grunt.registerTask('default', ['test', 'concurrent:watch']);
grunt.registerTask('serve', ['express:dev', 'concurrent:watch']);
};
|
JavaScript
| 0 |
@@ -6,16 +6,48 @@
strict';
+%0A/*eslint-disable key-spacing */
%0A%0Amodule
|
3b5e95808544ad73b28d0515d4697b67a7cdb1c6
|
Use url from config
|
src/light/when-done.js
|
src/light/when-done.js
|
import runtime from '../core/runtime.js'
import poll from '../utils/poll.js'
import fetch from '../utils/io/fetch.js'
import urlUtils from '../utils/url.js'
// main
export default function getBakeResult (processingId) {
return poll(function(resolve, reject, next){
var url = 'https://storage-nocdn.3d.io/' + processingId
fetch(url).then(function(response) {
return response.json()
}).then(function(message){
var status = message.params.status
if (status === 'ERROR') {
reject(message.params.data)
} else if (status === 'SUCCESS') {
resolve(message.params.data)
} else {
next()
}
})
})
}
|
JavaScript
| 0.000001 |
@@ -149,16 +149,57 @@
/url.js'
+%0Aimport configs from '../core/configs.js'
%0A%0A// mai
@@ -238,17 +238,16 @@
keResult
-
(process
@@ -255,17 +255,16 @@
ngId) %7B%0A
-%0A
return
@@ -300,18 +300,18 @@
t, next)
+
%7B
-%0A
%0A var
@@ -330,27 +330,42 @@
s://
-storage-nocdn.3d.io
+' + configs.storageDomainNoCdn + '
/' +
@@ -393,16 +393,23 @@
tch(url)
+%0A
.then(fu
@@ -433,16 +433,18 @@
%7B%0A
+
return r
@@ -462,18 +462,27 @@
n()%0A
+
+
%7D)
+%0A
.then(fu
@@ -496,18 +496,21 @@
message)
+
%7B%0A
+
va
@@ -549,16 +549,18 @@
%0A%0A
+
if (stat
@@ -585,16 +585,18 @@
+
+
reject(m
@@ -607,32 +607,34 @@
ge.params.data)%0A
+
%7D else if
@@ -666,16 +666,18 @@
+
+
resolve(
@@ -693,24 +693,26 @@
arams.data)%0A
+
%7D else
@@ -722,16 +722,18 @@
+
next()%0A
@@ -741,11 +741,14 @@
-%7D%0A%0A
+ %7D%0A
@@ -759,6 +759,6 @@
%7D)%0A
-%0A
%7D
+%0A
|
8db35f7035c43f98f40b2ed8925f7e854e3d7c0a
|
change task
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
'use strict';
// Project configuration
grunt.initConfig({
app: {
scripts: [
"lib/world/items/item.js",
"lib/**/*.js"
],
testScripts: [
"test/scripts/**/*.js"
],
testStyles: [
"test/styles/**/*.css"
]
},
// Metadata
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= pkg.license %> */\n',
// Task configuration
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['dist/compiled/**/*.js'],
dest: 'dist/isometric-features.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/isometric-features.min.js'
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
tasks: ['jshint:lib_test', 'nodeunit']
}
},
babel: {
options: {
presets: ["es2015"]
},
dist: {
files: [{
expand: true,
cwd: "lib/",
src: ["**/*.js"],
dest: "dist/compiled"
}]
}
},
jsdoc: {
dist: {
src: ["lib/**/*.js", "lib/README.md"],
options: {
destination: "../isometric-features-docs/",
template: "node_modules/minami"
}
}
},
includeSource: {
options: {
basepath: "lib/",
baseUrl: "",
ordering: "",
rename: function (dest, match, options) {
return "../" + match;
}
},
app: {
files: {
"test/index.html" : "test/index.html"
}
}
},
wiredep: {
task: {
src: ["test/index.html"]
}
},
strictly: {
options: {
function: true,
cwd: "lib/"
},
files: ["**/*.js"]
}
});
// These plugins provide necessary tasks
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks("grunt-include-source");
grunt.loadNpmTasks("grunt-babel");
grunt.loadNpmTasks("grunt-jsdoc");
grunt.loadNpmTasks("grunt-wiredep");
grunt.loadNpmTasks("strictly");
// Default task
grunt.registerTask('default', ["strictly", "jsdoc"]);
grunt.registerTask("test", ["includeSource", "wiredep"]);
grunt.registerTask("build", ["strictly", "babel", "concat", "uglify", "jsdoc"]);
};
|
JavaScript
| 0.999964 |
@@ -150,123 +150,8 @@
: %5B%0A
- %22lib/world/items/item.js%22,%0A %22lib/**/*.js%22%0A %5D,%0A testScripts: %5B%0A
@@ -2312,19 +2312,20 @@
epath: %22
-lib
+dist
/%22,%0A
|
3b83c4a8b59637f262c279269f6d15d644a3b810
|
Remove unused grunt-release-component dependency
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
bump : {
options: {
files : ['package.json', 'noty.jquery.json', 'js/noty/jquery.noty.js'],
updateConfigs : [],
commit : false,
commitMessage : 'Release v%VERSION%',
commitFiles : ['-a'],
createTag : false,
tagName : 'v%VERSION%',
tagMessage : 'Version %VERSION%',
push : false,
pushTo : 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
}
},
concat: {
dist: {
src : ['js/noty/jquery.noty.js', 'js/noty/layouts/*.js', 'js/noty/themes/*.js'],
dest: 'js/noty/packaged/jquery.noty.packaged.js'
}
},
wrap: {
basic: {
src: 'js/noty/packaged/jquery.noty.packaged.js',
dest: 'js/noty/packaged/jquery.noty.packaged.js',
options: {
wrapper: ["!function(root, factory) {\n\t if (typeof define === 'function' && define.amd) {\n\t\t define(['jquery'], factory);\n\t } else if (typeof exports === 'object') {\n\t\t module.exports = factory(require('jquery'));\n\t } else {\n\t\t factory(root.jQuery);\n\t }\n}(this, function($) {\n", "\nreturn window.noty;\n\n});"]
}
}
},
uglify: {
//options : {
// preserveComments: function(a) {
// return !!(a.start.file == 'js/noty/jquery.noty.js' && a.start.line == 11);
// }
//},
minifyJS: {
files: {
'js/noty/packaged/jquery.noty.packaged.min.js': ['js/noty/packaged/jquery.noty.packaged.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-release-component');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-wrap');
grunt.registerTask('build', ['bump', 'concat', 'wrap', 'uglify:minifyJS']);
grunt.registerTask('conc', ['concat', 'wrap']);
grunt.registerTask('ugly', ['uglify:minifyJS']);
};
|
JavaScript
| 0.000001 |
@@ -2076,59 +2076,8 @@
');%0A
- grunt.loadNpmTasks('grunt-release-component');%0A
|
d566c1acfadd73caaacd6bfdf1270fbcc4922fed
|
update grunt-karma config
|
Gruntfile.js
|
Gruntfile.js
|
/*
* grunt-image-preload
* https://github.com/lexich/grunt-image-preload
*
* Copyright (c) 2013 Efremov Alexey (lexich)
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Before generating any new files, remove any previously-created files.
clean: {
dist: ['build'],
},
coffee:{
dist:{
options:{
bare:true
},
files:{
"build/backbone-mixin.js":"dist/backbone-mixin.coffee"
}
}
},
uglify:{
dist:{
files:{
"build/backbone-mixin.min.js":"build/backbone-mixin.js"
}
}
},
karma: {
dist: {
configFile: 'karma.conf.js'
}
}
});
grunt.registerTask('compile', [
'karma:dist',
'clean:dist',
'coffee:dist',
'uglify:dist'
]);
// By default, lint and run all tests.
grunt.registerTask('default', ['compile']);
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
};
|
JavaScript
| 0 |
@@ -766,24 +766,26 @@
conf.js'
+,%0A
%0A %7D
@@ -772,24 +772,98 @@
s',%0A
+runnerPort: 9999,%0A singleRun: true,%0A browsers: %5B'PhantomJS'%5D
%0A %7D%0A
|
541205549e27df19f9ce71d8087da77e13084a49
|
Add grunt clean task
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-ngdocs');
grunt.initConfig({
dist: 'dist',
sources: 'src/**/*.js',
tests: 'test/**/*.js',
ngdocFiles: 'src/**/*.ngdoc',
jshint: {
files: ['Gruntfile.js','<%= sources %>'],
options: {
jshintrc: '.jshintrc'
}
},
karma: {
options: {
configFile: 'karma.conf.js'
},
unit: {
singleRun: true
},
watch: {
singleRun: false
}
},
concat: {
dist: {
src: ['<%= sources %>'],
dest: '<%= dist %>/componitor.js'
}
},
uglify: {
dist: {
src: '<%= concat.dist.dest %>',
dest: '<%= dist %>/componitor.min.js',
sourceMap: true
}
},
ngdocs: {
options: {
dest: '<%= dist %>/docs',
scripts: [
'angular.js',
'<%= concat.dist.dest %>'
],
title: 'componitor',
startPage: 'api/componitor',
titleLink: '#/api/componitor',
html5Mode: false
},
api: {
src: ['<%= sources %>', '<%= ngdocFiles %>'],
title: 'API Documentation'
}
},
watch: {
ngdocs: {
files: ['Gruntfile.js', '<%= sources %>', '<%= ngdocFiles %>'],
tasks: ['after-test']
}
}
});
grunt.registerTask('before-test', ['jshint']);
grunt.registerTask('test', ['karma:unit']);
grunt.registerTask('after-test', ['build']);
grunt.registerTask('build', ['concat:dist', 'uglify:dist', 'ngdocs:api']);
grunt.registerTask('default', ['before-test','test','after-test']);
};
|
JavaScript
| 0.006179 |
@@ -518,16 +518,64 @@
ngdoc',%0A
+ clean: %7B%0A dist: %5B'%3C%25= dist %25%3E'%5D%0A %7D,%0A
jshi
@@ -1875,16 +1875,30 @@
uild', %5B
+'clean:dist',
'concat:
|
69f65671b286dde8895e1e777a14b352fd3c65ac
|
Update Gruntfile
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * Jedo version <%= pkg.version %>\n' +
' * Copyright 2014-Preset <%= pkg.author %>\n' +
' * Licensed under <%= pkg.license %>\n' +
' */\n',
banner_dist: '\n/*!' +
' Underscore.js templates as a standalone implementation.\n' +
' JavaScript micro-templating, similar to John Resig\'s implementation.\n' +
' Underscore templates documentation: http://documentcloud.github.com/underscore/#template\n' +
' Modifyed by marlun78\n' +
'*/\n',
/**
* ------------------------------------------------------------
* Clean
* ------------------------------------------------------------
*/
clean: {
dist: 'dist'
},
/**
* ------------------------------------------------------------
* JSHint (http://www.jshint.com/docs/options)
* ------------------------------------------------------------
*/
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
grunt: 'Gruntfile.js',
src: 'src/**/*.js'
},
/**
* ------------------------------------------------------------
* Concat
* ------------------------------------------------------------
*/
concat: {
options: {
banner: '<%= banner %>',
stripBanners: false
},
dist: {
src: ['bower_components/microtemplates/index.js', 'src/jedo.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
/**
* ------------------------------------------------------------
* Watch
* ------------------------------------------------------------
*/
watch: {
src: {
files: '<%= jshint.src.src %>',
tasks: ['jshint:src:newer', 'concat']
}
},
/**
* ------------------------------------------------------------
* Uglify
* ------------------------------------------------------------
*/
uglify: {
options: {
banner: '<%= banner + banner_dist %>',
sourceMap: false
},
dist: {
files: {
'dist/jedo.min.js': ['dist/jedo.js']
}
}
}
});
// https://github.com/gruntjs/grunt-contrib-clean
grunt.loadNpmTasks('grunt-contrib-clean');
// https://github.com/gruntjs/grunt-contrib-concat
grunt.loadNpmTasks('grunt-contrib-concat');
// https://github.com/tschaub/grunt-newer
grunt.loadNpmTasks('grunt-newer');
// https://github.com/gruntjs/grunt-contrib-watch
grunt.loadNpmTasks('grunt-contrib-watch');
// https://github.com/gruntjs/grunt-contrib-jshint
grunt.loadNpmTasks('grunt-contrib-jshint');
// https://github.com/gruntjs/grunt-contrib-uglify
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['jshint']);
grunt.registerTask('dev', ['default', 'watch']);
grunt.registerTask('dist', ['clean', 'default', 'concat', 'uglify']);
};
|
JavaScript
| 0.000001 |
@@ -226,16 +226,45 @@
4-Preset
+%5Cn' +%0A ' * Author:
%3C%25= pkg
@@ -271,32 +271,32 @@
.author %25%3E%5Cn' +%0A
-
' *
@@ -326,32 +326,32 @@
license %25%3E%5Cn' +%0A
+
' */
@@ -359,397 +359,8 @@
n',%0A
- banner_dist: '%5Cn/*!' +%0A ' Underscore.js templates as a standalone implementation.%5Cn' +%0A ' JavaScript micro-templating, similar to John Resig%5C's implementation.%5Cn' +%0A ' Underscore templates documentation: http://documentcloud.github.com/underscore/#template%5Cn' +%0A ' Modifyed by marlun78%5Cn' +%0A '*/%5Cn',%0A%0A
%0A
@@ -1897,22 +1897,8 @@
ner
-+ banner_dist
%25%3E',
|
7e41cd0d3262614f2838bfc10d250e49727c7b80
|
Increase mocha timeout slightly.
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: ['Gruntfile.js', 'bin/*', 'lib/**/*.js', 'test/**/*.js', '!test/assets/**/*']
},
simplemocha: {
options: {
reporter: 'spec'
},
full: { src: ['test/test.js'] },
short: {
options: {
reporter: 'dot'
},
src: ['test/test.js']
}
},
execute: {
assets: {
src: ['test/assets/downloader.js']
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'simplemocha:short']
},
shell: {
cover: {
command: 'node node_modules/istanbul/lib/cli.js cover --dir ./test/reports node_modules/mocha/bin/_mocha -- -R dot',
options: {
stdout: true,
stderr: true
}
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-execute');
grunt.registerTask('test', ['execute:assets', 'simplemocha:full']);
grunt.registerTask('cover', 'shell:cover');
grunt.registerTask('default', ['jshint', 'test']);
};
|
JavaScript
| 0 |
@@ -332,16 +332,49 @@
: 'spec'
+,%0A timeout: '5000'
%0A
|
4e4609bfd06dd21ac852182b817013d2809962cb
|
fix ios cubemaps after the mipmap change
|
src/resources/cubemap.js
|
src/resources/cubemap.js
|
pc.extend(pc, function () {
var CubemapHandler = function (device, assets, loader) {
this._device = device;
this._assets = assets;
this._loader = loader;
};
CubemapHandler.prototype = {
load: function (url, callback) { },
open: function (url, data) { },
patch: function (assetCubeMap, assets) {
var self = this;
var loaded = false;
if (! assetCubeMap.resources[0]) {
assetCubeMap.resources[0] = new pc.Texture(this._device, {
format : pc.PIXELFORMAT_R8_G8_B8_A8,
cubemap: true,
mipmaps: true,
fixCubemapSeams: !! assetCubeMap._dds
});
loaded = true;
}
if (! assetCubeMap.file) {
delete assetCubeMap._dds;
} else if (assetCubeMap.file && ! assetCubeMap._dds) {
var url = assetCubeMap.getFileUrl();
assets._loader.load(url + '?t=' + assetCubeMap.file.hash, 'texture', function (err, texture) {
if (! err) {
assets._loader.patch({
resource: texture,
type: 'texture',
data: assetCubeMap.data
}, assets);
assetCubeMap._dds = texture;
self.patch(assetCubeMap, assets);
} else {
assets.fire("error", err, assetCubeMap);
assets.fire("error:" + assetCubeMap.id, err, assetCubeMap);
assetCubeMap.fire("error", err, assetCubeMap);
return;
}
});
}
if ((! assetCubeMap.file || ! assetCubeMap._dds) && assetCubeMap.resources[1]) {
// unset prefiltered textures
assetCubeMap.resources = [ assetCubeMap.resources[0] ];
loaded = true;
} else if (assetCubeMap._dds && ! assetCubeMap.resources[1]) {
assetCubeMap.resources = [ assetCubeMap.resources[0] ];
// set prefiltered textures
assetCubeMap._dds.fixCubemapSeams = true;
assetCubeMap._dds.mipmaps = this._device.useTexCubeLod ? false : true;
assetCubeMap._dds.addressU = pc.ADDRESS_CLAMP_TO_EDGE;
assetCubeMap._dds.addressV = pc.ADDRESS_CLAMP_TO_EDGE;
assetCubeMap.resources.push(assetCubeMap._dds);
for (var i = 1; i < 6; i++) {
// create a cubemap for each mip in the prefiltered cubemap
var mip = new pc.Texture(this._device, {
cubemap: true,
fixCubemapSeams: true,
mipmaps: false,
format: assetCubeMap._dds.format,
rgbm: assetCubeMap._dds.rgbm,
width: Math.pow(2, 7 - i),
height: Math.pow(2, 7 - i)
});
mip._levels[0] = assetCubeMap._dds._levels[i];
mip.upload();
assetCubeMap.resources.push(mip);
}
loaded = true;
}
var cubemap = assetCubeMap.resource;
if (cubemap.name !== assetCubeMap.name)
cubemap.name = assetCubeMap.name;
if (assetCubeMap.data.hasOwnProperty('rgbm') && cubemap.rgbm !== !! assetCubeMap.data.rgbm)
cubemap.rgbm = !! assetCubeMap.data.rgbm;
cubemap.fixCubemapSeams = !! assetCubeMap._dds;
if (assetCubeMap.data.hasOwnProperty('minFilter') && cubemap.minFilter !== assetCubeMap.data.minFilter)
cubemap.minFilter = assetCubeMap.data.minFilter;
if (assetCubeMap.data.hasOwnProperty('magFilter') && cubemap.magFilter !== assetCubeMap.data.magFilter)
cubemap.magFilter = assetCubeMap.data.magFilter;
if (assetCubeMap.data.hasOwnProperty('anisotropy') && cubemap.anisotropy !== assetCubeMap.data.anisotropy)
cubemap.anisotropy = assetCubeMap.data.anisotropy;
if (cubemap.addressU !== pc.ADDRESS_CLAMP_TO_EDGE)
cubemap.addressU = pc.ADDRESS_CLAMP_TO_EDGE;
if (cubemap.addressV !== pc.ADDRESS_CLAMP_TO_EDGE)
cubemap.addressV = pc.ADDRESS_CLAMP_TO_EDGE;
this._patchTextureFaces(assetCubeMap, assets);
if (loaded) {
// trigger load event as resource is changed
assets.fire('load', assetCubeMap);
assets.fire('load:' + assetCubeMap.id, assetCubeMap);
assetCubeMap.fire('load', assetCubeMap);
}
},
_patchTexture: function() {
this.registry._loader._handlers.cubemap._patchTextureFaces(this, this.registry);
},
_patchTextureFaces: function(assetCubeMap, assets) {
if (! assetCubeMap.loadFaces && assetCubeMap.file)
return;
var cubemap = assetCubeMap.resource;
var sources = [ ];
var count = 0;
var levelsUpdated = false;
var self = this;
if (! assetCubeMap._levelsEvents)
assetCubeMap._levelsEvents = [ null, null, null, null, null, null ];
assetCubeMap.data.textures.forEach(function (id, index) {
var assetReady = function(asset) {
count++;
sources[index] = asset && asset.resource.getSource() || null;
// events of texture loads
var evtAsset = assetCubeMap._levelsEvents[index];
if (evtAsset !== asset) {
if (evtAsset)
evtAsset.off('load', self._patchTexture, assetCubeMap);
if (asset)
asset.on('load', self._patchTexture, assetCubeMap);
assetCubeMap._levelsEvents[index] = asset || null;
}
// check if source is actually changed
if (sources[index] !== cubemap._levels[0][index])
levelsUpdated = true;
// when all faces checked
if (count === 6 && levelsUpdated) {
cubemap.setSource(sources);
// trigger load event (resource changed)
assets.fire('load', assetCubeMap);
assets.fire('load:' + assetCubeMap.id, assetCubeMap);
assetCubeMap.fire('load', assetCubeMap);
}
};
var asset = assets.get(assetCubeMap.data.textures[index]);
if (asset) {
asset.ready(assetReady);
assets.load(asset);
} else if (id) {
assets.once("load:" + id, assetReady);
} else {
assetReady(null);
}
});
},
};
return {
CubemapHandler: CubemapHandler
};
}());
|
JavaScript
| 0 |
@@ -2307,95 +2307,8 @@
ue;%0A
- assetCubeMap._dds.mipmaps = this._device.useTexCubeLod ? false : true;%0A
|
c84e09198ab583a24cf1d48d5f09eaea9d8677d2
|
Tweak saucelabs settings
|
Gruntfile.js
|
Gruntfile.js
|
/* global module: false */
module.exports = function(grunt) {
"use strict";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
base: {
src: ['src/**/*.ts'],
dest: 'build/private/gobo.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'src'
}
},
'tests-local': {
src: ['tests/framework/local.ts', 'tests/*.test.ts'],
dest: 'build/private/local-test.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'tests'
}
},
'test-data': {
src: ['tests/framework/data.ts', 'tests/*.test.ts'],
dest: 'build/private/test-data.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'tests'
}
},
'test-framework': {
src: ['tests/framework/framework.ts'],
dest: 'build/private/test-framework.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'tests'
}
},
'test-server': {
src: ['tests/framework/server.ts'],
dest: 'build/private/test-server.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'tests'
}
},
'test-harness': {
src: ['tests/framework/harness.ts'],
dest: 'build/private/test-harness.js',
options: {
module: 'commonjs',
target: 'es5',
basePath: 'tests'
}
},
},
tslint: {
options: {
configuration: grunt.file.readJSON("tslint.json")
},
dist: {
src: ['src/**/*.ts']
}
},
import: {
dist: {
src: 'src/wrap.js',
dest: 'build/gobo.debug.js'
}
},
uglify: {
build: {
src: 'build/gobo.debug.js',
dest: 'build/gobo-<%= pkg.version %>.min.js'
}
},
watch: {
files: ['src/**/*', 'Gruntfile.js', 'tests/**/*.ts'],
tasks: ['default']
},
bytesize: {
all: {
src: ['build/gobo-*.min.js']
}
},
mochaTest: {
test: {
src: ['build/private/local-test.js']
}
},
'saucelabs-custom': {
all: {
options: {
urls: [ 'http://localhost:8080' ],
build: process.env.CI_BUILD_NUMBER || Date.now(),
testname: 'Gobo unit tests',
public: "public",
browsers: [
{
browserName: 'firefox',
platform: 'WIN8.1'
},
{
browserName: 'chrome',
platform: 'WIN8.1'
},
{
browserName: 'internet explorer',
version: '11',
platform: 'WIN8.1'
},
{
browserName: 'internet explorer',
version: '10',
platform: 'WIN8'
},
{
browserName: 'internet explorer',
version: '9',
platform: 'WIN7'
},
{
browserName: 'safari',
platform: 'OS X 10.10',
version: '8.0'
},
{
browserName: 'android',
platform: 'Linux',
version: '4.4',
deviceName: 'Android Emulator'
},
{
browserName: 'android',
platform: 'Linux',
version: '4.3',
deviceName: 'Android Emulator'
},
{
browserName: 'iphone',
platform: 'OS X 10.10',
version: '8.1',
deviceName: 'iPhone Simulator'
}
]
}
}
}
});
grunt.registerTask('test-server:cached', function() {
console.log("Starting server");
require('./build/private/test-server.js')().start(true);
});
grunt.registerTask('test-server:uncached', function() {
console.log("Starting server");
require('./build/private/test-server.js')().start(false);
});
// Plugins
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bytesize');
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-import');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-tslint');
grunt.loadNpmTasks('grunt-saucelabs');
// Default task(s).
grunt.registerTask('default',
['typescript', 'import', 'tslint', 'mochaTest', 'uglify', 'bytesize']);
grunt.registerTask('dev',
['typescript', 'import', 'test-server:uncached', 'watch']);
grunt.registerTask('release',
['default', 'test-server:cached', 'saucelabs-custom']);
};
|
JavaScript
| 0 |
@@ -3234,16 +3234,173 @@
ublic%22,%0A
+ pollInterval: 5,%0A statusCheckAttempts: 18,%0A 'max-duration': 90,%0A maxRetries: 1,%0A
|
6d40ccb04a8402c94879388cd734ac3c6a3f66b7
|
Add remaining missing 'console.log' (#1098)
|
src/providers/sh/commands/domains/buy.js
|
src/providers/sh/commands/domains/buy.js
|
// Packages
const { italic, bold } = require('chalk')
// Utilities
const error = require('../../../../util/output/error')
const wait = require('../../../../util/output/wait')
const cmd = require('../../../../util/output/cmd')
const param = require('../../../../util/output/param')
const info = require('../../../../util/output/info')
const success = require('../../../../util/output/success')
const stamp = require('../../../../util/output/stamp')
const promptBool = require('../../../../util/input/prompt-bool')
const eraseLines = require('../../../../util/output/erase-lines')
const treatBuyError = require('../../util/domains/treat-buy-error')
const NowCreditCards = require('../../util/credit-cards')
const addBilling = require('../billing/add')
module.exports = async function({ domains, args, currentTeam, user, coupon }) {
const name = args[0]
let elapsed
if (!name) {
return console.error(error(`Missing domain name. Run ${cmd('now domains help')}`))
}
const nameParam = param(name)
let stopSpinner
let price
let period
let validCoupon
try {
if (coupon) {
stopSpinner = wait(`Validating coupon ${param(coupon)}`)
const creditCards = new NowCreditCards({
apiUrl: domains._agent._url,
token: domains._token,
debug: domains._debug,
currentTeam
})
const [couponInfo, { cards }] = await Promise.all([
domains.coupon(coupon),
creditCards.ls()
])
stopSpinner()
if (!couponInfo.isValid) {
return console.error(error(`The coupon ${param(coupon)} is invalid`))
}
if (!couponInfo.canBeUsed) {
return console.error(error(`The coupon ${param(coupon)} has already been used`))
}
validCoupon = true
if (cards.length === 0) {
info(
'You have no credit cards on file. Please add one in order to claim your free domain'
)
info(`Your card will ${bold('not')} be charged`)
await addBilling({
creditCards,
currentTeam,
user,
clear: true
})
}
}
elapsed = stamp()
stopSpinner = wait(`Checking availability for ${nameParam}`)
const json = await domains.price(name)
price = validCoupon ? 0 : json.price
period = json.period
} catch (err) {
stopSpinner()
return console.error(error(err.message))
}
const available = await domains.status(name)
stopSpinner()
if (!available) {
console.error(error(
`The domain ${nameParam} is ${italic('unavailable')}! ${elapsed()}`
))
return
}
const periodMsg = `${period}yr${period > 1 ? 's' : ''}`
console.log(info(
`The domain ${nameParam} is ${italic('available')} to buy under ${bold(
(currentTeam && currentTeam.slug) || user.username || user.email
)}! ${elapsed()}`
))
const confirmation = await promptBool(
`Buy now for ${bold(`$${price}`)} (${periodMsg})?`
)
eraseLines(1)
if (!confirmation) {
return info('Aborted')
}
stopSpinner = wait('Purchasing')
elapsed = stamp()
try {
await domains.buy({ name, coupon })
} catch (err) {
stopSpinner()
return treatBuyError(err)
}
stopSpinner()
console.log(success(`Domain ${nameParam} purchased ${elapsed()}`))
console.log(info(
`You may now use your domain as an alias to your deployments. Run ${cmd(
'now alias --help'
)}`
))
}
|
JavaScript
| 0.000001 |
@@ -1788,24 +1788,36 @@
) %7B%0A
+console.log(
info(%0A
@@ -1915,16 +1915,17 @@
)
+)
%0A
@@ -1925,16 +1925,28 @@
+console.log(
info(%60Yo
@@ -1985,16 +1985,17 @@
harged%60)
+)
%0A%0A
@@ -3015,16 +3015,28 @@
return
+console.log(
info('Ab
@@ -3042,16 +3042,17 @@
borted')
+)
%0A %7D%0A%0A
|
190714b15a12a472c382a67cf2b78b7ce6634f6b
|
Add doc to method and make attributes of LOVModal configurable
|
src/public-assets/js/components/modal.js
|
src/public-assets/js/components/modal.js
|
App.extend({
Components: {}
});
App.Components.Modal = (function ($, document) {
var pub = {
name: 'App.Components.Modal',
depends: ['App.Components.Form'], /** Form's assignFormValue method used in populateModal */
events: ['click'],
submitFormButtonSelector: '[data-submit-modal-form]',
submitForm: function (modal, form) {
form = form || 'form';
$(modal).find(form).submit();
},
/**
* Populate the fields in the modal from the data attributes on the modal trigger button
* @param modalId
* @param modelName
*/
populateModal: function (modalId, modelName) {
var assignFormValue = App.Components.Form.assignFormValue;
$("[data-target='" + modalId + "']").on('click', function (event) {
var data = this.dataset;
for (var field in data) {
var element = $(modalId + " [name='" + modelName + "[" + field + "]'");
if (element.length == 0 && field.indexOf('[]') > -1) {
element = $(modalId + " [name='" + modelName + "[" + (field.replace('[]', '')) + "][]'");
}
if (element.length > 0) {
var value = $(this).data(field);
if (element.length == 1) {
assignFormValue(element, value);
}
else if (element.length > 1) {
element.each(function () {
assignFormValue($(this), value);
});
}
}
}
});
},
/**
* Remove option in a dropdown based on the value of a field
* @param modalSelector selector to select modal
* @param modelName name of model used in modal
* @param fieldName name of field with value
* @param dropdownFieldName name of dropdown
*/
hideDropdownOptionWithFieldValue: function (modalSelector, modelName, fieldName, dropdownFieldName) {
$(modalSelector).on('show.bs.modal', function (event) {
var field = $(modalSelector + " [name='" + modelName + "[" + fieldName + "]'");
var dropdown = $(modalSelector + " select[name='" + modelName + "[" + dropdownFieldName + "]']");
dropdown.find('option').show();
var optionToExclude = dropdown.find("option[value='" + field.val() + "']");
optionToExclude.hide();
});
},
$genericModal: $('[data-generic-modal]'),
modalIdSelector: '[data-id]',
modalTitleSelector: 'h4.modal-title',
modalMsgSelector: '[data-msg]',
modalFormSelector: 'form',
genericPrefillModal: function () {
var modal = this.$genericModal;
modal.on('show.bs.modal', function (event) {
var src = $(event.relatedTarget),
id = src.data('id'),
title = src.data('title'),
msg = src.data('msg'),
url = src.data('url');
modal.find(pub.modalTitleSelector).text(title);
modal.find(pub.modalMsgSelector).html(msg);
modal.find(pub.modalFormSelector).prop('action', url)
.find(pub.modalIdSelector).val(id);
});
},
init: function () {
submitModalForm();
this.genericPrefillModal();
},
close: function () {
$('.modal:visible').modal('hide');
}
};
function submitModalForm() {
$(document).on(pub.events.click, pub.submitFormButtonSelector, function () {
$(this).closest('.modal-content').find('form').submit();
var $submitBtn = $(pub.submitFormButtonSelector);
$submitBtn.attr("disabled", true);
setTimeout(function () {
$submitBtn.removeAttr("disabled");
}, 5000);
});
}
return pub;
})(jQuery, document);
App.initModule(App.Components.Modal);
|
JavaScript
| 0 |
@@ -1798,13 +1798,11 @@
*
-Remov
+Hid
e op
@@ -2464,24 +2464,70 @@
me + %22%5D'%5D%22);
+%0A%0A // show all dropdown options
%0A
@@ -2562,16 +2562,85 @@
.show();
+%0A%0A // get option with value correlating to field value
%0A
@@ -2660,21 +2660,18 @@
optionTo
-Exclu
+Hi
de = dro
@@ -2720,16 +2720,48 @@
+ %22'%5D%22);
+%0A%0A // hide option
%0A
@@ -2781,13 +2781,10 @@
onTo
-Exclu
+Hi
de.h
|
6869d0ec93a9d6cd4ca373efd73f3f843b92d421
|
Update serve-static path
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
var serveStatic = require('serve-static');
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
livereload: {
port: 35729
},
connect: {
livereload: {
options: {
base: 'dist',
port: 9000,
hostname: 'localhost', // Change this to '0.0.0.0' to access the server from outside.
middleware: function(connect, options) {
return [
serveStatic('limejs/closure/closure/goog'),
serveStatic(options.base[0])
];
}
}
}
},
regarde: {
all: {
files: '**',
tasks: ['livereload']
}
},
open: {
server: {
url: 'http://localhost:<%= connect.livereload.options.port %>/index.html'
}
},
clean: {
all: ['bin', 'coverage', 'dist/*', '.tmp/*']
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'src/js/{,*/}*.js',
'test/spec/{,*/}*.js'
]
},
csslint: {
dist: {
options: {
'bulletproof-font-face': false,
'ids': false,
'known-properties': false
},
src: 'src/css/{,*/}*.css'
}
},
cssmin: {
dist: {
src: 'src/css/{,*/}*.css',
dest: 'dist/css/tictactoe.min.css'
}
},
htmlmin: {
options: {
collapseWhitespace: false, // https://github.com/yeoman/grunt-usemin/issues/44
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: false
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['{,*/}*.html'],
dest: 'dist'
}]
}
},
useminPrepare: {
html: 'src/index.html'
},
usemin: {
html: ['dist/index.html'],
css: ['dist/css/{,*/}*.css'],
options: {
dirs: ['dist']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: 'src/img',
src: ['*.png', '*.jpg'],
dest: 'dist/img'
}],
options: {
optimizationLevel: 3
}
}
},
closureDepsWriter: {
test: {
options: {
closureLibraryPath: 'limejs/closure',
root_with_prefix: [
'"test/spec/ ../../../../test/spec"',
'"limejs/lime/ ../../../lime/"',
'"limejs/box2d/src/ ../../../box2d/src/"',
'"limejs/closure/ ../../"'
]
},
dest: 'limejs/closure/closure/goog/deps.js'
},
all: {
options: {
closureLibraryPath: 'limejs/closure',
root_with_prefix: [
'"src/js/ ../../../../src/js"',
'"limejs/lime/ ../../../lime/"',
'"limejs/box2d/src/ ../../../box2d/src/"',
'"limejs/closure/ ../../"'
]
},
dest: 'limejs/closure/closure/goog/deps.js'
}
},
closureBuilder: {
options: {
closureLibraryPath: 'limejs/closure',
inputs: 'src/js/tictactoe.js'
},
test: {
options: {
closureLibraryPath: 'limejs/closure',
inputs: 'test/spec/tictactoe-deps.js'
},
src: ['limejs/closure', 'limejs/box2d/src', 'limejs/lime', 'test/spec'],
dest: '.tmp/js/tictactoe-test.js'
},
dev: {
src: ['limejs/closure', 'limejs/box2d/src', 'limejs/lime', 'src/js'],
dest: 'dist/js/tictactoe.js'
},
dist: {
src: ['limejs/closure', 'limejs/box2d/src', 'limejs/lime', 'src/js'],
dest: '.tmp/js/tictactoe.js'
}
},
closureCompiler: {
options: {
compilerFile: 'limejs/bin/external/closure-compiler.jar',
compilerOpts: {
// compilation_level: 'ADVANCED_OPTIMIZATIONS',
// externs: ['../../server/javascript/gamerules.externs.js']
}
},
all: {
src: ['src/js/gamerules.js', '.tmp/js/tictactoe.js'],
dest: 'dist/js/tictactoe.min.js'
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
},
coverage: {
configFile: 'karma-coverage.conf.js'
}
},
compress: {
zip: {
options: {
archive: 'bin/<%= pkg.name %>-<%= pkg.version %>.zip'
},
files: [{
expand: true,
src: ['src/**', 'test/**', 'docs/**', 'dist/**', '*']
}]
}
},
copy: {
dev: {
files: [{
expand: true,
dot: true,
cwd: 'src',
dest: 'dist',
src: [
'*',
'bower_components/**',
'css/**',
'img/**',
'js/gamerules.js'
]
}]
},
dist: {
files: [{
expand: true,
dot: true,
cwd: 'src',
dest: 'dist',
src: [
'*.ico',
'css/fonts/{,*/}*.{svg,woff,ttf}',
'bower_components/**'
]
}]
}
}
});
// closureBuilder fails if the destination folder does not exist
grunt.registerTask('makeJsOutputDir', function (target) {
if (target === 'dist' || target === 'test') {
grunt.file.mkdir('.tmp/js');
}
grunt.file.mkdir('dist/js');
});
grunt.registerTask('update', [
'closureDepsWriter:all'
]);
grunt.registerTask('serve', [
'clean',
'jshint',
//'csslint', //TODO
'copy:dev',
'makeJsOutputDir:dev',
'closureDepsWriter:all',
'closureBuilder:dev',
'livereload-start',
'connect',
'open',
'regarde'
]);
grunt.registerTask('build', [
'imagemin',
'cssmin',
'useminPrepare',
'htmlmin',
'copy:dist',
'usemin',
'makeJsOutputDir:dist',
'closureDepsWriter:all',
'closureBuilder:dist',
'closureCompiler'
]);
grunt.registerTask('test', [
'makeJsOutputDir:test',
'closureDepsWriter:test',
'closureBuilder:test',
'karma:unit'
]);
grunt.registerTask('coverage', [
'makeJsOutputDir:test',
'closureDepsWriter:test',
'closureBuilder:test',
'karma:coverage'
]);
grunt.registerTask('default', ['clean', 'jshint', /* 'csslint', */ 'test', 'build']);
};
|
JavaScript
| 0 |
@@ -821,16 +821,40 @@
eStatic(
+require('path').resolve(
options.
@@ -861,16 +861,17 @@
base%5B0%5D)
+)
%0A
|
1690c9d11e54e16bde9adac1c318d3fa3ec4ac34
|
Update base directory
|
Gruntfile.js
|
Gruntfile.js
|
/*global require:true, module:false*/
module.exports = function (grunt) {
'use strict';
// For livereload
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect['static'](path.resolve(point));
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
connect: {
livereload: {
options: {
port: 7770,
base: 'src/node_modules/',
middleware: function (connect, options) {
return [lrSnippet, folderMount(connect, options.base)];
}
}
}
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['lib/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
}
},
jshint: {
jshintrc: '.jshintrc',
gruntfile: {
src: ['Gruntfile.js']
},
js: {
src: ['src/js/*.js', 'test/**/*.js']
}
},
regarde: {
// gruntfile: {
// files: ['<%= jshint.gruntfile.src %>'],
// tasks: ['jshint']
// },
html: {
files: 'src/index.html',
tasks: ['livereload']
},
css: {
files: 'src/css/styles.css',
tasks: ['livereload']
},
js: {
files: '<%= jshint.js.src %>',
tasks: ['jshint', 'livereload']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.registerTask('default', ['livereload-start', 'connect', 'regarde']);
};
|
JavaScript
| 0.000001 |
@@ -850,25 +850,9 @@
e: '
-src/node_modules/
+.
',%0A
|
1a4b5e5a8d1903997166004725f2184e6d86da15
|
Remove build-contrib task
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'tasks/**/*.js',
'<%= nodeunit.tests %>'
]
},
clean: {
test: [
'test/tmp',
'.sass-cache'
]
},
nodeunit: {
tests: ['test/test.js']
},
sass: {
options: {
sourcemap: 'none'
},
compile: {
files: {
'test/tmp/scss.css': 'test/fixtures/compile.scss',
'test/tmp/sass.css': 'test/fixtures/compile.sass',
'test/tmp/css.css': 'test/fixtures/compile.css'
}
},
ignorePartials: {
cwd: 'test/fixtures/partials',
src: '*.scss',
dest: 'test/tmp',
expand: true,
ext: '.css'
},
updateTrue: {
options: {
update: true
},
files: [{
expand: true,
cwd: 'test/fixtures',
src: [
'updatetrue.scss',
'updatetrue.sass',
'updatetrue.css'
],
dest: 'test/tmp',
ext: '.css'
}]
}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.registerTask('mkdir', grunt.file.mkdir);
grunt.registerTask('test', [
'jshint',
'clean',
'mkdir:tmp',
'sass',
'nodeunit',
'clean'
]);
grunt.registerTask('default', ['test', 'build-contrib']);
};
|
JavaScript
| 0.000001 |
@@ -1571,25 +1571,8 @@
est'
-, 'build-contrib'
%5D);%0A
|
49fccfe867c2798a25537798290996ee90ca6c0b
|
Add forgotten comma in folder name array
|
Gruntfile.js
|
Gruntfile.js
|
/*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
'use strict'
module.exports = function (grunt) {
const os = grunt.option('os') || process.env.PCKG_OS_NAME || ''
const platform = grunt.option('platform') || process.env.PCKG_CPU_ARCH || ''
const node = grunt.option('node') || process.env.nodejs_version || process.env.PCKG_NODE_VERSION || ''
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace_json: {
manifest: {
src: 'package.json',
changes: {
'engines.node': (node || '<%= pkg.engines.node %>'),
os: (os ? [os] : '<%= pkg.os %>'),
cpu: (platform ? [platform] : '<%= pkg.cpu %>')
}
}
},
compress: {
pckg: {
options: {
mode: os === 'linux' ? 'tgz' : 'zip',
archive: 'dist/<%= pkg.name %>-<%= pkg.version %>' + (node ? ('_node' + node) : '') + (os ? ('_' + os) : '') + (platform ? ('_' + platform) : '') + (os === 'linux' ? '.tgz' : '.zip')
},
files: [
{
src: [
'LICENSE',
'*.md',
'package.json',
'ctf.key',
'swagger.yml',
'server.ts',
'config.schema.yml',
'build/**',
'!build/reports/**',
'config/*.yml',
'data/*.ts',
'data/static/**',
'data/chatbot/.gitkeep',
'encryptionkeys/**',
'frontend/dist/frontend/**'
'frontend/src/**/*.ts',
'ftp/**',
'i18n/.gitkeep',
'lib/**',
'models/*.ts',
'node_modules/**',
'routes/*.ts',
'uploads/complaints/.gitkeep',
'views/**'
],
dest: 'juice-shop_<%= pkg.version %>/'
}
]
}
}
})
grunt.registerTask('checksum', 'Create .md5 checksum files', function () {
const fs = require('fs')
const crypto = require('crypto')
fs.readdirSync('dist/').forEach(file => {
const buffer = fs.readFileSync('dist/' + file)
const md5 = crypto.createHash('md5')
md5.update(buffer)
const md5Hash = md5.digest('hex')
const md5FileName = 'dist/' + file + '.md5'
grunt.file.write(md5FileName, md5Hash)
grunt.log.write(`Checksum ${md5Hash} written to file ${md5FileName}.`).verbose.write('...').ok()
grunt.log.writeln()
})
})
grunt.loadNpmTasks('grunt-replace-json')
grunt.loadNpmTasks('grunt-contrib-compress')
grunt.registerTask('package', ['replace_json:manifest', 'compress:pckg', 'checksum'])
}
|
JavaScript
| 0.000001 |
@@ -1528,24 +1528,25 @@
frontend/**'
+,
%0A
|
7200a74e13b02d27f5eee295f229c15ccc47f404
|
version 1.2.0 - Added Signature Pad field type.
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
ngtemplates: {
'formly.onsenui': {
src: 'src/fields/**.html',
dest: 'src/fields/<%= pkg.name %>.templates.js',
options: {
url: function(url) { return url.replace('src/fields', 'onsenui/fields'); }
}
}
},
uglify: {
options: {
banner:
'/* <%= pkg.name %>' +
' | (v<%= pkg.version %>)' +
' | builded on <%= grunt.template.today("dd-mm-yyyy") %>' +
' | GitHub: <%= pkg.repository.url %>' +
'*/\n(function () {',
separator: '})(); (function () {',
footer: '})();'
},
build: {
src: ['src/modules/<%= pkg.name %>.js','src/modules/<%= pkg.name %>.config.js','src/fields/<%= pkg.name %>.templates.js'],
dest: 'build/<%= pkg.name %>.min.js'
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'src/css',
src: ['*.css'],
dest: 'build',
ext: '.min.css'
}]
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task(s).
grunt.registerTask('default', ['uglify','ngtemplates','cssmin']);
};
|
JavaScript
| 0 |
@@ -690,16 +690,22 @@
src: %5B
+%0A%09%09%09%09%09
'src/mod
@@ -725,24 +725,30 @@
name %25%3E.js',
+%0A%09%09%09%09%09
'src/modules
@@ -775,16 +775,60 @@
fig.js',
+%0A%09%09%09%09%09'src/directives/*.directive.js',%0A%09%09%09%09%09
'src/fie
@@ -860,16 +860,21 @@
ates.js'
+%0A%09%09%09%09
%5D,%0A
@@ -1299,24 +1299,26 @@
task(s).%0A
+//
grunt.regist
@@ -1370,12 +1370,79 @@
smin'%5D);
+%0A%09grunt.registerTask('default', %5B'ngtemplates','cssmin','uglify'%5D);
%0A%0A%7D;
|
b3123ad7ca7ad8d1da656a55fe669d28b7ee348f
|
Remove uneeded variable
|
Gruntfile.js
|
Gruntfile.js
|
/*!
* Bootstrap Grid Flexbox Gruntfile
* https://github.com/ngengs/bootstrap-grid-flexbox
* Copyright 2016 Rizky Kharisma.
* Licensed under MIT (https://github.com/ngengs/bootstrap-grid-flexbox/blob/master/LICENSE)
*/
module.exports = function (grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
var path = require('path');
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
clean: {
dist: 'dist'
},
less: {
compileCore: {
options: {
strictMath: true,
sourceMap: false,
outputSourceFiles: true,
sourceMapURL: '<%= pkg.name %>.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
},
src: 'less/<%= pkg.name %>.less',
dest: 'dist/css/<%= pkg.name %>.css'
}
},
cssmin: {
options: {
// TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
// and then simplify the fix for https://github.com/twbs/bootstrap/issues/14837 accordingly
compatibility: 'ie8',
keepSpecialComments: '*',
sourceMap: true,
sourceMapInlineSources: true,
advanced: false
},
minifyCore: {
src: 'dist/css/<%= pkg.name %>.css',
dest: 'dist/css/<%= pkg.name %>.min.css'
}
},
sass: {
options: {
precision: 6,
outputSourceFiles: true,
outputStyle: 'expanded',
sourceMap: true,
sourceMapURL: '<%= pkg.name %>.css.map',
sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
},
compileCore: {
src: 'sass/<%= pkg.name %>.scss',
dest: 'dist/css/<%= pkg.name %>.css'
}
},
watch: {
less: {
files: 'less/**/*.less',
tasks: 'less'
}
},
exec: {
npmUpdate: {
command: 'npm update'
}
},
compress: {
main: {
options: {
archive: '<%= pkg.name %>-<%= pkg.version %>-dist.zip',
mode: 'zip',
level: 9,
pretty: true
},
files: [
{
expand: true,
cwd: 'dist/',
src: ['**'],
dest: '<%= pkg.name %>-<%= pkg.version %>-dist'
}
]
}
}
});
// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
// Watch File Changes
grunt.loadNpmTasks('grunt-contrib-watch');
// CSS distribution task.
grunt.registerTask('less-compile', ['less:compileCore']);
grunt.registerTask('sass-compile', ['sass:compileCore']);
grunt.registerTask('dist-css', ['sass-compile', 'cssmin:minifyCore']);
// Full distribution task.
grunt.registerTask('dist', ['clean:dist', 'dist-css']);
// Default task.
grunt.registerTask('default', ['dist']);
grunt.registerTask('prep-release', ['dist', 'compress']);
};
|
JavaScript
| 0.000001 |
@@ -337,39 +337,8 @@
';%0A%0A
- var path = require('path');%0A%0A
//
|
03587aea113ea6a088d3af2ca920668898576fbf
|
Add cached getByPersonId method to participants store
|
src/store/courses/SectionParticipants.js
|
src/store/courses/SectionParticipants.js
|
Ext.define('Slate.store.courses.SectionParticipants', {
extend: 'Ext.data.Store',
model: 'Slate.model.course.SectionParticipant',
config: {
section: null,
cohort: null,
role: null,
pageSize: 0,
remoteSort: false,
sorters: [
{
property: 'PersonLastName',
direction: 'ASC'
},
{
property: 'PersonFirstName',
direction: 'ASC'
}
]
},
constructor: function() {
this.callParent(arguments);
this.dirty = true;
},
// config handlers
updateSection: function(section) {
this.getProxy().setExtraParam('course_section', section || null);
this.dirty = true;
},
updateCohort: function(cohort) {
this.getProxy().setExtraParam('cohort', cohort || null);
this.dirty = true;
},
updateRole: function(role) {
this.getProxy().setExtraParam('role', role || null);
this.dirty = true;
},
// member methods
loadIfDirty: function() {
if (!this.dirty) {
return;
}
this.dirty = false;
this.load();
}
});
|
JavaScript
| 0 |
@@ -508,24 +508,47 @@
%5D%0A %7D,%0A%0A%0A
+ // model lifecycle%0A
construc
@@ -557,32 +557,32 @@
r: function() %7B%0A
-
this.cal
@@ -628,32 +628,520 @@
= true;%0A %7D,%0A%0A
+ loadRecords: function() %7B%0A var me = this,%0A personIdMap = %7B%7D,%0A count, index = 0, participant;%0A%0A me.callParent(arguments);%0A%0A if (!me.getSection()) %7B%0A me.peopleMap = null;%0A return;%0A %7D%0A%0A for (count = me.getCount(); index %3C count; index++) %7B%0A participant = me.getAt(index);%0A personIdMap%5Bparticipant.get('PersonID')%5D = participant;%0A %7D%0A%0A me.personIdMap = personIdMap;%0A %7D,%0A%0A
%0A // config h
@@ -1701,16 +1701,16 @@
false;%0A
-
@@ -1722,16 +1722,309 @@
load();%0A
+ %7D,%0A%0A getByPersonId: function(personId) %7B%0A var personIdMap = this.personIdMap;%0A%0A if (!personIdMap) %7B%0A Ext.Logger.warn('getByPersonId is only available when filtering by section');%0A return null;%0A %7D%0A%0A return personIdMap%5BpersonId%5D %7C%7C null;%0A
%7D%0A%7D)
|
1ad9fbd90447947578f4fa5b6ae4e5627d75acf1
|
change default lambda runtime to nodejs14.x
|
src/config/constants.js
|
src/config/constants.js
|
// dummy placeholder url for the WHATWG URL constructor
// https://github.com/nodejs/node/issues/12682
export const BASE_URL_PLACEHOLDER = 'http://example'
export const CUSTOM_OPTION = 'serverless-offline'
export const DEFAULT_LAMBDA_RUNTIME = 'nodejs12.x'
// https://docs.aws.amazon.com/lambda/latest/dg/limits.html
export const DEFAULT_LAMBDA_MEMORY_SIZE = 1024
// default function timeout in seconds
export const DEFAULT_LAMBDA_TIMEOUT = 900 // 15 min
// timeout for all connections to be closed
export const SERVER_SHUTDOWN_TIMEOUT = 5000
export const DEFAULT_WEBSOCKETS_API_ROUTE_SELECTION_EXPRESSION =
'$request.body.action'
export const DEFAULT_WEBSOCKETS_ROUTE = '$default'
export const DEFAULT_DOCKER_CONTAINER_PORT = 9001
|
JavaScript
| 0.000005 |
@@ -247,17 +247,17 @@
'nodejs1
-2
+4
.x'%0A%0A//
|
5889cc8baee933594fb162e88e0aea194da0dfd3
|
fix error in Lobby
|
src/containers/Lobby.js
|
src/containers/Lobby.js
|
import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import withUserMedia from '../hocs/withUserMedia'
import withSandbox from '../hocs/withSandbox'
import integrateLobby from '../hocs/integrateLobby'
import withChallenges from '../hocs/withChallenges'
import Video from '../components/Video'
import Editor from '../components/Editor'
import TestTable from '../components/TestTable'
import Challenges from '../components/challenges'
class Lobby extends PureComponent {
constructor(props) {
super(props)
this.onRunClick = this.onRunClick.bind(this)
this.showChallenges = this.showChallenges.bind(this)
this.hideChallenges = this.hideChallenges.bind(this)
this.state = {
challengesVisibility: 'hide'
}
}
showChallenges() {
this.setState({challengesVisibility: 'visible column col-lg-2 float-right'})
}
hideChallenges() {
this.setState({challengesVisibility: 'hide'})
}
renderLoading() {
return (
<span>Loading...</span>
)
}
onChallengeClick(item) {
console.log('item in onChallengeClick: ', item)
if (item.complete === null) {
this.props.onEditorChange(item.initial_editor)
this.props.createNewChallenge({challengeId: item.id, editorState: item.initial_editor})
// this.props.createNewChallenge
} else {
this.props.onEditorChange(item.editorState)
}
this.props.onChallengeChange(item)
}
onEditorChange(newValue) {
this.setState({ editorValue: newValue }, () => {
this.state.connection &&
this.state.connection.send({ editorValue: newValue })
})
}
onRunClick(e) {
this.props.sandboxEval(this.props.editorValue)
}
componentWillReceiveProps(nextProps) {
if (nextProps.sandboxResult !== this.props.sandboxResult) {
this.evalMessageStyle = {color: 'red'}
this.evalMessage = ''
if (Array.isArray(nextProps.sandboxResult)) {
if (nextProps.sandboxResult.every((el) => el === true)) {
this.evalMessageStyle = {
color: 'green',
float: 'right',
marginRight: '40px'}
this.evalMessage = "You passed: " + this.props.currentChallenge.input_output.length + '/' + this.props.currentChallenge.input_output.length
this.props.currentChallenge.complete = true
} else {
this.evalMessageStyle = {
color: 'red',
float: 'right',
marginRight: '40px'}
this.evalMessage = "You passed: " + nextProps.sandboxResult.reduce((acc, el) => (el === true ? acc + 1 : acc), 0) + '/' + this.props.currentChallenge.input_output.length
this.props.currentChallenge.complete = false
}
this.props.updateChallenge({challengeId: this.props.currentChallenge.id, complete: this.props.currentChallenge.complete = true, editorState: this.props.editorValue})
} else {
this.evalMessage = nextProps.sandboxResult
}
}
}
renderComplete() {
const { stream: myStream, peerStream, sandboxResult } = this.props
return (
<div className="lobby-page columns col-gapless">
<div className="left-screen" onClick={this.hideChallenges}>
<section className="webcam-section">
<div className="parent-webcam">
<div className="myStream">
{myStream && <Video streamId={myStream.id} src={URL.createObjectURL(myStream)} muted={true}/>}
</div>
<div className="video-responsive video-responsive-4-3 waiting">
{peerStream ? <Video streamId={peerStream.id} src={URL.createObjectURL(peerStream)} muted={false}/> : <span>Waiting for Peer.</span>}
</div>
</div>
</section>
<div className="test-suite">
<TestTable
tests={tests}
sandboxResult={sandboxResult || []} />
<div style={this.evalMessageStyle}>{this.evalMessage}</div>
</div>
</div>
<section className='editor-section column col-lg-6' onClick={this.hideChallenges}>
<Editor
value={this.props.editorValue || ''}
onChange={this.props.onEditorChange} />
</section>
</section>
<div className="test-suite">
{!!this.props.currentChallenge &&
<div>
<div style={{fontWeight: 'bold', fontSize: '30px', textAlign: 'center', textDecoration: 'underline'}}>{this.props.currentChallenge.name}:</div>
<div style={{fontSize: '20px', fontStyle: 'italic', textAlign: 'center'}}>{this.props.currentChallenge.question}</div>
<TestTable
tests={this.props.currentChallenge.input_output || []}
sandboxResult={sandboxResult || []} />
</div> }
<div style={this.evalMessageStyle}>{this.evalMessage}</div>
</div>
</div>
<div className={this.state.challengesVisibility}>
<Challenges
challenges={this.props.challenges}
onChallengeClick={this.onChallengeClick.bind(this)}
/>
</div>
<button className="btn" onClick={this.onRunClick}>Run</button>
<button className="btn" onClick={this.showChallenges}>Challenges</button>
</div>
)
}
render() {
const { isUserMediaLoading } = this.props
return isUserMediaLoading
? this.renderLoading()
: this.renderComplete()
}
}
Lobby.propTypes = {
id: PropTypes.string,
peer: PropTypes.object,
stream: PropTypes.object,
error: PropTypes.object,
isUserMediaLoading: PropTypes.bool,
peerId: PropTypes.string,
}
export default connect()(withChallenges(withUserMedia(integrateLobby(withSandbox(Lobby)))))
|
JavaScript
| 0.000001 |
@@ -3804,246 +3804,8 @@
ion%3E
-%0A %3Cdiv className=%22test-suite%22%3E%0A %3CTestTable%0A tests=%7Btests%7D%0A sandboxResult=%7BsandboxResult %7C%7C %5B%5D%7D /%3E%0A %3Cdiv style=%7Bthis.evalMessageStyle%7D%3E%7Bthis.evalMessage%7D%3C/div%3E%0A %3C/div%3E
%0A%0A
@@ -4059,37 +4059,16 @@
ction%3E%0A%0A
- %3C/section%3E%0A
@@ -4695,17 +4695,16 @@
%7D%3C/div%3E%0A
-%0A
@@ -4725,26 +4725,15 @@
%3C
-/div%3E%0A %3Cdiv
+section
cla
@@ -4922,36 +4922,41 @@
/%3E%0A %3C/
-div%3E
+section%3E%0A
%0A %3Cbutton
|
4b5d603ff97b2cd44b4188cb88f8591282ae31a0
|
Add hooks to our new JSON-RPC methods to the JS API class.
|
static/js/api.js
|
static/js/api.js
|
Namespace("ryepdx.openerp.quickship").ApiFactory = function (instance) {
return new (instance.web.Class.extend({
init: function(options){
options = options || {};
this.connection = new instance.web.JsonRPC();
this.connection.setup(options.url || 'http://localhost:8069');
this.model = new instance.web.Model('stock.packages');
this.notifications = {};
},
// Makes a JSON-RPC call to the local OpenERP server.
rpc : function(endpoint, name,params){
var ret = new $.Deferred();
var callbacks = this.notifications[name] || [];
for(var i = 0; i < callbacks.length; i++){
callbacks[i](params);
}
this.connection.rpc('/' + endpoint + '/' + name, params || {}).done(function(result) {
ret.resolve(result);
}).fail(function(error) {
ret.reject(error);
});
return ret;
},
ups_rpc: function (name, params) {
return this.rpc('ups', name, params);
},
usps_rpc: function (name, params) {
return this.rpc('usps', name, params);
},
// Allows triggers to be set for when particular JSON-RPC function calls are made via 'message.'
add_notification: function(name, callback){
if(!this.notifications[name]){
this.notifications[name] = [];
}
this.notifications[name].push(callback);
},
// Convenience function for creating a new package.
create_package: function (sale_order, pkg, picker, packer, shipper) {
return this.model.call("create_package", {
"sale_order": sale_order,
"package": pkg,
"picker_id": picker,
"packer_id": packer,
"shipper_id": shipper
});
},
// Convenience function for getting quotes for a package.
get_quotes: function (package_id, test) {
var params = {};
if (test !== undefined) {
params['test'] = test;
}
return this.model.call('get_quotes', [package_id], params);
},
// Convenience function for getting the label for a package.
get_label: function (package_id, shipping, test) {
var params = {"shipping": shipping};
if (test !== undefined) {
params['test'] = test;
}
return this.model.call('get_label', [package_id], params);
},
// Convenience function for getting stats.
get_stats: function (fromDate, toDate) {
return this.model.call('get_stats', [fromDate, toDate]);
}
}))();
};
|
JavaScript
| 0 |
@@ -198,26 +198,19 @@
this.
-connection
+rpc
= new i
@@ -249,26 +249,19 @@
this.
-connection
+rpc
.setup(o
@@ -321,54 +321,264 @@
his.
-model = new instance.web.Model('stock.packages
+packages = new instance.web.Model('stock.packages');%0A this.users = new instance.web.Model('res.users');%0A this.package_types = new instance.web.Model('shipping.package.type');%0A this.sales = new instance.web.Model('sale.order
');%0A
@@ -964,18 +964,11 @@
his.
-connection
+rpc
.rpc
@@ -1893,29 +1893,32 @@
return this.
-model
+packages
.call(%22creat
@@ -2241,26 +2241,28 @@
nction (
-package_id
+sale_id, pkg
, test)
@@ -2275,29 +2275,29 @@
var
-param
+kwarg
s = %7B%7D;%0A%0A
@@ -2339,37 +2339,37 @@
-param
+kwarg
s%5B'test'%5D = test
@@ -2400,37 +2400,40 @@
return this.
-model
+packages
.call('get_quote
@@ -2437,34 +2437,36 @@
otes', %5B
-package_id%5D, param
+sale_id, pkg%5D, kwarg
s);%0A
@@ -2758,37 +2758,40 @@
return this.
-model
+packages
.call('get_label
@@ -2956,13 +2956,16 @@
his.
-model
+packages
.cal
@@ -3000,16 +3000,795 @@
Date%5D);%0A
+ %7D,%0A%0A get_usps_account: function (test) %7B%0A kwargs = %7B%7D%0A if (typeof (test) !== %22undefined%22) %7B%0A kwargs = %7Btest: Boolean(test)%7D%0A %7D%0A return this.users.call('account_status', %5B%5D, kwargs);%0A %7D,%0A%0A get_package_types: function () %7B%0A return this.package_types.query(%5B'code', 'length', 'width', 'height'%5D).all();%0A %7D,%0A%0A get_sale_order: function (code) %7B%0A return this.sales.query(%5B'id', 'name'%5D).filter(%5B%5B'name', '=', code%5D%5D).all();%0A %7D,%0A%0A get_quickship_id: function (user_id) %7B%0A kwargs = %7B%7D%0A if (user_id) %7B%0A kwargs%5B%22user_id%22%5D = user_id;%0A %7D%0A return this.users.call('get_quickship_id', %5B%5D, kwargs);%0A
|
cfbbcca161e189020f8793580c07286acea7701b
|
update export interface
|
entries.js
|
entries.js
|
/**
* @file entries.js
* @author Y3G
* @fileoverview
* 接口文件
*/
'use strict';
var check = require('./src/check');
var makePolicy = require('./policy');
var exportModule = check.check;
exportModule.Checker = check.Checker;
exportModule.NotChecker = check.NotChecker;
exportModule.policy = makePolicy(check.Checker.prototype, ['not', 'owner']);
module.exports = exportModule;
|
JavaScript
| 0 |
@@ -151,16 +151,20 @@
uire('./
+src/
policy')
|
f9d4ec32ffa36353fc97b5f47c60de8e81f70c43
|
add webpack notifier
|
src/ui/axis-chart/demo/webpack.config.js
|
src/ui/axis-chart/demo/webpack.config.js
|
'use strict';
var path = require('path');
var autoprefixer = require('autoprefixer');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: './app',
output: {
path: __dirname,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: 'node-modules/',
loaders: ['babel', __dirname + '/html-pre-tag-loader']
},
{
test: /\.css$/,
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader'
},
]
},
postcss: [autoprefixer],
resolve: {
extensions: ['', '.js', '.jsx']
},
stats: false,
progress: true
};
|
JavaScript
| 0.000001 |
@@ -79,16 +79,73 @@
fixer');
+%0Avar WebpackNotifierPlugin = require('webpack-notifier');
%0A%0Amodule
@@ -286,16 +286,86 @@
s'%0A %7D,%0A
+ plugins: %5B%0A new WebpackNotifierPlugin(%7BalwaysNotify: true%7D)%0A %5D,%0A
module
|
802d9741358d48cc20eab3d03e150943f92d823c
|
Update lib.js
|
static/js/lib.js
|
static/js/lib.js
|
/**
* JSON config file
* TODO(cripplet): move to external defaults.json file
*/
var name = "Minke Zhang";
var email = "[email protected]";
var username = "cripplet-db";
var password = "6f920f50f5c81308ee0" + "aad463a40ac83b4cd5b16";
var repo = "db";
var getEndpoint = function(path) {
return "https://api.github.com/repos/" + username + "/" + repo + "/contents/" + path;
};
var getMockPath = function() {
return (Math.random().toString(36)+'00000000000000000').slice(2, 16+2)
};
var getFile = function(path, el_status, el_debug, el_data) {
$.ajax({
type: "GET",
url: getEndpoint(path),
dataType: "json",
contentType: "application/json",
success: function(resp) {
el_status.text("success");
el_debug.text(JSON.stringify(resp));
el_data.text(atob(resp.content));
},
error: function(req) {
el_status.text("failure");
el_debug.text(JSON.stringify(req));
}
});
}
var addFile = function(path, content, el_status, el_debug, el_data) {
path = getMockPath();
var payload = {
"path": path,
"message": "added " + path,
"committer": {
"name": name,
"email": email
},
"content": btoa(content)
}
$.ajax({
type: "PUT", // not POST for some reason
url: getEndpoint(path),
dataType: "json",
contentType: "application/json",
xhrFields: { withCredentials: false },
headers: { 'Authorization': "Basic " + btoa(username + ":" + password) },
data: JSON.stringify(payload),
success: function(resp) {
el_status.text("success");
el_debug.text(JSON.stringify(resp));
},
error: function(req) {
el_status.text("failure");
el_debug.text(JSON.stringify(req));
}
});
};
|
JavaScript
| 0.000001 |
@@ -1601,24 +1601,63 @@
ify(resp));%0A
+ el_data.text(resp.content.name);%0A
%7D,%0A e
|
c9ede0ddca46ffc213ba35ea9870b11d59d8f88d
|
Update master
|
example.js
|
example.js
|
document.addEventListener("DOMContentLoaded", function() {
var header = document.create("h1").addClass(["first", "head"]).plaintext("Header text");
var paraElem = document.create("p").attr({"id" : "para", "align" : "center"}).data("id", "smth").css("marginTop", "12px");
document.body.append([header, paraElem]);
}, false);
|
JavaScript
| 0 |
@@ -52,17 +52,20 @@
ion() %7B%0A
-%09
+
var head
@@ -145,17 +145,20 @@
text%22);%0A
-%09
+
var para
@@ -274,12 +274,46 @@
px%22)
-;%0A%0A%09
+.html(%22%3Cspan%3Esome text%3C/span%3E%22);%0A%0A
docu
|
fd350c428f1475be73a944bd2bf9537843228d76
|
remove sockjs calls
|
ui/config/webpackDevServer.config.js
|
ui/config/webpackDevServer.config.js
|
/* eslint-disable */
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const path = require('path');
const config = require('./webpack.config.dev');
const paths = require('./paths');
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const host = process.env.HOST || '0.0.0.0';
module.exports = function(proxy, allowedHost) {
return {
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
// websites from potentially accessing local content through DNS rebinding:
// https://github.com/webpack/webpack-dev-server/issues/887
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
// However, it made several existing use cases such as development in cloud
// environment or subdomains in development significantly more complicated:
// https://github.com/facebookincubator/create-react-app/issues/2271
// https://github.com/facebookincubator/create-react-app/issues/2233
// While we're investigating better solutions, for now we will take a
// compromise. Since our WDS configuration only serves files in the `public`
// folder we won't consider accessing them a vulnerability. However, if you
// use the `proxy` feature, it gets more dangerous because it can expose
// remote code execution vulnerabilities in backends like Django and Rails.
// So we will disable the host check normally, but enable it if you have
// specified the `proxy` setting. Finally, we let you override it if you
// really know what you're doing with a special environment variable.
disableHostCheck:
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
// Enable gzip compression of generated files.
compress: true,
// Silence WebpackDevServer's own logs since they're generally not useful.
// It will still show compile warnings and errors with this setting.
clientLogLevel: 'none',
// By default WebpackDevServer serves physical files from current directory
// in addition to all the virtual build products that it serves from memory.
// This is confusing because those files won’t automatically be available in
// production build folder unless we copy them. However, copying the whole
// project directory is dangerous because we may expose sensitive files.
// Instead, we establish a convention that only files in `public` directory
// get served. Our build script will copy `public` into the `build` folder.
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
// Note that we only recommend to use `public` folder as an escape hatch
// for files like `favicon.ico`, `manifest.json`, and libraries that are
// for some reason broken when imported through Webpack. If you just want to
// use an image, put it in `src` and `import` it from JavaScript instead.
contentBase: paths.appPublic,
// By default files from `contentBase` will not trigger a page reload.
watchContentBase: true,
// Enable hot reloading server. It will provide /sockjs-node/ endpoint
// for the WebpackDevServer client so it can learn when the files were
// updated. The WebpackDevServer client is included as an entry point
// in the Webpack development configuration. Note that only changes
// to CSS are currently hot reloaded. JS changes will refresh the browser.
hot: true,
// It is important to tell WebpackDevServer to use the same "root" path
// as we specified in the config. In development, we always serve from /.
publicPath: config.output.publicPath,
// WebpackDevServer is noisy by default so we emit custom message instead
// by listening to the compiler events with `compiler.plugin` calls above.
quiet: true,
proxy: [
{
context: ['/', '/api', '/media', '/project', '/login', '/logout', '/static', '/xstatic'],
target: 'http://localhost:8000',
secure: true,
},
],
// Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebookincubator/create-react-app/issues/293
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebookincubator/create-react-app/issues/1065
watchOptions: {
ignored: new RegExp(
`^(?!${path
.normalize(paths.appSrc + '/')
.replace(/[\\]+/g, '\\\\')}).+[\\\\/]node_modules[\\\\/]`,
'g'
),
},
// Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === 'https',
host: host,
overlay: false,
historyApiFallback: {
// Paths with dots should still use the history fallback.
// See https://github.com/facebookincubator/create-react-app/issues/387.
disableDotRule: true,
},
public: allowedHost,
before(app) {
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
},
};
};
|
JavaScript
| 0.000001 |
@@ -5068,33 +5068,8 @@
%7D,%0A
- public: allowedHost,%0A
|
1a50bf32f64a3677d46d58308e0489c9c40f5299
|
Clean up statsd config a bit; increase flush rate for more fun in dev
|
statsd/config.js
|
statsd/config.js
|
(function () {
"use strict";
return {
"debug": true,
"backends": ["./backends/repeater", "./backends/console"],
"repeater": [ { "host": "statsd-sink", "port": 8125 } ],
//"repeaterProtocol": "tcp" // Default: "udp4"
"repeaterProtocol": "upd4"
};
})();
|
JavaScript
| 0 |
@@ -39,16 +39,171 @@
eturn %7B%0A
+ // Production configuration%0A //%22backends%22: %5B%22./backends/repeater%22%5D,%0A //%22flushInterval%22: 10000,%0A%0A // Development configuration%0A
@@ -280,24 +280,56 @@
/console%22%5D,%0A
+ %22flushInterval%22: 1000,%0A%0A
%22rep
@@ -385,64 +385,8 @@
%5D,%0A
- //%22repeaterProtocol%22: %22tcp%22 // Default: %22udp4%22%0A
|
388b0492640fd0e5176de14d4575ff1ac6386975
|
Fix pledge override not used for refresh rates
|
src/structs/db/Patron.js
|
src/structs/db/Patron.js
|
const path = require('path')
const Base = require('./Base.js')
const PatronModel = require('../../models/Patron.js')
const getConfig = require('../../config.js').get
class Patron extends Base {
constructor (data, _saved) {
super(data, _saved)
// _id is patron member ID
if (!this._id) {
throw new TypeError('_id is undefined')
}
/**
* @type {string}
*/
this.status = this.getField('status')
/**
* @type {string}
*/
this.lastCharge = this.getField('lastCharge')
/**
* @type {number}
*/
this.pledgeLifetime = this.getField('pledgeLifetime')
if (this.pledgeLifetime === undefined) {
throw new TypeError('pledgeLifetime is undefined')
}
/**
* @type {number}
*/
this.pledge = this.getField('pledge')
if (this.pledge === undefined) {
throw new TypeError('pledge is undefined')
}
/**
* Due to Patreon's unmaintained API, some people who paid 5 USD in a different currency such
* as 4.5 euros will not receive the 5 USD benefits since Patreon reports the pldge as 4.5.
*
* This is a temporary measure until payments are moved off of Patreon.
*
* @type {number|undefined}
*/
this.pledgeOverride = this.getField('pledgeOverride')
/**
* @type {string}
*/
this.discord = this.getField('discord')
/**
* @type {string}
*/
this.name = this.getField('name')
/**
* @type {string}
*/
this.email = this.getField('email')
}
static get SLOW_THRESHOLD () {
return 500
}
static async refresh () {
const filePath = path.join(path.resolve(), 'settings', 'api.js')
return require(filePath)()
}
toObject () {
return {
_id: this._id,
status: this.status,
lastCharge: this.lastCharge,
pledgeLifetime: this.pledgeLifetime,
pledge: this.pledge,
discord: this.discord,
name: this.name,
email: this.email
}
}
/**
* @returns {boolean}
*/
isActive () {
const active = this.status === Patron.STATUS.ACTIVE
if (active) {
return true
}
const declined = this.status === Patron.STATUS.DECLINED
if (!declined || !this.lastCharge) {
return false
}
const now = new Date(new Date().toUTCString())
const last = new Date(this.lastCharge)
const diffTime = Math.abs(last - now)
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))
return diffDays < 4
}
/**
* @returns {number}
*/
determineMaxFeeds () {
const config = getConfig()
if (!this.isActive()) {
return config.feeds.max
}
const pledge = this.pledgeOverride || this.pledge
if (pledge >= 2000) {
return 140
}
if (pledge >= 1500) {
return 105
}
if (pledge >= 1000) {
return 70
}
if (pledge >= 500) {
return 35
}
if (pledge >= 250) {
return 15
}
return config.feeds.max
}
/**
* @returns {number}
*/
determineMaxGuilds () {
if (!this.isActive()) {
return 1
}
if (this.pledgeLifetime >= 2500) {
return 4
}
if (this.pledgeLifetime >= 1500) {
return 3
}
if (this.pledgeLifetime >= 500) {
return 2
}
return 1
}
/**
* @returns {number}
*/
determineWebhook () {
if (!this.isActive()) {
return false
} else {
return this.pledge >= 100
}
}
static get STATUS () {
return {
ACTIVE: 'active_patron',
FORMER: 'former_patron',
DECLINED: 'declined_patron'
}
}
static get Model () {
return PatronModel.Model
}
}
module.exports = Patron
|
JavaScript
| 0 |
@@ -728,181 +728,8 @@
%7D%0A%0A
- /**%0A * @type %7Bnumber%7D%0A */%0A this.pledge = this.getField('pledge')%0A if (this.pledge === undefined) %7B%0A throw new TypeError('pledge is undefined')%0A %7D%0A%0A
@@ -1111,24 +1111,220 @@
Override')%0A%0A
+ /**%0A * @type %7Bnumber%7D%0A */%0A this.pledge = this.pledgeOverride %7C%7C this.getField('pledge')%0A if (this.pledge === undefined) %7B%0A throw new TypeError('pledge is undefined')%0A %7D%0A%0A
/**%0A
@@ -2688,39 +2688,16 @@
pledge =
- this.pledgeOverride %7C%7C
this.pl
|
3ae6daf894e65ea261aeb8e46bc41c7e7cc83162
|
make font size responsive
|
src/templates/default.js
|
src/templates/default.js
|
import React from 'react';
import PageSection from '~/components/page-section';
import Typography from '~/components/typography';
import Heading from '~/components/heading';
import { Box, Flex } from 'rebass';
import { Navigation, NavigationItem, NavigationLink } from '~/components/navigation';
import styled from 'styled-components';
import {responsiveStyle, width} from 'styled-system';
import { lighten, darken } from 'polished';
const Tiles = styled.div`
display:flex;
justify-content: stretch;
align-content: space-between;
flex-wrap:wrap;
background-color: ${( ({theme}) => theme.colors.secondaryAccent) };
`;
const Tile = styled.div`
${width};
background-color: ${ ({theme, number}) => number % 2 === 0 || (number / 4) % 2 !== 0 ? lighten(0.2, theme.colors.primary) : lighten(0.1, theme.colors.secondary) };
border-bottom:solid 1px ${ ({theme}) => lighten(0.1, theme.colors.primary)};
border-right:solid 1px ${ ({theme}) => lighten(0.1, theme.colors.primary)};
line-height:10vw;
&:hover{
border-bottom: solid 1px ${({theme}) => lighten(0.1, theme.colors.primaryAccent)};
transition: all 0.2s;
a {
background-color: ${ ({theme}) => theme.colors.primaryAccent };
transition: all 0.2s;
}
}
a {
font-size: 0.9em;
width:100%;
height:100%;
}
a:visited, a:link {
color: #FFF;
}
`;
const Separator = styled.div`
background-color: ${ ({theme, bg}) => bg ? theme.colors[bg] : theme.colors.primary };
color: ${ ({theme}) => darken(0.25, theme.colors.primary) };
height:2em;
line-height:2em;
text-align:center;
font-size:1.3em;
`
const ServiceRoute = ({data}) =>{
let { related, item } = data;
let { html, frontmatter } = item;
let image = frontmatter.image ? (<img style={{ maxWidth: "100%" }} src={frontmatter.image}></img>) : null;
var relatedLinks = related ? related.edges.map( ({node}, index) => (
<Tile key={ `tl${node.fields.slug}`} number={index} width={[1, 1/2, 1/4]}>
<NavigationLink to={node.fields.slug}>{node.frontmatter.title}</NavigationLink>
</Tile>
)) : null;
var other = related ? [ <Separator key="lookingforsomethingelse">Looking for something else?</Separator>, <Tiles key="tiles">{relatedLinks}</Tiles> ] : [];
return (
<Box>
<PageSection bg="light">
<Heading>{frontmatter.title}</Heading>
{image}
<Box dangerouslySetInnerHTML={{ __html: html }}></Box>
</PageSection>
{other}
<Separator bg="secondaryAccent" />
</Box>
)
}
export default ServiceRoute;
export const pageQuery = graphql`
query PageByCategory($slug: String!, $area: String!){
item: markdownRemark(fields: { slug: { eq: $slug }}){
html
frontmatter{
title,
image
}
},
related: allMarkdownRemark(
filter:{
fields: {
area: { eq: $area },
slug: { ne : $slug }
}
}
sort: { fields: [frontmatter___date], order: DESC }
){
edges{
node{
id
fields{
area,
slug
}
frontmatter{
title
}
}
}
}
}
`
|
JavaScript
| 0.000001 |
@@ -1023,16 +1023,67 @@
ht:10vw;
+%0A $%7B responsiveStyle('font-size', 'fontSize') %7D;
%0A%0A &:
@@ -2125,16 +2125,60 @@
2, 1/4%5D%7D
+ fontSize=%7B%5B%221em%22, %221em%22, %221.3em%22, %221.5em%22%5D%7D
%3E%0A
|
defaed8e8f5ed4ace2cdc8e87c9011219ac93b6e
|
Update DEV.js
|
config/env/DEV.js
|
config/env/DEV.js
|
let oxygen = {
WWW_PORT: process.env.OXYGEN_WWW_PORT || process.env.PORT || 8080,
SEARCHER_MQ_NAME: 'searcher',
CRAWLER_MQ_NAME: 'crawler',
PARSER_MQ_NAME: 'parser'
}
let mongo = {
host: process.env.MONGO_HOST || '127.0.0.1',
port: process.env.MONGO_PORT || 27017,
usr: process.env.MONGO_USR || 'mongo',
pwd: process.env.MONGO_PWD || 'mongo',
masterDB: process.env.MONGO_DB || 'oxygen'
};
//@ TODO use mongo username & password in constructing the URL if given
mongo['mongoURL'] = ('mongodb://' + mongo.host + ':' + mongo.port + '/' + mongo.masterDB);
let neo4j = {
host: process.env.NE04J_HOST || '127.0.0.1',
http: process.env.NEO4J_HTTP_PORT || 7474,
bolt: process.env.NEO4J_BOLT_PORT || 7687,
usr: process.env.NEO4J_USR || 'neo4j',
pwd: process.env.NEO4J_PWD || 'Pappu14.'
};
//@ TODO use neo4j username & password in constructing the URL if given
neo4j['neo4jURL'] = ('bolt://' + neo4j.host + ':' + neo4j.bolt);
neo4j['neo4jHTTPURL'] = ('http://' + neo4j.host + ':' + neo4j.http);
let redis = {
host: process.env.REDIS_HOST || '127.0.0.1',
port: process.env.REDIS_PORT || 6379
}
// redis['redisURL'] = ('redis://user:password@host:port/db-number');
let rabbitMQ = {
host: process.env.RABBITMQ_HOST || '127.0.0.1',
port: process.env.RABBITMQ_PORT || 5672
};
rabbitMQ['rabbitmqURL'] = ('amqp://' + rabbitMQ.host + ':' + rabbitMQ.port);
let config = {
OXYGEN: oxygen,
MONGO: mongo,
NEO4J: neo4j,
REDIS: redis,
RABBITMQ: rabbitMQ,
NO_OF_RESULTS: 5,
CACHE_EXPIRY_TIME: 120
};
module.exports = config;
|
JavaScript
| 0.000001 |
@@ -807,16 +807,16 @@
%7C%7C '
-Pappu14.
+password
'%0D%0A%7D
|
71adbe330e85041a306080d705150757beef033a
|
Refactor IVoiceChannel.join
|
lib/interfaces/IVoiceChannel.js
|
lib/interfaces/IVoiceChannel.js
|
"use strict";
const Utils = require("../core/Utils");
const User = require("../models/User");
const IChannel = require("./IChannel");
/**
* @interface
* @model Channel
* @extends IChannel
*/
class IVoiceChannel extends IChannel {
constructor(discordie, channelId) {
super(discordie, channelId);
}
/**
* Creates an array of members joined in this voice channels.
* @returns {Array<IGuildMember>}
* @readonly
*/
get members() {
return this._discordie.Users.membersInVoiceChannel(this);
}
/**
* Checks whether current user is in this voice channel.
* @returns {boolean}
* @readonly
*/
get joined() {
return !!this.getVoiceConnectionInfo();
}
/**
* Joins this voice channel.
* Creates a new voice connection if there are no active connections for
* this channels' guild.
*
* Note: One account can be only in one channel per guild.
* Promise will resolve instantly and contain the same instance
* if connection to the server is already established.
*
* If there is a pending connection for the guild this channel belongs to,
* it will return the same promise.
*
* Checks permissions locally and returns a rejected promise with
* `Error` "Missing permission" if `Voice.CONNECT` permission is denied.
*
* Returns a rejected promise with `Error` "Channel does not exist" if
* guild is unavailable or channel does not exist in cache.
* @param {boolean} [selfMute]
* @param {boolean} [selfDeaf]
* @returns {Promise<VoiceConnectionInfo, Error|Number>}
*/
join(selfMute, selfDeaf) {
if (!this._valid)
return Promise.reject(new Error("Channel does not exist"));
// check permissions locally
// since server silently drops invalid voice state updates
if (!this.joined) {
const permissions = this._discordie.User.permissionsFor(this);
if (!permissions.Voice.CONNECT)
return Promise.reject(new Error("Missing permission"));
}
const argsArray = [].slice.call(arguments);
const args = [this.guild_id, this._channelId].concat(argsArray);
const vc = this._discordie.VoiceConnections;
return vc._getOrCreate.apply(vc, args);
}
/**
* Leaves this voice channel if joined.
*/
leave() {
const info = this.getVoiceConnectionInfo();
if (info) info.voiceConnection.disconnect();
}
/**
* Retrieves `VoiceConnectionInfo` for this voice channel.
* @returns {VoiceConnectionInfo|null}
*/
getVoiceConnectionInfo() {
return this._discordie.VoiceConnections.getForChannel(this._channelId);
}
}
module.exports = IVoiceChannel;
|
JavaScript
| 0 |
@@ -1992,125 +1992,8 @@
%7D%0A%0A
- const argsArray = %5B%5D.slice.call(arguments);%0A const args = %5Bthis.guild_id, this._channelId%5D.concat(argsArray);%0A
@@ -2067,23 +2067,59 @@
eate
-.apply(vc, args
+(this.guild_id, this._channelId, selfMute, selfDeaf
);%0A
|
cf977bb132af00a8ac7c2053d0a1d161c48d9783
|
Add hint for IE11 workaround.
|
src/extras/core/Font.js
|
src/extras/core/Font.js
|
/**
* @author zz85 / http://www.lab4games.net/zz85/blog
* @author mrdoob / http://mrdoob.com/
*/
import { ShapePath } from './ShapePath.js';
function Font( data ) {
this.type = 'Font';
this.data = data;
}
Object.assign( Font.prototype, {
isFont: true,
generateShapes: function ( text, size ) {
if ( size === undefined ) size = 100;
var shapes = [];
var paths = createPaths( text, size, this.data );
for ( var p = 0, pl = paths.length; p < pl; p ++ ) {
Array.prototype.push.apply( shapes, paths[ p ].toShapes() );
}
return shapes;
}
} );
function createPaths( text, size, data ) {
var chars = Array.from ? Array.from( text ) : String( text ).split( '' ); // see #13988
var scale = size / data.resolution;
var line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;
var paths = [];
var offsetX = 0, offsetY = 0;
for ( var i = 0; i < chars.length; i ++ ) {
var char = chars[ i ];
if ( char === '\n' ) {
offsetX = 0;
offsetY -= line_height;
} else {
var ret = createPath( char, scale, offsetX, offsetY, data );
offsetX += ret.offsetX;
paths.push( ret.path );
}
}
return paths;
}
function createPath( char, scale, offsetX, offsetY, data ) {
var glyph = data.glyphs[ char ] || data.glyphs[ '?' ];
if ( ! glyph ) {
console.error( 'THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.' );
return;
}
var path = new ShapePath();
var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
if ( glyph.o ) {
var outline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );
for ( var i = 0, l = outline.length; i < l; ) {
var action = outline[ i ++ ];
switch ( action ) {
case 'm': // moveTo
x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale + offsetY;
path.moveTo( x, y );
break;
case 'l': // lineTo
x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale + offsetY;
path.lineTo( x, y );
break;
case 'q': // quadraticCurveTo
cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale + offsetY;
path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
break;
case 'b': // bezierCurveTo
cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale + offsetY;
cpx2 = outline[ i ++ ] * scale + offsetX;
cpy2 = outline[ i ++ ] * scale + offsetY;
path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
break;
}
}
}
return { offsetX: glyph.ha * scale, path: path };
}
export { Font };
|
JavaScript
| 0 |
@@ -692,16 +692,37 @@
'' ); //
+ workaround for IE11,
see #13
|
db1f5c3985ae6410e246eb6a2c6ab44703c245e4
|
Make halftone default to a black background instead of a transparent one
|
src/filters/halftone.js
|
src/filters/halftone.js
|
// @flow
import { PALETTE, RANGE, STRING, BOOL } from "constants/controlTypes";
import { nearest } from "palettes";
import { cloneCanvas, getBufferIndex, rgba } from "utils";
import type { Palette } from "types";
export const optionTypes = {
size: { type: RANGE, range: [0, Infinity], default: 6 }, // diameter of input
sizeMultiplier: { type: RANGE, range: [0, 5], step: 0.1, default: 1 }, // diameter of output
offset: { type: RANGE, range: [0, 3], step: 0.1, default: 0.3 },
levels: { type: RANGE, range: [0, 255], default: 32 }, // no. of circle sizes
palette: { type: PALETTE, default: nearest },
squareDots: { type: BOOL, default: false },
background: { type: STRING, default: "transparent" }
};
export const defaults = {
size: optionTypes.size.default,
sizeMultiplier: optionTypes.sizeMultiplier.default,
offset: optionTypes.offset.default,
levels: optionTypes.levels.default,
palette: { ...optionTypes.palette.default, options: { levels: 8 } },
squareDots: optionTypes.squareDots.default,
background: optionTypes.background.default
};
const halftone = (
input: HTMLCanvasElement,
options: {
size: number,
sizeMultiplier: number,
offset: number,
levels: number,
palette: Palette,
squareDots: boolean,
background: string
} = defaults
): HTMLCanvasElement => {
const getOffset = (
radians: number,
radius: number,
x0: number,
y0: number
) => {
const x = x0 + radius * Math.cos(radians);
const y = y0 + radius * Math.sin(radians);
return [x, y];
};
const { background, palette } = options;
const size = parseInt(options.size, 10);
const output = cloneCanvas(input, false);
const inputCtx = input.getContext("2d");
const outputCtx = output.getContext("2d");
if (!inputCtx || !outputCtx) {
return input;
}
outputCtx.globalCompositeOperation = "screen";
if (typeof background === "string") {
outputCtx.fillStyle = background;
outputCtx.fillRect(0, 0, output.width, output.height);
}
const buf = inputCtx.getImageData(0, 0, input.width, input.height).data;
// TODO: handle edges
for (let x = 0; x < input.width; x += size) {
for (let y = 0; y < input.height; y += size) {
const meanColor = rgba(0, 0, 0, 0);
const pixels = size * size;
for (let w = 0; w < size; w += 1) {
for (let h = 0; h < size; h += 1) {
const sourceIdx = getBufferIndex(x + w, y + h, output.width);
for (let c = 0; c < 4; c += 1) {
meanColor[c] += buf[sourceIdx + c] / pixels;
}
}
}
// FIXME: this is wrong(?), should apply nearest here and palette later in colors
// rgba(255, 0, 0) should be matched to red?
const quantizedColor = palette.getColor(meanColor, palette.options);
const radii = quantizedColor.map(
c => c * (size / 2 / 255) * options.sizeMultiplier
);
const colors = [
`rgba(255, 0, 0, ${meanColor[3] / 255}`,
`rgba(0, 255, 0, ${meanColor[3] / 255}`,
`rgba(0, 0, 255, ${meanColor[3] / 255}`
];
const centerX = x + size / 2;
const centerY = y + size / 2;
const offsetDistance = size * options.offset;
const centers = [
getOffset(2 * Math.PI / 3, offsetDistance, centerX, centerY),
getOffset(2 * 2 * Math.PI / 3, offsetDistance, centerX, centerY),
getOffset(2 * Math.PI, offsetDistance, centerX, centerY)
];
for (let c = 0; c < 3; c += 1) {
if (options.squareDots) {
outputCtx.fillStyle = colors[c];
outputCtx.fillRect(centers[c][0], centers[c][1], radii[c], radii[c]);
} else {
// Circle
outputCtx.beginPath();
outputCtx.arc(centers[c][0], centers[c][1], radii[c], 0, Math.PI * 2);
outputCtx.fillStyle = colors[c];
outputCtx.fill();
}
}
}
}
outputCtx.globalCompositeOperation = "source-over";
return output;
};
export default {
name: "Halftone",
func: halftone,
options: defaults,
optionTypes,
defaults
};
|
JavaScript
| 0.000098 |
@@ -698,19 +698,13 @@
t: %22
-transparent
+black
%22 %7D%0A
|
07fec32754cef2695a24647b21b8a12791c12b9f
|
Tweak standalone REPL prompt
|
repl_cell.js
|
repl_cell.js
|
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* 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 Ajax.org B.V. 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 AJAX.ORG B.V. 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.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var Anchor = require("ace/anchor").Anchor;
var Range = require("ace/range").Range;
var comparePoints = Range.comparePoints;
var lang = require("ace/lib/lang");
var ReplCell = function(options, session) {
this.session = session;
this.type = options.type;
};
(function() {
this.insert = function(pos, text) {
if (typeof pos == "string") {
text = pos;
pos = this.getRange().end;
}
this.session.insert(pos, text);
};
this.setPlaceholder = function(str) {
this.placeholder = str;
};
this.setMode = function() {
};
this.setWaiting = function(val) {
this.waiting = val;
this.session.repl.$updateSession();
};
this.prompt = "";
this.promptType = null;
this.setPrompt = function(str, type) {
if (this.prompt == str)
return;
this.promptType = type;
this.prompt = (str || "") + " ";
this.session.maxPromptLength = Math.max(this.session.maxPromptLength||0, this.prompt.length);
};
this.setValue = function(val, selection) {
if (!this.session)
return;
if (val == null)
return this.remove();
if (this.lineWidget && val.trim())
this.removeWidget();
this.$updateRange();
var pos = this.session.doc.replace(this.range, val);
this.range.setEnd(pos);
if (selection == 1)
this.session.selection.setRange({start: this.range.end, end: this.range.end});
else if (selection == -1)
this.session.selection.setRange({start: this.range.start, end: this.range.start});
};
this.getValue = function() {
if (!this.session)
return "";
return this.session.doc.getTextRange(this.range);
};
this.getRange = function() {
this.$updateRange();
return this.range;
};
this.$updateRange = function(row) {
var cells = this.session.replCells;
if (row == null)
row = cells.indexOf(this);
for (i = row; i > 0; i--) {
if (cells[i])
break;
}
var cell = cells[i];
if (!cell)
return;
cell.row = i;
for (var i = row+1; i < this.session.getLength(); i++) {
if (cells[i])
break;
}
cell.endRow = i-1;
cell.range = new Range(cell.row, 0, cell.endRow, Number.MAX_VALUE);
return this.range;
};
this.removeWidget = function() {
if (this.lineWidget) {
var w = this.lineWidget;
this.lineWidget = null;
this.session.repl.removeLineWidget(w);
}
};
this.addWidget = function(options) {
if (this.lineWidget)
this.removeWidget();
this.setValue("");
options.row = this.range.end.row;
this.lineWidget = options;
this.session.repl.addLineWidget(this.lineWidget);
};
this.destroy = function() {
this.removeWidget();
this.session = null;
};
this.remove = function() {
if (this.session)
this.session.repl.removeCell(this);
};
}).call(ReplCell.prototype);
exports.ReplCell = ReplCell;
});
|
JavaScript
| 0 |
@@ -2681,16 +2681,17 @@
%22) + %22
+
%22;%0A
|
c5e5fe55db486f6e7b203c58a64d6aaa4604ef8d
|
Use QUOTAGUARDSTATIC_URL ENV variable
|
resolvers.js
|
resolvers.js
|
const fetch = require('node-fetch');
const util = require('util');
const parseXML = util.promisify(require('xml2js').parseString);
const {NotAuthorised, InvalidPostcode, IncorrectPostcode} = require('./errors');
const Posty = require('postcode');
var HttpsProxyAgent = require('https-proxy-agent');
let agent = null;
const {PROXY_URI} = process.env;
if (PROXY_URI) {
agent = new HttpsProxyAgent(PROXY_URI);
}
module.exports = {
Query: {
Pod: (_, {AccountCode, Reference, Postcode}) =>
fetch(
`http://www.tpeweb.co.uk/WebServices/Customer/PODTrackingData.asmx/GetTrackingRecord?AccountCode=${AccountCode}&Reference=${Reference}`,
{
agent
}
)
.then(res => res.text())
.then(xml => parseXML(xml, {trim: true, explicitArray: false}))
.then(data => JSON.parse(JSON.stringify(data['ArrayOfTrackingRecord']['TrackingRecord'])))
.then(data => {
if (data.Authorised.startsWith('Not')) {
throw new NotAuthorised();
}
const postyCode = new Posty(Postcode);
if (!postyCode.valid()) {
throw new InvalidPostcode();
}
if (data.DeliveryAddress.Postcode !== postyCode.normalise()) {
throw new IncorrectPostcode();
}
const movements = data.MovementInformation.Movement;
const scans = data.ScanInformation.Scan;
return {
...data,
MovementInformation: [...movements],
TimedInformation: data.TimedInformation.TimedDelivery,
ScanInformation: [...scans]
};
})
}
};
|
JavaScript
| 0 |
@@ -318,25 +318,36 @@
%0Aconst %7B
-PROXY_URI
+QUOTAGUARDSTATIC_URL
%7D = proc
@@ -360,25 +360,36 @@
v;%0A%0Aif (
-PROXY_URI
+QUOTAGUARDSTATIC_URL
) %7B%0A ag
@@ -418,17 +418,28 @@
ent(
-PROXY_URI
+QUOTAGUARDSTATIC_URL
);%0A%7D
|
e1134086a32c0f491fc79a82099b6ded9b4faf6e
|
Apply BackgroundImage fix for FeaturedTile
|
src/tile/FeaturedTile.js
|
src/tile/FeaturedTile.js
|
import PropTypes from 'prop-types';
import React from 'react';
import {
TouchableOpacity,
Text as NativeText,
View,
Image,
StyleSheet,
Dimensions,
} from 'react-native';
import Text from '../text/Text';
import Icon from '../icons/Icon';
import ViewPropTypes from '../config/ViewPropTypes';
const FeaturedTile = props => {
const {
title,
icon,
caption,
imageSrc,
containerStyle,
imageContainerStyle,
overlayContainerStyle,
iconContainerStyle,
titleStyle,
captionStyle,
...attributes
} = props;
let { width, height } = props;
if (!width) {
width = Dimensions.get('window').width;
}
if (!height) {
height = width * 0.8;
}
const styles = StyleSheet.create({
container: {
width,
height,
},
imageContainer: {
alignItems: 'center',
justifyContent: 'center',
resizeMode: 'cover',
backgroundColor: '#ffffff',
width,
height,
},
overlayContainer: {
flex: 1,
alignItems: 'center',
backgroundColor: 'rgba(0,0,0,0.2)',
alignSelf: 'stretch',
justifyContent: 'center',
paddingLeft: 25,
paddingRight: 25,
paddingTop: 45,
paddingBottom: 40,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
},
text: {
color: '#ffffff',
backgroundColor: 'rgba(0,0,0,0)',
marginBottom: 15,
textAlign: 'center',
},
iconContainer: {
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
},
});
return (
<TouchableOpacity
{...attributes}
style={[styles.container, containerStyle && containerStyle]}
>
<Image
source={imageSrc}
style={[
styles.imageContainer,
imageContainerStyle && imageContainerStyle,
]}
>
<View
style={[
styles.overlayContainer,
overlayContainerStyle && overlayContainerStyle,
]}
>
<View
style={[
styles.iconContainer,
iconContainerStyle && iconContainerStyle,
]}
>
{icon && <Icon {...icon} />}
</View>
<Text h4 style={[styles.text, titleStyle && titleStyle]}>
{title}
</Text>
<Text style={[styles.text, captionStyle && captionStyle]}>
{caption}
</Text>
</View>
</Image>
</TouchableOpacity>
);
};
FeaturedTile.propTypes = {
title: PropTypes.string,
icon: PropTypes.object,
caption: PropTypes.string,
imageSrc: Image.propTypes.source.isRequired,
onPress: PropTypes.func,
containerStyle: ViewPropTypes.style,
iconContainerStyle: ViewPropTypes.style,
imageContainerStyle: ViewPropTypes.style,
overlayContainerStyle: ViewPropTypes.style,
titleStyle: NativeText.propTypes.style,
captionStyle: NativeText.propTypes.style,
width: PropTypes.number,
height: PropTypes.number,
};
export default FeaturedTile;
|
JavaScript
| 0 |
@@ -119,17 +119,8 @@
ew,%0A
- Image,%0A
St
@@ -285,16 +285,73 @@
pTypes';
+%0Aimport BackgroundImage from '../config/BackgroundImage';
%0A%0Aconst
@@ -1758,16 +1758,26 @@
%0A %3C
+Background
Image%0A
@@ -2530,16 +2530,26 @@
%3C/
+Background
Image%3E%0A
@@ -2701,16 +2701,26 @@
ageSrc:
+Background
Image.pr
|
1edc5cd07d23e51065ebfb8c780090a8ea59c2f9
|
remove indexChanged event registration
|
src/ui/SolidityLocals.js
|
src/ui/SolidityLocals.js
|
'use strict'
var DropdownPanel = require('./DropdownPanel')
var localDecoder = require('../solidity/localDecoder')
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var yo = require('yo-yo')
class SolidityLocals {
constructor (_parent, _traceManager, internalTreeCall) {
this.parent = _parent
this.internalTreeCall = internalTreeCall
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
this.init()
this.view
}
render () {
this.view = yo`<div id='soliditylocals' >
<div id='warning'></div>
${this.basicPanel.render()}
</div>`
return this.view
}
init () {
this.parent.event.register('indexChanged', this, (index) => {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) {
warningDiv.innerHTML = 'invalid step index'
return
}
if (this.parent.currentStepIndex !== index) return
this.parent.event.register('sourceLocationChanged', this, (sourceLocation) => {
this.traceManager.waterfall([
this.traceManager.getStackAt,
this.traceManager.getMemoryAt],
index,
(error, result) => {
if (!error) {
var stack = result[0].value
var memory = result[1].value
try {
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory, sourceLocation)
this.basicPanel.update(locals)
} catch (e) {
warningDiv.innerHTML = e.message
}
}
})
})
})
}
}
module.exports = SolidityLocals
|
JavaScript
| 0 |
@@ -819,21 +819,30 @@
gister('
-index
+sourceLocation
Changed'
@@ -850,21 +850,30 @@
this, (
-index
+sourceLocation
) =%3E %7B%0A
@@ -966,253 +966,8 @@
''%0A
- if (index %3C 0) %7B%0A warningDiv.innerHTML = 'invalid step index'%0A return%0A %7D%0A%0A if (this.parent.currentStepIndex !== index) return%0A%0A this.parent.event.register('sourceLocationChanged', this, (sourceLocation) =%3E %7B%0A
@@ -998,18 +998,16 @@
rfall(%5B%0A
-
@@ -1040,26 +1040,24 @@
At,%0A
-
-
this.traceMa
@@ -1088,19 +1088,38 @@
- i
+this.parent.currentStepI
ndex,%0A
-
@@ -1153,18 +1153,16 @@
-
if (!err
@@ -1175,26 +1175,24 @@
-
-
var stack =
@@ -1199,34 +1199,32 @@
result%5B0%5D.value%0A
-
var
@@ -1240,34 +1240,32 @@
result%5B1%5D.value%0A
-
try
@@ -1276,26 +1276,24 @@
-
var locals =
@@ -1321,17 +1321,40 @@
yLocals(
-i
+this.parent.currentStepI
ndex, th
@@ -1415,26 +1415,24 @@
-
-
this.basicPa
@@ -1462,18 +1462,16 @@
-
%7D catch
@@ -1472,26 +1472,24 @@
catch (e) %7B%0A
-
@@ -1527,38 +1527,34 @@
age%0A
- %7D%0A
+%7D%0A
%7D%0A
@@ -1555,19 +1555,8 @@
%7D%0A
-
- %7D)%0A
|
58dd8c6517cc44f6b12e3d0302a0ab66af33cbf3
|
Fix render logic bug in the default Typeahead item components (could cause undefined to be returned inappropriately)
|
src/ui/typeahead/core.js
|
src/ui/typeahead/core.js
|
import React from 'react'
import _ from 'lodash'
import API from '../../api'
import {objectToQueryString} from '../../utils/query'
export default class Typeahead extends React.Component {
static propTypes = {
code: React.PropTypes.string,
disabled: React.PropTypes.bool,
placeholder: React.PropTypes.string,
defaultValue: React.PropTypes.string,
endpoint: React.PropTypes.string,
query: React.PropTypes.string,
extraQueries: React.PropTypes.object,
resultField: React.PropTypes.string,
client: React.PropTypes.function,
requestThrottle: React.PropTypes.number,
itemComponent: React.PropTypes.element,
listComponent: React.PropTypes.element
}
static defaultProps = {
onChange: _.noop,
onChooseResult: _.noop,
query: 'q',
extraQueries: {},
resultField: 'results',
requestThrottle: 500,
listComponent: TypeaheadResultList
}
constructor(props) {
super(props)
this.state = {
results: [],
searchValue: '',
isLoadingResults: false,
focused: false,
resultCursor: -1,
queryCounter: 0,
errorLoadingResults: false,
showResults: false
}
this.inputChangeHandler = _.throttle(this.onInputChange.bind(this), this.props.requestThrottle, { leading: false })
this.api = new API(props.client)
}
render() {
const { results, searchValue, isLoadingResults, showResults } = this.state
const { placeholder, itemComponent, onChooseResult } = this.props
let classes = ['typeahead']
classes.push((true) ? 'top' : 'bottom')
if (showResults && results.length > 0) {
classes.push('active')
}
const ListComponent = this.props.listComponent || TypeaheadResultList
return (
<div className={classes.join(' ')}>
<div className="ui input">
<input type="text"
ref="input"
value={searchValue}
{...this.attachInputCallbacks()}
placeholder={placeholder} />
</div>
{(() => {
if (isLoadingResults && _.isEmpty(results)) {
return <TypeaheadResultLoader />
}
else if (showResults && !_.isEmpty(results)) {
return <ListComponent results={results} onChooseResult={onChooseResult}
itemComponent={itemComponent} />
}
else if (showResults && searchValue.length >= 1) {
return <TypeaheadEmptyResult />
}
else {
// Show nothing
}
})()}
</div>
)
}
componentDidMount() {
const component = this
this.closeListener = e => {
if (e.target !== component.refs.input) {
component.hideResults()
}
}
document.addEventListener('click', this.closeListener)
}
componentWillUnmount() {
document.removeEventListener('click', this.closeListener)
}
attachInputCallbacks() {
return {
onFocus: () => {
this.setState({ focused: true, showResults: true })
},
onBlur: () => {
// this.setState({ focused: false })
},
onChange: (event) => {
this.setState({ searchValue: event.target.value, isLoadingResults: true })
this.inputChangeHandler()
}
}
}
onInputChange() {
const { searchValue, queryCounter } = this.state
const { endpoint, query, extraQueries, resultField } = this.props
if (_.isEmpty(searchValue)) {
this.setState({
queryCounter: this.state.queryCounter + 1,
isLoadingResults: false,
errorLoadingResults: false,
showResults: false,
results: []
})
return
}
const requestQueryString = objectToQueryString({ ...extraQueries, [query]: searchValue })
const queryId = queryCounter + 1
this.setState({ queryCounter: queryId, errorLoadingResults: false })
this.api.loadJSON(endpoint + requestQueryString)
.then(response => {
// Tracking the queryId ensures only the latest result is processed, in case multiple
// requests arrive out of order.
if (this.state.queryCounter == queryId) {
const newResults = resultField ? response[resultField] : response
this.setState({ results: newResults || [], isLoadingResults: false, showResults: true })
}
})
.catch(error => this.setState({ errorLoadingResults: true, showResults: true }))
}
clear() {
this.setState({
queryCounter: this.state.queryCounter + 1,
isLoadingResults: false,
errorLoadingResults: false,
results: [],
searchValue: '',
showResults: false
})
}
hideResults() {
this.setState({
showResults: false
})
}
}
export const TypeaheadResultLoader = props => {
return (
<div className="ui typeahead results">
<div className="ui text loader">Loading</div>
</div>
)
}
export const TypeaheadEmptyResult = props => {
return (
<div className="ui typeahead results">
<div className="empty">No Results</div>
</div>
)
}
export const TypeaheadDefaultResult = ({ onClick = _.noop, result }) => {
return (
<div className="item" onClick={onClick}>
<div className="title">{result.title || result.name || result.first_name
? `${result.first_name} ${result.last_name}`
: null || result.label || result.id}</div>
<div className="description">{result.description || result.details}</div>
</div>
)
}
export class TypeaheadResultList extends React.Component {
static propTypes = {
results: React.PropTypes.arrayOf(React.PropTypes.object),
itemComponent: React.PropTypes.element,
onChooseResult: React.PropTypes.func
}
static defaultProps = {
results: [],
itemComponent: TypeaheadDefaultResult,
onChooseResult: _.noop
}
render() {
const { results, itemComponent, onChooseResult } = this.props
const clickHandler = (r, e) => {
e.preventDefault()
e.stopPropagation()
onChooseResult(r)
}
return (
<div className="ui typeahead results">
{_.map(results,
result => React.createElement(itemComponent, { result, onClick: _.partial(clickHandler, result) }))}
</div>
)
}
}
|
JavaScript
| 0 |
@@ -5505,24 +5505,25 @@
ult.name %7C%7C
+(
result.first
@@ -5595,16 +5595,17 @@
: null
+)
%7C%7C resu
|
ff9432ad0a6654fc18103b80348a8fdd3f264e67
|
reset state after failure
|
src/util/pair-checker.js
|
src/util/pair-checker.js
|
// LICENSE : MIT
"use strict";
/**
* 「と」といったペアがちゃんと閉じられているかをチェックします
* @param {object} context
* @param {string} left
* @param {string} right
* @returns {object}
*/
import assert from "assert";
import {RuleHelper} from "textlint-rule-helper";
export function checkPair(context, { left, right }) {
assert(left);
assert(right);
let {Syntax, RuleError, report, getSource} = context;
let helper = new RuleHelper(context);
let isInParagraph = false;
let matchParentheses = [];
return {
[Syntax.Paragraph](node){
if (helper.isChildNode(node, [Syntax.BlockQuote])) {
return;
}
isInParagraph = true
},
[Syntax.Str](node){
if (!isInParagraph) {
return;
}
let text = getSource(node);
// left を探す
let index = text.indexOf(left);
if (index !== -1) {
matchParentheses.push({
node,
index
});
}
// right を探す
let pairIndex = text.indexOf(right, index + 1);
if (pairIndex !== -1) {
matchParentheses.pop();
}
},
[`${Syntax.Paragraph}:exit`](node){
isInParagraph = false;
// 全ての対が見つかったなら配列は空になる
if (matchParentheses.length === 0) {
return;
}
matchParentheses.forEach(({node, index}) => {
report(node, new RuleError(`${left}の対となる${right}が見つかりません。${left}${right}`, index));
});
}
};
}
|
JavaScript
| 0.000001 |
@@ -1608,32 +1608,94 @@
%7D);%0A
+ // clear state%0A matchParentheses = %5B%5D;%0A
%7D%0A %7D;
|
78ab3bb9ec8ca3fdcee673495f3e5fb1a1c25000
|
add check if window undefined before calculating uniqueId
|
src/utils/getUniqueId.js
|
src/utils/getUniqueId.js
|
/*
To prevent the SVGs masks being used with the same id
*/
const getUniqueId = () => {
const id = Math.random()
.toString(36)
.substring(2, 15);
return id;
};
export default getUniqueId;
|
JavaScript
| 0.000001 |
@@ -81,16 +81,62 @@
() =%3E %7B%0A
+%0A if(typeof window === 'undefined') return;%0A%0A
const
|
7b6aaecb9f438e691fcc90574318839ae3ad62d9
|
fix missing padding-right when overflow-y is scroll
|
src/utils/popup/index.js
|
src/utils/popup/index.js
|
import Vue from 'vue';
import merge from 'element-ui/src/utils/merge';
import PopupManager from 'element-ui/src/utils/popup/popup-manager';
import getScrollBarWidth from '../scrollbar-width';
let idSeed = 1;
const transitions = [];
const hookTransition = (transition) => {
if (transitions.indexOf(transition) !== -1) return;
const getVueInstance = (element) => {
let instance = element.__vue__;
if (!instance) {
const textNode = element.previousSibling;
if (textNode.__vue__) {
instance = textNode.__vue__;
}
}
return instance;
};
Vue.transition(transition, {
afterEnter(el) {
const instance = getVueInstance(el);
if (instance) {
instance.doAfterOpen && instance.doAfterOpen();
}
},
afterLeave(el) {
const instance = getVueInstance(el);
if (instance) {
instance.doAfterClose && instance.doAfterClose();
}
}
});
};
let scrollBarWidth;
const getDOM = function(dom) {
if (dom.nodeType === 3) {
dom = dom.nextElementSibling || dom.nextSibling;
getDOM(dom);
}
return dom;
};
export default {
model: {
prop: 'visible',
event: 'visible-change'
},
props: {
visible: {
type: Boolean,
default: false
},
transition: {
type: String,
default: ''
},
openDelay: {},
closeDelay: {},
zIndex: {},
modal: {
type: Boolean,
default: false
},
modalFade: {
type: Boolean,
default: true
},
modalClass: {},
modalAppendToBody: {
type: Boolean,
default: false
},
lockScroll: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: false
},
closeOnClickModal: {
type: Boolean,
default: false
}
},
created() {
if (this.transition) {
hookTransition(this.transition);
}
},
beforeMount() {
this._popupId = 'popup-' + idSeed++;
PopupManager.register(this._popupId, this);
},
beforeDestroy() {
PopupManager.deregister(this._popupId);
PopupManager.closeModal(this._popupId);
if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
},
data() {
return {
opened: false,
bodyOverflow: null,
bodyPaddingRight: null,
rendered: false
};
},
watch: {
visible(val) {
if (val) {
if (this._opening) return;
if (!this.rendered) {
this.rendered = true;
Vue.nextTick(() => {
this.open();
});
} else {
this.open();
}
} else {
this.close();
}
}
},
methods: {
open(options) {
if (!this.rendered) {
this.rendered = true;
this.$emit('visible-change', true);
}
const props = merge({}, this.$props || this, options);
if (this._closeTimer) {
clearTimeout(this._closeTimer);
this._closeTimer = null;
}
clearTimeout(this._openTimer);
const openDelay = Number(props.openDelay);
if (openDelay > 0) {
this._openTimer = setTimeout(() => {
this._openTimer = null;
this.doOpen(props);
}, openDelay);
} else {
this.doOpen(props);
}
},
doOpen(props) {
if (this.$isServer) return;
if (this.willOpen && !this.willOpen()) return;
if (this.opened) return;
this._opening = true;
this.$emit('visible-change', true);
const dom = getDOM(this.$el);
const modal = props.modal;
const zIndex = props.zIndex;
if (zIndex) {
PopupManager.zIndex = zIndex;
}
if (modal) {
if (this._closing) {
PopupManager.closeModal(this._popupId);
this._closing = false;
}
PopupManager.openModal(this._popupId, PopupManager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
if (props.lockScroll) {
if (!this.bodyOverflow) {
this.bodyPaddingRight = document.body.style.paddingRight;
this.bodyOverflow = document.body.style.overflow;
}
scrollBarWidth = getScrollBarWidth();
let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
if (scrollBarWidth > 0 && bodyHasOverflow) {
document.body.style.paddingRight = scrollBarWidth + 'px';
}
document.body.style.overflow = 'hidden';
}
}
if (getComputedStyle(dom).position === 'static') {
dom.style.position = 'absolute';
}
dom.style.zIndex = PopupManager.nextZIndex();
this.opened = true;
this.onOpen && this.onOpen();
if (!this.transition) {
this.doAfterOpen();
}
},
doAfterOpen() {
this._opening = false;
},
close() {
if (this.willClose && !this.willClose()) return;
if (this._openTimer !== null) {
clearTimeout(this._openTimer);
this._openTimer = null;
}
clearTimeout(this._closeTimer);
const closeDelay = Number(this.closeDelay);
if (closeDelay > 0) {
this._closeTimer = setTimeout(() => {
this._closeTimer = null;
this.doClose();
}, closeDelay);
} else {
this.doClose();
}
},
doClose() {
this.$emit('visible-change', false);
this._closing = true;
this.onClose && this.onClose();
if (this.lockScroll) {
setTimeout(() => {
if (this.modal && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
}, 200);
}
this.opened = false;
if (!this.transition) {
this.doAfterClose();
}
},
doAfterClose() {
PopupManager.closeModal(this._popupId);
this._closing = false;
}
}
};
export {
PopupManager
};
|
JavaScript
| 0.000069 |
@@ -184,16 +184,51 @@
-width';
+%0Aimport %7B getStyle %7D from '../dom';
%0A%0Alet id
@@ -4563,24 +4563,92 @@
rollHeight;%0A
+ let bodyOverflowY = getStyle(document.body, 'overflowY');%0A
if
@@ -4671,16 +4671,17 @@
%3E 0 &&
+(
bodyHasO
@@ -4679,32 +4679,63 @@
(bodyHasOverflow
+ %7C%7C bodyOverflowY === 'scroll')
) %7B%0A
|
a80b11f98dcae8adc5eaca09941cb2ac88d3fe04
|
remove delay
|
src/main/mhub/index.js
|
src/main/mhub/index.js
|
'use strict'
const fs = require('fs')
const ejs = require('ejs')
const path = require('path')
const mkdirp = require('mkdirp')
const Promise = require('bluebird')
const randomatic = require('randomatic')
const { MClient } = require('mhub')
Promise.promisifyAll(fs)
Promise.promisifyAll(ejs)
const mkdirpAsync = Promise.promisify(mkdirp)
const MHUB_CONNECTION_STRING = 'ws://localhost:13900'
// const MHUB_NODE_NAME = 'default'
const MHUB_EXECUTABLE_PATH = path.resolve('./internals/mhub/bin/mhub-server')
const MHUB_FILE_TEMPLATE = path.join(__static, 'mhub-config.ejs')
const MHUB_FILE_PATH = path.resolve('./tmp/$mhub.config.json')
const MAX_RETRIES = 5
function generateConfigFileContent (configFile, options) {
return mkdirpAsync(path.dirname(configFile))
.then(() => ejs.renderFileAsync(MHUB_FILE_TEMPLATE, options))
.then(content => fs.writeFileAsync(configFile, content))
}
class Mhub {
constructor (serviceManager, logStream, options) {
this.mhubScript = MHUB_EXECUTABLE_PATH
this.configFile = MHUB_FILE_PATH
this.serviceManager = serviceManager
this.logStream = logStream
this.options = Object.assign(options, {
launcherPassword: randomatic('Aa', 12)
})
this.client = new MClient(MHUB_CONNECTION_STRING, {
noImplicitConnect: true,
timeout: 500
})
}
start () {
return this.serviceManager.startService({
init: () => generateConfigFileContent(this.configFile, this.options),
serviceName: 'mhub',
serviceId: this.serviceId,
logStream: this.logStream,
executable: process.execPath,
arguments: [this.mhubScript, '-c', this.configFile],
env: {
'ELECTRON_RUN_AS_NODE': '1'
}
})
.then(serviceId => {
this.serviceId = serviceId
})
.delay(1000)
.then(() => this.connect())
}
connect (retry = 0) {
return Promise.resolve(this.client.connect())
.catch(err => {
if (err.code === 'ECONNREFUSED' && retry < MAX_RETRIES) {
return Promise.delay(500 * 2 ** retry)
.then(() => this.connect(retry + 1))
} else {
throw err
}
})
.then(() => this.client.login('launcher', this.options.launcherPassword))
}
publish (nodeName, topic, message, headers) {
return Promise.resolve(this.client.publish(nodeName, topic, message, headers))
.tap(() => console.log(`Mhub message published on topic ${topic}`))
}
stop () {
return Promise.resolve(this.client.close())
.then(() => this.serviceManager.stopService(this.serviceId))
}
get url () {
return MHUB_CONNECTION_STRING
}
}
exports.Mhub = Mhub
|
JavaScript
| 0.000025 |
@@ -1786,27 +1786,8 @@
%7D)%0A
- .delay(1000)%0A
|
1aa2d92e5f255dc5e795f21623c83c35b819d9a9
|
use DI pattern for rails asset pipeline compatibility
|
ngProgress.js
|
ngProgress.js
|
/*
ngProgress v0.0.2 - slim, site-wide progressbar for AngularJS
(C) 2013 - Victor Bjelkholm
License: MIT (see LICENSE)
Source: https://github.com/victorbjelkholm/ngprogress
*/
var module = angular.module('ngProgress', []);
module.provider('progressbar', function() {
//Default values for provider
this.count = 0;
this.height = '2px';
this.color = 'firebrick';
this.$get = function($document, $window) {
var count = this.count;
var height = this.height;
var color = this.color;
var $body = $document.find('body');
// Create elements that is needed
var progressbarContainer = angular.element('<div class="progressbar-container"></div>');
var progressbar = angular.element('<div class="progressbar"></div>');
//Add CSS3 styles for transition smoothing
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = ".progressbar {-webkit-transition: all 0.5s ease-in-out; -moz-transition: all 0.5s ease-in-out; -o-transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out;}";
document.body.appendChild(css);
//Styling for the progressbar-container
progressbarContainer.css('position', 'fixed');
progressbarContainer.css('margin', '0');
progressbarContainer.css('padding', '0');
progressbarContainer.css('top', '0px');
progressbarContainer.css('left', '0px');
progressbarContainer.css('right', '0px');
//Styling for the progressbar itself
progressbar.css('height', height);
progressbar.css('box-shadow', '0px 0px 10px 0px ' + color);
progressbar.css('width', count+'%');
progressbar.css('margin', '0');
progressbar.css('padding', '0');
progressbar.css('background-color', color);
//Add progressbar to progressbar-container and progressbar-container
// to body
progressbarContainer.append(progressbar);
$body.append(progressbarContainer);
return {
// Starts the animation and adds between 0 - 5 percent to loading
// each 400 milliseconds. Should always be finished with progressbar.complete()
// to hide it
start: function() {
progressbar.css('width', count + '%');
progressbar.css('opacity', '1');
$window.interval = setInterval(function(){
if(count + 1 >= 95) {
clearInterval($window.interval);
} else {
var random = Math.floor(Math.random()*5)
count = count + random;
progressbar.css('width', count + '%');
}
}, 400);
},
// Sets the height of the progressbar. Use any valid CSS value
// Eg '10px', '1em' or '1%'
height: function(new_height) {
progressbar.css('height', new_height);
},
// Sets the color of the progressbar and it's shadow. Use any valid HTML
// color
color: function(color) {
progressbar.css('box-shadow', '0px 0px 10px 0px ' + color);
progressbar.css('background-color', color);
},
// Returns on how many percent the progressbar is at. Should'nt be needed
status: function() {
return this.count;
},
// Stops the progressbar at it's current location
stop: function() {
clearInterval($window.interval);
},
// Set's the progressbar percentage. Use a number between 0 - 100.
// If 100 is provided, complete will be called.
set: function(new_count) {
clearInterval($window.interval);
if(new_count >= 100) {
this.complete();
}
count = new_count;
progressbar.css('width', count + '%');
progressbar.css('opacity', '1');
return count;
},
// Resets the progressbar to percetage 0 and therefore will be hided after
// it's rollbacked
reset: function() {
clearInterval($window.interval);
count = 0;
progressbar.css('width', count + '%');
progressbar.css('opacity', '1');
return 0;
},
// Jumps to 100% progress and fades away progressbar.
complete: function() {
clearInterval($window.interval);
count = 100;
progressbar.css('width', count + '%');
setTimeout(function(){
progressbar.css('opacity', '0');
}, 500);
setTimeout(function(){
count = 0;
progressbar.css('width', count + '%');
}, 1000);
return count;
}
}
};
this.setColor = function(color) {
this.color = color;
};
this.setHeight = function(height) {
this.height = height;
};
});
|
JavaScript
| 0 |
@@ -393,16 +393,41 @@
s.$get =
+ %5B'$document', '$window',
functio
@@ -5123,24 +5123,25 @@
%7D%0A %7D
+%5D
;%0A%0A this.
@@ -5286,8 +5286,9 @@
%7D;%0A%0A%7D);
+%0A
|
00d126ba34dcefad8f7680999df9b95152bdc9c6
|
check if renderable
|
src/instance/methods.js
|
src/instance/methods.js
|
/* ======= Instance Methods ======= */
var hasConsole = typeof window.console !== undefined;
/**
* Logs a Message
* @param {String} msg
*/
Moon.prototype.log = function(msg) {
if(!config.silent && hasConsole) console.log(msg);
}
/**
* Throws an Error
* @param {String} msg
*/
Moon.prototype.error = function(msg) {
if(hasConsole) console.error("[Moon] ERR: " + msg);
}
/**
* Sets Value in Data
* @param {String} key
* @param {String} val
*/
Moon.prototype.set = function(key, val) {
this.$data[key] = val;
if(!this.$destroyed) this.build(this.$el.childNodes, this.$dom.children);
this.$hooks.updated();
}
/**
* Gets Value in Data
* @param {String} key
* @return {String} Value of key in data
*/
Moon.prototype.get = function(key) {
return this.$data[key];
}
/**
* Calls a method
* @param {String} method
*/
Moon.prototype.callMethod = function(method, args) {
args = args || [];
this.$methods[method].apply(this, args);
}
/**
* Destroys Moon Instance
*/
Moon.prototype.destroy = function() {
Object.defineProperty(this, '$data', {
set: function(value) {
_data = value;
}
});
this.$destroyed = true;
this.$hooks.destroyed();
}
/**
* Builds the DOM With Data
* @param {Array} children
*/
Moon.prototype.build = function(children, vdom) {
for(var i = 0; i < children.length; i++) {
var vnode = vdom[i];
var child = children[i];
if(vnode !== undefined && !vnode.once) {
var valueOfVNode = ""
if(child.nodeName === "#text") {
if(vnode.val) {
valueOfVNode = vnode.val(this.$data);
} else {
valueOfVNode = vnode;
}
child.textContent = valueOfVNode;
} else if(vnode.props) {
for(var attr in vnode.props) {
var compiledProp = vnode.props[attr](this.$data);
if(directives[attr]) {
child.removeAttribute(attr);
directives[attr](child, compiledProp, vnode);
} else {
child.setAttribute(attr, compiledProp);
}
}
}
this.build(child.childNodes, vnode.children);
}
}
}
/**
* Initializes Moon
*/
Moon.prototype.init = function() {
this.log("======= Moon =======");
this.$hooks.created();
setInitialElementValue(this.$el, this.$template);
if(this.$render !== noop) {
this.$dom = this.$render(h);
} else {
this.$dom = createVirtualDOM(this.$el);
}
this.build(this.$el.childNodes, this.$dom.children);
this.$hooks.mounted();
}
|
JavaScript
| 0.000001 |
@@ -1415,16 +1415,38 @@
ode.once
+ && vnode.shouldRender
) %7B%0A
|
6495eaca783e3141dccff577c0440f021894cdd5
|
Remove redundant default props in BottomConfirmModal
|
src/widgets/modals/BottomConfirmModal.js
|
src/widgets/modals/BottomConfirmModal.js
|
/* @flow weak */
/**
* OfflineMobile Android
* Sustainable Solutions (NZ) Ltd. 2016
*/
import React from 'react';
import {
Text,
StyleSheet,
View,
} from 'react-native';
import { Button } from '../Button';
import { BottomModal } from './BottomModal';
import globalStyles, { SUSSOL_ORANGE, WARM_GREY } from '../../globalStyles';
export function BottomConfirmModal(props) {
const { onCancel, onConfirm, questionText, confirmText, cancelText, ...modalProps } = props;
return (
<BottomModal {...modalProps}>
<Text style={[globalStyles.text, localStyles.questionText]}>
{questionText}
</Text>
<Button
style={[globalStyles.button, localStyles.cancelButton]}
textStyle={[globalStyles.buttonText, localStyles.buttonText]}
text={cancelText}
onPress={onCancel}
/>
<Button
style={[globalStyles.button, localStyles.deleteButton]}
textStyle={[globalStyles.buttonText, localStyles.buttonText]}
text={confirmText}
onPress={onConfirm}
/>
</BottomModal>
);
}
BottomConfirmModal.propTypes = {
style: View.propTypes.style,
isOpen: React.PropTypes.bool.isRequired,
questionText: React.PropTypes.string.isRequired,
onCancel: React.PropTypes.func.isRequired,
onConfirm: React.PropTypes.func.isRequired,
cancelText: React.PropTypes.string,
confirmText: React.PropTypes.string,
};
BottomConfirmModal.defaultProps = {
style: {},
cancelText: 'Cancel',
confirmText: 'Confirm',
swipeToClose: false, // negating the default.
backdropPressToClose: false, // negating the default.
position: 'bottom',
backdrop: false,
};
const localStyles = StyleSheet.create({
questionText: {
color: 'white',
fontSize: 22,
paddingRight: 10,
},
buttonText: {
color: 'white',
},
cancelButton: {
borderColor: 'white',
},
deleteButton: {
borderColor: 'white',
backgroundColor: SUSSOL_ORANGE,
},
});
|
JavaScript
| 0 |
@@ -1503,153 +1503,8 @@
m',%0A
- swipeToClose: false, // negating the default.%0A backdropPressToClose: false, // negating the default.%0A position: 'bottom',%0A backdrop: false,%0A
%7D;%0A%0A
|
140f0c90cfddfb8367971361f5a47bed0500e8f0
|
purge cache optimize
|
core/app/index.js
|
core/app/index.js
|
const express = require('express');
const ect = require('ect');
const path = require('path');
const random = require('random-int');
module.exports = config => {
const app = express();
const themeName = 'default';
const themeDir = path.resolve(
__dirname,
'../../content/themes',
config.theme
);
const libDir = path.resolve(
__dirname,
'../../node_modules'
);
const uploadDir = path.resolve(
__dirname,
'../../content/upload'
);
// config static dir
app.use(express.static(themeDir));
app.use('/libs', express.static(libDir));
app.use('/upload', express.static(uploadDir));
// config view engine
app.set('view engine', 'ect');
app.set('views', themeDir);
app.engine('ect', ect({
watch: true,
root: themeDir,
ext: '.ect'
}).render);
// route
app.use('/', (req, res, next) => {
// view helper
res.locals.asset = file => file + '?_=' + Date.now();
res.locals.upload = media => '/upload' + media.path;
res.locals.settings = app.parent.get('shared').settings;
// config
res.locals.config = app.parent.get('config');
next();
});
app.get('/', (req, res, next) => {
let count = app.parent.get('shared').mediaCount;
let picked = random(count - 1);
res.redirect('/' + picked);
});
app.get('/:alias([0-9]+)', (req, res, next) => {
let alias = parseInt(req.params.alias, 10);
let count = app.parent.get('shared').mediaCount;
if (alias < 0 || alias > count - 1) {
return res.redirect('/');
}
let cache = app.parent.get('shared').cache;
if (cache[alias]) {
res.locals.media = cache[alias];
return next();
}
app.parent.get('models').Media
.findOne({
alias: alias
})
.lean()
.then(media => {
if (!media) {
return res.redirect('/');
}
res.locals.media = cache[alias] = media;
next();
});
}, (req, res, next) => {
let count = app.parent.get('shared').mediaCount;
let media = res.locals.media;
res.render('index', {
media: media,
prev: media.alias > 0 ?
'/' + (media.alias - 1) : '#',
next: media.alias < count - 1 ?
'/' + (media.alias + 1) : '#',
siteUrl: `${req.protocol}://${req.hostname}/${media.alias}`,
});
});
return app;
};
|
JavaScript
| 0.000001 |
@@ -178,16 +178,47 @@
press();
+%0A%09const timestamp = Date.now();
%0A%0A%09const
@@ -893,33 +893,116 @@
=%3E
-file + '?_=' + Date.now()
+%7B%0A%09%09%09if (config.debug) %7B%0A%09%09%09%09return file + '?_=' + Date.now();%0A%09%09%09%7D%0A%0A%09%09%09return file + '?_=' + timestamp;%0A%09%09%7D
;%0A%09%09
|
fae3d819b57fe69eb81612cd97fa4a1ed3e47aad
|
Use mime type resolving from platform utils.
|
webinos/common/xmpp/lib/webserver.js
|
webinos/common/xmpp/lib/webserver.js
|
/*******************************************************************************
* Code contributed to the webinos project
*
* 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.
*
*******************************************************************************/
/**
* Author: Eelco Cramer
*/
(function() {
"use strict";
var http = require('http');
var server = http.createServer(handler);
var wsServer = http.createServer(handler);
var url = require("url");
var path = require("path");
var fs = require("fs");
var logger = require('./Logger').getLogger('webserver', 'warn');
var WebSocketServer = require('websocket').server;
var rpcServer = require("./RpcServer.js");
var path = require('path');
var documentRoot = path.resolve(__dirname, '../../../test/client');
var moduleRoot = require(path.resolve(__dirname, '../dependencies.json'));
var dependencyPath = path.join(__dirname, '../', moduleRoot.root.location, '/dependencies.json')
var dependencies = require(path.normalize(dependencyPath));
var webinosRoot = path.resolve(__dirname, '../' + moduleRoot.root.location);
var rpc = require(path.join(webinosRoot, dependencies.rpc.location));
var wss;
/**
* Handles incoming requests from connected WRTs
* @function
* @param request The HTTP request.
* @param response The HTTP response.
*/
function handler(request, response) {
logger.verbose("Entering request callback");
var pathname = url.parse(request.url).pathname;
logger.debug("Received request for " + pathname);
// simulate a fully configured web server
if (pathname == "/") pathname = "client.html";
// determine file to serve
var filename = path.join(documentRoot, pathname);
filename = path.normalize(filename);
// now serve the file
fs.readFile(filename, function (err, data) {
if (err) {
// Can't read file. This is not an error or warning
logger.debug("Can't read " + filename + " due to " + err);
// create error response
response.writeHead(404, {"Content-Type": "text/plain"});
response.write("Error " + err + " when serving " + pathname);
logger.info("404 NOT FOUND for " + filename);
} else {
response.writeHead(200, {"Content-Type": mimeType(filename)});
response.write(data);
logger.info("200 OK for " + filename);
}
response.end();
logger.verbose("Leaving request callback");
});
}
/**
* Starts the webserver webinos clients can connect to.
* @function
* @param httpPort Port for HTTP connections.
* @param wssPort Port for websocket connections.
* @param rpcHandler The RPC handler.
* @param jid The jid of PZP.
*/
function start(httpPort, wssPort, rpcHandler, jid) {
logger.verbose("Entering start()");
logger.debug("Creating web server on port " + httpPort);
server.listen(httpPort);
wsServer.listen(wssPort);
logger.info("Webserver listening on port " + httpPort);
// configure the RPC server
wss = new WebSocketServer({
httpServer: wsServer,
autoAcceptConnections: true
});
//TODO fix this
rpcServer.configure(wss, rpcHandler, jid);
logger.verbose("Leaving start()");
}
exports.start = start;
exports.wss = wss;
var mimeTypes = [];
mimeTypes[".png"] = "image/png";
mimeTypes[".gif"] = "image/gif";
mimeTypes[".htm"] = "text/html";
mimeTypes[".html"] = "text/html";
mimeTypes[".txt"] = "text/plain";
mimeTypes[".png"] = "image/png";
mimeTypes[".js"] = "application/x-javascript";
mimeTypes[".css"] = "text/css";
/**
* Gets the MIME type for a file.
* @private
* @function
* @param {string} file The filename.
*/
function mimeType(file) {
logger.verbose("Entering mimeType function");
var ext = path.extname(file);
var type = mimeTypes[ext] || "text/plain";
logger.debug("Determined mime type of ext " + ext + " to be " + type)
logger.verbose("Leaving mimeType function");
}
})();
|
JavaScript
| 0 |
@@ -1701,16 +1701,166 @@
ation));
+%0A%0A var webinos = require(%22find-dependencies%22)(__dirname);%0A var content = webinos.global.require(webinos.global.util.location, %22lib/content.js%22);
%0A %0A
@@ -4140,352 +4140,8 @@
s;%0A%0A
- var mimeTypes = %5B%5D;%0A mimeTypes%5B%22.png%22%5D = %22image/png%22;%0A mimeTypes%5B%22.gif%22%5D = %22image/gif%22;%0A mimeTypes%5B%22.htm%22%5D = %22text/html%22;%0A mimeTypes%5B%22.html%22%5D = %22text/html%22;%0A mimeTypes%5B%22.txt%22%5D = %22text/plain%22;%0A mimeTypes%5B%22.png%22%5D = %22image/png%22;%0A mimeTypes%5B%22.js%22%5D = %22application/x-javascript%22;%0A mimeTypes%5B%22.css%22%5D = %22text/css%22;%0A%0A
@@ -4242,16 +4242,20 @@
ng%7D file
+name
The fil
@@ -4295,16 +4295,20 @@
ype(file
+name
) %7B%0A
@@ -4362,161 +4362,45 @@
-%09var ext = path.extname(file);%0A %09var type = mimeTypes%5Bext%5D %7C%7C %22text/plain%22;%0A %09logger.debug(%22Determined mime type of ext %22 + ext + %22 to be %22 + typ
+ content.getContentType(filenam
e)
+;
%0A
|
1d4460c237cb8fa225c70c6a90c1cab918e5a5f2
|
Fix an error message.
|
lib/transport/http-transport.js
|
lib/transport/http-transport.js
|
/**
* Implementation of an HTTP/REST transport for the JSON-WS module.
*/
'use strict';
const jsonrpc = require('./json-rpc');
const BaseTransport = require('./base-transport');
function param(req, name, defaultValue) {
const params = req.params || {};
const body = req.body || {};
const query = req.query || {};
if (params[name] !== null && params[name] !== undefined && params.hasOwnProperty(name)) {
return params[name];
}
if (body[name] !== null && body[name] !== undefined) {
return body[name];
}
if (query[name] !== null && query[name] !== undefined) {
return query[name];
}
return defaultValue;
}
class HttpTransport extends BaseTransport {
static get type() {
return 'HTTP';
}
constructor(registry) {
super(registry);
this._setupHandlers();
}
// HTTP-specific sendMessage
sendMessage(msg, context, format) {
const res = context.http.response;
res.set('Access-Control-Allow-Origin', '*');
let isSent = false;
try {
if (msg.error) {
res.set('Content-Type', 'application/json');
res.status(500).send(JSON.stringify(msg));
isSent = true;
} else if (msg.id !== undefined && msg.id !== null) {
// For now, assume that no format means JSON
// otherwise simply dump the message as-is into the response stream
// This can be extended with custom formatters if required
const messageData = format || Buffer.isBuffer(msg.result) ? msg.result : JSON.stringify(msg);
res.set('Content-Type', format || (Buffer.isBuffer(messageData) ? 'application/octet-stream' : 'application/json'));
res.send(messageData);
isSent = true;
}
} catch (err) {
this.trace.error(context, null, err);
res.set('Content-Type', 'application/json');
res.status(500).end(JSON.stringify(
jsonrpc.response(
msg.id,
jsonrpc.error(-32000, err.message))));
isSent = true;
} finally {
if (!isSent) {
res.end();
}
}
}
// Override the attach method
// Set up Express routes
_setupHandlers() {
const restHandler = (req, res) => {
const servicePrefix = `/${req.params.serviceName}/${req.params.serviceVersion}`;
const service = this.registry.getService(servicePrefix);
const methodName = req.params.methodName || param(req, 'method') || null;
const methodInfo = service.methodMap[methodName];
const json = jsonrpc.jsonrpc({
method: methodName
});
const id = param(req, 'id');
if (id !== undefined && id !== null) {
json.id = id;
} else if (!methodInfo || methodInfo.returns || methodInfo.async) {
// auto-assign a message ID if the method has a declared return type (or is declared as async)
// and no ID was given on input. Also, if the method was NOT found, assign an ID so
// the error is always returned to the clients
json.id = methodName;
}
const params = param(req, 'params');
if (params !== undefined) {
json.params = params;
if (typeof json.params === 'string') {
try {
json.params = JSON.parse(json.params);
} catch (unnamedJsonParseErr) { //eslint-ignore-line no-empty-blocks
}
}
} else if (methodInfo && methodInfo.params) {
json.params = {};
for (let i = 0; i < methodInfo.params.length; i++) {
const parName = methodInfo.params[i].name;
const paramValue = param(req, parName);
if (typeof paramValue !== 'undefined') {
json.params[parName] = paramValue;
if (typeof json.params[parName] === 'string') {
try {
json.params[parName] = JSON.parse(json.params[parName]);
} catch (namedJsonParseErr) { //eslint-ignore-line no-empty-blocks
}
}
}
}
if (Object.keys(json.params).length === 0) {
delete json.params;
}
}
const messageContext = {
http: {
request: req,
response: res
},
data: null
};
const continueImmediately = this.validateMessage(service, req.originalParams, (err, data) => {
if (err) {
this.trace.error(messageContext, methodInfo, err);
res.set('Content-Type', 'application/json');
res.status(403).end(JSON.stringify(
jsonrpc.response(
json.id,
jsonrpc.error(-32000, 'Unauthorized request', err.message))));
} else {
messageContext.data = data;
this.handleMessage(service, json, messageContext);
}
});
if (continueImmediately) {
this.handleMessage(service, json, messageContext);
}
};
this.registry.router.post('/:serviceName/:serviceVersion', restHandler);
this.registry.router.all(`/:serviceName/:serviceVersion/:methodName`, restHandler);
}
}
module.exports = HttpTransport;
|
JavaScript
| 0.000081 |
@@ -1812,16 +1812,44 @@
(-32000,
+ 'Sending response failure',
err.mes
|
2d66c0b1e05a62cd7b8295a4d55a547b3c85eb90
|
fix 0.8.0 issue with verifying the kong node by case-insensitive compare
|
src/js/services/kong.js
|
src/js/services/kong.js
|
/**
* This factory handles CRUD requests to the backend API.
*/
angular.module('app')
.factory('Kong', ['$http', '$q', '$cookies', 'Alert', function ($http, $q, $cookies, Alert) {
var config = {
url : $cookies.getObject('config.url'),
auth : { type : "no_auth" }
};
var factory = {
config: config,
get: function (endpoint) {
var deferred = $q.defer();
$http.get(factory.config.url + endpoint).then(function (response) {
deferred.resolve(response.data);
}, function (response) {
factory.handleError(response, deferred, endpoint);
});
return deferred.promise;
},
put: function (endpoint, data) {
var deferred = $q.defer();
$http({
method: 'PUT',
url: factory.config.url + endpoint,
data: data,
}).then(function (response) {
deferred.resolve(response.data);
}, function (response) {
factory.handleError(response, deferred, endpoint);
});
return deferred.promise;
},
patch: function (endpoint, data) {
var deferred = $q.defer();
$http.patch(factory.config.url + endpoint, data).then(function (response) {
deferred.resolve(response.data);
}, function (response) {
factory.handleError(response, deferred, endpoint);
});
return deferred.promise;
},
delete: function (endpoint) {
var deferred = $q.defer();
$http.delete(factory.config.url + endpoint).then(function (response) {
deferred.resolve(response);
}, function (response) {
factory.handleError(response, deferred, endpoint);
});
return deferred.promise;
},
post: function (endpoint, data) {
var deferred = $q.defer();
$http.post(factory.config.url + endpoint, data).then(function (response) {
deferred.resolve(response.data);
}, function (response) {
factory.handleError(response, deferred, endpoint);
});
return deferred.promise;
},
handleError: function (response, deferred, endpoint) {
if (response.data && response.status != 500) {
if (response.data.message) {
Alert.error(response.data.message);
}
deferred.reject(response);
} else {
Alert.error("Oops, something wrong happened. Please refresh the page.");
response.data = {};
deferred.reject(response);
}
},
checkConfig: function (config) {
var url = config.url;
if (config.auth.type === 'basic_auth') {
var auth_string = btoa(config.auth.username + ':' + config.auth.password);
$http.defaults.headers.common['Authorization'] = 'Basic ' + auth_string;
} else {
delete $http.defaults.headers.common['Authorization'];
}
var deferred = $q.defer();
if (!url) {
deferred.reject('Not reachable');
} else {
$http({
url: url,
method: 'GET',
timeout: 5000,
}).then(function (response) {
if (response.data.tagline && response.data.tagline == "Welcome to Kong") {
deferred.resolve();
} else {
deferred.reject('Not Kong');
}
}, function (response) {
if (response.status == 401) {
deferred.reject('Auth required');
} else if (response.status == 403) {
deferred.reject('Forbidden');
} else {
deferred.reject('Not reachable');
}
});
}
return deferred.promise;
},
setConfig: function (config) {
var deferred = $q.defer();
factory.checkConfig(config).then(function () {
factory.config = config;
$cookies.putObject('config.url', factory.config.url, {
expires: new Date(new Date().getTime() + 1000 * 24 * 3600 * 60) // remember 60 days
});
deferred.resolve();
}, function (response) {
deferred.reject(response);
});
return deferred.promise;
}
};
return factory;
}]);
|
JavaScript
| 0 |
@@ -3949,14 +3949,28 @@
line
+.toLowerCase()
== %22
-W
+w
elco
@@ -3975,17 +3975,17 @@
come to
-K
+k
ong%22) %7B%0A
|
04e6c43da793d94c10c1e6601439a696e72b8923
|
fix typo in comment
|
src/js/utils/strings.js
|
src/js/utils/strings.js
|
// ==========================================================================
// String utils
// ==========================================================================
import is from './is';
// Generate a random ID
export function generateId(prefix) {
return `${prefix}-${Math.floor(Math.random() * 10000)}`;
}
// Format string
export function format(input, ...args) {
if (is.empty(input)) {
return input;
}
return input.toString().replace(/{(\d+)}/g, (match, i) => args[i].toString());
}
// Get percentage
export function getPercentage(current, max) {
if (current === 0 || max === 0 || Number.isNaN(current) || Number.isNaN(max)) {
return 0;
}
return ((current / max) * 100).toFixed(2);
}
// Replace all occurances of a string in a string
export const replaceAll = (input = '', find = '', replace = '') =>
input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());
// Convert to title case
export const toTitleCase = (input = '') =>
input.toString().replace(/\w\S*/g, (text) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase());
// Convert string to pascalCase
export function toPascalCase(input = '') {
let string = input.toString();
// Convert kebab case
string = replaceAll(string, '-', ' ');
// Convert snake case
string = replaceAll(string, '_', ' ');
// Convert to title case
string = toTitleCase(string);
// Convert to pascal case
return replaceAll(string, ' ', '');
}
// Convert string to pascalCase
export function toCamelCase(input = '') {
let string = input.toString();
// Convert to pascal case
string = toPascalCase(string);
// Convert first character to lowercase
return string.charAt(0).toLowerCase() + string.slice(1);
}
// Remove HTML from a string
export function stripHTML(source) {
const fragment = document.createDocumentFragment();
const element = document.createElement('div');
fragment.appendChild(element);
element.innerHTML = source;
return fragment.firstChild.innerText;
}
// Like outerHTML, but also works for DocumentFragment
export function getHTML(element) {
const wrapper = document.createElement('div');
wrapper.appendChild(element);
return wrapper.innerHTML;
}
|
JavaScript
| 0.000529 |
@@ -393,22 +393,16 @@
(input))
- %7B%0A
return
@@ -407,20 +407,16 @@
n input;
-%0A %7D
%0A%0A retu
@@ -726,17 +726,18 @@
ll occur
-a
+re
nces of
|
01ceab37ccbdc1b256154186f6140add18835a5b
|
删除fs.watch特性
|
node/_node.js
|
node/_node.js
|
var fs = require('fs');
var path = require('path');
module.exports = function (template) {
var cacheStore = template.cache;
var defaults = template.defaults;
var rExtname;
// 提供新的配置字段
defaults.base = '';
defaults.extname = '.html';
defaults.encoding = 'utf-8';
function compileFromFS(filename) {
// 加载模板并编译
var source = readTemplate(filename);
if (typeof source === 'string') {
return template.compile(source, {
filename: filename
});
}
}
// 重写引擎编译结果获取方法
template.get = function (filename) {
var fn;
if (cacheStore.hasOwnProperty(filename)) {
// 使用内存缓存
fn = cacheStore[filename];
} else {
fn = compileFromFS(filename);
if (fn) {
var watcher = fs.watch(filename + defaults.extname);
// 文件发生改变,重新生成缓存
// TODO: 观察删除文件,或者其他使文件发生变化的改动
watcher.on('change', function (event) {
if (event === 'change') {
cacheStore[filename] = compileFromFS(filename);
}
});
}
}
return fn;
};
function readTemplate (id) {
id = path.join(defaults.base, id + defaults.extname);
if (id.indexOf(defaults.base) !== 0) {
// 安全限制:禁止超出模板目录之外调用文件
throw new Error('"' + id + '" is not in the template directory');
} else {
try {
return fs.readFileSync(id, defaults.encoding);
} catch (e) {}
}
}
// 重写模板`include``语句实现方法,转换模板为绝对路径
template.utils.$include = function (filename, data, from) {
from = path.dirname(from);
filename = path.join(from, filename);
return template.renderFile(filename, data);
}
// express support
template.__express = function (file, options, fn) {
if (typeof options === 'function') {
fn = options;
options = {};
}
if (!rExtname) {
// 去掉 express 传入的路径
rExtname = new RegExp((defaults.extname + '$').replace(/\./g, '\\.'));
}
file = file.replace(rExtname, '');
options.filename = file;
fn(null, template.renderFile(file, options));
};
return template;
}
|
JavaScript
| 0 |
@@ -691,315 +691,8 @@
me);
-%0A%0A%09%09 if (fn) %7B%0A%09%09%09 var watcher = fs.watch(filename + defaults.extname);%0A%0A%09%09%09 // %E6%96%87%E4%BB%B6%E5%8F%91%E7%94%9F%E6%94%B9%E5%8F%98%EF%BC%8C%E9%87%8D%E6%96%B0%E7%94%9F%E6%88%90%E7%BC%93%E5%AD%98%0A%09%09%09 // TODO%EF%BC%9A %E8%A7%82%E5%AF%9F%E5%88%A0%E9%99%A4%E6%96%87%E4%BB%B6%EF%BC%8C%E6%88%96%E8%80%85%E5%85%B6%E4%BB%96%E4%BD%BF%E6%96%87%E4%BB%B6%E5%8F%91%E7%94%9F%E5%8F%98%E5%8C%96%E7%9A%84%E6%94%B9%E5%8A%A8%0A%09%09%09 watcher.on('change', function (event) %7B%0A%09%09%09%09 if (event === 'change') %7B%0A%09%09%09%09%09 cacheStore%5Bfilename%5D = compileFromFS(filename);%0A%09%09%09%09 %7D%0A%09%09%09 %7D);%0A%09%09 %7D
%0A%09
|
10a4d3f66049d804e1cf7854d2e957ef1248edc8
|
increase range of opacity generator slightly
|
site/main.js
|
site/main.js
|
import Vue from 'vue'
import fetch from 'unfetch'
import * as hero from '../'
const patterns = []
const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)
const roundTo = (increment, number) => Math.round(number / increment) * increment
const genAlpha = () => {
// using 102 instead of 100 for the upper range
// gives us a slightly larger chance of returning 1
let num = roundTo(5, random(25, 102))
return num === 100 ? 1 : parseFloat(`0.${num}`)
}
// Could do this per-pattern but it felt wrong making 84 requests straight off the get-go
fetch(`https://randoma11y.com/combos?page=${random(69, 420)}&per_page=${Object.keys(hero).length}`)
.then(r => r.json())
.then(json => {
let count = 0
for (let item in hero) {
let pattern = {}
pattern.colorOne = json[count].color_one
pattern.colorTwo = json[count].color_two
pattern.opacity = genAlpha()
pattern.fn = hero[item]
patterns.push(pattern)
count++
}
})
Vue.component('hero', {
props: ['c1', 'c2', 'alpha', 'fn'],
data () {
return {
colorOne: this.c1,
colorTwo: this.c2,
opacity: this.alpha
}
},
computed: {
style () {
return {
backgroundPosition: 'center',
backgroundColor: this.colorOne,
backgroundImage: this.fn(this.colorTwo, this.opacity)
}
},
name () {
return this.fn.name.replace(/([A-Z])/g, ' $1')
},
ident () {
return this.fn.name.replace(/([A-Z])/g, '-$1').toLowerCase()
},
func () {
return `${this.fn.name}('${this.colorTwo}', ${this.opacity})`
}
},
methods: {
changeColor () {
let self = this
fetch(`https://randoma11y.com/combos?page=${random(69, 420)}&per_page=1`)
.then(r => r.json())
.then(json => {
self.colorOne = json[0].color_one
self.colorTwo = json[0].color_two
self.opacity = genAlpha()
})
}
},
template: `
<div class="hero w-100 w-50-ns w-third-m w-25-l fl" :id="ident">
<div class="hide-child aspect-ratio aspect-ratio--16x9" :style="style">
<div class="child absolute absolute--fill bg-black-70 flex flex-column items-center justify-center pa3" @click.self="changeColor">
<h3 class="white f5 f4-ns f3-l fw4 ttu tracked tc mt0 mb2">{{ name }}</h3>
<code class="mt2 pv2 ph3 ba b--white br2 code white f5">{{ func }}</code>
</div>
</div>
</div>`
})
new Vue({ // eslint-disable-line
el: '#app',
data: { patterns },
template: `<div class="cf heroes"><hero v-for="item in patterns" :key="item.fn.name" :c1="item.colorOne" :c2="item.colorTwo" :alpha="item.opacity" :fn="item.fn"></hero></div>`
})
|
JavaScript
| 0 |
@@ -382,16 +382,74 @@
rning 1%0A
+ // the same holds true for using 23 for the lower range%0A
let nu
@@ -471,17 +471,17 @@
random(2
-5
+3
, 102))%0A
|
d05330111ccc9d820c19e35f7b834ad98629ebde
|
fix throttling
|
src/withMousePosition.js
|
src/withMousePosition.js
|
import React from 'react'
import { findDOMNode } from 'react-dom'
import createHelper from 'recompose/createHelper'
import createElement from 'recompose/createElement'
import pick from 'lodash/pick'
import identity from 'lodash/identity'
import isFunction from 'lodash/isFunction'
const pickedProps = [
'pageX',
'pageY',
'clientX',
'clientY',
'screenX',
'screenY',
]
export const defaultState = { mousePosition: undefined }
const withMousePosition = (throttle = identity) =>
BaseComponent =>
class extends React.Component {
state = defaultState
componentDidMount = () => {
this.dom = findDOMNode(this)
this.dom.addEventListener('mousemove', this.onMouseMove)
this.dom.addEventListener('mouseleave', this.onMouseLeave)
}
componentWillUnmount = () => {
if (isFunction(this.onMouseMove.cancel)) {
this.onMouseMove.cancel()
}
this.dom.removeEventListener('mousemove', this.onMouseMove)
this.dom.removeEventListener('mouseleave', this.onMouseLeave)
}
onMouseMove = e =>
throttle(this.setState({ mousePosition: pick(e, pickedProps) }))
onMouseLeave = () =>
this.setState(defaultState)
render = () =>
createElement(BaseComponent, {
...this.props,
...this.state,
})
}
export default createHelper(withMousePosition, 'withMousePosition')
|
JavaScript
| 0.000004 |
@@ -1052,28 +1052,29 @@
e =
-e =%3E%0A throttle(
+throttle(%0A e =%3E
this
@@ -1123,16 +1123,21 @@
rops) %7D)
+%0A
)%0A%0A o
|
91b21bc7964186432e82f16b60eba82f65287390
|
Reset relevance of F# keywords.
|
src/languages/fsharp.js
|
src/languages/fsharp.js
|
/*
Language: F#
Author: Jonas Follesø <[email protected]>
Contributors: Troy Kershaw <[email protected]>, Henrik Feldt <[email protected]>
*/
function(hljs) {
var TYPEPARAM = {
begin: '<', end: '>',
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: /'[a-zA-Z0-9_]+/})
]
};
return {
aliases: ['fs'],
keywords:
// monad builder keywords (at top, matches before non-bang kws)
'yield! return! let! do!' +
// regular keywords
'abstract and as assert base begin class default delegate do done ' +
'downcast downto elif else end exception extern false finally for ' +
'fun|10 function global if in inherit inline interface internal lazy let ' +
'match member module mutable|10 namespace new null of open or ' +
'override private public rec|10 return sig static struct then to ' +
'true try type upcast use val void when while with yield',
contains: [
{
className: 'string',
begin: '@"', end: '"',
contains: [{begin: '""'}]
},
{
className: 'string',
begin: '"""', end: '"""'
},
{
className: 'comment',
begin: '\\(\\*', end: '\\*\\)'
},
{
className: 'class',
beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
contains: [
hljs.UNDERSCORE_TITLE_MODE,
TYPEPARAM
]
},
{
className: 'annotation',
begin: '\\[<', end: '>\\]',
relevance: 10
},
{
className: 'attribute',
begin: '\\B(\'[A-Za-z])\\b',
contains: [hljs.BACKSLASH_ESCAPE]
},
hljs.C_LINE_COMMENT_MODE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
hljs.C_NUMBER_MODE
]
};
}
|
JavaScript
| 0 |
@@ -627,19 +627,16 @@
'fun
-%7C10
functio
@@ -731,19 +731,16 @@
mutable
-%7C10
namespa
@@ -804,11 +804,8 @@
rec
-%7C10
ret
|
493a1e8c9a2bfc398e51de790d780354b23313f2
|
Set event handler on accordion header only
|
src/layout/Accordion.js
|
src/layout/Accordion.js
|
/* jshint undef: true, unused: true, browser: true, quotmark: single, curly: true */
/* global Ext */
Ext.define('Jarvus.touch.layout.Accordion', {
extend: 'Ext.layout.Default',
alias: ['layout.accordion'],
config: {
expandedItem: null,
allowCollapse: true,
scrollOnExpand: false,
pressedCls: 'x-item-pressed'
},
constructor: function() {
var me = this;
me.callParent(arguments);
},
setContainer: function(container) {
var me = this,
options = {
delegate: '> component'
};
me.callParent(arguments);
container.innerElement.on('tap', 'onHeaderTap', me, {
delegate: '.accordion-header'
});
container.on('hide', 'onItemHide', me, options)
.on('show', 'onItemShow', me, options)
.on('expand', 'onItemExpand', me, options)
.on('collapse', 'onItemCollapse', me, options);
container.addCls('jarvus-layout-accordion');
},
insertInnerItem: function(item, index) {
var me = this,
pressedCls = me.getPressedCls(),
container = me.container,
itemDom = item.element.dom,
nextSibling = container.getInnerAt(index + 1),
nextSiblingDom = nextSibling ? nextSibling.accordion.dom : null,
accordion;
item.element.addCls('accordion-body');
accordion = container.innerElement.createChild({
tag: 'section',
cls: 'accordion-section',
cn: {
tag: 'h1',
cls: 'accordion-header',
html: item.config.title
}
}, nextSiblingDom);
accordion.on({
touchstart: function() {
accordion.addCls(pressedCls);
},
touchend: function() {
accordion.removeCls(pressedCls);
}
});
if (item.isHidden()) {
accordion.hide();
}
accordion.dom.appendChild(itemDom);
accordion.item = item;
item.accordion = accordion;
return me;
},
removeInnerItem: function(item) {
item.accordion.detach();
},
onHeaderTap: function(ev) {
var item = ev.getTarget('.accordion-section', this.container.innerElement, true).item;
if (item.collapsed) {
item.expand();
} else {
item.collapse();
}
},
applyExpandedItem: function(item) {
if (!item && item !== 0) {
return null;
}
if (item.isElement) {
return item.item;
}
if (Ext.isNumber(item)) {
return this.container.getInnerAt(item);
}
return item;
},
updateExpandedItem: function(item, oldItem) {
if (oldItem && !this.container.config.allowMultipleExpandedItems) {
oldItem.collapse();
}
if (item && item.isPainted()) {
item.expand();
}
},
onItemAdd: function(item) {
var me = this;
me.callParent(arguments);
item.expand = function() {
if (item.collapsed && item.fireEvent('beforeexpand', item, me) !== false) {
item.collapsed = false;
item.fireEvent('expand', item, me);
}
};
item.collapse = function() {
if (!item.collapsed && item.fireEvent('beforecollapse', item, me) !== false) {
item.collapsed = true;
item.fireEvent('collapse', item, me);
}
};
if (item.config.expanded) {
me.setExpandedItem(item);
item.collapsed = false;
item.accordion.addCls('selected');
} else {
item.collapsed = true;
}
},
onItemHide: function(item) {
if (item.isInnerItem()) {
item.accordion.hide();
}
},
onItemShow: function(item) {
if (item.isInnerItem()) {
item.accordion.show();
}
},
onItemExpand: function(item) {
var me = this,
container = me.findParentContainerWithScrollable(),
scrollable = container.getScrollable(),
scroller = scrollable ? scrollable.getScroller() : null;
me.setExpandedItem(item);
if (item && me.shouldItemBeMaximized(item)) {
item.setHeight(container.bodyElement.getHeight() - me.getTotalHeight(container));
if (scroller) {
scroller.setDisabled(true);
}
} else if (scroller) {
scroller.setDisabled(false);
if (me.getScrollOnExpand()) {
Ext.defer(function() {
var scrollToY = me.getHeaderScrollPosition(item);
if (scroller.getSize().y - scroller.getContainerSize().y > scrollToY) {
scroller.scrollTo(0, scrollToY, true);
}
}, 25);
}
}
item.accordion.addCls('selected');
},
onItemCollapse: function(item) {
var me = this;
if (me.getExpandedItem() === item) {
me.setExpandedItem(null);
}
item.accordion.removeCls('selected');
},
/**
* certain functions depend on working with a container that has a scrollable/scroller;
* since it's possible that an accordion might exist as a child of a parent container
* that has scrollable (instead of the accordion container being the entire scrollable area),
* we can use this function to locate the nearest parent with a scrollable.
*/
findParentContainerWithScrollable: function() {
var container = this.container;
return container.up('container{getScrollable()}') || container;
},
/**
* Test if given item should be maximized
*/
shouldItemBeMaximized: function(item) {
var me = this,
container = me.findParentContainerWithScrollable();
return !container.getScrollable().getElement().getHeight() || !!item.config.maximizeHeight;
},
getTotalHeight: function(container) {
var innerItems = container.getInnerItems(),
len = innerItems.length,
i = 0,
totalHeight = 0,
containerItem;
if (container === this.container) {
for (; i < len; i++) {
containerItem = innerItems[i];
if (!containerItem.getHidden()) {
totalHeight += containerItem.accordion.getHeight();
}
}
}
return totalHeight;
},
getHeaderScrollPosition: function(item) {
var innerItems = this.container.getInnerItems(),
index = Ext.Array.indexOf(innerItems, item) - 1,
top = 0;
while (index >= 0) {
top += innerItems[index].accordion.getHeight();
index--;
}
return top;
}
});
|
JavaScript
| 0 |
@@ -1370,32 +1370,49 @@
accordion
+, accordionHeader
;%0A%0A item.
@@ -1754,16 +1754,86 @@
ccordion
+Header = accordion.down('.accordion-header');%0A%0A accordionHeader
.on(%7B%0A
@@ -1884,32 +1884,38 @@
accordion
+Header
.addCls(pressedC
@@ -1986,32 +1986,38 @@
accordion
+Header
.removeCls(press
|
d8f871f851e466b611de2938141b7cb475ee3347
|
add missing backtick
|
src/mixins/ellipsis.js
|
src/mixins/ellipsis.js
|
// @flow
/**
* CSS to represent truncated text with an ellipsis.
*
* @example
* // Styles as object usage
* const styles = {
* ...ellipsis('250px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${ellipsis('250px')}
*
*
* // CSS as JS Output
*
* div: {
* 'display': 'inline-block',
* 'max-width': '250px',
* 'overflow': 'hidden',
* 'text-overflow': 'ellipsis',
* 'white-space': 'nowrap',
* 'word-wrap': 'normal'
* }
*/
function ellipsis(width: string = '100%') {
return {
'display': 'inline-block',
'max-width': width,
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
'word-wrap': 'normal',
}
}
export default ellipsis
|
JavaScript
| 0.000881 |
@@ -243,16 +243,18 @@
px')%7D%0A *
+ %60
%0A *%0A * /
|
e674a995916f4d3fcdda0b40a70cc43e9a005d08
|
remove repos
|
src/lib/make_sourced.js
|
src/lib/make_sourced.js
|
'use strict'
var Common = require('./common')
var async = require('async')
var _ = require('lodash')
var util = require('util')
function EntityError (msg, constr) {
Error.captureStackTrace(this, constr || this)
this.message = msg || 'Entity Error'
}
util.inherits(EntityError, Error)
EntityError.prototype.name = 'EntityError'
function SourcedEntity (name, snapshot, events, seneca) {
var self = this
self.log$ = function () {
this.private$.seneca.log.apply(this, arguments)
}
var private$ = self.private$ = function () {}
private$.seneca = seneca
private$.entity_name = name
private$.events_repo = seneca.make('events', name)
private$.snapshots_repo = seneca.make('snapshots', name)
this.newEvents = []
this.eventsToEmit = []
this.replaying = false
this.snapshotVersion = 0
this.timestamp = Date.now()
this.version = 0
if (snapshot) {
this.merge(snapshot)
}
if (events) {
this.replay(events)
}
}
SourcedEntity.prototype.make$ = function () {
var self = this
var args = Common.arrayify(arguments)
if (args[0] && args[0].seneca) {
self.private$.seneca = args.shift()
}
if (!args[0]) {
throw new EntityError('Entity name should be provided.')
}
if (args[1]) {
var snapshot = args[1]
}
if (args[2]) {
var events = args[2]
}
var entity = new SourcedEntity(args[0], snapshot, events, self.private$.seneca)
return entity
}
SourcedEntity.prototype.emit = function emit () {
if (!this.replaying) {
var args = Common.arrayify(arguments)
this.private$.seneca.act({role: this.private$.entity_name, event: args.shift(), data: args})
}
}
SourcedEntity.prototype.enqueue = function enqueue () {
if (!this.replaying) {
this.eventsToEmit.push(arguments)
}
}
SourcedEntity.prototype.digest = function digest (command, data) {
if (!this.replaying) {
this.timestamp = Date.now()
this.version = this.version + 1
this.log$(util.format('digesting command \'%s\' w/ data %j', command, data))
this.newEvents.push({
command: command,
data: data,
timestamp: this.timestamp,
version: this.version
})
}
}
SourcedEntity.prototype.merge = function merge (snapshot) {
this.log$(util.format('merging snapshot %j', snapshot))
for (var property in snapshot) {
if (snapshot.hasOwnProperty(property)) {
var val = _.cloneDeep(snapshot[property])
}
this.mergeProperty(property, val)
}
return this
}
SourcedEntity.prototype.mergeProperty = function mergeProperty (name, value) {
if (mergeProperties.size &&
mergeProperties.has(this.__proto__.constructor.name) &&
mergeProperties.get(this.__proto__.constructor.name).has(name) &&
typeof mergeProperties.get(this.__proto__.constructor.name).get(name) === 'function') {
return mergeProperties.get(this.__proto__.constructor.name).get(name).call(this, value)
} else if (typeof value === 'object' && typeof this[name] === 'object') {
_.merge(this[name], value)
} else {
this[name] = value
}
}
SourcedEntity.prototype.replay = function replay (events, done) {
var self = this
this.replaying = true
self.log$(util.format('replaying events %j', events))
var fns = _.map(events, function (event) {
return function (callback) {
var pattern = util.format('role:%s,cmd:%s', self.private$.entity_name, event.command)
var data = _.merge({fatal$: false, entity: self}, event.data)
self.private$.seneca.act(pattern, data, function (err) {
if (err) return callback(err)
self.version = event.version
return callback(null)
})
}
})
async.series(fns, function (err) {
if (err) {
self.log$(err)
return done(err)
}
self.replaying = false
return done(null, {entity: self})
})
}
SourcedEntity.prototype.snapshot = function snapshot () {
this.snapshotVersion = this.version
var snap = _.cloneDeep(this, true)
return this.trimSnapshot(snap)
}
SourcedEntity.prototype.trimSnapshot = function trimSnapshot (snapshot) {
delete snapshot.eventsToEmit
delete snapshot.newEvents
delete snapshot.replaying
delete snapshot._events
delete snapshot._maxListeners
delete snapshot.domain
return snapshot
}
var mergeProperties = new Map()
SourcedEntity.mergeProperty = function (type, name, fn) {
if (!mergeProperties.has(type.name)) mergeProperties.set(type.name, new Map())
mergeProperties.get(type.name).set(name, fn)
}
module.exports = function make_entity (name, seneca) {
return new SourcedEntity(name, null, null, seneca)
}
module.exports.SourcedEntity = SourcedEntity
|
JavaScript
| 0.000001 |
@@ -603,121 +603,8 @@
me%0A%0A
- private$.events_repo = seneca.make('events', name)%0A private$.snapshots_repo = seneca.make('snapshots', name)%0A%0A
th
|
eb37cc10c19415b0fd1ff58d1cfcafd03f166324
|
set arrow element onLoad
|
src/modifiers/arrow.js
|
src/modifiers/arrow.js
|
// @flow
import type { Modifier, ModifierArguments } from '../types';
import getBasePlacement from '../utils/getBasePlacement';
import addClientRectMargins from '../dom-utils/addClientRectMargins';
import getLayoutRect from '../dom-utils/getLayoutRect';
import getMainAxisFromPlacement from '../utils/getMainAxisFromPlacement';
import within from '../utils/within';
import { left, right } from '../enums';
type Options = { element: HTMLElement | string };
export function arrow({ state, options, name }: ModifierArguments<Options>) {
let { element: arrowElement = '[data-popper-arrow]' } = options;
// CSS selector
if (typeof arrowElement === 'string') {
arrowElement = state.elements.popper.querySelector(arrowElement);
if (!arrowElement) {
return state;
}
}
if (!state.elements.popper.contains(arrowElement)) {
if (__DEV__) {
console.error(
'Popper: "arrow" modifier\'s `element` must be a child of the popper element.'
);
}
return state;
}
state.elements.arrow = arrowElement;
const popperOffsets = state.modifiersData.popperOffsets;
const basePlacement = getBasePlacement(state.placement);
const axis = getMainAxisFromPlacement(basePlacement);
const isVertical = [left, right].includes(basePlacement);
const len = isVertical ? 'height' : 'width';
const arrowElementRect = addClientRectMargins(
getLayoutRect(arrowElement),
arrowElement
);
const endDiff =
state.measures.reference[len] +
state.measures.reference[axis] -
popperOffsets[axis] -
state.measures.popper[len];
const startDiff = popperOffsets[axis] - state.measures.reference[axis];
const centerToReference = endDiff / 2 - startDiff / 2;
let center =
state.measures.popper[len] / 2 -
arrowElementRect[len] / 2 +
centerToReference;
// Make sure the arrow doesn't overflow the popper if the center point is
// outside of the popper bounds
center = within(
0,
center,
state.measures.popper[len] - arrowElementRect[len]
);
// Prevents breaking syntax highlighting...
const axisProp: string = axis;
state.modifiersData[name] = { [axisProp]: center };
return state;
}
export default ({
name: 'arrow',
enabled: true,
phase: 'main',
fn: arrow,
requires: ['popperOffsets'],
optionallyRequires: ['preventOverflow'],
}: Modifier<Options>);
|
JavaScript
| 0.00016 |
@@ -485,17 +485,8 @@
ate,
- options,
nam
@@ -526,521 +526,50 @@
%7B%0A
-let %7B element: arrowElement = '%5Bdata-popper-arrow%5D' %7D = options;%0A%0A // CSS selector%0A if (typeof arrowElement === 'string') %7B%0A arrowElement = state.elements.popper.querySelector(arrowElement);%0A%0A if (!arrowElement) %7B%0A return state;%0A %7D%0A %7D%0A%0A if (!state.elements.popper.contains(arrowElement)) %7B%0A if (__DEV__) %7B%0A console.error(%0A 'Popper: %22arrow%22 modifier%5C's %60element%60 must be a child of the popper element.'%0A );%0A %7D%0A%0A return state;%0A %7D%0A%0A state.elements.arrow = arrowElement;%0A
+const arrowElement = state.elements.arrow;
%0A c
@@ -847,16 +847,62 @@
idth';%0A%0A
+ if (!arrowElement) %7B%0A return state;%0A %7D%0A%0A
const
@@ -1750,16 +1750,663 @@
ate;%0A%7D%0A%0A
+function onLoad(%7B state, options %7D: ModifierArguments%3COptions%3E) %7B%0A let %7B element: arrowElement = '%5Bdata-popper-arrow%5D' %7D = options;%0A%0A // CSS selector%0A if (typeof arrowElement === 'string') %7B%0A arrowElement = state.elements.popper.querySelector(arrowElement);%0A%0A if (!arrowElement) %7B%0A return state;%0A %7D%0A %7D%0A%0A if (!state.elements.popper.contains(arrowElement)) %7B%0A if (__DEV__) %7B%0A console.error(%0A %5B%0A 'Popper: %22arrow%22 modifier%5C's %60element%60 must be a child of the popper',%0A 'element.',%0A %5D.join(' ')%0A );%0A %7D%0A%0A return state;%0A %7D%0A%0A state.elements.arrow = arrowElement;%0A%0A return state;%0A%7D%0A%0A
export d
@@ -2466,16 +2466,16 @@
'main',%0A
-
fn: ar
@@ -2479,16 +2479,26 @@
arrow,%0A
+ onLoad,%0A
requir
|
b164a8617044c7767d79e1d53fac71f863d8d5ad
|
Fix regression in logout button position
|
src/mui/layout/Menu.js
|
src/mui/layout/Menu.js
|
import React, { PropTypes } from 'react';
import inflection from 'inflection';
import Paper from 'material-ui/Paper';
import { List, ListItem } from 'material-ui/List';
import { Link } from 'react-router';
import pure from 'recompose/pure';
import compose from 'recompose/compose';
import translate from '../../i18n/translate';
const styles = {
open: {
flex: '0 0 16em',
order: -1,
transition: 'margin 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms',
marginLeft: 0,
},
closed: {
flex: '0 0 16em',
order: -1,
transition: 'margin 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms',
marginLeft: '-16em',
},
};
const translatedResourceName = (resource, translate) =>
translate(`resources.${resource.name}.name`, {
smart_count: 2,
_: resource.options.label ?
translate(resource.options.label, { smart_count: 2, _: resource.options.label }) :
inflection.humanize(inflection.pluralize(resource.name)),
});
const Menu = ({ resources, translate, logout, open }) => (
<Paper style={open ? styles.open : styles.closed}>
<List>
{resources
.filter(r => r.list)
.map(resource =>
<ListItem
key={resource.name}
containerElement={<Link to={`/${resource.name}`} />}
primaryText={translatedResourceName(resource, translate)}
leftIcon={<resource.icon />}
/>,
)
}
</List>
{logout}
</Paper>
);
Menu.propTypes = {
resources: PropTypes.array.isRequired,
translate: PropTypes.func.isRequired,
logout: PropTypes.element,
};
const enhanced = compose(
pure,
translate,
);
export default enhanced(Menu);
|
JavaScript
| 0.000025 |
@@ -459,32 +459,131 @@
0.32, 1) 0ms',%0A
+ display: 'flex',%0A flexDirection: 'column',%0A justifyContent: 'space-between',%0A
marginLe
@@ -718,32 +718,131 @@
0.32, 1) 0ms',%0A
+ display: 'flex',%0A flexDirection: 'column',%0A justifyContent: 'space-between',%0A
marginLe
|
b5db617063ce57a28e8146e47b477f52e461ab77
|
Fix story mutation validation (#37)
|
src/mutations/story.js
|
src/mutations/story.js
|
/**
* Node.js API Starter Kit (https://reactstarter.com/nodejs)
*
* Copyright © 2016-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
/* @flow */
import validator from 'validator';
import { GraphQLNonNull, GraphQLID, GraphQLString } from 'graphql';
import { fromGlobalId, mutationWithClientMutationId } from 'graphql-relay';
import db from '../db';
import StoryType from '../types/StoryType';
import ValidationError from './ValidationError';
const inputFields = {
title: {
type: GraphQLString,
},
text: {
type: GraphQLString,
},
url: {
type: GraphQLString,
},
};
const outputFields = {
story: {
type: StoryType,
},
};
function validate(input, { t, user }) {
const errors = [];
const data = {};
if (!user) {
throw new ValidationError([{ key: '', message: t('Only authenticated users can create stories.') }]);
}
if (typeof input.title === 'undefined' || input.title.trim() === '') {
errors.push({ key: 'title', message: t('The title field cannot be empty.') });
} else if (!validator.isLength(input.title, { min: 3, max: 80 })) {
errors.push({ key: 'title', message: t('The title field must be between 3 and 80 characters long.') });
} else {
data.title = input.title;
}
if (typeof input.url !== 'undefined' && input.url.trim() !== '') {
if (!validator.isLength(input.url, { max: 200 })) {
errors.push({ key: 'url', message: t('The URL field cannot be longer than 200 characters long.') });
} else if (!validator.isURL(input.url)) {
errors.push({ key: 'url', message: t('The URL is invalid.') });
} else {
data.url = input.url;
}
}
if (typeof input.text !== 'undefined' && input.text.trim() !== '') {
if (!validator.isLength(input.url, { min: 20, max: 2000 })) {
errors.push({ key: 'text', message: t('The text field must be between 20 and 2000 characters long.') });
} else {
data.text = input.text;
}
}
if (data.url && data.text) {
errors.push({ key: '', message: t('Please fill either the URL or the text field but not both.') });
} else if (!input.url && !input.text) {
errors.push({ key: '', message: t('Please fill either the URL or the text field.') });
}
data.author_id = user.id;
return { data, errors };
}
const createStory = mutationWithClientMutationId({
name: 'CreateStory',
inputFields,
outputFields,
async mutateAndGetPayload(input, context) {
const { stories } = context;
const { data, errors } = validate(input, context);
if (errors.length) {
throw new ValidationError(errors);
}
const rows = await db.table('stories').insert(data).returning('id');
return stories.load(rows[0]).then(story => ({ story }));
},
});
const updateStory = mutationWithClientMutationId({
name: 'UpdateStory',
inputFields: {
id: { type: new GraphQLNonNull(GraphQLID) },
...inputFields,
},
outputFields,
async mutateAndGetPayload(input, context) {
const { t, user, stories } = context;
const { type, id } = fromGlobalId(input.id);
if (type !== 'Story') {
throw new Error(t('The story ID is invalid.'));
}
const { data, errors } = validate(input, context);
const story = await db.table('stories').where('id', '=', id).first('*');
if (!story) {
errors.push({ key: '', message: 'Failed to save the story. Please make sure that it exists.' });
} else if (story.author_id !== user.id) {
errors.push({ key: '', message: 'You can only edit your own stories.' });
}
if (errors.length) {
throw new ValidationError(errors);
}
data.updated_at = db.raw('CURRENT_TIMESTAMP');
await db.table('stories').where('id', '=', id).update(data);
await stories.clear(id);
return stories.load(id).then(x => ({ story: x }));
},
});
export default {
createStory,
updateStory,
};
|
JavaScript
| 0.000001 |
@@ -1872,27 +1872,28 @@
ength(input.
-url
+text
, %7B min: 20,
|
a0f1fed1ea90fe68cf7488207ba2097b2f0e8de6
|
Fix english
|
src/index.js
|
src/index.js
|
import React, {useEffect, useRef, useState} from 'react'
import PropTypes from 'prop-types'
import ReactSlidySlider from './react-slidy-slider'
function noop() {}
const ReactSlidy = props => {
const [showSlider, setShowSlider] = useState(!props.lazyLoadSlider)
const nodeEl = useRef(null)
useEffect(
function() {
let observer
if (props.lazyLoadSlider) {
const initLazyLoadSlider = () => {
// if we support IntersectionObserver, let's use it
const {offset = 0} = props.lazyLoadConfig
observer = new window.IntersectionObserver(handleIntersection, {
rootMargin: `${offset}px 0px 0px`
})
observer.observe(nodeEl.current)
}
if (!('IntersectionObserver' in window)) {
import('intersection-observer').then(initLazyLoadSlider)
} else {
initLazyLoadSlider()
}
}
return () => observer && observer.disconnect()
},
[] // eslint-disable-line
)
const handleIntersection = ([entry], observer) => {
if (entry.isIntersecting || entry.intersectionRatio > 0) {
observer.unobserve(entry.target)
setShowSlider(true)
}
}
const {children, numOfSlides, sanitize} = props
const numOfSlidesSanitzed = Math.min(
numOfSlides,
React.Children.count(children)
)
return (
<div className={props.classNameBase} ref={nodeEl}>
{showSlider && (
<ReactSlidySlider
parentRef={nodeEl}
{...props}
numOfSlides={sanitize ? numOfSlidesSanitzed : numOfSlides}
>
{props.children}
</ReactSlidySlider>
)}
</div>
)
}
ReactSlidy.propTypes = {
/** Children to be used as slides for the slider */
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
/** Class base to create all clases for elements. Styles might break if you modify it. */
classNameBase: PropTypes.string,
/** Function that will be executed AFTER destroying the slider. Useful for clean up stuff */
doAfterDestroy: PropTypes.func,
/** Function that will be executed AFTER initializing the slider */
doAfterInit: PropTypes.func,
/** Function that will be executed AFTER slide transition has ended */
doAfterSlide: PropTypes.func,
/** Function that will be executed BEFORE slide is happening */
doBeforeSlide: PropTypes.func,
/** Ease mode to use on translations */
ease: PropTypes.string,
/** Determine the number of items that will be preloaded */
itemsToPreload: PropTypes.number,
/** Determine the first slide to start with */
initialSlide: PropTypes.number,
/** Activate navigation by keyboard */
keyboardNavigation: PropTypes.bool,
/** Determine if the slider will be lazy loaded using Intersection Observer */
lazyLoadSlider: PropTypes.bool,
/** Configuration for lazy loading. Only needed if lazyLoadSlider is true */
lazyLoadConfig: PropTypes.shape({
/** Distance which the slider will be loaded */
offset: PropTypes.number
}),
/** Activate navigation by keyboard */
navigateByKeyboard: PropTypes.bool,
/** Number of slides to show at once */
numOfSlides: PropTypes.number,
/** Determine if we want to take sanitize the slides or take numberOfSlider directly */
sanitize: PropTypes.bool,
/** Determine if arrows should be shown */
showArrows: PropTypes.bool,
/** Determine the speed of the sliding animation */
slideSpeed: PropTypes.number,
/** Configure arrow class for determin that arrow is the last one */
tailArrowClass: PropTypes.string
}
ReactSlidy.defaultProps = {
classNameBase: 'react-Slidy',
doAfterDestroy: noop,
doAfterInit: noop,
doAfterSlide: noop,
doBeforeSlide: noop,
itemsToPreload: 1,
initialSlide: 0,
ease: 'ease',
lazyLoadSlider: true,
lazyLoadConfig: {
offset: 150
},
navigateByKeyboard: false,
numOfSlides: 1,
sanitize: true,
slideSpeed: 500,
showArrows: true,
tailArrowClass: 'react-Slidy-arrow--disabled'
}
export default ReactSlidy
|
JavaScript
| 0.999999 |
@@ -3215,21 +3215,16 @@
want to
-take
sanitize
|
86c045c39c072a1c92f802282d815331c069ca07
|
remove useless escaping in regex
|
src/index.js
|
src/index.js
|
'use strict'
import arrayUnique from 'array-unique'
/**
* Retrieve list of Angular modules get/set in file
* @throws {Error} - if fileContents is not passed
* @throws {TypeError} - if fileContents is not a string
* @param {String} fileContents - Angular file contents to be examined
* @returns {String[]} - list of module names get/set in file
*/
module.exports = function (fileContents) {
const modules = []
let match
if (!fileContents) {
throw new Error('Expected file contents to be passed')
}
if (typeof fileContents !== 'string') {
throw new TypeError('Expected file contents to be a string')
}
const regex = /angular[\s]*[.]module[\(]?[\s]*'([^']*)'[^\)angular]*[\)]?/g
match = regex.exec(fileContents)
while (match && match[1]) {
modules.push(match[1])
match = regex.exec(fileContents)
}
return arrayUnique(modules)
}
|
JavaScript
| 0.000002 |
@@ -662,17 +662,16 @@
%5Dmodule%5B
-%5C
(%5D?%5B%5Cs%5D*
@@ -681,17 +681,16 @@
%5E'%5D*)'%5B%5E
-%5C
)angular
@@ -692,17 +692,16 @@
gular%5D*%5B
-%5C
)%5D?/g%0A%0A
|
f86f99d172274712b6d169928d1ee6b51c0108ba
|
tweak logic
|
src/index.js
|
src/index.js
|
var Promise = require('i-promise');
var getRetryCounts = require('./get-retry-counts');
module.exports = repromise;
function repromise(options, fn) {
return new Promise((resolve, reject)=>{
if (arguments.length < 1) throw new Error('No arguments specified');
if (arguments.length == 1) {
fn = options;
options = {};
}
if (typeof fn !== 'function') throw new Error('Function is required');
fn = wrap(fn);
var retries = getRetryCounts(options); //array of setTimeout values for retries
return fn().catch((err)=>retry(resolve,reject,retries,fn)(err));
});
}
function retry(resolve, reject, retries, fn) {
//return handle to wrapped function
return onError;
//wrapped function for error/retry handler
function onError(err) {
if (!retries.length) return reject(err);
setTimeout(()=>fn().then(resolve, onError), retries.shift());
}
}
function wrap(fn) {
return function(){
try {
return Promise.resolve(fn());
} catch(err) {
return Promise.reject(err);
}
};
}
|
JavaScript
| 0.000001 |
@@ -151,46 +151,12 @@
%7B%0A
-return new Promise((resolve, reject)=%3E
+try
%7B%0A
@@ -183,22 +183,38 @@
th %3C 1)
-throw
+return Promise.reject(
new Erro
@@ -240,16 +240,17 @@
cified')
+)
;%0A if
@@ -360,14 +360,30 @@
n')
-throw
+return Promise.reject(
new
@@ -411,16 +411,17 @@
quired')
+)
;%0A%0A f
@@ -548,16 +548,46 @@
((err)=%3E
+new Promise((resolve,reject)=%3E
retry(re
@@ -620,15 +620,63 @@
rr))
+)
;%0A %7D
-);
+ catch(err) %7B%0A return Promise.reject(err);%0A %7D
%0A%7D%0A%0A
|
441b86ad051deaaf71aede46f4281c88c2a32b4f
|
fix Object.keys usage
|
src/index.js
|
src/index.js
|
import isPlainObject from 'is-plain-object'
const _encode = value => Array.isArray(value) && !value.length ? '[]' : encodeURI(value)
const encodeParam = (value, key) => {
if (isPlainObject(value)) {
return Object.keys(value).reduce((memo, _key) => {
return `${memo}${key}[${_key}]=${_encode(value[_key])}&`
}, '')
} else {
return `${key}=${_encode(value)}&`
}
}
export const encodeParams = (params = {}) => {
if (!isPlainObject(params)) throw new Error('encodeParams expects a plain object')
return Object.keys(params).reduce((memo, key) =>
`${memo}${encodeParam(params[key], key)}`
, '').slice(0,-1)
}
export default (baseUrl = '', baseParams = {}) =>
(relativeUrl, params = {}) => {
if (relativeUrl.charAt(0) !== '/') {
relativeUrl = `/${relativeUrl}`
}
const separator = relativeUrl.includes('?') ? '&' : '?'
// doing this because baseParams should be overridden by params,
// but preferable to havebaseParams at end of querystring
// (even if key order not fully guaranteed)
params = Object.keys(baseParams).reduce((memo, k, v) => {
if (memo[k]) return memo
memo[k] = v
return memo
}, {...params})
return `${baseUrl}${relativeUrl}${separator}${encodeParams(params)}`
}
|
JavaScript
| 0.000053 |
@@ -1170,11 +1170,8 @@
o, k
-, v
) =%3E
@@ -1232,17 +1232,29 @@
mo%5Bk%5D =
-v
+baseParams%5Bk%5D
%0A
|
16b5918770542c66bd4c53c32f4fcb4c903400d1
|
feat(def): add def method
|
src/index.js
|
src/index.js
|
// @flow
/**
* class-component.js v13.0.0
* author: Yoshiya Hinosawa ( http://github.com/kt3k )
* license: MIT
*/
import './decorators.js'
import { register as cc, init, ccc } from './register-and-init.js'
import check, { checkClassNamesAreStringOrNull, checkComponentNameIsValid } from './assert.js'
import $ from './jquery.js'
import { COELEMENT_DATA_KEY_PREFIX } from './const'
cc.init = init
// Expose __ccc__
cc.__ccc__ = ccc
/**
* Initializes the given element with the class-component of the given name.
* @param name The name of the class component
* @param el The element to initialize
*/
cc.el = (name: string, el: HTMLElement) => {
checkComponentNameIsValid(name)
ccc[name](el)
}
/**
* Gets the eoelement instance of the class-component of the given name
* @param name The class-component name
* @param el The element
*/
const get = cc.get = (name: string, el: HTMLElement) => {
checkComponentNameIsValid(name)
const coelement = (el: any)[COELEMENT_DATA_KEY_PREFIX + name]
check(coelement, `no coelement named: ${name}, on the dom: ${el.tagName}`)
return coelement
}
// Initializes the jquery things.
if (!$.cc) {
$.cc = cc
const descriptor: any = { get () {
const $el = this
const dom: HTMLElement = $el[0]
check(dom != null, 'cc (class-component context) is unavailable at empty dom selection')
let cc = (dom: any).cc
if (!cc) {
/**
* Initializes the element as class-component of the given names. If the names not given, then initializes it by the class-component of the class names it already has.
* @param {?string} classNames The class component names
* @return {jQuery}
*/
cc = (dom: any).cc = (classNames: ?string) => {
checkClassNamesAreStringOrNull(classNames)
;(classNames || dom.className).split(/\s+/).map(className => {
if (ccc[className]) {
ccc[className]($el.addClass(className)[0])
}
})
return $el
}
/**
* Gets the coelement of the given name.
* @param {string} name The name of the coelement
* @return {Object}
*/
cc.get = (name: string) => get(name, dom)
cc.init = (className: string) => cc(className).cc.get(className)
}
return cc
} }
// Defines the special property cc on the jquery prototype.
Object.defineProperty($.fn, 'cc', descriptor)
}
|
JavaScript
| 0.999676 |
@@ -395,16 +395,29 @@
= init%0A%0A
+cc.def = cc%0A%0A
// Expos
|
d6516f450d26d3315e0312313c5e9beb94d52e5c
|
Add tslint-eslint-rules
|
src/index.js
|
src/index.js
|
module.exports = {
rules: {
// tslint (https://palantir.github.io/tslint/rules/)
"align": false,
"eofline": false,
"import-spacing": false,
"indent": false,
"linebreak-style": false,
"max-line-length": false,
"new-parens": false,
"no-consecutive-blank-lines": false,
"no-irregular-whitespace": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"one-line": false,
"quotemark": false,
"semicolon": false,
"space-before-function-paren": false,
"trailing-comma": false,
"whitespace": false,
// tslint-react (https://github.com/palantir/tslint-react)
"jsx-alignment": false,
"jsx-curly-spacing": false,
"jsx-no-multiline-js": false,
"jsx-wrap-multiline": false,
// tslint-eslint-rules (https://github.com/buzinas/tslint-eslint-rules)
}
}
|
JavaScript
| 0 |
@@ -848,15 +848,318 @@
-rules)%0A
+ %22block-spacing%22: false,%0A %22brace-style%22: false,%0A %22no-multi-spaces%22: false,%0A %22object-curly-spacing%22: false,%0A %22space-in-parens%22: false,%0A %22ter-arrow-parens%22: false,%0A %22ter-arrow-spacing%22: false,%0A %22ter-indent%22: false,%0A %22ter-max-len%22: false,%0A %22ter-no-irregular-whitespace%22: false
%0A %7D%0A%7D%0A
|
b6113c7f5ee25d2a9442f38b47ab5bfd9ed0ae67
|
add performJob method
|
src/index.js
|
src/index.js
|
var q = require('q');
/**
* A tool for creating and processing background jobs
* @class JobQueueService
* @param {StorageService} storage an instance of le-storage-service that is used to create records
* @returns {service}
*/
var JobQueueService = function (storage) {
if (!storage) { throw new Error('Instance of storage service required'); }
var _storage = storage;
/**
* Stores a new job to process
* @function addJob
* @memberof JobQueueService
* @instance
* @param {string} type the type of the job, used to determine how it should be processed
* @param {string} data the data necessary to complete the job
* @returns {promise} resolves with the newly created job record
*/
this.addJob = function (type, data) {
var record = _storage.createRecord('_queue/task')
return record
.update({
type: type,
data: data
})
.then(function () { return record; });
}
/**
* Creates a worker to process the jobs in the queue
* @function createWorker
* @memberof JobQueueService
* @instance
* @param {JobQueueProvider} provider the provider this service delegates to
* @param {Function} processJob function that processes the job. Called with two params `job` and `complete`. This function must call `complete()` to finish processing a job
*/
this.createWorker = function (provider, processJob) {
if (!provider) { throw new Error('Job queue provider required'); }
if (!processJob) { throw new Error('Process job callback required'); }
provider.createWorker(processJob);
}
}
module.exports = JobQueueService;
|
JavaScript
| 0.000067 |
@@ -925,24 +925,710 @@
;%0A %7D%0A /**%0A
+ * Stores a new job and resolve when the job is complete%0A * @function performJob%0A * @memberof JobQueueService%0A * @instance%0A * @param %7Bstring%7D type the type of the job, used to determine how it should be processed%0A * @param %7Bstring%7D data the data necessary to complete the job%0A * @returns %7Bpromise%7D resolves when the task is complete%0A */%0A this.performJob = function (type, data) %7B%0A var deferred = q.defer();%0A this.addJob(type, data)%0A .then(function (record) %7B%0A record.sync(function (recordData) %7B%0A if (recordData === null) %7B%0A record.unsync();%0A deferred.resolve();%0A %7D%0A %7D);%0A %7D);%0A return deferred.promise;%0A %7D%0A /**%0A
* Creates
|
f927d1ff8d8eed2778f98c2746d9535d12547ce1
|
use resolved stage value when stage is NOT passed in as options
|
src/index.js
|
src/index.js
|
'use strict';
class BinarySupport {
constructor(serverless, options) {
this.options = options || {};
this.serverless = serverless;
this.mimeTypes = this.serverless.service.custom.apigwBinary.types;
this.provider = this.serverless.getProvider(this.serverless.service.provider.name);
this.stage = this.options.stage || this.serverless.service.provider.stage;
this.hooks = {
'after:deploy:deploy': this.afterDeploy.bind(this)
};
}
getApiId() {
return new Promise(resolve => {
this.provider.request('CloudFormation', 'describeStacks', {StackName: this.provider.naming.getStackName(this.stage)}).then(resp => {
const output = resp.Stacks[0].Outputs;
let apiUrl;
output.filter(entry => entry.OutputKey.match('ServiceEndpoint')).forEach(entry => apiUrl = entry.OutputValue);
const apiId = apiUrl.match('https:\/\/(.*)\\.execute-api')[1];
resolve(apiId);
});
});
}
putSwagger(apiId, swagger) {
return this.provider.request('APIGateway', 'putRestApi', {restApiId: apiId, mode: 'merge', body: swagger});
}
createDeployment(apiId) {
return this.provider.request('APIGateway', 'createDeployment', {restApiId: apiId, stageName: this.stage});
}
getApiGatewayName(){
if(this.serverless.service.resources && this.serverless.service.resources.Resources){
const Resources = this.serverless.service.resources.Resources;
for(let key in Resources){
if(Resources.hasOwnProperty(key)){
if(Resources[key].Type==='AWS::ApiGateway::RestApi'
&& Resources[key].Properties.Name){
return Resources[key].Properties.Name;
}
}
}
}
return this.provider.naming.getApiGatewayName();
}
afterDeploy() {
const swaggerInput = JSON.stringify({
"swagger": "2.0",
"info": {
"title": this.getApiGatewayName()
},
"x-amazon-apigateway-binary-media-types": this.mimeTypes
});
return this.getApiId().then(apiId => {
return this.putSwagger(apiId, swaggerInput).then(() => {
return this.createDeployment(apiId);
});
});
}
}
module.exports = BinarySupport;
|
JavaScript
| 0.000002 |
@@ -298,88 +298,8 @@
e);%0A
- this.stage = this.options.stage %7C%7C this.serverless.service.provider.stage;%0A%0A
@@ -393,16 +393,21 @@
etApiId(
+stage
) %7B%0A
@@ -503,16 +503,17 @@
acks', %7B
+
StackNam
@@ -553,19 +553,15 @@
ame(
-this.
stage)
+
%7D).t
@@ -905,34 +905,32 @@
swagger) %7B%0A
-
return this.prov
@@ -967,24 +967,25 @@
tRestApi', %7B
+
restApiId: a
@@ -1018,16 +1018,17 @@
swagger
+
%7D);%0A %7D%0A
@@ -1052,22 +1052,27 @@
nt(apiId
+, stage
) %7B%0A
-
retu
@@ -1131,16 +1131,17 @@
ment', %7B
+
restApiI
@@ -1165,18 +1165,14 @@
me:
-this.
stage
+
%7D);%0A
@@ -1201,16 +1201,17 @@
me()
+
%7B%0A if
(thi
@@ -1206,16 +1206,17 @@
%7B%0A if
+
(this.se
@@ -1281,32 +1281,33 @@
urces.Resources)
+
%7B%0A const Re
@@ -1315,17 +1315,16 @@
ources =
-
this.se
@@ -1370,16 +1370,17 @@
for
+
(let key
@@ -1393,16 +1393,17 @@
sources)
+
%7B%0A
@@ -1398,32 +1398,33 @@
es) %7B%0A if
+
(Resources.hasOw
@@ -1438,16 +1438,17 @@
ty(key))
+
%7B%0A
@@ -1453,16 +1453,17 @@
if
+
(Resourc
@@ -1478,11 +1478,13 @@
Type
+
===
+
'AWS
@@ -1518,18 +1518,16 @@
-
&& Resou
@@ -1552,16 +1552,17 @@
es.Name)
+
%7B%0A
@@ -1574,17 +1574,16 @@
return
-
Resource
@@ -1921,16 +1921,96 @@
%0A %7D);
+%0A const stage = this.options.stage %7C%7C this.serverless.service.provider.stage;
%0A%0A re
@@ -2028,16 +2028,21 @@
etApiId(
+stage
).then(a
@@ -2152,24 +2152,31 @@
oyment(apiId
+, stage
);%0A %7D);
|
47bbda08d97240f6f33dee59654d399bd2755e5a
|
Remove GenerateMeshBVHWorker export
|
src/index.js
|
src/index.js
|
export { MeshBVH } from './core/MeshBVH.js';
export { MeshBVHVisualizer } from './objects/MeshBVHVisualizer.js';
export { CENTER, AVERAGE, SAH, NOT_INTERSECTED, INTERSECTED, CONTAINED } from './core/Constants.js';
export { getBVHExtremes, estimateMemoryInBytes, getJSONStructure, validateBounds } from './debug/Debug.js';
export { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from './utils/ExtensionUtilities.js';
export { getTriangleHitPointInfo } from './utils/TriangleUtilities.js';
export * from './gpu/MeshBVHUniformStruct.js';
export * from './gpu/shaderFunctions.js';
export * from './gpu/VertexAttributeTexture.js';
export * from './workers/GenerateMeshBVHWorker.js';
|
JavaScript
| 0 |
@@ -635,56 +635,4 @@
s';%0A
-export * from './workers/GenerateMeshBVHWorker.js';%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.