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
|
---|---|---|---|---|---|---|---|
8e62f0718b8fa9e3dcf2b5b9fc1a6034507e98f9
|
Create component nodes
|
plugins/AppImporter/AppImporter.js
|
plugins/AppImporter/AppImporter.js
|
define(['plugin/PluginBase', 'plugin/PluginConfig', 'path',
'../utils/WebgmeUtils', '../utils/NescUtils'],
function (PluginBase, PluginConfig, path, wgme_utils, nesc_utils) {
'use strict';
var AppImporter = function () {
PluginBase.call(this);
};
AppImporter.prototype = Object.create(PluginBase.prototype);
AppImporter.prototype.constructor = AppImporter;
AppImporter.prototype.getName = function () {
return "AppImporter";
};
AppImporter.prototype.getVersion = function () {
return '0.0.0';
};
AppImporter.prototype.main = function (callback) {
var self = this;
var core = self.core;
var log = self.logger;
var async = require('async');
var save = true;
var app_path = path.resolve(process.env.TOSROOT, 'apps', 'Blink', 'BlinkAppC.nc');
var cwp = core.getRegistry(self.rootNode, 'configuration_paths');
var mwp = core.getRegistry(self.rootNode, 'module_paths');
var fwp = core.getRegistry(self.rootNode, 'folder_paths');
var paths_arr = [
{ paths: cwp, depth: 1 },
{ paths: mwp, depth: 2 },
{ paths: fwp, depth: 0 }
];
var reg_obj = {
cwp: cwp,
mwp: mwp,
fwp: fwp
};
async.parallel([
function (callback) {
wgme_utils.loadObjects.call(self, paths_arr, callback);
},
function (callback) {
nesc_utils.getAppJson(app_path, callback);
}
],
function (err, results) {
if (err) {
log.info(err);
self.result.setSuccess(false);
return callback(null, self.result);
}
self.run(results[1], results[0], reg_obj);
var fs = require('fs-extra');
fs.outputJsonSync('temp/BlinkAppC.json', results[1], {spaces: 2});
if (save) {
self.save('save', function (err) {
call_callback(true);
});
} else call_callback(true);
});
function call_callback (success) {
self.result.setSuccess(success);
callback(null, self.result);
}
};
AppImporter.prototype.run = function (app_json, nodes, reg_obj) {
var self = this;
// Create components
var components = app_json.components;
for (var c_name in components) {
if ( nodes[c_name] === undefined ) {
var comp_json = components[c_name];
var parent = wgme_utils.mkdirp.call(self, comp_json.file_path, nodes, reg_obj.fwp);
var base = wgme_utils.getMetaNode.call(self, nesc_utils.getBase(comp_json));
self.createNode(c_name, parent, base);
}
}
self.core.setRegistry(self.rootNode, 'folder_paths', reg_obj.fwp);
};
AppImporter.prototype.createNode = function(name, parent, base) {
this.logger.info('', 'to be created', name);
};
return AppImporter;
});
|
JavaScript
| 0.000001 |
@@ -1134,16 +1134,42 @@
p%0A %7D;%0A%0A
+ log.info('', reg_obj);%0A%0A
async.
@@ -2001,16 +2001,40 @@
= this;%0A
+ var core = self.core;%0A
// Cre
@@ -2380,24 +2380,39 @@
son));%0A
+ var new_node =
self.create
@@ -2447,198 +2447,689 @@
-%7D%0A %7D%0A self.core.setRegistry(self.rootNode, 'folder_paths', reg_obj.fwp);%0A%7D;%0A%0AAppImporter.prototype.createNode = function(name, parent, base) %7B%0A this.logger.info('', 'to be created', name)
+ core.setAttribute(new_node, 'safe', comp_json.safe);%0A cache_and_register();%0A %7D%0A %7D%0A%0A function cache_and_register () %7B%0A nodes%5Bc_name%5D = new_node;%0A%0A if ( comp_json.comp_type === 'Configuration')%0A var wp = reg_obj.cwp;%0A else if ( comp_json.comp_type === 'Module')%0A wp = reg_obj.mwp;%0A wp%5Bc_name%5D = core.getPath(new_node);%0A%0A core.setRegistry(new_node, 'nesc-dump', comp_json);%0A // TODO: set call graph and tasks in registry%0A %7D%0A%0A%7D;%0A%0AAppImporter.prototype.createNode = function(name, parent, base) %7B%0A var new_node = this.core.createNode(%7B%0A parent: parent,%0A base: base%0A %7D);%0A this.core.setAttribute(new_node, 'name', name);%0A return new_node
;%0A%7D;
|
3623a9129743857de241167d633bdb18c9bbe75c
|
Use KeyboardEvent.key instead of code
|
buttons.js
|
buttons.js
|
import { Mixin, InitialRender } from './ce';
import { triggerEvent } from './events';
import { DisableBehavior } from './disabled';
import { FocusableBehavior } from './focus';
/**
* Mixin that provides the behavior of a button. This set the role of the
* element to `button`, add support for disabling it and normalize the
* keyboard behavior.
*/
export let ButtonBehavior = Mixin(ParentClass => class extends ParentClass.with(DisableBehavior, FocusableBehavior, InitialRender) {
initialRenderCallback() {
super.initialRenderCallback();
// Mark this element as a button
this.setAttribute('role', 'button');
/*
* Listener that listens for a key press of Enter or Space and
* emits a press event.
*/
this.addEventListener('keypress', e => {
switch(e.code) {
case 'Enter':
case 'Space':
e.preventDefault();
if(! this.disabled) {
triggerEvent(this, 'click');
}
}
});
}
});
|
JavaScript
| 0.000002 |
@@ -777,12 +777,11 @@
h(e.
-code
+key
) %7B%0A
|
f78f3b55e241220d934047cd9326deea2a9c1ef8
|
add satellite layer
|
corehq/apps/reports_core/static/reports_core/js/maps.js
|
corehq/apps/reports_core/static/reports_core/js/maps.js
|
var maps = (function() {
var fn = {};
fn.init_map = function (config, mapContainer) {
if (!fn.hasOwnProperty('map')) {
mapContainer.show();
mapContainer.empty();
fn.map = L.map(mapContainer[0], {trackResize: false}).setView([0, 0], 3);
var mapId = 'mapbox.streets';
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
maxZoom: 18,
id: mapId,
accessToken: config.mapboxAccessToken
}).addTo(fn.map);
L.control.scale().addTo(fn.map);
fn.layerControl = L.control.layers();
fn.layerControl.addTo(fn.map);
new ZoomToFitControl().addTo(fn.map);
$('#zoomtofit').css('display', 'block');
} else {
if (fn.map.activeOverlay) {
fn.map.removeLayer(fn.map.activeOverlay);
fn.layerControl.removeLayer(fn.map.activeOverlay);
fn.map.activeOverlay = null;
}
}
};
fn.initPopupTempate = function (config) {
if (!fn.template) {
var rows = _.map(config.columns, function (col) {
var tr = _.template("<tr><td><%= label %></td>")(col);
tr += "<td><%= " + col.column_id + "%></td></tr>";
return tr;
});
var table = '<table class="table table-bordered"><%= rows %></table>';
var template = _.template(table)({rows: rows.join('')});
fn.template = _.template(template);
}
};
fn.render = function (config, data, mapContainer) {
fn.init_map(config, mapContainer);
fn.initPopupTempate(config);
var bad_re = /[a-zA-Z()]+/;
var points = _.compact(_.map(data, function (row) {
var val = row[config.location_column_id];
if (val !== null && !bad_re.test(val)) {
var latlon = val.split(" ").slice(0, 2);
return L.marker(latlon).bindPopup(fn.template(row));
}
}));
if (points.length > 0) {
var overlay = L.featureGroup(points);
fn.layerControl.addOverlay(overlay, config.layer_name);
overlay.addTo(fn.map);
fn.map.activeOverlay = overlay;
zoomToAll(fn.map);
}
};
return fn;
})();
|
JavaScript
| 0 |
@@ -44,385 +44,593 @@
-fn.init_map = function (config, mapContainer) %7B%0A if (!fn.hasOwnProperty('map')) %7B%0A mapContainer.show();%0A mapContainer.empty();%0A fn.map = L.map(mapContainer%5B0%5D, %7BtrackResize: false%7D).setView(%5B0, 0%5D, 3);%0A var mapId = 'mapbox.streets';%0A L.tileLayer('https://api.tiles.mapbox.com/v4/%7Bid%7D/%7Bz%7D/%7Bx%7D/%7By%7D.png?access_token=%7Ba
+var getTileLayer = function (layerId, accessToken) %7B%0A return L.tileLayer('https://api.mapbox.com/v4/%7Bid%7D/%7Bz%7D/%7Bx%7D/%7By%7D.png?access_token=%7BaccessToken%7D', %7B%0A id: layerId,%0A accessToken: accessToken,%0A maxZoom: 17%0A %7D);%0A %7D;%0A%0A fn.init_map = function (config, mapContainer) %7B%0A if (!fn.hasOwnProperty('map')) %7B%0A mapContainer.show();%0A mapContainer.empty();%0A var streets = getTileLayer('mapbox.streets', config.mapboxAccessToken),%0A satellite = getTileLayer('mapbox.satellite', config.mapboxA
cces
@@ -627,37 +627,35 @@
apboxAccessToken
-%7D', %7B
+);%0A
%0A
@@ -655,136 +655,148 @@
- maxZoom: 18,%0A id: mapId,%0A accessToken: config.mapboxAccessToken%0A %7D).addTo(fn.map
+fn.map = L.map(mapContainer%5B0%5D, %7B%0A trackResize: false,%0A layers: %5Bstreets%5D%0A %7D).setView(%5B0, 0%5D, 3
);%0A
+%0A
@@ -829,32 +829,172 @@
addTo(fn.map);%0A%0A
+ var baseMaps = %7B%7D;%0A baseMaps%5Bgettext(%22Streets%22)%5D = streets;%0A baseMaps%5Bgettext(%22Satellite%22)%5D = satellite;%0A%0A
fn.l
@@ -1024,16 +1024,24 @@
.layers(
+baseMaps
);%0A
|
47ff052c22f721b72f98243440f7f8a2531d85cb
|
fix close and unclose link via ajax
|
openslides/agenda/static/javascript/agenda.js
|
openslides/agenda/static/javascript/agenda.js
|
/**
* OpenSlides agenda functions
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
function hideLine(object) {
if (object == []) {
return;
}
object.hide();
id = object.children('td.tabledrag-hide').children('input.menu-mlid').attr('value');
$('.menu-plid[value=\'' + id + '\']').parent().parent().each(function() {
hideLine($(this));
});
}
function hideClosedSlides(hide) {
if (hide) {
$('#hidelink').attr('title', 'show');
$('#hidelink').removeClass('hide').addClass('show');
$('.close_link.closed').parent().parent().each(function() {
hideLine($(this));
});
hidden = $('#menu-overview tr:hidden').size();
$('#hiddencount').text(', davon ' + hidden + ' verborgen.');
} else {
$('#menu-overview tr').show();
$('#hidelink').attr('title','hide');
$('#hidelink').removeClass('show').addClass('hide');
$('#hiddencount').text('');
}
return false;
}
$(function() {
$('.close_link').click(function(event) {
event.preventDefault();
slide = $(this);
$.ajax({
type: 'GET',
url: slide.attr('href'),
dataType: 'json',
success: function(data) {
if (data.closed) {
newclass = 'closed';
} else {
newclass = 'open';
}
slide.removeClass('closed open').addClass(newclass);
slide.attr('href', data.link);
}
});
});
// filter to show/hide closed items
$('#hide_closed_items').click(function(event) {
// show all items
if ($.cookie('Slide.HideClosed') == 1) {
$.cookie('Slide.HideClosed', 0);
hideClosedSlides(false);
$('#hide_closed_items').attr('checked', false);
}
else { // hide closed items
$.cookie('Slide.HideClosed', 1);
hideClosedSlides(true);
$('#hide_closed_items').attr('checked', true);
}
});
if ($.cookie('Slide.HideClosed') === null) {
$('#hide_closed_items').attr('checked', false);
$.cookie('Slide.HideClosed', 0);
} else if ($.cookie('Slide.HideClosed') == 1) {
hideClosedSlides(true);
$('#hide_closed_items').attr('checked', true);
}
});
|
JavaScript
| 0 |
@@ -1091,16 +1091,18 @@
ose_link
+ a
').click
@@ -1504,16 +1504,25 @@
slide.
+parent().
removeCl
|
0a6cadec2f1280ed4c4fca88a226d9c6a16fb081
|
Check if maxResults is defined
|
src/bestResults.js
|
src/bestResults.js
|
'use strict';
module.exports = bestResults;
/* we have 2 criteria to find the best results
1. best match per zone based on the bestOf parameter
2. maxResults : maximal number of results
*/
function bestResults(results, bestOf, maxResults, minSimilarity) {
var newResults = [];
// in order to find the bestOf we will sort by similarity and take all of them for which there is nothing in a range
// of the bestOf range
results.sort(function (a, b) {
return b.similarity - a.similarity;
});
if (minSimilarity) {
for (var i = 0; i < results.length; i++) {
if (results[i].similarity < minSimilarity) {
results = results.slice(0, i);
break;
}
}
}
if (bestOf) {
for (var i = 0; i < results.length && newResults.length < maxResults; i++) {
for (var j = 0; j < newResults.length; j++) {
if (Math.abs(newResults[j].msem - results[i].msem) < (bestOf / (results[i].charge || 1))) {
break;
}
}
if (j == newResults.length) {
newResults.push(results[i]);
}
}
} else {
newResults = results.slice(0, maxResults);
}
return newResults;
};
|
JavaScript
| 0.000002 |
@@ -815,42 +815,8 @@
ngth
- && newResults.length %3C maxResults
; i+
@@ -1183,28 +1183,97 @@
newResults
- = r
+=results.slice(0);%0A %7D%0A%0A if (maxResults) %7B%0A newResults = newR
esults.slice
|
6435f9280a163f3fd3dd76a1ec40473ad6d6927b
|
Improve idagio connector (#2648)
|
src/connectors/idagio.js
|
src/connectors/idagio.js
|
'use strict';
const symphonySelector = '.player-PlayerInfo__infoEl--2jhHY span:nth-child(3) span:first-child';
const commonNameSelector = '.player-PlayerInfo__infoEl--2jhHY span:nth-child(3) span:nth-child(2)';
const directorSelector = '.player-PlayerInfo__recordingInfo--15VMv>span:first-child span';
const trackSelector = '.player-PlayerInfo__infoEl--2jhHY';
const pauseButtonSelector = '.player-PlayerControls__btn--1r-vy:nth-child(2) .util-IconLabel__component--3Uitr span';
Connector.playerSelector = '.player-PlayerBar__bar--2yos_';
Connector.artistSelector = '.player-PlayerInfo__infoEl--2jhHY span:first-child';
Connector.getTrack = getCurrentTrack;
Connector.getAlbum = getCurrentSymphony;
Connector.currentTimeSelector = '.player-PlayerProgress__progress--2F0qB>span';
Connector.durationSelector = '.player-PlayerProgress__timeTotal--3aHlj span';
Connector.isPlaying = () => Util.getTextFromSelectors(pauseButtonSelector) === 'Pause';
Connector.isScrobblingAllowed = () => Util.getTextFromSelectors('.player-PlayerInfo__recordingInfo--15VMv') !== 'Sponsor message';
function getCurrentTrack() {
return Util.getTextFromSelectors(trackSelector).split(' – ').slice(1).join(': ');
}
function getCurrentSymphony() {
const symphonyShort = Util.getTextFromSelectors(symphonySelector).split(/ in [A-G]| op. [0-9]| KV [0-9]/)[0];
const commonName = Util.getTextFromSelectors(commonNameSelector) || '';
const director = removeParenthesis(Util.getTextFromSelectors(directorSelector));
return `${symphonyShort}${commonName} (${director})`;
}
function removeParenthesis(text) {
return text.replace(/\s*\(.*?\)\s*/g, '');
}
|
JavaScript
| 0 |
@@ -1113,88 +1113,1522 @@
%7B%0A%09
-return Util.getTextFromSelectors(trackSelector).split('%C2%A0%E2%80%93%C2%A0').slice(1).join(': ')
+/*%0A%09 * Idagio puts composer and piece all in the same div element, so we have to undo this.%0A%09 * First split the tag by dashes. Include spaces to avoid issues with names containing dashes.%0A%09 * The first part is the composer name. We want to exclude this, so we slice it off.%0A%09 * Then, replace the dashes with colons, this makes the tag more in line with what is expected.%0A%09 * Finally, trim as a %22just in case%22 in preparation for the next step. Unnecessary in the cases I've seen, but extremely simple and might prevent something down the line.%0A%09 * Example from https://app.idagio.com/albums/saint-saens-violin-sonata-no-1-cello-sonata-no-1-and-piano-trio-no-2:%0A%09 * %22Camille Saint-Sa%C3%ABns %E2%80%93 Sonata for Violin and Piano No. 1 in D minor op. 75 R 123 %E2%80%93 I. Allegro agitato %E2%80%93%22%0A%09 * -%3E %5B%22Camille Saint-Sa%C3%ABns%22, %22Sonata for Violin and Piano No. 1 in D minor op. 75 R 123%22, %22I. Allegro agitato %E2%80%93%22%5D%0A%09 * -%3E %5B%22Sonata for Violin and Piano No. 1 in D minor op. 75 R 123%22, %22I. Allegro agitato %E2%80%93%22%5D%0A%09 * -%3E %22Sonata for Violin and Piano No. 1 in D minor op. 75 R 123: I. Allegro agitato %E2%80%93%22%0A%09 */%0A%09let track = Util.getTextFromSelectors(trackSelector).split('%C2%A0%E2%80%93%C2%A0').slice(1).join(': ').trim();%0A%09/*%0A%09 * Now remove trailing dash if exists.%0A%09 * Example: %22Sonata for Violin and Piano No. 1 in D minor op. 75 R 123: I. Allegro agitato %E2%80%93%22%0A%09 * -%3E %22Sonata for Violin and Piano No. 1 in D minor op. 75 R 123: I. Allegro agitato %22 (the space is trimmed later in core)%0A%09 */%0A%09if (track.slice(-1) === '%E2%80%93') %7B%0A%09%09track = track.slice(0, -1);%0A%09%7D%0A%09return track
;%0A%7D%0A
|
20c108ddc20b70da45f686bfe2235f964f321197
|
simplify each
|
lib/api/traversing.js
|
lib/api/traversing.js
|
var _ = require('underscore'),
select = require('cheerio-select'),
utils = require('../utils'),
isTag = utils.isTag;
var find = exports.find = function(selector) {
try {
var elem = select(selector, [].slice.call(this.children()));
return this.make(elem);
} catch(e) {
return this.make([]);
}
};
var parent = exports.parent = function(elem) {
if (this[0] && this[0].parent)
return this.make(this[0].parent);
else
return this;
};
var next = exports.next = function() {
var elem = this[0];
while ((elem = elem.next)) if (isTag(elem)) return this.make(elem);
return this.make([]);
};
var prev = exports.prev = function() {
var elem = this[0];
while ((elem = elem.prev)) if (isTag(elem)) return this.make(elem);
return this.make([]);
};
var siblings = exports.siblings = function(elem) {
return this.make(_.filter(
this.parent() ? this.parent().children() : this.siblingsAndMe(),
function(elem) { return isTag(elem) && elem !== this[0]; },
this
));
};
var children = exports.children = function(selector) {
var elems = _.reduce(this, function(memo, elem) {
return memo.concat(_.filter(elem.children, isTag));
}, []);
if (selector === undefined) return this.make(elems);
else if (_.isNumber(selector)) return this.make(elems[selector]);
return this.make(elems).filter(selector);
};
var each = exports.each = function(fn) {
var length = this.length,
el, i;
for (i = 0; i < length; ++i) {
el = this[i];
if (fn.call(this.make(el), i, el) === false) {
break;
}
}
return this;
};
var map = exports.map = function(fn) {
return _.map(this, function(el, i) {
return fn.call(this.make(el), i, el);
}, this);
};
var filter = exports.filter = function(match) {
var make = _.bind(this.make, this);
return make(_.filter(this, _.isString(match) ?
function(el) { return select(match, el)[0] === el; }
: function(el, i) { return match.call(make(el), i, el); }
));
};
var first = exports.first = function() {
return this[0] ? this.make(this[0]) : this;
};
var last = exports.last = function() {
return this[0] ? this.make(this[this.length - 1]) : this;
};
// Reduce the set of matched elements to the one at the specified index.
var eq = exports.eq = function(i) {
i = +i;
if (i < 0) i = this.length + i;
return this[i] ? this.make(this[i]) : this.make([]);
};
var slice = exports.slice = function() {
return this.make([].slice.apply(this, arguments));
};
|
JavaScript
| 0.999999 |
@@ -1410,22 +1410,26 @@
%7B%0A var
+i = 0,
len
-gth
= this.
@@ -1438,114 +1438,71 @@
ngth
-,%0A el, i;%0A%0A for (i = 0; i %3C length; ++i) %7B%0A el = this%5Bi%5D;%0A if (fn.call(this.make(el), i, el) =
+;%0A while (i %3C len && fn.call(this.make(this%5Bi%5D), i, this%5Bi%5D) !
== f
@@ -1511,33 +1511,12 @@
se)
-%7B%0A break;%0A %7D%0A %7D%0A
+++i;
%0A r
|
50b7efd57b6565776f2922ab35a46cbba7af78b4
|
Remove hard code from language binary name in args
|
lib/atom-julia-run.js
|
lib/atom-julia-run.js
|
/* global atom */
"use strict";
const CompositeDisposable = require("atom").CompositeDisposable;
const path = require("path");
const child_process = require("child_process");
var user_os = process.platform;
var os_defaults = {
"linux":{terminal:"gnome-terminal", default_command:"julia \"{file}\""},
"win32":{terminal:"cmd", default_command:"julia.exe \"{file}\""}
};
var terminal = os_defaults[user_os].terminal;
var default_command = os_defaults[user_os].default_command;
function set_command_args(terminal, ca){
console.log(ca);
var args = "";
if (terminal=="cmd") {
args = ["/c", "start", __dirname + "/../bin/cp.exe"].concat(ca);
} else if (terminal=="gnome-terminal") {
var filename = ca[1];
console.log("filename", filename)
args = ["-e", "bash -c 'julia '"+ filename +"';exec $SHELL'"];
};
return args;
};
module.exports = {
activate: () => {
this.subscriptions = new CompositeDisposable();
this.subscriptions.add(
atom.commands.add("atom-text-editor", "Julia run: run-f5", run_f5),
atom.commands.add("atom-text-editor", "Julia run: run-f6", run_f6)
);
},
deactivate: () => {
this.subscriptions.dispose();
},
config: {
f5_command: {
title: "Command of F5",
description: "{file} stands for current file path",
type: "string",
default: default_command
},
f6_command: {
title: "Command of F6",
description: "{file} stands for current file path",
type: "string",
default: default_command
},
disable_notifications: {
title: "Disable success notifications",
description: "Disable notifications while saving and running",
type: "boolean",
default: false
},
disable_notifications_on_fail: {
title: "Disable failure notifications",
description: "Disable notifications when extension name does not match",
type: "boolean",
default: false
}
},
subscriptions: null
};
function run_f5() {
run(atom.config.get("atom-julia-run.f5_command"));
}
function run_f6() {
run(atom.config.get("atom-julia-run.f6_command"));
}
function run(command) {
var editor = atom.workspace.getActiveTextEditor();
if (!editor) {
return;
}
var file = editor.buffer.file;
if (!file) {
notification("warning", "You have to create the file first.", true);
return;
}
notification("info", "Saving...");
editor.save();
var info = path.parse(file.path);
if (info.ext != ".jl") {
notification("warning", format("{0} is not a .jl file, exit.", [info.base]));
return;
}
notification("info", format("Running {0} ...", [info.base]));
var ca = command.split(" ");
ca.forEach(function(k, i, a) {
a[i] = format(k, {
"file": file.path,
"dir": info.dir,
"name": info.name,
"ext": info.ext,
});
});
var args = set_command_args(terminal, ca)
console.log(args)
var child = child_process.spawn(terminal ,args,
{cwd: info.dir,
detached: true});
child.unref();
}
function notification(type, message, always) {
if (type == "info") {
if (always || !atom.config.get("atom-julia-run.disable_notifications")) {
atom.notifications.add("info", message);
}
} else if (type == "warning") {
if (always || !atom.config.get("atom-julia-run.disable_notifications_on_fail")) {
atom.notifications.add("warning", message);
}
}
}
function format(string, array) {
return string.replace(/{(.*?)}/g, k => array[k.substring(1, k.length - 1)]);
}
|
JavaScript
| 0.002853 |
@@ -696,24 +696,57 @@
erminal%22) %7B%0A
+ var language_binary = ca%5B0%5D;%0A
var file
@@ -829,16 +829,34 @@
-c '
-julia '%22
+%22 + language_binary + %22 %22
+ fi
@@ -867,10 +867,10 @@
me +
+
%22
-'
;exe
@@ -882,16 +882,47 @@
ELL'%22%5D;%0A
+ console.log(%22args:%22, args)%0A
%7D;%0A r
|
2de5908648b82acba4d4183df483a58e6ebb7d66
|
Update path reference
|
lib/client-context.js
|
lib/client-context.js
|
var dom = require('./dom'),
exec = require('./client-exec').exec,
rewriteStack = require('./client-exec').rewriteStack,
fs = require('fs'),
jQuery = require('./fruit-loops'),
path = require('path'),
vm = require('vm');
module.exports = exports = function(options) {
var host = options.host || 'localhost',
callback = options.callback;
var window = vm.createContext({
$server: true,
nextTick: function(callback) {
process.nextTick(function() { exec(callback); });
},
navigator: {
userAgent: options.userAgent
},
loadInContext: function(href, callback) {
if (href && window.lumbarLoadPrefix) {
// TODO : Make this more generic (i.e. don't expect a sha in there)
href = path.relative(path.dirname(window.lumbarLoadPrefix), href);
href = path.resolve(path.dirname(options.index) + '/web', href);
}
exec(function() {
vm.runInContext(fs.readFileSync(href), window, href);
});
// TODO : Make this generic, i.e. allow names other than `Phoenix`
if (window.Phoenix && !changeRegistered) {
changeRegistered = true;
window.Phoenix.on('emit', function() {
setTimeout(function() {
emit();
}, 10);
});
}
if (callback) {
window.nextTick(callback);
}
}
});
window.self = window.window = window;
dom.console(window);
dom.document(window);
dom.location(window, 'http://' + host + options.url.path);
dom.history(window);
dom.performance(window);
dom.storage(window, 'localStorage');
dom.storage(window, 'sessionStorage');
var $ = jQuery(window, fs.readFileSync(options.index));
window.jQuery = window.Zepto = window.$ = $.$;
var changeRegistered,
viewSet = false;
function emit(force) {
// TODO : Figure put the best way to handle output after send... Error? Ignore? Log?
if (!callback) {
console.log(rewriteStack(new Error().stack));//$.root.html());
return;
}
// Inline any script content that we may have received
$.$('body').append('<script>var $serverCache = ' + $.ajax.toJSON() + ';</script>');
// Ensure sure that we have all of our script content and that it it at the end of the document
// this has two benefits: the body element may be rendered to directly and this will push
// all of the scripts after the content elements
$.$('body').append(files);
console.log('emit time: ' + (Date.now() - window.performance.timing.navigationStart));
// And output the thing
callback(undefined, $.root.html());
callback = undefined;
}
var files = $.$('script');
files.each(function() {
var el = $.$(this),
text = el.text(),
external = el.attr('src');
if (external) {
window.loadInContext(external.replace(/\.js$/, '-server.js'));
} else {
exec(function() {
vm.runInContext(text, window, text);
});
}
});
};
|
JavaScript
| 0 |
@@ -173,19 +173,14 @@
('./
-fruit-loops
+jquery
'),%0A
|
1af561dfec7868fc3566a67aa334c4c531278f7c
|
Change rootDirectories to getPaths & remove lowerCase function
|
lib/codealike-atom.js
|
lib/codealike-atom.js
|
'use babel';
import { CompositeDisposable, Disposable } from 'atom';
import { Codealike } from '@codealike/codealike-core';
import smalltalk from 'smalltalk';
import CodealikeStatusBarView from './statusBarView';
const AtomCodealikePlugin = {
subscriptions: null,
statusBar: null,
statusBarView: null,
initialize() {
// initialize status bar view
this.statusBarView = new CodealikeStatusBarView();
this.statusBarView.init();
this.statusBarView.updateMessage("Codealike is initializing...", "info");
},
tryConnect() {
// try to connect
Codealike.connect()
.then(
function() {
AtomCodealikePlugin.startTrackingProject();
},
function() {
AtomCodealikePlugin.stopTrackingProject();
}
);
},
askForCredentials() {
smalltalk.prompt("Codealike API Token", "Enter here your Codealike API token, or clean it to disconnect", Codealike.getUserToken() || '')
.then(
function(token) {
// set user token configuration
Codealike.setUserToken(token);
// try to connect
if (token) {
Codealike.connect()
.then(
function() {
AtomCodealikePlugin.startTrackingProject();
},
function() {
AtomCodealikePlugin.stopTrackingProject();
}
);
}
else {
AtomCodealikePlugin.stopTrackingProject();
Codealike.disconnect();
}
},
function() {
// if cancel was pressed, do nothing
}
);
},
stopTrackingProject() {
Codealike.stopTracking();
},
startTrackingProject() {
// verify if there is a loaded folder in workspace
if (atom.project.rootDirectories.length) {
// then ensure codealike configuration exists
// and start tracking
let atomProject = atom.project.rootDirectories["0"].lowerCasePath;
if (!atomProject) {
atomProject = atom.project.rootDirectories["0"].path;
}
Codealike
.configure(atom.project.rootDirectories["0"].lowerCasePath)
.then(
(configuration) => {
// calculate when workspace started loading
let currentDate = new Date();
let startupDurationInMs = atom.getWindowLoadTime();
currentDate.setMilliseconds(currentDate.getMilliseconds()-startupDurationInMs);
// start tracking project
Codealike.startTracking(configuration, currentDate);
}
);
}
},
activate(state) {
// initialize plugin for current client and version
Codealike.initialize('atom', '0.0.9');
Codealike.registerStateSubscriber((state) => {
if (state.isTracking) {
if (state.networkStatus === 'OnLine') {
AtomCodealikePlugin.statusBarView.updateMessage("Codealike is tracking on-line", "success");
}
else {
AtomCodealikePlugin.statusBarView.updateMessage("Codealike is tracking off-line", "warning");
}
}
else {
AtomCodealikePlugin.statusBarView.updateMessage("Click here to configure Codealike", "info");
}
});
// try to connect to codealike and start tracking
AtomCodealikePlugin.tryConnect();
// if another path is loaded, reconfigure codealike instance
atom.project.onDidChangePaths((path) => {
AtomCodealikePlugin.startTracking();
})
// Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
this.subscriptions = new CompositeDisposable();
// Register command that toggles this view
this.subscriptions.add(atom.commands.add('atom-workspace', {
'codealike:connect': () => AtomCodealikePlugin.askForCredentials()
}));
atom.workspace.observeTextEditors((editor) => {
editor.onDidChangeCursorPosition((ev) => {
// if text was changed the event
// was already handled by onDidChange
if (ev.textChanged)
return;
var context = { };
if (editor = atom.workspace.getActiveTextEditor()) {
if (file = editor.getBuffer().file) {
context.file = file.path;
}
if (editor.cursors.length > 0) {
context.line = editor.cursors[0].getCurrentLineBufferRange().end.row + 1;
}
}
Codealike.trackFocusEvent(context);
});
editor.onDidChange((ev) => {
var context = { };
if (editor = atom.workspace.getActiveTextEditor()) {
if (file = editor.getBuffer().file) {
context.file = file.path;
}
if (editor.cursors.length > 0) {
context.line = editor.cursors[0].getCurrentLineBufferRange().end.row + 1;
}
}
Codealike.trackCodingEvent(context);
});
});
},
deactivate() {
Codealike.dispose();
this.subscriptions.dispose();
this.statusBarView.destroy();
this.statusBar.destroy();
},
consumeStatusBar(sb) {
this.statusBar = sb.addLeftTile({ item: this.statusBarView });
}
};
export default AtomCodealikePlugin;
|
JavaScript
| 0.000001 |
@@ -1803,24 +1803,66 @@
Project() %7B%0A
+ let paths = atom.project.getPaths();%0A%0A
// verif
@@ -1916,35 +1916,12 @@
if (
-atom.project.rootDirectorie
+path
s.le
@@ -2008,17 +2008,16 @@
racking%0A
-%0A
le
@@ -2022,246 +2022,69 @@
let
-atomProject = atom.project.rootDirectories%5B%220%22%5D.lowerCasePath;%0A if (!atomProject) %7B%0A atomProject
+rootPath
=
+p
at
-om.project.rootDirectories%5B%220%22%5D.path;%0A %7D%0A%0A Codealike%0A .configure(atom.project.rootDirectories%5B%220%22%5D.lowerCase
+hs%5B0%5D;%0A%0A Codealike%0A .configure(root
Path
|
4a8e13af0e00915180dfe87239e94744b2e37c16
|
enable proxy knowledge
|
lib/config/express.js
|
lib/config/express.js
|
/**
* config/express.js
*
* Defines all express related configurations for the server
*/
'use strict';
var express = require('express');
var path = require('path');
// var jwt = require('express-jwt');
var modelsImport = require('../models/');
var mongoose = require('mongoose');
var cookieParser = require('cookie-parser');
var settings = require('../../settings');
var responseUtils = require('../utils/response');
module.exports = function(app) {
var rootPath = path.normalize(__dirname + '/../..');
mongoose.connect(settings.database);
var Models = modelsImport(mongoose);
// make models available in req variable
app.use(function (req, res, next) {
req.models = Models;
return next();
});
// make error message function available in res variable
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type,Authorization');
res.errorJson = function (err) {
responseUtils.sendErrorJson(res, err);
};
return next();
});
app.configure('development', function(){
app.use(require('connect-livereload')());
app.use(express.errorHandler());
});
app.configure(function(){
app.set('views', path.join(rootPath, 'views'));
app.use(express.static(path.join(rootPath, 'public')));
app.use('/docs', express.static(path.join(rootPath, 'docs')));
// app.engine('ejs', engine);
app.set('view engine', 'ejs');
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(cookieParser());
// Router needs to be last
app.use(app.router);
});
};
|
JavaScript
| 0 |
@@ -1710,16 +1710,47 @@
rser());
+%0A app.enable('trust proxy');
%0A%0A //
|
18198752b1b5de7c84c27600738441cf4121c55e
|
Change frequency
|
lib/counter_device.js
|
lib/counter_device.js
|
var stream = require('stream');
var util = require('util');
var sun_calc = require('suncalc');
util.inherits(counter_device,stream);
module.exports=counter_device;
function diff(from, to){
return (to.getHours() - from.getHours()) * 60 + to.getMinutes() - from.getMinutes();
}
function counter_device(opts, app, sd) {
var self = this;
this.readable = true;
this.writeable = false;
this.G = "daylightXChangeTimer";
this.V = 0;
this.D = 9001;
this.name = "Daylight change timer"
process.nextTick(function() {
setInterval(function() {
var longitude = parseFloat(opts.longitude);
var latitude = parseFloat(opts.latitude);
var now = new Date();
var tomorrow = new Date();
tomorrow.setDate(now.getDate() + 1);
var times = sun_calc.getTimes(now, latitude, longitude);
var times_tomorrow = sun_calc.getTimes(tomorrow, latitude, longitude);
var sunrise_today = times.sunriseEnd;
var sunset_today = times.sunsetStart;
var sunrise_tomorrow = times_tomorrow.sunriseEnd;
if(now <= sunrise_today){
self.emit('data', diff(now, sunrise_today));
sd.emit('data', 'night');
} else if(now >= sunrise_today && now <= sunset_today){
self.emit('data', diff(now, sunset_today));
sd.emit('data', 'day');
} else {
self.emit('data', diff(now, sunrise_tomorrow));
sd.emit('data', 'night');
}
}, 5000);
});
};
|
JavaScript
| 0.000001 |
@@ -1593,9 +1593,10 @@
%7D,
-5
+60
000)
|
3f0551232925ef1115f357ff94014a970c35ddb3
|
Improve readability
|
lib/createExplorer.js
|
lib/createExplorer.js
|
'use strict';
const path = require('path');
const fs = require('graceful-fs');
const loadPackageProp = require('./loadPackageProp');
const loadRc = require('./loadRc');
const loadJs = require('./loadJs');
const loadDefinedFile = require('./loadDefinedFile');
module.exports = function (options) {
// These cache Promises that resolve with results, not the results themselves
const fileCache = (options.cache) ? new Map() : null;
const directoryCache = (options.cache) ? new Map() : null;
const transform = options.transform || identityPromise;
function clearFileCache() {
if (fileCache) fileCache.clear();
}
function clearDirectoryCache() {
if (directoryCache) directoryCache.clear();
}
function clearCaches() {
clearFileCache();
clearDirectoryCache();
}
function load(searchPath, configPath) {
if (configPath) {
const absoluteConfigPath = path.resolve(process.cwd(), configPath);
if (fileCache && fileCache.has(absoluteConfigPath)) {
return fileCache.get(absoluteConfigPath);
}
const result = loadDefinedFile(absoluteConfigPath, options)
.then(transform);
if (fileCache) fileCache.set(absoluteConfigPath, result);
return result;
}
if (!searchPath) return Promise.resolve(null);
const absoluteSearchPath = path.resolve(process.cwd(), searchPath);
return isDirectory(absoluteSearchPath)
.then((searchPathIsDirectory) => {
const directory = (searchPathIsDirectory)
? absoluteSearchPath
: path.dirname(absoluteSearchPath);
return searchDirectory(directory);
});
}
function searchDirectory(directory, splitSearchPath) {
if (directoryCache && directoryCache.has(directory)) {
return directoryCache.get(directory);
}
const result = Promise.resolve()
.then(() => {
if (!options.packageProp) return;
return loadPackageProp(directory, options);
})
.then((result) => {
if (result || !options.rc) return result;
return loadRc(path.join(directory, options.rc), options);
})
.then((result) => {
if (result || !options.js) return result;
return loadJs(path.join(directory, options.js));
})
.then((result) => {
if (result) return result;
if (!splitSearchPath) splitSearchPath = directory.split(path.sep);
if (splitSearchPath.length <= 1 || directory === options.stopDir) return null;
splitSearchPath.pop();
return searchDirectory(splitSearchPath.join(path.sep), splitSearchPath);
})
.then(transform);
if (directoryCache) directoryCache.set(directory, result);
return result;
}
return {
load,
clearFileCache,
clearDirectoryCache,
clearCaches,
};
};
function isDirectory(filepath) {
return new Promise((resolve, reject) => {
fs.stat(filepath, (err, stats) => {
if (err) return reject(err);
return resolve(stats.isDirectory());
});
});
}
function identityPromise(x) {
return Promise.resolve(x);
}
|
JavaScript
| 0.000673 |
@@ -2297,32 +2297,80 @@
return result;%0A
+%0A const nextDirectory = (function () %7B%0A
if (!spl
@@ -2432,24 +2432,26 @@
p);%0A
+
if (splitSea
@@ -2469,12 +2469,154 @@
gth
-%3C= 1
+%3E 1) %7B%0A splitSearchPath.pop();%0A return splitSearchPath.join(path.sep);%0A %7D%0A %7D)();%0A%0A if (!nextDirectory
%7C%7C
@@ -2663,38 +2663,8 @@
ll;%0A
- splitSearchPath.pop();
%0A
@@ -2695,38 +2695,21 @@
ory(
-splitSearchPath.join(path.sep)
+nextDirectory
, sp
|
2c8f565ed81ed4aca02363e00d5c3206953c560a
|
add network and indivdual set results to cross-validation stats
|
lib/cross-validate.js
|
lib/cross-validate.js
|
var _ = require("underscore")._;
function testPartition(classifierConst, opts, trainOpts, trainSet, testSet) {
var classifier = new classifierConst(opts);
var beginTrain = Date.now();
var trainingStats = classifier.train(trainSet, trainOpts);
var beginTest = Date.now();
var testStats = classifier.test(testSet);
var endTest = Date.now();
var stats = _(testStats).extend({
trainTime : beginTest - beginTrain,
testTime : endTest - beginTest,
iterations: trainingStats.iterations,
trainError: trainingStats.error,
learningRate: classifier.learningRate,
hidden: classifier.hiddenSizes
});
return stats;
}
module.exports = function crossValidate(classifierConst, data, opts, trainOpts, k) {
k = k || 4;
var size = data.length / k;
data = _(data).sortBy(function() {
return Math.random();
});
var avgs = {
error : 0,
trainTime : 0,
testTime : 0,
iterations: 0,
trainError: 0
};
var stats = {
truePos: 0,
trueNeg: 0,
falsePos: 0,
falseNeg: 0,
total: 0
};
var misclasses = [];
var results = _.range(k).map(function(i) {
var dclone = _(data).clone();
var testSet = dclone.splice(i * size, size);
var trainSet = dclone;
var result = testPartition(classifierConst, opts, trainOpts, trainSet, testSet);
_(avgs).each(function(sum, stat) {
avgs[stat] = sum + result[stat];
});
_(stats).each(function(sum, stat) {
stats[stat] = sum + result[stat];
})
misclasses.push(result.misclasses);
});
_(avgs).each(function(sum, i) {
avgs[i] = sum / k;
});
stats.precision = stats.truePos / (stats.truePos + stats.falsePos);
stats.recall = stats.truePos / (stats.truePos + stats.falseNeg);
stats.accuracy = (stats.trueNeg + stats.truePos) / stats.total;
stats.testSize = size;
stats.trainSize = data.length - size;
return {
avgs: avgs,
stats: stats,
misclasses: _(misclasses).flatten()
};
}
|
JavaScript
| 0 |
@@ -619,23 +619,58 @@
denSizes
+,%0A network: classifier.toJSON()
%0A %7D);%0A
+%0A
return
@@ -1571,16 +1571,36 @@
lasses);
+%0A%0A return result;
%0A %7D);%0A%0A
@@ -1978,16 +1978,35 @@
stats,%0A
+ sets: results,%0A
misc
|
9440350a6e34999a820dc6091cdf09d41f6c7e9d
|
Format data
|
lib/deploy.command.js
|
lib/deploy.command.js
|
const path = require('path')
const fs = require('fs')
const { readFile } = require('./fs.utils')
const { log } = require('./log.utils')
module.exports = exports = configFilename => {
return (modules, options) => {
readFile(configFilename)
.then(data => JSON.parse(data).folder_path)
.then(processModuleData(modules))
.then(data => console.log(JSON.stringify(data, null, 2)))
}
}
function processModuleData(moduleNames) {
return folderPath => {
return moduleNames
.map(name => {
const addr = path.join(folderPath, 'files', name)
const file = fs.readFileSync(path.join(addr, 'settings.json'))
let settings = []
try {
settings = JSON.parse(file)
} catch(e) {
log({ type: 'warn', message: `Not able to load settings file for "${name}" module.` })
}
return { name, folder: addr, settings }
})
.filter(moduleConf => moduleConf.settings.length > 0)
}
}
|
JavaScript
| 0.000008 |
@@ -966,14 +966,457 @@
th %3E 0)%0A
+ .map(moduleConf =%3E %7B%0A return moduleConf.settings%0A .filter(file =%3E file.global)%0A .map(file =%3E (%7B%0A from: path.resolve(moduleConf.folder, file.filename),%0A to: path.resolve(file%5B'target-path'%5D.replace('~', process.env.HOME))%0A %7D))%0A %7D)%0A .reduce((files, modules) =%3E %7B%0A for (const file of modules) %7B%0A files.push(file)%0A %7D%0A%0A return files%0A %7D, %5B%5D)%0A
%7D%0A%7D%0A
|
74bb870f0d4aebbd819dca09a3229e4286480c25
|
Simplify error raising on storage
|
lib/domain/storage.js
|
lib/domain/storage.js
|
/*
* Storage Class is a interface to create storage with the following contracts
* lint comment is applied to prevent `class-method-use-this` for this case
*/
/* eslint class-methods-use-this: [
'error', { "exceptMethods": ['ping', 'listNamespaces', 'postCode', 'putCode', 'getCode',
'deleteCode', 'getCodeByCache']
}]
*/
const ERR_UNIMPLEMENTED_METHOD = 'unimplemented method for Storage interface';
class Storage {
constructor(name) {
this.name = name;
}
ping() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
listNamespaces() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
postCode() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
putCode() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
getCode() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
deleteCode() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
getCodeByCache() { throw new Error(ERR_UNIMPLEMENTED_METHOD); }
}
module.exports = Storage;
|
JavaScript
| 0.000001 |
@@ -395,16 +395,26 @@
ETHOD =
+new Error(
'unimple
@@ -449,16 +449,17 @@
terface'
+)
;%0A%0Aclass
@@ -531,34 +531,24 @@
g() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -559,22 +559,20 @@
D_METHOD
-)
; %7D%0A
-%0A
listNa
@@ -586,34 +586,24 @@
s() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -614,22 +614,20 @@
D_METHOD
-)
; %7D%0A
-%0A
postCo
@@ -635,34 +635,24 @@
e() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -663,22 +663,20 @@
D_METHOD
-)
; %7D%0A
-%0A
putCod
@@ -683,34 +683,24 @@
e() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -703,38 +703,36 @@
PLEMENTED_METHOD
-)
; %7D%0A
-%0A
getCode() %7B th
@@ -731,34 +731,24 @@
e() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -759,22 +759,20 @@
D_METHOD
-)
; %7D%0A
-%0A
delete
@@ -782,34 +782,24 @@
e() %7B throw
-new Error(
ERR_UNIMPLEM
@@ -814,14 +814,12 @@
THOD
-)
; %7D%0A
-%0A
ge
@@ -841,26 +841,16 @@
%7B throw
-new Error(
ERR_UNIM
@@ -865,17 +865,16 @@
D_METHOD
-)
; %7D%0A%7D%0A%0Am
|
6ae55f60d0be5c1ae21361a9b885a60e90ad0183
|
Update module1.js
|
sample_modules/module1.js
|
sample_modules/module1.js
|
console.log('module1!);
|
JavaScript
| 0.000001 |
@@ -14,11 +14,12 @@
module1!
+'
);%0A
|
73a4496bedc0c5113c4fa972d895c0f07536b0e4
|
Fix docs: heartbeat methods are instance methods
|
src/effects/heartbeat.js
|
src/effects/heartbeat.js
|
/** section: scripty2 fx
* class s2.fx.Heartbeat
*
* The heartbeat class provides for effects timing. An instance of this class
* is automatically created when the first effect on a page is instantiated.
*
* This class can be extended and replaced by your own implementation:
*
* // call before effects are created
* var myHeartbeat = Class.create(s2.fx.Heartbeat, { ... });
* s2.fx.initialize(new myHeartbeat());
*
* This can be used to implement customized debugging and more.
**/
s2.fx.Heartbeat = Class.create({
/**
* new s2.fx.Heartbeat([options])
* - options (Object): options hash
*
* The following options are available:
* * [[framerate]]: set (maximum) framerate for calls to [[s2.fx.beat]]/
**/
initialize: function(options) {
this.options = Object.extend({
framerate: Prototype.Browser.MobileSafari ? 20 : 60
}, options);
this.beat = this.beat.bind(this);
},
/**
* s2.fx.Heartbeat.start() -> undefined
*
* This function is called by [[s2.fx]] whenever there's a new active effect queued
* and there are no other effects running. This mechanism can be used to prevent
* unnecessary timeouts/intervals from being active, as [[s2.fx.Hearbeat.beat]] is only
* called when there are active effects that need to be rendered.
**/
start: function() {
if (this.heartbeatInterval) return;
this.heartbeatInterval =
setInterval(this.beat, 1000/this.options.framerate);
this.updateTimestamp();
},
/**
* s2.fx.Heartbeat.stop() -> undefined
*
* Called when the last active effect is dequeued.
**/
stop: function() {
if (!this.heartbeatInterval) return;
clearInterval(this.heartbeatInterval);
this.heartbeatInterval = null;
this.timestamp = null;
},
/**
* s2.fx.Heartbeat.beat() -> undefined
*
* This method fires an `effect:heartbeat` event which is in turn used by
* [[s2.fx]] to render all active effect queues.
*
* Fires: effect:heartbeat
**/
beat: function() {
this.updateTimestamp();
document.fire('effect:heartbeat');
},
/**
* s2.fx.Heartbeat.getTimestamp() -> Date
*
* Returns the current timestamp.
**/
getTimestamp: function() {
return this.timestamp || this.generateTimestamp();
},
/**
* s2.fx.Heartbeat.generateTimestamp() -> Date
*
* Returns the current date and time.
**/
generateTimestamp: function() {
return new Date().getTime();
},
/**
* s2.fx.Heartbeat.updateTimestamp() -> undefined
*
* Updates the current timestamp (sets it to the current date and time).
*
* If subclassed, this can be used to achieve special effects, for example all effects
* could be sped up or slowed down.
**/
updateTimestamp: function() {
this.timestamp = this.generateTimestamp();
}
});
|
JavaScript
| 0.999869 |
@@ -968,17 +968,17 @@
eartbeat
-.
+#
start()
@@ -1547,17 +1547,17 @@
eartbeat
-.
+#
stop() -
@@ -1831,25 +1831,25 @@
fx.Heartbeat
-.
+#
beat() -%3E un
@@ -2155,17 +2155,17 @@
eartbeat
-.
+#
getTimes
@@ -2346,17 +2346,17 @@
eartbeat
-.
+#
generate
@@ -2531,17 +2531,17 @@
eartbeat
-.
+#
updateTi
|
061cebc5b57fa8a13ab50ea97db8e4837bc23343
|
Make sure we fill the correct service types
|
tools/sapi-backfill-service-type.js
|
tools/sapi-backfill-service-type.js
|
/*
* 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/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
/*
* Backfill sapi_services bucket after adding index type field
*/
var path = require('path');
var fs = require('fs');
var util = require('util');
var moray = require('moray');
var async = require('async');
var config_file = path.resolve(__dirname, '..', 'etc/config.json');
var bunyan = require('bunyan');
var SERVICES_BUCKET = 'sapi_services';
var config;
try {
config = JSON.parse(fs.readFileSync(config_file, 'utf8'));
} catch (e) {
console.error('Error parsing config file JSON:');
console.dir(e);
process.exit(1);
}
var log = new bunyan({
name: 'sapi-backfill',
streams: [ {
level: config.logLevel || 'info',
stream: process.stdout
}]
});
var morayClient = moray.createClient({
log: log,
host: config.moray.host,
port: config.moray.port,
retry: (config.retry === false ? false : {
retries: Infinity,
minTimeout: 1000,
maxTimeout: 60000
})
});
function onConnect() {
morayClient.removeListener('error', onError);
log.info('moray: connected %s', morayClient.toString());
updateBucket(onBucket);
}
function onConnectAttempt(number, delay) {
var level;
if (number === 0) {
level = 'info';
} else if (number < 5) {
level = 'warn';
} else {
level = 'error';
}
log[level]({
attempt: number,
delay: delay
}, 'moray: connection attempted');
}
function onError(err) {
log.error(err, 'moray: connection failed');
}
morayClient.once('connect', onConnect);
morayClient.once('error', onError);
morayClient.on('connectAttempt', onConnectAttempt);
/*
* Work is done here
*/
function updateBucket(cb) {
morayClient.getBucket(SERVICES_BUCKET, function (err, bucket) {
if (err) {
cb(err);
return;
}
if (bucket.index.type !== undefined) {
log.info('"type" index is already added');
cb();
return;
}
var cfg = {
index: {
uuid: { type: 'string', unique: true },
name: { type: 'string' },
application_uuid: { type: 'string' },
type: { type: "string" }
}
};
morayClient.updateBucket(SERVICES_BUCKET, cfg, cb);
});
}
function listServices(cb) {
var services = [];
var req = morayClient.findObjects(SERVICES_BUCKET, '(uuid=*)');
req.once('error', cb);
req.on('record', function (object) {
services.push(object.value);
});
return req.once('end', function () {
cb(null, services);
});
}
function updateServices(services, cb) {
async.forEach(services, updateService, cb);
}
function updateService(service, cb) {
var uuid = service.uuid;
if (service.type === undefined) {
service.type = 'vm';
morayClient.putObject(SERVICES_BUCKET, uuid, service, function (err) {
if (err) {
log.error(err, 'Could not update service %s', uuid);
cb(err);
return;
}
log.info('Service %s has ben updated', uuid);
cb();
});
} else {
log.info('Service %s already has a type %s', uuid, service.type);
process.nextTick(cb);
}
}
function onBucket(bucketErr) {
if (bucketErr) {
log.error(bucketErr, 'Could not update bucket');
process.exit(1);
}
listServices(function (err, services) {
if (err) {
log.error(err, 'Could not list services');
process.exit(1);
}
updateServices(services, function (updateErr) {
if (updateErr) {
log.error(updateErr, 'Could not update services');
process.exit(1);
}
log.info('Services have been updated');
process.exit(0);
});
});
}
|
JavaScript
| 0 |
@@ -3055,32 +3055,164 @@
== undefined) %7B%0A
+ if (service.name === 'vm-agent' %7C%7C service.name === 'net-agent') %7B%0A service.type = 'agent';%0A %7D else %7B%0A
service.
@@ -3224,16 +3224,27 @@
= 'vm';%0A
+ %7D%0A%0A
@@ -3296,16 +3296,53 @@
service,
+%0A %7B noBucketCache: true %7D,
functio
|
e5c9390083938d2d02ea067b3fc7f7d0d9fae575
|
fix NaN in estimateGas
|
src/store/contractActions.js
|
src/store/contractActions.js
|
import { rpc } from 'lib/rpcapi';
import log from 'loglevel';
export function loadContractList() {
return (dispatch) => {
dispatch({
type: 'CONTRACT/LOADING',
});
rpc('emerald_contracts', []).then((json) => {
if (json.error) {
log.error(`emerald_contracts rpc call: ${JSON.stringify(json)}`);
}
dispatch({
type: 'CONTRACT/SET_LIST',
contracts: json.result,
});
// load Contract details?
});
};
}
export function addContract(address, name, abi, version, options, txhash) {
return (dispatch) =>
rpc('emerald_addContract', [{
address,
name,
abi,
version,
options,
txhash,
}]).then((json) => {
dispatch({
type: 'CONTRACT/ADD_CONTRACT',
address,
name,
abi,
version,
options,
txhash,
});
});
}
export function estimateGas(data) {
return (dispatch) =>
rpc('eth_estimateGas', [{ data }]).then((json) => {
return parseInt(json.result);
});
}
|
JavaScript
| 0.000008 |
@@ -1219,16 +1219,51 @@
return
+ isNaN(parseInt(json.result)) ? 0 :
parseIn
|
0287e7fcec02805cfd0582a9fa837d6abd39e556
|
Implement PullApi.show
|
lib/github/PullApi.js
|
lib/github/PullApi.js
|
/**
* Copyright 2010 Ajax.org B.V.
*
* This product includes software developed by
* Ajax.org B.V. (http://www.ajax.org/).
*
* Author: Ryan Funduk <[email protected]>
*/
var sys = require("sys");
var AbstractApi = require("./AbstractApi").AbstractApi;
var PullApi = exports.PullApi = function(api) {
this.$api = api;
};
sys.inherits(PullApi, AbstractApi);
(function() {
/**
* List pulls by username, repo and (optionally) state
* http://develop.github.com/p/pulls.html
*
* @param {String} username the username
* @param {String} repo the repo
* @param {String} $state the issue state, optional
*/
this.getList = function(username, repo, state, callback)
{
if (typeof(state) == 'function') {
callback = state;
state = '';
}
else {
state = '/' + encodeURI(state);
}
this.$api.get(
'pulls/' + encodeURI(username) + "/" + encodeURI(repo) + state,
null, null,
this.$createListener(callback, "pulls")
);
};
}).call(PullApi.prototype);
|
JavaScript
| 0.000001 |
@@ -1118,16 +1118,552 @@
%7D;%0A%0A
+ /**%0A * Show a pull by username, repo, and number.%0A * http://develop.github.com/p/pulls.html%0A *%0A * @param %7BString%7D username the username%0A * @param %7BString%7D repo the repo%0A * @param %7BInt%7D num the pull number%0A */%0A this.show = function(username, repo, num, callback)%0A %7B%0A this.$api.get(%0A 'pulls/' + encodeURI(username) + '/' + encodeURI(repo) + '/' + num,%0A null, null,%0A this.$createListener(callback, 'pull')%0A );%0A %7D;%0A%0A
%7D).call(
|
55adf51b020b013a436f443122f320a9773a0c33
|
add workaround comment
|
src/stores/CandidateStore.js
|
src/stores/CandidateStore.js
|
"use strict";
var AppDispatcher = require('../dispatcher/AppDispatcher');
var AppConstants = require('../constants/AppConstants');
var {EventEmitter} = require('events');
var assign = require('object-assign');
var WebAPIUtils = require("../utils/WebAPIUtils");
var {ActionTypes} = AppConstants;
var CHANGE_EVENT = 'change';
var _current = null;
var _candidates = {
'5': {
id: 5,
name: '馮光遠',
avatar: '/assets/images/candidates/5.jpg', //require("../../client/images/candidates/5.jpg")
avatar_square: '/assets/images/candidates_avatar/5.jpg',
status: false
},
'6': {
id: 6,
name: '連勝文',
avatar: '/assets/images/candidates/6.jpg', //require("../../client/images/candidates/6.jpg")
avatar_square: '/assets/images/candidates_avatar/6.jpg',
status: false
},
'7': {
id: 7,
name: '柯文哲',
avatar: '/assets/images/candidates/7.jpg', //require("../../client/images/candidates/7.jpg")
avatar_square: '/assets/images/candidates_avatar/7.jpg',
status: false
}
};
var CandidateStore = assign({}, EventEmitter.prototype, {
emitChange () {
this.emit(CHANGE_EVENT);
},
addChangeListener (callback) {
this.on(CHANGE_EVENT, callback);
},
removeChangeListener (callback) {
this.removeListener(CHANGE_EVENT, callback);
},
getStatus () {
var result = {};
Object.keys(_candidates).map(function (c) {
return result[c] = _candidates[c].status;
});
return result;
},
getCurrentCandidate () {
return _current;
},
get (id) {
return _candidates[id];
},
getAll () {
return Object.keys(_candidates).map((c) => {
return _candidates[c];
});
}
});
CandidateStore.dispatchToken = AppDispatcher.register((payload) => {
var {action} = payload;
switch(action.type) {
case ActionTypes.CHOOSE_CANDIDATE:
_current=action.id;
CandidateStore.emitChange();
break;
case ActionTypes.STATUS:
WebAPIUtils.checkStatus(function (err, res) {
if (err) {
return console.log(err);
}
Object.keys(_candidates).map(function(c, i){
var allStatus = res.body.data;
if(allStatus)
_candidates[c]['status'] = allStatus[i];
});
CandidateStore.emitChange();
});
break;
default:
}
});
module.exports = CandidateStore;
|
JavaScript
| 0 |
@@ -2166,16 +2166,38 @@
lStatus)
+//this is a workaround
%0A
|
f64b212f68368e45d0a57ee7a97f1e06adfc3561
|
Add items to the list component after they are put into the DOM, such that the itemFocus finds the dom correctly when positioning itself
|
js/browser/panels/ListPanel.js
|
js/browser/panels/ListPanel.js
|
jsio('from common.javascript import Class, bind');
jsio('import browser.events as events');
jsio('import browser.dom as dom');
jsio('import browser.css as css');
jsio('import browser.ItemView');
jsio('import browser.ListComponent');
jsio('import .Panel');
css.loadStyles(jsio.__path);
exports = Class(Panel, function(supr) {
this.init = function() {
supr(this, 'init', arguments);
this._label = this._item;
this._listComponent = new browser.ListComponent(bind(this, '_onItemSelected'));
}
this.createContent = function() {
supr(this, 'createContent');
this.addClassName('ListPanel');
}
this.addItem = function(item) {
item.addClassName('listItem');
this._listComponent.addItem(item);
this._content.appendChild(item.getElement());
this._manager.resize();
}
this.focus = function() {
supr(this, 'focus');
this._listComponent.focus();
}
this._onItemSelected = function(item) {
this._publish('ItemSelected', item);
}
})
|
JavaScript
| 0 |
@@ -680,45 +680,8 @@
is._
-listComponent.addItem(item);%0A%09%09this._
cont
@@ -713,16 +713,53 @@
lement()
+);%0A%09%09this._listComponent.addItem(item
);%0A%09%09thi
|
22968f7f735bba9fb79f7dce62cc42e4d47a872f
|
Replace twitter with github link for Katie
|
static/js/components/about.js
|
static/js/components/about.js
|
const html = require('choo/html');
module.exports = (state, prev, send) => {
return html`
<main role="main" class="layout__main" onload=${(e) => send('startup')}>
<section class="about">
<h2 class="about__title">About 5 Calls</h2>
<h3 class="about__subtitle">Why Calling Works</h3>
<p>Calling members of Congress is the most effective way to have your voice heard. Calls are tallied by staffers and the count is given to your representatives, informing them how strongly their constituents feel about a current issue. The sooner you reach out, the more likely it is that <strong>your voice will influence their position.</strong></p>
<p>Don’t just take it from us:</p>
<ul>
<li><a href="https://www.nytimes.com/2016/11/22/us/politics/heres-why-you-should-call-not-email-your-legislators.html">“Here’s Why You Should Call, Not Email, Your Legislators”</a> <span class="about__source">NY Times</span></li>
<li><a href="http://www.vox.com/policy-and-politics/2016/11/15/13641920/trump-resist-congress">“Don’t just write to your representatives. Call them — and go to town halls.”</a> <span class="about__source">Vox</span></li>
<li><a href="https://www.washingtonpost.com/powerpost/a-day-of-chaos-at-the-capitol-as-house-republicans-back-down-on-ethics-changes/2017/01/03/50e392ac-d1e6-11e6-9cb0-54ab630851e8_story.html?utm_term=.86c8d3a06832">“I can tell you the calls we’ve gotten in my district office and here in Washington surprised me, meaning the numbers of calls.”</a> <span class="about__source"> Washington Post</span></li>
<li><a href="https://twitter.com/costareports/status/816373917900161024">“Most members tell me blizzard of angry constituent calls were most impt factor in getting the House to sideline the amdt”</a> <span class="about__source">Robert Costa</span></li>
</ul>
<p><i>5 Calls</i> does the research for each issue, determining which representatives are most influential for which topic, collecting phone numbers for those offices and writing scripts that clearly articulate a progressive position. You just have to call.</p>
<p>Are we not covering an issue we should be? <a href="mailto:[email protected]">Please reach out.</a></p>
<h3 class="about__subtitle">Calling Tips</h3>
<p>Calls should take less than a minute. You’ll be speaking to a staffer, so make your point clearly so they can tally your opinion correctly. The provided scripts are useful but you can add your own words.</p>
<p>Be respectful. The staffers that pick up the phone aren’t looking to challenge you and you should treat them with the same respect you expect from them, regardless of which party they work for.</p>
<h3 class="about__subtitle">Who made 5 Calls?</h3>
<p>5 Calls is a volunteer effort. Founded and run by husband & wife team <a href="https://twitter.com/nickoneill">Nick</a> and <a href="https://twitter.com/syntheticmethod">Rebecca</a>, many dedicated volunteers contribute design, code and issues to the site including: <a href="https://twitter.com/monteiro">@monteiro</a>, <a href="https://twitter.com/stewartsc">@stewartsc</a>, <a href="https://twitter.com/liamdanger">@liamdanger</a>, <a href="https://twitter.com/capndesign">@capndesign</a>, <a href="https://twitter.com/jameshome">@jameshome</a>, <a href="https://twitter.com/beau">@beau</a>, <a href="https://twitter.com/cdoremus">@cdoremus</a>, <a href="https://twitter.com/ocderby">@ocderby</a>, <a href="https://twitter.com/mr0grog">@mr0grog</a> and <a href="https://github.com/5calls/5calls/graphs/contributors">more supporters.</a></p>
<p>Our iOS app is made by <a href="https://twitter.com/subdigital">@subdigital</a>, <a href="https://twitter.com/mccarron">@mccarron</a>, <a href="https://twitter.com/chrisbrandow">@chrisbrandow</a> and <a href="https://github.com/5calls/ios/graphs/contributors">more supporters</a></p>
<p>Our Android app is made by <a href="https://twitter.com/dekthedek">@dekthedek</a>, gregliest and <a href="https://github.com/5calls/android/graphs/contributors">more supporters</a></p>
<p>Our issues, scripts and social team is <a href="https://twitter.com/charmbtrippin">@charmbtrippin</a>, <a href="https://www.instagram.com/sara.n.g/">sara.n.g</a>, amanda.l, <a href="https://twitter.com/djpiebob">@djpiebob</a>, <a href="https://twitter.com/theRati">@theRati</a>, <a href="https://twitter.com/Lhhargrave">@lhhargrave</a>, amanda.n, <a href="https://twitter.com/sagerke">@sagerke</a>, Eleanor Wertman and more contributors.</p>
<p>We want to make advocacy accessible. We hope 5 Calls will make it effortless for regular people to have a voice when it’s needed most.</p>
<h3 class="about__subtitle">Join us</h3>
<p>This project is <a href="https://github.com/5calls/5calls">open source</a> and volunteer made. If you’d like to join us in developing useful tools for citizens, please get in touch via <a href="https://twitter.com/make5calls">Twitter</a> or <a href="mailto:[email protected]">email</a>.</p>
</section>
</main>
`;
}
|
JavaScript
| 0.999988 |
@@ -3971,31 +3971,30 @@
ef=%22https://
-twitter
+github
.com/dekthed
@@ -3994,25 +3994,18 @@
dekt
-hedek
+ar
%22%3E
-@
dekt
-hedek
+ar
%3C/a%3E
|
dd67a7c64b351c8879dc2679f6ef13d08bb9a4e3
|
make sandbox-mode callbacks be async
|
js/communicate-with-sandbox.js
|
js/communicate-with-sandbox.js
|
(function(){
"use strict";
hilarious.use_sandbox = (location.search === '?sandbox' || location.hash === '#sandbox');
var files = hilarious.sandbox_files = {
"foo": "rgb is great!\n",
"bar": "no\n it is\n not\n\t! :)\n",
"baz/quux": "hello world\n\nlorem ipsum dolor sit amet\n"
};
var ops = {
save: function(filename, contents, timeout, success, failure) {
files[filename] = contents;
success();
},
abort: function(saveRequest) {
console.log("this sandbox saves/loads synchronously and thus aborting is not needed");
},
load: function(filename, success, failure) {
if(_.has(files, filename)) {
success(files[filename]);
} else {
failure();
}
},
load_status: function(success, failure) {
success({
context_name: "Demo editor",
default_file_name: null,
editable_files: hilarious.algo.to_set(files)
});
}
};
if(hilarious.use_sandbox) {
hilarious.loadsave_ops = ops;
}
}());
|
JavaScript
| 0 |
@@ -289,16 +289,166 @@
%5Cn%22%0A%7D;%0A%0A
+// Using setTimeout(_, 0) just in case any other code depends on%0A// the callbacks being asynchronous (all the other saving modes%0A// do it that way).%0A%0A
var ops
@@ -513,24 +513,54 @@
failure) %7B%0A
+ setTimeout(function() %7B%0A
files%5Bfi
@@ -579,24 +579,26 @@
ntents;%0A
+
success();%0A
@@ -596,16 +596,27 @@
cess();%0A
+ %7D, 0);%0A
%7D,%0A a
@@ -784,24 +784,54 @@
failure) %7B%0A
+ setTimeout(function() %7B%0A
if(_.has
@@ -853,24 +853,26 @@
e)) %7B%0A
+
+
success(file
@@ -889,16 +889,18 @@
%5D);%0A
+
%7D else %7B
@@ -906,16 +906,18 @@
%7B%0A
+
+
failure(
@@ -923,17 +923,30 @@
();%0A
-%7D
+ %7D%0A %7D, 0);
%0A %7D,%0A
@@ -983,24 +983,54 @@
failure) %7B%0A
+ setTimeout(function() %7B%0A
success(
@@ -1037,16 +1037,18 @@
%7B%0A
+
+
context_
@@ -1074,16 +1074,18 @@
,%0A
+
default_
@@ -1101,16 +1101,18 @@
: null,%0A
+
ed
@@ -1158,17 +1158,30 @@
es)%0A
-%7D
+ %7D);%0A %7D, 0
);%0A %7D%0A%7D
|
7b2fc95c6a6d618c94e44c69a9abd263a2f7c058
|
Remove ensure_i18n from display settings.
|
static/js/settings_display.js
|
static/js/settings_display.js
|
var settings_display = (function () {
var exports = {};
var meta = {
loaded: false,
};
function change_display_setting(data, status_element, success_msg, sticky) {
var $status_el = $(status_element);
var status_is_sticky = $status_el.data('is_sticky');
var display_message = (status_is_sticky) ? $status_el.data('sticky_msg') : success_msg;
var opts = {
success_msg: display_message,
sticky: status_is_sticky || sticky,
};
if (sticky) {
$status_el.data('is_sticky', true);
$status_el.data('sticky_msg', success_msg);
}
settings_ui.do_settings_change(channel.patch, '/json/settings/display', data, status_element, opts);
}
exports.set_night_mode = function (bool) {
var night_mode = bool;
var data = {night_mode: JSON.stringify(night_mode)};
change_display_setting(data, '#display-settings-status');
};
exports.set_up = function () {
meta.loaded = true;
$("#display-settings-status").hide();
$("#user_timezone").val(page_params.timezone);
$(".emojiset_choice[value=" + page_params.emojiset + "]").prop("checked", true);
$("#default_language_modal [data-dismiss]").click(function () {
overlays.close_modal('default_language_modal');
});
$("#default_language_modal .language").click(function (e) {
e.preventDefault();
e.stopPropagation();
overlays.close_modal('default_language_modal');
var data = {};
var $link = $(e.target).closest("a[data-code]");
var setting_value = $link.attr('data-code');
data.default_language = JSON.stringify(setting_value);
var new_language = $link.attr('data-name');
$('#default_language_name').text(new_language);
change_display_setting(data, '#language-settings-status',
i18n.t("Saved. Please <a class='reload_link'>reload</a> for the change to take effect."), true);
});
$('#default_language').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
overlays.open_modal('default_language_modal');
});
$("#high_contrast_mode").change(function () {
var high_contrast_mode = this.checked;
var data = {};
data.high_contrast_mode = JSON.stringify(high_contrast_mode);
change_display_setting(data, '#display-settings-status');
});
$("#dense_mode").change(function () {
var dense_mode = this.checked;
var data = {};
data.dense_mode = JSON.stringify(dense_mode);
change_display_setting(data, '#display-settings-status');
});
$("#night_mode").change(function () {
exports.set_night_mode(this.checked);
});
$('body').on('click', '.reload_link', function () {
window.location.reload();
});
$("#left_side_userlist").change(function () {
var left_side_userlist = this.checked;
var data = {};
data.left_side_userlist = JSON.stringify(left_side_userlist);
change_display_setting(data, '#display-settings-status',
i18n.t("Saved. Please <a class='reload_link'>reload</a> for the change to take effect."), true);
});
$("#twenty_four_hour_time").change(function () {
var data = {};
var setting_value = $("#twenty_four_hour_time").is(":checked");
data.twenty_four_hour_time = JSON.stringify(setting_value);
change_display_setting(data, '#time-settings-status');
});
$("#user_timezone").change(function () {
var data = {};
var timezone = this.value;
data.timezone = JSON.stringify(timezone);
change_display_setting(data, '#time-settings-status');
});
$(".emojiset_choice").click(function () {
var emojiset = $(this).val();
var data = {};
data.emojiset = JSON.stringify(emojiset);
var spinner = $("#emoji-settings-status").expectOne();
loading.make_indicator(spinner, {text: settings_ui.strings.saving });
channel.patch({
url: '/json/settings/display',
data: data,
success: function () {
},
error: function (xhr) {
ui_report.error(settings_ui.strings.failure, xhr, $('#emoji-settings-status').expectOne());
},
});
});
$("#translate_emoticons").change(function () {
var data = {};
var setting_value = $("#translate_emoticons").is(":checked");
data.translate_emoticons = JSON.stringify(setting_value);
change_display_setting(data, '#emoji-settings-status');
});
};
exports.report_emojiset_change = function () {
// TODO: Clean up how this works so we can use
// change_display_setting. The challenge is that we don't want to
// report success before the server_events request returns that
// causes the actual sprite sheet to change. The current
// implementation is wrong, though, in that it displays the UI
// update in all active browser windows.
function emoji_success() {
if ($("#emoji-settings-status").length) {
loading.destroy_indicator($("#emojiset_spinner"));
$("#emojiset_select").val(page_params.emojiset);
ui_report.success(i18n.t("Emojiset changed successfully!"),
$('#emoji-settings-status').expectOne());
var spinner = $("#emoji-settings-status").expectOne();
settings_ui.display_checkmark(spinner);
}
}
if (page_params.emojiset === 'text') {
emoji_success();
return;
}
var sprite = new Image();
sprite.onload = function () {
var sprite_css_href = "/static/generated/emoji/" + page_params.emojiset + "_sprite.css";
$("#emoji-spritesheet").attr('href', sprite_css_href);
emoji_success();
};
sprite.src = "/static/generated/emoji/sheet_" + page_params.emojiset + "_64.png";
};
function _update_page() {
$("#twenty_four_hour_time").prop('checked', page_params.twenty_four_hour_time);
$("#left_side_userlist").prop('checked', page_params.left_side_userlist);
$("#default_language_name").text(page_params.default_language_name);
$("#translate_emoticons").prop('checked', page_params.translate_emoticons);
$("#night_mode").prop('checked', page_params.night_mode);
// TODO: Set emojiset selector here.
// Longer term, we'll want to automate this function
}
exports.update_page = function () {
i18n.ensure_i18n(_update_page);
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = settings_display;
}
|
JavaScript
| 0 |
@@ -5954,18 +5954,16 @@
%7D;%0A%0A
-function _
+exports.
upda
@@ -5969,16 +5969,28 @@
ate_page
+ = function
() %7B%0A
@@ -6465,83 +6465,8 @@
ion%0A
-%7D%0A%0Aexports.update_page = function () %7B%0A i18n.ensure_i18n(_update_page);%0A
%7D;%0A%0A
|
d88902a7185430a4d0b1a1ec40ba656e85a19a98
|
Fix find so that it calls sink.error on error, not sink.eof.
|
js/foam/core/dao/CloningDAO.js
|
js/foam/core/dao/CloningDAO.js
|
/**
* @license
* Copyright 2014 Google Inc. All Rights Reserved.
*
* 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.
*/
CLASS({
package: 'foam.core.dao',
name: 'CloningDAO',
properties: [
{
model_: 'BooleanProperty',
name: 'onSelect',
defaultValue: false
}
],
extendsModel: 'ProxyDAO',
methods: {
select: function(sink, options) {
if ( ! this.onSelect ) return this.SUPER(sink, options);
sink = sink || [].sink;
var future = afuture();
this.delegate.select({
put: function(obj, s, fc) {
obj = obj.deepClone();
sink.put && sink.put(obj, s, fc);
},
error: function() {
sink.error && sink.error.apply(sink, argumentS);
},
eof: function() {
sink.eof && sink.eof();
future.set(sink);
}
}, options);
return future.get;
},
find: function(key, sink) {
return this.SUPER(key, {
put: function(o) {
var clone = o.deepClone();
sink && sink.put && sink.put(clone);
},
error: sink && sink.eof && sink.eof.bind(sink)
});
}
}
});
|
JavaScript
| 0 |
@@ -1610,26 +1610,28 @@
nk && sink.e
-of
+rror
&& sink.eof
@@ -1628,18 +1628,20 @@
& sink.e
-of
+rror
.bind(si
|
82c422a3b9d96319cfc499a505e0514ceb50c8c0
|
add qualcomm to client list
|
assets/js/components/ecosystems/ClientsSection.js
|
assets/js/components/ecosystems/ClientsSection.js
|
import React, { Component } from 'react'
export default class ClientsSection extends Component {
render () {
return (
<div className="client-section">
<div className="section flexMiddle">
<h1>Our Clients</h1>
<div className="client-logos">
<img src="//cdn.langa.io/3rdparty/ibmwatson-logo.png" />
<img src="//cdn.langa.io/3rdparty/mco-logo.png" />
<img src="//cdn.langa.io/3rdparty/homeaway-logo.svg" />
<img src="//cdn.langa.io/3rdparty/xogroup-logo.png" />
<img src="//cdn.langa.io/3rdparty/itprotv-logo.png" />
<img src="//cdn.langa.io/3rdparty/milbar-logo.png" />
<img src="//cdn.langa.io/3rdparty/oxfordroad-logo.png" />
<img src="//cdn.langa.io/3rdparty/ibm-logo.png" />
<img src="//cdn.langa.io/3rdparty/underbuilt-logo.png" />
</div>
</div>
</div>
)
}
}
|
JavaScript
| 0 |
@@ -394,11 +394,16 @@
rty/
-mco
+qualcomm
-log
@@ -539,32 +539,95 @@
up-logo.png%22 /%3E%0A
+ %3Cimg src=%22//cdn.langa.io/3rdparty/mco-logo.png%22 /%3E%0A
%3Cimg
@@ -735,32 +735,32 @@
ar-logo.png%22 /%3E%0A
+
%3Cimg
@@ -817,71 +817,8 @@
/%3E%0A
- %3Cimg src=%22//cdn.langa.io/3rdparty/ibm-logo.png%22 /%3E%0A
|
aeadb1264565704f43b4f421f1c53341666e20aa
|
Update check failure should no longer bother the user unless they manually initiated the check
|
discord/addon/updates.js
|
discord/addon/updates.js
|
/**
* BPM for Discord
* (c) 2015-2016 ByzantineFailure
*
* Updates panel handlers. Version number inserted
* during the build process (see Makefile). Also creates
* updates notification span and checker
**/
var BPM_updatesSubpanel = {
init: null,
teardown: null
};
(function() {
var UPDATE_INTERVAL_HOURS = 3;
var codeVersion = /* REPLACE-WITH-DC-VERSION */;
function BPM_checkForUpdates(createAlert) {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.github.com/repos/ByzantineFailure/bpm/releases');
xhr.onreadystatechange = function() {
if(xhr.readyState != 4) return;
if(xhr.status !== 200 && xhr.status !== 304) {
alert('Error checking for updates, HTTP status: ' + xhr.status + '. Is Github down?');
return;
}
var response = JSON.parse(xhr.responseText);
//TODO: Will fail if there's no non-prereleases ready.
//Not a problem, though, fairly isolated, doesn't break anything
//Still should fix.
var release = response
.filter(function(release) {
return !release.prerelease;
})
.sort(function(a, b) {
var aDate = new Date(a.created_at);
var bDate = new Date(b.created_at);
if(aDate > bDate) {
return -1;
} else if (bDate > aDate) {
return 1;
} else {
return 0;
}
})
[0];
if(release.tag_name !== codeVersion) {
if(createAlert) {
alert('Current BPM for Discord version is ' + codeVersion + ', found version ' + release.tag_name + '\n' +
'Link to updates can be found in the Updates panel of BPM settings.');
}
addUpdatesNotifier(release.html_url);
} else if(createAlert) {
alert('BPM up to date!');
}
}
xhr.send(null);
}
function addUpdatesNotifier(url) {
var preexisting = document.getElementById('bpm-update-link');
if(preexisting) {
if(preexisting.href != url) {
preexisting.href = url;
}
return;
}
var li = document.createElement('li');
var ginner = document.createElement('div');
li.appendChild(ginner);
ginner.className = 'guild-inner';
ginner.id = 'bpm-new-version-button';
var link = document.createElement('a');
ginner.appendChild(link);
link.id = 'bpm-update-link';
link.href = url;
link.target = '_blank';
link.appendChild(document.createTextNode('Update'));
var container = document.querySelector('ul.guilds');
container.insertBefore(li, container.firstChild);
}
function initUpdates(subpanel) {
var updateButton = document.getElementById('bpm-check-for-updates-button');
updateButton.addEventListener('click', function(e) {
e.preventDefault();
BPM_checkForUpdates(true);
});
}
function teardownUpdates(subpanel) {
var updateButton = document.getElementById('bpm-check-for-updates-button');
updateButton.removeEventListener('click');
}
function backgroundUpdateCheck() {
BPM_checkForUpdates(false);
window.setTimeout(backgroundUpdateCheck, 1000 * 60 * 60 * UPDATE_INTERVAL_HOURS);
}
BPM_updatesSubpanel.init = initUpdates;
BPM_updatesSubpanel.teardown = teardownUpdates;
backgroundUpdateCheck();
})();
|
JavaScript
| 0 |
@@ -667,24 +667,59 @@
!== 304) %7B%0A
+ if(createAlert) %7B%0A
a
@@ -806,16 +806,31 @@
wn?'); %0A
+ %7D%0A
|
a499ec36152aa91813e732481237e8af4c97da87
|
Update TestResponseHandler.js
|
src/responseHandlers/TestResponseHandler.js
|
src/responseHandlers/TestResponseHandler.js
|
var jsface = require('jsface'),
_und = require('underscore'),
vm = require('vm'),
ErrorHandler = require('../utilities/ErrorHandler'),
AbstractResponseHandler = require('./AbstractResponseHandler'),
window = require("jsdom-nogyp").jsdom().parentWindow,
_jq = require("jquery")(window),
_lod = require("lodash"),
Helpers = require('../utilities/Helpers'),
log = require('../utilities/Logger'),
Backbone = require("backbone"),
xmlToJson = require("xml2js"),
Globals = require("../utilities/Globals"),
tv4 = require("tv4");
require('sugar');
/**
* @class TestResponseHandler
* @classdesc
*/
var TestResponseHandler = jsface.Class(AbstractResponseHandler, {
$singleton: true,
// function called when the event "requestExecuted" is fired. Takes 4 self-explanatory parameters
_onRequestExecuted: function(error, response, body, request) {
var results = this._runTestCases(error, response, body, request);
AbstractResponseHandler._onRequestExecuted.call(this, error, response, body, request, results);
this._logTestResults(results);
},
_runTestCases: function(error, response, body, request) {
if (this._hasTestCases(request)) {
var tests = this._getValidTestCases(request.tests);
var sandbox = this._createSandboxedEnvironment(error, response, body, request);
return this._runAndGenerateTestResults(tests, sandbox);
}
return {};
},
_hasTestCases: function(request) {
return !!request.tests;
},
// returns an array of test cases ( as strings )
_getValidTestCases: function(tests) {
return _und.reduce(tests.split(';'), function(listOfTests, testCase) {
var t = testCase.trim();
if (t.length > 0) {
listOfTests.push(t);
}
return listOfTests;
}, []);
},
// run and generate test results. Also exit if any of the tests has failed
// given the users passes the flag
_runAndGenerateTestResults: function(testCases, sandbox) {
var testResults = this._evaluateInSandboxedEnvironment(testCases, sandbox);
if (Globals.stopOnError) {
_und.each(_und.keys(testResults), function(key){
if (!testResults[key]) {
ErrorHandler.terminateWithError("Test case failed: " + key);
}
});
}
return testResults;
},
// evaluates a list of testcases in a sandbox generated by _createSandboxedEnvironment
// catches exceptions and throws a custom error message
_evaluateInSandboxedEnvironment: function(testCases, sandbox) {
var sweet= "for(p in sugar.object) Object.prototype[p] = sugar.object[p];";
sweet += "for(p in sugar.array) Array.prototype[p] = sugar.array[p];";
sweet += "for(p in sugar.string) String.prototype[p] = sugar.string[p];";
sweet += "for(p in sugar.date) Date.prototype[p] = sugar.date[p];";
sweet += "for(p in sugar.funcs) Function.prototype[p]= sugar.funcs[p];";
testCases = sweet + 'String.prototype.has = function(value){ return this.indexOf(value) > -1};' + testCases.join(";");
try {
vm.runInNewContext(testCases, sandbox);
} catch (err) {
ErrorHandler.exceptionError(err);
}
return sandbox.tests;
},
_getTransformedRequestData: function(request) {
var transformedData;
if (request.transformed.data === "") {
return {};
}
if (request.dataMode === "raw") {
transformedData = request.transformed.data;
} else {
transformedData = Helpers.transformFromKeyValue(request.transformed.data);
}
return transformedData;
},
// sets the env vars json as a key value pair
_setEnvironmentContext: function() {
return Helpers.transformFromKeyValue(Globals.envJson.values);
},
_createSandboxedEnvironment: function(error, response, body, request) {
var sugar = { array:{}, object:{}, string:{}, funcs:{}, date:{} };
Object.getOwnPropertyNames(Array.prototype).each(function(p) { sugar.array[p] = Array.prototype[p];});
Object.getOwnPropertyNames(Object.prototype).each(function(p) { sugar.object[p] = Object.prototype[p];});
Object.getOwnPropertyNames(String.prototype).each(function(p) { sugar.string[p] = String.prototype[p];});
Object.getOwnPropertyNames(Date.prototype).each(function(p) { sugar.date[p] = Date.prototype[p]};);
Object.getOwnPropertyNames(Function.prototype).each(function(p) { sugar.funcs[p] = Function.prototype[p]};);
return {
sugar: sugar,
tests: {},
responseHeaders: response.headers,
responseBody: body,
responseTime: response.stats.timeTaken,
request: {
url: request.transformed.url,
method: request.method,
headers: Helpers.generateHeaderObj(request.transformed.headers),
data: this._getTransformedRequestData(request),
dataMode: request.dataMode
},
responseCode: {
code: response.statusCode,
name: request.name,
detail: request.description
},
data: {},
iteration: Globals.iterationNumber,
environment: this._setEnvironmentContext(),
globals: {},
$: _jq,
_: _lod,
Backbone: Backbone,
xmlToJson: function(string) {
var JSON = {};
xmlToJson.parseString(string, {explicitArray: false,async: false}, function (err, result) {
JSON = result;
});
return JSON;
},
tv4: tv4,
console: {log: function(){}},
postman: {
setEnvironmentVariable: function(key, value) {
var envVar = _und.find(Globals.envJson.values, function(envObject){
return envObject["key"] === key;
});
if (envVar) { // if the envVariable exists replace it
envVar["value"] = value;
} else { // else add a new envVariable
Globals.envJson.values.push({
key: key,
value: value,
type: "text",
name: key
});
}
},
setGlobalVariable: function(key, value) {
// Set this guy up when we setup globals.
}
}
};
},
// logger for test case results
_logTestResults: function(results) {
_und.each(_und.keys(results), function(key) {
if (results[key]) {
log.testCaseSuccess(key);
} else {
ErrorHandler.testCaseError(key);
}
});
}
});
module.exports = TestResponseHandler;
|
JavaScript
| 0.000001 |
@@ -4476,26 +4476,26 @@
prototype%5Bp%5D
-%7D
;
+%7D
);%0A%09%09Object.
@@ -4591,18 +4591,18 @@
otype%5Bp%5D
-%7D
;
+%7D
);%0A%09%09ret
|
6bca7672f0014b1090c60fa103f9d02d59c8a8f2
|
Update cleanup script.
|
cleanup.js
|
cleanup.js
|
#!/user/bin/env nodejs
'use strict';
const fs = require('fs');
try {
fs.unlinkSync('dist/umd/PNotifyBrightTheme.js');
fs.unlinkSync('dist/umd/PNotifyMaterial.js');
} catch (e) {}
|
JavaScript
| 0 |
@@ -82,28 +82,24 @@
kSync('dist/
-umd/
PNotifyBrigh
@@ -137,12 +137,8 @@
ist/
-umd/
PNot
|
57278e92ff6f4231e556cf60fa38e18d8edda795
|
Fix geogw API
|
lib/models/dataset.js
|
lib/models/dataset.js
|
var mongoose = require('mongoose');
var async = require('async');
var _ = require('lodash');
var dgv = require('../dgv');
var geogw = require('../geogw');
var map = require('../mapping').map;
var Schema = mongoose.Schema;
var ObjectId = Schema.Types.ObjectId;
var DatasetSchema = new Schema({
_id: { type: String },
hashedId: String, // TEMP
// Last known title
title: { type: String }, // May be overriden by alternative revision
// Last known producers
producers: { type: [String] }, // May be overriden by alternative revision
// Attributes related to the publication on the udata platform
publication: {
// Unique ID on the udata platform
_id: { type: String, unique: true, sparse: true },
// Publication status: can be private or public
status: { type: String, enum: ['private', 'public'] },
// Organization on the udata platform which hold the dataset
organization: { type: ObjectId, ref: 'Organization' },
// Source catalog on the geogw platform from which the dataset is synced
sourceCatalog: { type: ObjectId },
// Published dataset revision
revision: { type: Date }
},
// List of organizations for which the dataset is matching criteria
matchingFor: [{ type: ObjectId, ref: 'Organization' }]
});
DatasetSchema.methods = {
fetchAndConvert: function (done) {
var datasetRef = this;
geogw.getRecordFromCatalog(datasetRef._id, datasetRef.publication.organization, function (err, sourceDataset) {
if (err) return done(err);
var uDataset;
datasetRef
.set('title', sourceDataset.metadata.title)
.set('producers', sourceDataset.organizations);
try {
uDataset = map(sourceDataset);
uDataset.organization = datasetRef.publication.organization;
uDataset.private = datasetRef.publication.status !== 'public';
} catch (e) {
return done(e);
}
done(null, uDataset);
});
},
fetchWorkingAccessToken: function (done) {
var Organization = mongoose.model('Organization');
var organization = new Organization({ _id: this.publication.organization });
organization.fetchWorkingAccessToken(done);
},
processSynchronization: function (type, done) {
var datasetRef = this;
async.parallel({
uDataset: _.bind(datasetRef.fetchAndConvert, datasetRef),
accessToken: _.bind(datasetRef.fetchWorkingAccessToken, datasetRef)
}, function (err, context) {
if (err) return done(err);
if (!context.accessToken) return done(new Error('No working accessToken found'));
function requestSyncCallback(err, publishedDataset) {
if (err) return done(err);
// var now = new Date();
if (type === 'create') {
datasetRef
// .set('_created', now)
.set('publication._id', publishedDataset.id);
}
datasetRef
// .set('_updated', now)
.save(done);
}
if (type === 'create') {
dgv.createDataset(context.uDataset, context.accessToken, requestSyncCallback);
} else if (type === 'update') {
dgv.updateDataset(datasetRef.publication._id, context.uDataset, context.accessToken, requestSyncCallback);
} else {
throw new Error('Unknown type for processSynchronization');
}
});
},
synchronize: function (done) {
this.processSynchronization('update', done);
},
publish: function (done) {
this.processSynchronization('create', done);
},
unpublish: function (done) {
var datasetRef = this;
datasetRef.fetchWorkingAccessToken(function (err, accessToken) {
if (err) return done(err);
if (!accessToken) return done(new Error('No working accessToken found'));
dgv.deleteDataset(datasetRef.publication._id, accessToken, function (err) {
if (err) return done(err);
datasetRef.set('publication', undefined).save(done);
});
});
}
};
mongoose.model('Dataset', DatasetSchema);
|
JavaScript
| 0.00004 |
@@ -1508,28 +1508,29 @@
ication.
-organization
+sourceCatalog
, functi
|
417ab07d9dffcc383960ff12fbd3cf5ef25980ba
|
Fix app base block handler being prematurely resolved when immediately shown after a click.
|
src/standard-xp-app/standard-xp-app-base.js
|
src/standard-xp-app/standard-xp-app-base.js
|
import './templates/base.scss';
import crashTemplate from './templates/crash.pug';
import './templates/crash.scss';
import blockInitTemplate from './templates/block-init.pug';
import './templates/block-init.scss';
import endTemplate from './templates/end.pug';
import './templates/end.scss';
import waitTemplate from './templates/wait.pug';
import './templates/wait.scss';
/**
* Standard Experimentation App Base class. The app is higly reconfigurable and any method
* can be safely replaced at any time. Cannot be used as is as it lacks a proper `runTrial`
* method implementation.
* @constructor
* @abstract
*/
export default class StandardXpAppBase {
/**
* @param {HTMLElement} node The node where to user for the app.
*/
constructor(node) {
/**
* The node where lives the app (read-only).
* @type {HTMLElement}
*/
Object.defineProperty(this, 'node', { value: node });
}
/**
* Must be overwriten by subclasses (or dynamically replaced).
* @param {Object} config the trial configuration
* @return {Promise<Object>} resolved with the trial results.
* @abstract
*/
runTrial() {
throw new Error('XpApp.runTrial is not implemented');
}
/**
* Show the wait view.
* @param {String} [message] The wait message.
*/
wait(message) {
this.node.innerHTML = waitTemplate(message);
}
/**
* By default start waiting when the app starts.
*/
start() {
return this.wait();
}
/**
* Show the crash view.
* @param {String} message The error message.
* @param {Error} [error] The error that has been raised.
* @param {Object} [run] The current run.
*/
crash(message, error, run) {
this.node.innerHTML = crashTemplate({
run,
message,
stack: error && error.stack
});
const detailsButton = this.node.querySelector('.details-button');
detailsButton.addEventListener('click', evt => {
evt.preventDefault();
this.node.querySelector('.xp-app-base').classList.toggle('with-details');
});
}
/**
* Show the block initialization view.
* @param {Object} blockInfo
* @return {Promise} Resolved when the user click/tap on the view.
*/
initBlock(blockInfo) {
return new Promise(resolve => {
this.node.innerHTML = blockInitTemplate(blockInfo);
const listener = evt => {
evt.preventDefault();
this.node.removeEventLister('click', listener);
resolve();
};
this.node.addEventListener('click', listener);
}).then(res => {
this.wait();
return res;
});
}
/**
* Show the end view.
*/
end() {
this.node.innerHTML = endTemplate();
}
}
|
JavaScript
| 0 |
@@ -367,16 +367,62 @@
scss';%0A%0A
+const XP_APP_BASE_CLASSNAME = 'xp-app-base';%0A%0A
/**%0A * S
@@ -2027,22 +2027,35 @@
tor(
-'.xp-app-base'
+%60.$%7BXP_APP_BASE_CLASSNAME%7D%60
).cl
@@ -2381,16 +2381,92 @@
kInfo);%0A
+ const appNode = this.node.querySelector(%60.$%7BXP_APP_BASE_CLASSNAME%7D%60);%0A
co
@@ -2523,30 +2523,28 @@
();%0A
-this.n
+appN
ode.removeEv
@@ -2551,16 +2551,18 @@
entListe
+ne
r('click
@@ -2605,30 +2605,28 @@
%7D;%0A
-this.n
+appN
ode.addEvent
|
f9f8b1b4a8c38a21361cb20a4ffb8889ee36fb2c
|
remove obsolete property from primitive complex type
|
src/sulfur/schema/type/complex/primitive.js
|
src/sulfur/schema/type/complex/primitive.js
|
/* Copyright (c) 2013, Erik Wienhold
* All rights reserved.
*
* Licensed under the BSD 3-Clause License.
*/
/* global define */
define([
'sulfur/schema/validator/all',
'sulfur/schema/validator/property',
'sulfur/schema/validator/prototype',
'sulfur/util/factory'
], function (AllValidator, PropertyValidator, PrototypeValidator, Factory) {
'use strict';
return Factory.derive({
initialize: function (options) {
this._qname = options.qname;
this._namespace = options.namespace;
this._valueType = options.valueType;
},
get qname() {
return this._qname;
},
get valueType() {
return this._valueType;
},
get allowedElements() {
return this.valueType.allowedElements;
},
isRestrictionOf: function (other) {
return this === other;
},
createValidator: function () {
var validators = [ PrototypeValidator.create(this.valueType.prototype) ];
this.allowedElements.toArray().reduce(function (validators, element) {
var validator = PropertyValidator.create('value',
element.type.createValidator(), [ element.name ]);
validators.push(validator);
return validators;
}, validators);
return AllValidator.create(validators);
}
});
});
|
JavaScript
| 0.000001 |
@@ -468,51 +468,8 @@
me;%0A
- this._namespace = options.namespace;%0A
|
7852353b06bbdc66440d71ec6331240e73940fae
|
Normalize namespace handling in collections
|
src/collections.js
|
src/collections.js
|
exports.sortByName = (a, b) => {
const aName = (a.properties != null ? a.properties.name : undefined) || a.name || a.id || 'Unknown';
const bName = (b.properties != null ? b.properties.name : undefined) || b.name || b.id || 'Unknown';
return aName.localeCompare(bName);
};
exports.sortBySeen = (ain, bin) => {
const a = ain;
const b = bin;
if (!a.seen) {
return 1;
}
if (!b.seen) {
return -1;
}
a.seen = typeof a.seen === 'object' ? a.seen : new Date(a.seen);
b.seen = typeof b.seen === 'object' ? b.seen : new Date(b.seen);
if (a.seen > b.seen) {
return -1;
}
if (b.seen > a.seen) {
return 1;
}
return 0;
};
exports.addToList = (list, entity, sort = exports.sortByName) => {
let found = false;
list.forEach((existing) => {
if (existing === entity) {
// Entity is already in list as-is, skip
found = true;
return;
}
const existingId = (existing.properties != null ? existing.properties.id : undefined)
|| existing.id || existing.name;
const entityId = (entity.properties != null ? entity.properties.id : undefined)
|| entity.id || entity.name;
if (existingId === entityId) {
// id match, replace
const exists = existing;
Object.keys(entity).forEach((key) => {
exists[key] = entity[key];
});
found = true;
}
});
if (found) { return; }
list.push(entity);
// Sort the list on desired criteria
list.sort(sort);
};
exports.removeFromList = (list, entity) => {
const matched = list.find((existing) => {
if (existing === entity) {
return true;
}
const existingId = (existing.properties != null ? existing.properties.id : undefined)
|| existing.id;
const entityId = (entity.properties != null ? entity.properties.id : undefined) || entity.id;
return (existingId === entityId);
});
if (!matched) {
return;
}
list.splice(list.indexOf(matched), 1);
};
|
JavaScript
| 0.000001 |
@@ -1,24 +1,63 @@
+const %7B basename %7D = require('path');%0A%0A
exports.sortByName = (a,
@@ -85,94 +85,196 @@
e =
-(a.properties != null ? a.properties.name : undefined) %7C%7C a.name %7C%7C a.id %7C%7C 'Unknown';
+exports.unnamespace(exports.getName(a));%0A const bName = exports.unnamespace(exports.getName(b));%0A return aName.localeCompare(bName);%0A%7D;%0A%0Aexports.getName = (obj, allowUnknown = true) =%3E %7B
%0A c
@@ -282,18 +282,19 @@
nst
-bN
+n
ame = (
-b
+obj
.pro
@@ -311,17 +311,19 @@
null ?
-b
+obj
.propert
@@ -347,17 +347,19 @@
ned) %7C%7C
-b
+obj
.name %7C%7C
@@ -363,15 +363,57 @@
%7C%7C
-b.id %7C%7C
+obj.id;%0A if (!name && allowUnknown) %7B%0A return
'Un
@@ -420,16 +420,20 @@
known';%0A
+ %7D%0A
return
@@ -437,34 +437,265 @@
urn
-aName.localeCompare(bName)
+name;%0A%7D;%0A%0Aexports.unnamespace = (name) =%3E %7B%0A if (name.indexOf('/') === -1) %7B%0A return name;%0A %7D%0A return basename(name);%0A%7D;%0A%0Aexports.namespace = (name, namespace) =%3E %7B%0A if (name.indexOf('/') !== -1) %7B%0A return name;%0A %7D%0A return %60$%7Bnamespace%7D/$%7Bname%7D%60
;%0A%7D;
@@ -1339,231 +1339,135 @@
d =
-(
ex
-isting.properties != null ? existing.properties.id : undefined)%0A %7C%7C existing.id %7C%7C existing.name;%0A const entityId = (entity.properties != null ? entity.properties.id : undefined)%0A %7C%7C entity.id %7C%7C entity.name
+ports.unnamespace(exports.getName(existing, false));%0A const entityId = exports.unnamespace(exports.getName(entity, false))
;%0A
@@ -1959,193 +1959,135 @@
d =
-(
ex
-isting.properties != null ? existing.properties.id : undefined)%0A %7C%7C existing.id;%0A const entityId = (entity.properties != null ? entity.properties.id : undefined) %7C%7C entity.id
+ports.unnamespace(exports.getName(existing, false));%0A const entityId = exports.unnamespace(exports.getName(entity, false))
;%0A
|
f91bbc11eb5959cb95145f281dc89c99a7101bad
|
update the noConflict function on d3ma, and update the d3.assert for customing the error log
|
src/common/core.js
|
src/common/core.js
|
var d3 = window.d3;
d3.ma = {};
d3.ma.version = '0.1.0';
|
JavaScript
| 0.000001 |
@@ -18,18 +18,390 @@
3;%0A%0A
-d3.ma = %7B%7D
+var previousD3ma = window.d3.ma;%0A%0Avar d3ma = d3.ma = %7B%7D;%0A%0Ad3ma.noConflict = function() %7B%0A%09window.d3ma= previousD3ma;%0A%09return d3ma;%0A%7D;%0A%0Ad3ma.assert = function(test, message) %7B%0A%09if(test) %7B return; %7D%0A%09throw new Error('%5Bd3.ma%5D ' + message);%0A%7D;%0A%0Ad3ma.assert(d3, 'd3.js is required');%0A%0Ad3ma.assert( typeof d3.version === 'string' && d3.version.match(/%5E3/), 'd3.js version 3 is required' )
;%0A%0Ad
@@ -424,8 +424,11 @@
0.1.0';%0A
+%0A%0A%0A
|
e7bb1f3d786babb4c5255ae14725ccaf2e4bd6b9
|
Update custom_funct.js
|
leaflet/JS-CSS/custom_funct.js
|
leaflet/JS-CSS/custom_funct.js
|
function leaflet_alert() {
alert("Clicking OK the user takes full responsibility of using this map.");
}
function leaflet_alert2() {
var txt;
var r = confirm("Clicking OK the user takes full responsibility of using this map.");
if (r != true) {
txt = "You pressed Cancel";
}
}
|
JavaScript
| 0.000001 |
@@ -161,17 +161,20 @@
onfirm(%22
-C
+By c
licking
@@ -232,64 +232,151 @@
map
-.%22);%0A if (r != true) %7B%0A txt = %22You pressed Cancel%22
+ and absolves the map developper of any responsibility.%22);%0A if (r != true) %7B%0A window.open('https://edrap.github.io/abruzzomap', '_blank')
;%0A
|
719900d8b561fcb080ccffa760ca917a57de7473
|
rename variables and use new baseDirectory variable
|
lib/npmrc-switcher.js
|
lib/npmrc-switcher.js
|
#! /usr/bin/env node
'use strict';
var findup = require("findup-sync");
var fs = require("fs");
var shell = require("child_process").execFile;
// Only check the value once
var baseDirectory = (function(){
return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
}());
var npmrcUserPath = getUserHome() + '/.npmrc';
var npmrcUserBackupPath = getUserHome() + '/.npmrc.bak';
function getPath() {
var npmrcPath = findup('.npmrc');
if (npmrcPath) {
if (npmrcPath !== npmrcUserPath) {
return npmrcPath;
}
} else {
return null;
}
}
function renameFile(currentFileName, newFileName) {
if (fs.existsSync(currentFileName)) {
fs.renameSync(currentFileName, newFileName);
if (fs.existsSync(currentFileName)) {
// You didn't get renamed bro...
throw new Error("Couldn't rename file.");
}
}
}
function copyFile(source, target, callback) {
shell('/bin/cp', [source, target], function() {
callback();
});
}
function returnToDefault() {
renameFile(npmrcUserBackupPath, npmrcUserPath);
}
function backupCurrent() {
renameFile(npmrcUserPath, npmrcUserBackupPath);
}
var path = getPath();
if (path) {
backupCurrent();
copyFile(path, npmrcUserPath, function() {
});
} else {
returnToDefault();
}
|
JavaScript
| 0 |
@@ -300,37 +300,38 @@
var
-npmrcUser
+baseFile
Path
+
=
-getUserHome()
+baseDirectory
+ '
@@ -344,25 +344,20 @@
c';%0Avar
-npmrcU
+ba
se
-r
BackupPa
@@ -365,21 +365,21 @@
h =
-getUserHome()
+baseDirectory
+ '
@@ -499,25 +499,24 @@
ath !==
-npmrcUser
+baseFile
Path) %7B%0A
@@ -1082,25 +1082,20 @@
ameFile(
-npmrcU
+ba
se
-r
BackupPa
@@ -1094,33 +1094,32 @@
BackupPath,
-npmrcUser
+baseFile
Path);%0A%7D%0A%0Afu
@@ -1162,32 +1162,26 @@
ile(
-npmrcUserPath, npmrcU
+baseFilePath, ba
se
-r
Back
@@ -1270,17 +1270,16 @@
th,
-npmrcUser
+baseFile
Path
|
e6900103f44df4faae9b0a6e6e4d9873fb002d0e
|
Fix repo URL
|
lib/parseReposToMd.js
|
lib/parseReposToMd.js
|
'use strict';
const _ = require('underscore');
const moment = require('moment');
module.exports = (repos) => {
let reposInMd = ``;
let years = [];
let months = []
_.each(repos, (repo) => {
let year = moment(repo.created_at).year();
let month = moment(repo.created_at).month();
let monthText = moment(repo.created_at).format('MMM');
if (!_.contains(years, year)) {
reposInMd += `### ${year}\n`;
years.push(year);
}
if (!_.contains(months, month)) {
reposInMd += `##### ${monthText}\n`;
months.push(month);
}
reposInMd += `- [\`${repo.name}\`](repo.url) ${repo.description}\n\n`;
});
return reposInMd;
};
|
JavaScript
| 0.000002 |
@@ -611,16 +611,24 @@
%5C%60%5D(
+$%7B
repo.
+html_
url
+%7D
) $%7B
|
8c15d4d0111777290169f8f3afe3544df2c9ee37
|
Refactor transanctional
|
lib/processor_base.js
|
lib/processor_base.js
|
var parse5 = require('parse5'),
request = require('request'),
EnvironmentOperator = require('./operators/control_flow/environment');
//Monad-inspired control flow: rollback to the previous value if the new one is undefined.
function transanctional(currentValue, newValue) {
if (newValue !== undefined)
return newValue;
return currentValue;
}
//ProcessorBase
var ProcessorBase = function () {
this.operators = [EnvironmentOperator];
this.environment = {
baseUrl: null,
inElement: null,
inBody: false
};
var processor = this;
//NOTE: we don't use .bind() here because it uses quite slow .apply() internally.
this.parser = new parse5.SimpleApiParser({
doctype: function (name, publicId, systemId) {
processor._onDoctype(name, publicId, systemId);
},
startTag: function (tagName, attrs, selfClosing) {
processor._onStartTag(tagName, attrs, selfClosing);
},
endTag: function (tagName) {
processor._onEndTag(tagName);
},
text: function (text) {
processor._onText(text);
},
comment: function (comment) {
processor._onComment(comment);
}
});
};
//Pure virtual
ProcessorBase.prototype.aggregateOperatorResults = null;
//Parser handlers
ProcessorBase.prototype._onDoctype = function (name, publicId, systemId) {
var doctype = {
name: name,
publicId: publicId,
systemId: systemId
};
for (var i = 0; i < this.operators.length; i++) {
if (this.operators[i].onDoctype)
doctype = transanctional(doctype, this.operators[i].onDoctype(doctype));
}
};
ProcessorBase.prototype._onStartTag = function (tagName, attrs, selfClosing) {
var startTag = {
tagName: tagName,
attrs: attrs,
selfClosing: selfClosing
};
for (var i = 0; i < this.operators.length; i++) {
if (this.operators[i].onStartTag)
startTag = transanctional(startTag, this.operators[i].onStartTag(startTag));
}
};
ProcessorBase.prototype._onEndTag = function (tagName) {
for (var i = 0; i < this.operators.length; i++) {
if (this.operators[i].onEndTag)
tagName = transanctional(tagName, this.operators[i].onEndTag(tagName));
}
};
ProcessorBase.prototype._onText = function (text) {
for (var i = 0; i < this.operators.length; i++) {
if (this.operators[i].onText)
text = transanctional(text, this.operators[i].onText(text));
}
};
ProcessorBase.prototype._onComment = function (comment) {
for (var i = 0; i < this.operators.length; i++) {
if (this.operators[i].onComment)
comment = transanctional(comment, this.operators[i].onComment(comment));
}
};
//API
ProcessorBase.prototype.fromHtml = function (html, baseUrl) {
this.environment.baseUrl = baseUrl;
this.environment.inElement = null;
this.environment.inBody = false;
for (var i = 0; i < this.operators.length; i++)
this.operators[i].reset(this.environment);
this.parser.parse(html);
return this.aggregateOperatorResults();
};
ProcessorBase.prototype.from = function (options, callback) {
var processor = this;
request(options, function (err, response, body) {
var results = null;
if (!err) {
//TODO decode body
results = processor.fromHtml(body, options.url || options.uri || options);
}
callback(err, response, results);
});
};
|
JavaScript
| 0.00001 |
@@ -251,23 +251,19 @@
ctional(
-current
+old
Value, n
@@ -277,20 +277,23 @@
) %7B%0A
-if (
+return
newValue
@@ -297,11 +297,11 @@
lue
-!
==
+=
und
@@ -310,54 +310,25 @@
ined
-)%0A return newValue;%0A%0A return current
+ ? oldValue : new
Valu
|
7905d1467fa9d8977b5a8205bb06f0c0dc92779e
|
Add function 'getTimeToken'
|
lib/requests/query.js
|
lib/requests/query.js
|
const request = require('./promise-request')
const Url = require('./url')
/**
* 获取楼层状态的状态
* @param {Number} floor 楼层的编号
*/
async function getFloorStatus(floor = 3) {
let { response, body } = await request(Url.Floor(floor), {
json: true
})
if (response.statusCode !== 200) {
throw new Error(`Bad status code ${response.status} when get floor status`);
}
return body
}
/**
* 获取自习区域的状态
* @param {AreaInfo} area 自习区域信息
*/
async function getAreaStatus(area) {
const now = new Date;
let { response, body } = await request(Url.Area(area), {
json: true
})
if (response.statusCode !== 200) {
throw new Error(`Bad status code ${response.status} when get area status`)
}
return body
}
/**
* 预约座位
* @param {Seat} seat 座位
* @param {UserInfo} userInfo 用户信息
* @param {Jar} jar Cookie 罐
* @return
*/
async function book(seat, userInfo, jar) {
const url = 'http://58.194.172.92:85/api.php/spaces/${seat.id}/book';
let { response, body } = await request(url, {
method: 'POST',
form: {
'access_token': userInfo.accessToken,
'userid': userInfo.id,
segment,
'type': 1
},
headers: { cookie: jar.toString() },
json: true
});
if (response.statusCode !== 200) {
throw new Error(`Bad status code ${response.status} when book the seat`);
}
return body
}
module.exports = {
getFloorStatus,
getAreaStatus,
book
}
|
JavaScript
| 0.001389 |
@@ -730,232 +730,767 @@
%0A *
-%E9%A2%84%E7%BA%A6%E5%BA%A7%E4%BD%8D%0A * @param %7BSeat%7D seat %E5%BA%A7%E4%BD%8D%0A * @param %7BUserInfo%7D userInfo %E7%94%A8%E6%88%B7%E4%BF%A1%E6%81%AF%0A * @param %7BJar%7D jar Cookie %E7%BD%90%0A * @return%0A */%0Aasync function book(seat, userInfo, jar) %7B%0A const url = 'http://58.194.172.92:85/api.php/spaces/$%7Bseat.id%7D/book';%0A
+Get a time token, which is used in booking request%0A * @param %7BSeat%7D seat The seat object%0A * @param %7BBoolean%7D tomorrow Indicates today or tomorrow%0A */%0Aasync function getTimeToken(area, tomorrow = false) %7B%0A let date = new Date()%0A%0A if (tomorrow) %7B%0A date.setDate(date.getDate() + 1)%0A %7D%0A%0A let %7B response, body %7D = await request(Url.TimeToken(area.id, date), %7B%0A json: true%0A %7D)%0A%0A if (response.statusCode !== 200) %7B%0A throw new Error(%60Bad status code $%7Bresponse.status%7D when get available intervals%60);%0A %7D%0A%0A console.log(require('util').inspect(body, false, 4, true))%0A return body.data.list%5B0%5D.id%0A%7D%0A%0A/**%0A * %E9%A2%84%E7%BA%A6%E5%BA%A7%E4%BD%8D%0A * @param %7BSeat%7D seat %E5%BA%A7%E4%BD%8D%0A * @param %7BUser%7D user %E7%94%A8%E6%88%B7%E4%BF%A1%E6%81%AF%0A * @param %7BNumber%7D timeToken%0A * @return%0A */%0Aasync function book(seat, user, timeToken) %7B
%0A l
@@ -1527,19 +1527,36 @@
request(
-u
+U
rl
+.Booking(seat.id)
, %7B%0A
@@ -1613,24 +1613,32 @@
user
-Info.
+.jar.get('
access
-T
+_t
oken
+')
,%0A
@@ -1659,23 +1659,34 @@
user
-Info.id
+.jar.get('userid')
,%0A
segm
@@ -1685,15 +1685,28 @@
+'
segment
+': timeToken
,%0A
@@ -1749,16 +1749,21 @@
cookie:
+user.
jar.toSt
@@ -1791,17 +1791,16 @@
rue%0A %7D)
-;
%0A%0A if (
@@ -1984,16 +1984,32 @@
Status,%0A
+ getTimeToken,%0A
book%0A%7D
|
2fe415f7e87c598904c347c56d447fb14f4ecd11
|
Fix typo
|
lib/starts-with-so.js
|
lib/starts-with-so.js
|
// Opinion: I think it's gross to start written English independant clauses with "so"
// most of the time. Maybe it's okay in spoken English.
//
// More on "so:"
// * http://www.nytimes.com/2010/05/22/us/22iht-currents.html?_r=0
// * http://comminfo.rutgers.edu/images/comprofiler/plug_profilegallery/84/pg_2103855866.pdf
// this implementation is really naive
var re = new RegExp('([^\n\\.;!?]+)([\\.;!?]+)', 'gi');
var startsWithSo = new RegExp('^(\\s)*so\\b[\\s\\S]', 'i');
module.exports = function (text) {
var suggestions = [];
var match, innerMatch;
while (match = re.exec(text)) {
if (innerMatch = startsWithSo.exec(match[1])) {
suggestions.push({
index: match.index + (innerMatch[1] || '').length,
offset: 2
});
}
}
return suggestions;
};
|
JavaScript
| 0.999999 |
@@ -58,17 +58,17 @@
independ
-a
+e
nt claus
|
244a0dcedcc3a714d3420c2dc348763e1d916ad7
|
Fix node port in home module
|
src/app/modules/home/home.controller.js
|
src/app/modules/home/home.controller.js
|
import nem from 'nem-sdk';
class HomeCtrl {
/**
* Initialize dependencies and properties
*
* @params {services} - Angular services to inject
*/
constructor(AppConstants, $localStorage, $http) {
'ngInject';
//// Module dependencies region ////
this._storage = $localStorage;
this._$http = $http;
this._AppConstants = AppConstants;
//// End dependencies region ////
//// Module properties region ////
this.appName = AppConstants.appName;
this.newUpdate = false;
this.updateInfo = {};
//// End properties region ////
this.checkBrowser();
this.getGeolocation();
this.checkLatestVersion();
}
//// Module methods region ////
/**
* Check if browser is supported or show an un-dismassable modal
*/
checkBrowser() {
// Detect recommended browsers
let isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
let isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
let isFirefox = /Firefox/.test(navigator.userAgent);
// If no recommended browser used, open modal
if(!isChrome && !isSafari && !isFirefox) {
$('#noSupportModal').modal({
backdrop: 'static',
keyboard: false
});
}
}
/**
* Get closest node from geolocation, if user agrees
*/
getGeolocation() {
// If no mainnet node in local storage
if (navigator.geolocation && !this._storage.selectedMainnetNode) {
// Get position
navigator.geolocation.getCurrentPosition((res) => {
// Get the closest nodes
nem.com.requests.supernodes.nearest(res.coords).then((res) => {
// Pick a random node in the array
let node = res.data[Math.floor(Math.random()*res.data.length)];
// Set the node in local storage
this._storage.selectedMainnetNode = nem.model.objects.create("endpoint")("http://"+node.ip, 7778);
}, (err) => {
// If error it will use default node
console.log(err);
});
}, (err) => {
console.log(err);
// Get all the active supernodes
nem.com.requests.supernodes.get(1).then((res) => {
// Pick a random node in the array
let node = res.data[Math.floor(Math.random()*res.data.length)];
// Set the node in local storage
this._storage.selectedMainnetNode = nem.model.objects.create("endpoint")("http://"+node.ip, 7778);
}, (err) => {
// If error it will use default node
console.log(err);
});
});
}
}
/**
* Check if a new version is available on Github
*/
checkLatestVersion() {
this._$http.get("https://api.github.com/repos/NemProject/NanoWallet/releases/latest").then((res) => {
let version = res.data.name;
let isVersion2 = parseInt(version.substr(0, version.indexOf('.'))) > 1;
if (isVersion2 && version !== this._AppConstants.version) {
this.newUpdate = true;
this.updateInfo = res.data;
}
});
}
//// End methods region ////
}
export default HomeCtrl;
|
JavaScript
| 0 |
@@ -2150,35 +2150,35 @@
p://%22+node.ip, 7
-778
+890
);%0A
@@ -2794,11 +2794,11 @@
p, 7
-778
+890
);%0A
|
cf17a93bee7ab3aae508b70bba61aafd5b84f7f4
|
Use HTTPS for gravatar (#24)
|
lib/utils/gravatar.js
|
lib/utils/gravatar.js
|
var md5Hex = require('md5-hex');
// Get gravatar url
function gravatarUrl(email) {
return 'http://www.gravatar.com/avatar/'+md5Hex(email)+'?s=200&d='+encodeURIComponent('https://www.gitbook.com/assets/images/avatars/user.png');
}
module.exports = {
url: gravatarUrl
};
|
JavaScript
| 0 |
@@ -93,16 +93,17 @@
rn 'http
+s
://www.g
|
0d0ef9294c8bacdbaa76c131517e63340073bd58
|
fix for language == html
|
lib/utils/markdown.js
|
lib/utils/markdown.js
|
var aug = require('aug');
var fs = require('fs');
var hl = require('highlight.js');
var marked = require('marked');
module.exports = function(text, highlight, callback) {
marked.setOptions({
// callback for code highlighter
gfm: true,
pedantic: false,
sanitize: false,
highlight: function(code, lang) {
var out;
if (!highlight) {
out = code;
} else if (lang) {
out = hl.highlight(lang, code).value;
} else {
out = hl.highlightAuto(code).value;
}
return out;
}
});
var result = marked(text);
callback(null, result);
};
|
JavaScript
| 0.000748 |
@@ -322,16 +322,74 @@
ang) %7B%0A%0A
+ if (lang == 'html') %7B%0A lang = 'xml';%0A %7D%0A
va
|
7bb0c46f853af7130dd3cabe84ce63c972c1cd4f
|
fix jsonparser
|
lib/data-manager/jsonparser.js
|
lib/data-manager/jsonparser.js
|
/*jshint esversion:6, node:true*/
'use strict';
class JSONParser {
constructor(manager) {
manager.parser('json', this.parse.bind(this));
}
/**
* Parse JSON into an array of results. Assumes top-level is array, unless
* opts.key is provided to pick a top-level key from parsed object as results.
* @param {string} contents
* @param {object} options
*/
parse(contents, opts) {
let results = JSON.parse(contents);
if (opts.key) results = results[opts.key];
return results;
}
}
module.exports = JSONParser;
|
JavaScript
| 0.000148 |
@@ -416,24 +416,82 @@
ts, opts) %7B%0A
+ if(typeof contents === 'object') return contents;%0A
let
|
2deb5c48c6643faf4aa244d772dee6d075ffdc49
|
remove recursive blocking
|
lib/workflows/load.js
|
lib/workflows/load.js
|
'use strict';
const dir = require('node-dir');
const yaml = require('js-yaml');
const globalConfig = require('config');
const path = require('path');
const utils = require('./utils');
/**
* Gets all Workflows
*
* @param {string} wfpath path to workflow directory
*
* @returns {Promise} - An {Array} containing {Object} for each workflow, including `name` {String}, `id` name {String}, and steps {Object} loaded from YAML config file
*/
const load = (wfpath) => {
const workflows = [];
const ids = [];
let workflowsPath = path.join(process.cwd(), 'workflows');
if (globalConfig.hasOwnProperty('workflows')) {
if (globalConfig.workflows.hasOwnProperty('directory')) {
workflowsPath = globalConfig.workflows.directory;
}
}
if (wfpath) {
workflowsPath = wfpath;
}
return new Promise((resolve, reject) => {
dir.readFiles(workflowsPath, {
match: /.yml$/,
exclude: /^\./,
recursive: false,
}, (err, content, next) => {
if (err) {
reject(err);
}
const config = yaml.safeLoad(content);
if (utils.check(config) !== true) {
reject(new Error(utils.check(config)));
}
if (ids.indexOf(config.id) === -1) {
ids.push(config.id);
workflows.push(config);
}
else {
reject(new Error(`Workflow ${config.id} is duplicated!`));
}
next();
}, (err) => {
if (err) {
reject(err);
}
resolve(workflows);
});
});
};
module.exports = load;
|
JavaScript
| 0 |
@@ -923,32 +923,8 @@
./,%0A
- recursive: false,%0A
|
d33b174e19f3aaf0f5ebf69cd30dfdc632da1ebf
|
Fix team search (#2573)
|
app/assets/javascripts/admin/team/team_list_view.js
|
app/assets/javascripts/admin/team/team_list_view.js
|
// @flow
/* eslint-disable jsx-a11y/href-no-hash */
import _ from "lodash";
import * as React from "react";
import { Table, Icon, Spin, Button, Input, Modal } from "antd";
import Utils from "libs/utils";
import messages from "messages";
import CreateTeamModal from "admin/team/create_team_modal_view.js";
import { getEditableTeams, deleteTeam } from "admin/admin_rest_api";
import Persistence from "libs/persistence";
import { PropTypes } from "@scalableminds/prop-types";
import { withRouter } from "react-router-dom";
import type { APITeamType } from "admin/api_flow_types";
import type { RouterHistory } from "react-router-dom";
const { Column } = Table;
const { Search } = Input;
type Props = {
history: RouterHistory,
};
type State = {
isLoading: boolean,
teams: Array<APITeamType>,
searchQuery: string,
isTeamCreationModalVisible: boolean,
};
const persistence: Persistence<State> = new Persistence(
{ searchQuery: PropTypes.string },
"teamList",
);
class TeamListView extends React.PureComponent<Props, State> {
state = {
isLoading: true,
teams: [],
searchQuery: "",
isTeamCreationModalVisible: false,
};
componentWillMount() {
this.setState(persistence.load(this.props.history));
}
componentDidMount() {
this.fetchData();
}
componentWillUpdate(nextProps, nextState) {
persistence.persist(this.props.history, nextState);
}
async fetchData(): Promise<void> {
const teams = await getEditableTeams();
this.setState({
isLoading: false,
teams,
});
}
handleSearch = (event: SyntheticInputEvent<>): void => {
this.setState({ searchQuery: event.target.value });
};
deleteTeam = (team: APITeamType) => {
Modal.confirm({
title: messages["team.delete"],
onOk: async () => {
this.setState({
isLoading: true,
});
deleteTeam(team.id).then(
() => {
this.setState({
isLoading: false,
teams: this.state.teams.filter(t => t.id !== team.id),
});
},
() => {
this.setState({
isLoading: false,
});
},
);
},
});
};
createTeam = async (newTeam: APITeamType) => {
this.setState({
isTeamCreationModalVisible: false,
teams: this.state.teams.concat([newTeam]),
});
};
render() {
const marginRight = { marginRight: 20 };
return (
<div className="container">
<div style={{ marginTag: 20 }}>
<div className="pull-right">
<Button
icon="plus"
style={marginRight}
type="primary"
onClick={() => this.setState({ isTeamCreationModalVisible: true })}
>
Add Team
</Button>
<Search
style={{ width: 200 }}
onPressEnter={this.handleSearch}
onChange={this.handleSearch}
value={this.state.searchQuery}
/>
</div>
<h3>Teams</h3>
<div className="clearfix" style={{ margin: "20px 0px" }} />
<Spin spinning={this.state.isLoading} size="large">
<Table
dataSource={Utils.filterWithSearchQueryOR(
this.state.teams,
["name", "owner", "parent"],
this.state.searchQuery,
)}
rowKey="id"
pagination={{
defaultPageSize: 50,
}}
style={{ marginTop: 30, marginBotton: 30 }}
>
<Column
title="Name"
dataIndex="name"
key="name"
sorter={Utils.localeCompareBy("name")}
/>
<Column
title="Action"
key="actions"
render={(__, script: APITeamType) => (
<a href="#" onClick={_.partial(this.deleteTeam, script)}>
<Icon type="delete" />Delete
</a>
)}
/>
</Table>
</Spin>
<CreateTeamModal
teams={this.state.teams}
isVisible={this.state.isTeamCreationModalVisible}
onOk={this.createTeam}
onCancel={() => this.setState({ isTeamCreationModalVisible: false })}
/>
</div>
</div>
);
}
}
export default withRouter(TeamListView);
|
JavaScript
| 0 |
@@ -3330,27 +3330,8 @@
ame%22
-, %22owner%22, %22parent%22
%5D,%0A
|
66219ea9a8e0705a35544a670c20cd75a8d9ca72
|
remove ckeditor override, as the latest version doesn't require it
|
app/assets/javascripts/content_block/application.js
|
app/assets/javascripts/content_block/application.js
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require ckeditor/override
//= require ckeditor/init
//= require_tree .
|
JavaScript
| 0 |
@@ -577,38 +577,8 @@
%0A//%0A
-//= require ckeditor/override%0A
//=
|
257bde6349d6ca8a93f634474576e3ad95cebfb1
|
Send connect message.
|
conduit.js
|
conduit.js
|
// Control-flow utilities.
var cadence = require('cadence')
var assert = require('assert')
// An evented message queue.
var Procession = require('procession')
// Evented stream reading and writing.
var Staccato = require('staccato')
// JSON for use in packets.
var Jacket = require('nascent.jacket')
// Orderly destruction of complicated objects.
var Destructible = require('destructible')
// Evented semaphore.
var Signal = require('signal')
// Return the first not null-like value.
var coalesce = require('extant')
// An error-frist callback work queue.
var Turnstile = require('turnstile/redux')
Turnstile.Queue = require('turnstile/queue')
function Conduit (input, output, receiver) {
this.destroyed = false
this._destructible = new Destructible('conduit/connection')
this._destructible.markDestroyed(this)
this._input = new Staccato.Readable(input)
this._destructible.addDestructor('input', this._input, 'destroy')
this._output = new Staccato.Writable(output)
this._destructible.addDestructor('output', this._output, 'destroy')
this._turnstile = new Turnstile
this._queue = new Turnstile.Queue(this, '_write', this._turnstile)
this._destructible.addDestructor('turnstile', this._turnstile, 'pause')
this.receiver = receiver
var pump = this.receiver.read.shifter().pump(this._queue, 'push')
this._destructible.addDestructor('pump', pump, 'cancel')
this._slices = []
this._record = new Jacket
this._closed = new Signal
this._destructible.addDestructor('closed', this._closed, 'unlatch')
this.ready = new Signal
this._destructible.addDestructor('ready', this.ready, 'unlatch')
}
Conduit.prototype._pump = cadence(function (async, buffer) {
async(function () {
this._parse(coalesce(buffer, new Buffer(0)), async())
this.ready.unlatch()
}, function () {
this._read(async())
}, function () {
this._closed.wait(async())
})
})
Conduit.prototype._buffer = cadence(function (async, buffer, start, end) {
async(function () {
var length = Math.min(buffer.length - start, this._chunk.length)
var slice = buffer.slice(start, start + length)
start += length
this._chunk.length -= length
if (this._chunk.length == 0) {
if (this._slices.length) {
this._slices.push(slice)
slice = Buffer.concat(this._slices)
this._slices.length = 0
} else {
slice = new Buffer(slice)
}
var envelope = this._chunk.body
var e = envelope
while (e.body != null) {
e = e.body
}
e.body = slice
this._chunk = null
this._record = new Jacket
this.receiver.write.enqueue(envelope, async())
} else {
this._slices.push(new Buffer(slice))
}
}, function () {
return start
})
})
Conduit.prototype._json = cadence(function (async, buffer, start, end) {
start = this._record.parse(buffer, start, end)
async(function () {
if (this._record.object != null) {
var envelope = this._record.object
switch (envelope.method) {
case 'envelope':
this.receiver.write.enqueue(envelope.body, async())
break
case 'chunk':
this._chunk = this._record.object
break
case 'trailer':
// var socket = this._sockets[envelope.to]
this.receiver.write.enqueue(null, async())
// delete this._sockets[envelope.to]
break
}
this._record = new Jacket
}
}, function () {
return start
})
})
Conduit.prototype._parse = cadence(function (async, buffer) {
var parse = async(function (start) {
if (start == buffer.length) {
return [ parse.break ]
}
if (this._chunk != null) {
this._buffer(buffer, start, buffer.length, async())
} else {
this._json(buffer, start, buffer.length, async())
}
})(0)
})
Conduit.prototype._read = cadence(function (async) {
var read = async(function () {
this._input.read(async())
}, function (buffer) {
if (buffer == null) {
return [ read.break ]
}
this._parse(buffer, async())
})()
})
Conduit.prototype._write = cadence(function (async, envelope) {
envelope = envelope.body
async(function () {
if (envelope == null) {
// TODO And then destroy the conduit.
this._output.write(JSON.stringify({
module: 'conduit',
method: 'trailer',
body: null
}) + '\n', async())
this._closed.unlatch()
} else {
var e = envelope
while (e.body != null && typeof e.body == 'object' && !Buffer.isBuffer(e.body)) {
e = e.body
}
if (Buffer.isBuffer(e.body)) {
var body = e.body
e.body = null
var packet = JSON.stringify({
module: 'conduit',
method: 'chunk',
length: body.length,
body: envelope
}) + '\n'
e.body = body
this._output.write(packet, async())
this._output.write(e.body, async())
} else {
this._output.write(JSON.stringify({
module: 'conduit',
method: 'envelope',
body: envelope
}) + '\n', async())
}
}
}, function () {
return []
})
})
Conduit.prototype.listen = function (buffer, callback) {
this._queue.turnstile.listen(this._destructible.monitor('turnstile'))
this._pump(buffer, this._destructible.monitor('pump'))
this._destructible.completed(callback)
}
Conduit.prototype.destroy = function () {
this._destructible.destroy()
}
module.exports = Conduit
|
JavaScript
| 0 |
@@ -5870,24 +5870,95 @@
callback) %7B%0A
+ this.receiver.write.push(%7B module: 'conduit', method: 'connect' %7D)%0A
this._qu
|
538560fc32ab7cd2bfbaf26e08b89f873bb30a72
|
fix cookie
|
libs/cookie/cookie.js
|
libs/cookie/cookie.js
|
/**
* Aifang Javascript Framework.
* Copyright 2012 ANJUKE Inc. All rights reserved.
*
*
* 这是cookie核心文件,
*
*
* @path: cookie/cookie.js
* @author: Jock
* @version: 1.0.0
* @date: 2012/02/10
*
*/
(function(J){
var D = document,
millisecond = 24 * 60 * 60 * 1000,
encode = encodeURIComponent,
decode = decodeURIComponent;
/**
* 验证字符串是否合法的cookie值
*
* @param {String} val cookie值
* @return {Boolean} 是否合法的cookie值
*/
function validString(val){
return J.isString(val) && '' !== val;
}
/**
* 设置cookie
*
* @param {String} name cookie名称
* @param {String} value cookie值
* @param {String} date cookie过期时间
* @param {String} path cookie path
* @param {String} domain cookie domain
* @param {String} secure cookie secure
* @return null
*/
/*function setCookie(name, value, date, domain, path, secure){
D.cookie = name + "=" + String(encode( value )) +
((date) ? ";expires=" + date.toGMTString() : "") +
(validString(path) ? ";path=" + path : "") +
(validString(domain) ? ";domain=" + domain : "" ) +
((secure) ? ";secure" : "" );
}*/
function setCookie(name, value, expires, domain, path, secure){
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires_date.toGMTString() : "") +
((path) ? ";path=" + path: "") +
((domain) ? ";domain=" + domain: "") +
((secure) ? ";secure": "");
}
var cookie = {
/**
* 获取cookie值
*
* @param {String} name cookie名称
* @return {String} cookie值
*/
/*getCookie: function (check_name) {
var a_all_cookies = document.cookie.split(';');
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for (i = 0; i < a_all_cookies.length; i++) {
a_temp_cookie = a_all_cookies[i].split('=');
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if (cookie_name == check_name) {
b_cookie_found = true;
if (a_temp_cookie.length > 1) {
cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if (!b_cookie_found) {
return null;
}
},*/
getCookie: function (name) {
var ret, m;
if (validString(name)) {
if ((m = String(D.cookie).match(
new RegExp('(?:^| )' + name + '(?:(?:=([^;]*))|;|$)')))) {
ret = m[1] ? decode(m[1]) : '';
}
}
return ret;
},
/**
* 设置cookie
*
* @param {String} name cookie名称
* @param {String} value cookie值
* @param {String} expires cookie过期时间 (单位天)
* @param {String} path cookie path
* @param {String} domain cookie domain
* @param {String} secure cookie secure
* @return null
*/
setCookie: function(name, value, expires, domain, path, secure) {
var date = '';
if (expires) {
date = new Date();
date.setTime(date.getTime() + expires * millisecond);
}
setCookie(name, value, date, domain, path, secure)
},
/*setCookie: function(name, value, expires, domain, path, secure) {
setCookie(name, value, expires, domain, path, secure)
},*/
/**
* 删除cookie
*
* @param {String} name cookie名称
* @return null
*/
rmCookie: function(name, domain, path, secure){
var expires = new Date();
expires.setTime(expires.getTime() - 10000);
setCookie(name, '', expires, domain, path, secure)
}
};
J.add('cookie', cookie);
J.mix(J, cookie);
})(J);
|
JavaScript
| 0.000002 |
@@ -864,18 +864,16 @@
*/%0A
-/*
function
@@ -1234,16 +1234,16 @@
%7D
-*/
%0A%0A
+/*
func
@@ -1776,24 +1776,26 @@
: %22%22);%0A %7D
+*/
%0A%0A var co
|
035b24d1d1b8f57027fc5d552fdc7208d7068f7f
|
remove unnecessary key prop
|
app/components/library/ListItemRadioButton/index.js
|
app/components/library/ListItemRadioButton/index.js
|
import { ListItem } from 'react-native-elements';
import RadioButton from 'react-native-radio-button';
import React from 'react';
import PropTypes from 'prop-types';
import { grey, primaryColor } from '../../../globals/colors';
import styles from './styles';
const ListItemRadioButton = ({ key, title, onSwitch, switched }) => (
<ListItem
key={key}
title={title}
rightIcon={
<RadioButton
animation={switched && 'bounceIn'}
isSelected={switched}
onPress={onSwitch}
innerColor={switched ? primaryColor : grey}
outerColor={switched ? primaryColor : grey}
/>
}
containerStyle={styles.container}
onPress={onSwitch}
/>
);
ListItemRadioButton.propTypes = {
key: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
onSwitch: PropTypes.func.isRequired,
switched: PropTypes.bool.isRequired,
};
export default ListItemRadioButton;
|
JavaScript
| 0.000008 |
@@ -288,13 +288,8 @@
= (%7B
- key,
tit
@@ -335,22 +335,8 @@
tem%0A
- key=%7Bkey%7D%0A
@@ -711,44 +711,8 @@
= %7B%0A
- key: PropTypes.string.isRequired,%0A
ti
|
34f7a93e18f16aceb69d4ff555f1bd30b5ca6d84
|
add basic plus sign
|
lib/features/add-row/AddRow.js
|
lib/features/add-row/AddRow.js
|
'use strict';
var domify = require('min-dom/lib/domify');
// document wide unique overlay ids
var ids = new (require('diagram-js/lib/util/IdGenerator'))('row');
/**
* Adds a control to the table to add more rows
*
* @param {EventBus} eventBus
*/
function AddRow(eventBus, sheet, elementRegistry, modeling) {
this.row = null;
var self = this;
// add the row control row
eventBus.on('utilityColumn.added', function(event) {
var column = event.column;
self.row = sheet.addRow({
id: 'tjs-controls',
isFoot: true
});
var node = domify('<a title="Add row" class="icon-dmn dmn-icon-plus"></a>');
node.addEventListener('mouseup', function() {
modeling.createRow({ id: ids.next() });
});
sheet.setCellContent({
row: self.row,
column: column,
content: node
});
});
}
AddRow.$inject = [ 'eventBus', 'sheet', 'elementRegistry', 'modeling' ];
module.exports = AddRow;
AddRow.prototype.getRow = function() {
return this.row;
};
|
JavaScript
| 0.000005 |
@@ -600,31 +600,39 @@
ss=%22
-icon-dmn dmn-icon-plus%22
+table-js-add-row%22%3E%3Cspan%3E+%3C/span
%3E%3C/a
|
a2323c20d4d5233ce7d17e620da1ad77def2ed3e
|
fix node 0.8 compatibility
|
lib/geocoder/googlegeocoder.js
|
lib/geocoder/googlegeocoder.js
|
'use strict';
(function () {
var net = require('net'),
crypto = require('crypto'),
url = require('url');
/**
* Constructor
* @param <object> httpAdapter Http Adapter
* @param <string> clientId Google client id
* @param <string> apiKey Google Api Key
*/
var GoogleGeocoder = function(httpAdapter, clientId, apiKey) {
if (!httpAdapter || httpAdapter == 'undefinded') {
throw new Error('Google Geocoder need an httpAdapter');
}
if (!apiKey || apiKey == 'undefinded') {
apiKey = null;
}
this.apiKey = apiKey;
if (!clientId || clientId == 'undefinded') {
clientId = null;
}
if (clientId && !apiKey) {
throw new Error('You must specify a apiKey (privateKey)');
}
this.clientId = clientId;
this.httpAdapter = httpAdapter;
};
// Google geocoding API endpoint
GoogleGeocoder.prototype._endpoint = 'https://maps.googleapis.com/maps/api/geocode/json';
/**
* Geocode
* @param <string> value Value to geocode (Adress)
* @param <function> callback Callback method
*/
GoogleGeocoder.prototype.geocode = function(value, callback) {
if (net.isIP(value)) {
throw new Error('Google Geocoder no suport geocoding ip');
}
var _this = this;
var params = this._prepareQueryString();
params.address = value;
this._signedRequest(this._endpoint, params);
this.httpAdapter.get(this._endpoint, params, function(err, result) {
if (err) {
throw err;
} else {
// status can be "OK", "ZERO_RESULTS", "OVER_QUERY_LIMIT", "REQUEST_DENIED", "INVALID_REQUEST", or "UNKNOWN_ERROR"
// error_message may or may not be present
if (result.status !== 'OK') {
return callback(new Error('Status is ' + result.status + '.' + (result.error_message ? ' ' + result.error_message : '')));
}
var results = [];
for(var i = 0; i < result.results.length; i++) {
results.push(_this._formatResult(result.results[i]));
}
callback(false, results);
}
});
};
GoogleGeocoder.prototype._prepareQueryString = function() {
var params = {
'sensor' : false
};
if (this.clientId) {
params.client = this.clientId;
}
return params;
};
GoogleGeocoder.prototype._signedRequest = function(endpoint, params) {
if (this.clientId) {
var request = url.parse(endpoint);
request.query = params;
request = url.parse(request.format());
request.path = '/maps/api/geocode/json?address=blah&sensor=false&client=foo';
var decodedKey = new Buffer(this.apiKey.replace('-', '+').replace('_', '/'), 'base64').toString('binary');
var hmac = crypto.createHmac('sha1', decodedKey);
hmac.update(request.path);
var signature = hmac.digest('base64');
signature = signature.replace('+', '-').replace('/', '_');
params.signature = signature;
}
return params;
};
GoogleGeocoder.prototype._formatResult = function(result) {
var country = null;
var countryCode = null;
var city = null;
var state = null;
var stateCode = null;
var zipcode = null;
var streetName = null;
var streetNumber = null;
for (var i = 0; i < result.address_components.length; i++) {
// Country
if (result.address_components[i].types.indexOf('country') >= 0) {
country = result.address_components[i].long_name;
}
if (result.address_components[i].types.indexOf('country') >= 0) {
countryCode = result.address_components[i].short_name;
}
// State
if (result.address_components[i].types.indexOf('administrative_area_level_1') >= 0) {
state = result.address_components[i].long_name;
}
if (result.address_components[i].types.indexOf('administrative_area_level_1') >= 0) {
stateCode = result.address_components[i].short_name;
}
// City
if (result.address_components[i].types.indexOf('locality') >= 0) {
city = result.address_components[i].long_name;
}
// Adress
if (result.address_components[i].types.indexOf('postal_code') >= 0) {
zipcode = result.address_components[i].long_name;
}
if (result.address_components[i].types.indexOf('route') >= 0) {
streetName = result.address_components[i].long_name;
}
if (result.address_components[i].types.indexOf('street_number') >= 0) {
streetNumber = result.address_components[i].long_name;
}
}
return {
'latitude' : result.geometry.location.lat,
'longitude' : result.geometry.location.lng,
'country' : country,
'city' : city,
'state' : state,
'stateCode' : stateCode,
'zipcode' : zipcode,
'streetName': streetName,
'streetNumber' : streetNumber,
'countryCode' : countryCode
};
};
/**
* Reverse geocoding
* @param <integer> lat Latittude
* @param <integer> lng Longitude
* @param <function> callback Callback method
*/
GoogleGeocoder.prototype.reverse = function(lat, lng, callback) {
var _this = this;
var params = this._prepareQueryString();
params.latlng = lat + ',' + lng;
this._signedRequest(this._endpoint, params);
this.httpAdapter.get(this._endpoint , params, function(err, result) {
if (err) {
throw err;
} else {
// status can be "OK", "ZERO_RESULTS", "OVER_QUERY_LIMIT", "REQUEST_DENIED", "INVALID_REQUEST", or "UNKNOWN_ERROR"
// error_message may or may not be present
if (result.status !== 'OK') {
return callback(new Error('Status is ' + result.status + '.' + (result.error_message ? ' ' + result.error_message : '')));
}
var results = [];
if(result.results.length > 0) {
results.push(_this._formatResult(result.results[0]));
}
callback(false, results);
}
});
};
module.exports = GoogleGeocoder;
})();
|
JavaScript
| 0 |
@@ -2824,23 +2824,19 @@
rse(
-request
+url
.format(
));%0A
@@ -2831,16 +2831,23 @@
.format(
+request
));%0A
|
2e1a3db7971f98f601c11eb04f976098e80b7d36
|
Set stripHash to true
|
lib/http/analyzers/index-of.js
|
lib/http/analyzers/index-of.js
|
'use strict'
const url = require('url')
const {is} = require('type-is')
const {pipe} = require('mississippi')
const htmlparser = require('htmlparser2')
const normalize = require('normalize-url')
const bufferize = require('../bufferize')
function stripQuery(location) {
const parsed = new url.URL(location)
parsed.search = ''
try {
return normalize(parsed.toString(), {
stripWWW: false,
removeTrailingSlash: false
})
} catch (error) {
// Url could not be normalized, return original URL.
// See https://github.com/sindresorhus/normalize-url/issues/24
return parsed.toString()
}
}
function extractLinks(token, options) {
let isIndexOf = false
const links = []
let baseUrl = stripQuery(token.finalUrl)
const parser = new htmlparser.WritableStream({
ontext: text => {
const matches = options.indexOfMatches || []
if (matches.some(match => text.trim().match(match))) {
isIndexOf = true
}
},
onopentag: (tag, attributes) => {
if (tag === 'base' && attributes.href) {
baseUrl = stripQuery(url.resolve(baseUrl, attributes.href))
}
if (isIndexOf && tag === 'a' && attributes.href) {
const resolved = stripQuery(url.resolve(baseUrl, attributes.href))
if (resolved !== baseUrl && resolved.startsWith(baseUrl)) {
links.push(resolved)
}
}
}
})
return new Promise((resolve, reject) => {
pipe(
token.response,
parser,
err => {
if (err) {
return reject(err)
}
resolve({isIndexOf, links})
}
)
})
}
async function analyzeIndexOf(token, options) {
if (token.analyzed) {
return false
}
const isHtml = token.fileTypes.some(type => is(type.mime, 'html'))
if (!isHtml) {
return false
}
options.logger.log('index-of:analyze:start', token)
const {isIndexOf, links} = await bufferize(token, () => extractLinks(token, options))
options.logger.log('index-of:analyze:end', token)
if (isIndexOf) {
token.type = 'index-of'
token.analyzed = true
token.children = []
if (links.length > 0) {
token.children = links.map(url => ({
inputType: 'url',
url
}))
}
}
}
module.exports = analyzeIndexOf
|
JavaScript
| 0.999985 |
@@ -431,16 +431,39 @@
h: false
+,%0A stripHash: true
%0A %7D)%0A
|
531c6fe9baaea438a9a822737c54e1d6b615d1b5
|
Update model.js
|
Unordered-javascript-examples/deeplearnjs-examples/mnist-eager/model.js
|
Unordered-javascript-examples/deeplearnjs-examples/mnist-eager/model.js
|
//import * as dl from 'deeplearn';
//import {MnistData} from './data';
// Hyperparameters.
const LEARNING_RATE = .05;
const BATCH_SIZE = 64;
const TRAIN_STEPS = 100;
// Data constants.
const IMAGE_SIZE = 784;
const LABELS_SIZE = 10;
//const math = dl.ENV.math;
const optimizer = new dl.SGDOptimizer(LEARNING_RATE);
// Set up the model and loss function.
var weights = dl.variable(dl.Array2D.randNormal([IMAGE_SIZE, LABELS_SIZE], 0, 1 / Math.sqrt(IMAGE_SIZE), 'float32'));
var model = function (xs) {
return math.matMul(xs, weights);
};
var loss = function (labels, ys) {
return math.mean(math.softmaxCrossEntropyWithLogits(labels, ys));
};
// Train the model.
async function train(data, log) {
const returnCost = true;
for (let i = 0; i < TRAIN_STEPS; i++) {
const cost = dl.optimizer.minimize( () => {
const batch = data.nextTrainBatch(BATCH_SIZE);
return loss(batch.labels, model(batch.xs));
}, returnCost);
log("loss[" + i + "]: " + cost.dataSync());
await dl.util.nextFrame();
}
}
// Tests the model on a set
async function test(data) {}
// Predict the digit number from a batch of input images.
function predict(x) {
const pred = math.scope(() => {
const axis = 1;
return math.argMax(model(x), axis);
});
return Array.from(pred.dataSync());
}
// Given a logits or label vector, return the class indices.
function classesFromLabel(y){
const axis = 1;
const pred = math.argMax(y, axis);
return Array.from(pred.dataSync());
}
|
JavaScript
| 0.000001 |
@@ -229,18 +229,16 @@
= 10;%0A%0A
-//
const ma
@@ -239,16 +239,22 @@
nst math
+Model2
= dl.EN
@@ -357,19 +357,21 @@
ction.%0A%0A
-var
+const
weights
@@ -478,19 +478,44 @@
32'));%0A%0A
-var
+%0A%0A%0A// Train the model.%0Aconst
model =
@@ -527,26 +527,24 @@
tion (xs) %7B%0A
-
return mat
@@ -544,16 +544,22 @@
urn math
+Model2
.matMul(
@@ -576,19 +576,21 @@
s);%0A%7D;%0A%0A
-var
+const
loss =
@@ -613,18 +613,16 @@
, ys) %7B%0A
-
return
@@ -626,16 +626,22 @@
urn math
+Model2
.mean(ma
@@ -691,18 +691,16 @@
));%0A%7D;%0A%0A
-%0A%0A
// Train
@@ -740,14 +740,10 @@
data
-, log
)
+
%7B%0A
@@ -827,19 +827,16 @@
cost =
-dl.
optimize
@@ -851,14 +851,19 @@
ze(
+function
()
- =%3E
%7B%0A
@@ -994,34 +994,35 @@
+console.
log(
-%22
+%60
loss%5B
-%22 + i + %22%5D: %22 +
+$%7Bi%7D%5D: $%7B
cost
@@ -1032,16 +1032,18 @@
taSync()
+%7D%60
);%0A%0A
@@ -1238,16 +1238,22 @@
d = math
+Model2
.scope((
@@ -1290,24 +1290,30 @@
return math
+Model2
.argMax(mode
@@ -1502,16 +1502,22 @@
d = math
+Model2
.argMax(
|
e9ea61fee4a0f78d5d9e9614e1e06b209f7adbcd
|
make linkBankOperation work
|
linkBankOperations.js
|
linkBankOperations.js
|
const moment = require('moment')
const bluebird = require('bluebird')
const cozyClient = require('./cozyclient')
const DOCTYPE = 'io.cozy.bank.operations'
const log = require('./logger')
module.exports = (entries, doctype, options = {}) => {
if (typeof options.identifiers === 'string') {
options.identifiers = [options.identifiers.toLowerCase()]
} else if (Array.isArray(options.identifiers)) {
options.identifiers = options.identifiers.map((id) => (id.toLowerCase()))
} else {
throw new Error('linkBankOperations cannot be called without "identifiers" option')
}
Object.assign(options, {
amountDelta: 0.001,
dateDelta: 15
})
options.minDateDelta = options.minDateDelta || options.dateDelta
options.maxDateDelta = options.maxDateDelta || options.dateDelta
// for each entry try to get a corresponding operation
return bluebird.each(entries, entry => {
let date = new Date(entry.paidDate || entry.date)
let startDate = moment(date).subtract(options.minDateDelta, 'days')
let endDate = moment(date).add(options.maxDateDelta, 'days')
// get the list of operation corresponding to the date interval arount the date of the entry
let startkey = `${startDate.format('YYYY-MM-DDT00:00:00.000')}Z`
let endkey = `${endDate.format('YYYY-MM-DDT00:00:00.000')}Z`
return cozyClient.data.defineIndex(DOCTYPE, ['date'])
.then(index => cozyClient.data.query(index, { selector: {
date: {
'$gt': startkey,
'$lt': endkey
}}
}))
.then(operations => {
// find the operations with the expected identifier
let operationToLink = null
let candidateOperationsForLink = []
let amount = Math.abs(parseFloat(entry.amount))
// By default, an entry is an expense. If it is not, it should be
// declared as a refund: isRefund=true.
if (entry.isRefund === true) amount *= -1
let minAmountDelta = Infinity
for (let operation of operations) {
let opAmount = Math.abs(operation.amount)
// By default, an entry is an expense. If it is not, it should be
// declared as a refund: isRefund=true.
if (entry.isRefund === true) opAmount *= -1
let amountDelta = Math.abs(opAmount - amount)
// Select the operation to link based on the minimal amount
// difference to the expected one and if the label matches one
// of the possible labels (identifier)
// If unsafe matching is enabled, also find all operations for which the entry could ba a part of
for (let identifier of options.identifiers) {
if (operation.label.toLowerCase().indexOf(identifier) >= 0 &&
amountDelta <= options.amountDelta &&
amountDelta <= minAmountDelta) {
operationToLink = operation
minAmountDelta = amountDelta
break
} else if (operation.label.toLowerCase().indexOf(identifier) >= 0 && // label must match
!operation.parent && // not a child operation itself
amountDelta > 0 && // op amount is smaller than entry amount
((entry.isRefund && operation.amount > 0) || // if entry is refund, op is refund
(!entry.isRefund && operation.amount < 0)) && // if entry is expense, op is expense
this.allowUnsafeLinks) {
candidateOperationsForLink.push(operation)
}
}
}
if (operationToLink !== null && entry._id) {
log('debug', operationToLink, 'There is an operation to link')
let link = `${doctype}:${entry._id}`
if (operationToLink.bill === link) return Promise.resolve()
return cozyClient.data.updateAttributes(DOCTYPE, operationToLink._id, { bill: link })
}
return Promise.resolve()
})
})
}
|
JavaScript
| 0.000001 |
@@ -179,16 +179,68 @@
logger')
+%0Aconst debug = require('debug')('linkBankOperation')
%0A%0Amodule
@@ -1585,24 +1585,88 @@
ations =%3E %7B%0A
+ debug(operations.length, 'Number of operations to check')%0A
// fin
@@ -3709,19 +3709,20 @@
& entry.
-_id
+file
) %7B%0A
@@ -3812,18 +3812,21 @@
= %60
-$%7Bdoctype%7D
+io.cozy.files
:$%7Be
@@ -3830,19 +3830,20 @@
$%7Bentry.
-_id
+file
%7D%60%0A
|
3aac9980fddc2871f540da0a723d592de5f3fbc1
|
Update hover text for RecommendedBadge component (#7994)
|
src/ui/components/RecommendedBadge/index.js
|
src/ui/components/RecommendedBadge/index.js
|
/* @flow */
import * as React from 'react';
import { compose } from 'redux';
import translate from 'core/i18n/translate';
import Icon from 'ui/components/Icon';
import type { I18nType } from 'core/types/i18n';
import './styles.scss';
type Props = {};
type InternalProps = {|
i18n: I18nType,
|};
export const RecommendedBadgeBase = (props: InternalProps) => {
const { i18n } = props;
const label = i18n.gettext('Recommended');
return (
<div className="RecommendedBadge">
<a
className="RecommendedBadge-link"
href="https://support.mozilla.org/"
rel="noopener noreferrer"
target="_blank"
title={i18n.gettext(
'Recommended extensions are vetted for exceptional security and performance.',
)}
>
<span className="RecommendedBadge-icon">
<Icon alt={label} name="recommended" />
</span>
<span className="RecommendedBadge-label">{label}</span>
</a>
</div>
);
};
const RecommendedBadge: React.ComponentType<Props> = compose(translate())(
RecommendedBadgeBase,
);
export default RecommendedBadge;
|
JavaScript
| 0 |
@@ -674,25 +674,38 @@
'
-R
+Firefox only r
ecommend
ed exten
@@ -696,18 +696,17 @@
ecommend
-ed
+s
extensi
@@ -713,34 +713,35 @@
ons
-are vetted for exceptional
+that meet our standards for
sec
|
5d4d4d33c751ca1823dcdf26dae5b4b3c1c81061
|
Add Surat Jalan
|
src/surat-jalan/surat-jalan-product-item.js
|
src/surat-jalan/surat-jalan-product-item.js
|
'use strict'
module.exports = class SuratJalanProductItem {
constructor(source) {
this.code = '';
this.name = '';
this.description = '';
this.totalPO = 0;
this.totalSJ = 0;
this.unit = '';
this.price = '';
}
}
|
JavaScript
| 0.000003 |
@@ -252,23 +252,22 @@
his.price =
-''
+0
;%0A %7D%0A%7D
|
e1e2ca082a4ac155d2eecb810304bfa461e69954
|
fix deprecation warning
|
compile.js
|
compile.js
|
#!/usr/bin/nodejs
'use strict';
global.DOMParser = require('xmldom').DOMParser;
//require('../closure-library/closure/goog/bootstrap/nodejs')
global.Blockly = require('./blockly_wrapped.js');
//require('./blocks_compressed.js');
//require('./javascript_compressed.js');
//require('./msg/js/en.js');
Blockly.Events.Create = function() { this.isNull=function(){return 1}; };
var fname = process.argv[0] == 'blockly' ? process.argv[1] : process.argv[2];
var fs = require('fs');
var xmlText = fs.readFileSync(fname, 'utf8');
try {
var xml = Blockly.Xml.textToDom(xmlText);
}
catch (e) {
console.log(e);
process.exit(2);
}
var workspace = new Blockly.Workspace();
Blockly.Xml.domToWorkspace(workspace, xml);
var code = Blockly.JavaScript.workspaceToCode(workspace);
var prepend = `
var HKOIInput = {
str : '',
lines : []
};
var window = {
'alert': function(x) {
console.log(x);
},
'prompt': function(x) {
while (true) {
var buf = new Buffer(1024);
var br = require('fs').readSync(process.stdin.fd, buf, 0, 1024);
if (br == 0) break;
HKOIInput.str += buf.toString(null, 0, br);
}
var lines = HKOIInput.str.split('\\n');
for (var i in lines) {
HKOIInput.lines.push(lines[i]);
}
return HKOIInput.lines.shift();
}
};
var HKOIUpdateVar = function() {};
`;
code = prepend + code;
fs.writeFileSync('program.exe', code);
fs.chmodSync('program.exe', 493);
|
JavaScript
| 0.000019 |
@@ -698,16 +698,21 @@
rkspace(
+xml,
workspac
@@ -716,13 +716,8 @@
pace
-, xml
);%0Av
|
9b693271c4adf9fba94f9c962910d9629dc029f3
|
Swap xbbcode.js build out for symlinked bbcode.js
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var concat = require('gulp-concat');
var rev = require('gulp-rev');
var minifyCSS = require('gulp-minify-css');
var uglifyJS = require('gulp-uglify');
gulp.task('copy-fonts', function() {
var fontPaths = [
'./public/vendor/bootstrap/fonts/**',
'./public/vendor/font-awesome/fonts/**'
];
gulp.src(fontPaths)
.pipe(gulp.dest('./dist/fonts/'));
});
gulp.task('build-css', ['copy-fonts'], function() {
var cssPaths = [
'./public/vendor/bootstrap/css/bootstrap.css',
'./public/vendor/bootstrap/css/bootstrap-theme.css',
'./public/vendor/font-awesome/css/font-awesome.css',
'./public/vendor/bootstrap-markdown/css/bootstrap-markdown.min.css',
'./public/css/bootstrap_overrides.css',
'./public/css/general.css'
];
gulp.src(cssPaths)
.pipe(concat('all.css'))
.pipe(minifyCSS())
.pipe(gulp.dest('./dist/'));
});
gulp.task('build-js', function() {
var jsPaths = [
'public/vendor/jquery/jquery-2.1.3.min.js',
'public/vendor/timeago/jquery.timeago.js',
'public/vendor/markdown/markdown.js',
'public/vendor/bootstrap-markdown/js/bootstrap-markdown.js',
'public/vendor/jquery-appear/jquery.appear.js',
'public/vendor/bootstrap/js/bootstrap.js',
'public/vendor/xbbcode/xbbcode/xbbcode.js',
'public/js/bbcode_editor.js'
];
gulp.src(jsPaths)
.pipe(concat('all.js'))
.pipe(uglifyJS())
.pipe(gulp.dest('./dist/'));
});
//
// Note: I usually have to run `gulp build-assets` twice for it
// to work. Need to look into why.
//
gulp.task('build-assets', ['build-css', 'build-js'], function() {
gulp.src(['dist/all.css', 'dist/all.js'])
.pipe(rev())
.pipe(gulp.dest('dist'))
.pipe(rev.manifest())
.pipe(gulp.dest('dist'));
});
|
JavaScript
| 0.000001 |
@@ -1280,25 +1280,24 @@
ode/xbbcode/
-x
bbcode.js',%0A
@@ -1291,24 +1291,57 @@
/bbcode.js',
+ // Symlinked to server/bbcode.js
%0A 'public
|
266a705ba2e938e1e08e73ae11687a4093fc9f33
|
Fix path to "main.css"
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
watch = require('gulp-watch'),
cleanCSS = require('gulp-clean-css'),
uglify = require('gulp-uglify'),
stylus = require('gulp-stylus'),
nib = require('nib'),
less = require('gulp-less'),
sass = require('gulp-sass'),
coffee = require('gulp-coffee'),
gutil = require('gulp-util'),
autoprefixer = require('gulp-autoprefixer'),
jade = require('gulp-jade'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
browserSync = require('browser-sync'),
rewriteCSS = require('gulp-rewrite-css');
// CSS
gulp.task('css', function () {
gulp.src('./css/all.css')
.pipe(autoprefixer({
browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1', 'Explorer 8', 'ie >= 8'],
cascade: false,
remove: false
}))
.pipe(cleanCSS())
.pipe(rewriteCSS({destination: './dist/css'}))
.pipe(sourcemaps.init())
.pipe(concat('all.min.css'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/css'));
});
// JS
gulp.task('js', function () {
gulp.src([
'./bower_components/jquery/dist/jquery.min.js',
'./bower_components/jquery-migrate/jquery-migrate.min.js',
'./bower_components/bootstrap/dist/js/bootstrap.min.js',
'./js/main.js',
'./js/coffee/coffee_main.js'
])
.pipe(uglify())
.pipe(sourcemaps.init())
.pipe(concat('all.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/js'));
// for IE
gulp.src([
'./bower_components/html5shiv/dist/html5shiv.min.js',
'./bower_components/respond/dest/respond.min.js'
])
.pipe(uglify())
.pipe(sourcemaps.init())
.pipe(concat('all.ie.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/js'));
});
// Stylus
gulp.task('stylus', function () {
gulp.src('./css/stylus/stylus_main.styl')
.pipe(stylus({use: nib()}))
.pipe(gulp.dest('./css/stylus'));
});
// LESS
gulp.task('less', function () {
gulp.src('./css/less/less_main.less')
.pipe(less())
.pipe(gulp.dest('./css/less'));
});
// SASS
gulp.task('sass', function () {
gulp.src('./css/scss/scss_main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css/scss'));
gulp.src('./css/sass/sass_main.sass')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css/sass'));
});
// CoffeeScript
gulp.task('coffee', function () {
gulp.src('./js/coffee/**/*.coffee')
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./js/coffee'));
});
// Jade
gulp.task('jade', function () {
gulp.src('./*.jade')
.pipe(jade())
.pipe(gulp.dest('./'));
});
// Images
gulp.task('images', function () {
return gulp.src('./img/**/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe(gulp.dest('./dist/img/'));
});
// Watcher
gulp.task('watch', function () {
gulp.watch([
'./bower_components/**/*.css',
'./css/main.css',
'./css/stylus/stylus_main.css',
'./css/less/less_main.css',
'./css/scss/scss_main.css',
'./css/sass/sass_main.css'
], ['css']);
gulp.watch([
'./bower_components/**/*.js',
'./js/main.js',
'./js/coffee/coffee_main.js'
], ['js']);
gulp.watch([
'./css/stylus/**/*.styl'
], ['stylus']);
gulp.watch([
'./css/less/**/*.less'
], ['less']);
gulp.watch([
'./css/scss/**/*.scss',
'./css/sass/**/*.sass'
], ['sass']);
gulp.watch([
'./js/coffee/**/*.coffee'
], ['coffee']);
gulp.watch([
'./*.jade'
], ['jade']);
});
// BrowserSync
gulp.task('browser-sync', function () {
browserSync.init([
'./dist/css/all.min.css',
'./dist/js/all.ie.min.js',
'./dist/js/all.min.js',
'./dist/img/**/*',
'./*.html'
], {
server: {
baseDir: './'
}});
});
// Images
gulp.task('screenshot', function () {
var Pageres = require('pageres');
pageres = new Pageres({delay: 2})
.src('localhost', ['1920x1080', '1366x768', '1280x1024'])
.src('localhost:3000', ['1920x1080', '1366x768', '1280x1024'])
.src('localhost:3001', ['1920x1080', '1366x768', '1280x1024'])
.dest('./dist/screenshots')
.run(function (err) {
console.log('Creating screenshots is done!');
});
});
// Compile
gulp.task('compile', ['stylus', 'less', 'sass', 'css', 'coffee', 'js', 'jade']);
// Deploy
gulp.task('deploy', ['images', 'screenshot']);
// default
gulp.task('default', ['watch', 'browser-sync']);
|
JavaScript
| 0.000222 |
@@ -3428,16 +3428,20 @@
'./css/
+css/
main.css
|
50374502ad2004e99ca4eb0b02736632d936b824
|
add date to deply commit line
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp'),
less = require('gulp-less'),
minify = require("gulp-mini-css"),
autoprfixer = require('gulp-autoprefixer'),
jshint = require('gulp-jshint'),
jsuglify = require('gulp-uglify'),
plumber = require('gulp-plumber'),
connect = require('gulp-connect'),
rename = require('gulp-rename'),
jade = require('gulp-jade'),
imageop = require('gulp-image-optimization'),
changed = require('gulp-changed'),
exec = require('child_process').exec;
var paths = {
input: {
js: "src/js/**/*js",
less: "src/less/**/*.less",
jade: "src/jade/**/*.jade",
img: ['src/img/**/*.png', 'src/img/**/*.jpg', 'src/img/**/*.gif', 'src/img/**/*.jpeg', 'src/img/**/*.*']
},
output: {
js: "build/js",
css: "build/css",
img: "build/img",
root: "build"
}
};
gulp.task('deploy', ['jade', 'less', 'js', 'image'], function(cb) {
exec('git add -f build; git commit -m "git deployment"; git push origin `git subtree split --prefix build`:gh-pages --force;git reset HEAD^;git reset build', function(err, stdout, stderr) {
if (err) return cb(err); // return error
console.log(stdout);
console.log(stderr);
cb(); // finished task
});
});
gulp.task('connect', function() {
connect.server({
root: paths.output.root,
livereload: true
});
});
gulp.task("less", function() {
return gulp.src(paths.input.less)
.pipe(plumber())
.pipe(less())
.pipe(autoprfixer())
.pipe(gulp.dest(paths.output.css))
.pipe(minify({
ext: '.min.css'
}))
.pipe(gulp.dest(paths.output.css))
.pipe(connect.reload());
});
gulp.task("jade", function() {
gulp.src("CNAME").pipe(gulp.dest(paths.output.root));
return gulp.src(paths.input.jade)
.pipe(plumber())
.pipe(jade())
.pipe(gulp.dest(paths.output.root))
.pipe(connect.reload());
});
gulp.task("js", function() {
return gulp.src(paths.input.js)
.pipe(plumber())
.pipe(jshint())
.pipe(rename({
extname: ".js"
}))
.pipe(gulp.dest(paths.output.js))
.pipe(jsuglify())
.pipe(rename({
extname: ".min.js"
}))
.pipe(gulp.dest(paths.output.js))
.pipe(connect.reload());
});
gulp.task("image", function() {
return gulp.src(paths.input.img)
.pipe(plumber())
.pipe(changed(paths.output.img))
.pipe(imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
}))
.pipe(gulp.dest(paths.output.img));
});
gulp.task("watch", function() {
gulp.watch(paths.input.less, ['less']);
gulp.watch(paths.input.js, ['js']);
gulp.watch(paths.input.jade, ['jade']);
gulp.watch(paths.input.img, ['image']);
});
gulp.task('default', ["connect", "less", "jade", "js", "image", "watch"]);
|
JavaScript
| 0 |
@@ -927,16 +927,35 @@
ployment
+ ' + new Date() + '
%22; git p
|
206e56c1f757f7f464a945e0ab2697afa648eadc
|
fix gulpfile
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var less = require('gulp-less');
var coffee = require('gulp-coffee');
var uglify = require('gulp-uglify');
var path = require('path');
lessPath = './core/static/style';
coffeePath = './core/static/script';
gulp.task('less', function() {
return gulp.src(lessPath + "/**/*.less").pipe(less()).pipe(gulp.dest(lessPath));
});
gulp.task('coffee', function() {
return gulp.src(coffeePath + "/**/*.coffee").pipe(coffee()).on('error', function(error) {
throw error;
}).pipe(uglify().pipe(gulp.dest(coffeePath)));
});
gulp.task('default', ['less', 'coffee'], function() {
gulp.watch(lessPath + "/**/*.less", function() {
return gulp.run('less');
});
return gulp.watch(coffeePath + "/**/*.coffee", function() {
return gulp.run('coffee');
});
});
|
JavaScript
| 0.000065 |
@@ -508,16 +508,17 @@
uglify()
+)
.pipe(gu
@@ -537,17 +537,16 @@
eePath))
-)
;%0A%7D);%0A%0Ag
@@ -559,36 +559,14 @@
sk('
-default', %5B'less', 'coffee'%5D
+watch'
, fu
@@ -569,25 +569,24 @@
, function()
-
%7B%0A gulp.wat
@@ -588,20 +588,22 @@
p.watch(
-less
+coffee
Path + %22
@@ -612,71 +612,30 @@
*/*.
-less%22, function() %7B%0A return gulp.run('less');%0A %7D);%0A return
+coffee%22,%5B'coffee'%5D);%0A
gul
@@ -634,38 +634,36 @@
);%0A gulp.watch(
-coffee
+less
Path + %22/**/*.co
@@ -664,67 +664,77 @@
*/*.
-coffee%22, function() %7B%0A return gulp.run('coffee');%0A %7D);%0A%7D
+less%22,%5B'less'%5D);%0A%7D);%0A%0Agulp.task('default', %5B'less', 'coffee', 'watch'%5D
);%0A
|
837cdd29bb2a155953cbc3687d34e48b8678401b
|
update gulpfile
|
gulpfile.js
|
gulpfile.js
|
'use strict'
const gulp = require('gulp')
gulp.task('generate-service-worker', (callback) => {
let path = require('path')
let swPrecache = require('sw-precache')
let rootDir = 'app'
swPrecache.write(path.join(rootDir, 'service-worker.js'), {
staticFileGlobs: [ rootDir + '/*.{html, png}', rootDir + '/elements/*.{js,html,png}', rootDir + '/bower_components/*/*.{js,html,png}', '/bower_components/*/!(Gruntfile.js)' ],
stripPrefix: rootDir,
replacePrefix: '/playbulb-polymer/app/'
}, callback)
})
|
JavaScript
| 0.000001 |
@@ -267,16 +267,22 @@
Globs: %5B
+%0A
rootDir
@@ -297,24 +297,30 @@
html, png%7D',
+%0A
rootDir + '
@@ -346,16 +346,22 @@
l,png%7D',
+%0A
rootDir
@@ -401,16 +401,22 @@
l,png%7D',
+%0A
'/bower
@@ -516,17 +516,16 @@
ymer/app
-/
'%0A %7D, c
|
765242987558b0577dd1b490f8be1fe2724caf21
|
Fix typo in validation rule comments (#472)
|
src/validation/rules/FieldsOnCorrectType.js
|
src/validation/rules/FieldsOnCorrectType.js
|
/* @flow */
/**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import type { ValidationContext } from '../index';
import { GraphQLError } from '../../error';
import suggestionList from '../../jsutils/suggestionList';
import quotedOrList from '../../jsutils/quotedOrList';
import type { Field } from '../../language/ast';
import type { GraphQLSchema } from '../../type/schema';
import type { GraphQLOutputType } from '../../type/definition';
import {
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
} from '../../type/definition';
export function undefinedFieldMessage(
fieldName: string,
type: string,
suggestedTypeNames: Array<string>,
suggestedFieldNames: Array<string>
): string {
let message = `Cannot query field "${fieldName}" on type "${type}".`;
if (suggestedTypeNames.length !== 0) {
const suggestions = quotedOrList(suggestedTypeNames);
message += ` Did you mean to use an inline fragment on ${suggestions}?`;
} else if (suggestedFieldNames.length !== 0) {
message += ` Did you mean ${quotedOrList(suggestedFieldNames)}?`;
}
return message;
}
/**
* Fields on correct type
*
* A GraphQL document is only valid if all fields selected are defined by the
* parent type, or are an allowed meta field such as __typenamme
*/
export function FieldsOnCorrectType(context: ValidationContext): any {
return {
Field(node: Field) {
const type = context.getParentType();
if (type) {
const fieldDef = context.getFieldDef();
if (!fieldDef) {
// This field doesn't exist, lets look for suggestions.
const schema = context.getSchema();
const fieldName = node.name.value;
// First determine if there are any suggested types to condition on.
const suggestedTypeNames =
getSuggestedTypeNames(schema, type, fieldName);
// If there are no suggested types, then perhaps this was a typo?
const suggestedFieldNames = suggestedTypeNames.length !== 0 ?
[] :
getSuggestedFieldNames(schema, type, fieldName);
// Report an error, including helpful suggestions.
context.reportError(new GraphQLError(
undefinedFieldMessage(
fieldName,
type.name,
suggestedTypeNames,
suggestedFieldNames
),
[ node ]
));
}
}
}
};
}
/**
* Go through all of the implementations of type, as well as the interfaces
* that they implement. If any of those types include the provided field,
* suggest them, sorted by how often the type is referenced, starting
* with Interfaces.
*/
function getSuggestedTypeNames(
schema: GraphQLSchema,
type: GraphQLOutputType,
fieldName: string
): Array<string> {
if (type instanceof GraphQLInterfaceType ||
type instanceof GraphQLUnionType) {
const suggestedObjectTypes = [];
const interfaceUsageCount = Object.create(null);
schema.getPossibleTypes(type).forEach(possibleType => {
if (!possibleType.getFields()[fieldName]) {
return;
}
// This object type defines this field.
suggestedObjectTypes.push(possibleType.name);
possibleType.getInterfaces().forEach(possibleInterface => {
if (!possibleInterface.getFields()[fieldName]) {
return;
}
// This interface type defines this field.
interfaceUsageCount[possibleInterface.name] =
(interfaceUsageCount[possibleInterface.name] || 0) + 1;
});
});
// Suggest interface types based on how common they are.
const suggestedInterfaceTypes = Object.keys(interfaceUsageCount)
.sort((a, b) => interfaceUsageCount[b] - interfaceUsageCount[a]);
// Suggest both interface and object types.
return suggestedInterfaceTypes.concat(suggestedObjectTypes);
}
// Otherwise, must be an Object type, which does not have possible fields.
return [];
}
/**
* For the field name provided, determine if there are any similar field names
* that may be the result of a typo.
*/
function getSuggestedFieldNames(
schema: GraphQLSchema,
type: GraphQLOutputType,
fieldName: string
): Array<string> {
if (type instanceof GraphQLObjectType ||
type instanceof GraphQLInterfaceType) {
const possibleFieldNames = Object.keys(type.getFields());
return suggestionList(fieldName, possibleFieldNames);
}
// Otherwise, must be a Union type, which does not define fields.
return [];
}
|
JavaScript
| 0 |
@@ -1525,18 +1525,18 @@
_typenam
-m
e
+.
%0A */%0Aexp
|
47bea7ce21059c3c4105bad1983067ec2c4b6c5c
|
Make sure test runs have the most up to date assets
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var del = require('del');
var compass = require('gulp-compass');
var browserify = require('browserify');
var hologram = require('gulp-hologram');
var connect = require('gulp-connect');
var open = require('gulp-open');
var ejs = require('gulp-ejs');
var fs = require('fs');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
gulp.task('default', [
'watch',
'serve'
]);
gulp.task('test', [
'_lint',
'_cssCritic',
]);
gulp.task('watch', ['assets'], function() {
gulp.watch("src/**/*", ['assets']);
});
gulp.task('serve', function() {
connect.server({
root: ['dist'],
port: 8000,
livereload: true
});
});
gulp.task('clean', function(done) {
del(['dist'], {force: true}, done);
});
gulp.task('assets', [
'_styles',
'_scripts',
'_images',
'_fonts',
'_styleguide'
]);
// private
gulp.task('_styleguide', [
'clean',
'_hologramBuild',
'_copyStyleguideAssets',
'_copyRandomAssets']);
gulp.task('_styles', [
'clean',
'_compassBuild',
'_copyPrism'
]);
gulp.task('_fonts', [
'clean',
'_fontAwesome',
'_sourceSansPro'
]);
gulp.task('_compassBuild', ['clean'], function() {
gulp.src(['src/pivotal-ui/pivotal-ui.scss', 'src/style_guide/style_guide.scss'])
.pipe(compass({
config_file: './config/compass.rb',
css: 'dist',
sass: 'src'
}).on('error', function() { console.error(arguments) })
);
});
gulp.task('_copyPrism', ['clean'], function() {
gulp.src(['src/syntax-highlighting/*.css'])
.pipe(gulp.dest('./dist/syntax-highlighting/'));
});
gulp.task('_scripts', ['clean'], function() {
browserify('./src/pivotal-ui/javascripts/pivotal-ui.js').bundle()
.pipe(source('./pivotal-ui.js'))
.pipe(gulp.dest('dist/pivotal-ui/'))
});
gulp.task('_images', ['clean'], function() {
gulp.src('src/images/**/*')
.pipe(gulp.dest('./dist/images/'));
});
gulp.task('_fontAwesome', ['clean'], function() {
gulp.src([
'node_modules/font-awesome/fonts/*',
])
.pipe(gulp.dest('./dist/fonts/'));
});
gulp.task('_sourceSansPro', ['clean'], function() {
gulp.src([
'src/source-sans-pro/**/*',
'!src/source-sans-pro/source-sans-pro.css.scss'
])
.pipe(gulp.dest('./dist/fonts/'));
});
gulp.task('_copyStyleguideAssets', ['clean'], function() {
gulp.src(['src/style_guide/*.js', 'src/style_guide/github.css'])
.pipe(gulp.dest('./dist/style_guide'));
});
gulp.task('_copyRandomAssets', ['clean'], function() {
gulp.src([
'src/nginx.conf',
'src/Staticfile',
'src/style_guide/404.html',
'src/style_guide/pane.html'
])
.pipe(gulp.dest('./dist/'));
});
gulp.task('_hologramBuild', ['clean'], function() {
gulp.src('hologram_config.yml')
.pipe(hologram({
bundler: true
}));
});
gulp.task('_copyTestAssets', ['assets'], function() {
return gulp.src([
'dist/**/*',
]).pipe(gulp.dest('./test/dist/'));
});
gulp.task('_createTestFileList', function(cb) {
fs.readdir('./test/components/', function(err, files) {
if (err) {
console.error(err);
process.exit(1)
}
var stream = gulp.src('./test/regressionRunner.ejs')
.pipe(ejs({
files: files
}, {
ext: '.js'
}))
.pipe(gulp.dest('./test/'));
stream.on('finish', cb)
});
});
gulp.task('_cssCritic', ['_lint', '_copyTestAssets', '_createTestFileList'], function() {
gulp.src("./test/regressionRunner.html")
.pipe(open("./test/regressionRunner.html",{app:"firefox"}));
});
gulp.task('_lint', function() {
return gulp.src('./src/pivotal-ui/javascripts/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'))
});
|
JavaScript
| 0 |
@@ -539,32 +539,51 @@
atch', %5B'assets'
+, '_copyTestAssets'
%5D, function() %7B%0A
@@ -612,24 +612,43 @@
%22, %5B'assets'
+, '_copyTestAssets'
%5D);%0A%7D);%0A%0Agul
@@ -1051,24 +1051,25 @@
andomAssets'
+%0A
%5D);%0A%0Agulp.ta
@@ -1254,32 +1254,39 @@
function() %7B%0A
+return
gulp.src(%5B'src/p
@@ -1561,32 +1561,39 @@
function() %7B%0A
+return
gulp.src(%5B'src/s
@@ -1726,16 +1726,23 @@
n() %7B%0A
+return
browseri
@@ -1921,32 +1921,39 @@
function() %7B%0A
+return
gulp.src('src/im
@@ -2053,32 +2053,39 @@
function() %7B%0A
+return
gulp.src(%5B%0A '
@@ -2215,32 +2215,39 @@
function() %7B%0A
+return
gulp.src(%5B%0A '
@@ -2427,32 +2427,39 @@
function() %7B%0A
+return
gulp.src(%5B'src/s
@@ -2605,32 +2605,39 @@
function() %7B%0A
+return
gulp.src(%5B%0A '
@@ -2828,32 +2828,39 @@
function() %7B%0A
+return
gulp.src('hologr
@@ -3537,26 +3537,33 @@
unction() %7B%0A
-
+return
gulp.src(%22./
|
917c073f2436c12ac840e0a9473c1ae1394b19ca
|
update change value
|
packages/api-generator/src/maps/v-chip-group.js
|
packages/api-generator/src/maps/v-chip-group.js
|
module.exports = {
'v-chip-group': {
events: [
{
name: 'change',
value: 'number',
},
],
},
}
|
JavaScript
| 0.000003 |
@@ -100,16 +100,24 @@
'number
+ %7C array
',%0A
|
87656b259e9161214747a62454b04474198d47b7
|
Remove auto scroll past native url bar
|
src/www/js/app/ui/pageviews/BasePageView.js
|
src/www/js/app/ui/pageviews/BasePageView.js
|
define(function(require) {
var Detection = require('lavaca/env/Detection'),
PageView = require('lavaca/mvc/PageView'),
Promise = require('lavaca/util/Promise'),
viewManager = require('lavaca/mvc/ViewManager'),
common = require('app/ui/common'),
$ = require('$'),
History = require('lavaca/net/History');
require('lavaca/fx/Animation'); //jquery plugins
/**
* A View from which all other application Views can extend.
* Adds support for animating between views.
*
* @class app.ui.views.BasePageView
* @extends Lavaca.mvc.View
*
*/
var BasePageView = PageView.extend(function() {
PageView.apply(this, arguments);
this.mapEvent('.cancel', 'tap', this.onTapCancel);
common.mapGlobals.call(this);
}, {
/**
* The name of the template used by the view
* @property {String} template
* @default 'default'
*/
template: 'default',
/**
* The name of the template used by the view
* @property {Object} pageTransition
* @default 'default'
*/
pageTransition: {
'in': '',
'out': '',
'inReverse': '',
'outReverse': ''
},
/**
* Executes when the template renders successfully. This implementation
* adds support for animations between views, based off of the animation
* property on the prototype.
* @method onRenderSuccess
*
* @param {Event} e The render event. This object should have a string property named "html"
* that contains the template's rendered HTML output.
*/
onRenderSuccess: function() {
// Scroll iPhone past url bar
if (!navigator.standalone && (Detection.iphone || Detection.ipod)) {
var height = document.documentElement.clientHeight;
$(document.body).height(height + 60);
setTimeout(scrollTo, 0, 0, 1);
}
PageView.prototype.onRenderSuccess.apply(this, arguments);
},
/**
* Handler for when a cancel control is tapped
* @method onTapCancel
*
* @param {Event} e The tap event.
*/
onTapCancel: function(e) {
e.preventDefault();
viewManager.dismiss(e.currentTarget);
},
/**
* Executes when the user navigates to this view. This implementation
* adds support for animations between views, based off of the animation
* property on the prototype.
* @method enter
*
* @param {jQuery} container The parent element of all views
* @param {Array} exitingViews The views that are exiting as this one enters
* @return {Lavaca.util.Promise} A promise
*/
enter: function(container, exitingViews) {
return PageView.prototype.enter.apply(this, arguments)
.then(function() {
if (History.isRoutingBack) {
if (History.animationBreadcrumb.length > 0) {
this.pageTransition = History.animationBreadcrumb.pop();
}
} else {
History.animationBreadcrumb.push(this.pageTransition);
}
var animationIn = History.isRoutingBack ? this.pageTransition['inReverse']:this.pageTransition['in'],
animationOut = History.isRoutingBack ? this.pageTransition['outReverse']:this.pageTransition['out'],
i = -1,
exitingView;
var triggerEnterComplete = function() {
this.trigger('entercomplete');
this.shell.removeClass(animationIn);
};
if (Detection.animationEnabled && animationIn !== '') {
if (exitingViews.length) {
i = -1;
while (!!(exitingView = exitingViews[++i])) {
exitingView.shell.addClass(animationOut);
if (animationOut === '') {
exitingView.exitPromise.resolve();
}
}
}
if ((this.layer > 0 || exitingViews.length > 0)) {
this.shell
.nextAnimationEnd(triggerEnterComplete.bind(this))
.addClass(animationIn + ' current');
} else {
this.shell.addClass('current');
this.trigger('entercomplete');
}
} else {
this.shell.addClass('current');
if (exitingViews.length > 0) {
i = -1;
while (!!(exitingView = exitingViews[++i])) {
exitingView.shell.removeClass('current');
if (exitingView.exitPromise) {
exitingView.exitPromise.resolve();
}
}
}
this.trigger('entercomplete');
}
});
},
/**
* Executes when the user navigates away from this view. This implementation
* adds support for animations between views, based off of the animation
* property on the prototype.
* @method exit
*
* @param {jQuery} container The parent element of all views
* @param {Array} enteringViews The views that are entering as this one exits
* @return {Lavaca.util.Promise} A promise
*/
exit: function(container, enteringViews) {
var animation = History.isRoutingBack ? this.pageTransition['outReverse'] : (enteringViews.length ? enteringViews[0].pageTransition['out'] : '');
if (History.isRoutingBack && this.shell.data('layer-index') > 0) {
this.pageTransition = History.animationBreadcrumb.pop();
animation = this.pageTransition['outReverse'];
}
if (Detection.animationEnabled && animation) {
this.exitPromise = new Promise(this);
this.shell
.nextAnimationEnd(function() {
PageView.prototype.exit.apply(this, arguments).then(function() {
this.exitPromise.resolve();
});
this.shell.removeClass(animation + ' current');
}.bind(this))
.addClass(animation);
return this.exitPromise;
} else {
this.shell.removeClass('current');
return PageView.prototype.exit.apply(this, arguments);
}
}
});
return BasePageView;
});
|
JavaScript
| 0 |
@@ -1176,777 +1176,8 @@
/**%0A
- * Executes when the template renders successfully. This implementation%0A * adds support for animations between views, based off of the animation%0A * property on the prototype.%0A * @method onRenderSuccess%0A *%0A * @param %7BEvent%7D e The render event. This object should have a string property named %22html%22%0A * that contains the template's rendered HTML output.%0A */%0A onRenderSuccess: function() %7B%0A // Scroll iPhone past url bar%0A if (!navigator.standalone && (Detection.iphone %7C%7C Detection.ipod)) %7B%0A var height = document.documentElement.clientHeight;%0A $(document.body).height(height + 60);%0A setTimeout(scrollTo, 0, 0, 1);%0A %7D%0A PageView.prototype.onRenderSuccess.apply(this, arguments);%0A %7D,%0A /**%0A
|
f882df24bcf5de1939b4210cfd690a283bd6dd16
|
Fix error loading updated preset
|
src/components/Budgets/PresetBudgets.js
|
src/components/Budgets/PresetBudgets.js
|
import nanoid from 'nanoid';
import React, { Component } from 'react';
import Select from 'react-select';
import { addPreset, removePreset, subscribePresets, updatePreset } from '../../actions/budgets';
import { connect } from 'react-redux';
import { convertToList } from '../../helpers/reformat';
class PresetBudgets extends Component {
constructor() {
super();
this.state = {
name: '',
preset: '',
}
this.onAdd = this.onAdd.bind(this);
this.onChange = this.onChange.bind(this);
this.onChangePreset = this.onChangePreset.bind(this);
this.onDelete = this.onDelete.bind(this);
this.onLoad = this.onLoad.bind(this);
this.onUpdate = this.onUpdate.bind(this);
}
componentDidMount() {
this.props.dispatch(subscribePresets());
}
onAdd(e) {
e.preventDefault();
const payload = {
budget: {
label: this.state.name,
value: this.props.query,
id: nanoid(),
},
};
this.props.dispatch(addPreset(payload));
this.setState({
...this.state,
name: '',
})
}
onChange(property, value) {
this.setState({
...this.state,
[property]: value,
});
}
onChangePreset(preset) {
this.setState({
...this.state,
preset: preset,
});
}
onDelete() {
if(this.state.preset === null) {
return;
}
const payload = {
elementId: this.state.preset.id,
};
console.log(payload);
this.props.dispatch(removePreset(payload));
this.setState({
...this.state,
preset: null,
});
}
onLoad() {
if(this.state.preset === null) {
this.props.search({});
return;
}
this.props.search(this.state.preset.value);
}
onUpdate() {
console.log('Preset', this.state.preset.id);
const payload = {
preset: {
label: this.state.preset.label,
value: this.props.query,
id: this.state.preset.id,
}
};
this.props.dispatch(updatePreset(payload));
}
render () {
return (
<div>
<h3>Load Budget</h3>
<label>Load:</label>
<Select
className="select-bar"
onChange={this.onChangePreset}
options={this.props.presets}
value={this.state.preset}
/>
<button
className="btn btn-primary"
onClick={this.onLoad}>
Load
</button><button
className="btn btn-primary"
onClick={this.onUpdate}>
Update
</button>
<button
className="btn btn-primary"
onClick={this.onDelete}>
Delete
</button>
<form onSubmit={this.onAdd}>
<label>Save As:</label>
<input
onChange={e => this.onChange('name', e.target.value)}
value={this.state.name}
>
</input>
<button
className="btn btn-primary"
type="submit">
Save New
</button>
</form>
</div>
);
}
}
const mapPropsToState = state => ({
presets: convertToList(state.budgets.presets),
query: state.budgets.query,
});
export default connect(mapPropsToState)(PresetBudgets);
|
JavaScript
| 0.000001 |
@@ -1,12 +1,40 @@
+import flatten from 'flat';%0A
import nanoi
@@ -991,17 +991,16 @@
%0A %7D;%0A
-%0A
this
@@ -1021,31 +1021,57 @@
h(addPreset(
+flatten.unflatten(%7B ...
payload
+ %7D)
));%0A%0A thi
@@ -1489,34 +1489,8 @@
%7D;%0A
- console.log(payload);%0A
@@ -1715,72 +1715,445 @@
-this.props.search(this.state.preset.value);%0A %7D%0A%0A onUpdate()
+%0A const preset = this.props.presets.filter(preset =%3E preset.id === this.state.preset.id)%5B0%5D;%0A const maintainedProps = this.props.maintainDepth.map((property) =%3E preset.value%5Bproperty%5D);%0A let query = %7B...preset.value%7D;%0A let newQuery = %7B%7D;%0A %0A this.props.maintainDepth.map((property) =%3E %7B%0A query%5Bproperty%5D = undefined;%0A %7D);%0A%0A newQuery = flatten(query);%0A this.props.maintainDepth.map((property, index) =%3E
%7B%0A
+
@@ -2168,40 +2168,132 @@
log(
-'Preset', this.state.preset.id);
+property);%0A newQuery%5Bproperty%5D = maintainedProps%5Bindex%5D;%0A %7D);%0A%0A this.props.search(newQuery);%0A %7D%0A%0A onUpdate() %7B%0A
%0A
@@ -2482,31 +2482,57 @@
pdatePreset(
+flatten.unflatten(%7B ...
payload
+ %7D)
));%0A %7D%0A%0A r
@@ -3318,16 +3318,44 @@
value)%7D%0A
+ required=%7Btrue%7D%0A
@@ -3583,16 +3583,87 @@
%0A %7D%0A%7D%0A%0A
+PresetBudgets.defaultProps = %7B%0A maintainDepth: %5B%0A 'tags',%0A %5D,%0A%7D;%0A%0A
const ma
|
c2507e8168ea6f41f18416e940fcda750edbc4c5
|
add json file extension on jest
|
src/jest/create-config.js
|
src/jest/create-config.js
|
import fs from 'fs';
import path from 'path';
import appRootDir from 'app-root-dir';
export default (noCoverage) => {
const rootDir = appRootDir.get();
const setupTestFilePath = path.resolve(rootDir, 'stanza', 'setup-test.js');
const setupTestsFile = fs.existsSync(setupTestFilePath)
? setupTestFilePath
: undefined;
return {
rootDir,
setupTestFrameworkScriptFile: setupTestsFile,
testEnvironment: 'node',
testURL: 'http://localhost',
moduleFileExtensions: ['js', 'jsx'],
moduleDirectories: ['src', 'shared', 'node_modules'],
transform: {
'^.+\\.(js|jsx)$': path.resolve(__dirname, 'babel-transform.js'),
},
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.resolve(
__dirname,
'asset-mock.js',
),
'\\.(css|less|sass|scss)$': path.resolve(__dirname, 'style-mock.js'),
},
testPathIgnorePatterns: [
'<rootDir>[/\\\\](build|docs|node_modules|scripts)[/\\\\]',
'/_fixtures',
],
collectCoverage: !noCoverage,
coverageReporters: ['json', 'html', 'text-summary'],
collectCoverageFrom: ['src/**/*.{js,jsx}'],
coveragePathIgnorePatterns: ['/node_modules', '/test'],
};
};
|
JavaScript
| 0.000001 |
@@ -500,16 +500,24 @@
', 'jsx'
+, 'json'
%5D,%0A m
|
a224f78ac6c16b2b8fb0a57c0046586066d4e501
|
Add container
|
tasks/config/admin/release.js
|
tasks/config/admin/release.js
|
/*******************************
Release Settings
*******************************/
// release settings
module.exports = {
// path to components for repos
source : './dist/components/',
// modified asset paths for component repos
paths: {
source : '../themes/default/assets/',
output : 'assets/'
},
templates: {
bower : './tasks/config/admin/templates/bower.json',
composer : './tasks/config/admin/templates/composer.json',
package : './tasks/config/admin/templates/package.json',
meteor : {
css : './tasks/config/admin/templates/css-package.js',
component : './tasks/config/admin/templates/component-package.js',
less : './tasks/config/admin/templates/less-package.js',
},
readme : './tasks/config/admin/templates/README.md',
notes : './RELEASE-NOTES.md'
},
org : 'Semantic-Org',
repo : 'Semantic-UI',
// files created for package managers
files: {
composer : 'composer.json',
config : 'semantic.json',
npm : 'package.json',
meteor : 'package.js'
},
// root name for distribution repos
distRepoRoot : 'Semantic-UI-',
// root name for single component repos
componentRepoRoot : 'UI-',
// root name for package managers
packageRoot : 'semantic-ui-',
// root path to repos
outputRoot : '../repos/',
homepage : 'http://www.semantic-ui.com',
// distributions that get separate repos
distributions: [
'LESS',
'CSS'
],
// components that get separate repositories for bower/npm
components : [
'accordion',
'ad',
'api',
'breadcrumb',
'button',
'card',
'checkbox',
'comment',
'dimmer',
'divider',
'dropdown',
'embed',
'feed',
'flag',
'form',
'grid',
'header',
'icon',
'image',
'input',
'item',
'label',
'list',
'loader',
'menu',
'message',
'modal',
'nag',
'popup',
'progress',
'rail',
'rating',
'reset',
'reveal',
'search',
'segment',
'shape',
'sidebar',
'site',
'statistic',
'step',
'sticky',
'tab',
'table',
'transition',
'visibility'
]
};
|
JavaScript
| 0.000005 |
@@ -1703,24 +1703,41 @@
'comment',%0A
+ 'container',%0A
'dimmer'
|
723f00f21ed3d6578dbb1460aeddc480d53f841b
|
Fix operator evaluation skip bug upon signal update.
|
src/dataflow/on.js
|
src/dataflow/on.js
|
import Operator from '../Operator';
import {isChangeSet} from '../ChangeSet';
import {constant, extend, isFunction} from 'vega-util';
var SKIP = {skip: true};
/**
* Perform operator updates in response to events. Applies an
* update function to compute a new operator value. If the update function
* returns a {@link ChangeSet}, the operator will be pulsed with those tuple
* changes. Otherwise, the operator value will be updated to the return value.
* @param {EventStream|Operator} source - The event source to react to.
* This argument can be either an EventStream or an Operator.
* @param {Operator|function(object):Operator} target - The operator to update.
* This argument can either be an Operator instance or (if the source
* argument is an EventStream), a function that accepts an event object as
* input and returns an Operator to target.
* @param {function(Parameters,Event): *} [update] - Optional update function
* to compute the new operator value, or a literal value to set. Update
* functions expect to receive a parameter object and event as arguments.
* This function can either return a new operator value or (if the source
* argument is an EventStream) a {@link ChangeSet} instance to pulse
* the target operator with tuple changes.
* @param {object} [params] - The update function parameters.
* @param {object} [options] - Additional options hash. If not overridden,
* updated operators will be skipped by default.
* @param {boolean} [options.skip] - If true, the operator will
* be skipped: it will not be evaluated, but its dependents will be.
* @param {boolean} [options.force] - If true, the operator will
* be re-evaluated even if its value has not changed.
* @return {Dataflow}
*/
export default function(source, target, update, params, options) {
var fn = source instanceof Operator ? onOperator : onStream;
fn(this, source, target, update, params, options);
return this;
}
function onStream(df, stream, target, update, params, options) {
var opt = extend({}, options, SKIP), func, op;
if (!isFunction(target)) target = constant(target);
if (update === undefined) {
func = function(e) {
df.touch(target(e));
};
} else if (isFunction(update)) {
op = new Operator(null, update, params, false);
func = function(e) {
var v, t = target(e);
op.evaluate(e);
isChangeSet(v = op.value) ? df.pulse(t, v, options) : df.update(t, v, opt);
};
} else {
func = function(e) {
df.update(target(e), update, opt);
};
}
stream.apply(func);
}
function onOperator(df, source, target, update, params, options) {
var func, op;
if (update === undefined) {
op = target;
} else {
func = isFunction(update) ? update : constant(update);
update = !target ? func : function(_, pulse) {
var value = func(_, pulse);
return target.skip()
? value
: (target.skip(true).value = value);
};
op = new Operator(null, update, params, false);
op.modified(options && options.force);
op.rank = 0;
if (target) {
op.skip(true); // skip first invocation
op.value = target.value;
op.targets().add(target);
}
}
source.targets().add(op);
}
|
JavaScript
| 0 |
@@ -2868,23 +2868,21 @@
;%0A
-return
+if (!
target.s
@@ -2890,24 +2890,11 @@
ip()
-%0A ? value
+) %7B
%0A
@@ -2902,11 +2902,8 @@
-: (
targ
@@ -2914,28 +2914,71 @@
kip(
-true).value = value)
+value !== this.value).value = value;%0A %7D%0A return value
;%0A
|
9f1310c5bf6d225dafe6626ae53e6e7fc09e7fcf
|
Add clean task
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var sass = require('gulp-sass');
//var watch = require('gulp-watch');
var bower = require('gulp-bower');
var childTheme = 'leo';
var parentTheme = '/theme-open-ent/**/*';
var themePath = './assets/themes';
var localcsslib = '../entcore-css-lib/**/*';
var localparentTheme = '../theme-open-ent/**/*';
var sourceDependency = [];
//recupere theme sur git & copy dans springboard
gulp.task('update-libs', function () {
return bower({ directory: themePath, cwd: '.' });
});
//copy dans childTheme ce qu'il a recup du theme (git)
gulp.task('fill-theme', sourceDependency, function () {
return gulp.src(themePath + parentTheme)
.pipe(gulp.dest(themePath + '/' + childTheme));
});
////////////////////////
//copy dans childTheme les dependances locales
gulp.task('copy-local', function () {
//copy css-lib local
return gulp.src([localcsslib, localparentTheme], {base: '../'})
.pipe(gulp.dest(themePath));
});
////////////////////////
//override dans childTheme les el specifique
gulp.task('override-theme', ['fill-theme'], function () {
gulp.src([themePath + '/' + childTheme+'/override-img/**/*'])
.pipe(gulp.dest(themePath + '/' + childTheme + '/img'));
gulp.src([themePath + '/' + childTheme + '/override-js/**/*'])
.pipe(gulp.dest(themePath + '/' + childTheme+'/js'));
gulp.src([themePath + '/' + childTheme + '/override-template/**/*'])
.pipe(gulp.dest(themePath + '/' + childTheme + '/template'));
});
//compile sass
gulp.task('compile-sass', ['override-theme'], function () {
//compile le css specifique dans le fichier default et ecrase le theme.css
gulp.src(themePath + '/' + childTheme + '/override-css/default/theme.scss')
.pipe(sass())
.pipe(gulp.dest(themePath + '/' + childTheme + '/default'));
gulp.src(themePath + '/' + childTheme + '/dyslexic/*.scss')
.pipe(sass())
.pipe(gulp.dest(themePath + '/' + childTheme + '/dyslexic'));
});
gulp.task('themes-local', function(){
sourceDependency.push('copy-local')
return gulp.start('compile-sass')
});
gulp.task('themes', function(){
sourceDependency.push('update-libs')
return gulp.start('compile-sass')
});
//attention supprimer le theme open-ent si on switch entre les 2 taches
// //watcher
// gulp.task('watch-css', function() {
//
// function compileTheme() {
// // //compile css-lib local
// // gulp.src(['../css-lib/**/*'])
// // .pipe(gulp.dest('./assets/themes/entcore-css-lib'));
// //
// // //compile theme-open-ent local
// // gulp.src(['../theme-open-ent/**/*'])
// // .pipe(gulp.dest('./assets/themes/theme-open-ent'));
//
// //compile childTheme
// gulp.src('./assets/themes/'+childTheme+'/default/theme.scss')
// .pipe(sass())
// .pipe(gulp.dest('./assets/themes/'+childTheme+'/default'));
// }
// watch('../css-lib/**/*.scss', compileTheme);
// //watch theme-open-ent local
// watch('../theme-open-ent/**/*.scss', compileTheme);
// watch('./assets/themes/'+childTheme+'/**/*.scss', compileTheme);
//
// });
|
JavaScript
| 0.000429 |
@@ -126,17 +126,42 @@
ower');%0A
+var del = require('del');
%0A
-
%0A%0Avar ch
@@ -379,16 +379,213 @@
= %5B%5D;%0A%0A
+gulp.task('clean', function()%7B%0A return del(%5BthemePath + '/*', '!' + themePath + '/' + childTheme, themePath + '/' + childTheme + '/*', '!' + themePath + '/' + childTheme + '/override*'%5D);%0A%7D);%0A%0A
//recupe
@@ -625,16 +625,16 @@
ngboard%0A
-
gulp.tas
@@ -649,16 +649,27 @@
e-libs',
+ %5B'clean'%5D,
functio
|
80b2aee93cfdd661ba0d4d69b13c78689aa84f77
|
Fix results
|
diveSync.js
|
diveSync.js
|
var fs = require('fs'),
append = require('append');
// general function
var diveSync = function(dir, opt, action) {
// default options
var defaultOpt = {
recursive: true,
all: false,
directories: false,
filter: function filter() {
return true;
}
};
// action is the last argument
action = arguments[arguments.length - 1];
// ensure opt is an object
if (typeof opt != 'object')
opt = {};
opt = append(defaultOpt, opt);
// apply filter
if (!opt.filter(dir, true)) return;
try {
// read the directory
var list = fs.readdirSync(dir);
// for every file in the list
list.sort().some(function (file) {
if (opt.all || file[0] != '.') {
// full path of that file
var path = dir + '/' + file;
// get the file's stats
var stat = fs.statSync(path);
// if the file is a directory
if (stat && stat.isDirectory()) {
// call the action if enabled for directories
if (opt.directories)
if (action(null, path) === false) return false;
// dive into the directory
if (opt.recursive)
diveSync(path, opt, action);
} else {
// apply filter
if (!opt.filter(path, false)) return;
// call the action
return action(null, path) === false;
}
}
});
} catch(err) {
action(err);
}
};
module.exports = diveSync;
|
JavaScript
| 0.000001 |
@@ -1061,24 +1061,38 @@
= false)
+%0A
return
false;%0A%0A
@@ -1083,20 +1083,19 @@
return
-fals
+tru
e;%0A%0A
@@ -1279,23 +1279,41 @@
false))
+%0A
return
+ false
;%0A%0A
|
44be4f37dee756bb08603c108b78f5bfdd279da4
|
refactor variables for use in multiple steps
|
tasks/grunt-release.js
|
tasks/grunt-release.js
|
/*
* grunt-release
* https://github.com/geddski/grunt-release
*
* Copyright (c) 2013 Dave Geddes
* Licensed under the MIT license.
*/
var shell = require('shelljs');
var semver = require('semver');
module.exports = function(grunt){
grunt.registerTask('release', 'bump version, git tag, git push, npm publish', function(type){
//defaults
var options = this.options({
bump: true,
file: grunt.config('pkgFile') || 'package.json',
add: true,
commit: true,
tag: true,
push: true,
pushTags: true,
npm : true
});
var tagName = grunt.config.getRaw('release.options.tagName') || '<%= version %>';
var commitMessage = grunt.config.getRaw('release.options.commitMessage') || 'release <%= version %>';
var tagMessage = grunt.config.getRaw('release.options.tagMessage') || 'version <%= version %>';
var config = setup(options.file, type);
var templateOptions = {
data: {
version: config.newVersion
}
};
if (options.bump) bump(config);
if (options.add) add(config);
if (options.commit) commit(config);
if (options.tag) tag(config);
if (options.push) push();
if (options.pushTags) pushTags(config);
if (options.npm) publish(config);
function setup(file, type){
var pkg = grunt.file.readJSON(file);
var newVersion = pkg.version;
if (options.bump) {
newVersion = semver.inc(pkg.version, type || 'patch');
}
return {file: file, pkg: pkg, newVersion: newVersion};
}
function add(config){
run('git add ' + config.file);
}
function commit(config){
var message = grunt.template.process(commitMessage, templateOptions);
run('git commit '+ config.file +' -m "'+ message +'"', config.file + ' committed');
}
function tag(config){
var name = grunt.template.process(tagName, templateOptions);
var message = grunt.template.process(tagMessage, templateOptions);
run('git tag ' + name + ' -m "'+ message +'"', 'New git tag created: ' + name);
}
function push(){
run('git push', 'pushed to remote');
}
function pushTags(config){
run('git push --tags', 'pushed new tag '+ config.newVersion +' to remote');
}
function publish(config){
var cmd = 'npm publish';
var msg = 'published '+ config.newVersion +' to npm';
var npmtag = getNpmTag();
if (npmtag){
cmd += ' --tag ' + npmtag;
msg += ' with a tag of "' + npmtag + '"';
}
if (options.folder){ cmd += ' ' + options.folder }
run(cmd, msg);
}
function getNpmTag(){
var tag = grunt.option('npmtag') || options.npmtag;
if(tag === true) { tag = config.newVersion }
return tag;
}
function run(cmd, msg){
var nowrite = grunt.option('no-write');
if (nowrite) {
grunt.verbose.writeln('Not actually running: ' + cmd);
}
else {
grunt.verbose.writeln('Running: ' + cmd);
shell.exec(cmd, {silent:true});
}
if (msg) grunt.log.ok(msg);
}
function bump(config){
config.pkg.version = config.newVersion;
grunt.file.write(config.file, JSON.stringify(config.pkg, null, ' ') + '\n');
grunt.log.ok('Version bumped to ' + config.newVersion);
}
});
};
|
JavaScript
| 0.000001 |
@@ -325,24 +325,29 @@
tion(type)%7B%0A
+ %0A
//defaul
@@ -587,18 +587,177 @@
var
-tagName =
+config = setup(options.file, type);%0A var templateOptions = %7B%0A data: %7B%0A version: config.newVersion%0A %7D%0A %7D;%0A var tagName = grunt.template.process(
grun
@@ -810,32 +810,50 @@
'%3C%25= version %25%3E'
+, templateOptions)
;%0A var commit
@@ -854,32 +854,55 @@
commitMessage =
+grunt.template.process(
grunt.config.get
@@ -965,16 +965,34 @@
sion %25%3E'
+, templateOptions)
;%0A va
@@ -1002,24 +1002,47 @@
agMessage =
+grunt.template.process(
grunt.config
@@ -1110,145 +1110,91 @@
%25%3E'
-;%0A%0A var config = setup(options.file, type);%0A var templateOptions = %7B%0A data: %7B%0A version: config.newVersion%0A %7D%0A %7D
+, templateOptions);%0A var nowrite = grunt.option('no-write');%0A var task = this
;%0A%0A
@@ -1828,84 +1828,8 @@
g)%7B%0A
- var message = grunt.template.process(commitMessage, templateOptions);%0A
@@ -1863,33 +1863,39 @@
.file +' -m %22'+
-m
+commitM
essage +'%22', con
@@ -1957,148 +1957,8 @@
g)%7B%0A
- var name = grunt.template.process(tagName, templateOptions);%0A var message = grunt.template.process(tagMessage, templateOptions);%0A
@@ -1976,17 +1976,20 @@
tag ' +
-n
+tagN
ame + '
@@ -1995,17 +1995,20 @@
-m %22'+
-m
+tagM
essage +
@@ -2038,17 +2038,20 @@
ed: ' +
-n
+tagN
ame);%0A
@@ -2789,54 +2789,8 @@
g)%7B%0A
- var nowrite = grunt.option('no-write');%0A
|
ab7a677aea1c18b55f297c4331e073562c55a284
|
Fix width of the TrelloCards' row with points and members
|
src/components/TrelloCard/TrelloCard.js
|
src/components/TrelloCard/TrelloCard.js
|
// @flow
import React, { Component } from 'react';
import { View, StyleSheet, Linking } from 'react-native';
import { isEqual } from 'lodash';
import ActionSheet from '@yfuks/react-native-action-sheet';
import { Text, Card, Button } from '../../components';
import appStyle from '../../appStyle';
import MemberIcon from './MemberIcon';
import PointsBadge from './PointsBadge';
import { Analytics } from '../../services';
import type { CardType } from '../../types';
import { differenceInBusinessDays } from '../../services/Time';
import Icon from '../Icon';
export default class extends Component<Props> {
shouldComponentUpdate(nextProps: Props) {
return !isEqual(nextProps.card, this.props.card);
}
showActionSheet = () => {
Analytics.logEvent('card_actionSheet_trigger'); // how curious are users?
ActionSheet.showActionSheetWithOptions(
{
options: ['Open in Trello', 'Cancel'],
cancelButtonIndex: 1,
},
index => {
switch (index) {
case 0:
Linking.openURL(this.props.card.url).catch(e => console.error('Error opening URL', e));
break;
default:
break;
}
}
);
};
render() {
const { card } = this.props;
const validationLatenessInDays =
card.dateEndDevelopment && differenceInBusinessDays(card.dateDone || Date.now(), card.dateEndDevelopment);
return (
<Button style={this.props.style} onLongPress={this.showActionSheet}>
<View>
<Card>
<View style={styles.labelsRow}>
<View style={styles.idShortContainer}>
<Text>#{card.idShort}</Text>
</View>
{validationLatenessInDays > 1 && (
<View style={styles.lateValidationContainer}>
<Text style={styles.lateValidationText}>{validationLatenessInDays}</Text>
<Icon
type="material-community"
name="clock-alert"
size={appStyle.font.size.default}
color={appStyle.colors.overRed}
/>
</View>
)}
</View>
<Text style={styles.title}>{card.name}</Text>
<View style={styles.membersRow}>
<View style={styles.pointsContainer}>
{card.points != null && <PointsBadge points={card.points.toLocaleString()} />}
{card.points != null && card.postPoints != null && <View style={{ width: 4 }} />}
{card.postPoints != null && <PointsBadge points={card.postPoints.toLocaleString()} isPostEstimation />}
</View>
<View style={styles.membersContainer}>
<View style={styles.members}>
{card.members.map(member => (
<View key={member.id} style={styles.member}>
<MemberIcon member={member} />
</View>
))}
</View>
</View>
</View>
</Card>
</View>
</Button>
);
}
}
const styles = StyleSheet.create({
labelsRow: {
flexDirection: 'row',
justifyContent: 'space-between',
},
membersRow: {
flexDirection: 'row',
},
title: {
marginVertical: appStyle.margin,
},
membersContainer: {
flex: 5,
alignSelf: 'flex-end',
justifyContent: 'flex-end',
},
members: {
flexDirection: 'row',
alignSelf: 'flex-end',
justifyContent: 'flex-end',
},
member: {
marginLeft: 5,
},
idShortContainer: {
backgroundColor: appStyle.colors.secondary,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 7,
borderRadius: appStyle.borderRadius,
},
lateValidationContainer: {
flexDirection: 'row',
backgroundColor: appStyle.colors.red,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 7,
borderRadius: appStyle.borderRadius,
},
lateValidationText: {
marginRight: 2,
color: appStyle.colors.overRed,
},
pointsContainer: {
flex: 1,
flexDirection: 'row',
flexShrink: 1,
alignItems: 'flex-end',
},
});
type Props = {
card: CardType,
style?: any,
};
|
JavaScript
| 0.000008 |
@@ -3271,16 +3271,53 @@
'row',%0A
+ justifyContent: 'space-between',%0A
%7D,%0A t
@@ -3396,62 +3396,17 @@
-flex: 5,%0A alignSelf: 'flex-end',%0A justifyContent
+alignSelf
: 'f
@@ -4092,21 +4092,8 @@
: %7B%0A
- flex: 1,%0A
@@ -4118,27 +4118,8 @@
w',%0A
- flexShrink: 1,%0A
|
ab18eb32d844f264cf0573f6c9d5379885f8ca49
|
fix build
|
gulpfile.js
|
gulpfile.js
|
"use strict";
// Include gulp
var fs = require("fs");
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps")
var path = require("path");
var browserSync = require("browser-sync").create();
var sass = require('gulp-sass');
var babelify = require('babelify');
var gutil = require('gulp-util');
var replace = require('gulp-replace');
var browserify = require("browserify");
var source = require('vinyl-source-stream');
var reload = browserSync.reload;
var runSequence = require('run-sequence');
var extensions = ['.js','.json','.es6'];
gulp.task('watch',['browserify', 'sass'], function(){
browserSync.init({
server:'./src'
});
gulp.watch("./src/sass/**/*.scss", ['sass']);
gulp.watch("./src/scripts/**/*.js", ['browserify']);
gulp.watch("./src/**/*.html").on('change', reload);
gulp.watch("./src/bundle*.js").on('change', reload);
});
gulp.task('sass',function(){
return gulp.src('./src/sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass()).on('error', function logError(error) {
console.error(error);
})
.pipe(sourcemaps.write())
.pipe(gulp.dest('./src/css'))
.pipe(reload({stream:true}));
});
gulp.task('browserify', ['browserify_phone', 'browserify_moderator', 'browserify_screen', 'browserify_summary']);
gulp.task('browserify_phone',function(){
return browserify({entries: './src/scripts/app_phone.js', debug:true, extensions: extensions})
.transform(babelify)
.on('error', gutil.log)
.bundle()
.on('error', gutil.log)
.pipe(source('bundle_phone.js'))
.pipe(gulp.dest('./src'));
});
gulp.task('browserify_moderator',function(){
return browserify({entries: './src/scripts/app_moderator.js', debug:true, extensions: extensions})
.transform(babelify)
.on('error', gutil.log)
.bundle()
.on('error', gutil.log)
.pipe(source('bundle_moderator.js'))
.pipe(gulp.dest('./src'));
});
gulp.task('browserify_screen',function(){
return browserify(['./src/scripts/app_screen.js'], {debug:true})
.transform(babelify)
.on('error', gutil.log)
.bundle()
.on('error', gutil.log)
.pipe(source('bundle_screen.js'))
.pipe(gulp.dest('./src'));
});
gulp.task('browserify_summary',function(){
return browserify(['./src/scripts/app_summary.js'], {debug:true})
.transform(babelify)
.on('error', gutil.log)
.bundle()
.on('error', gutil.log)
.pipe(source('bundle_summary.js'))
.pipe(gulp.dest('./src'));
});
gulp.task("copy", function () {
return gulp.src([
"src/*.html",
"src/*.js",
"src/*.json",
"src/css/**",
"src/assets/**",
],{"base":"./src"})
.pipe(gulp.dest('./public/'));
});
gulp.task("replace", function(){
gulp.src(['./public/bundle_phone.js', './public/bundle_moderator.js'])
.pipe(replace('/* SERVICE_WORKER_REPLACE', ''))
.pipe(replace('SERVICE_WORKER_REPLACE */', ''))
.pipe(gulp.dest('./public/'));
});
gulp.task("replace_timestamp", function(){
gulp.src['./public/service-worker-phone.js', './public/service-worker-moderator.js']
.pipe(replace('{timestamp}', Date.now()))
.pipe(gulp.dest('./public/'));
})
gulp.task('build',function(){
runSequence(
['browserify', 'sass'],
'copy',
'replace_phone',
'replace_timestamp'
);
});
/* Default task */
gulp.task("default", ["watch"]);
|
JavaScript
| 0.000001 |
@@ -3287,22 +3287,16 @@
'replace
-_phone
',%0A '
|
35a6c201558eaa8e704b5b07f88aeab3d9eef119
|
Add back a missing comment
|
tasks/inline-images.js
|
tasks/inline-images.js
|
/**
* grunt-inline-images
* https://github.com/EE/grunt-inline-images
*
* Author Michał Gołębiowski <[email protected]>
* Licensed under the MIT license.
*/
'use strict';
// Gruntfile.js & tasks/*.js are the only non-transpiled files.
/* eslint-disable no-var, no-eval */
var assert = require('assert');
module.exports = function (grunt) {
try {
assert.strictEqual(eval('(() => 2)()'), 2);
return require('../src/inline-images')(grunt);
} catch (e) {
return require('../dist/src/inline-images')(grunt);
}
};
|
JavaScript
| 0.000002 |
@@ -189,16 +189,68 @@
rict';%0A%0A
+// Disable options that don't work in Node.js 0.10.%0A
// Grunt
|
527518ef54ec7348b83781fa86563f21a9fb6de9
|
Fix javascript path
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('serve-dev', function() {
browserSync({
server: {
baseDir: '.'
}
});
gulp.watch(['*.html', 'scripts/**/*.js'], reload);
});
|
JavaScript
| 0.001215 |
@@ -221,16 +221,20 @@
html', '
+java
scripts/
|
f451e7a97778ccb020954199f16d9117558e6ebb
|
Implement gulpfile
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var jade = require('gulp-jade');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var browserSync = require('browser-sync').create();
var dist = './dist';
var src = './src';
// default task
gulp.task('default', ['browser-sync'], function () {
gulp.watch('dist/*.html', ['reload']);
gulp.watch('dist/*.css', ['reload']);
gulp.watch('dist/*.js', ['reload']);
});
// sync browser
gulp.task('browser-sync', function() {
browserSync.init({
port: 8080,
server: {
baseDir: 'dist',
index: 'popup.html'
}
});
});
// reload browser
gulp.task('reload', function () {
browserSync.reload();
});
// copy bootflat files into src
// convert jade to html
gulp.task('jade', function() {
gulp.src('./src/jade/*.jade')
.pipe(jade())
.pipe(gulp.dest('./dist/'));
});
// convert sass to css
// concat css
// minify css
// minify and concat js
gulp.task('js', function() {
gulp.src([
'./node_modules/bootflat/js/bootstrap.min.js'
])
.pipe(uglify({
preserveComments: 'license'
}))
.pipe(concat('app.js'))
.pipe(gulp.dest('dist/js'));
});
// convert and minify and distribution into dist
// watch src
|
JavaScript
| 0.000296 |
@@ -110,24 +110,70 @@
ulp-jade');%0A
+var minifyCss = require('gulp-minify-css');%0A
var uglify
@@ -1035,33 +1035,221 @@
%0A//
-concat css%0A%0A// minify css
+minify and concat css%0Agulp.task('css', function() %7B%0A gulp.src(%5B%0A './node_modules/bootflat/bootflat/css/bootflat.min.css'%0A %5D)%0A .pipe(minifyCss())%0A .pipe(concat('app.css'))%0A .pipe(gulp.dest('dist/css'));%0A%7D);
%0A%0A//
|
2269f49841689b86431249f04b266f0575f74c8a
|
make port and https configurable via process.env
|
gulpfile.js
|
gulpfile.js
|
'use strict';
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const browserSync = require('browser-sync').create();
const concat = require('gulp-concat');
const sass = require('gulp-sass');
const runSequence = require('run-sequence');
const addSrc = require('gulp-add-src');
const gutil = require('gulp-util');
const del = require('del');
const paths = {
DIST: './dist',
DIST_SKINS: './dist/skins',
DIST_FONTS: './dist/font',
SRC_JS: './src/js/*.js',
SRC_SCSS: './src/scss/*.scss',
SRC_SCSS_SKINS: './src/scss/skins/*.scss'
};
const distName = 'wjplayer';
const distName360 = 'wjplayer-360';
const deps = ['core', 'ads', 'switcher', 'share', 'download', 'ga'];
const deps360 = ['360'];
let includesJs = [];
let includesCss = [];
let includesJs360 = [];
let includesCss360 = [];
const includes = {
js: {
core: [
'node_modules/video.js/dist/video.js',
'node_modules/videojs5-hlsjs-source-handler/lib/videojs5-hlsjs-source-handler.js',
paths.SRC_JS
],
ads: [
'node_modules/videojs-contrib-ads/src/videojs.ads.js',
'node_modules/videojs-ima/src/videojs.ima.js'
],
switcher: [
'node_modules/videojs-resolution-switcher/lib/videojs-resolution-switcher.js'
],
share: [
'node_modules/videojs-social/videojs-social.js'
],
download: [
'node_modules/videojs-download-button/dist/videojs-download-button.js'
],
ga: [
'node_modules/videojs-ga/dist/videojs.ga.js'
],
360: [
'node_modules/three/build/three.js',
'node_modules/videojs-panorama/dist/videojs-panorama.v5.js'
]
},
css: {
core: [
'node_modules/video.js/dist/video-js.css'
],
ads: [
'node_modules/videojs-ima/src/videojs.ima.css'
],
switcher: [
'node_modules/videojs-resolution-switcher/lib/videojs-resolution-switcher.css'
],
share: [
'node_modules/videojs-social/videojs-social.css'
],
download: [
'node_modules/videojs-download-button/dist/videojs-download-button.css'
],
ga: [],
360: [
'node_modules/videojs-panorama/dist/videojs-panorama.css'
]
},
fonts: 'node_modules/video.js/dist/font/*',
swf: 'node_modules/video.js/dist/video-js.swf'
};
deps.forEach(function(inc) {
includesJs = includesJs.concat(includes.js[inc]);
includesCss = includesCss.concat(includes.css[inc]);
});
deps360.forEach(function(inc) {
includesJs360 = includesJs360.concat(includes.js[inc]);
includesCss360 = includesCss360.concat(includes.css[inc]);
});
gulp.task('default', () => {
runSequence('scripts-360', 'styles', 'fonts', 'swf');
});
// Open in browser for testing
gulp.task('browse', ['server', 'watch']);
gulp.task('build', ['clean-dist'], () => {
gulp.start('scripts', 'styles');
});
gulp.task('scripts', ['scripts-360', 'lint'], () => {
return gulp.src(includesJs)
.pipe(concat(distName + '.js'))
.pipe(gulp.dest(paths.DIST));
});
gulp.task('scripts-360', () => {
return gulp.src(includesJs360)
.pipe(concat(distName360 + '.js'))
.pipe(gulp.dest(paths.DIST));
});
gulp.task('styles', ['skins', 'styles-360'], () => {
return gulp.src(paths.SRC_SCSS)
.pipe(sass({
outputStyle: 'nested'
}).on('error', gutil.log))
.pipe(addSrc.prepend(includesCss))
.pipe(concat(distName + '.css'))
.pipe(gulp.dest(paths.DIST));
});
gulp.task('styles-360', () => {
return gulp.src(includesCss360)
.pipe(concat(distName360 + '.css'))
.pipe(gulp.dest(paths.DIST));
});
gulp.task('skins', () => {
return gulp.src(paths.SRC_SCSS_SKINS)
.pipe(sass({
outputStyle: 'nested'
}).on('error', gutil.log))
.pipe(gulp.dest(paths.DIST_SKINS));
});
gulp.task('fonts', () => {
return gulp.src(includes.fonts)
.pipe(gulp.dest(paths.DIST_FONTS));
});
gulp.task('swf', () => {
return gulp.src(includes.swf)
.pipe(gulp.dest(paths.DIST));
});
gulp.task('clean-js', () => {
return del(paths.SRC_JS);
});
gulp.task('clean-dist', () => {
return del(paths.DIST + '/**/*.{js,css}');
});
gulp.task('lint', () => {
return gulp.src(paths.SRC_JS)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('server', () => {
browserSync.init({
server: {
baseDir: './'
},
port: 3030,
https: true,
open: true,
notify: false
});
});
gulp.task('watch', () => {
gulp.watch('index.html').on('change', browserSync.reload);
gulp.watch(paths.SRC_JS, ['scripts']);
gulp.watch(paths.DIST + '/*.js', ['sync-js']);
gulp.watch(paths.SRC_SCSS, ['styles']);
gulp.watch(paths.DIST + '/*.css', ['sync-css']);
});
gulp.task('sync-js', () => {
gulp.src(paths.DIST + '/*.js')
.pipe(browserSync.stream());
});
gulp.task('sync-css', () => {
gulp.src(paths.DIST + '/*.css')
.pipe(browserSync.stream());
});
|
JavaScript
| 0 |
@@ -4302,12 +4302,32 @@
ort:
+ process.env.PORT %7C%7C
30
-3
+0
0,%0A
@@ -4336,20 +4336,35 @@
https:
-true
+!!process.env.HTTPS
,%0A op
|
3a46ff7af7469503110dec07816c2a9efc030002
|
Fix issue in item details route
|
src/js/components/root.js
|
src/js/components/root.js
|
import React, { Component } from 'react'
import { Router, Route, browserHistory, } from 'react-router'
import { Provider } from 'react-redux'
import configureStore from '../store/configure-store'
import ClassificationExplorer from './classification-explorer'
import ClassificationDetails from './classification-details'
import ItemDetails from './item-details'
import { path } from '../router-mapping'
const store = configureStore()
export default class Root extends Component {
render() {
return (
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={ClassificationExplorer} />
<Route path={path.classificationDetails}
component={ClassificationDetails} />
<Route path={path.itemDetails.pattern}
component={ItemDetails} />
</Router>
</Provider>
)
}
}
|
JavaScript
| 0.000001 |
@@ -786,16 +786,8 @@
ails
-.pattern
%7D%0A
|
b56ac41012b4597f40843a06e6063c82aed08252
|
add source
|
gulpfile.js
|
gulpfile.js
|
/**
* Created by nuintun on 2015/5/5.
*/
'use strict';
var path = require('path');
var gulp = require('gulp');
var rimraf = require('del');
var transport = require('gulp-cmd');
var uglify = require('gulp-uglify');
var css = require('gulp-minify-css');
var plumber = require('gulp-plumber');
var colors = transport.colors;
// alias
var alias = {
'jquery': 'base/jquery/1.11.2/jquery',
'base': 'base/base/1.2.0/base',
'class': 'base/class/1.2.0/class',
'events': 'base/events/1.2.0/events',
'widget': 'base/widget/1.2.0/widget',
'template': 'base/template/3.0.3/template',
'templatable': 'base/templatable/0.10.0/templatable',
'iframe-shim': 'util/iframe-shim/1.1.0/iframe-shim',
'position': 'util/position/1.1.0/position',
'messenger': 'util/messenger/2.1.0/messenger',
'mask': 'common/overlay/1.2.0/mask',
'overlay': 'common/overlay/1.2.0/overlay',
'dialog': 'common/dialog/1.5.1/dialog',
'confirmbox': 'common/dialog/1.5.1/confirmbox'
};
var startTime = Date.now();
// complete callback
function complete(){
var now = new Date();
console.log(
' %s [%s] build complete ... %s%s',
colors.cyan.bold('gulp-cmd'),
now.toLocaleString(),
colors.green(now - startTime),
colors.cyan('ms')
);
}
// clean task
gulp.task('clean', function (callback){
rimraf('online', callback);
});
// runtime task
gulp.task('runtime', ['clean'], function (){
gulp.src('assets/loader/**/*.js', { base: 'assets' })
.pipe(uglify())
.pipe(gulp.dest('online'));
gulp.src('assets/?(loader|images)/**/*.!(js)', { base: 'assets' })
.pipe(gulp.dest('online'));
});
// online task
gulp.task('online', ['runtime'], function (){
// all js
gulp.src('assets/js/**/*.js', { base: 'assets/js' })
.pipe(transport({
alias: alias,
ignore: ['jquery'],
include: function (id){
return id.indexOf('view') === 0 ? 'all' : 'relative';
},
css: {
onpath: function (path){
return path.replace('assets/', 'online/')
}
}
}))
.pipe(uglify())
.pipe(gulp.dest('online/js'))
.on('end', complete);
// other file
gulp.src('assets/js/**/*.!(js|css|json|tpl|html)')
.pipe(gulp.dest('online/js'));
// css
gulp.src('assets/css/**/*.*')
.pipe(css({ compatibility: 'ie8' }))
.pipe(gulp.dest('online/css'));
});
// develop task
gulp.task('default', ['runtime'], function (){
// all file
gulp.src('assets/js/**/*.*', { base: 'assets/js' })
.pipe(transport({
alias: alias,
include: 'self',
oncsspath: function (path){
return path.replace('assets/', 'online/')
}
}))
.pipe(gulp.dest('online/js'))
.on('end', complete);
gulp.src('assets/css/**/*.*', { base: 'assets' })
.pipe(gulp.dest('online'));
});
// develop watch task
gulp.task('watch', ['default'], function (){
var base = path.join(process.cwd(), 'assets');
// watch all file
gulp.watch('assets/js/**/*.*', function (e){
if (e.type === 'deleted') {
rimraf(path.resolve('online', path.relative(base, e.path)));
} else {
startTime = Date.now();
gulp.src(e.path, { base: 'assets/js' })
.pipe(plumber())
.pipe(transport({
alias: alias,
include: 'self',
cache: false,
oncsspath: function (path){
return path.replace('assets/', 'online/')
}
}))
.pipe(gulp.dest('online/js'))
.on('end', complete);
}
});
// watch all file
gulp.watch('assets/?(images|loader|css)/**/*.*', function (e){
if (e.type === 'deleted') {
rimraf(path.resolve('online', path.relative(base, e.path)));
} else {
startTime = Date.now();
gulp.src(e.path, { base: 'assets' })
.pipe(plumber())
.pipe(gulp.dest('online'))
.on('end', complete);
}
});
});
|
JavaScript
| 0 |
@@ -2536,29 +2536,41 @@
elf',%0A
-on
css
+: %7B%0A on
path: functi
@@ -2572,32 +2572,34 @@
unction (path)%7B%0A
+
return p
@@ -2628,24 +2628,34 @@
'online/')%0A
+ %7D%0A
%7D%0A
@@ -3321,13 +3321,29 @@
-on
css
+: %7B%0A on
path
@@ -3353,32 +3353,34 @@
unction (path)%7B%0A
+
retu
@@ -3409,32 +3409,46 @@
s/', 'online/')%0A
+ %7D%0A
%7D%0A
|
e410b175f90ac1069335d11ab0bbb3cb80354cdb
|
Fix build behavior by returning streams.
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var gulpMocha = require('gulp-mocha');
var javascriptGlobs = ['*.js', 'src/**/*.js', 'test/**/*.js'];
gulp.task('style', function () {
gulp.src(javascriptGlobs)
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jscs.reporter('fail'));
});
gulp.task('lint', function () {
gulp.src(javascriptGlobs)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter())
.pipe(jshint.reporter('fail'));
});
gulp.task('test:unit', function () {
gulp.src('test/unit/**/*.js')
.pipe(gulpMocha());
});
gulp.task('test:integration', function () {
gulp.src('test/integration/**/*.js')
.pipe(gulpMocha());
});
gulp.task('test', ['test:unit', 'test:integration']);
gulp.task('build', ['lint', 'style', 'test'], function () {
gulp.src('/');
});
gulp.task('default', ['build']);
|
JavaScript
| 0 |
@@ -237,32 +237,39 @@
function () %7B%0A
+return
gulp.src(javascr
@@ -270,32 +270,32 @@
avascriptGlobs)%0A
-
.pipe(jscs()
@@ -388,32 +388,39 @@
function () %7B%0A
+return
gulp.src(javascr
@@ -561,32 +561,39 @@
function () %7B%0A
+return
gulp.src('test/u
@@ -673,32 +673,39 @@
function () %7B%0A
+return
gulp.src('test/i
@@ -805,24 +805,24 @@
ration'%5D);%0A%0A
+
gulp.task('b
@@ -857,42 +857,8 @@
st'%5D
-, function () %7B%0A gulp.src('/');%0A%7D
);%0A%0A
|
e7baf2deda7f6a6f318df93f7a120ecfb4708fd6
|
Remove some blank lines
|
src/js/markovGenerator.js
|
src/js/markovGenerator.js
|
'use strict';
var markovGenerator = (function() {
var EOS = /[!?.]/;
function getDictItemByKey(dict, key) {
for (var i = 0, len = dict.length; i < len; i++) {
if (dict[i].key === key) return dict[i];
}
return null;
}
function getSeed(dict, chainSize) {
// find a seed that starts with a capital letter
var seed = [];
var seedAttempt = 0;
while (true) {
seedAttempt++;
var seed = dict[Math.floor(Math.random() * dict.length)].words;
var firstChar = seed[0].charAt(0);
if (firstChar === firstChar.toUpperCase()) {
break;
}
// too many loops, just use this one and move on.
if (seedAttempt > 20) {
break;
}
}
return seed;
}
function getWords(words, dict, chainSize) {
while (true) {
var last_words = words.slice(-1 * chainSize);
var match = getDictItemByKey(dict, last_words.join('/'));
if (match === null) break;
var next_opts = match.next;
var rand_next = next_opts[Math.floor(Math.random() * next_opts.length)];
if (typeof(rand_next) === 'undefined') break;
words.push(rand_next);
if (EOS.test(rand_next)) break;
}
return words;
}
function generateSentence(dict, chainSize) {
console.log("generating sentence");
var seed = getSeed(dict, chainSize);
var generatedWords = getWords(seed, dict, chainSize);
var sentence = generatedWords.join(' ');
if (EOS.test(sentence) === false) {
sentence = sentence + "."; // append a . to finish it
}
return sentence;
}
return { generateSentence : generateSentence }
})();
|
JavaScript
| 0.999999 |
@@ -458,17 +458,16 @@
.words;%0A
-%0A
%09%09%09var f
@@ -560,17 +560,16 @@
k;%0A%09%09%09%7D%0A
-%0A
%09%09%09// to
@@ -882,17 +882,16 @@
break;%0A
-%0A
%09%09%09var n
@@ -989,17 +989,16 @@
ngth)%5D;%0A
-%0A
%09%09%09if (t
@@ -1038,17 +1038,16 @@
break;%0A
-%0A
%09%09%09words
@@ -1207,17 +1207,16 @@
ence%22);%0A
-%0A
%09%09var se
@@ -1302,17 +1302,16 @@
nSize);%0A
-%0A
%09%09var se
@@ -1345,17 +1345,16 @@
n(' ');%0A
-%0A
%09%09if (EO
|
f15f36d746b8ed1d2845f8e278bf4f0b20073ed5
|
Remove Safari 8 from tests
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var metal = require('gulp-metal');
var options = {
bundleCssFileName: 'ajax.css',
bundleFileName: 'ajax.js',
globalName: 'metal',
mainBuildJsTasks: ['build:globals'],
moduleName: 'metal-ajax',
testBrowsers: ['Chrome', 'Firefox', 'Safari', 'IE10 - Win7', 'IE11 - Win7'],
testSaucelabsBrowsers: {
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome'
},
sl_chrome_57: {
base: 'SauceLabs',
browserName: 'chrome',
version: '57'
},
sl_safari_8: {
base: 'SauceLabs',
browserName: 'safari',
version: '8'
},
sl_safari_9: {
base: 'SauceLabs',
browserName: 'safari',
version: '9'
},
sl_safari_10: {
base: 'SauceLabs',
browserName: 'safari',
version: '10'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox'
},
sl_firefox_53: {
base: 'SauceLabs',
browserName: 'firefox',
version: '53'
},
sl_ie_10: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '10'
},
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
sl_edge_20: {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
version: '13'
},
sl_iphone: {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.2'
},
sl_android_4: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
},
sl_android_5: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '5.0'
}
}
};
metal.registerTasks(options);
|
JavaScript
| 0 |
@@ -470,94 +470,8 @@
%09%7D,%0A
-%09%09sl_safari_8: %7B%0A%09%09%09base: 'SauceLabs',%0A%09%09%09browserName: 'safari',%0A%09%09%09version: '8'%0A%09%09%7D,%0A
%09%09sl
|
be2904662eafee990cc73ec048f92f3f49c97325
|
更新gulpfile.js
|
gulpfile.js
|
gulpfile.js
|
const outputDir = 'build';
//https://github.com/mafintosh/pump
const pump = require('pump');
//https://github.com/gulpjs/gulp
const gulp = require('gulp');
//https://github.com/terinjokes/gulp-uglify
const uglify = require('gulp-uglify');
//https://github.com/scniro/gulp-clean-css
const cleanCSS = require('gulp-clean-css');
//https://github.com/cynosureabu/gulp-min-ejs
const minifyejs = require('gulp-minify-ejs');
const tasks = {
//压缩src/public/js目录下的js文件
compressJS: callback => {
const option = {
mangle : {
toplevel: true,
keep_fnames: true,
reserved: ['$']
}
};
pump([
gulp.src('src/public/js/**/*.js'),
uglify(option),
gulp.dest(outputDir + '/public/js/')
], callback);
},
//处理src/public/css目录下的css文件中的空行
cleanCSS: callback => {
pump([
gulp.src('src/public/css/*.css'),
cleanCSS({compatibility: 'ie8'}),
gulp.dest(outputDir + '/public/css/')
], callback);
},
//复制src/public目录下的其他文件
copyPublic: callback => {
pump([
gulp.src(['src/public/**', '!src/public/js/**/*.js', '!src/public/css/**/*.css']),
gulp.dest(outputDir + '/public/')
], callback);
},
//处理src/private/views目录下的ejs模板中的空白行
minifyejs: callback => {
pump([
gulp.src('src/private/views/**/*.ejs'),
minifyejs(),
gulp.dest(outputDir + '/private/views/')
], callback);
},
//复制src/private目录下的其他文件
copyPrivate: callback => {
pump([
gulp.src(['src/private/**', '!src/private/views/**/*.ejs']),
gulp.dest(outputDir + '/private/')
], callback);
}
};
for(var key in tasks) {
gulp.task(key, tasks[key]);
}
gulp.task('default', Object.keys(tasks));
|
JavaScript
| 0 |
@@ -9,22 +9,16 @@
tputDir
-
= 'build
|
2d758b7623a28807d762103331008a69514c1e26
|
Remove last bits of gulp-bg
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var bg = require('gulp-bg');
var docs = require('./gulp/docs');
gulp.task('docs', docs({
cwd: __dirname,
src: './src/docs',
dest: './dist/docs'
}));
gulp.task('watch-docs', function (cb) {
gulp.watch('./src/docs/**', ['docs']);
});
gulp.task('default', []);
|
JavaScript
| 0.00002 |
@@ -25,37 +25,8 @@
');%0A
-var bg = require('gulp-bg');%0A
var
|
907c6ecd1e45f6cf9a95b5351aa6625cf6963f00
|
Add build task
|
gulpfile.js
|
gulpfile.js
|
// Copyright 2016 underdolphin(masato sueda)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const electron = require('electron-connect').server.create();
const gulp = require('gulp');
const cleancss = require('gulp-clean-css');
const htmlmin = require('gulp-htmlmin');
const plumber = require('gulp-plumber');
const stylus = require('gulp-stylus');
const prettydiff = require('gulp-prettydiff');
const typescript = require('gulp-typescript');
const del = require('del');
const project = typescript.createProject('tsconfig.json', {
typescript: require('typescript')
});
gulp.task('html', () => {
gulp.src('src/**/*.html')
.pipe(plumber())
.pipe(htmlmin({
collapseWhitespace: true
}))
.pipe(gulp.dest('./build/'));
});
gulp.task('css', () => {
gulp.src('src/**/*.styl')
.pipe(plumber())
.pipe(stylus())
.pipe(cleancss())
.pipe(gulp.dest('./build/'));
});
gulp.task('js:main', () => {
gulp.src('src/main/**/*.ts')
.pipe(plumber())
.pipe(project())
.pipe(prettydiff({
lang: 'js',
mode: 'minify',
}))
.pipe(gulp.dest('./build/main'));
});
gulp.task('js:renderer', () => {
gulp.src('src/renderer/**/*.ts')
.pipe(plumber())
.pipe(project())
.pipe(prettydiff({
lang: 'js',
mode: 'minify',
}))
.pipe(gulp.dest('./build/renderer'));
});
gulp.task('serve', () => {
electron.start();
gulp.watch('build/main/**/**.js', ['restart:electron']);
gulp.watch(['build/**/**.html', 'build/**/**.css', 'build/renderer/**/**.js'], ['reload:renderer'])
})
gulp.task('watch', () => {
gulp.watch('src/**/*.html', ['html']);
gulp.watch('src/**/*.styl', ['css']);
gulp.watch('src/main/**/*.ts', ['js:main']);
gulp.watch('src/renderer/**/*.ts', ['js:renderer']);
});
gulp.task('restart:electron', (done) => {
electron.restart();
done();
});
gulp.task('reload:renderer', (done) => {
electron.reload();
done();
});
gulp.task("default", ['watch', 'serve']);
gulp.task('clean', del.bind(null,['build/main','build/renderer']));
|
JavaScript
| 0.000388 |
@@ -1016,17 +1016,132 @@
%0A%0Aconst
-p
+mainProject = typescript.createProject('tsconfig.json', %7B%0A typescript: require('typescript')%0A%7D);%0A%0Aconst rendererP
roject =
@@ -1692,33 +1692,37 @@
)%0A .pipe(
-p
+mainP
roject())%0A
@@ -1963,17 +1963,25 @@
.pipe(
-p
+rendererP
roject()
@@ -2768,24 +2768,24 @@
'serve'%5D);%0A%0A
-
gulp.task('c
@@ -2839,8 +2839,68 @@
rer'%5D));
+%0A%0Agulp.task('build',%5B'html','css','js:main','js:renderer'%5D);
|
ce7b7ab4d2a9cac0cc378c1a810b70f3b32dcdab
|
Update deps
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var initGulpTasks = require('react-component-gulp-tasks');
/**
* Tasks are added by the react-component-gulp-tasks package
*
* See https://github.com/JedWatson/react-component-gulp-tasks
* for documentation.
*
* You can also add your own additional gulp tasks if you like.
*/
// Read the package.json to detect the package name
var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
var taskConfig = {
component: {
name: 'BurgerMenu',
dependencies: [
'classnames',
'react',
'snapsvg'
],
lib: 'lib',
file: 'BurgerMenu.js',
src: 'src',
dist: 'dist',
pkgName: pkg.name
},
example: {
src: 'example/src',
dist: 'example/dist',
files: [
'index.html',
'.gitignore',
'normalize.css',
'fonts/**/*'
],
scripts: [
'example.js'
],
less: [
'example.less'
]
}
};
initGulpTasks(gulp, taskConfig);
|
JavaScript
| 0 |
@@ -502,24 +502,53 @@
ndencies: %5B%0A
+ 'browserify-optional',%0A
'class
|
5c4e196c0e270ee5147843aa3756045c90aa77db
|
Disable 'es6.classes' transform for server.
|
gulpfile.js
|
gulpfile.js
|
/**
* @license MIT License
*
* Copyright (c) 2015 Tetsuharu OHZEKI <[email protected]>
* Copyright (c) 2015 Yusuke Suzuki <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
'use strict';
let babel = require('gulp-babel');
let babelify = require('babelify');
let browserify = require('browserify');
let childProcess = require('child_process');
let concat = require('gulp-concat');
let del = require('del');
let eslint = require('gulp-eslint');
let gulp = require('gulp');
let path = require('path');
let source = require('vinyl-source-stream');
let uglify = require('gulp-uglifyjs');
const isRelease = process.env.NODE_ENV === 'production';
const SRC = [
'client/js/libs/handlebars.js',
'client/js/libs/handlebars/**/*.js',
'client/js/libs/jquery.js',
'client/js/libs/jquery/**/*.js',
'client/js/libs/moment.js',
'client/js/libs/stringcolor.js',
'client/js/libs/uri.js',
];
const DIST_SERVER = './dist/';
const DIST_CLIENT = './client/dist/';
const DIST_CLIENT_JS = path.resolve(DIST_CLIENT, './js/');
/**
* # The rules of task name
*
* ## public task
* - This is completed in itself.
* - This is callable as `gulp <taskname>`.
*
* ## private task
* - This has some sideeffect in dependent task trees
* and it cannot recovery by self.
* - This is __callable only from public task__.
* DONT CALL as `gulp <taskname>`.
* - MUST name `__taskname`.
*/
gulp.task('__uglify', ['clean:client'], function () {
return gulp.src(SRC)
.pipe(uglify('libs.min.js', {
compress: false,
}))
.pipe(gulp.dest(DIST_CLIENT_JS));
});
gulp.task('__handlebars', ['clean:client'], function () {
let handlebars = path.relative(__dirname, './node_modules/handlebars/bin/handlebars');
let args = [
String(handlebars),
'client/views/',
'-e', 'tpl',
'-f', path.resolve(DIST_CLIENT_JS, './karen.templates.js'),
];
let option = {
cwd: path.relative(__dirname, ''),
stdio: 'inherit',
};
childProcess.spawn('node', args, option);
});
gulp.task('__browserify', ['clean:client'], function () {
const SRC_JS = ['./client/js/karen.js'];
const option = {
insertGlobals: false,
debug: isRelease ? false : true,
};
const babel = babelify.configure({
optional: [],
});
browserify(SRC_JS, option)
.transform(babel)
.bundle()
.pipe(source('karen.js'))
.pipe(gulp.dest(DIST_CLIENT_JS));
});
gulp.task('jslint', function () {
let option = {
useEslintrc: true,
};
return gulp.src([
'./gulpfile.js',
'./client/js/karen.js',
'./client/script/**/*.js',
'./defaults/**/*.js',
'./src/**/*.js',
])
.pipe(eslint(option))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('__babel:server', ['clean:server'], function () {
return gulp.src('./src/**/*.js')
.pipe(babel({
// For io.js, we need not some transforms:
blacklist: [
'es6.blockScoping',
'es6.constants',
'es6.forOf',
'es6.templateLiterals',
],
sourceMaps: false,
}))
.pipe(gulp.dest(DIST_SERVER));
});
gulp.task('clean:client', function (callback) {
return del(path.join(DIST_CLIENT, '**', '*.*'), callback);
});
gulp.task('clean:server', function (callback) {
return del(path.join(DIST_SERVER, '**', '*.*'), callback);
});
gulp.task('__build:server', ['__babel:server']);
gulp.task('__build:client', ['__handlebars', '__uglify', '__browserify']);
gulp.task('build:server', ['jslint', '__build:server']);
gulp.task('build:client', ['jslint', '__build:client']);
gulp.task('build', ['jslint', '__build:client', '__build:server']);
gulp.task('clean', ['clean:client', 'clean:server']);
gulp.task('default', ['build']);
|
JavaScript
| 0 |
@@ -4192,16 +4192,47 @@
oping',%0A
+ 'es6.classes',%0A
|
e181e4b8ba97c2a7b431995a70bcd4c9a3c01df9
|
Fix lib issue
|
gulpfile.js
|
gulpfile.js
|
(function(){
'use strict';
var gulp = require('gulp'),
Merge = require('streamqueue'),
argv = require('yargs').argv,
$ = require('gulp-load-plugins')({
rename: {
'gulp-sass': 'sass',
'gulp-minify-css': 'minifycss'
},
lazy: false
});
/* Combine Sass / Libraries */
gulp.task('styles', function() {
var style = gulp.src('src/scss/*.scss');
return style
.pipe($.sass({ outputStyle: 'compressed', errLogToConsole: true }))
.pipe($.autoprefixer({ browsers: ['last 2 version'] }))
.pipe($.if(argv.prod, $.minifycss()))
.pipe(gulp.dest('dist/css'))
.pipe($.notify({ message: 'Styles Task Completed' }));
});
/* Main Script / Libraries */
gulp.task('scripts-main', function() {
var libs = libs = gulp.src(['src/js/play-midnight-*', '!src/js/play-midnight-utils.js', '!src/js/play-midnight.js']),
utils = gulp.src('src/js/play-midnight-utils.js'),
script = gulp.src('src/js/play-midnight.js'),
merged;
merged = new Merge({ objectMode: true });
merged.queue(utils);
merged.queue(libs);
merged.queue(script);
return merged.done()
.pipe($.jshint())
.pipe($.jshint.reporter('default'))
.pipe($.concat('play-midnight.js'))
.pipe($.if(argv.prod, $.uglify()))
.pipe(gulp.dest('dist/js'))
.pipe($.notify({ message: 'Main Scripts Task Completed' }));
});
/* Background Script */
gulp.task('scripts-bg', function() {
var script = gulp.src('src/js/background.js');
return script
.pipe($.jshint())
.pipe($.jshint.reporter('default'))
.pipe($.if(argv.prod, $.uglify()))
.pipe(gulp.dest('dist/js'))
.pipe($.notify({ message: 'Background Scripts Task Completed' }));
});
/* Images Script */
gulp.task('images', function() {
var images = gulp.src('src/images/**/*');
return images
.pipe(gulp.dest('dist/images'))
.pipe($.notify({ message: 'Images Task Completed' }));
});
/* HTML Script */
gulp.task('html', function() {
var html = gulp.src('src/**/*.html');
return html
.pipe(gulp.dest('dist'))
.pipe($.notify({ message: 'HTML Task Completed' }));
});
/* Watch File Changes */
gulp.task('watch', function() {
gulp.watch('src/scss/**/*.scss', ['styles']);
gulp.watch('src/js/**/play-midnight*.js', ['scripts-main']);
gulp.watch('src/js/**/background.js', ['scripts-bg']);
gulp.watch('src/images/**/*', ['images']);
gulp.watch('src/**/*.html', ['html']);
});
/* Default Task */
gulp.task('default', function() {
gulp.start('styles', 'scripts-main', 'scripts-bg', 'images', 'html');
});
}());
|
JavaScript
| 0.000001 |
@@ -721,23 +721,16 @@
r libs =
- libs =
gulp.sr
|
8400394e4af99241d597f2ea69d3a1f9f2c1ef86
|
Remove integration test, because it run too long in CI
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var path = require('path');
var fs = require('fs');
gulp.task('cases', function () {
var jsonify = require('./jsonify');
var postcss = require('postcss');
var cases = path.join(__dirname, 'cases');
var extra = require('./extra-cases');
fs.readdirSync(cases).forEach(function (i) {
if ( path.extname(i) !== '.json' ) return;
var name = path.basename(i, '.json');
var css = extra[name];
if ( !css ) css = fs.readFileSync(path.join(cases, name + '.css'));
var root = postcss.parse(css, { from: '/' + name });
fs.writeFileSync(path.join(cases, i), jsonify(root) + '\n');
});
});
gulp.task('lint', function () {
var eslint = require('gulp-eslint');
return gulp.src(['*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('integration', function (done) {
var real = require('./real');
real(done, [['Browserhacks', 'http://browserhacks.com/']], function (css) {
return { css: css };
});
});
gulp.task('test', function () {
var mocha = require('gulp-mocha');
return gulp.src('test/*.js', { read: false }).pipe(mocha());
});
gulp.task('default', ['lint', 'integration']);
|
JavaScript
| 0.000004 |
@@ -884,207 +884,8 @@
);%0A%0A
-gulp.task('integration', function (done) %7B%0A var real = require('./real');%0A real(done, %5B%5B'Browserhacks', 'http://browserhacks.com/'%5D%5D, function (css) %7B%0A return %7B css: css %7D;%0A %7D);%0A%7D);%0A%0A
gulp
|
21fcb3ccdd2b676ea7f4ec3cc341f00c89977357
|
Update gulp tasks
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var sassLint = require('gulp-sass-lint');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
require('babel-core/register');
// testing
var mocha = require('gulp-mocha');
/**
*
* @param outFolder string
* @param outFileBase string
* @return {*}
*/
function runBabelOnFolder(outFolder, outFileBase) {
if(outFolder !== '' && outFolder.slice(-1) !== '/'){
outFolder += '/';
}
return gulp.src('app/Resources/client/jsx/'+outFolder+outFileBase+'/*.js?(x)')
.pipe(babel({
presets: ['es2015', 'react']
}))
.pipe(concat(outFileBase+'.js'))
.pipe(gulp.dest('web/assets/js/'+outFolder));
}
gulp.task('babel-helpers', function() {
return runBabelOnFolder('', 'helpers');
});
gulp.task('babel-base', function() {
return runBabelOnFolder('', 'base');
});
gulp.task('babel-project-details', function() {
return runBabelOnFolder('project', 'details');
});
gulp.task('babel-project-trait-details', function() {
return runBabelOnFolder('project', 'traitDetails');
});
gulp.task('babel-trait-browse', function() {
return runBabelOnFolder('trait', 'browse');
});
gulp.task('babel-organism-details', function() {
return runBabelOnFolder('organism', 'details');
});
gulp.task('test', function() {
return gulp.src('tests/js/**/*.js', {read: false})
.pipe(mocha({reporter: 'spec', useColors: true}))
});
gulp.task('sass', function () {
return gulp.src('app/Resources/client/scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(sourcemaps.write('.', {includeContent: false}))
.pipe(gulp.dest('web/assets/css'));
});
gulp.task('sassLint', function() {
gulp.src('web/assets/scss/*.s+(a|c)ss')
.pipe(sassLint())
.pipe(sassLint.format())
.pipe(sassLint.failOnError());
});
gulp.task('babel', [
'babel-helpers',
'babel-base',
'babel-project-details',
'babel-project-trait-details',
'babel-trait-browse',
'babel-organism-details'
], function () {
});
gulp.task('css', ['sassLint','sass'], function () {
});
gulp.task('default', ['css','babel','test'], function() {
// place code for your default task here
});
|
JavaScript
| 0.000001 |
@@ -1054,32 +1054,136 @@
details');%0A%7D);%0A%0A
+gulp.task('babel-project-helpers', function() %7B%0A return runBabelOnFolder('project', 'helpers');%0A%7D);%0A%0A
gulp.task('babel
@@ -2177,32 +2177,61 @@
oject-details',%0A
+ 'babel-project-helpers',%0A
'babel-proje
|
2a79dab7b36f706e3e4580848c844c6b16e64faa
|
Add gulp build and serve tasks
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var gulp = require('gulp'),
iif = require('gulp-if'),
sass = require('gulp-sass'),
cssbeautify = require('gulp-cssbeautify'),
del = require('del');
gulp.task('build', ['clean'], function() {
return gulp.src('apps/**')
.pipe(iif('*.scss', sass()))
.pipe(iif('*.css', cssbeautify({ indent: ' ' })))
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function(cb) {
del('dist', cb);
});
gulp.task('default', function() {
gulp.start('build');
});
|
JavaScript
| 0 |
@@ -170,18 +170,93 @@
e('del')
-;%0A
+,%0A browserSync = require('browser-sync');%0A%0A// Process app templates folder
%0Agulp.ta
@@ -264,16 +264,25 @@
k('build
+Templates
', %5B'cle
@@ -313,16 +313,21 @@
urn gulp
+%0A
.src('ap
@@ -461,85 +461,374 @@
);%0A%0A
-gulp.task('clean', function(cb) %7B%0A del('dist', cb);%0A%7D);%0A%0Agulp.task('default'
+// Process public folder%0Agulp.task('buildPublic', %5B'clean'%5D, function() %7B%0A return gulp%0A .src('public/**')%0A .pipe(gulp.dest('dist'));%0A%7D);%0A%0A// Generate all files%0Agulp.task('build', %5B'buildTemplates', 'buildPublic'%5D);%0A%0A// Clean dist folder%0Agulp.task('clean', function(cb) %7B%0A del('dist', cb);%0A%7D);%0A%0A// Watch files for changes & reload%0Agulp.task('serve', %5B'build'%5D
, fu
@@ -837,36 +837,214 @@
tion
+
() %7B%0A
-gulp.start('build');%0A%7D
+browserSync(%7B%0A notify: false,%0A server: %5B'dist'%5D%0A %7D);%0A%0A gulp.watch(%5B'public/*.*', 'apps/**/*.html', 'apps/**/*.%7Bscss,css%7D'%5D, %5B'build', browserSync.reload%5D);%0A%7D);%0A%0Agulp.task('default', %5B'build'%5D
);%0A
|
a1f148a3da3544fb63a34bf4ca96bad53eced00d
|
Change output file name
|
gulpfile.js
|
gulpfile.js
|
'use strict'
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const gulpts = require('gulp-typescript');
const uglify = require('gulp-uglify');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const tsProject = gulpts.createProject('tsconfig.json', {
typescript: require('typescript'),
module: "commonjs",
sortOutput: true
});
gulp.task('tsCompile', () => {
gulp.src('src/**/*.ts')
.pipe(plumber())
.pipe(tsProject())
.js
.pipe(gulp.dest('build/'));
});
gulp.task('browserify', () => {
browserify({
entries: ['./build/index.js']
})
.bundle()
.pipe(source('lib.min.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./dist/'))
});
gulp.task('watch', () => {
gulp.watch('src/**/*.ts', ['tsCompile']);
gulp.watch('build/**/*.js', ['browserify']);
});
gulp.task('default', ['tsCompile', 'browserify'], () => {
gulp.start('watch')
});
|
JavaScript
| 0.000007 |
@@ -746,11 +746,16 @@
ce('
-lib
+parseley
.min
|
456c184d7172bdfe7ff515eb7a279d0947dbbb5e
|
Fix watch paths
|
gulpfile.js
|
gulpfile.js
|
// Requires
var pkg = require('./package.json');
var gulp = require('gulp');
var autoprefixer = require('autoprefixer');
var browserSync = require('browser-sync').create();
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var cssnano = require('cssnano');
var data = require('gulp-data');
var del = require('del');
var fs = require('fs');
var imagemin = require('gulp-imagemin');
var plumber = require('gulp-plumber');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var svgSprite = require('gulp-svg-sprite');
var twig = require('gulp-twig');
var uglify = require('gulp-uglify');
// BrowserSync reload
function reload(done) {
browserSync.reload();
done();
};
// Get data from JSON
function getData() {
var data = JSON.parse(fs.readFileSync(pkg.paths.src.base + pkg.vars.dataName, 'utf8'));
return data;
};
// CSS task
gulp.task('css', function() {
var processors = [
autoprefixer(),
cssnano({
preset: 'default'
})
];
return gulp.src(pkg.paths.src.css + pkg.vars.cssName)
.pipe(plumber())
.pipe(sass().on('error', sass.logError))
.pipe(postcss(processors))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(pkg.paths.dist.css))
.pipe(browserSync.stream());
});
// JS task
gulp.task('js', function() {
return gulp.src(pkg.globs.js)
.pipe(plumber())
.pipe(concat(pkg.vars.jsName))
.pipe(uglify())
.pipe(gulp.dest(pkg.paths.dist.js));
});
// HTML task
gulp.task('html', function() {
return gulp.src(pkg.globs.html)
.pipe(plumber())
.pipe(data(getData()))
.pipe(twig())
.pipe(gulp.dest(pkg.paths.dist.base));
});
// Images task
gulp.task('images', function() {
return gulp.src(pkg.globs.img)
.pipe(changed(pkg.paths.dist.img))
.pipe(imagemin({
interlaced: true,
progressive: true
}))
.pipe(gulp.dest(pkg.paths.dist.img));
});
// Sprites task
gulp.task('sprites', function() {
return gulp.src(pkg.globs.sprites)
.pipe(svgSprite({
mode: {
symbol: {
dest: '.',
sprite: pkg.vars.spriteName
}
}
}))
.pipe(gulp.dest(pkg.paths.dist.sprites));
});
// Fonts task
gulp.task('fonts', function() {
return gulp.src(pkg.globs.fonts)
.pipe(changed(pkg.paths.dist.fonts))
.pipe(gulp.dest(pkg.paths.dist.fonts));
})
// Clean task
gulp.task('clean', function() {
return del(pkg.globs.clean);
});
// Serve task
gulp.task('serve', function() {
browserSync.init({
server: pkg.urls.local
});
});
// Watch task
gulp.task('watch', function() {
gulp.watch(pkg.paths.src.css + '**/*.scss', gulp.series('css'));
gulp.watch(pkg.paths.src.js + '**/*.js', gulp.series('js', reload));
gulp.watch([
pkg.paths.src.base + '**/*.{html,twig}',
pkg.paths.src.base + pkg.vars.dataName
], gulp.series('html', reload));
gulp.watch(pkg.paths.src.img + '**/*', gulp.series('images'));
gulp.watch(pkg.paths.sprites + '**/*.svg', gulp.series('sprites'));
gulp.watch(pkg.paths.fonts + '**/*', gulp.series('fonts'))
});
// Default task
gulp.task('default',
gulp.series(
gulp.parallel('css', 'js', 'html', 'images', 'sprites', 'fonts'),
gulp.parallel('serve', 'watch')
)
);
// Build task
gulp.task('build',
gulp.series(
'clean',
gulp.parallel('css', 'js', 'html', 'images', 'sprites', 'fonts')
)
);
|
JavaScript
| 0.000016 |
@@ -2987,16 +2987,20 @@
g.paths.
+src.
sprites
@@ -3061,16 +3061,20 @@
g.paths.
+src.
fonts +
|
cfc9c3c862cb6456eb2ad1845b30746f515111c6
|
optimize style task
|
gulpfile.js
|
gulpfile.js
|
/*
gulpfile.js
===========
Rather than manage one giant configuration file responsible
for creating multiple tasks, each task has been broken out into
its own file in gulp/tasks. Any files in that directory get
automatically required below.
To add a new task, simply add a new task file that directory.
gulp/tasks/default.js specifies the default set of tasks to run
when you run `gulp`.
all main tasks are listed here
*/
'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var config = require('./gulp/config');
require('require-dir')('./gulp/tasks', {
recurse: true
});
/*******************************************************************************
MAIN TASKS
*******************************************************************************/
gulp.task('default', function(cb) {
runSequence('sprites', ['scripts', 'styles'], cb);
});
gulp.task('dev', function(cb) {
runSequence('default', 'browserSync:dev', 'watch', cb);
});
gulp.task('dist', function(cb) {
runSequence('clean', 'default', [
'js:dist',
'vendor:dist',
'css:dist',
'fonts:dist',
'images:dist',
'pkg:dist'
],
'html:src:dist',
'html:tmp:dist',
cb);
});
gulp.task('deploy', function(cb) {
runSequence('dist', 'publish');
});
gulp.task('release', function(cb) {
runSequence('bump:patch', 'dist', 'publish');
});
/*******************************************************************************
TASKS
*******************************************************************************/
gulp.task('styles', function(cb) {
switch (config.preprocessor) {
case 'scss':
runSequence('scsslint', 'scss', 'csslint', cb);
break;
case 'stylus':
runSequence('stylus', 'csslint', cb);
break;
default:
cb();
}
});
gulp.task('scripts', function(cb) {
runSequence('jshint', 'js', cb);
});
gulp.task('publish', function(cb) {
runSequence('rsync', cb);
});
|
JavaScript
| 0.999895 |
@@ -1682,16 +1682,17 @@
equence(
+%5B
'scsslin
@@ -1701,27 +1701,17 @@
, 'scss'
-, 'csslint'
+%5D
, cb);%0A
@@ -1772,19 +1772,8 @@
us',
- 'csslint',
cb)
|
5aec5cebcfac4ffa1f4f7a682dffab335cc5853c
|
Fix JS bundling in live mode.
|
gulpfile.js
|
gulpfile.js
|
'use strict';
var watchify = require('watchify');
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var assign = require('lodash.assign');
var watch = require('gulp-watch');
// for serving the app
var http = require('http');
var finalhandler = require('finalhandler')
var serveStatic = require('serve-static');
// add custom browserify options here
var customOpts = {
entries: ['./src/index.js'],
debug: true
};
var opts = assign({}, watchify.args, customOpts);
var b = watchify(browserify(opts));
gulp.task('js', bundle); // so you can run `gulp js` to build the file
b.on('update', bundle); // on any dep update, runs the bundler
b.on('log', gutil.log); // output build logs to terminal
function bundle() {
return b.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
// optional, remove if you don't need to buffer file contents
.pipe(buffer())
// optional, remove if you dont want sourcemaps
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
// Add transformation tasks to the pipeline here.
.pipe(sourcemaps.write('./')) // writes .map file
.pipe(gulp.dest('./dist'));
}
gulp.task('static', function () {
gulp.src('./static/*.html', {base: './static'})
.pipe(gulp.dest('./dist'));
});
gulp.task('stylesheets', function () {
gulp.src('./stylesheets/*.css', {base: './stylesheets'})
.pipe(gulp.dest('./dist'));
});
gulp.task('serve', function () {
var serve = serveStatic('dist', {'index': ['index.html']});
// Create server
var server = http.createServer(function (req, res) {
var done = finalhandler(req, res);
serve(req, res, done);
});
// Listen
var port = 3000;
server.listen(3000);
console.log("server listening on port", port);
});
gulp.task('watch', function () {
gulp.watch(['static/**'], ['static']);
gulp.watch(['stylesheets/**'], ['stylesheets']);
});
gulp.task('live', ['serve', 'watch']);
|
JavaScript
| 0 |
@@ -2282,13 +2282,19 @@
'watch'
+, 'js'
%5D);%0D%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.