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
f9f8ed266d815dfb18d8ac2b3fba500ddfe7443a
Update on className change
tweet-embed.js
tweet-embed.js
import React from 'react' import PropTypes from 'prop-types' const callbacks = [] function addScript (src, cb) { if (callbacks.length === 0) { callbacks.push(cb) var s = document.createElement('script') s.setAttribute('src', src) s.onload = () => callbacks.forEach(cb => cb()) document.body.appendChild(s) } else { callbacks.push(cb) } } class TweetEmbed extends React.Component { loadTweetForProps (props) { const renderTweet = () => { window.twttr.ready().then(({ widgets }) => { // Clear previously rendered tweet before rendering the updated tweet id if (this._div) { this._div.innerHTML = '' } const { options, onTweetLoadSuccess, onTweetLoadError } = props widgets .createTweetEmbed(this.props.id, this._div, options) .then(onTweetLoadSuccess) .catch(onTweetLoadError) }) } if (!(window.twttr && window.twttr.ready)) { const isLocal = window.location.protocol.indexOf('file') >= 0 const protocol = isLocal ? this.props.protocol : '' addScript(`${protocol}//platform.twitter.com/widgets.js`, renderTweet) } else { renderTweet() } } componentDidMount () { this.loadTweetForProps(this.props) } shouldComponentUpdate (nextProps, nextState) { return this.props.id !== nextProps.id } componentWillUpdate (nextProps, nextState) { this.loadTweetForProps(nextProps) } render () { return ( <div className={this.props.className} ref={c => { this._div = c }} /> ) } } TweetEmbed.propTypes = { id: PropTypes.string, options: PropTypes.object, protocol: PropTypes.string, onTweetLoadSuccess: PropTypes.func, onTweetLoadError: PropTypes.func, className: PropTypes.string } TweetEmbed.defaultProps = { protocol: 'https:', options: {}, className: null } export default TweetEmbed
JavaScript
0
@@ -1336,16 +1336,24 @@ return +(%0A this.pro @@ -1374,16 +1374,76 @@ Props.id + %7C%7C%0A this.props.className !== nextProps.className%0A ) %0A %7D%0A%0A @@ -1483,24 +1483,68 @@ extState) %7B%0A + if (this.props.id !== nextProps.id) %7B%0A this.loa @@ -1565,24 +1565,30 @@ (nextProps)%0A + %7D%0A %7D%0A%0A rende
07d20ff85fc921ac7ee49ddca9300bcc3f0cee48
add deviceId to id
twine/index.js
twine/index.js
var Bowline = require('bowline'); var adapter = {}; adapter.sensorName = 'twine'; adapter.types = [ { name: 'twine', fields: { timestamp: 'date', meta: { sensor: 'string', battery: 'string', wifiSignal: 'string' }, time: { age: 'float', timestamp: 'integer' }, values: { batteryVoltage: 'float', firmwareVersion: 'string', isVibrating: 'boolean', orientation: 'string', temperature: 'integer', updateMode: 'string', vibration: 'integer' } } } ]; adapter.promptProps = { properties: { email: { description: 'Enter your Twine account (e-mail address)'.magenta }, password: { description: 'Enter your password'.magenta }, deviceId: { description: 'Enter your Twine device ID'.magenta } } }; adapter.storeConfig = function(c8, result) { return c8.config(result).then(function(){ console.log('Configuration stored.'); c8.release(); }); } adapter.importData = function(c8, conf, opts) { if (conf.deviceId) { var client = new Bowline(conf); return client.fetch(function(err, response){ if (err) { console.trace(err); return; } response.id = response.time.timestamp; response.meta.sensor = conf.deviceId; response.timestamp = new Date(response.time.timestamp * 1000); console.log(response.timestamp); return c8.insert(response).then(function(result) { // console.log(result); // console.log('Indexed ' + result.items.length + ' documents in ' + result.took + ' ms.'); }).catch(function(error) { console.trace(error); }); }); } else { console.log('Configure first.'); } }; module.exports = adapter;
JavaScript
0.000014
@@ -1312,16 +1312,38 @@ imestamp + + '-' + conf.deviceId ;%0A
531334c2437e62fad78d7da19cde57fe333c933f
Update to redux-req-middleware
server/middleware/routing-middleware.js
server/middleware/routing-middleware.js
import { match } from 'react-router'; import routes from '../../src/base/routes'; import renderPage from '../lib/renderPage'; import { fetchRequiredActions } from 'base'; import renderContainer from '../lib/renderContainer'; import configureServerStore from '../lib/configureStore'; import { applyMiddleware, createStore } from 'redux'; import rootReducer from '../../src/base/reducers/'; import requestMiddleware from '../../src/base/middleware/Request'; const context = 'server'; export default function routingMiddleware(req, res, next) { const store = configureServerStore(); match({ routes , location: req.url }, (error, redirectLocation, renderProps) => { if ( error ) return res.status(500).send( error.message ); if ( redirectLocation ) return res.redirect( 302, redirectLocation.pathname + redirectLocation.search ); if ( renderProps == null ) return res.status(404).send( 'Not found' ); fetchRequiredActions(store.dispatch, renderProps.components, renderProps.params, context) .then(() => { const routeMatch = renderProps.location.pathname; const renderedContainer = renderContainer(store, renderProps); return renderPage(routeMatch, renderedContainer, store ); }) .then( page => res.status(200).send(page) ) .catch( err => res.end(err.message) ); }); }
JavaScript
0
@@ -30,16 +30,61 @@ router'; +%0Aimport %7B fetchRequiredActions %7D from 'base'; %0A%0Aimport @@ -169,53 +169,8 @@ e';%0A -import %7B fetchRequiredActions %7D from 'base';%0A impo @@ -282,209 +282,8 @@ ';%0A%0A -import %7B applyMiddleware, createStore %7D from 'redux';%0Aimport rootReducer from '../../src/base/reducers/';%0Aimport requestMiddleware from '../../src/base/middleware/Request';%0A%0Aconst context = 'server';%0A%0A expo @@ -332,14 +332,8 @@ res -, next ) %7B%0A @@ -473,15 +473,13 @@ if ( - error - ) re @@ -504,17 +504,16 @@ 0).send( - error.me @@ -517,17 +517,16 @@ .message - );%0A i @@ -528,17 +528,16 @@ if ( - redirect @@ -544,17 +544,16 @@ Location - ) return @@ -566,17 +566,16 @@ edirect( - 302, red @@ -622,17 +622,16 @@ n.search - );%0A i @@ -633,17 +633,16 @@ if ( - renderPr @@ -652,17 +652,16 @@ == null - ) return @@ -682,17 +682,16 @@ 4).send( - 'Not fou @@ -693,17 +693,16 @@ t found' - );%0A%0A @@ -786,15 +786,16 @@ ms, -context +'server' )%0A @@ -1003,17 +1003,16 @@ r, store - );%0A @@ -1027,17 +1027,16 @@ .then( - page =%3E @@ -1061,17 +1061,16 @@ nd(page) - )%0A @@ -1076,17 +1076,16 @@ .catch( - err =%3E r @@ -1103,17 +1103,16 @@ message) - );%0A %7D);
d3c291cb68ac0e06d34d568a3a6a264f83c8d713
Correct some errors in German locale
js/i18n/grid.locale-de.js
js/i18n/grid.locale-de.js
;(function($){ /** * jqGrid German Translation * Version 1.0.0 (developed for jQuery Grid 3.3.1) * Olaf Klöppel opensource@blue-hit.de * http://blue-hit.de/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html **/ $.jgrid = { defaults : { recordtext: "Zeige {0} - {1} von {2}", emptyrecords: "Keine Datensätze vorhanden", loadtext: "Lädt...", pgtext : "Seite {0} von {1}" }, search : { caption: "Suche...", Find: "Finden", Reset: "Zurücksetzen", odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','größer','größer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'], groupOps: [ { op: "AND", text: "alle" }, { op: "OR", text: "mindestens eins" } ], matchText: " match", rulesText: " rules" }, edit : { addCaption: "Datensatz hinzufügen", editCaption: "Datensatz bearbeiten", bSubmit: "Speichern", bCancel: "Abbrechen", bClose: "Schließen", saveData: "Daten wurden geändert! Änderungen speichern?", bYes : "ja", bNo : "nein", bExit : "abbrechen", msg: { required:"Feld ist erforderlich", number: "Bitte geben Sie eine Zahl ein", minValue:"Wert muss größer oder gleich sein, als ", maxValue:"Wert muss kleiner oder gleich sein, als ", email: "ist keine valide E-Mail Adresse", integer: "Bitte geben Sie eine Ganzzahl ein", date: "Bitte geben Sie ein gültiges Datum ein", url: "ist keine gültige URL. Prefix muss eingegeben werden ('http://' oder 'https://')", nodefined : " ist nicht definiert!", novalue : " Rückgabewert ist erforderlich!", customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!", customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Überprüfung vorhanden sein!" } }, view : { caption: "Datensatz anschauen", bClose: "Schließen" }, del : { caption: "Löschen", msg: "Ausgewählte Datensätze löschen?", bSubmit: "Löschen", bCancel: "Abbrechen" }, nav : { edittext: " ", edittitle: "Ausgewählten Zeile editieren", addtext:" ", addtitle: "Neuen Zeile einfügen", deltext: " ", deltitle: "Ausgewählte Zeile löschen", searchtext: " ", searchtitle: "Datensatz finden", refreshtext: "", refreshtitle: "Tabelle neu laden", alertcap: "Warnung", alerttext: "Bitte Zeile auswählen", viewtext: "", viewtitle: "Ausgewählte Zeile anzeigen" }, col : { caption: "Spalten anzeigen/verbergen", bSubmit: "Speichern", bCancel: "Abbrechen" }, errors : { errcap : "Fehler", nourl : "Keine URL angegeben", norecords: "Keine Datensätze zum verarbeiten", model : "colNames und colModel sind unterschiedlich lang!" }, formatter : { integer : {thousandsSeparator: " ", defaultValue: '0'}, number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'}, currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" €", defaultValue: '0,00'}, date : { dayNames: [ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ], AmPm : ["am","pm","AM","PM"], S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'}, srcformat: 'Y-m-d', newformat: 'd.m.Y', masks : { ISO8601Long:"Y-m-d H:i:s", ISO8601Short:"Y-m-d", ShortDate: "j.n.Y", LongDate: "l, d. F Y", FullDateTime: "l, d. F Y G:i:s", MonthDay: "d. F", ShortTime: "G:i", LongTime: "G:i:s", SortableDateTime: "Y-m-d\\TH:i:s", UniversalSortableDateTime: "Y-m-d H:i:sO", YearMonth: "F Y" }, reformatAfterEdit : false }, baseLinkUrl: '', showAction: '', target: '', checkbox : {disabled:true}, idName : 'id' } }; })(jQuery);
JavaScript
0.999996
@@ -1410,13 +1410,14 @@ ine -valid +g%C3%BCltig e E- @@ -1568,17 +1568,17 @@ URL. Pr -e +%C3%A4 fix muss @@ -2168,17 +2168,16 @@ gew%C3%A4hlte -n Zeile e @@ -2222,17 +2222,16 @@ e: %22Neue -n Zeile e @@ -2358,12 +2358,12 @@ atz -find +such en%22, @@ -2588,23 +2588,14 @@ en a -nzeigen/verberg +usw%C3%A4hl en%22, @@ -2876,17 +2876,17 @@ rator: %22 - +. %22, defau
8e024c2a2eeef6f1163e83affbac48be463488a4
Add Sinon to require-test-config
js/require-test-config.js
js/require-test-config.js
require.config({ paths: { //Test 'jasmine': 'lib/jasmine-1.3.1/jasmine', 'jasmine-html': 'lib/jasmine-1.3.1/jasmine-html' }, shim: { 'jasmine-html': { deps: ['jasmine'] }, 'jasmine': { exports: 'jasmine' } } });
JavaScript
0
@@ -122,16 +122,52 @@ ne-html' +,%0A%09%09'sinon': 'lib/sinon/sinon-1.6.0' %0A%09%7D,%0A%0A%09s @@ -256,16 +256,54 @@ asmine'%0A +%09%09%7D,%0A%09%09'sinon': %7B%0A%09%09%09exports: 'sinon'%0A %09%09%7D%0A%09%7D%0A%7D
b90a4d892377f6468d1c50464902e1f4b5d16066
make the hold condition clearer.
js/rpg_core/ImageCache.js
js/rpg_core/ImageCache.js
function ImageCache(){ this.initialize.apply(this, arguments); } ImageCache.limit = 20 * 1000 * 1000; ImageCache.prototype.initialize = function(){ this._items = {}; }; ImageCache.prototype.add = function(key, value){ this._items[key] = { bitmap: value, touch: Date.now(), key: key }; this._truncateCache(); }; ImageCache.prototype.get = function(key){ if(this._items[key]){ var item = this._items[key]; item.touch = Date.now(); return item.bitmap; } return null; }; ImageCache.prototype.reserve = function(key, reservationId){ this._items[key].reservationId = reservationId; }; ImageCache.prototype.releaseReservation = function(reservationId){ var items = this._items; Object.keys(items) .map(function(key){return items[key];}) .forEach(function(item){ if(item.reservationId === reservationId){ delete item.reservationId; } }); }; ImageCache.prototype._truncateCache = function(){ var items = this._items; var sizeLeft = ImageCache.limit; Object.keys(items).map(function(key){ return items[key]; }).sort(function(a, b){ return b.touch - a.touch; }).forEach(function(item){ if(!item.bitmap.isRequestOnly() && (sizeLeft > 0 || item.reservationId || !item.bitmap.isReady())){ var bitmap = item.bitmap; sizeLeft -= bitmap.width * bitmap.height; }else{ delete items[item.key]; } }); }; ImageCache.prototype.isReady = function(){ var items = this._items; return !Object.keys(items).some(function(key){ return !items[key].bitmap.isRequestOnly() && !items[key].bitmap.isReady(); }); }; ImageCache.prototype.getErrorBitmap = function(){ var items = this._items; var bitmap = null; if(!Object.keys(items).some(function(key){ if(items[key].bitmap.isError()){ bitmap = items[key].bitmap; return true; } return false; })) { return bitmap; } return null; };
JavaScript
0
@@ -1286,101 +1286,45 @@ if( -!item.bitmap.isRequestOnly() && (sizeLeft %3E 0 %7C%7C item.reservationId %7C%7C !item.bitmap.isReady() +sizeLeft %3E 0 %7C%7C this._mustBeHeld(item ))%7B%0A @@ -1472,24 +1472,24 @@ ;%0A %7D%0A - %7D);%0A%7D;%0A%0A @@ -1480,32 +1480,423 @@ %7D%0A %7D);%0A%7D;%0A%0A +ImageCache.prototype._mustBeHeld = function(item)%7B%0A // request only is weak so It's purgeable%0A if(item.bitmap.isRequestOnly()) return false;%0A // reserved item must be held%0A if(item.reservationId) return true;%0A // not ready bitmap must be held (because of checking isReady())%0A if(!item.bitmap.isReady()) return true;%0A // then the item may purgeable%0A return false;%0A%7D;%0A%0A ImageCache.proto
f645f73993b8f788a22e884ae833e986a4e085db
make dialog (attachment, file exists) translatable (#1079)
js/service/FileService.js
js/service/FileService.js
/* * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net> * * @author Julius Härtl <jus@bitgrid.net> * * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ import app from '../app/App.js'; /* global OC oc_requesttoken */ export default class FileService { constructor (FileUploader, CardService, $rootScope, $filter) { this.$filter = $filter; this.uploader = new FileUploader(); this.cardservice = CardService; this.uploader.onAfterAddingFile = this.onAfterAddingFile.bind(this); this.uploader.onSuccessItem = this.onSuccessItem.bind(this); this.uploader.onErrorItem = this.onErrorItem.bind(this); this.uploader.onCancelItem = this.onCancelItem.bind(this); this.maxUploadSize = $rootScope.config.maxUploadSize; this.progress = []; this.status = null; } reset () { this.status = null; } runUpload (fileItem, attachmentId) { this.status = null; fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment?type=deck_file'); if (typeof attachmentId !== 'undefined') { fileItem.url = OC.generateUrl('/apps/deck/cards/' + fileItem.cardId + '/attachment/' + attachmentId + '?type=deck_file'); } else { fileItem.formData = [ { requesttoken: oc_requesttoken, type: 'deck_file', } ]; } fileItem.headers = {requesttoken: oc_requesttoken}; this.uploader.uploadItem(fileItem); } onAfterAddingFile (fileItem) { if (this.maxUploadSize > 0 && fileItem.file.size > this.maxUploadSize) { this.status = { error: t('deck', `Failed to upload {name}`, {name: fileItem.file.name}), message: t('deck', 'Maximum file size of {size} exceeded', {size: this.$filter('bytes')(this.maxUploadSize)}) }; return; } // Fetch card details before trying to upload so we can detect filename collisions properly let self = this; this.progress.push(fileItem); this.cardservice.fetchOne(fileItem.cardId).then(function (data) { let attachments = self.cardservice.get(fileItem.cardId).attachments; let existingFile = attachments.find((attachment) => { return attachment.data === fileItem.file.name; }); if (typeof existingFile !== 'undefined') { OC.dialogs.confirm( `A file with the name ${fileItem.file.name} already exists. Do you want to overwrite it?`, 'File already exists', function (result) { if (result) { self.runUpload(fileItem, existingFile.id); } else { let fileName = existingFile.extendedData.info.filename; let foundFilesMatching = attachments.filter((attachment) => { return attachment.extendedData.info.extension === existingFile.extendedData.info.extension && attachment.extendedData.info.filename.startsWith(fileName); }); let nextIndex = foundFilesMatching.length + 1; fileItem.file.name = fileName + ' (' + nextIndex + ').' + existingFile.extendedData.info.extension; self.runUpload(fileItem); } } ); } else { self.runUpload(fileItem); } }, function (error) { this.progress = this.progress.filter((item) => (fileItem.file.name !== item.file.name)); }); } onSuccessItem (item, response) { let attachments = this.cardservice.get(item.cardId).attachments; let index = attachments.indexOf(attachments.find((attachment) => attachment.id === response.id)); if (~index) { attachments = attachments.splice(index, 1); } this.cardservice.get(item.cardId).attachments.push(response); this.progress = this.progress.filter((fileItem) => (fileItem.file.name !== item.file.name)); } onErrorItem (item, response) { this.progress = this.progress.filter((fileItem) => (fileItem.file.name !== item.file.name)); this.status = { error: t('deck', `Failed to upload:`) + ' ' + item.file.name, message: response.message }; } onCancelItem (item) { this.progress = this.progress.filter((fileItem) => (fileItem.file.name !== item.file.name)); } getProgressItemsForCard (cardId) { return this.progress.filter((fileItem) => (fileItem.cardId === cardId)); } } app.service('FileService', FileService);
JavaScript
0
@@ -2861,16 +2861,26 @@ m(%0A%09%09%09%09%09 +t('deck', %60A file @@ -2960,23 +2960,34 @@ ite it?%60 +) ,%0A%09%09%09%09%09 +t('deck', 'File al @@ -2999,16 +2999,17 @@ exists' +) ,%0A%09%09%09%09%09f
7a361f1b6c500bdaa7927a2f6b0b8113ca16b0a4
Change spatial rel
js/tasks/LayerInfoTask.js
js/tasks/LayerInfoTask.js
/*global pulse, app, jQuery, require, document, esri, esriuk, Handlebars, console, $, mynearest, window, alert, unescape, define */ /* | Copyright 2015 ESRI (UK) Limited | | 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. */ /** * Execute the Query Task to a Layer */ define(["dojo/Deferred", "esri/layers/FeatureLayer", "esri/renderers/jsonUtils", "esri/tasks/query", "esri/tasks/QueryTask", "esri/geometry/Circle", "esri/units"], function (Deferred, FeatureLayer, jsonUtils, Query, QueryTask, Circle, Units) { var taskOutput = function LayerInfoTask(props) { this.properties = props; this.getLayerInfo = function () { var _this = this, result = new Deferred(), featureLayer; // Need to also get the symbology for each layer featureLayer = new FeatureLayer(_this.properties.serviceUrl); featureLayer.on("error", function (err) { result.resolve({ id: _this.properties.layerId, layerInfo: null, results:null, error: err, itemId: _this.properties.itemId }); }); featureLayer.on("load", function (data) { var layerInf = { renderer: null, id: _this.properties.layerId, itemId: _this.properties.itemId, opacity: _this.properties.layerOpacity }; if (props.layerRenderer !== undefined && props.layerRenderer !== null) { layerInf.renderer = jsonUtils.fromJson(props.layerRenderer); } else { layerInf.renderer = data.layer.renderer; } _this.queryLayer(data.layer.maxRecordCount).then(function (res) { result.resolve({ id: _this.properties.layerId, layerInfo: layerInf, results: res.results, error: null, itemId: _this.properties.itemId, url: _this.properties.serviceUrl }); }); }); return result.promise; }; this.getUnits = function (distanceUnits) { switch (distanceUnits) { case "m": return Units.MILES; case "km": return Units.KILOMETERS case "me": return Units.METERS default: return Units.MILES; } }; this.queryLayer = function (maxRecords) { var _this = this, result = new Deferred(), query, queryTask; // Use the current location and buffer the point to create a search radius query = new Query(); queryTask = new QueryTask(_this.properties.serviceUrl); query.where = "1=1"; // Get everything query.geometry = new Circle({ center: [_this.properties.currentPoint.x, _this.properties.currentPoint.y], radius: _this.properties.searchRadius, radiusUnit: _this.getUnits(_this.properties.distanceUnits), geodesic: _this.properties.currentPoint.spatialReference.isWebMercator() }); query.outFields = ["*"]; query.returnGeometry = true; query.outSpatialReference = _this.properties.currentPoint.spatialReference; query.num = maxRecords || 1000; query.spatialRelationship = Query.SPATIAL_REL_CONTAINS; queryTask.execute(query, function (features) { result.resolve({ error: null, id: _this.properties.layerId, results: features, itemId: _this.properties.itemId}); }, function (error) { result.resolve({ error: error, id: _this.properties.layerId, results: null, itemId: _this.properties.itemId }); }); return result.promise; }; this.execute = function () { return this.getLayerInfo(); }; }; return taskOutput; });
JavaScript
0
@@ -3764,24 +3764,26 @@ %0A +// query.spati
0c2b7483660c4debe997680b4917835159979b43
Update eval.js
commands/eval.js
commands/eval.js
const Discord = require('discord.js'); const config = require("./config.json"); exports.run = async (bot, message) => { var embed = new Discord.RichEmbed() .setTitle("Restricted") .setColor("#f45f42") .addField("You are restricted from this command", "Its for the bot owner only!") const randomColor = "#000000".replace(/0/g, function () { return (~~(Math.random() * 16)).toString(16); }); const clean = text => { if (typeof(text) === "string") return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203)); else return text; } const args = message.content.split(" ").slice(1); if (!args) return message.reply("Put what args you want") try { if(message.author.id !== config.ownerID) return message.channel.send({ embed: embed }); const code = args.join(" "); let evaled = eval(code); if (typeof evaled !== "string") evaled = require("util").inspect(evaled); var embed2 = new Discord.RichEmbed() .setTitle("Evaled:", false) .setColor(randomColor) .addField("Evaled: :inbox_tray:", `\`\`\`js\n${args}\n\`\`\``) .addField("Output: :outbox_tray:", clean(evaled)) message.channel.send({ embed: embed2 }); } catch (err) { var embed3 = new Discord.RichEmbed() .setTitle("ERROR:") .setColor("#f44242") .addField("Evaled: :inbox_tray:", `\`\`\`js\n${args}\n\`\`\``) .addField("Output: :outbox_tray:", `\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``) message.channel.send({ embed: embed3 }); }};
JavaScript
0.000001
@@ -1130,36 +1130,36 @@ , %60%5C%60%5C%60%5C%60js%5Cn$%7B -args +code %7D%5Cn%5C%60%5C%60%5C%60%60)%0A
dd7ef38e9266bca790b0603a02f8215d43d4d849
Fix error in statistics output
src/Sannis-node-mysql-libmysqlclient.js
src/Sannis-node-mysql-libmysqlclient.js
/* Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com> See license text in LICENSE file */ // Load configuration var cfg = require("./config").cfg; // Require modules var assert = require("assert"), sys = require("sys"), mysql = require("../deps/Sannis-node-mysql-libmysqlclient/mysql-libmysqlclient"), conn = mysql.createConnection(), global_start_time, global_total_time; function selectSyncBenchmark(callback) { var start_time, total_time, factor = cfg.do_not_run_sync_if_async_exists ? 1 : 2; start_time = new Date(); var res = conn.query("SELECT * FROM " + cfg.test_table + ";"); var rows = res.fetchAll(); total_time = ((new Date()) - start_time) / 1000; sys.puts("**** " + (factor * cfg.insert_rows_count) + " rows sync selected in " + total_time + "s (" + Math.round(cfg.insert_rows_count / total_time) + "/s)"); // Some tests if (rows.length !== factor * cfg.insert_rows_count) { sys.puts("\033[31m**** " + (factor * cfg.insert_rows_count) + " rows inserted" + ", but only " + rows.length + " rows selected\033[39m"); } assert.deepEqual(rows[0], cfg.selected_row_example); // Finish benchmark global_total_time = ((new Date()) - global_start_time - cfg.delay_before_select) / 1000; sys.puts("** Total time is " + global_total_time + "s"); conn.close(); callback.apply(); } function insertAsyncBenchmark(callback) { var start_time, total_time, i = 0; start_time = new Date(); function insertAsync() { i += 1; if (i <= cfg.insert_rows_count) { conn.queryAsync(cfg.insert_query, function (res) { insertAsync(); }); } else { total_time = ((new Date()) - start_time) / 1000; sys.puts("**** " + cfg.insert_rows_count + " async insertions in " + total_time + "s (" + Math.round(cfg.insert_rows_count / total_time) + "/s)"); setTimeout(function () { selectSyncBenchmark(callback); }, cfg.delay_before_select); } } insertAsync(); } function insertSyncBenchmark(callback) { var start_time, total_time, i = 0, res; start_time = new Date(); for (i = 0; i < cfg.insert_rows_count; i += 1) { res = conn.query(cfg.insert_query); } total_time = ((new Date()) - start_time) / 1000; sys.puts("**** " + cfg.insert_rows_count + " sync insertions in " + total_time + "s (" + Math.round(cfg.insert_rows_count / total_time) + "/s)"); insertAsyncBenchmark(callback); } function reconnectSyncBenchmark(callback) { var start_time, total_time, i = 0; start_time = new Date(); for (i = 0; i < cfg.reconnect_count; i += 1) { conn.close(); conn.connect(cfg.host, cfg.user, cfg.password, cfg.database); } total_time = ((new Date()) - start_time) / 1000; sys.puts("**** " + cfg.reconnect_count + " sync reconnects in " + total_time + "s (" + Math.round(cfg.reconnect_count / total_time) + "/s)"); if (cfg.do_not_run_sync_if_async_exists) { insertAsyncBenchmark(callback); } else { insertSyncBenchmark(callback); } } function escapeBenchmark(callback) { var start_time, total_time, i = 0, escaped_string; start_time = new Date(); for (i = 0; i < cfg.escape_count; i += 1) { escaped_string = conn.escape(cfg.string_to_escape); } total_time = ((new Date()) - start_time) / 1000; sys.puts("**** " + cfg.escape_count + " escapes in " + total_time + "s (" + Math.round(cfg.escape_count / total_time) + "/s)"); reconnectSyncBenchmark(callback); } function startBenchmark(callback) { var start_time, total_time, res; start_time = new Date(); conn.connect(cfg.host, cfg.user, cfg.password, cfg.database); if (!conn.connected()) { sys.puts("\033[31m** Connection error: " + conn.connectErrno() + ", " + conn.connectError() + "\033[39m"); // Finish benchmark global_total_time = ((new Date()) - global_start_time - cfg.delay_before_select) / 1000; sys.puts("\033[31m** Total time is " + global_total_time + "s\033[39m"); callback.apply(); return; } res = conn.query("DROP TABLE IF EXISTS " + cfg.test_table + ";"); res = conn.query("SET max_heap_table_size=128M;"); res = conn.query(cfg.create_table_query); total_time = ((new Date()) - start_time) / 1000; sys.puts("**** Benchmark initialization time is " + total_time + "s"); escapeBenchmark(callback); } exports.run = function (callback) { global_start_time = new Date(); startBenchmark(callback); };
JavaScript
0.000864
@@ -808,32 +808,41 @@ (%22 + Math.round( +factor * cfg.insert_rows_
117eae90552876726cb9bf5c9213bc544ae8b4ba
make evaling less annoying
commands/eval.js
commands/eval.js
const clean = (text) => { if (typeof (text) === 'string') { return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203)); } else { return text; } } module.exports = (message) => { let params = message.content.split(' ').splice(1) if (message.member.id == '102645408223731712') { try { var code = params.join(" ") var evaled = eval(code) if (typeof evaled !== "string") evaled = require("util").inspect(evaled) message.channel.sendCode("xl", clean(evaled)) } catch (err) { message.channel.sendMessage(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``) } } }
JavaScript
0.00005
@@ -234,16 +234,46 @@ e) =%3E %7B%0A + let client = message.client%0A let pa
5400972275f7871c3643329a3c2212f71e5d6f60
remove unused variables
test/source/from-test.js
test/source/from-test.js
require('buster').spec.expose(); var expect = require('buster').expect; var from = require('../../lib/source/from').from; var observe = require('../../lib/combinator/observe').observe; var sentinel = { value: 'sentinel' }; var other = { value: 'other' }; describe('from', function() { it('should support array-like items', function() { function observeArguments(){ var result = []; return observe(function(x) { result.push(x); }, from(arguments)).then(function() { expect(result).toEqual([1,2,3]); }); } return observeArguments(1,2,3); }); });
JavaScript
0.000014
@@ -184,80 +184,8 @@ e;%0A%0A -var sentinel = %7B value: 'sentinel' %7D;%0Avar other = %7B value: 'other' %7D;%0A%0A%0A desc
0b7fef7c3be1ff59aac49b91971ec6baef78b897
add support for displaying prefix (#144)
commands/info.js
commands/info.js
'use strict' const co = require('co') const cli = require('heroku-cli-util') const humanize = require('humanize-plus') function configVarsFromName (attachments, name) { return attachments .filter((att) => att.addon.name === name) .map((att) => att.name + '_URL') .sort((name) => name !== 'KAFKA_URL') } function formatInfo (info) { const cluster = info.cluster const addon = info.addon let lines = [ { name: 'Plan', values: [addon.plan.name] }, { name: 'Status', values: [cluster.state.message] }, { name: 'Version', values: [cluster.version] }, { name: 'Created', values: [cluster.created_at] } ] if (cluster.robot.is_robot) { lines.push({ name: 'Robot', values: ['True'] }) lines.push({ name: 'Robot TTL', values: [cluster.robot.robot_ttl] }) } // we hide __consumer_offsets in topic listing; don't count it const topicCount = cluster.topics.filter((topic) => topic !== '__consumer_offsets').length lines.push({ name: 'Topics', values: [`${topicCount} ${humanize.pluralize(topicCount, 'topic')}, see heroku kafka:topics`] }) lines.push({ name: 'Messages', values: [`${humanize.intComma(cluster.messages_in_per_sec)} ${humanize.pluralize(cluster.messages_in_per_sec, 'message')}/s`] }) lines.push({ name: 'Traffic', values: [`${humanize.fileSize(cluster.bytes_in_per_sec)}/s in / ${humanize.fileSize(cluster.bytes_out_per_sec)}/s out`] }) if (cluster.data_size !== undefined && cluster.limits.data_size.limit_bytes !== undefined) { let size = cluster.data_size let limit = cluster.limits.data_size.limit_bytes let percentage = ((size / limit) * 100.0).toFixed(2) lines.push({ name: 'Data Size', values: [`${humanize.fileSize(size)} / ${humanize.fileSize(limit)} (${percentage}%)`] }) } lines.push({name: 'Add-on', values: [cli.color.addon(addon.name)]}) return lines } function displayCluster (cluster) { cli.styledHeader(cluster.configVars.map(c => cli.color.configVar(c)).join(', ')) let clusterInfo = formatInfo(cluster) let info = clusterInfo.reduce((info, i) => { if (i.values.length > 0) { info[i.name] = i.values.join(', ') } return info }, {}) let keys = clusterInfo.map(i => i.name) cli.styledObject(info, keys) cli.log() } function * run (context, heroku) { const sortBy = require('lodash.sortby') const host = require('../lib/host') const fetcher = require('../lib/fetcher')(heroku) const app = context.app const cluster = context.args.CLUSTER let addons = [] let attachments = heroku.get(`/apps/${app}/addon-attachments`) if (cluster) { addons = yield [fetcher.addon(app, cluster)] } else { addons = yield fetcher.all(app) if (addons.length === 0) { cli.log(`${cli.color.app(app)} has no heroku-kafka clusters.`) return } } let clusters = yield addons.map(addon => { return { addon, attachments, cluster: heroku.request({ host: host(addon), method: 'get', path: `/data/kafka/v0/clusters/${addon.id}` }).catch(err => { if (err.statusCode !== 404) throw err cli.warn(`${cli.color.addon(addon.name)} is not yet provisioned.\nRun ${cli.color.cmd('heroku kafka:wait')} to wait until the cluster is provisioned.`) }) } }) clusters = clusters.filter(cluster => cluster.cluster) clusters.forEach(cluster => { cluster.configVars = configVarsFromName(cluster.attachments, cluster.addon.name) }) clusters = sortBy(clusters, cluster => cluster.configVars[0] !== 'KAFKA_URL', 'configVars[0]') clusters.forEach(displayCluster) } let cmd = { topic: 'kafka', description: 'display cluster information', needsApp: true, needsAuth: true, args: [{name: 'CLUSTER', optional: true}], run: cli.command({preauth: true}, co.wrap(run)) } exports.displayCluster = displayCluster exports.root = cmd exports.info = Object.assign({}, cmd, {command: 'info'})
JavaScript
0
@@ -1085,32 +1085,134 @@ :topics%60%5D%0A %7D)%0A%0A + if (cluster.topic_prefix) %7B%0A lines.push(%7B name: 'Prefix', values: %5Bcluster.topic_prefix%5D %7D)%0A %7D%0A%0A lines.push(%7B%0A
598a25c9c8472888c9abf1db9419c25d638c7b96
Update version string to 2.5.1-pre.7
version.js
version.js
if (enyo && enyo.version) { enyo.version["enyo-ilib"] = "2.5.1-pre.6"; }
JavaScript
0.000001
@@ -65,9 +65,9 @@ pre. -6 +7 %22;%0A%7D
f6d01a768c7d8dc0fae7635b7ce1a3fe683cd3b6
refactor module.exports
react-app/src/storage.js
react-app/src/storage.js
var client = new Dropbox.Client({ key: "" }); var exec = function(f) { if (client.isAuthenticated()) { f(); } else { client.authenticate(function(error, data) { if (error) { console.log(error); } else { f(); } }); } }; exports.userInfo = function(callback) { exec(function() { client.getAccountInfo(function(error, accountInfo) { if (error) { console.log(error); } else { callback({ name: accountInfo.name }); } }); }); }; var readdir = function(dirpath, callback) { exec(function() { client.readdir(dirpath, function(error, entries) { if (error) { console.log(error); } else { var ds = entries.filter(function(entry) { return !entry.startsWith('__'); }).map(function(entry) { var d = new $.Deferred; client.stat(dirpath + '/' + entry, function(error, stat) { d.resolve(stat); }); return d.promise(); }); $.when.apply(null, ds).done(function() { var stats = Array.prototype.slice.apply(arguments).map(function(s) { return { name: s.name, path: s.path, isFolder: s.isFolder, children: [] }; }); callback(stats); }); } }); }); }; exports.rootFiles = function(callback) { readdir('/', callback); }; exports.readdir = function(dirpath, callback) { readdir(dirpath, callback); }; exports.readEntry = function(path, callback) { exec(function() { client.stat(path, function(error, stat) { callback({ name: stat.name == '' ? '/' : stat.name, path: stat.path == '' ? '/' : stat.path, isFolder: stat.isFolder, children: [] }); }); }); }; exports.readfile = function(filepath, callback) { exec(function() { client.readFile(filepath, function(error, data) { if (error) { console.log(error); } else { callback(data); } }); }); }; exports.writefile = function(filepath, content, callback) { exec(function() { client.writeFile(filepath, content, function(error, stat) { if (error) { console.log(error); } else { callback({ name: stat.name, path: stat.path, isFolder: stat.isFolder, children: [] }); } }); }); }; exports.writeimage = function(imageFile, callback) { exec(function() { client.stat('/__images', function(error, stat) { if (error) { console.log(error); } else if (stat.isFile && !stat.isRemoved) { console.log(stat); console.log("ERROR!"); } else { var newImagePath = '/__images/' + imageFile.name; client.writeFile(newImagePath, imageFile, function(error, createdFile) { if (error) { console.log(error); } else { client.makeUrl(createdFile.path, {long: true}, function(error, data) { callback(data.url.replace("www.dropbox", "dl.dropboxusercontent")); }); } }); } }); }); }; exports.makedir = function(path, callback) { exec(function() { client.mkdir(path, function(error, data) { if (error) { console.log(error); } callback(); }); }); };
JavaScript
0.000002
@@ -1,12 +1,216 @@ +module.exports = %7B%0A userInfo: userInfo,%0A rootFiles: rootFiles,%0A readdir: readdir,%0A readEntry: readEntry,%0A readfile: readfile,%0A writefile: writefile,%0A writeimage: writeimage,%0A makedir: makedir%0A%7D;%0A%0A var client = @@ -248,27 +248,16 @@ );%0A%0A -var exec = function (f) @@ -252,16 +252,21 @@ function + exec (f) %7B%0A @@ -468,35 +468,25 @@ %7D;%0A%0A -exports.userInfo = function +function userInfo (cal @@ -1584,36 +1584,26 @@ %7D;%0A%0A -exports.rootFiles = function +function rootFiles (cal @@ -1645,34 +1645,16 @@ %7D;%0A%0A -exports.readdir = function (dir @@ -1641,32 +1641,40 @@ k);%0A%7D;%0A%0Afunction + readdir (dirpath, callba @@ -1717,36 +1717,26 @@ %7D;%0A%0A -exports.readEntry = function +function readEntry (pat @@ -2017,35 +2017,25 @@ %7D;%0A%0A -exports.readfile = function +function readfile (fil @@ -2243,36 +2243,26 @@ %7D;%0A%0A -exports.writefile = function +function writefile (fil @@ -2604,24 +2604,25 @@ %7D);%0A%7D;%0A%0A -exports. +function writeima @@ -2623,27 +2623,16 @@ iteimage - = function (imageFi @@ -3339,34 +3339,16 @@ %7D;%0A%0A -exports.makedir = function (pat @@ -3343,16 +3343,24 @@ function + makedir (path, c
76e43c94b1c3df7661eceddb08617fac10950740
bump version (#2690)
version.js
version.js
module.exports = '2019-06-22';
JavaScript
0
@@ -21,11 +21,11 @@ 19-0 -6-22 +7-21 ';%0A
5285fb5b2f44977cbb58d32aa573c0499215fbab
Support for Higher-Order Ambisonics (HOA). Rotation, convolution and rendering classes, w/ example.
test/test-hoa-rotator.js
test/test-hoa-rotator.js
/** * Copyright 2017 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. */ /** * Test HOARotator object. * * Shoot an encoded impulse into the rotator to generate a multichannel buffer. * Then compare it with the JS-calculated result. Thresholding the comparison is * necessary because of truncation error. */ describe('HOARotator', function () { // This test is async, override timeout threshold to 5 sec. this.timeout(5000); // Threshold for sample comparison. var THRESHOLD = 2.9802322387695312e-8; var sampleRate = 48000; var renderLength = 256; var ambisonicOrder = 3; // Values are computed using ambix SN3D-normalization spherical harmonics. // [1] C. Nachbar, F. Zotter, E. Deleflie and A. Sontacchi. "Ambix - A // Suggested Ambisonics Format," Ambisonics Symposium 2011. Lexington, US. var sphericalHarmonics_A0_E0_3oa = [1, 0, 0, 1, 0, 0, -0.5, 0, 0.866025403784439, 0, 0, 0, 0, -0.612372435695794, 0, 0.790569415042095]; var sphericalHarmonics_A45_E45_3oa = [1, 0.5, 0.707106781186547, 0.5, 0.433012701892219, 0.612372435695794, 0.25, 0.612372435695795, 0, 0.197642353760524, 0.684653196881458, 0.459279326771846, -0.176776695296637, 0.459279326771846, 0, -0.197642353760524]; var transformMatrix = [0.707106781186548, 0, -0.707106781186547, -0.5, 0.707106781186548, -0.5, 0.5, 0.707106781186547, 0.5]; var context; var hoaConstantBuffer; /** * Calculate the expected binaural rendering (based on SH-maxRE algorithm) * result from the impulse input and generate an AudioBus instance. * @param {AudioBuffer} buffer FOA SH-maxRE HRIR buffer. * @return {AudioBus} */ function generateExpectedBusFromSphericalHarmonicsVector() { // We need to determine the number of channels K based on the ambisonic // order N where K = (N + 1)^2 var numberOfChannels = (ambisonicOrder + 1) * (ambisonicOrder + 1); var generatedBus = new AudioBus(numberOfChannels, renderLength, sampleRate); // Assign all values in each channel to a spherical harmonic coefficient. for (var i = 0; i < numberOfChannels; i++) { var data = generatedBus.getChannelData(i); for (var j = 0; j < data.length; j++) { data[j] = sphericalHarmonics_A45_E45_3oa[i]; } } return generatedBus; } beforeEach(function () { context = new OfflineAudioContext(16, renderLength, sampleRate); hoaConstantBuffer = createConstantBuffer(context, sphericalHarmonics_A0_E0_3oa, renderLength); }); it('inject impulse buffer and verify convolution result.', function (done) { var constantSource = context.createBufferSource(); var hoaRotator = Omnitone.createHOARotator(context, ambisonicOrder); constantSource.buffer = hoaConstantBuffer; hoaRotator.setRotationMatrix(transformMatrix); constantSource.connect(hoaRotator.input); hoaRotator.output.connect(context.destination); constantSource.start(); context.startRendering().then(function (renderedBuffer) { var actualBus = new AudioBus(hoaConstantBuffer.numOfChannels, renderLength, sampleRate); actualBus.copyFromAudioBuffer(renderedBuffer); var expectedBus = generateExpectedBusFromSphericalHarmonicsVector(); expect(actualBus.compareWith(expectedBus, THRESHOLD)).to.equal(true); done(); }); } ); });
JavaScript
0
@@ -2866,24 +2866,96 @@ nction () %7B%0A + var numberOfChannels = (ambisonicOrder + 1) * (ambisonicOrder + 1);%0A context @@ -2955,16 +2955,22 @@ ontext = +%0A new Off @@ -2990,10 +2990,24 @@ ext( -16 +numberOfChannels , re
8611042bc961ff62d39ffff0e248b9e85af93f4a
update basic package-file testing
test/testPackageFiles.js
test/testPackageFiles.js
/* jshint -W097 */// jshint strict:false /*jslint node: true */ var expect = require('chai').expect; var fs = require('fs'); describe('Test package.json and io-package.json', function() { it('Test package files', function (done) { var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json'); var ioPackage = JSON.parse(fileContentIOPackage); var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json'); var npmPackage = JSON.parse(fileContentNPMPackage); expect(ioPackage).to.be.an('object'); expect(npmPackage).to.be.an('object'); expect(ioPackage.common.version).to.exist; expect(npmPackage.version).to.exist; if (!expect(ioPackage.common.version).to.be.equal(npmPackage.version)) { console.log('ERROR: Version numbers in package.json and io-package.json differ!!'); } if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) { console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!'); } done(); }); });
JavaScript
0
@@ -11,18 +11,19 @@ -W097 */ -// +%0A/* jshint @@ -34,19 +34,23 @@ ct:false + */ %0A/* + jslint n @@ -62,16 +62,40 @@ true */%0A +/* jshint expr: true */%0A var expe @@ -1158,32 +1158,738 @@ !');%0A %7D%0A%0A + expect(ioPackage.common.authors).to.exist;%0A if (ioPackage.common.name.indexOf('template') !== 0) %7B%0A if (Array.isArray(ioPackage.common.authors)) %7B%0A expect(ioPackage.common.authors.length).to.not.be.equal(0);%0A if (ioPackage.common.authors.length === 1) %7B%0A expect(ioPackage.common.authors%5B0%5D).to.not.be.equal('my Name %3Cmy@email.com%3E');%0A %7D%0A %7D%0A else %7B%0A expect(ioPackage.common.authors).to.not.be.equal('my Name %3Cmy@email.com%3E');%0A %7D%0A %7D%0A else %7B%0A console.log('Testing for set authors field in io-package skipped because template adapter');%0A %7D%0A done();%0A
6c4896512d165b3650f508e0eba84d6a0b9f7fcb
update basic package-file testing
test/testPackageFiles.js
test/testPackageFiles.js
/* jshint -W097 */ /* jshint strict:false */ /* jslint node: true */ /* jshint expr: true */ var expect = require('chai').expect; var fs = require('fs'); describe('Test package.json and io-package.json', function() { it('Test package files', function (done) { console.log(); var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json', 'utf8'); var ioPackage = JSON.parse(fileContentIOPackage); var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json', 'utf8'); var npmPackage = JSON.parse(fileContentNPMPackage); expect(ioPackage).to.be.an('object'); expect(npmPackage).to.be.an('object'); expect(ioPackage.common.version, 'ERROR: Version number in io-package.json needs to exist').to.exist; expect(npmPackage.version, 'ERROR: Version number in package.json needs to exist').to.exist; expect(ioPackage.common.version, 'ERROR: Version numbers in package.json and io-package.json needs to match').to.be.equal(npmPackage.version); if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) { console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!'); console.log(); } expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist; expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist; if (ioPackage.common.name.indexOf('template') !== 0) { if (Array.isArray(ioPackage.common.authors)) { expect(ioPackage.common.authors.length, 'ERROR: Author in io-package.json needs to be set').to.not.be.equal(0); if (ioPackage.common.authors.length === 1) { expect(ioPackage.common.authors[0], 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>'); } } else { expect(ioPackage.common.authors, 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>'); } } else { console.log('WARNING: Testing for set authors field in io-package skipped because template adapter'); console.log(); } expect(fs.existsSync(__dirname + '/../README.md'), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true; if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') { console.log('WARNING: titleLang is not existing in io-package.json. Please add'); console.log(); } if ( ioPackage.common.title.indexOf('iobroker') !== -1 || ioPackage.common.title.indexOf('ioBroker') !== -1 || ioPackage.common.title.indexOf('adapter') !== -1 || ioPackage.common.title.indexOf('Adapter') !== -1 ) { console.log('WARNING: title contains Adapter or ioBroker. It is clear anyway, that it is adapter for ioBroker.'); console.log(); } if (ioPackage.common.name.indexOf('vis-') !== 0) { if (!ioPackage.common.materialize || !fs.existsSync(__dirname + '/../admin/index_m.html') || !fs.existsSync(__dirname + '/../gulpfile.js')) { console.log('WARNING: Admin3 support is missing! Please add it'); console.log(); } if (ioPackage.common.materialize) { expect(fs.existsSync(__dirname + '/../admin/index_m.html'), 'Admin3 support is enabled in io-package.json, but index_m.html is missing!').to.be.true; } } var licenseFileExists = fs.existsSync(__dirname + '/../LICENSE'); var fileContentReadme = fs.readFileSync(__dirname + '/../README.md', 'utf8'); if (fileContentReadme.indexOf('## Changelog') === -1) { console.log('Warning: The README.md should have a section ## Changelog'); console.log(); } expect((licenseFileExists || fileContentReadme.indexOf('## License') !== -1), 'A LICENSE must exist as LICENSE file or as part of the README.md').to.be.true; if (!licenseFileExists) { console.log('Warning: The License should also exist as LICENSE file'); console.log(); } if (fileContentReadme.indexOf('## License') === -1) { console.log('Warning: The README.md should also have a section ## License to be shown in Admin3'); console.log(); } done(); }); });
JavaScript
0
@@ -86,19 +86,36 @@ true */%0A -var +'use strict';%0A%0Aconst expect @@ -144,17 +144,16 @@ ct;%0A -var fs +const fs @@ -225,18 +225,13 @@ n', -function() +() =%3E %7B%0A @@ -262,23 +262,15 @@ s', -function ( done -) + =%3E %7B%0A @@ -292,35 +292,37 @@ log();%0A%0A -var +const fileContentIOPa @@ -397,19 +397,21 @@ -var +const ioPacka @@ -450,35 +450,37 @@ kage);%0A%0A -var +const fileContentNPMP @@ -553,19 +553,21 @@ -var +const npmPack @@ -1511,32 +1511,142 @@ st').to.exist;%0A%0A + expect(ioPackage.common.license, 'ERROR: License missing in io-package in common.license').to.exist;%0A%0A if (ioPa @@ -3363,32 +3363,33 @@ %7D%0A%0A if ( +! ioPackage.common @@ -3393,34 +3393,77 @@ mon. -name.indexOf('vis-') !== 0 +controller && !ioPackage.common.onlyWWW && !ioPackage.common.noConfig ) %7B%0A @@ -3990,19 +3990,21 @@ -var +const license @@ -4070,11 +4070,13 @@ -var +const fil
84216367a31ccf4c364dc3676b063ba7d6db5e82
add more tests for convertAASequence
src/__tests__/convertAASequence.test.js
src/__tests__/convertAASequence.test.js
const convertAASequence = require('../convertAASequence'); describe('Checking convert AA sequence', () => { test('AAAAAAA', () => { const result = convertAASequence('AAAAAAA'); expect(result).toEqual('HAlaAlaAlaAlaAlaAlaAlaOH'); }); test('HAlaAla(H-1OH)AlaOH', () => { const result = convertAASequence('HAlaAla(H-1OH)AlaOH'); expect(result).toEqual('HAlaAla(H-1OH)AlaOH'); }) test('(Me)AAAAAAA(NH2)', () => { const result = convertAASequence('(Me)AAAAAAA(NH2)'); expect(result).toEqual('(Me)AlaAlaAlaAlaAlaAlaAla(NH2)'); }); test('ALA SER LYS GLY PRO', () => { const result = convertAASequence('ALA SER LYS GLY PRO'); expect(result).toEqual('HAlaSerLysGlyProOH'); }); });
JavaScript
0
@@ -240,16 +240,18 @@ %0A %7D);%0A%0A + test('HA @@ -278,16 +278,18 @@ () =%3E %7B%0A + const @@ -339,16 +339,18 @@ laOH');%0A + expect @@ -390,18 +390,273 @@ laOH');%0A -%7D) + %7D);%0A test('(C33H37O6N3Si) GluTyrGluLys(C16H30O)GluTyrGluOH', () =%3E %7B%0A const result = convertAASequence(%0A '(C33H37O6N3Si) GluTyrGluLys(C16H30O)GluTyrGluOH'%0A );%0A expect(result).toEqual('(C33H37O6N3Si) GluTyrGluLys(C16H30O)GluTyrGluOH');%0A %7D); %0A%0A test @@ -803,32 +803,168 @@ (NH2)');%0A %7D);%0A%0A + test('HAlaGlyProOH', () =%3E %7B%0A const result = convertAASequence('HAlaGlyProOH');%0A expect(result).toEqual('HAlaGlyProOH');%0A %7D);%0A%0A test('ALA SER
19eaed5b44c04592c2407639991d256cb944f7fc
Correct a spelling mistake
example/test/list_component_test.js
example/test/list_component_test.js
var Assert = require("assert"); var ReactDOMServer = require("react-dom/server"); var XPathUtils = require("xpath-react/utils"); var React = require("react"); var Sinon = require("sinon"); var List = require("../lib/list_component"); function asserHasXPath (element, expression) { Assert.ok(XPathUtils.find(element, expression), "Expected element to have expression " + expression); } describe("ListComponent", function () { describe("when isLoading is true", function () { it("should render a loading text", function () { var rendering = ReactDOMServer.renderToString(<List isLoading={true} />); Assert.ok(rendering.includes("Loading items..")); }); }); describe("when isLoading is false", function () { it("should render the given items", function () { var items = ["foo", "bar"]; var element = XPathUtils.render(<List isLoading={false} items={items} />); asserHasXPath(element, ".//li[contains(., 'foo')]"); asserHasXPath(element, ".//li[contains(., 'bar')]"); }); it("should render a delete button for each item", function () { var items = ["foo", "bar"]; var element = XPathUtils.render(<List isLoading={false} items={items} />); asserHasXPath(element, ".//li[contains(., 'foo')]/button[contains(., 'Delete')]"); asserHasXPath(element, ".//li[contains(., 'bar')]/button[contains(., 'Delete')]"); }); it("should invoke a callback upon pressing a delete button", function () { var items = ["foo"]; var onRemove = Sinon.spy(); var element = XPathUtils.render(<List isLoading={false} items={items} onRemove={onRemove} />); XPathUtils.Simulate.click(element, ".//button[contains(., 'Delete')]"); Assert.ok(onRemove.called); }); it("should render the given form value", function () { var element = XPathUtils.render(<List isLoading={false} formValue="foo" />); var textarea = XPathUtils.find(element, ".//textarea"); Assert.equal(textarea.props.value, "foo"); }); it("should render an add item button", function () { var element = XPathUtils.render(<List isLoading={false} />); asserHasXPath(element, ".//button[contains(., 'Add')]"); }); it("should invoke a callback upon pressing the add button", function () { var onAdd = Sinon.spy(); var element = XPathUtils.render(<List isLoading={false} onAdd={onAdd} formValue="foo" />); XPathUtils.Simulate.click(element, ".//button[contains(., 'Add')]"); Assert.ok(onAdd.calledWith("foo")); }); }); });
JavaScript
0.999999
@@ -243,24 +243,25 @@ nction asser +t HasXPath (el @@ -281,16 +281,16 @@ sion) %7B%0A - Assert @@ -910,32 +910,33 @@ %3E);%0A%0A asser +t HasXPath(element @@ -970,32 +970,33 @@ %5D%22);%0A asser +t HasXPath(element @@ -1224,32 +1224,33 @@ %3E);%0A%0A asser +t HasXPath(element @@ -1314,32 +1314,33 @@ %5D%22);%0A asser +t HasXPath(element @@ -2157,32 +2157,32 @@ g=%7Bfalse%7D /%3E);%0A%0A - asserHasXP @@ -2176,16 +2176,17 @@ asser +t HasXPath
6e7c4596d307ee43967f1b046b9b6dd73a594ebc
update basic package-file testing
test/testPackageFiles.js
test/testPackageFiles.js
/* jshint -W097 */ /* jshint strict:false */ /* jslint node: true */ /* jshint expr: true */ var expect = require('chai').expect; var fs = require('fs'); describe('Test package.json and io-package.json', function() { it('Test package files', function (done) { console.log(); var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json', 'utf8'); var ioPackage = JSON.parse(fileContentIOPackage); var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json', 'utf8'); var npmPackage = JSON.parse(fileContentNPMPackage); expect(ioPackage).to.be.an('object'); expect(npmPackage).to.be.an('object'); expect(ioPackage.common.version, 'ERROR: Version number in io-package.json needs to exist').to.exist; expect(npmPackage.version, 'ERROR: Version number in package.json needs to exist').to.exist; expect(ioPackage.common.version, 'ERROR: Version numbers in package.json and io-package.json needs to match').to.be.equal(npmPackage.version); if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) { console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!'); console.log(); } expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist; expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist; if (ioPackage.common.name.indexOf('template') !== 0) { if (Array.isArray(ioPackage.common.authors)) { expect(ioPackage.common.authors.length, 'ERROR: Author in io-package.json needs to be set').to.not.be.equal(0); if (ioPackage.common.authors.length === 1) { expect(ioPackage.common.authors[0], 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>'); } } else { expect(ioPackage.common.authors, 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <my@email.com>'); } } else { console.log('WARNING: Testing for set authors field in io-package skipped because template adapter'); console.log(); } expect(fs.existsSync(__dirname + '/../README.md'), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true; expect(fs.existsSync(__dirname + '/../LICENSE'), 'ERROR: LICENSE needs to exist! Please create one.').to.be.true; if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') { console.log('WARNING: titleLang is not existing in io-package.json. Please add'); console.log(); } if ( ioPackage.common.title.indexOf('iobroker') !== -1 || ioPackage.common.title.indexOf('ioBroker') !== -1 || ioPackage.common.title.indexOf('adapter') !== -1 || ioPackage.common.title.indexOf('Adapter') !== -1 ) { console.log('WARNING: title contains Adapter or ioBroker. It is clear anyway, that it is adapter for ioBroker.'); console.log(); } if (ioPackage.common.name.indexOf('vis-') !== 0) { if (!ioPackage.common.materialize || !fs.existsSync(__dirname + '/../admin/index_m.html') || !fs.existsSync(__dirname + '/../gulpfile.js')) { console.log('WARNING: Admin3 support is missing! Please add it'); console.log(); } if (ioPackage.common.materialize) { expect(fs.existsSync(__dirname + '/../admin/index_m.html'), 'Admin3 support is enabled in io-package.json, but index_m.html is missing!').to.be.true; } } var licenseFileExists = fs.existsSync(__dirname + '/../LICENSE'); var fileContentReadme = fs.readFileSync(__dirname + '/../README.md', 'utf8'); if (fileContentReadme.indexOf('## Changelog') === -1) { console.log('Warning: The README.md should have a section ## Changelog'); console.log(); } expect((licenseFileExists || fileContentReadme.indexOf('## License') !== -1), 'A LICENSE must exist as LICENSE file or as part of the README.md').to.be.true; if (!licenseFileExists) { console.log('Warning: The License should also exist as LICENSE file'); console.log(); } if (fileContentReadme.indexOf('## License') === -1) { console.log('Warning: The README.md should also have a section ## License to be shown in Admin3'); console.log(); } done(); }); });
JavaScript
0
@@ -2574,130 +2574,8 @@ ue;%0A - expect(fs.existsSync(__dirname + '/../LICENSE'), 'ERROR: LICENSE needs to exist! Please create one.').to.be.true;%0A
e6567bc593b7c57a88542f137375621701579907
fix failing test: round to seconds (#1631)
examples/async/src/actions/index.js
examples/async/src/actions/index.js
export const REQUEST_POSTS = 'REQUEST_POSTS' export const RECEIVE_POSTS = 'RECEIVE_POSTS' export const SELECT_REDDIT = 'SELECT_REDDIT' export const INVALIDATE_REDDIT = 'INVALIDATE_REDDIT' export function selectReddit(reddit) { return { type: SELECT_REDDIT, reddit, } } export function invalidateReddit(reddit) { return { type: INVALIDATE_REDDIT, reddit, } } export function requestPosts(reddit) { return { type: REQUEST_POSTS, reddit, } } export function receivePosts(reddit, posts) { return { type: RECEIVE_POSTS, reddit, posts, receivedAt: Date.now(), } }
JavaScript
0.001585
@@ -597,17 +597,36 @@ At: -Date.now( +new Date().setMilliseconds(0 ),%0A
d05c2340b89a8312d33b07af6e688a186ee6cc2a
remove console log
gulp/tasks/browserify.js
gulp/tasks/browserify.js
/** * @author centsent */ import config from '../config'; import gulp from 'gulp'; import gulpif from 'gulp-if'; import gutil from 'gulp-util'; import source from 'vinyl-source-stream'; import sourcemaps from 'gulp-sourcemaps'; import buffer from 'vinyl-buffer'; import streamify from 'gulp-streamify'; import watchify from 'watchify'; import browserify from 'browserify'; import babelify from 'babelify'; import uglify from 'gulp-uglify'; import handleErrors from '../util/handleErrors'; import browserSync from 'browser-sync'; import ngAnnotate from 'browserify-ngannotate'; import stringify from 'stringify'; import eventStream from 'event-stream'; import fs from 'fs'; // Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/ function buildScript(entries, file) { let bundler = browserify({ entries: entries, debug: true, cache: {}, packageCache: {}, fullPaths: !global.isProd }); const transforms = [ stringify(['.html']), babelify.configure({ stage: 0 }), ngAnnotate, 'brfs', 'bulkify' ]; transforms.forEach((transform) => { bundler.transform(transform); }); function rebundle() { const stream = bundler.bundle(); const createSourcemap = global.isProd && config.browserify.prodSourcemap; gutil.log(`Rebundle...${file}`); return stream.on('error', handleErrors) .pipe(source(file)) .pipe(gulpif(createSourcemap, buffer())) .pipe(gulpif(createSourcemap, sourcemaps.init())) .pipe(gulpif(global.isProd, streamify(uglify({ compress: { drop_console: true } })))) .pipe(gulpif(createSourcemap, sourcemaps.write('./'))) .pipe(gulp.dest(config.dist.root)) .pipe(browserSync.stream({ once: true })); } if (!global.isProd) { bundler = watchify(bundler); bundler.on('update', () => { rebundle(); }); } return rebundle(); } gulp.task('browserify', () => { if (global.isProd) { return buildScript([config.browserify.entry], config.browserify.bundleName); } const entries = config.browserify.entries.filter(item => { return fs.existsSync(item.src); }); console.log(entries); const tasks = entries.map(entry => { return buildScript([entry.src], entry.bundleName); }); return eventStream.merge.apply(null, tasks); });
JavaScript
0.002829
@@ -2210,32 +2210,8 @@ %7D);%0A - console.log(entries);%0A co
bd350cafa94a7bd4e8ba94ccd683a544ddd5dd69
Fix an issue where unown formes weren't parsed
data/alternate_forms.js
data/alternate_forms.js
'use strict'; const formes = new Array(722); formes[0] = null; for (let i = 1; i < formes.length; i++) { formes[i] = null; } formes[25] = [null, 'Rockstar', 'Belle', 'Pop', 'PhD', 'Libre', 'Cosplay']; formes[202] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '?' ]; formes[351] = [null, 'Sunny', 'Rainy', 'Snowy']; [382, 383].forEach(i => { formes[i] = [null, 'Primal']; }); formes[386] = [null, 'Attack', 'Defense', 'Speed']; [412, 413].forEach(i => { formes[i] = ['Plant', 'Sandy', 'Trash']; }); formes[421] = ['Overcast', 'Sunshine']; [422, 423].forEach(i => { formes[i] = ['West', 'East']; }); formes[479] = [null, 'Heat', 'Wash', 'Frost', 'Fan', 'Mow']; formes[487] = ['Altered', 'Origin']; formes[492] = ['Land', 'Sky']; formes[493] = [ null, 'Fighting', 'Flying', 'Poison', 'Ground', 'Rock', 'Bug', 'Ghost', 'Steel', 'Fire', 'Water', 'Grass', 'Electric', 'Psychic', 'Ice', 'Dragon', 'Dark', 'Fairy' ]; formes[550] = ['Red', 'Blue']; formes[555] = [null, 'Zen']; [585, 586].forEach(i => { formes[i] = ['Spring', 'Summer', 'Autumn', 'Winter']; }); [641, 642, 645].forEach(i => { formes[i] = ['Incarnate', 'Therian']; }); formes[646] = [null, 'White', 'Black']; formes[647] = [null, 'Resolute']; formes[648] = ['Aria', 'Pirouette']; formes[649] = [null, 'Douse', 'Shock', 'Burn', 'Chill']; [664, 665, 666].forEach(i => { formes[i] = [ 'Icy Snow', 'Polar', 'Tundra', 'Continental', 'Garden', 'Elegant', 'Meadow', 'Modern', 'Marine', 'Archipelago', 'High Plains', 'Sandstorm', 'River', 'Monsoon', 'Savanna', 'Sun', 'Ocean', 'Jungle', 'Fancy', 'Poké Ball' ]; }); [669, 671].forEach(i => { formes[i] = ['Red', 'Yellow', 'Orange', 'Blue', 'White']; }); formes[670] = ['Red', 'Yellow', 'Orange', 'Blue', 'White', 'Eternal']; formes[676] = [null, 'Heart', 'Star', 'Diamond', 'Debutante', 'Matron', 'Dandy', 'La Reine', 'Kabuki', 'Pharaoh']; formes[681] = ['Shield', 'Blade']; [710, 711].forEach(i => { formes[i] = ['Small', 'Average', 'Large', 'Super']; }); formes[720] = ['Confined', 'Unbound']; [ 3, 9, 15, 18, 65, 80, 94, 115, 127, 130, 142, 181, 208, 212, 214, 229, 248, 254, 257, 260, 282, 302, 303, 306, 308, 310, 319, 323, 334, 354, 359, 362, 373, 376, 380, 381, 384, 428, 445, 448, 460, 475, 531, 719 ].forEach(i => { formes[i] = [null, 'Mega']; }); [6, 150].forEach(i => { formes[i] = [null, 'Mega X', 'Mega Y']; }); module.exports = formes;
JavaScript
0.000004
@@ -207,17 +207,17 @@ ormes%5B20 -2 +1 %5D = %5B%0A
9c2b960d09cd3d43106c4ca444701e35432d0272
disable PDF view for android (#12061)
shared/fs/filepreview/view-container.js
shared/fs/filepreview/view-container.js
// @flow import * as I from 'immutable' import { compose, connect, lifecycle, type Dispatch, type TypedState, setDisplayName, } from '../../util/container' import * as Constants from '../../constants/fs' import * as FsGen from '../../actions/fs-gen' import * as React from 'react' import * as Types from '../../constants/types/fs' import DefaultView from './default-view-container' import ImageView from './image-view' import TextView from './text-view' import AVView from './av-view' import PdfView from './pdf-view' import {Box, Text} from '../../common-adapters' import {globalStyles, globalColors, platformStyles} from '../../styles' type Props = { path: Types.Path, routePath: I.List<string>, } const mapStateToProps = (state: TypedState, {path}: Props) => { const _pathItem = state.fs.pathItems.get(path) || Constants.makeFile() return { _serverInfo: state.fs.localHTTPServerInfo, mimeType: _pathItem.type === 'file' ? _pathItem.mimeType : '', isSymlink: _pathItem.type === 'symlink', } } const mapDispatchToProps = (dispatch: Dispatch, {path}: Props) => ({ loadMimeType: () => dispatch(FsGen.createMimeTypeLoad({path})), }) const mergeProps = ({_serverInfo, mimeType, isSymlink}, {loadMimeType}, {path}) => ({ url: Constants.generateFileURL(path, _serverInfo), mimeType, isSymlink, path, loadMimeType, }) const Renderer = ({mimeType, isSymlink, url, path, routePath, loadMimeType}) => { if (isSymlink) { return <DefaultView path={path} routePath={routePath} /> } if (mimeType === '') { return ( <Box style={stylesLoadingContainer}> <Text type="BodySmall" style={stylesLoadingText}> Loading ... </Text> </Box> ) } switch (Constants.viewTypeFromMimeType(mimeType)) { case 'default': return <DefaultView path={path} routePath={routePath} /> case 'text': return <TextView url={url} routePath={routePath} /> case 'image': return <ImageView url={url} routePath={routePath} /> case 'av': return <AVView url={url} routePath={routePath} /> case 'pdf': return <PdfView url={url} routePath={routePath} /> default: return <Text type="BodyError">This shouldn't happen</Text> } } const stylesLoadingContainer = { ...globalStyles.flexBoxColumn, ...globalStyles.flexGrow, alignItems: 'center', justifyContent: 'center', } const stylesLoadingText = platformStyles({ isMobile: { color: globalColors.white_40, }, }) export default compose( connect(mapStateToProps, mapDispatchToProps, mergeProps), setDisplayName('ViewContainer'), lifecycle({ componentDidMount() { if (!this.props.isSymlink && this.props.mimeType === '') { this.props.loadMimeType() } }, componentDidUpdate(prevProps) { if ( !this.props.isSymlink && // Trigger loadMimeType if we don't have it yet, this.props.mimeType === '' && // but only if we haven't triggered it before. prevProps.mimeType !== '' ) { this.props.loadMimeType() } }, }) )(Renderer)
JavaScript
0
@@ -642,16 +642,67 @@ /styles' +%0Aimport %7BisAndroid%7D from '../../constants/platform' %0A%0Atype P @@ -2164,16 +2164,165 @@ return +isAndroid ? ( // Android WebView doesn't support PDF. Come on Android!%0A %3CDefaultView path=%7Bpath%7D routePath=%7BroutePath%7D /%3E%0A ) : (%0A %3CPdfView @@ -2353,24 +2353,32 @@ utePath%7D /%3E%0A + )%0A default:
de3fe9b8720657c3acd70272aa62aa37aaace1c1
Change logic for loading state of checkbox.
assets/js/components/settings/SettingsPlugin.js
assets/js/components/settings/SettingsPlugin.js
/** * SettingsPlugin component. * * Site Kit by Google, Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { useCallback } from '@wordpress/element'; /** * Internal dependencies */ import Data from 'googlesitekit-data'; import { CORE_SITE } from '../../googlesitekit/datastore/site/constants'; import { Cell, Grid, Row } from '../../material-components'; import Layout from '../layout/Layout'; import Checkbox from '../Checkbox'; const { useDispatch, useSelect } = Data; export default function SettingsPlugin() { const showAdminBar = useSelect( ( select ) => select( CORE_SITE ).getShowAdminBar() ); const { setShowAdminBar } = useDispatch( CORE_SITE ); const onAdminBarToggle = useCallback( ( { target } ) => { setShowAdminBar( !! target.checked ); }, [ setShowAdminBar ] ); return ( <Layout className="googlesitekit-settings-meta" title={ __( 'Plugin Settings', 'google-site-kit' ) } header fill > <div className="googlesitekit-settings-module googlesitekit-settings-module--active"> <Grid> <Row> <Cell size={ 12 }> <div className="googlesitekit-settings-module__meta-items"> <div className="googlesitekit-settings-module__meta-item googlesitekit-settings-module__meta-item--nomargin"> <Checkbox id="admin-bar-toggle" name="admin-bar-toggle" value="1" checked={ showAdminBar } onChange={ onAdminBarToggle } disabled={ showAdminBar === undefined } loading={ typeof showAdminBar !== 'boolean' } > <span> { __( 'Display relevant page stats in the Admin bar', 'google-site-kit' ) } </span> </Checkbox> </div> </div> </Cell> </Row> </Grid> </div> </Layout> ); }
JavaScript
0
@@ -2128,26 +2128,8 @@ ng=%7B -%0A%09%09%09%09%09%09%09%09%09%09%09typeof sho @@ -2142,32 +2142,22 @@ Bar -!== 'boolean'%0A%09%09%09%09%09%09%09%09%09%09 +=== undefined %7D%0A%09%09
e92e2ae45a2d6a7a049149be654528d4ff199bd4
Update js gulp task
gulp/tasks/javascript.js
gulp/tasks/javascript.js
'use strict'; var watchify = require('watchify'); var browserify = require('browserify'); var gulp = require('gulp'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var gutil = require('gulp-util'); var maps = require('gulp-sourcemaps'); var assign = require('lodash.assign'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var customOpts = { entries: ['assets/js/main.js'], debug: true }; var opts = assign({}, watchify.args, customOpts); var b = watchify(browserify(opts)); gulp.task('js', bundle); b.on('update', bundle); b.on('log', gutil.log); function bundle() { return b.bundle() .on('error', gutil.log.bind(gutil, 'Browserify Error')) .pipe(source('app')) .pipe(rename({ extname: '.js' })) .pipe(gulp.dest('./build/')) .pipe(buffer()) .pipe(uglify()) // .pipe(maps.init({loadMaps: true})) // .pipe(maps.write('./')) .pipe(rename({ extname: '.min.js' })) .pipe(gulp.dest('./build')) }
JavaScript
0
@@ -108,24 +108,63 @@ re('gulp');%0A +var changed = require('gulp-changed');%0A var uglify = @@ -184,24 +184,24 @@ p-uglify');%0A - var rename = @@ -583,16 +583,39 @@ pts));%0A%0A +var DEST = './build';%0A%0A gulp.tas @@ -801,24 +801,49 @@ rce('app'))%0A + .pipe(changed(DEST))%0A .pipe(re @@ -892,18 +892,12 @@ est( -'./build/' +DEST ))%0A @@ -1070,22 +1070,17 @@ lp.dest( -'./build' +DEST ))%0A%7D%0A
e280b9628d6ac7853fda06548ff64dbced234194
Fix incorrect Vivillon pattern names
data/alternate_forms.js
data/alternate_forms.js
'use strict'; const formes = new Array(722); formes[0] = null; for (let i = 1; i < formes.length; i++) { formes[i] = null; } formes[25] = [null, 'Rockstar', 'Belle', 'Pop', 'PhD', 'Libre', 'Cosplay']; formes[202] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '?' ]; formes[351] = [null, 'Sunny', 'Rainy', 'Snowy']; [382, 383].forEach(i => { formes[i] = [null, 'Primal']; }); formes[386] = [null, 'Attack', 'Defense', 'Speed']; [412, 413].forEach(i => { formes[i] = ['Plant', 'Sandy', 'Trash']; }); formes[421] = ['Overcast', 'Sunshine']; [422, 423].forEach(i => { formes[i] = ['West', 'East']; }); formes[479] = [null, 'Heat', 'Wash', 'Frost', 'Fan', 'Mow']; formes[487] = ['Altered', 'Origin']; formes[492] = ['Land', 'Sky']; formes[493] = [ null, 'Fighting', 'Flying', 'Poison', 'Ground', 'Rock', 'Bug', 'Ghost', 'Steel', 'Fire', 'Water', 'Grass', 'Electric', 'Psychic', 'Ice', 'Dragon', 'Dark', 'Fairy' ]; formes[550] = ['Red', 'Blue']; formes[555] = [null, 'Zen']; [585, 586].forEach(i => { formes[i] = ['Spring', 'Summer', 'Autumn', 'Winter']; }); [641, 642, 645].forEach(i => { formes[i] = ['Incarnate', 'Therian']; }); formes[646] = [null, 'White', 'Black']; formes[647] = [null, 'Resolute']; formes[648] = ['Aria', 'Pirouette']; formes[649] = [null, 'Douse', 'Shock', 'Burn', 'Chill']; [664, 665, 666].forEach(i => { formes[i] = [ 'Icy Snow', 'Polar', 'Tundra', 'Continental', 'Garden', 'Elegant', 'Meadow', 'Modern', 'Marine', 'Archipelago', 'High-Plains', 'Sandstorm', 'River', 'Monsoon', 'Savannah', 'Sun', 'Ocean', 'Jungle', 'Fancy', 'Poké Ball' ]; }); [669, 671].forEach(i => { formes[i] = ['Red', 'Yellow', 'Orange', 'Blue', 'White']; }); formes[670] = ['Red', 'Yellow', 'Orange', 'Blue', 'White', 'Eternal']; formes[676] = [null, 'Heart', 'Star', 'Diamond', 'Debutante', 'Matron', 'Dandy', 'La Reine', 'Kabuki', 'Pharaoh']; formes[681] = ['Shield', 'Blade']; [710, 711].forEach(i => { formes[i] = ['Small', 'Average', 'Large', 'Super']; }); formes[720] = ['Confined', 'Unbound']; [ 3, 9, 15, 18, 65, 80, 94, 115, 127, 130, 142, 181, 208, 212, 214, 229, 248, 254, 257, 260, 282, 302, 303, 306, 308, 310, 319, 323, 334, 354, 359, 362, 373, 376, 380, 381, 384, 428, 445, 448, 460, 475, 531, 719 ].forEach(i => { formes[i] = [null, 'Mega']; }); [6, 150].forEach(i => { formes[i] = [null, 'Mega X', 'Mega Y']; }); module.exports = formes;
JavaScript
0.999997
@@ -1717,9 +1717,9 @@ High -- + Plai @@ -1780,17 +1780,16 @@ 'Savanna -h ',%0A '
1b8a369d6c3358a05ca5988acd3a8cc8d3e1259e
Add admin bar checkbox.
assets/js/components/settings/SettingsPlugin.js
assets/js/components/settings/SettingsPlugin.js
/** * SettingsPlugin component. * * Site Kit by Google, Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ import { Cell, Grid, Row } from '../../material-components'; import Layout from '../layout/Layout'; export default function SettingsPlugin() { return ( <Layout className="googlesitekit-settings-meta" title={ __( 'Plugin Settings', 'google-site-kit' ) } header fill > <div className="googlesitekit-settings-module googlesitekit-settings-module--active"> <Grid> <Row> <Cell size={ 12 }> <div className="googlesitekit-settings-module__meta-items"> <div className="googlesitekit-settings-module__meta-item googlesitekit-settings-module__meta-item--nomargin"> </div> </div> </Cell> </Row> </Grid> </div> </Layout> ); }
JavaScript
0
@@ -713,16 +713,66 @@ s/i18n'; +%0Aimport %7B useCallback %7D from '@wordpress/element'; %0A%0A/**%0A * @@ -897,16 +897,52 @@ Layout'; +%0Aimport Checkbox from '../Checkbox'; %0A%0Aexport @@ -978,16 +978,75 @@ gin() %7B%0A +%09const onAdminBarToggle = useCallback( () =%3E %7B%0A%0A%09%7D, %5B%5D );%0A%0A %09return @@ -1381,16 +1381,16 @@ items%22%3E%0A - %09%09%09%09%09%09%09%09 @@ -1499,16 +1499,315 @@ argin%22%3E%0A +%09%09%09%09%09%09%09%09%09%3CCheckbox%0A%09%09%09%09%09%09%09%09%09%09id=%22admin-bar-toggle%22%0A%09%09%09%09%09%09%09%09%09%09name=%22admin-bar-toggle%22%0A%09%09%09%09%09%09%09%09%09%09value=%221%22%0A%09%09%09%09%09%09%09%09%09%09onChange=%7B onAdminBarToggle %7D%0A%09%09%09%09%09%09%09%09%09%3E%0A%09%09%09%09%09%09%09%09%09%09%3Cspan%3E%0A%09%09%09%09%09%09%09%09%09%09%09%7B __( 'Display relevant page stats in the Admin bar', 'google-site-kit' ) %7D%0A%09%09%09%09%09%09%09%09%09%09%3C/span%3E%0A%09%09%09%09%09%09%09%09%09%3C/Checkbox%3E%0A %09%09%09%09%09%09%09%09
f8e504dd14c2ec878449c4d63d7d7bf6f7a123d2
Fix missing accumulator in deploy.js authz (#926)
commands/deploy.js
commands/deploy.js
"use strict"; var _ = require("lodash"); var requireInstance = require("../lib/requireInstance"); var requirePermissions = require("../lib/requirePermissions"); var checkDupHostingKeys = require("../lib/checkDupHostingKeys"); var checkValidTargetFilters = require("../lib/checkValidTargetFilters"); var checkFirebaseSDKVersion = require("../lib/checkFirebaseSDKVersion"); var Command = require("../lib/command"); var deploy = require("../lib/deploy"); var requireConfig = require("../lib/requireConfig"); var filterTargets = require("../lib/filterTargets"); // in order of least time-consuming to most time-consuming var VALID_TARGETS = ["database", "storage", "firestore", "functions", "hosting"]; var TARGET_PERMISSIONS = { database: ["firebasedatabase.instances.update"], hosting: ["firebasehosting.sites.update"], functions: [ "cloudfunctions.functions.list", "cloudfunctions.functions.create", "cloudfunctions.functions.get", "cloudfunctions.functions.update", "cloudfunctions.functions.delete", "cloudfunctions.operations.get", ], firestore: [ "datastore.indexes.list", "datastore.indexes.create", "datastore.indexes.update", "datastore.indexes.delete", ], storage: [ "firebaserules.releases.create", "firebaserules.rulesets.create", "firebaserules.releases.update", ], }; module.exports = new Command("deploy") .description("deploy code and assets to your Firebase project") .option("-p, --public <path>", "override the Hosting public directory specified in firebase.json") .option("-m, --message <message>", "an optional message describing this deploy") .option( "--only <targets>", 'only deploy to specified, comma-separated targets (e.g. "hosting,storage"). For functions, ' + 'can specify filters with colons to scope function deploys to only those functions (e.g. "--only functions:func1,functions:func2"). ' + "When filtering based on export groups (the exported module object keys), use dots to specify group names " + '(e.g. "--only functions:group1.subgroup1,functions:group2)"' ) .option("--except <targets>", 'deploy to all targets except specified (e.g. "database")') .before(requireConfig) .before(function(options) { options.filteredTargets = filterTargets(options, VALID_TARGETS); const permissions = options.filteredTargets.reduce((perms, target) => { return perms.concat(TARGET_PERMISSIONS[target]); }); return requirePermissions(options, permissions); }) .before(function(options) { // only fetch the default instance for hosting or database deploys if (_.intersection(options.filteredTargets, ["hosting", "database"]).length > 0) { return requireInstance(options); } }) .before(checkDupHostingKeys) .before(checkValidTargetFilters) .before(checkFirebaseSDKVersion) .action(function(options) { return deploy(options.filteredTargets, options); });
JavaScript
0.000001
@@ -2450,16 +2450,20 @@ );%0A %7D +, %5B%5D );%0A r
f8ad92438dc0f32ecb8b1ffc5a8c828b16c953cf
Comment big key tests due to possible bug in libsodium
test/test_sodium_auth.js
test/test_sodium_auth.js
/** * Created by bmf on 10/31/13. */ "use strict"; var assert = require('assert'); var crypto = require('crypto'); var sodium = require('../build/Release/sodium'); var key = new Buffer(sodium.crypto_auth_KEYBYTES).fill('Jefe').fill(0,4,32);; var c = Buffer.from('what do ya want for nothing?'); var key2 = Buffer.from('Another one got caught today, it\'s all over the papers. "Teenager Arrested in Computer Crime Scandal", "Hacker Arrested after Bank Tampering"... Damn kids. They\'re all alike.'); var expected1 = Buffer.from( [ 0x16, 0x4b, 0x7a, 0x7b, 0xfc, 0xf8, 0x19, 0xe2, 0xe3, 0x95, 0xfb, 0xe7, 0x3b, 0x56, 0xe0, 0xa3, 0x87, 0xbd, 0x64, 0x22, 0x2e, 0x83, 0x1f, 0xd6, 0x10, 0x27, 0x0c, 0xd7, 0xea, 0x25, 0x05, 0x54 ]); var expected2 = Buffer.from( [ 0x7b, 0x9d, 0x83, 0x38, 0xeb, 0x1e, 0x3d, 0xdd, 0xba, 0x8a, 0x9a, 0x35, 0x08, 0xd0, 0x34, 0xa1, 0xec, 0xbe, 0x75, 0x11, 0x37, 0xfa, 0x1b, 0xcb, 0xa0, 0xf9, 0x2a, 0x3e, 0x6d, 0xfc, 0x79, 0x80, 0xb8, 0x81, 0xa8, 0x64, 0x5f, 0x92, 0x67, 0x22, 0x74, 0x37, 0x96, 0x4b, 0xf3, 0x07, 0x0b, 0xe2, 0xb3, 0x36, 0xb3, 0xa3, 0x20, 0xf8, 0x25, 0xce, 0xc9, 0x87, 0x2d, 0xb2, 0x50, 0x4b, 0xf3, 0x6d ]); var expected3 = Buffer.from( [ 0x73, 0xe0, 0x0d, 0xcb, 0xf4, 0xf8, 0xa3, 0x33, 0x30, 0xac, 0x52, 0xed, 0x2c, 0xc9, 0xd1, 0xb2, 0xef, 0xb1, 0x77, 0x13, 0xd3, 0xec, 0xe3, 0x96, 0x14, 0x9f, 0x37, 0x65, 0x3c, 0xfe, 0x70, 0xe7, 0x1f, 0x2c, 0x6f, 0x9a, 0x62, 0xc3, 0xc5, 0x3a, 0x31, 0x8a, 0x9a, 0x0b, 0x3b, 0x78, 0x60, 0xa4, 0x31, 0x6f, 0x72, 0x9b, 0x8d, 0x30, 0x0f, 0x15, 0x9b, 0x2f, 0x60, 0x93, 0xa8, 0x60, 0xc1, 0xed ]); var a = new Buffer(sodium.crypto_auth_BYTES); var a2 = new Buffer(sodium.crypto_auth_hmacsha512_BYTES); describe('LibSodium Auth', function() { it('crypto_auth should return the expected auth token', function(done) { var authToken = sodium.crypto_auth(c, key); assert.deepEqual(authToken, expected1); assert.equal(authToken.length, sodium.crypto_auth_BYTES); done(); }); it('crypto_auth_hmacsha512_* = crypto_auth_hmacsha512', function(done) { // Split the message in half var c1 = c.slice(0, c.length / 2); var c2 = c.slice(c.length / 2, c.length); var s1 = sodium.crypto_auth_hmacsha512_init(key); var s2 = sodium.crypto_auth_hmacsha512_update(s1, c1); var s3 = sodium.crypto_auth_hmacsha512_update(s2, c2); var a1 = sodium.crypto_auth_hmacsha512_final(s3); var a2 = sodium.crypto_auth_hmacsha512(c, key); // Assert that the states changed with each update assert.notDeepEqual(s1, s2); assert.notDeepEqual(s2, s3); assert.notDeepEqual(s1, s3); // Assert that it matches what we expected assert.deepEqual(a1, a2); // Is it the right token length assert.equal(a1.length, sodium.crypto_auth_hmacsha512_BYTES); assert.equal(a2.length, sodium.crypto_auth_hmacsha512_BYTES); done(); }); it('crypto_auth_hmacsha512_* = crypto_auth_hmacsha512', function(done) { // Split the message in half var c1 = c.slice(0, 1); var c2 = c.slice(0, c.length -1); var s1 = sodium.crypto_auth_hmacsha512_init(key2); var s2 = sodium.crypto_auth_hmacsha512_update(s1, c1); var s3 = sodium.crypto_auth_hmacsha512_update(s2, c2); var a1 = sodium.crypto_auth_hmacsha512_final(s3); // Assert that the states changed with each update assert.notDeepEqual(s1, s2); assert.notDeepEqual(s2, s3); assert.notDeepEqual(s1, s3); // Assert that it matches what we expected assert.deepEqual(a1, expected2); // Is it the right token length assert.equal(a1.length, sodium.crypto_auth_hmacsha512_BYTES); done(); }); });
JavaScript
0
@@ -3052,32 +3052,80 @@ one();%0A %7D);%0A%0A +/* THIS TEST IS DISABLED DUE TO A LIBSODIUM BUG%0A it('crypto_a @@ -3939,12 +3939,14 @@ %7D);%0A +*/ %0A%7D);
df1ffe63d46e3a3c4c74ae2e7f531254ad2b5d24
Include mojular dependency in JS file
assets/scripts/modules/conditional-subfields.js
assets/scripts/modules/conditional-subfields.js
var $ = require('jquery'); Mojular.Modules.ConditionalSubfields = { el: '[data-controlled-by]', init: function() { this.cacheEls(); this.bindEvents(); this.setInitialState(); this.replaceLabels(); }, setInitialState: function() { var self = this; this.conditionalFields .each(function() { var $fields = $('[name="' + $(this).data('controlled-by') + '"]'); $fields = $fields.filter(function() { // Unchecked checkbox or checked radio button return this.type === 'checkbox' || $(this).is(':checked'); }); $fields.each($.proxy(self.handleVisibility, self)); }); }, // If CONDITIONAL_LABELS constant exists its contents will be used to // replace fields on page load. // e.g. If non-JS page has a label "If Yes, how many?" (referring to previous field) // Adding `CONDITIONAL_LABELS['num_children'] = 'How many?'` would change label to 'How many?' // when JS kicks in. replaceLabels: function() { if(!window.CONDITIONAL_LABELS) { return; } $.each(window.CONDITIONAL_LABELS, function(key, value) { $('#field-' + key + '') .find('.fieldset-label *') .text(value); }); }, bindEvents: function() { var self = this; var controllers = $.unique(this.conditionalFields.map(function() { return $(this).data('controlled-by'); })); $.each(controllers, function() { $('[name="' + this + '"]').on('change', $.proxy(self.handleVisibility, self)); }); }, handleVisibility: function() { var self = this; this.conditionalFields.each(function() { self._handleField($(this)); }); }, _handleField: function($field) { // `controlled-by` specifies the field name which controls the visibility of element var controlInputName = $field.data('controlled-by'); // `control-value` is the value which should trigger the visibility of element var controlInputValue = $field.data('control-value') + ''; var $controlInput = $('[name="' + controlInputName + '"]'); // control visibility only for specified value (unless it's a wildcard `*`) if(controlInputValue && controlInputValue !== '*') { $controlInput = $controlInput.filter('[value="' + controlInputValue + '"]'); } this._toggleField($field, $controlInput.is(':checked')); }, _toggleField: function($field, isVisible) { $field .toggleClass('u-expanded', isVisible) .toggleClass('u-hidden', !isVisible) .attr({ 'aria-expanded': isVisible, 'aria-hidden': !isVisible }); if(!isVisible && !$field.data('persist-values')) { $field.find('input') .prop('checked', false) .trigger('label-select'); } }, cacheEls: function() { this.conditionalFields = $(this.el); } };
JavaScript
0
@@ -1,12 +1,32 @@ +require('mojular');%0A var $ = requ
b7c9e260ae261ec48f9e4664aa62bcbacadd71a1
Remove requiring FS since it's not needed
commands/emotes.js
commands/emotes.js
var fs = require('fs'); module.exports = { emote_alphys: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/alphys.png" }); }, emote_toby: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/dog.png" }); }, emote_tobybone: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/tobybone.gif" }); }, emote_tobysleep: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/tobysleep.gif" }); }, emote_tobytrap: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/tobytrap.gif" }); }, emote_flowey: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/flowey.png" }); }, emote_floweyevil: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/floweyevil.png" }); }, emote_papyrusglare: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/papyrusglare.png" }); }, emote_papyrusshock: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/papyruswacky.png" }); }, emote_papyruscool: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/papyruscool.png" }); }, emote_sans: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/sans.png" }); }, emote_toriel: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/toriel.png" }); }, emote_torielglare: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/torielglare.png" }); }, emote_torielcry: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/torielsad.png" }); }, emote_torielshock: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/torielshock.png" }); }, emote_undyne: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/undynelaugh.png" }); }, emote_blook: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/napstablook.png" }); }, emote_dapperblook: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/dapperblook.png" }); }, emote_blookchill: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/napstablookchill.png" }); }, emote_napsta: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/napstablooktunes.png" }); }, emote_blookworried: function(bot, user, userID, channelID, message) { var helpers = require('./../helpers'); helpers.statistics("emoted", user, userID, channelID, message); bot.uploadFile({ to: channelID, file: "emote/napstablookworried.png" }); } }
JavaScript
0
@@ -1,29 +1,4 @@ -var fs = require('fs');%0A%0A modu
001d1f491a789278132055db39281d2024b584af
use the configured id of a model - fixes list.get(model)
model/list/list.js
model/list/list.js
steal('can/model/list','jquery/model').then(function() { // List.get used to take a model or list of models var getList = $.Model.List.prototype.get; $.Model.List.prototype.get = function(arg) { var ids; if(arg instanceof $.Model.List) { ids = []; $.each(arg,function() { ids.push(this.attr('id')); }); arg = ids; } else if(arg.attr && arg.attr('id')) { arg = arg.attr('id'); } return getList.apply(this,arguments); }; // restore the ability to push a list!arg var push = $.Model.List.prototype.push; $.Model.List.prototype.push = function(arg) { if(arg instanceof $.Model.List) { arg = can.makeArray(arg); } return push.apply(this,arguments); }; });
JavaScript
0
@@ -196,24 +196,28 @@ %7B%0A%09%09var ids +, id ;%0A%09%09if(arg i @@ -362,25 +362,65 @@ && arg. -attr('id' +constructor && (id = arg.attr(arg.constructor.id) )) %7B%0A%09%09%09 @@ -429,22 +429,10 @@ g = -arg.attr('id') +id ;%0A%09%09
dbc30e11332b9be3a63634bad5410c820092ab32
command is no array
commands/reload.js
commands/reload.js
const alias = require('../events/message.js').alias; exports.run = async(client, msg, args) => { if (!args || args.length < 1) return msg.reply('Please type the command name to reload'); let command; if (require('./' + args[0])) { command = args[0] } try { delete require.cache[require.resolve(`./` + command[0])]; msg.channel.send(`Reloaded command ${command}`); } catch (e) { msg.channel.send(`**${command}** Does not exists.`) } }; exports.help = { category : 'dev only', usage : '[command name]', description: 'Reloads a command', detail : 'Reload the command code without need of restarting the bot.', botPerm : ['SEND_MESSAGES'], authorPerm : [], alias : [ null ] };
JavaScript
0.999999
@@ -321,19 +321,16 @@ command -%5B0%5D )%5D;%0A
75beb0542a3541e2e48c3d5c6455969c69409e4d
Tidy up.
src/article/shared/EditEntityCommand.js
src/article/shared/EditEntityCommand.js
import { Command } from 'substance' /* This command intended to switch view and scroll to the selected node. Command state becoming active only for certain type of custom selection, e.g. if you want to use it, provide config with selectionType property. */ export default class EditEntityCommand extends Command { getCommandState (params, context) { let sel = params.selection let newState = { disabled: true } if (sel.isCustomSelection()) { if (sel.customType === this.config.selectionType) { newState.disabled = false newState.nodeId = sel.nodeId } } return newState } execute (params, context) { const appState = context.appState const viewName = appState.get('viewName') if (viewName !== 'metadata') { const sel = params.selection const nodeId = sel.nodeId context.editor.send('updateViewName', 'metadata') // HACK: using the ArticlePanel instance to get to the current editor // so that we can dispatch 'executeCommand' let editor = context.articlePanel.refs.content editor.send('scrollTo', { nodeId }) // HACK: this is a mess because context.api is a different instance after // switching to metadata view // TODO: we should extend ArticleAPI to allow for this editor.api.selectFirstRequiredPropertyOfMetadataCard(nodeId) } } }
JavaScript
0.000002
@@ -44,34 +44,63 @@ his -command intended to switch +is a preliminary solultion that switches to the correct vie @@ -111,19 +111,19 @@ d scroll - to +s%0A the sel @@ -136,157 +136,105 @@ node -.%0A Command state becoming active only for certain type of custom selection,%0A e.g. if you want to use it, provide config with selectionType property + into view.%0A On the long run we want to let the views be independent, e.g. using a popup instead .%0A*/ @@ -404,24 +404,182 @@ true%0A %7D%0A + // this command only becomes active for a specific type of custom selection,%0A // e.g. if you want to use it, provide config with selectionType property %0A if (sel
46dfb3990aa247d9406704d13f2d6734d7d31a72
add sqrt and fix getType
examples/js/nodes/math/Math1Node.js
examples/js/nodes/math/Math1Node.js
/** * @author sunag / http://www.sunag.com.br/ */ THREE.Math1Node = function( a, method ) { THREE.TempNode.call( this ); this.a = a; this.method = method || THREE.Math1Node.SIN; }; THREE.Math1Node.RAD = 'radians'; THREE.Math1Node.DEG = 'degrees'; THREE.Math1Node.EXP = 'exp'; THREE.Math1Node.EXP2 = 'exp2'; THREE.Math1Node.LOG = 'log'; THREE.Math1Node.LOG2 = 'log2'; THREE.Math1Node.INVERSE_SQRT = 'inversesqrt'; THREE.Math1Node.FLOOR = 'floor'; THREE.Math1Node.CEIL = 'ceil'; THREE.Math1Node.NORMALIZE = 'normalize'; THREE.Math1Node.FRACT = 'fract'; THREE.Math1Node.SAT = 'saturate'; THREE.Math1Node.SIN = 'sin'; THREE.Math1Node.COS = 'cos'; THREE.Math1Node.TAN = 'tan'; THREE.Math1Node.ASIN = 'asin'; THREE.Math1Node.ACOS = 'acos'; THREE.Math1Node.ARCTAN = 'atan'; THREE.Math1Node.ABS = 'abs'; THREE.Math1Node.SIGN = 'sign'; THREE.Math1Node.LENGTH = 'length'; THREE.Math1Node.NEGATE = 'negate'; THREE.Math1Node.INVERT = 'invert'; THREE.Math1Node.prototype = Object.create( THREE.TempNode.prototype ); THREE.Math1Node.prototype.constructor = THREE.Math1Node; THREE.Math1Node.prototype.getType = function( builder ) { switch ( this.method ) { case THREE.Math1Node.DISTANCE: return 'fv1'; } return this.a.getType( builder ); }; THREE.Math1Node.prototype.generate = function( builder, output ) { var material = builder.material; var type = this.getType( builder ); var result = this.a.build( builder, type ); switch ( this.method ) { case THREE.Math1Node.NEGATE: result = '(-' + result + ')'; break; case THREE.Math1Node.INVERT: result = '(1.0-' + result + ')'; break; default: result = this.method + '(' + result + ')'; break; } return builder.format( result, type, output ); };
JavaScript
0
@@ -391,15 +391,42 @@ ode. -INVERSE +SQRT = 'sqrt';%0ATHREE.Math1Node.INV _SQR @@ -1205,16 +1205,14 @@ ode. -DISTANCE +LENGTH :%0A%09%09
ef02a3b0295cdc3fd206ee61a208625255a4f666
Remove debug info
src/assets/js/materialbox-fullscreen.js
src/assets/js/materialbox-fullscreen.js
/** * materialbox_fullscreen.js * Oleg Fomin <ofstudio@gmail.com> * * Based on materialbox from Materialize Framework v0.96.1 | https://github.com/Dogfalo/materialize * Added fullscreen feature * * See * ... * newWidth = windowWidth * 1; * newHeight = windowWidth * 1 * ratio; * ... * * Docs and demo: http://materializecss.com/media.html * */ 'use strict'; (function ($) { $.fn.materialbox_fullscreen = function () { return this.each(function () { if ($(this).hasClass('intialized')) { return; } $(this).addClass('intialized'); var overlayActive = false; var doneAnimating = true; var inDuration = 275; var outDuration = 200; var origin = $(this); var placeholder = $('<div></div>').addClass('material-placeholder'); origin.wrap(placeholder); origin.on('click', function () { var placeholder = origin.parent('.material-placeholder'); var windowWidth = window.innerWidth; var windowHeight = window.innerHeight; var originalWidth = origin.width(); var originalHeight = origin.height(); // If already modal, return to original if (doneAnimating === false) { returnToOriginal(); return false; } else if (overlayActive && doneAnimating === true) { returnToOriginal(); return false; } // Set states doneAnimating = false; origin.addClass('active'); overlayActive = true; // Set positioning for placeholder placeholder.css({ width: placeholder[0].getBoundingClientRect().width, height: placeholder[0].getBoundingClientRect().height, position: 'relative', top: 0, left: 0 }); // Set css on origin origin.css({position: 'absolute', 'z-index': 1000}) .data('width', originalWidth) .data('height', originalHeight); // Add overlay var overlay = $('<div id="materialbox-overlay"></div>') .css({ opacity: 0 }) .click(function () { if (doneAnimating === true) { returnToOriginal(); } }); // Animate Overlay $('body').append(overlay); overlay.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'} ); // Add and animate caption if it exists if (origin.data('caption') !== '') { var $photo_caption = $('<div class="materialbox-caption"></div>'); $photo_caption.text(origin.data('caption')); $('body').append($photo_caption); $photo_caption.css({'display': 'inline'}); $photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'}); } // Resize Image var ratio = 0; var widthPercent = originalWidth / windowWidth; var heightPercent = originalHeight / windowHeight; var newWidth = 0; var newHeight = 0; console.log('Works!'); if (widthPercent > heightPercent) { ratio = originalHeight / originalWidth; newWidth = windowWidth * 1; newHeight = windowWidth * 1 * ratio; } else { ratio = originalWidth / originalHeight; newWidth = (windowHeight * 1) * ratio; newHeight = windowHeight * 1; } // Animate image + set z-index if (origin.hasClass('responsive-img')) { origin.velocity({'max-width': newWidth, 'width': originalWidth}, { duration: 0, queue: false, complete: function () { origin.css({left: 0, top: 0}) .velocity( { height: newHeight, width: newWidth, left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2, top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2 }, { duration: inDuration, queue: false, easing: 'easeOutQuad', complete: function () { doneAnimating = true; } } ); } // End Complete }); // End Velocity } else { origin.css('left', 0) .css('top', 0) .velocity( { height: newHeight, width: newWidth, left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2, top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2 }, { duration: inDuration, queue: false, easing: 'easeOutQuad', complete: function () { doneAnimating = true; } } ); // End Velocity } }); // End origin on click // Return on scroll $(window).scroll(function () { if (overlayActive) { returnToOriginal(); } }); // Return on ESC $(document).keyup(function (e) { if (e.keyCode === 27 && doneAnimating === true) { // ESC key if (overlayActive) { returnToOriginal(); } } }); // This function returns the modaled image to the original spot function returnToOriginal() { doneAnimating = false; var placeholder = origin.parent('.material-placeholder'); var originalWidth = origin.data('width'); var originalHeight = origin.data('height'); origin.velocity('stop', true); $('#materialbox-overlay').velocity('stop', true); $('.materialbox-caption').velocity('stop', true); $('#materialbox-overlay').velocity({opacity: 0}, { duration: outDuration, // Delay prevents animation overlapping queue: false, easing: 'easeOutQuad', complete: function () { // Remove Overlay overlayActive = false; $(this).remove(); } }); // Resize Image origin.velocity( { width: originalWidth, height: originalHeight, left: 0, top: 0 }, { duration: outDuration, queue: false, easing: 'easeOutQuad' } ); // Remove Caption + reset css settings on image $('.materialbox-caption').velocity({opacity: 0}, { duration: outDuration, // Delay prevents animation overlapping queue: false, easing: 'easeOutQuad', complete: function () { placeholder.css({ height: '', width: '', position: '', top: '', left: '' }); origin.css({ height: '', top: '', left: '', width: '', 'max-width': '', position: '', 'z-index': '' }); // Remove class origin.removeClass('active'); doneAnimating = true; $(this).remove(); } }); } }); }; }(jQuery));
JavaScript
0.000001
@@ -3686,48 +3686,8 @@ 0;%0A - console.log('Works!');%0A%0A %0A
7ba1b5ea23471b4c2df9f0cbd45afd9764dd4b98
Fix build process for Leaflet.markercluster
Jakefile.js
Jakefile.js
const LeafletBuild = require('./vendor/leaflet/build/build') const MarkerClusterBuild = require('./vendor/leaflet-markercluster/build/build') function pushdAsync(wd) { const oldwd = process.cwd() process.chdir('vendor/leaflet') return () => { process.chdir(oldwd) complete() } } function installDepsCmd() { // https://github.com/ForbesLindesay/spawn-sync/blob/b0063ee33b17feaa905602f0b2ff72b4acd1bdbb/postinstall.js#L29 const npm = process.env.npm_execpath ? `"${process.argv[0]}" "${process.env.npm_execpath}"` : 'npm' return `${npm} install` } desc('Build Leaflet') task('build-leaflet', ['fetchdeps-leaflet'], {async: true}, () => { console.log('.. Building Leaflet ..') LeafletBuild.build(pushdAsync('vendor/leaflet'), 'mvspju5') }) desc('Build Leaflet.markercluster') task('build-leaflet-markercluster', ['fetchdeps-leaflet-markercluster'], {async: true}, () => { console.log('.. Building Leaflet.markercluster ..') MarkerClusterBuild.build(pushdAsync('vendor/leaflet-markercluster'), '7') }) desc('Build dependencies') task('build-deps', ['build-leaflet', 'build-leaflet-markercluster']) desc('Download Git submodules') task('fetch-submodules', {async: true}, () => { console.log('.. Fetching submodules ..') jake.exec( 'git submodule update --init --recursive', {printStdout: true, printStderr: true}, complete ) }) desc('Download Leaflet dependencies') task('fetchdeps-leaflet', {async: true}, () => { console.log('.. Fetching Leaflet dependencies ..') jake.exec( installDepsCmd(), {printStdout: true, printStderr: true}, pushdAsync('vendor/leaflet') ) }) desc('Download Leaflet.markercluster dependencies') task('fetchdeps-leaflet-markercluster', {async: true}, () => { console.log('.. Fetching leaflet-markercluster dependencies ..') jake.exec( installDepsCmd(), {printStdout: true, printStderr: true}, pushdAsync('vendor/leaflet-markercluster') ) }) desc('Fetch submodule dependencies') task( 'fetch-submodule-deps', ['fetch-submodules', 'fetchdeps-leaflet', 'fetchdeps-leaflet-markercluster'] ) task('default', ['fetch-submodules', 'build-deps', 'fetch-submodule-deps'])
JavaScript
0.000003
@@ -209,32 +209,18 @@ s.chdir( -'vendor/leaflet' +wd )%0A retu @@ -856,31 +856,16 @@ uster'%5D, - %7Basync: true%7D, () =%3E %7B @@ -857,32 +857,32 @@ ster'%5D, () =%3E %7B%0A + console.log('. @@ -925,80 +925,137 @@ )%0A -MarkerClusterBuild.build(pushdAsync('vendor/leaflet-markercluster'), '7' +const oldwd = process.cwd()%0A process.chdir('vendor/leaflet-markercluster')%0A MarkerClusterBuild.build('7')%0A process.chdir(oldwd )%0A%7D)
cc16cd936e582933ac9831f986dcf7fd03d77799
Add Gravity Suit (#322)
mods/cssb/items.js
mods/cssb/items.js
'use strict'; exports.BattleItems = { // VXN "wondergummi": { id: "wondergummi", name: "Wonder Gummi", spritenum: 538, naturalGift: { basePower: 200, type: "???", }, isNonStandard: true, onUpdate: function (pokemon) { if (pokemon.hp <= pokemon.maxhp / 4 || (pokemon.hp <= pokemon.maxhp / 2 && pokemon.hasAbility('gluttony'))) { pokemon.eatItem(); } }, onTryEatItem: function (item, pokemon) { if (!this.runEvent('TryHeal', pokemon)) return false; }, onEat: function (pokemon) { let fakecheck = this.random(1000); if (fakecheck <= 850) { this.add('message', 'Its belly felt full!'); this.heal(pokemon.maxhp / 2); this.add('message', 'Its IQ rose!'); this.boost({ spd: 2, }); this.boost({ def: 2, }); } else { this.add('message', 'Wait... Its a WANDER Gummi!'); this.heal(pokemon.maxhp / 100); this.add('message', 'It gained the blinker status!'); this.boost({ accuracy: -6, }); } }, desc: "Either heals the user's max HP by 1/2, boosts the user's SpD and Def by 2 stages, or heals 1% of their health, but drops accuracy by six stages, when at 1/4 max HP or less, 1/2 if the user's ability is Gluttony. Single use.", }, };
JavaScript
0
@@ -1234,11 +1234,332 @@ .%22,%0A%09%7D,%0A +%09// Gligars%0A%09%22gravitysuit%22: %7B%0A%09%09id: %22gravitysuit%22,%0A%09%09name: %22Gravity Suit%22,%0A%09%09spritenum: 581,%0A%09%09fling: %7B%0A%09%09%09basePower: 30,%0A%09%09%7D,%0A%09%09onStart: function (pokemon) %7B%0A%09%09%09this.useMove('Gravity', pokemon);%0A%09%09%09this.useMove('Trick Room', pokemon);%0A%09%09%7D,%0A%09%09isNonStandard: true,%0A%09%09desc: %22Uses Gravity and Trick Room on Switch-in.%22,%0A%09%7D,%0A %7D;%0A
35249ff3536527a7767eb342ce84ca2cfb8232da
Remove unused variable
src/utils/configuration.js
src/utils/configuration.js
const characters = { 0: [1008, 1008, 3132, 3132, 15375, 15375, 15375, 15375, 15375, 15375, 3852, 3852, 1008, 1008], 1: [240, 240, 1008, 1008, 240, 240, 240, 240, 240, 240, 240, 240, 4095, 4095], 2: [4092, 4092, 15375, 15375, 63, 63, 1020, 1020, 4080, 4080, 16128, 16128, 16383, 16383], 3: [4095, 4095, 60, 60, 240, 240, 1020, 1020, 15, 15, 15375, 15375, 4092, 4092], 4: [252, 252, 1020, 1020, 3900, 3900, 15420, 15420, 16383, 16383, 60, 60, 60, 60], 5: [16380, 16380, 15360, 15360, 16380, 16380, 15, 15, 15, 15, 15375, 15375, 4092, 4092], 6: [1020, 1020, 3840, 3840, 15360, 15360, 16380, 16380, 15375, 15375, 15375, 15375, 4092, 4092], 7: [16383, 16383, 15375, 15375, 60, 60, 240, 240, 960, 960, 960, 960, 960, 960], 8: [4092, 4092, 15375, 15375, 15375, 15375, 4092, 4092, 15375, 15375, 15375, 15375, 4092, 4092], 9: [4092, 4092, 15375, 15375, 15375, 15375, 4095, 4095, 15, 15, 60, 60, 4080, 4080], ':': [0, 0, 960, 960, 960, 960, 0, 0, 0, 0, 960, 960, 960, 960], }; // A wild missingno appears... const missingno = [13107, 13107, 3276, 3276, 13107, 13107, 3276, 3276, 13107, 13107, 3276, 3276, 13107, 13107]; const rows = 14; const columns = 14; const defaultSize = 4; const defaultGrid = { width: 4, height: 4, columns, rows, }; export { characters, missingno, rows, columns, defaultSize, defaultGrid };
JavaScript
0.000015
@@ -1168,31 +1168,8 @@ 14; -%0Aconst defaultSize = 4; %0A%0Aco @@ -1286,21 +1286,8 @@ mns, - defaultSize, def
f4d0d54fc30096a9303651548953dcc5418f1db1
Update qrCodeScanning.js
Moma/Moma.Droid/Assets/Content/scripts/qrCodeScanning.js
Moma/Moma.Droid/Assets/Content/scripts/qrCodeScanning.js
function qrCodeScanBtn() { jsBridge.ScanQRCode(); } function qrCodeTextBtn() { jsBridge.showQRCodeText(); //showQRText('Emile Berliner \n Born in Germany May 20, 1851, he first worked as a printer, then as a clerk in a \n fabric store. It was here that his talent as an inventor first surfaced. He invented a\nnew loom for weaving cloth. Emile Berliner immigrated to the United States in 1870, following the example of a friend. He spent much of his time at the library\nof the Cooper Institute where he took a keen interest in electricity and sound."'); } function showQRText(text) { var title = poiIB.find('#title h1'); var content = poiIB.find('#content'); var boxTitle = "QR CODE"; var boxContent = text; title.text(boxTitle); content.empty(); content.append(boxContent); poiIB.css('visibility', 'visible'); }
JavaScript
0
@@ -591,24 +591,50 @@ ext(text) %7B%0A + if (text != %22%22) %7B%0A var titl @@ -662,24 +662,28 @@ e h1');%0A + + var content @@ -709,24 +709,28 @@ ent');%0A%0A + + var boxTitle @@ -743,24 +743,28 @@ CODE%22;%0A + + var boxConte @@ -779,16 +779,20 @@ t;%0A%0A + + title.te @@ -805,16 +805,20 @@ Title);%0A + cont @@ -830,16 +830,20 @@ mpty();%0A + cont @@ -866,17 +866,20 @@ ntent);%0A -%0A + poiI @@ -910,10 +910,16 @@ ible');%0A + %7D %0A%7D +%0A
2bbf83c79a1ba863af40a557d78ca442ff7a1fc8
Build bundle in Travis.
test/ui-examples-test.js
test/ui-examples-test.js
const tape = require('tape'), phylotree = require('../dist/phylotree'), express = require('express'), puppeteer = require('puppeteer'); const app = express(); const PORT = process.env.PORT || 8888; const HEADLESS = process.env.HEADLESS == 'false' ? false : true; app.use(express.static('.')); var server, browser, page; function get_example_url(example) { return 'http://localhost:' + PORT + '/examples/' + example; } tape("setup", async function(test) { browser = await puppeteer.launch({ headless: HEADLESS, slowMo: 50, devtools: false, timeout: 10000 }); page = (await browser.pages())[0]; await page.setViewport({ width: 1200, height: 800 }) server = app.listen(PORT, function() { console.log('Started server on port', PORT); }); test.end(); }); tape("Hello world loads", async function(test) { await page.setViewport({ width: 1200, height: 800 }); await page.goto(get_example_url('hello-world')); await page.waitForSelector('#tree_display'); const treeHandle = await page.$('#tree_display'); const treeContents = await page.evaluate( treeContainer => treeContainer.innerHTML, treeHandle ); test.assert(treeContents); test.end(); }); tape("Selctome loads", async function(test) { await page.setViewport({ width: 1200, height: 800 }); await page.goto(get_example_url('selectome')); await page.waitForSelector('#tree_display'); const treeHandle = await page.$('#tree_display'); const treeContents = await page.evaluate( treeContainer => treeContainer.innerHTML, treeHandle ); test.assert(treeContents); test.end(); }); tape("teardown", async function(test) { await browser.close(); server.close(); test.end(); });
JavaScript
0
@@ -1233,16 +1233,17 @@ ape(%22Sel +e ctome lo
86257d6d52f5f53c3880f4e8de4a74a789baae74
Fix copy pasta
banana-stand/app/controllers/song.controller.js
banana-stand/app/controllers/song.controller.js
var server = require('vvps-engine').server, BaseApiController = require('vvps-engine').controllers.base, songController = new BaseApiController(require('../models/song.model.js')), Song = songController.model; /** * Get all songs * @param req * @param res * @param next */ songController.getMany = function (req, res, next) { Song.find({}, function (err, songs) { if (err) { return next(err); } else { res.json(songs); } }); }; /** * Get a shark by its id * @param req * @param res * @param next */ songController.getOne = function (req, res, next) { Song.findById(req.params.id, function (err, shark) { if (err) { return next(err); } else { res.json(shark); } }); }; module.exports = songController;
JavaScript
0.000002
@@ -237,16 +237,62 @@ l songs%0A + * TODO search params -- title & artist match%0A * @para @@ -289,32 +289,32 @@ h%0A * @param req%0A - * @param res%0A * @@ -565,20 +565,19 @@ Get a s -hark +ong by its @@ -727,20 +727,19 @@ (err, s -hark +ong ) %7B%0A%0A @@ -835,12 +835,11 @@ on(s -hark +ong );%0A
296dcb45f7a9f070ebef96edf139cf8ca1664916
Append invisible character to buttery output
modules/buttery.js
modules/buttery.js
/** * Eighteen seconds of spam. */ var readline = require( 'readline' ); var fs = require( 'fs' ); module.exports = { commands: { buttery: { help: 'Sings a lovely song', aliases: [ 'biscuit', 'base', 'wobble' ], privileged: true, // very spammy! command: function ( bot, msg ) { var rl = readline.createInterface( { input: fs.createReadStream( __rootdir + '/data/buttery.txt' ), terminal: false } ); rl.on( 'line', function ( line ) { bot.say( msg.to, line ); } ); } } } };
JavaScript
0.998525
@@ -494,16 +494,50 @@ to, line + + '%5Cu200b' /* zero width space */ );%0A%09%09%09%09
be4b589fd76f20d00aacf86c886807df0289baf3
fix isPlainObject, is comparing object stringified object constructors instead of prototypes (did not work from iframes because Object in iframe is not the same as in parent)
src/utils/isPlainObject.js
src/utils/isPlainObject.js
/** * @param {any} obj The object to inspect. * @returns {boolean} True if the argument appears to be a plain object. */ export default function isPlainObject(obj) { if (!obj) { return false; } return typeof obj === 'object' && Object.getPrototypeOf(obj) === Object.prototype; }
JavaScript
0
@@ -1,8 +1,74 @@ +const fnToString = (fn) =%3E Function.prototype.toString.call(fn);%0A%0A /**%0A * @ @@ -238,16 +238,43 @@ if (!obj + %7C%7C typeof obj !== 'object' ) %7B%0A @@ -298,50 +298,61 @@ %0A%0A -return typeof obj === 'object' &&%0A +const proto = typeof obj.constructor === 'function' ? Obj @@ -375,19 +375,17 @@ Of(obj) -=== +: Object. @@ -394,11 +394,238 @@ ototype; +%0A%0A if (proto === null) %7B%0A return true;%0A %7D%0A%0A var constructor = proto.constructor;%0A%0A return typeof constructor === 'function'%0A && constructor instanceof constructor%0A && fnToString(constructor) === fnToString(Object); %0A%7D%0A
0a6a742e2182dbfa150608a0d01c7abc7150bb29
Remove the loop-bug
role.harvester.js
role.harvester.js
module.exports = { run: function(creep) { if (creep.spawning === false) { if (creep.memory.sourcenum == undefined) { var numEnergySources = creep.room.lookForAtArea(LOOK_ENERGY, 0, 0, 49, 49, true).length; creep.memory.sourcenum = Math.floor(Math.random() * (numEnergySources + 1)); } if (creep.memory.working === true) { if (creep.carry.energy === 0) { creep.memory.working = false; } // First find extenstions to fill var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType === STRUCTURE_EXTENSION) && structure.energy < structure.energyCapacity; } }); if (targets.length > 0) { if (creep.transfer(targets[0], RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) { creep.moveTo(targets[0]); } } else { // Then try towers var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType === STRUCTURE_TOWER) && structure.energy < structure.energyCapacity; } }); if (targets.length > 0) { if (creep.transfer(targets[0], RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) { creep.moveTo(targets[0]); } } else { // Then try spawns var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType === STRUCTURE_SPAWN) && structure.energy < structure.energyCapacity; } }); if (targets.length > 0) { if (creep.transfer(targets[0], RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) { creep.moveTo(targets[0]); } } else { // Then try containers or storage var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType === STRUCTURE_CONTAINER || structure.structureType === STRUCTURE_STORAGE) && structure.store.energy < structure.storeCapacity; } }); if (targets.length > 0) { if (creep.transfer(targets[0], RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) { creep.moveTo(targets[0]); } } else { } } } } } else { if (creep.carry.energy === creep.carryCapacity) { creep.memory.working = true; } else { var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType === STRUCTURE_CONTAINER || structure.structureType === STRUCTURE_STORAGE) && structure.store.energy > creep.carryCapacity; } }); if (targets.length > 0) { var source = targets[0]; if (creep.withdraw(source, RESOURCE_ENERGY, creep.carryCapacity - creep.carry) === ERR_NOT_IN_RANGE) { creep.moveTo(source); } } else { var source = creep.room.find(FIND_SOURCES)[creep.memory.sourcenum]; if (creep.harvest(source) === ERR_NOT_IN_RANGE) { creep.moveTo(source); } } } } } } };
JavaScript
0
@@ -2699,593 +2699,8 @@ e %7B%0A -%0A var targets = creep.room.find(FIND_STRUCTURES, %7B%0A filter: (structure) =%3E %7B%0A return (structure.structureType === STRUCTURE_CONTAINER %7C%7C%0A structure.structureType === STRUCTURE_STORAGE) &&%0A structure.store.energy %3E creep.carryCapacity;%0A %7D%0A %7D);%0A if (targets.length %3E 0) %7B%0A var source = targets%5B0%5D;%0A if (creep.withdraw(source, RESOURCE_ENERGY, creep.carryCapacity - creep.carry) === ERR_NOT_IN_RANGE) %7B%0A creep.moveTo(source);%0A %7D%0A %7D else %7B%0A @@ -2775,34 +2775,32 @@ num%5D;%0A - if (creep.harves @@ -2837,34 +2837,32 @@ ) %7B%0A - creep.moveTo(sou @@ -2867,30 +2867,16 @@ ource);%0A - %7D%0A
5dc3085a812c52f66d3f64c225437da5531d4277
add netease api
routes/netease.js
routes/netease.js
var express = require('express'); var request = require('request'); var router = express.Router(); /* GET users listing. */ router.get('/', function(req, res, next) { res.header("Content-Type", "application/json;charset=utf-8"); //console.log('ref:' + req.header('referer')); var id = req.query.id; var playlist_id = req.query.playlist_id; var url = 'http://music.163.com/api/song/detail/?id='+id+'&ids=%5B'+id+'%5D'; if(playlist_id){ url = 'http://music.163.com/api/playlist/detail/?id='+id+'&ids=%5B'+id+'%5D'; } netease_http(url,function(data){ return res.send(data); }); }); function netease_http(url,callback){ var options = { url: url, headers: { Cookie:'appver=1.5.0.75771;', referer:'http://music.163.com' } }; request(options,function(err,res,body){ if(!err && res.statusCode == 200){ body = JSON.parse(body); callback&&callback(body); }else{ console.log(err); } }); } module.exports = router;
JavaScript
0
@@ -508,32 +508,41 @@ st/detail/?id='+ +playlist_ id+'&ids=%255B'+id @@ -531,32 +531,41 @@ t_id+'&ids=%255B'+ +playlist_ id+'%255D';%0A %7D%0A
f139cafb37f0093ab5379843c33648a792d8d42a
switch to property 'using asked parameter types'
test/arbitrary/command.js
test/arbitrary/command.js
const assert = require('assert'); const jsc = require('jsverify'); const {command} = require('../../src/arbitrary/command'); const GENSIZE = 10; function MyEmptyClass(...params) { this.params = params; }; describe('command', function() { describe('generator', function() { it('should instantiate an object from the given class', function() { const arb = command(MyEmptyClass); var v = arb.generator(GENSIZE); assert.ok(v.command instanceof MyEmptyClass, 'command instance of MyEmptyClass'); assert.ok(Array.isArray(v.parameters), 'parameters is an array'); assert.equal(v.parameters.length, 0, 'parameters array is empty'); }); it('should instantiate using asked parameter types', function() { const arb = command(MyEmptyClass, jsc.nat, jsc.array(jsc.nat), jsc.constant(5)); var v = arb.generator(GENSIZE); assert.ok(v.command instanceof MyEmptyClass, 'command instance of MyEmptyClass'); assert.ok(Array.isArray(v.parameters), 'parameters is an array'); assert.equal(v.parameters.length, 3, 'parameters array contains 3 elements'); assert.equal(typeof(v.parameters[0]), "number", 'first parameter is a number'); assert.ok(Array.isArray(v.parameters[1]), 'second parameter is an array'); assert.equal(typeof(v.parameters[2]), "number", 'third parameter is a number'); assert.deepEqual(v.command.params, v.parameters, "parameters are the one used during instantiation"); }); }); });
JavaScript
0
@@ -723,24 +723,26 @@ %7D);%0D%0A +%0D%0A it(' @@ -826,62 +826,382 @@ nst -a +knownA rb +s = -command(MyEmptyClass, jsc.nat, jsc.array(jsc.nat +%7B%0D%0A %22bool%22 : %7B%0D%0A arb: jsc.bool,%0D%0A check: v =%3E v === true %7C%7C v === false%0D%0A %7D,%0D%0A %22nat%22 : %7B%0D%0A arb: jsc.nat,%0D%0A check: v =%3E typeof(v) === 'number'%0D%0A %7D,%0D%0A %22oneof%22: %7B%0D%0A arb: jsc.oneof(jsc.constant(5 ), j @@ -1216,12 +1216,13 @@ ant( -5)); +42)), %0D%0A @@ -1235,134 +1235,388 @@ -var v = arb.generator(GENSIZE);%0D%0A assert.ok(v.command instanceof MyEmptyClass, 'command instance of MyEmptyClass'); + check: v =%3E v === 5 %7C%7C v === 42%0D%0A %7D,%0D%0A %22array%22: %7B%0D%0A arb: jsc.array(jsc.nat),%0D%0A check: v =%3E Array.isArray(v) && v.find(i =%3E typeof(i) !== 'number') === undefined%0D%0A %7D,%0D%0A %7D;%0D%0A const allowedArbs = jsc.oneof.apply(this, Object.keys(knownArbs).map(v =%3E jsc.constant(v)));%0D%0A %0D%0A @@ -1629,551 +1629,896 @@ +jsc. assert -.ok(Array.isArray(v.parameters), 'parameters is an array');%0D%0A assert.equal(v.parameters.length, 3, 'parameters array contains 3 elements');%0D%0A assert.equal(typeof(v.parameters%5B0%5D), %22number%22, 'first parameter is a number');%0D%0A assert.ok(Array.isArray(v.parameters%5B1%5D), 'second parameter is an array');%0D%0A assert.equal(typeof(v.parameters%5B2%5D), %22number%22, 'third parameter is a number');%0D%0A assert.deepEqual(v.command.params, v.parameters, %22parameters are the one used during instantiation%22 +(jsc.forall(jsc.array(allowedArbs), function(arbsName) %7B%0D%0A const arb = command.apply(this, %5BMyEmptyClass%5D.concat(arbsName.map(v =%3E knownArbs%5Bv%5D.arb)));%0D%0A var v = arb.generator(GENSIZE);%0D%0A var success = true;%0D%0A%0D%0A success = success && v.command instanceof MyEmptyClass;%0D%0A success = success && Array.isArray(v.parameters);%0D%0A success = success && v.parameters.length === arbsName.length;%0D%0A success = success && v.command.params.length === arbsName.length;%0D%0A%0D%0A for (var idx = 0 ; idx !== arbsName.length ; ++idx) %7B%0D%0A success = success && knownArbs%5BarbsName%5Bidx%5D%5D.check(v.parameters%5Bidx%5D);%0D%0A success = success && v.parameters%5Bidx%5D == v.command.params%5Bidx%5D;%0D%0A %7D%0D%0A%0D%0A return success;%0D%0A %7D) );%0D%0A
c175ebb784fe838e2f2b40ef2a2648b6a3e73a46
Fix the tests
test/write-files.test.js
test/write-files.test.js
/** * Tests for the file writer */ const test = require('tape'); const utils = require('./fixture'); const prunk = require('prunk'); const Immutable = require('immutable'); const setup = (mkdirpMock, fsMock) => { prunk.mock('mkdirp', mkdirpMock); prunk.mock('fs-promise', fsMock); return require('../lib/write-files'); }; // Teardown utility const teardown = () => utils.resetTestDoubles('../lib/write-files'); // Default mocks const defFs = { writeFile() { return Promise.resolve(); } }; const defConfig = Immutable.Map(); const defMkdir = (_, cb) => cb(null); test('write-files; exports a function', t => { const writeFiles = setup(); t.plan(1); t.equals(typeof writeFiles, 'function'); t.end(); teardown(); }); test('write-files; creates the output directories of files', t => { const files = Immutable.fromJS([ { outputDirectory: 'a' }, { outputDirectory: 'b' }, { outputDirectory: 'c' } ]); const dirs = files.map( f => f.get('outputDirectory') ); const mock = (name, cb) => { t.true( dirs.contains(name) ); cb(null); }; t.plan( files.count() ); const writeFiles = setup(mock, defFs); writeFiles(defConfig, files) .then( () => t.end() ) .catch( () => t.fail() ); }); test('write-files; writes the files', t => { const files = Immutable.fromJS([ { outputPath: 'a', contents: 'a' }, { outputPath: 'b', contents: 'b' }, { outputPath: 'c', contents: 'c' } ]); const paths = files.map( f => f.get('outputDirectory') ); const mock = { writeFile(file, contents) { t.equal(file, contents); t.true( paths.contains(file) ); return Promise.resovlve(); } }; t.plan( files.count() ); const writeFiles = setup(defMkdir, mock); writeFiles(defConfig, files) .then( () => t.end() ) .catch( () => t.fail() ); });
JavaScript
0.999909
@@ -1111,16 +1111,22 @@ ns(name) +, name );%0A @@ -1293,34 +1293,33 @@ .catch( -() +e =%3E t.fail() );%0A @@ -1309,28 +1309,46 @@ e =%3E t.fail( +e ) ); +%0A%0A teardown(); %0A%7D);%0A%0Atest(' @@ -1605,33 +1605,28 @@ .get('output -Directory +Path ') );%0A%0A c @@ -1709,16 +1709,22 @@ contents +, file );%0A @@ -1793,17 +1793,16 @@ ise.reso -v lve();%0A @@ -1835,32 +1835,36 @@ n( files.count() + * 2 );%0A%0A const w @@ -1979,18 +1979,17 @@ .catch( -() +e =%3E t.fa @@ -1991,16 +1991,34 @@ t.fail( +e ) ); +%0A%0A teardown(); %0A%7D);
de7278a9045655a404c95c1bf64dcec5cc1ed7cf
Add test to catch non-numeric sorting
exercises/triangle/triangle.spec.js
exercises/triangle/triangle.spec.js
var Triangle = require('./triangle'); describe('Triangle', function() { it('equilateral triangles have equal sides', function() { var triangle = new Triangle(2,2,2); expect(triangle.kind()).toEqual('equilateral'); }); xit('larger equilateral triangles also have equal sides', function() { var triangle = new Triangle(10,10,10); expect(triangle.kind()).toEqual('equilateral'); }); xit('isosceles triangles have last two sides equal', function() { var triangle = new Triangle(3,4,4); expect(triangle.kind()).toEqual('isosceles'); }); xit('isosceles trianges have first and last sides equal', function() { var triangle = new Triangle(4,3,4); expect(triangle.kind()).toEqual('isosceles'); }); xit('isosceles triangles have two first sides equal', function() { var triangle = new Triangle(4,4,3); expect(triangle.kind()).toEqual('isosceles'); }); xit('isosceles triangles have in fact exactly two sides equal', function() { var triangle = new Triangle(10,10,2); expect(triangle.kind()).toEqual('isosceles'); }); xit('scalene triangles have no equal sides', function() { var triangle = new Triangle(3,4,5); expect(triangle.kind()).toEqual('scalene'); }); xit('scalene triangles have no equal sides at a larger scale too', function() { var triangle = new Triangle(10,11,12); expect(triangle.kind()).toEqual('scalene'); }); xit('scalene triangles have no equal sides in descending order either', function() { var triangle = new Triangle(5,4,2); expect(triangle.kind()).toEqual('scalene'); }); xit('very small triangles are legal', function() { var triangle = new Triangle(0.4,0.6,0.3); expect(triangle.kind()).toEqual('scalene'); }); xit('test triangles with no size are illegal', function() { var triangle = new Triangle(0,0,0); expect(triangle.kind.bind(triangle)).toThrow(); }); xit('triangles with negative sides are illegal', function() { var triangle = new Triangle(3,4,-5); expect(triangle.kind.bind(triangle)).toThrow(); }); xit('triangles violating triangle inequality are illegal', function() { var triangle = new Triangle(1,1,3); expect(triangle.kind.bind(triangle)).toThrow(); }); xit('edge cases of triangle inequality are in fact legal', function() { var triangle = new Triangle(2,4,2); expect(triangle.kind.bind(triangle)).not.toThrow(); }); xit('triangles violating triangle inequality are illegal 2', function() { var triangle = new Triangle(7,3,2); expect(triangle.kind.bind(triangle)).toThrow(); }); });
JavaScript
0.000015
@@ -2601,12 +2601,188 @@ %0A %7D);%0A%0A + xit('triangles violating triangle inequality are illegal 3', function() %7B%0A var triangle = new Triangle(10,1,3);%0A expect(triangle.kind.bind(triangle)).toThrow();%0A %7D);%0A%0A %7D);%0A
3061f890aa18e405236e0daebe59333e419a796d
Use switch in loadMore onInteract
src/components/MessageTypes/LoadMore.js
src/components/MessageTypes/LoadMore.js
'use strict' import React, { useCallback, useEffect, useRef, useState } from 'react' import PropTypes from 'prop-types' import { useTranslation } from 'react-i18next' import debounce from 'lodash.debounce' function LoadMore ({ parentElement, onActivate, ...rest }) { const [t] = useTranslation() const [paddingTop, setPaddingTop] = useState(0) const lastTouchY = useRef(-1) const activate = useCallback(() => { if (typeof onActivate === 'function') onActivate() }, [onActivate]) const onInteract = useCallback( event => { if (event.type === 'click') activate() else if (event.type === 'wheel') { if (event.deltaY < 0) onScrollUp() else onScrollDown() } else if (event.type === 'touchmove') { const clientY = event.changedTouches[0].clientY if (lastTouchY.current > 0 && clientY - lastTouchY.current > 0) onScrollUp() else onScrollDown() lastTouchY.current = clientY } else if (event.type === 'keydown') { if (event.keyCode === 38) onScrollUp() else if (event.keyCode === 40) onScrollDown() } }, [activate] ) useEffect(() => { if (!parentElement) return parentElement.addEventListener('wheel', onInteract) parentElement.addEventListener('touchmove', onInteract) document.addEventListener('keydown', onInteract) return () => { debouncedOnActivate.cancel() parentElement.removeEventListener('wheel', onInteract) parentElement.removeEventListener('touchmove', onInteract) document.removeEventListener('keydown', onInteract) } }, [parentElement, onInteract]) const debouncedOnActivate = useCallback(debounce(activate, 200), [activate]) function onScrollUp () { setPaddingTop(40) debouncedOnActivate() } function onScrollDown () { setPaddingTop(0) debouncedOnActivate.cancel() } return ( <div style={{ paddingTop: paddingTop > 0 ? paddingTop : '' }} className="firstMessage loadMore" {...rest} onClick={onInteract} > {t('channel.loadMore')} </div> ) } LoadMore.propTypes = { parentElement: PropTypes.instanceOf(Element), onActivate: PropTypes.func } export default LoadMore
JavaScript
0
@@ -541,26 +541,30 @@ =%3E %7B%0A -if +switch (event.type @@ -567,70 +567,91 @@ type - === 'click') activate()%0A else if (event.type === +) %7B%0A case 'click':%0A activate()%0A break%0A case 'wheel' ) %7B%0A @@ -646,20 +646,20 @@ 'wheel' -) %7B%0A +:%0A @@ -693,32 +693,34 @@ ollUp()%0A + else onScrollDow @@ -733,33 +733,30 @@ -%7D else if (event.type === + break%0A case 'to @@ -763,20 +763,20 @@ uchmove' -) %7B%0A +:%0A @@ -819,24 +819,26 @@ %5B0%5D.clientY%0A + if ( @@ -910,32 +910,34 @@ ollUp()%0A + else onScrollDow @@ -932,32 +932,34 @@ onScrollDown()%0A + lastTouc @@ -989,33 +989,30 @@ -%7D else if (event.type === + break%0A case 'ke @@ -1017,20 +1017,20 @@ keydown' -) %7B%0A +:%0A @@ -1060,32 +1060,34 @@ 8) onScrollUp()%0A + else if @@ -1120,24 +1120,73 @@ crollDown()%0A + break%0A default:%0A break%0A %7D%0A
1ac3b0e2ff05dcc781a90abf266b7ca400a3af88
Update index.js
src/with-features/index.js
src/with-features/index.js
import React, { Component } from "react"; import getEnabled from "../utils/get-enabled"; import updateFeaturesWithParams from "../utils/updateFeaturesWithParams"; import PropTypes from "prop-types"; const getEnabledFeatures = (initialFeatures, windowLocationSearch) => getEnabled(updateFeaturesWithParams(initialFeatures, windowLocationSearch)); // withFeatures = (config?: { initialFeatures: Object, windowLocation: Object }) => Component => Component const withFeatures = ( { initialFeatures = {}, windowLocationSearch = typeof window !== "undefined" ? window.location.search : "", features = getEnabledFeatures(initialFeatures, windowLocationSearch) } = {} ) => WrappedComponent => { class withFeaturesHOC extends Component { static childContextTypes = { features: PropTypes.array }; getChildContext() { return { features }; } render() { return ( <WrappedComponent {...this.props} features={features} /> ); } } return withFeaturesHOC; }; export default withFeatures;
JavaScript
0.000002
@@ -412,24 +412,30 @@ Location -: Object +Search: String %7D) =%3E C
62b498af984349b80b0ebcf04c1d0242a3b49116
Update documentation
demo/examples/common.js
demo/examples/common.js
import React from 'react'; import Modules from '../helpers/modules'; import { AwesomeButton, AwesomeButtonProgress } from '../../src/index'; export const properties = [ { name: 'General', props: [ { name: 'button-default-height', type: 'range', max: 100, min: 30, suffix: 'px', }, { name: 'button-default-font-size', type: 'range', max: 25, min: 10, suffix: 'px', }, { name: 'button-default-border-radius', type: 'range', max: 25, suffix: 'px', }, { name: 'button-horizontal-padding', type: 'range', max: 50, suffix: 'px', }, { name: 'button-raise-level', type: 'range', max: 10, suffix: 'px', }, ], }, { name: 'Animations', props: [ { name: 'button-hover-pressure', type: 'range', max: 4, step: 0.5, }, { name: 'transform-speed', type: 'range', max: 0.60, step: 0.025, suffix: 's', }, ], }, { name: 'Primary', props: [ { name: 'button-primary-color', type: 'color', }, { name: 'button-primary-color-dark', type: 'color', }, { name: 'button-primary-color-light', type: 'color', }, { name: 'button-primary-color-hover', type: 'color', }, { name: 'button-primary-border', type: 'border', }, ], }, { name: 'Secondary', props: [ { name: 'button-secondary-color', type: 'color', }, { name: 'button-secondary-color-dark', type: 'color', }, { name: 'button-secondary-color-light', type: 'color', }, { name: 'button-secondary-color-hover', type: 'color', }, { name: 'button-secondary-border', type: 'border', }, ], }, { name: 'Anchor', props: [ { name: 'button-anchor-color', type: 'color', }, { name: 'button-anchor-color-dark', type: 'color', }, { name: 'button-anchor-color-light', type: 'color', }, { name: 'button-anchor-color-hover', type: 'color', }, { name: 'button-anchor-border', type: 'border', }, ], }, ]; export const features = [ 'Look and feel customisable and extendable via SASS variables and lists', 'Use it with CSSModules or Plain CSS (NO inline-styles)', 'Render any tag as the component\'s child (text, icon, img, svg)', 'Animated progress button', 'OnClick bubble animation', ]; export function examples(theme) { return [ { title: 'Installation', command: 'npm install --save react-native-awesome-button', }, { title: 'Multiple Import', jsx: ` import { AwesomeButton, AwesomeButtonProgress, AwesomeButtonShare, } from 'react-awesome-button'; `, }, { title: 'Single Import', jsx: ` import AwesomeButton from 'react-awesome-button/src/components/AwesomeButton'; `, }, { title: 'Primary Button', jsx: '<AwesomeButton type="primary">Primary</AwesomeButton>', component: ( <AwesomeButton cssModule={Modules.Modules[theme]} type="primary" > Primary </AwesomeButton> ), }, { title: 'Secondary Progress Button', jsx: ` <AwesomeButtonProgress type="secondary" size="medium" action={(element, next) => doSomethingThenCall(next)} > Primary </AwesomeButtonProgress>`, component: ( <AwesomeButtonProgress type="secondary" size="medium" action={(element, next) => { setTimeout(() => { next(); }, 1000); }} cssModule={Modules.Modules[theme]} > Progress </AwesomeButtonProgress> ), }, { title: 'Multiple Sizes', jsx: ` <AwesomeButton size="icon" type="primary" > <i className="fa fa-codepen" /> </AwesomeButton> <AwesomeButton size="small" type="primary" > Small </AwesomeButton> <AwesomeButton size="small" type="primary" > Medium </AwesomeButton> <AwesomeButton size="small" type="primary" > Large </AwesomeButton>`, component: ( <div> <AwesomeButton cssModule={Modules.Modules[theme]} size="icon" type="primary" > <i className="fa fa-codepen" aria-hidden /> </AwesomeButton> <AwesomeButton cssModule={Modules.Modules[theme]} size="small" type="primary" > Small </AwesomeButton> <AwesomeButton cssModule={Modules.Modules[theme]} size="medium" type="primary" > Medium </AwesomeButton> <AwesomeButton cssModule={Modules.Modules[theme]} size="large" type="primary" > Large </AwesomeButton> </div> ), }, { title: 'Styling with - CSS', description: 'For styling with CSS you can access all themes on the /dist folder and append it via <link> or import into your .js or .css files.', jsx: 'import \'react-awesome-button/dist/themes/theme-blue.css\';', }, { title: 'Styling with - CSS Modules', description: 'For styling it through CSS Modules, import the file from the themes folder inside the src. You\'ll need a .scss loader in place in order to build it.', jsx: ` import AwesomeButton from 'react-awesome-button/src/components/AwesomeButton'; import styles from 'react-awesome-button/src/styles/themes/theme-blue'; ... function Component() { return ( <AwesomeButton cssModule={styles} type="primary" > Primary Blue Themed Button </AwesomeButton> ); } `, }, ]; }
JavaScript
0
@@ -2957,15 +2957,8 @@ act- -native- awes @@ -3099,12 +3099,13 @@ tonS -hare +ocial ,%0A%7D
c5cdbb1d6244cd5e0a77416c1ef598336de4809a
change deprecated transaction to runInAction
test/observable-stream.js
test/observable-stream.js
'use strict'; const utils = require('../'); const mobx = require('mobx'); const test = require('tape'); const Rx = require("rxjs"); test("to observable", t => { const user = mobx.observable({ firstName: "C.S", lastName: "Lewis" }) mobx.useStrict(false); let values = [] const sub = Rx.Observable .from(utils.toStream(() => user.firstName + user.lastName)) .map(x => x.toUpperCase()) .subscribe(v => values.push(v)) user.firstName = "John" mobx.transaction(() => { user.firstName = "Jane"; user.lastName = "Jack"; }) sub.unsubscribe(); user.firstName = "error"; t.deepEqual(values, [ "JOHNLEWIS", "JANEJACK" ]); t.end(); }) test("from observable", t => { mobx.useStrict(true) const fromStream = utils.fromStream(Rx.Observable.interval(100), -1) const values = []; const d = mobx.autorun(() => { values.push(fromStream.current); }) setTimeout(() => { t.equal(fromStream.current, -1) }, 50) setTimeout(() => { t.equal(fromStream.current, 0) }, 150) setTimeout(() => { t.equal(fromStream.current, 1) fromStream.dispose() }, 250) setTimeout(() => { t.equal(fromStream.current, 1) t.deepEqual(values, [-1, 0, 1]) d() mobx.useStrict(false) t.end() }, 350) })
JavaScript
0.000001
@@ -483,14 +483,14 @@ obx. -transa +runInA ctio
9a56478947c81b6a8d4a12d59f1e6afb32b58008
Add a test for postNewNupicStatus
test/test-shaValidator.js
test/test-shaValidator.js
var assert = require('assert'), shaValidator = require('./../utils/shaValidator.js') repoClientStub = { 'getAllStatusesFor': function(sha, callback) { callback(null, 'fakeStatusHistory'); }, 'validators': { 'excludes': [] } }, repoClientSecondStub = { 'getAllStatusesFor': function(sha, callback) { callback(null, 'fakeStatusHistory'); }, 'validators': { 'excludes': ['FirstValidator'] } }, validatorsStub = [ { 'name': 'FirstValidator', 'priority': 1, 'validate': function(sha, githubUser, statusHistory, repoClient, callback) { assert.equal(sha, 'testSHA', 'in FirstValidator.validate : wrong sha!'); assert.equal(githubUser, 'carlfriess', 'in FirstValidator.validate : wrong githubUser!'); assert.equal(statusHistory, 'fakeStatusHistory', 'in FirstValidator.validate : wrong statusHistory!'); callback(null, { 'state': 'success', 'target_url': 'correctTargetURL' }); } }, { 'name': 'SecondValidator', 'priority': 0, 'validate': function(sha, githubUser, statusHistory, repoClient, callback) { assert.equal(sha, 'testSHA', 'in SecondValidator.validate : wrong sha!'); assert.equal(githubUser, 'carlfriess', 'in SecondValidator.validate : wrong githubUser!'); assert.equal(statusHistory, 'fakeStatusHistory', 'in SecondValidator.validate : wrong statusHistory!'); callback(null, { 'state': 'success', 'target_url': 'otherTargetURL' }); } } ]; describe('shaValidator test', function() { it('Testing with two validators.', function(done) { shaValidator.performCompleteValidation('testSHA', 'carlfriess', repoClientStub, validatorsStub, false, function(err, sha, output, repoClient) { assert(!err, 'Should not be an error'); assert.equal(sha, 'testSHA', 'in shaValidator.performCompleteValidation : wrong sha in output!'); assert.equal(output.state, 'success', 'in shaValidator.performCompleteValidation : wrong state in output : Not success!'); //assert.equal(output.target_url, 'correctTargetURL', 'in shaValidator.performCompleteValidation : wrong target_url in output!'); assert.equal(output.description, 'All validations passed (FirstValidator, SecondValidator)', 'in shaValidator.performCompleteValidation : wrong description in output!'); done(); }); }); it('Testing with two validators. One configured to be excluded.', function(done) { shaValidator.performCompleteValidation('testSHA', 'carlfriess', repoClientSecondStub, validatorsStub, false, function(err, sha, output, repoClient) { assert(!err, 'Should not be an error'); assert.equal(sha, 'testSHA', 'in shaValidator.performCompleteValidation : wrong sha in output!'); assert.equal(output.state, 'success', 'in shaValidator.performCompleteValidation : wrong state in output : Not success!'); assert.equal(output.target_url, 'otherTargetURL', 'in shaValidator.performCompleteValidation : wrong target_url in output!'); assert.equal(output.description, 'All validations passed (SecondValidator [1 skipped])', 'in shaValidator.performCompleteValidation : wrong description in output!'); done(); }); }); });
JavaScript
0
@@ -3635,12 +3635,1007 @@ %0A %7D); +%0A%0A it('Testing postNewNupicStatus', function(done) %7B%0A var mockSha = 'mockSha',%0A mockStatusDetails = %7B%0A 'state': 'success',%0A 'target_url': 'otherTargetURL',%0A 'description': 'description'%0A %7D,%0A statusPosted = null,%0A mockClient = %7B%0A github: %7B%0A statuses: %7B%0A create: function (statusObj) %7B%0A statusPosted = statusObj;%0A %7D%0A %7D%0A %7D%0A %7D;%0A%0A shaValidator.postNewNupicStatus(mockSha, mockStatusDetails, mockClient);%0A%0A assert(statusPosted, 'status should be posted');%0A assert.equal(statusPosted.state, mockStatusDetails.state, 'posted wrong state!');%0A assert.equal(statusPosted.target_url, mockStatusDetails.target_url, 'posted wrong target_url!');%0A assert.equal(statusPosted.description, 'NuPIC Status: ' + mockStatusDetails.description, 'posted wrong state!');%0A%0A done();%0A %7D); %0A%7D);
f900cb77d877db00ded9d07f4705efcd73b41420
remove extra whitespace
test/testium-core.test.js
test/testium-core.test.js
import assert from 'assertive'; import Gofer from 'gofer'; import { getTestium, getBrowser } from '../'; const gofer = new Gofer({ globalDefaults: {}, }); async function fetch(uri, options) { return gofer.fetch(uri, options); } async function fetchResponse(uri, options) { return gofer.fetch(uri, options).getResponse(); } describe('testium-core', () => { let testium; before(async () => { testium = await getTestium(); }); after(() => testium && testium.close()); describe('getNewPageUrl', () => { it('ignores absolute urls', () => { assert.equal('https://www.example.com/?a=b', testium.getNewPageUrl('https://www.example.com', { query: { a: 'b' }, })); }); it('redirects to the target url', async () => { const result = await fetch(testium.getNewPageUrl('/error')); assert.equal('500 SERVER ERROR', result); }); it('supports additional options', async () => { const response = await fetchResponse( testium.getNewPageUrl('/echo', { query: { x: 'y' } }), { json: true }); const echo = response.body; assert.truthy('Sends a valid JSON response', echo); assert.equal('GET', echo.method); assert.equal('/echo?x=y', echo.url); assert.truthy('Sets a cookie', response.headers['set-cookie']); assert.include('Sets a _testium_ cookie', '_testium_=', `${response.headers['set-cookie']}`); }); }); describe('getInitialUrl', () => { it('is a blank page', async () => { const result = await fetch(testium.getInitialUrl()); assert.equal('Initial url returns a blank page', '', result); }); }); describe('getChromeDevtoolsPort', () => { it('returns a number >= 1024 in chrome, throws otherwise', () => { if (testium.browser.capabilities.browserName === 'chrome') { assert.hasType(Number, testium.getChromeDevtoolsPort()); assert.expect(testium.getChromeDevtoolsPort() >= 1024); } else { const err = assert.throws(() => testium.getChromeDevtoolsPort()); assert.equal('Can only get devtools port for chrome', err.message); } }); }); describe('basic navigation', () => { describe('via wd driver', () => { it('can navigate to /index.html', async () => { const { browser } = await getTestium(); await browser.navigateTo('/index.html'); assert.equal('Test Title', await browser.getPageTitle()); }); it('preserves #hash segments of the url', async () => { const { browser } = await getTestium(); await browser.navigateTo('/echo#!/foo?yes=it-is', { headers: { 'x-random-data': 'present', }, }); const hash = await browser.evaluate(() => window.location.href); assert.equal('http://127.0.0.1:4445/echo#!/foo?yes=it-is', hash); // Making sure that headers are correctly forwarded const element = await browser.getElement('pre'); const echo = JSON.parse(await element.text()); assert.equal('present', echo.headers['x-random-data']); }); }); describe('via sync driver', () => { it('can navigate to /index.html', async () => { const browser = await getBrowser({ driver: 'sync' }); browser.navigateTo('/index.html'); assert.equal('Test Title', browser.getPageTitle()); }); it('preserves #hash segments of the url', async () => { const browser = await getBrowser({ driver: 'sync' }); browser.navigateTo('/echo#!/foo?yes=it-is', { headers: { 'x-random-data': 'present', }, }); const hash = browser.evaluate('return "" + window.location.hash;'); assert.equal('#!/foo?yes=it-is', hash); // Making sure that headers are correctly forwarded const echo = JSON.parse(browser.getElement('pre').get('text')); assert.equal('present', echo.headers['x-random-data']); }); }); }); describe('cross-test side effects', () => { describe('changes page size', () => { before(async () => { testium = await getTestium(); }); it('leaves a dirty state', () => testium.browser.setPageSize({ width: 600, height: 800 })); it('can read its own changes', async () => { const pageSize = await testium.browser.getPageSize(); assert.deepEqual({ width: 600, height: 800 }, pageSize); }); }); describe('expects original page size', () => { before(async () => { testium = await getTestium(); }); it('sees the default page size', async () => { const pageSize = await testium.browser.getPageSize(); assert.deepEqual({ height: 768, width: 1024 }, pageSize); }); }); }); describe('getTestium', () => { it('handles alternating drivers', async () => { testium = await getTestium({ driver: 'wd' }); assert.hasType('first wd driver has assertStatusCode()', Function, testium.browser.assertStatusCode); testium = await getTestium({ driver: 'sync' }); assert.hasType('second sync driver has assert.* functions', Object, testium.browser.assert); testium = await getTestium({ driver: 'wd' }); assert.hasType('second wd driver has assertStatusCode()', Function, testium.browser.assertStatusCode); }); }); });
JavaScript
0.999995
@@ -2158,17 +2158,16 @@ %0A %7D);%0A%0A -%0A descri
5151208d82faa5b3f6fe3c9dcb85f8fd30b657a9
test wrong callback type throws right exception
test/tests/events_spec.js
test/tests/events_spec.js
"use strict"; provide(function(exports) { using('lib/component', function(defineComponent) { describe("(Core) events", function() { var Component = (function() { function testComponent() { this.after('initialize', function() { this.testString || (this.testString = ""); this.testString += "-initBase-"; }); } return defineComponent(testComponent, withTestMixin1, withTestMixin2); })(); function withTestMixin1() { this.testVal = 69; this.after('initialize', function() { this.testString || (this.testString = ""); this.testString += "-initTestMixin1-"; }); }; function withTestMixin2() { this.after('initialize', function() { this.testString || (this.testString = ""); this.testString += "-initTestMixin1-"; }); }; ////////////////////////////////////// beforeEach(function() { window.outerDiv = document.createElement('div'); window.innerDiv = document.createElement('div'); window.outerDiv.appendChild(window.innerDiv); document.body.appendChild(window.outerDiv); }); afterEach(function() { document.body.removeChild(window.outerDiv); window.outerDiv = null; window.innerDiv = null; Component.teardownAll(); }); it('bubbles native events between components', function() { var instance1 = new Component(window.innerDiv); var instance2 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance2.on('click', spy); instance1.trigger('click'); expect(spy).toHaveBeenCalled(); }); it('unbinds listeners using "off"', function() { var instance1 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance1.on('click', spy); instance1.off('click', spy); instance1.trigger('click'); expect(spy).not.toHaveBeenCalled(); }); it('correctly unbinds multiple registered events for the same callback function using "off"', function() { var instance1 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance1.on(document, 'event1', spy); instance1.on(document, 'event2', spy); instance1.off(document, 'event1', spy); instance1.off(document, 'event2', spy); instance1.trigger('event1'); instance1.trigger('event2'); expect(spy).not.toHaveBeenCalled(); }); it('does not unbind those registered events that share a callback, but were not sent "off" requests', function() { var instance1 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance1.on(document, 'event1', spy); instance1.on(document, 'event2', spy); instance1.off(document, 'event1', spy); instance1.trigger('event2'); expect(spy).toHaveBeenCalled(); }); it('bubbles custom events between components', function() { var instance1 = new Component(window.innerDiv); var instance2 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance2.on('click', spy); instance1.trigger('click'); expect(spy).toHaveBeenCalled(); }); it('can be attached to any element', function() { var instance1 = new Component(window.innerDiv); var instance2 = new Component(window.outerDiv); var spy = jasmine.createSpy(); instance2.on(document, 'click', spy); instance1.trigger('click'); expect(spy).toHaveBeenCalled(); }); it('makes data and target element available to callback', function() { var instance = new Component(document.body); var data = {blah: 'blah'}; var spy = jasmine.createSpy(); instance.on(document, 'foo', spy); instance.trigger('foo', data); var args = spy.mostRecentCall.args; expect(args[0]).toEqual(jasmine.any($.Event)); expect(args[1]).toEqual(data); }); it('ignores data parameters with value of undefined', function() { var instance = new Component(document.body); var spy = jasmine.createSpy(); instance.on(document, 'foo', spy); instance.trigger('foo', undefined); var args = spy.mostRecentCall.args; expect(args[0]).toEqual(jasmine.any($.Event)); expect(args[1]).not.toBeDefined(); }); it('merges eventData into triggered event data', function() { var instance = new Component(document.body, { eventData: { penguins: 'cool', sheep: 'dull' } }); var data = { sheep: 'thrilling' }; var spy = jasmine.createSpy(); instance.on(document, 'foo', spy); instance.trigger('foo', data); var args = spy.mostRecentCall.args; var returnedData = args[1]; expect(returnedData.penguins).toBeDefined(); expect(returnedData.penguins).toBe('cool'); expect(returnedData.sheep).toBeDefined(); expect(returnedData.sheep).toBe('thrilling'); }); exports(1); }); }); });
JavaScript
0.000003
@@ -4545,32 +4545,378 @@ d();%0A %7D);%0A%0A + it('throws the expected error when attempting to bind to wrong type', function() %7B%0A var instance = new Component(document.body);%0A var badBind = function() %7Binstance.on(document, 'foo', %22turkey%22)%7D;%0A expect(badBind).toThrow(%22Unable to bind to 'foo' because the given callback is not a function or an object%22);%0A %7D);%0A%0A it('merges
bc0e04fad14c341e0a297e14da55318490f08c12
Test cargo tessel sdk install/uninstall
test/unit/cargo-tessel.js
test/unit/cargo-tessel.js
// Test dependencies are required and exposed in common/bootstrap.js require('../common/bootstrap'); /*global CrashReporter */ exports['Cargo Subcommand (cargo tessel ...)'] = { setUp(done) { this.sandbox = sinon.sandbox.create(); this.info = this.sandbox.stub(log, 'info'); this.error = this.sandbox.stub(log, 'error'); this.parse = this.sandbox.spy(cargo.nomnom, 'parse'); this.runBuild = this.sandbox.stub(rust, 'runBuild').returns(Promise.resolve()); done(); }, tearDown(done) { this.sandbox.restore(); done(); }, build: function(test) { // test.expect(3); var tarball = new Buffer([0x00]); var buildOp = Promise.resolve(tarball); // Prevent the tarball from being logged this.sandbox.stub(console, 'log'); this.runBuild.returns(buildOp); cargo(['build']); buildOp.then(() => { test.equal(console.log.callCount, 1); test.equal(console.log.lastCall.args[0], tarball); test.deepEqual(this.parse.lastCall.args, [['build']]); test.deepEqual(this.runBuild.lastCall.args, [ { isCli: false, binary: undefined } ]); test.done(); }); } };
JavaScript
0
@@ -276,24 +276,72 @@ g, 'info');%0A + this.warn = this.sandbox.stub(log, 'warn');%0A this.err @@ -614,18 +614,8 @@ uild -: function (tes @@ -622,19 +622,16 @@ t) %7B%0A - // test.ex @@ -639,9 +639,9 @@ ect( -3 +4 );%0A%0A @@ -687,22 +687,23 @@ var b -uildOp +resolve = Promi @@ -836,22 +836,23 @@ eturns(b -uildOp +resolve );%0A%0A @@ -879,14 +879,15 @@ b -uildOp +resolve .the @@ -1180,12 +1180,966 @@ %7D);%0A %7D +,%0A%0A sdkInstall(test) %7B%0A test.expect(2);%0A%0A var iresolve = Promise.resolve();%0A%0A this.install = this.sandbox.stub(rust.cargo, 'install').returns(iresolve);%0A%0A cargo.nomnom.globalOpts(%7Bsubcommand: 'install'%7D);%0A cargo(%5B'sdk', 'install'%5D);%0A%0A iresolve.then(() =%3E %7B%0A test.equal(this.install.callCount, 1);%0A test.deepEqual(this.install.lastCall.args%5B0%5D, %7B '0': 'sdk', subcommand: 'install', _: %5B 'sdk', 'install' %5D %7D);%0A test.done();%0A %7D);%0A %7D,%0A sdkUninstall(test) %7B%0A test.expect(2);%0A%0A var iresolve = Promise.resolve();%0A%0A this.uninstall = this.sandbox.stub(rust.cargo, 'uninstall').returns(iresolve);%0A%0A cargo.nomnom.globalOpts(%7Bsubcommand: 'uninstall'%7D);%0A cargo(%5B'sdk', 'uninstall'%5D);%0A%0A iresolve.then(() =%3E %7B%0A test.equal(this.uninstall.callCount, 1);%0A test.deepEqual(this.uninstall.lastCall.args%5B0%5D, %7B '0': 'sdk', subcommand: 'uninstall', _: %5B 'sdk', 'uninstall' %5D %7D);%0A test.done();%0A %7D);%0A %7D, %0A%7D;%0A
bc8b847d897af07399d267c86abe0d8ebc88b623
check for corner case of too few flickr images when cycling images
javascripts/app.js
javascripts/app.js
jQuery(document).ready(function ($) { var flickrImages = []; var flickrLimit = 20; var previousIdx = 9999; var timeout = {}; /* ---------------------------------------------------------------------- * Flickr image magick * ----------------------------------------------------------------------*/ $(document).ready(function() { // Prevent .main-image-div from getting the child divs' onclicks $(".content").click(function(e) { e.stopPropagation(); }) // this function sticks a random image from flickrImages[] in to the // background of .main-image-div and causes a JS link to the image's // flickrpage newImage = function() { var num=0; while ((num=Math.floor(Math.random()*flickrImages.length)) == previousIdx) {} previousIdx = num; $('.main-image-div').css("background", "url("+flickrImages[num].image_b+") no-repeat 50%"); $('.float').html("<h4>"+flickrImages[num].title+"</h4>"); $('.main-image-div').click( function() { window.location = flickrImages[num].link; }); }; // Do the jquery flick goodness $.jflickrfeed( { limit: flickrLimit, qstrings: { tags: 'publish', id: '60827818@N07' }, useTemplate: false, itemCallback: function(item){ flickrImages.push(item); } }, function(){ newImage(); timeout = setInterval(newImage, 10000) }); }); /* TABS --------------------------------- */ /* Remove if you don't need :) */ function activateTab($tab) { var $activeTab = $tab.closest('dl').find('dd.active'), contentLocation = $tab.children('a').attr("href") + 'Tab'; // Strip off the current url that IE adds contentLocation = contentLocation.replace(/^.+#/, '#'); // Strip off the current url that IE adds contentLocation = contentLocation.replace(/^.+#/, '#'); //Make Tab Active $activeTab.removeClass('active'); $tab.addClass('active'); //Show Tab Content $(contentLocation).closest('.tabs-content').children('li').hide(); $(contentLocation).css('display', 'block'); } $('dl.tabs dd a').on('click.fndtn', function (event) { activateTab($(this).parent('dd')); }); if (window.location.hash) { activateTab($('a[href="' + window.location.hash + '"]')); $.foundation.customForms.appendCustomMarkup(); } /* ALERT BOXES ------------ */ $(".alert-box").delegate("a.close", "click", function(event) { event.preventDefault(); $(this).closest(".alert-box").fadeOut(function(event){ $(this).remove(); }); }); /* PLACEHOLDER FOR FORMS ------------- */ /* Remove this and jquery.placeholder.min.js if you don't need :) */ $('input, textarea').placeholder(); /* TOOLTIPS ------------ */ $(this).tooltips(); /* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */ // $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'left'}); // $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'left'}); // $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'left'}); // $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'left'}); /* DROPDOWN NAV ------------- */ var lockNavBar = false; /* Windows Phone, sadly, does not register touch events :( */ if (Modernizr.touch || navigator.userAgent.match(/Windows Phone/i)) { $('.nav-bar a.flyout-toggle').on('click.fndtn touchstart.fndtn', function(e) { e.preventDefault(); var flyout = $(this).siblings('.flyout').first(); if (lockNavBar === false) { $('.nav-bar .flyout').not(flyout).slideUp(500); flyout.slideToggle(500, function(){ lockNavBar = false; }); } lockNavBar = true; }); $('.nav-bar>li.has-flyout').addClass('is-touch'); } else { $('.nav-bar>li.has-flyout').hover(function() { $(this).children('.flyout').show(); }, function() { $(this).children('.flyout').hide(); }); } /* DISABLED BUTTONS ------------- */ /* Gives elements with a class of 'disabled' a return: false; */ /* SPLIT BUTTONS/DROPDOWNS */ $('.button.dropdown > ul').addClass('no-hover'); $('.button.dropdown').on('click.fndtn touchstart.fndtn', function (e) { e.stopPropagation(); }); $('.button.dropdown.split span').on('click.fndtn touchstart.fndtn', function (e) { e.preventDefault(); $('.button.dropdown').not($(this).parent()).children('ul').removeClass('show-dropdown'); $(this).siblings('ul').toggleClass('show-dropdown'); }); $('.button.dropdown').not('.split').on('click.fndtn touchstart.fndtn', function (e) { e.preventDefault(); $('.button.dropdown').not(this).children('ul').removeClass('show-dropdown'); $(this).children('ul').toggleClass('show-dropdown'); }); $('body, html').on('click.fndtn touchstart.fndtn', function () { $('.button.dropdown ul').removeClass('show-dropdown'); }); // Positioning the Flyout List var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)').outerHeight() - 1, largeButtonHeight = $('.button.large.dropdown').outerHeight() - 1, smallButtonHeight = $('.button.small.dropdown').outerHeight() - 1, tinyButtonHeight = $('.button.tiny.dropdown').outerHeight() - 1; $('.button.dropdown:not(.large):not(.small):not(.tiny) > ul').css('top', normalButtonHeight); $('.button.dropdown.large > ul').css('top', largeButtonHeight); $('.button.dropdown.small > ul').css('top', smallButtonHeight); $('.button.dropdown.tiny > ul').css('top', tinyButtonHeight); });
JavaScript
0
@@ -496,17 +496,16 @@ );%0A%09%7D)%0A%0A -%0A %09// this @@ -702,16 +702,42 @@ while + (flickrImages.length%3E1 && ((num=M @@ -801,16 +801,12 @@ Idx) +) %7B%7D -%09 %0A%09
000ec8b33bd96e3187e522630770624c2f923599
fix linter error
src/@ui/ConnectedImage/SkeletonImage.tests.js
src/@ui/ConnectedImage/SkeletonImage.tests.js
import React from 'react'; import { Text } from 'react-native'; import renderer from 'react-test-renderer'; import SkeletonImage from './SkeletonImage'; describe('the SkeletonImage component', () => { it('should render a loading state', () => { const tree = renderer.create( <SkeletonImage onReady={false} />, ); expect(tree).toMatchSnapshot(); }); });
JavaScript
0.000002
@@ -24,45 +24,8 @@ t';%0A -import %7B Text %7D from 'react-native';%0A impo
9babccc978ed4d7124631bd4289fb3e9da117dff
copy change
development/scripts/views/stats_coffee.js
development/scripts/views/stats_coffee.js
"use strict"; const StatsView = require("./stats"); const xhr = require("xhr"); module.exports = StatsView.extend({ template: ` <section class="category coffee"> <header> <div class="art"></div> <div class="copy"> <p></p> </div> </header> <main class="stats"> <div class="stats-container"> <div class="stat"> <h3>Average Daily Coffees</h3> <h2>0.94</h2> </div> <div class="stat"> <h3>Est. Total Volume (L)</h3> <h2>122.62</h2> </div> <div class="stat"> <h3>Median Daily Coffees</h3> <h2>1</h2> </div> <div class="stat"> <h3>Average Weekday Coffees</h3> <h2>0.98</h2> </div> <div class="stat"> <h3>Average Weekend Coffees</h3> <h2>0.87</h2> </div> <div class="stat"> <h3>Est. Days Without</h3> <h2>73</h2> </div> <div class="stat"> <h3>Est. Days with More than Usual</h3> <h2>51</h2> </div> <div class="stat"> <h3>Most Daily Coffees</h3> <h2>3</h2> </div> <div class="stat"> <h3>Longest streak (coffees)</h3> <h2>15</h2> </div> <div class="stat"> <h3>Longest dry spell (days)</h3> <h2>3</h2> </div> <div class="stat"> <h3>Total Days Recorded</h3> <h2>286</h2> </div> </div> </main> </section> ` });
JavaScript
0.000001
@@ -935,13 +935,14 @@ han -Usual +Median %3C/h3
aae8a628d0f82561d9087e1b8fbd8024d7b4fbf4
remove dead code
client/scripts/task/controller/cam-tasklist-task-groups-ctrl.js
client/scripts/task/controller/cam-tasklist-task-groups-ctrl.js
define([ 'angular' ], function( angular ) { 'use strict'; var GROUP_TYPE = 'candidate'; return [ '$scope', '$translate', '$q', 'Notifications', 'camAPI', function( $scope, $translate, $q, Notifications, camAPI ) { // setup ////////////////////////////////////////////// var Task = camAPI.resource('task'); var task = null; var NEW_GROUP = { groupId : null, type: GROUP_TYPE }; var newGroup = $scope.newGroup = angular.copy(NEW_GROUP); var taskGroupsData = $scope.taskGroupsData; var groupsChanged = $scope.groupsChanged; var errorHandler = $scope.errorHandler(); $scope._groups = []; var messages = {}; $translate([ 'FAILURE', 'INIT_GROUPS_FAILURE', 'ADD_GROUP_FAILED', 'REMOVE_GROUP_FAILED' ]) .then(function(result) { messages.failure = result.FAILURE; messages.initGroupsFailed = result.INIT_GROUPS_FAILURE; messages.addGroupFailed = result.ADD_GROUP_FAILED; messages.removeGroupFailed = result.REMOVE_GROUP_FAILED; }); // observe //////////////////////////////////////////////////////// $scope.modalGroupsState = taskGroupsData.observe('groups', function(groups) { $scope._groups = angular.copy(groups) || []; $scope.validateNewGroup(); }); taskGroupsData.observe('task', function (_task) { task = _task; }); // actions /////////////////////////////////////////////////////// $scope.$watch('modalGroupsState.$error', function (error){ if (error) { Notifications.addError({ status: messages.failure, message: messages.initGroupsFailed, exclusive: true, scope: $scope }); } }); $scope.addGroup = function () { var taskId = task.id; groupsChanged(); delete newGroup.error; Task.identityLinksAdd(taskId, newGroup, function(err) { if (err) { // return Notifications.addError({ // status: messages.failure, // message: messages.addGroupFailed, // exclusive: true, // scope: $scope // }); return errorHandler('TASK_UPDATE_ERROR', err); } $scope.taskGroupForm.$setPristine(); $scope._groups.push({id: newGroup.groupId}); newGroup = $scope.newGroup = angular.copy(NEW_GROUP); }); }; $scope.removeGroup = function(group, index) { var taskId = task.id; groupsChanged(); Task.identityLinksDelete(taskId, {type: GROUP_TYPE, groupId: group.id}, function(err) { if (err) { return Notifications.addError({ status: messages.failure, message: messages.removeGroupFailed, exclusive: true, scope: $scope }); } $scope._groups.splice(index, 1); }); }; $scope.validateNewGroup = function () { delete newGroup.error; if ($scope.taskGroupForm && $scope.taskGroupForm.newGroup) { $scope.taskGroupForm.newGroup.$setValidity('duplicate', true); var newGroupId = newGroup.groupId; if (newGroupId) { for(var i = 0, currentGroup; !!(currentGroup = $scope._groups[i]); i++) { if (newGroupId === currentGroup.id) { newGroup.error = { message: 'DUPLICATE_GROUP' }; $scope.taskGroupForm.newGroup.$setValidity('duplicate', false); } } } } }; $scope.isValid = function () { if (!newGroup.groupId || newGroup.error) { return false; } return true; }; }]; });
JavaScript
0.998565
@@ -1988,222 +1988,8 @@ ) %7B%0A - // return Notifications.addError(%7B%0A // status: messages.failure,%0A // message: messages.addGroupFailed,%0A // exclusive: true,%0A // scope: $scope%0A // %7D);%0A%0A
1544405be029163cfa0dd5719d16833b72ae82d1
Add preset to jest babel config
.babelrc.js
.babelrc.js
const withTests = { presets: [ [ '@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3', targets: { node: 'current' } }, ], ], plugins: [ 'babel-plugin-require-context-hook', 'babel-plugin-dynamic-import-node', '@babel/plugin-transform-runtime', ], }; module.exports = { ignore: [ './lib/codemod/src/transforms/__testfixtures__', './lib/postinstall/src/__testfixtures__', ], presets: [ ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], '@babel/preset-typescript', '@babel/preset-react', '@babel/preset-flow', ], plugins: [ [ '@babel/plugin-proposal-decorators', { legacy: true, }, ], ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-proposal-export-default-from', '@babel/plugin-syntax-dynamic-import', ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], 'babel-plugin-macros', ['emotion', { sourceMap: true, autoLabel: true }], ], env: { test: withTests, }, overrides: [ { test: './examples/vue-kitchen-sink', env: { test: withTests, }, }, { test: './lib', presets: [ ['@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', corejs: '3' }], '@babel/preset-react', ], plugins: [ ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], '@babel/plugin-proposal-export-default-from', '@babel/plugin-syntax-dynamic-import', ['@babel/plugin-proposal-class-properties', { loose: true }], 'babel-plugin-macros', ['emotion', { sourceMap: true, autoLabel: true }], '@babel/plugin-transform-react-constant-elements', 'babel-plugin-add-react-displayname', ], env: { test: withTests, }, }, { test: [ './lib/node-logger', './lib/codemod', './addons/storyshots', '**/src/server/**', '**/src/bin/**', ], presets: [ [ '@babel/preset-env', { shippedProposals: true, useBuiltIns: 'usage', targets: { node: '8.11', }, corejs: '3', }, ], ], plugins: [ 'emotion', 'babel-plugin-macros', '@babel/plugin-transform-arrow-functions', '@babel/plugin-transform-shorthand-properties', '@babel/plugin-transform-block-scoping', '@babel/plugin-transform-destructuring', ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-export-default-from', ], env: { test: withTests, }, }, ], };
JavaScript
0
@@ -1176,24 +1176,66 @@ chen-sink',%0A + presets: %5B'@vue/babel-preset-jsx'%5D,%0A env: %7B
1eca38d5b3f226163d33f2c2d8bde7eac79d9193
Add a "Do Not Track" policy to tracking entrypoint
utils/track.js
utils/track.js
import fetch from 'isomorphic-fetch' import Router from 'next/router' const reportView = () => { const { pathname } = window.location fetch('https://sc-micro-analytics.now.sh' + pathname) .then(() => { console.log(`Reported page view for ${pathname}.`) }) .catch(err => { console.warn('Could not report page view:', err) }) } reportView() Router.onRouteChangeComplete = () => { reportView() }
JavaScript
0.000002
@@ -64,16 +64,377 @@ outer'%0A%0A +if (%0A (navigator.doNotTrack && navigator.doNotTrack !== 'no') %7C%7C%0A window.doNotTrack %7C%7C%0A navigator.msDoNotTrack%0A) %7B%0A console.log('Tracking is disabled due to the Do Not Track policy of this browser.')%0A%7D else %7B%0A console.log('Tracking is enabled. If you do not want your page view to be tracked enable the %22Do Not Track%22 policy in your browser settings.')%0A%0A const re @@ -452,16 +452,18 @@ () =%3E %7B%0A + const @@ -494,16 +494,18 @@ cation%0A%0A + fetch( @@ -556,16 +556,18 @@ me)%0A + .then(() @@ -568,24 +568,26 @@ hen(() =%3E %7B%0A + consol @@ -631,16 +631,18 @@ ame%7D.%60)%0A + %7D)%0A @@ -644,16 +644,18 @@ %7D)%0A + .catch(e @@ -658,24 +658,26 @@ ch(err =%3E %7B%0A + consol @@ -723,18 +723,24 @@ rr)%0A + %7D)%0A + %7D%0A%0A + repo @@ -749,16 +749,18 @@ View()%0A%0A + Router.o @@ -790,16 +790,18 @@ () =%3E %7B%0A + report @@ -807,10 +807,14 @@ tView()%0A + %7D%0A %7D%0A
81178452cc15448c2857b1d7df4eb3b7f55f3bd7
Test phase
node-hsync/main.js
node-hsync/main.js
var program = require('commander'); var Process = require('process'); var util = require('util'); var Hubic = require('./hubic.js'); var HFile = require('./hfile.js'); var LFile = require('./lfile.js'); var Syncer = require('./syncer.js'); program.option("-u, --username <login>", "Hubic username"); program.option("-p, --passwd <passwd>", "Hubic password"); program.option("-s, --source <path>", "Source directory"); program.option("-d, --destination <path>", "Destination directory"); program.option("--hubic-log", "Enable hubic log"); program.option("--hubic-login-log", "Enable hubic login log"); program.option("--swift-log", "Enable swift log"); program.option("--swift-request-log", "Enable swift request log"); program.option("--sync-log", "Enable sync processus log"); program.option("-n, --dry-run", "Perform a trial run with no changes made"); program.option("--max-request <number>", "Max simultaneous swift requests (does not include upload requests)", parseInt); program.option("--max-upload <number>", "Max simultaneous updload requests", parseInt); program.option("--uploading-prefix <prefix>", "Upload filename prefix"); program.option("--backup-directory-name <name>", "Backup directory name"); program.option("--container-name <name>", "Swift container name"); program.option("--purge-uploading-files", "Delete not used uploading files"); program.option("--progress", "Show progress"); program.option("--versioning", "Move modified or deleted file to a backup folder"); program.option("--certPath", "Specify the path of the SSL certificate (for authentication process)"); program.option("--keyPath", "Specify the path of the SSL key (for authentication process)"); program.option("--tokenPath", "Specify the path of the last authorized token"); program.option("--clientID", "Specify the Hubic application Client ID"); program.option("--clientSecret", "Specify the Hubic application Client Secret"); program.parse(Process.argv); if (!program.username) { console.log("Username is not specified"); Process.exit(1); } function goHubic() { if (!program.token) { console.log("Token is not specified"); Process.exit(1); } if (!program.source) { console.log("Source is not specified"); Process.exit(1); } if (!program.destination) { console.log("Destination is not specified"); Process.exit(1); } var hubic = new Hubic(program.username, program.passwd, program, function( error, hubic) { if (error) { console.error("Error: " + error); return; } var syncer = new Syncer(hubic, program); var hroot = HFile.createRoot(hubic); var lroot = LFile.createRoot(program.source); hroot.find(program.destination, function(error, hfile) { if (error) { console.error("ERROR: " + error); return; } syncer.sync(lroot, hfile, function(error) { if (error) { console.error("ERROR: " + error); return; } }); }); }); } if (!program.token) { var auth = new Authentification(); if (program.certPath) { auth.certPath = program.certPath; } if (program.keyPath) { auth.keyPath = program.keyPath; } if (program.clientID) { auth.clientID = program.clientID; } if (program.clientSecret) { auth.clientSecret = program.clientSecret; } auth.username = program.username; auth.process(function(error, password) { if (error) { console.error("Can not authenticate: " + error); Process.exit(1); } program.passwd = password; goHubic(); }); } else { goHubic(); }
JavaScript
0.000001
@@ -232,16 +232,73 @@ er.js'); +%0Avar Authentification = require('./authentification.js'); %0A%0Aprogra
b8ec958f89616a5e6071c0d6586f0a4126582370
Add addPolyfills function
utils/utils.js
utils/utils.js
/* * utils.js: utility functions */ export { getScrollOffsets, drag }; /* * getScrollOffsets: Use x and y scroll offsets to calculate positioning * coordinates that take into account whether the page has been scrolled. * From Mozilla Developer Network: Element.getBoundingClientRect() */ function getScrollOffsets () { let t; let xOffset = (typeof window.pageXOffset === "undefined") ? (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollLeft === 'number' ? t : document.body).ScrollLeft : window.pageXOffset; let yOffset = (typeof window.pageYOffset === "undefined") ? (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop === 'number' ? t : document.body).ScrollTop : window.pageYOffset; return { x: xOffset, y: yOffset }; } /* * drag: Add drag and drop functionality to an element by setting this * as its mousedown handler. Depends upon getScrollOffsets function. * From JavaScript: The Definitive Guide, 6th Edition (slightly modified) */ function drag (elementToDrag, dragCallback, event) { let scroll = getScrollOffsets(); let startX = event.clientX + scroll.x; let startY = event.clientY + scroll.y; let origX = elementToDrag.offsetLeft; let origY = elementToDrag.offsetTop; let deltaX = startX - origX; let deltaY = startY - origY; if (dragCallback) dragCallback(elementToDrag); if (document.addEventListener) { document.addEventListener("mousemove", moveHandler, true); document.addEventListener("mouseup", upHandler, true); } else if (document.attachEvent) { elementToDrag.setCapture(); elementToDrag.attachEvent("onmousemove", moveHandler); elementToDrag.attachEvent("onmouseup", upHandler); elementToDrag.attachEvent("onlosecapture", upHandler); } if (event.stopPropagation) event.stopPropagation(); else event.cancelBubble = true; if (event.preventDefault) event.preventDefault(); else event.returnValue = false; function moveHandler (e) { if (!e) e = window.event; let scroll = getScrollOffsets(); elementToDrag.style.left = (e.clientX + scroll.x - deltaX) + "px"; elementToDrag.style.top = (e.clientY + scroll.y - deltaY) + "px"; elementToDrag.style.cursor = "move"; if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; } function upHandler (e) { if (!e) e = window.event; elementToDrag.style.cursor = "grab"; elementToDrag.style.cursor = "-moz-grab"; elementToDrag.style.cursor = "-webkit-grab"; if (document.removeEventListener) { document.removeEventListener("mouseup", upHandler, true); document.removeEventListener("mousemove", moveHandler, true); } else if (document.detachEvent) { elementToDrag.detachEvent("onlosecapture", upHandler); elementToDrag.detachEvent("onmouseup", upHandler); elementToDrag.detachEvent("onmousemove", moveHandler); elementToDrag.releaseCapture(); } if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; } }
JavaScript
0.000001
@@ -63,16 +63,30 @@ ts, drag +, addPolyfills %7D;%0A%0A/*%0A @@ -3121,8 +3121,1392 @@ ;%0A %7D%0A%7D%0A +%0A/*%0A* addPolyfills: Add polyfill implementations for JavaScript object methods%0A* defined in ES6 and used by bookmarklets:%0A* 1. Array.prototype.find%0A* 2. String.prototype.includes%0A*/%0Afunction addPolyfills () %7B%0A%0A // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find%0A if (!Array.prototype.find) %7B%0A Array.prototype.find = function (predicate) %7B%0A if (this === null) %7B%0A throw new TypeError('Array.prototype.find called on null or undefined');%0A %7D%0A if (typeof predicate !== 'function') %7B%0A throw new TypeError('predicate must be a function');%0A %7D%0A var list = Object(this);%0A var length = list.length %3E%3E%3E 0;%0A var thisArg = arguments%5B1%5D;%0A var value;%0A%0A for (var i = 0; i %3C length; i++) %7B%0A value = list%5Bi%5D;%0A if (predicate.call(thisArg, value, i, list)) %7B%0A return value;%0A %7D%0A %7D%0A return undefined;%0A %7D;%0A %7D%0A%0A // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes%0A if (!String.prototype.includes) %7B%0A String.prototype.includes = function (search, start) %7B%0A if (typeof start !== 'number') %7B%0A start = 0;%0A %7D%0A%0A if (start + search.length %3E this.length) %7B%0A return false;%0A %7D%0A else %7B%0A return this.indexOf(search, start) !== -1;%0A %7D%0A %7D;%0A %7D%0A%7D%0A
19935ca18a36e73a225f38fd96d0d7a2376baf81
Set UeberDB cache to 0 in remove-orphan-db-records.js
scripts/remove-orphan-db-records.js
scripts/remove-orphan-db-records.js
#! /usr/bin/env node // vim:set sw=2 ts=2 sts=2 ft=javascript expandtab: 'use strict'; // Dependencies var program = require('commander'), fs = require('fs'), path = require('path'); var _cliProgress = require('cli-progress'); var ueberDB = require('ueberdb2'), jsonminify = require('jsonminify'), eachSeries = require('async/eachSeries'), eachOfSeries = require('async/eachOfSeries'); // Arguments handling program .version('0.1.0') .option('-s, --settings <file>', '[MANDATORY] the path to your Etherpad\'s settings.json file') .option('-n, --dryrun', '(optional) just count the number of pads that would have been normally deleted') .parse(process.argv); // Check that we have the mandatory arguments if (!program.settings) { console.log(''); console.log('====================================================================='); console.log(' You must provide the path to your Etherpad\'s settings.json file!'); console.log('====================================================================='); program.help(); } // Try to parse the settings var settingsFilename = path.resolve(program.settings); var settingsStr = fs.readFileSync(settingsFilename).toString(); var settings; try { if(settingsStr) { settingsStr = jsonminify(settingsStr).replace(',]',']').replace(',}','}'); settings = JSON.parse(settingsStr); } } catch(e) { console.error('There was an error processing your settings.json file: '+e.message); process.exit(1); } // Open the database var db = new ueberDB.database(settings.dbType, settings.dbSettings); /* * Functions */ function exitIfErr(err) { console.log('====================='); console.error(err); return db.doShutdown(function() { process.exit(1); }); } // Remove record from DB function removeRecord(key, callback) { db.remove(key, function(err) { if (err) { return exitIfErr(err); } callback(); }); } /* * Start searching */ db.init(function(err) { if (err) { return exitIfErr(err); } db.get('mypads:conf:allowEtherPads', function(err, val) { if (err) { return exitIfErr(err); } // Yeah, we don't want to remove anonymous pads if (val !== false) { console.log(' _______________'); console.log('|===============|'); console.log('|: .---------. :|'); console.log('|: | HAL-9000| :|'); console.log('|: \'---------\' :|'); console.log('|: :| ________________________________________'); console.log('|: :| / I\'m sorry, Dave, I\'m afraid I can\'t do \\'); console.log('|: :| \\ that. /'); console.log('|: :| ----------------------------------------'); console.log('|: _ :| /'); console.log('|: ,` `. :| __/'); console.log('|: : (o) : :|'); console.log('|: `. _ ,` :|'); console.log('|: :|'); console.log('|:_____________:|'); console.log('|:=============:|'); console.log('|:*%*%*%*%*%*%*:|'); console.log('|:%*%*%*%*%*%*%:|'); console.log('|:*%*%*%*%*%*%*:|'); console.log('|:%*%*%*%*%*%*%:|'); console.log('\'===============\''); console.log(''); console.log('================================================'); console.log('It seems that you allow anonymous pads.'); console.log('This script would delete all the anonymous pads.'); console.log('Exiting'); console.log('================================================'); return db.doShutdown(function() { process.exit(1); }); } // readonly2pad:* records are leftovers of deleted pads before #197 was solved db.findKeys('readonly2pad:*', null, function(err, keys) { if (err) { return exitIfErr(err); } var candidatesForDeletion = 0; if (keys.length === 0) { console.log('No pads to check.'); return db.doShutdown(function() { process.exit(0); }); } console.log(keys.length+' pad(s) to check.'); // I love progress bars, it's cool var bar = new _cliProgress.Bar({ format: '[{bar}] {percentage}% | ETA: {eta}s | {val}/{tot}', stopOnComplete: true, hideCursor: true, barsize: 60, fps: 60 }, _cliProgress.Presets.shades_grey); bar.start(2 * keys.length, 0, { val: 0, tot: keys.length }); // For each readonly2pad record, do pad existence check eachOfSeries(keys, function(readonly2pad, index, next) { bar.increment(1, { val: index + 1 }); // First, get the padId db.get(readonly2pad, function(err, padId) { if (err) { return exitIfErr(err); } // Then, check if the pad exists in MyPads db.get('mypads:pad:'+padId, function(err, val) { if (err) { return exitIfErr(err); } // Launch a delete process if the pad doesn't exist if (val === null) { if (program.dryrun) { bar.increment(); candidatesForDeletion++; return next(); } // Cascade deletion process // 1. Delete the readonly2pad record db.remove(readonly2pad, function(err) { if (err) { return exitIfErr(err); } // 2. Delete the pad2readonly:padId record db.remove('pad2readonly:'+padId, function(err) { if (err) { return exitIfErr(err); } // 3. Delete the pad:padId record db.remove('pad:'+padId, function(err) { if (err) { return exitIfErr(err); } // 4. Check for revs records db.findKeys('pad:'+padId+':revs:*', null, function(err, keys) { if (err) { return exitIfErr(err); } // 5. Delete the revs records eachSeries(keys, removeRecord, function(err) { if (err) { return exitIfErr(err); } // 6. Check for chat records db.findKeys('pad:'+padId+':chat:*', null, function(err, keys) { if (err) { return exitIfErr(err); } // 7. Delete the chat records eachSeries(keys, removeRecord, function(err){ if (err) { return exitIfErr(err); } bar.increment(); return next(); }); }); }); }); }); }); }); } else { // No deletion needed bar.increment(); return next(); } }); }); }, function(err) { if (err) { return exitIfErr(err); } // Give time for progress bar to update before exiting setTimeout(function() { console.log(keys.length+' pad(s) checked.'); if (program.dryrun) { console.log(candidatesForDeletion+' pad(s) would have been deleted.'); } return db.doShutdown(function() { process.exit(0); }); }, 100); }); }); }); });
JavaScript
0.000001
@@ -1610,16 +1610,46 @@ Settings +, %7Bcache: 0, writeInterval: 0%7D );%0A%0A/*%0A
8b7e30ae70a8e0b103b032cea69b6214b553710f
Fix test
tests/e2e/reports_spec.js
tests/e2e/reports_spec.js
/*global browser:false, element:false, by:false */ 'use strict'; //https://github.com/angular/protractor/blob/master/docs/api.md //GetAttribute() returns "boolean" values and will return either "true" or null browser.get('/'); describe('Reports List', function() { it('should have a Report Editor title', function(){ expect(browser.getTitle()).toBe('Report Editor'); }); it('Should show have at least one report', function() { element.all(by.repeater('report in reports')).then(function(reportList){ expect(reportList.length).toBeGreaterThan(0); }); }); }); describe('Report Selection', function() { var deleteBtn = element(by.id('delete-reports')); var toggle = element(by.model('toggle')); var checkboxes = element.all(by.model('selectedReports[report._id]')); it('should have all reports unchecked', function(){ expect(toggle.getAttribute('checked')).toBe(null); expect(deleteBtn.isDisplayed()).toBe(false); }); it('should select all reports when clicking on the toggle', function(){ toggle.click(); expect(toggle.getAttribute('checked')).toBe('true'); expect(deleteBtn.isDisplayed()).toBe(true); checkboxes.each(function(element){ expect(element.getAttribute('checked')).toBe('true'); }); }); it('the toggle should be undeterminate if we unselect a report', function(){ var report = checkboxes.first(); report.click(); expect(report.getAttribute('checked')).toBe(null); expect(toggle.getAttribute('indeterminate')).toBe('true'); }); it('the toggle shouldn\'t be undeterminate if all reports are selected or unselected', function(){ var report = checkboxes.first(); report.click(); expect(report.getAttribute('checked')).toBe('true'); checkboxes.each(function(element) { element.click(); expect(element.getAttribute('checked')).toBe(null); }); expect(toggle.getAttribute('indeterminate')).toBe(null); expect(deleteBtn.isDisplayed()).toBe(false); checkboxes.each(function(element) { element.click(); expect(element.getAttribute('checked')).toBe('true'); }); expect(deleteBtn.isDisplayed()).toBe(true); expect(toggle.getAttribute('indeterminate')).toBe(null); }); }); /* describe('Creates and Deletes a Report', function(){ var createBtn = element(by.id('create-report')); var originalReportCount; var deleteBtn = element(by.id('delete-reports')); it('should create a new report', function(){ element.all(by.repeater('report in reports')).then(function(reportList){ originalReportCount = reportList.length; }); createBtn.click(); var input = element(by.model('report.name')); input.sendKeys('myuniquereport'); element(by.css('form[name="newReportForm"]')).submit(); element(by.id('reports')).click(); element.all(by.repeater('report in reports')).then(function(reportList){ expect(reportList.length).toBe(originalReportCount + 1); }); }); it('should delete a report', function() { var checkbox = element.all(by.model('selectedReports[report._id]')).last(); checkbox.click(); deleteBtn.click(); element(by.id('confirm-delete-reports')).click(); element.all(by.repeater('report in reports')).then(function(reportList){ expect(reportList.length).toBe(originalReportCount); }); }); }); */
JavaScript
0.000004
@@ -1556,32 +1556,213 @@ ')).toBe(null);%0A + checkboxes.count().then(function(count)%7B%0A if(count === 1) %7B%0A expect(toggle.getAttribute('indeterminate')).toBe(null);%0A %7D else %7B%0A expect(t @@ -1808,24 +1808,50 @@ Be('true');%0A + %7D%0A %7D);%0A %7D);%0A
ba0d3d373e89fb8a589d785abb058a127f78cc1f
Update config.js
samples/config.js
samples/config.js
var QBApp = { appId: 92, authKey: 'wJHdOcQSxXQGWx5', authSecret: 'BTFsj7Rtt27DAmT' }; var QBUsers = [ { id: 2077886, login: '@user1', password: 'x6Bt0VDy5', full_name: 'User 1' }, { id: 2077894, login: '@user2', password: 'x6Bt0VDy5', full_name: 'User 2' }, { id: 2077896, login: '@user3', password: 'x6Bt0VDy5', full_name: 'User 3' }, { id: 2077897, login: '@user4', password: 'x6Bt0VDy5', full_name: 'User 4' }, { id: 2077900, login: '@user5', password: 'x6Bt0VDy5', full_name: 'User 5' }, { id: 2077901, login: '@user6', password: 'x6Bt0VDy5', full_name: 'User 6' }, { id: 2077902, login: '@user7', password: 'x6Bt0VDy5', full_name: 'User 7' }, { id: 2077904, login: '@user8', password: 'x6Bt0VDy5', full_name: 'User 8' }, { id: 2077906, login: '@user9', password: 'x6Bt0VDy5', full_name: 'User 9' }, { id: 2077907, login: '@user10', password: 'x6Bt0VDy5', full_name: 'User 10' }, { id: 2327456, login: 'androidUser1', password: 'x6Bt0VDy5', full_name: 'Web user 1' }, { id: 2077906, login: 'androidUser2', password: 'x6Bt0VDy5', full_name: 'Web user 2' } ];
JavaScript
0.000002
@@ -1197,38 +1197,38 @@ %7D,%0A %7B%0A id: 2 -077906 +344849 ,%0A login: 'an
5b2f6697acd10851a49bb2fdf2040043dc15b039
use people API for sample (#2528)
samples/oauth2.js
samples/oauth2.js
// Copyright 2012 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. 'use strict'; const fs = require('fs'); const path = require('path'); const http = require('http'); const url = require('url'); const opn = require('open'); const destroyer = require('server-destroy'); const {google} = require('googleapis'); const plus = google.plus('v1'); /** * To use OAuth2 authentication, we need access to a a CLIENT_ID, CLIENT_SECRET, AND REDIRECT_URI. To get these credentials for your application, visit https://console.cloud.google.com/apis/credentials. */ const keyPath = path.join(__dirname, 'oauth2.keys.json'); let keys = {redirect_uris: ['']}; if (fs.existsSync(keyPath)) { keys = require(keyPath).web; } /** * Create a new OAuth2 client with the configured keys. */ const oauth2Client = new google.auth.OAuth2( keys.client_id, keys.client_secret, keys.redirect_uris[0] ); /** * This is one of the many ways you can configure googleapis to use authentication credentials. In this method, we're setting a global reference for all APIs. Any other API you use here, like google.drive('v3'), will now use this auth client. You can also override the auth client at the service and method call levels. */ google.options({auth: oauth2Client}); /** * Open an http server to accept the oauth callback. In this simple example, the only request to our webserver is to /callback?code=<code> */ async function authenticate(scopes) { return new Promise((resolve, reject) => { // grab the url that will be used for authorization const authorizeUrl = oauth2Client.generateAuthUrl({ access_type: 'offline', scope: scopes.join(' '), }); const server = http .createServer(async (req, res) => { try { if (req.url.indexOf('/oauth2callback') > -1) { const qs = new url.URL(req.url, 'http://localhost:3000') .searchParams; res.end('Authentication successful! Please return to the console.'); server.destroy(); const {tokens} = await oauth2Client.getToken(qs.get('code')); oauth2Client.credentials = tokens; // eslint-disable-line require-atomic-updates resolve(oauth2Client); } } catch (e) { reject(e); } }) .listen(3000, () => { // open the browser to the authorize url to start the workflow opn(authorizeUrl, {wait: false}).then(cp => cp.unref()); }); destroyer(server); }); } async function runSample() { // retrieve user profile const res = await plus.people.get({userId: 'me'}); console.log(res.data); } const scopes = ['https://www.googleapis.com/auth/plus.me']; authenticate(scopes) .then(client => runSample(client)) .catch(console.error);
JavaScript
0
@@ -828,19 +828,21 @@ %0Aconst p -lus +eople = googl @@ -844,19 +844,21 @@ google.p -lus +eople ('v1');%0A @@ -3087,19 +3087,21 @@ await p -lus +eople .people. @@ -3109,20 +3109,78 @@ et(%7B -userId: 'me' +%0A resourceName: 'people/me',%0A personFields: 'emailAddresses',%0A %7D);%0A @@ -3223,16 +3223,19 @@ opes = %5B +%0A 'https:/ @@ -3263,16 +3263,95 @@ uth/ -plus.me' +contacts.readonly',%0A 'https://www.googleapis.com/auth/user.emails.read',%0A 'profile',%0A %5D;%0Aa
99efb92fe23fe0fc2910c55b048e28d3de8bd797
Replace React.addons.classSet with classnames
src/Autosuggest.js
src/Autosuggest.js
'use strict'; var React = require('react/addons'); var guid = 0; var Autosuggest = React.createClass({ propTypes: { initialValue: React.PropTypes.string, // Input's initial value inputId: React.PropTypes.string, // Input's id inputPlaceholder: React.PropTypes.string, // Input's placeholder suggestions: React.PropTypes.func, // Function to get the suggestions suggestionRenderer: React.PropTypes.func // Function to render a single suggestion }, getDefaultProps: function() { return { initialValue: '', inputId: null, inputPlaceholder: null }; }, getInitialState: function() { guid += 1; this.id = guid; this.cache = {}; return { value: this.props.initialValue, suggestions: [], focusedSuggestionIndex: null, valueBeforeUpDown: null // When user interacts using the Up and Down keys, // this field remembers input's value prior to // interaction in order to revert back if ESC hit. // See: http://www.w3.org/TR/wai-aria-practices/#autocomplete }; }, getSuggestions: function(input) { if (input.length === 0) { this.setState({ suggestions: [], focusedSuggestionIndex: null, valueBeforeUpDown: null }); } else if (this.cache[input]) { this.setState({ suggestions: this.cache[input], focusedSuggestionIndex: null, valueBeforeUpDown: null }); } else { this.props.suggestions(input, function(error, suggestions) { if (error) { throw error; } else { this.cache[input] = suggestions; this.setState({ suggestions: suggestions, focusedSuggestionIndex: null, valueBeforeUpDown: null }); } }.bind(this)); } }, focusOnSuggestion: function(suggestionIndex) { var newState = { focusedSuggestionIndex: suggestionIndex, value: (suggestionIndex === null ? this.state.valueBeforeUpDown : this.state.suggestions[suggestionIndex]) }; if (this.state.valueBeforeUpDown === null) { newState.valueBeforeUpDown = this.state.value; } this.setState(newState); }, onInputChange: function(event) { var newValue = event.target.value; this.setState({ value: newValue, valueBeforeUpDown: null }); this.getSuggestions(newValue); }, onInputKeyDown: function(event) { var newState, newSuggestionIndex; switch (event.keyCode) { case 13: // enter this.setState({ suggestions: [], focusedSuggestionIndex: null, valueBeforeUpDown: null }); break; case 27: // escape newState = { suggestions: [], valueBeforeUpDown: null }; if (this.state.valueBeforeUpDown !== null) { newState.value = this.state.valueBeforeUpDown; } else if (this.state.suggestions.length === 0) { newState.value = ''; } this.setState(newState); break; case 38: // up if (this.state.suggestions.length === 0) { this.getSuggestions(this.state.value); } else { if (this.state.focusedSuggestionIndex === 0) { newSuggestionIndex = null; } else if (this.state.focusedSuggestionIndex === null) { newSuggestionIndex = this.state.suggestions.length - 1; } else { newSuggestionIndex = this.state.focusedSuggestionIndex - 1; } this.focusOnSuggestion(newSuggestionIndex); } event.preventDefault(); // Prevent the cursor from jumping to input's start break; case 40: // down if (this.state.suggestions.length === 0) { this.getSuggestions(this.state.value); } else { if (this.state.focusedSuggestionIndex === null) { newSuggestionIndex = 0; } else if (this.state.focusedSuggestionIndex === this.state.suggestions.length - 1) { newSuggestionIndex = null; } else { newSuggestionIndex = this.state.focusedSuggestionIndex + 1; } this.focusOnSuggestion(newSuggestionIndex); } break; } }, onInputBlur: function() { this.setState({ suggestions: [], valueBeforeUpDown: null }); }, onSuggestionMouseEnter: function(suggestionIndex) { this.setState({ focusedSuggestionIndex: suggestionIndex }); }, onSuggestionMouseLeave: function() { this.setState({ focusedSuggestionIndex: null }); }, onSuggestionMouseDown: function(suggestion) { this.setState({ value: suggestion, suggestions: [], focusedSuggestionIndex: null, valueBeforeUpDown: null }, function() { // This code executes after the component is re-rendered this.refs.input.getDOMNode().focus(); }); }, renderSuggestions: function() { if (this.state.value === '' || this.state.suggestions.length === 0) { return ''; } var content = this.state.suggestions.map(function(suggestion, index) { var classes = React.addons.classSet({ 'react-autosuggest__suggestion': true, 'react-autosuggest__suggestion--focused': index === this.state.focusedSuggestionIndex }); var suggestionContent = this.props.suggestionRenderer ? this.props.suggestionRenderer(suggestion, this.state.valueBeforeUpDown || this.state.value) : suggestion; return ( <div id={'react-autosuggest-' + this.id + '-suggestion-' + index} className={classes} role="option" key={'suggestion' + index} onMouseEnter={this.onSuggestionMouseEnter.bind(this, index)} onMouseLeave={this.onSuggestionMouseLeave} onMouseDown={this.onSuggestionMouseDown.bind(this, suggestion)}> {suggestionContent} </div> ); }, this); return ( <div id={'react-autosuggest-' + this.id} className="react-autosuggest__suggestions" role="listbox"> {content} </div> ); }, render: function() { var ariaActivedescendant = this.state.focusedSuggestionIndex === null ? null : 'react-autosuggest-' + this.id + '-suggestion-' + this.state.focusedSuggestionIndex; return ( <div className="react-autosuggest"> <input id={this.props.inputId} type="text" value={this.state.value} placeholder={this.props.inputPlaceholder} role="combobox" aria-autocomplete="list" aria-owns={'react-autosuggest-' + this.id} aria-expanded={this.state.suggestions.length > 0} aria-activedescendant={ariaActivedescendant} ref="input" onChange={this.onInputChange} onKeyDown={this.onInputKeyDown} onBlur={this.onInputBlur} /> {this.renderSuggestions()} </div> ); } }); module.exports = Autosuggest;
JavaScript
0.000465
@@ -38,14 +38,47 @@ eact -/addon +');%0Avar classnames = require('classname s'); @@ -5022,43 +5022,102 @@ -this.refs.input.getDOMNode().focus( +setTimeout(function() %7B%0A React.findDOMNode(this.refs.input).focus();%0A %7D.bind(this) );%0A @@ -5359,29 +5359,18 @@ s = -React.addons.classSet +classnames (%7B%0A
318568ef96b963f1dca06813b44aa8db0ad8ee23
Update index.spec.js
tests/unit/index.spec.js
tests/unit/index.spec.js
import chai from 'chai'; import chaiJsonSchema from 'chai-json-schema'; import schemas from 'jsfile-schemas'; import JsFile from 'JsFile'; import OoxmlEngine from './../../src/index'; chai.use(chaiJsonSchema); const assert = chai.assert; describe('jsFile-ooxml', () => { let files; const documentSchema = schemas.document; before(() => { files = window.files; }); it('should exist', () => { assert.isFunction(OoxmlEngine); }); it('should read the file', function () { this.timeout(15000); const queue = []; for (let name in files) { if (files.hasOwnProperty(name)) { const jf = new JsFile(files[name], { workerPath: '/base/dist/workers/' }); const promise = jf.read() .then(done, done); queue.push(promise); function done (result) { assert.instanceOf(result, JsFile.Document, name); const json = result.json(); const html = result.html(); const text = html.textContent || ''; assert.jsonSchema(json.content, documentSchema, name); assert.notEqual(text.length, 0, `File ${name} shouldn't be empty`); assert.notEqual(result.name.length, 0, `Engine should parse a name of file ${name}`); } } } return Promise.all(queue); }); });
JavaScript
0.000002
@@ -1202,16 +1202,8 @@ json -.content , do @@ -1506,8 +1506,9 @@ %7D);%0A%7D); +%0A
009d81819b84ff27276bf72b1a978831449d32b0
Load all macros aliases on test
tests/unit/macro-test.js
tests/unit/macro-test.js
import Ember from "ember"; import { alias, empty, notEmpty, none, not, bool, match, equal } from "ember-computed-decorators"; import { module, test, skip } from "qunit"; const { get, set } = Ember; module('macro decorator'); test('alias', function(assert) { var didInit = false; var obj = Ember.Object.extend({ init() { this._super(...arguments); this.first = 'rob'; this.last = 'jackson'; }, /* jshint ignore:start */ @alias('first') firstName, @empty('first') hasNoFirstName, @notEmpty('first') hasFirstName, @none('first') hasNoneFirstName, @not('first') notFirstName, @bool('first') boolFirstName, @match('first', /rob/) firstNameMatch, @equal('first', 'rob') firstNameEqual, // @gt() // @gte // @lt // @lte // @and // @or // @any // @oneWay /* jshint ignore:end */ name() { didInit = true; } }).create(); assert.equal(obj.get('firstName'), 'rob'); assert.equal(obj.get('hasNoFirstName'), false); assert.equal(obj.get('hasFirstName'), true); assert.equal(obj.get('hasNoneFirstName'), false); assert.equal(obj.get('notFirstName'), false); assert.equal(obj.get('boolFirstName'), true); assert.equal(obj.get('firstNameMatch'), true); assert.equal(obj.get('firstNameEqual'), true); });
JavaScript
0
@@ -45,66 +45,242 @@ ,%0A -empty,%0A notEmpty,%0A none,%0A not,%0A bool,%0A match,%0A equal +and,%0A bool,%0A collect,%0A empty,%0A equal,%0A filter,%0A filterBy,%0A gt,%0A gte,%0A lt,%0A lte,%0A map,%0A mapBy,%0A match,%0A max,%0A min,%0A none,%0A not,%0A notEmpty,%0A oneWay,%0A or,%0A readOnly,%0A reads,%0A setDiff,%0A sort,%0A sum,%0A union,%0A uniq %0A%7D f
15c7c23367e1a665a3aff8527a194a012ae2503a
Fix forceRecur when GC is the only payment processor in use
js/gcform.js
js/gcform.js
// This ensures that the is_recur check box is always checked if a GoCardless payment processor is selected. document.addEventListener('DOMContentLoaded', function () { // This next line gets swapped out by PHP var goCardlessProcessorIDs = []; var isRecurInput = document.getElementById('is_recur'); var ppRadios = document.querySelectorAll('input[name="payment_processor_id"]'); var goCardlessProcessorSelected; var selectedProcessorName; isRecurInput.addEventListener('change', function(e) { if (!isRecurInput.checked && goCardlessProcessorSelected) { e.preventDefault(); e.stopPropagation(); forceRecurring(true); } }); function forceRecurring(withAlert) { isRecurInput.checked = true; if (withAlert) { alert("Contributions made with " + selectedProcessorName + " must be recurring."); } var fakeEvent = new Event('change'); isRecurInput.dispatchEvent(fakeEvent); } function gcFixRecur() { var ppID; [].forEach.call(ppRadios, function(r) { if (r.checked) { ppID = parseInt(r.value); var label = document.querySelector('label[for="' + r.id + '"]'); selectedProcessorName = label ? label.textContent : 'Direct Debit'; } }); goCardlessProcessorSelected = (goCardlessProcessorIDs.indexOf(ppID) > -1); if (goCardlessProcessorSelected) { forceRecurring(); } } [].forEach.call(ppRadios, function(r) { r.addEventListener('click', gcFixRecur); }); gcFixRecur(); });
JavaScript
0
@@ -350,16 +350,30 @@ ('input%5B +type=%22radio%22%5D%5B name=%22pa @@ -765,24 +765,61 @@ ithAlert) %7B%0A + if (selectedProcessorName) %7B%0A alert( @@ -895,16 +895,96 @@ ing.%22);%0A + %7D%0A else %7B%0A alert(%22Contributions must be recurring.%22);%0A %7D%0A %7D%0A @@ -1091,16 +1091,26 @@ FixRecur +FromRadios () %7B%0A @@ -1535,22 +1535,105 @@ ;%0A %7D%0A -%0A %7D%0A%0A + if (ppRadios.length %3E 1) %7B%0A // We have radio inputs to select the processor.%0A %5B%5D.for @@ -1670,16 +1670,18 @@ ) %7B%0A + r.addEve @@ -1714,18 +1714,32 @@ ecur +FromRadios );%0A + %7D);%0A%0A + gc @@ -1746,17 +1746,497 @@ FixRecur -();%0A +FromRadios();%0A %7D%0A else %7B%0A var ppInput = document.querySelectorAll('input%5Btype=%22hidden%22%5D%5Bname=%22payment_processor_id%22%5D');%0A if (ppInput.length === 1) %7B%0A // We have a single payment processor involved that won't be changing.%0A var ppID = parseInt(ppInput%5B0%5D.value);%0A goCardlessProcessorSelected = (goCardlessProcessorIDs.indexOf(ppID) %3E -1);%0A if (goCardlessProcessorSelected) %7B%0A forceRecurring();%0A %7D%0A %7D%0A // else: no idea, let's do nothing.%0A %7D %0A%7D);%0A
6a490657bfa0925c3ac94384d2e06c5e0f18df23
Fix 'helper.equal' function to compare objects correctly
js/helper.js
js/helper.js
(function(app) { 'use strict'; var helper = {}; helper.randomString = function(len) { var s = []; for (var i = 0, n = Math.ceil(len / 7); i < n; i++) { s.push(Math.random().toString(36).slice(-7)); } return s.join('').slice(-len); }; helper.encodePath = function(str) { return str.split('/').map(function(s) { return encodeURIComponent(s); }).join('/'); }; helper.clamp = function(number, lower, upper) { return Math.min(Math.max(number, lower), upper); }; helper.inherits = function(ctor, superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true, }, }); return ctor; }; helper.identity = function(value) { return value; }; helper.equal = function(a, b) { if (a === b) { return true; } if (a == null || b == null || typeof a !== 'object' || typeof b !== 'object') { return (a === b); } var keys = Object.keys(a); if (keys.length !== Object.keys(b).length) { return false; } return keys.every(function(key) { return helper.equal(a[key], b[key]); }); }; helper.toArray = function(value) { return Array.prototype.slice.call(value); }; helper.values = function(obj) { return Object.keys(obj).map(function(key) { return obj[key]; }); }; helper.extend = function(obj, src) { Object.keys(src).forEach(function(key) { obj[key] = src[key]; }); return obj; }; helper.clone = function(obj) { return helper.extend({}, obj); }; helper.pick = function(obj, keys) { return keys.reduce(function(ret, key) { if (obj.hasOwnProperty(key)) { ret[key] = obj[key]; } return ret; }, {}); }; helper.dig = function() { return helper.toArray(arguments).reduce(function(obj, key) { return (typeof obj === 'object') ? obj[key] : null; }); }; helper.sortBy = function(array, iteratee) { var isCallback = (typeof iteratee === 'function'); return array.sort(function(a, b) { var l = (isCallback ? iteratee(a) : a[iteratee]); var r = (isCallback ? iteratee(b) : b[iteratee]); if (l < r) { return -1; } if (l > r) { return 1; } return 0; }); }; helper.removeAt = function(array, index) { if (index < 0 || index >= array.length) { throw new RangeError('Invalid index'); } array.splice(index, 1); }; helper.remove = function(array, item) { helper.removeAt(array, array.indexOf(item)); }; helper.moveToBack = function(array, item) { helper.remove(array, item); array.push(item); }; helper.findIndex = function(array, callback) { for (var i = 0, len = array.length; i < len; i++) { if (callback(array[i], i, array)) { return i; } } return -1; }; helper.findLastIndex = function(array, callback) { for (var i = array.length - 1; i >= 0; i--) { if (callback(array[i], i, array)) { return i; } } return -1; }; helper.find = function(array, callback) { var index = helper.findIndex(array, callback); return (index !== -1 ? array[index] : null); }; helper.findLast = function(array, callback) { var index = helper.findLastIndex(array, callback); return (index !== -1 ? array[index] : null); }; helper.flatten = function(array) { return Array.prototype.concat.apply([], array); }; helper.wrapper = function() { var Wrapper = function(self, wrapper) { return Object.defineProperty(wrapper, 'unwrap', { value: Wrapper.unwrap.bind(self), }); }; Wrapper.unwrap = function(key) { if (key === Wrapper.KEY) { return this; } }; Wrapper.KEY = {}; return Wrapper; }; if (typeof module !== 'undefined' && module.exports) { module.exports = helper; } else { app.helper = helper; } })(this.app || (this.app = {}));
JavaScript
0.021258
@@ -1209,32 +1209,58 @@ ) %7B%0A return + (b.hasOwnProperty(key) && helper.equal(a%5B @@ -1272,16 +1272,17 @@ b%5Bkey%5D) +) ;%0A %7D)
79a373ec421a17a6acbf1a59c389624d29538f95
Correct test case 1 to 4 for AboutInheritance.js
koans/AboutInheritance.js
koans/AboutInheritance.js
function Muppet(age, hobby) { this.age = age; this.hobby = hobby; this.answerNanny = function(){ return "Everything's cool!"; } } function SwedishChef(age, hobby, mood) { Muppet.call(this, age, hobby); this.mood = mood; this.cook = function() { return "Mmmm soup!"; } } SwedishChef.prototype = new Muppet(); describe("About inheritance", function() { beforeEach(function(){ this.muppet = new Muppet(2, "coding"); this.swedishChef = new SwedishChef(2, "cooking", "chillin"); }); it("should be able to call a method on the derived object", function() { expect(this.swedishChef.cook()).toEqual(FILL_ME_IN); }); it("should be able to call a method on the base object", function() { expect(this.swedishChef.answerNanny()).toEqual(FILL_ME_IN); }); it("should set constructor parameters on the base object", function() { expect(this.swedishChef.age).toEqual(FILL_ME_IN); expect(this.swedishChef.hobby).toEqual(FILL_ME_IN); }); it("should set constructor parameters on the derived object", function() { expect(this.swedishChef.mood).toEqual(FILL_ME_IN); }); }); // http://javascript.crockford.com/prototypal.html Object.prototype.beget = function () { function F() {} F.prototype = this; return new F(); } function Gonzo(age, hobby, trick) { Muppet.call(this, age, hobby); this.trick = trick; this.doTrick = function() { return this.trick; } } //no longer need to call the Muppet (base type) constructor Gonzo.prototype = Muppet.prototype.beget(); //note: if you're wondering how this line affects the below tests, the answer is that it doesn't. //however, it does do something interesting -- it makes this work: // var g = new Gonzo(...); // g instanceOf Muppet //true describe("About Crockford's inheritance improvement", function() { beforeEach(function(){ this.gonzo = new Gonzo(3, "daredevil performer", "eat a tire"); }); it("should be able to call a method on the derived object", function() { expect(this.gonzo.doTrick()).toEqual(FILL_ME_IN); }); it("should be able to call a method on the base object", function() { expect(this.gonzo.answerNanny()).toEqual(FILL_ME_IN); }); it("should set constructor parameters on the base object", function() { expect(this.gonzo.age).toEqual(FILL_ME_IN); expect(this.gonzo.hobby).toEqual(FILL_ME_IN); }); it("should set constructor parameters on the derived object", function() { expect(this.gonzo.trick).toEqual(FILL_ME_IN); }); });
JavaScript
0.000082
@@ -631,34 +631,36 @@ ()).toEqual( -FILL_ME_IN +%22Mmmm soup!%22 );%0A %7D);%0A %0A @@ -778,34 +778,44 @@ ()).toEqual( -FILL_ME_IN +%22Everything's cool!%22 );%0A %7D);%0A %0A @@ -925,34 +925,25 @@ ge).toEqual( -FILL_ME_IN +2 );%0A expec @@ -972,34 +972,33 @@ by).toEqual( -FILL_ME_IN +%22cooking%22 );%0A %7D);%0A %0A @@ -1112,34 +1112,33 @@ od).toEqual( -FILL_ME_IN +%22chillin%22 );%0A %7D);%0A%7D);
895c9f16aca4c85dfd6f1eafe8b4db1d72b267ab
improve javascript
marginotes.js
marginotes.js
var marginotes = function (options) { var options = options || {} $('body').append('<div class = "margintooltip" style = "display:none;"></div>') var field = options.field || "desc" var spans = this.filter("span") spans.css({ 'border-bottom': '1px dashed #337ab7', 'cursor': 'help' }) this.hover(function (e) { var description = $(this).attr(field) var parent = $(this.parentElement) var position = parent.position() var tooltip = $('.margintooltip') var width = Math.min(options.width || 100, position.left) if (width < 60 || !description) return var tooltipStyle = { "position": "absolute", "border-right": "solid 2px #337ab7", "width": "50px", "font-size": "13px", "text-align": "right", "padding-right": "7px", "top": position.top, "left": position.left - width - 5, "min-height": parent.height(), "width": width } tooltip.css(tooltipStyle) tooltip.text(description) tooltip.stop() tooltip.fadeIn({duration:100, queue: false}) }, function () { $('.margintooltip').stop() $('.margintooltip').fadeOut({duration:100}) }) } window.jQuery.prototype.marginotes = window.$.prototype.marginotes = marginotes
JavaScript
0.000316
@@ -33,20 +33,16 @@ ns) %7B%0A -var options @@ -56,16 +56,92 @@ ns %7C%7C %7B%7D +;%0A var field = options.field %7C%7C 'desc';%0A var spans = this.filter('span');%0A %0A $('bo @@ -163,19 +163,17 @@ iv class - = += %22margint @@ -185,19 +185,17 @@ p%22 style - = += %22display @@ -195,16 +195,17 @@ display: + none;%22%3E%3C @@ -215,80 +215,9 @@ v%3E') -%0A var field = options.field %7C%7C %22desc%22%0A var spans = this.filter(%22span%22) +; %0A s @@ -226,16 +226,20 @@ ns.css(%7B +%0A 'border @@ -270,26 +270,16 @@ 37ab7',%0A - 'cur @@ -290,19 +290,22 @@ : 'help' +%0A %7D) +; %0A this. @@ -366,16 +366,17 @@ r(field) +; %0A var @@ -406,16 +406,17 @@ Element) +; %0A var @@ -444,16 +444,17 @@ sition() +; %0A var @@ -483,16 +483,17 @@ ooltip') +; %0A var @@ -546,16 +546,18 @@ on.left) +;%0A %0A if @@ -588,31 +588,43 @@ ion) + %7B%0A return +; %0A -var +%7D%0A%0A tooltip Styl @@ -623,55 +623,31 @@ ltip -Style = %7B%0A %22position%22: %22absolute%22, +%0A .css(%7B %0A -%22 + ' bord @@ -654,20 +654,20 @@ er-right -%22: %22 +': ' solid 2p @@ -675,25 +675,25 @@ #337ab7 -%22 +' ,%0A %22width%22: @@ -688,32 +688,11 @@ -%22width%22: %2250px%22,%0A %22 + ' font @@ -700,25 +700,25 @@ size -%22: %22 +': ' 13px -%22 +' ,%0A %22tex @@ -717,37 +717,90 @@ -%22text-align%22: %22r + 'left': position.left - width - 5,%0A 'min-height': parent.he ight -%22 +() ,%0A %22pad @@ -795,17 +795,19 @@ ,%0A -%22 + ' padding- @@ -815,24 +815,24 @@ ight -%22: %227px%22 +': '7px' ,%0A %22top @@ -831,23 +831,19 @@ -%22top%22: + ' position .top @@ -842,20 +842,29 @@ tion -.top +': 'absolute' ,%0A %22lef @@ -863,86 +863,68 @@ -%22left%22: position.left - width - 5,%0A %22min-height%22: parent.height() + 'text-align': 'right',%0A 'top': position.top ,%0A %22wid @@ -923,15 +923,17 @@ -%22 + ' width -%22 +' : wi @@ -944,51 +944,19 @@ -%7D%0A tooltip.css(tooltipStyle)%0A tooltip + %7D)%0A .tex @@ -974,23 +974,18 @@ on)%0A -tooltip + .stop()%0A @@ -988,23 +988,18 @@ p()%0A -tooltip + .fadeIn( @@ -999,16 +999,25 @@ fadeIn(%7B +%0A duration @@ -1021,16 +1021,24 @@ ion:100, +%0A queue: @@ -1042,18 +1042,26 @@ e: false +%0A %7D) +; %0A %7D, fu @@ -1098,24 +1098,25 @@ tip').stop() +; %0A $('.mar @@ -1137,16 +1137,23 @@ adeOut(%7B +%0A duration @@ -1157,20 +1157,29 @@ ion: + 100 +%0A %7D) +; %0A %7D) +; %0A%7D +; %0A%0Awi @@ -1247,16 +1247,18 @@ tes = marginotes +;%0A
104bf2e18f2b97b7842b74c3e6e93027e847bfcd
Update script.js
js/script.js
js/script.js
jQuery(document).ready(function($) { // function - on scroll, navbar shrinks $(window).scroll(function() { var scroll = $(this).scrollTop(); var nav = $('#main-navbar'); // nav.addClass('#main-navbar.second-state'); if (scroll > 200) { nav.addClass('#main-navbar.second-state'); } else { nav.removeClass('#main-navbar.second-state'); } }); $('.slider').slick({ arrows: true, dots: true, centerMode: true, slidesToShow: 1, infinite: true, adaptiveHeight: false, fade: false }); });
JavaScript
0.000002
@@ -34,29 +34,21 @@ ) %7B%0A -%0A -// function - +%0A / on +o scr @@ -169,26 +169,21 @@ %09%09= $('# -main-navba +heade r');%0A%0A @@ -335,16 +335,18 @@ else %7B%0A +
8637794d54cc444f11a139838358adda989aa639
Update script.js
js/script.js
js/script.js
/** * Created by Gopalakrishnan on 7/5/2017. */ $(document).ready(function () { loadMenu(); addEmailandNumber(); /*loadResumeLink();*/ loadYear(); }); function loadMenu() { var menuhtml = '<a class="mdl-navigation__link" href="index">Overview</a>'; menuhtml += '<a class="mdl-navigation__link" href="skills">Skills</a>'; menuhtml += '<a class="mdl-navigation__link" href="work-experience">Work Experience</a>'; /*menuhtml += '<a class="mdl-navigation__link" href="competitive-programming">Competitive Programming</a>';*/ /*menuhtml += '<a class="mdl-navigation__link" href="open-source">Open Source</a>';*/ /*menuhtml += '<a class="mdl-navigation__link" href="education">Education</a>';*/ menuhtml += '<a class="mdl-navigation__link" href="projects">Projects</a>'; /*menuhtml += '<a class="mdl-navigation__link" id="resume-link" target="_blank">Resume</a>';*/ menuhtml += '<a class="mdl-navigation__link" href="https://github.com/gopalakrishnan-anbumani" target="_blank">Code on Github</a>'; /*menuhtml += '<a class="mdl-navigation__link" href="https://medium.com/@manishbisht" target="_blank">Blog on Medium</a>';*/ menuhtml += '<a class="mdl-navigation__link" href="https://www.quora.com/profile/gopalakrishnan-anbumani" target="_blank">Questions on Quora</a>'; menuhtml += '<a class="mdl-navigation__link" href="contact">Contact</a>'; $('#main-menu').html(menuhtml); } function loadResumeLink() { var resume = "http://goo.gl/Rro9Sk"; document.getElementById('resume-link').href = resume; } function addEmailandNumber() { var email = "gopalakrishnanbe16@gmail.com"; var mobileNumber = "+91-8248912123"; $(".email").html(email); $(".mobile-number").html(mobileNumber); } function loadYear() { var currentTime = new Date(); $("#copyright-year").text(currentTime.getFullYear()); }
JavaScript
0.000002
@@ -1633,18 +1633,18 @@ hnan -be16@gmail +gk@outlook .com
e66e106c003573c1d1a346481fce4e2b1335cbc2
fix typo in code document -> window
js/script.js
js/script.js
/* This script will be available on every screen as a child of the window object (see data/app.xml). */ window.addEventListener(Savvy.LOAD, function(){ // fired once when Savvy loads first document.querySelector("audio").play(); }); window.addEventListener(Savvy.READY, function(){ // fired every time a screen "ready" event is published }); document.addEventListener(Savvy.ENTER, function(){ // fired every time a screen "enter" event is published }); window.addEventListener(Savvy.EXIT, function(e){ // fired every time a screen "exit" event is published });
JavaScript
0.000033
@@ -343,24 +343,22 @@ ed%0A%7D);%0A%0A -document +window .addEven
63f82cafdf4524a53aee562754b306bb0fb951f0
Update script.js
js/script.js
js/script.js
(function(window, document, undefined) { window.onload = init; function init() { //get the canvas var canvas = document.getElementById("mapcanvas"); var c = canvas.getContext("2d"); var width = 960; var height = 540; } })(window, document, undefined);
JavaScript
0.000002
@@ -265,16 +265,394 @@ ;%0A %7D%0A + %0A document.getElementById(%22paintbtn%22).onclick = paint;%0A %0A function paint()%7B%0A var widthSelect = document.getElementById(%22width%22);%0A width = widthSelect.options%5BwidthSelect.selectedIndex%5D.value;%0A %0A var heightSelect = document.getElementById(%22height%22);%0A height = heightSelect.options%5BheightSelect.selectedIndex%5D.value;%0A %0A %7D%0A %7D)(windo
52b9e97c0b7acc7cfaf9e02a6bfe52bc135a6cbb
Update script.js
js/script.js
js/script.js
var script = document.createElement('script'); script.src = 'http://code.jquery.com/jquery-1.11.0.min.js'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); (function(window, document, undefined) { window.onload = init; function init() { var canvas = document.getElementById("mapcanvas"); var c = canvas.getContext("2d"); var myTimer; var blockSize = 10; // set the dynamic outside the loop var it1 = -1; var it2 = -1 //loop function function loop() { it1 = it1+1 if(it1 % 96 == 0){ it2 = it2+1 } // change dynamic //dynamic = dynamic * 1.1; x = it1*blockSize; y = it2*blockSize; //if we've reached the end, change direction // stop the the animation if it runs out-of-canvas if (it2 > 54) { //c.clearRect(0, 0, canvas.width, canvas.height); clearInterval(myTimer); } // clear the canvas for this loop's animation //c.clearRect(0, 0, canvas.width, canvas.height); c.fillStyle = '#87CEEB'; // draw c.beginPath(); c.fillRect(x, y, 10, 10); c.fill(); } $("#startbtn").click(function(){ dynamic=10; myTimer=setInterval(loop,20); }); } })(window, document, undefined);
JavaScript
0.000002
@@ -525,17 +525,18 @@ it2 = -1 +; %0A - %0A @@ -605,16 +605,17 @@ = it1+1 +; %0A @@ -638,16 +638,41 @@ == 0)%7B%0A + it1 = 0;%0A @@ -690,16 +690,17 @@ = it2+1 +; %0A
886981718049d73389d6416e54d2c1e35eecc58d
Update slider.js
js/slider.js
js/slider.js
; ( function ( $, window, document, undefined ) { "use strict"; var pluginName = "slider"; var defaults = { delay: 1000, interval: 10000 }; function Plugin( element, options ) { this.element = element; this.settings = $.extend( {}, defaults, options ); this.vari = { timer: undefined, slide: 1, slides: 0 }; this._defaults = defaults; this._name = pluginName; this.init(); } Plugin.prototype = { init: function () { var self = this; var $slider = $( this.element ); var $position = $slider.find( '.position' ); $slider.children( '.slides' ).find( 'img' ).each( function ( index, element ) { self.vari.slides ++; if ( self.vari.slides == self.vari.slide ) { $( element ).addClass( 'active' ).css( 'opacity', '1' ); $position.append( '<div class="points active"></div>' ); } else { $( element ).css( 'opacity', '0' ); $position.append( '<div class="points"></div>' ); } } ); $position.find( '.points' ).each( function ( index ) { $( this ).click( function () { self.show( index + 1 ); } ); } ); $slider.hover( function () { clearInterval( self.vari.timer ); }, function () { self.auto(); } ); $slider.find( '.prev > *' ).click( function () { self.prev(); } ); $slider.find( '.next > *' ).click( function () { self.next(); } ); this.auto(); }, auto: function () { var self = this; this.vari.timer = setInterval( function () { self.next(); }, this.settings.interval ); }, next: function () { if ( this.vari.slide < this.vari.slides ) { this.show( this.vari.slide + 1 ); } else { this.show( 1 ); } }, prev: function () { if ( this.vari.slide > 1 ) { this.show( this.vari.slide - 1 ); } else { this.show( this.vari.slides ); } }, show: function ( slide ) { $( this.element ).find( '.slides img:nth-child(' + this.vari.slide + ')' ).stop().removeClass( 'active' ).animate( {opacity: 0}, this.settings.delay ); $( this.element ).find( '.position .points:nth-child(' + this.vari.slide + ')' ).removeClass( 'active' ); $( this.element ).find( '.text span:nth-child(' + this.vari.slide + ')' ).removeClass( 'active' ); this.vari.slide = slide; $( this.element ).find( '.slides img:nth-child(' + this.vari.slide + ')' ).stop().addClass( 'active' ).animate( {opacity: 1}, this.settings.delay ); $( this.element ).find( '.position .points:nth-child(' + this.vari.slide + ')' ).addClass( 'active' ); $( this.element ).find( '.text span:nth-child(' + this.vari.slide + ')' ).addClass( 'active' ); return this; } }; $.fn[pluginName] = function ( options ) { this.each( function () { if ( ! $.data( this, "plugin_" + pluginName ) ) { $.data( this, "plugin_" + pluginName, new Plugin( this, options ) ); } } ); return this; }; } )( jQuery, window, document );
JavaScript
0.000001
@@ -2062,22 +2062,17 @@ ity: 0%7D, -%0A%09%09%09%09%09 + this.set @@ -2457,22 +2457,17 @@ ity: 1%7D, -%0A%09%09%09%09%09 + this.set
ce7f2b2986f36d657c7271ada12d173ce7f48fab
Update splash.js
js/splash.js
js/splash.js
var content = "<span class='badge'>New</span>"; var content += "Un nuovo video sull'autismo (realizzato con la collaborazione del prof. Tony Attwood, esperto dell'autismo)" var thumbup = <span class=\"glyphicon glyphicon-thumbs-up\"></span>"; <!-- this is the same for all the groups --> splasha.innerHTML = content + thumbup splashb.innerHTML = content + thumbup splashc.innerHTML = content + thumbup
JavaScript
0.000001
@@ -165,16 +165,17 @@ utismo)%22 +; %0Avar thu @@ -242,53 +242,8 @@ %22;%0A%0A -%3C!-- this is the same for all the groups --%3E%0A spla
42cab27120436e93ae230a9b01267716569f1781
Update upvote.js
js/upvote.js
js/upvote.js
var Upvote = (function (window, document) { that = this; // endEvent = hasTouch ? 'touchend' : 'mouseup', Upvote = function (opts) { that = this; this.current_category = 'us'; // --------------------------------------------------------- // Muench launch // --------------------------------------------------------- // Options from user for (i in opts) this.options[i] = opts[i]; // --------------------------------------------------------- // Skimmin launch // --------------------------------------------------------- $('.upvote-container').on('click', this.fn_tap_upvote.bind(this)); $('.category-container').on('click', this.fn_change_category.bind(this)); window.addEventListener('load', function() { FastClick.attach(document.body); }, false); this.fn_hide_rendering_icons(); this.fn_loading(); this.fn_reveal_content(); }; Upvote.prototype = { // ------------------------------------------------------ // Skimmin Core Functions // ------------------------------------------------------ // primarily used to hide slow rendering fn_loading: function() { that = this; $('#loading-circle').fadeIn(0); alert('ok'); setTimeout(function() { $('body').fadeIn(0); }, 300); // $('#loading-circle').addClass('animated bounceIn'); int_loading_count = 0; arr_colors = Array('rgba(52, 152, 219, 1)', 'rgba(255, 140, 0, 1)', 'rgba(231, 76, 60, 1)', 'rgba(0, 128, 0, .9)', 'rgba(0, 154, 136, .9)', 'rgba(164, 121, 228, 1)'); // bool_kill_next_loop = false; pulsing_circle_interval = setInterval(function() { $('#1').css('opacity', '.8'); setTimeout(function() { $('#1').css('opacity', '1'); $('#2').css('opacity', '.8'); }, 100); setTimeout(function() { $('#2').css('opacity', '1'); $('#3').css('opacity', '.8'); }, 200); setTimeout(function() { $('#3').css('opacity', '1'); $('#4').css('opacity', '.8'); }, 300); setTimeout(function() { $('#4').css('opacity', '1'); $('#5').css('opacity', '.8'); }, 400); setTimeout(function() { $('#5').css('opacity', '1'); $('#6').css('opacity', '.8'); }, 500); setTimeout(function() { $('#6').css('opacity', '1'); $('#7').css('opacity', '.75'); }, 600); setTimeout(function() { $('#7').css('opacity', '1'); }, 700); // $('#loading-circle').css('background-color', arr_colors[int_loading_count]); int_loading_count += 1; if (int_loading_count == 4) { clearInterval(pulsing_circle_interval); setTimeout(function() { // $('#loading-circle').addClass('animated slideOutUp'); // $('#loading-circle').fadeOut(300); }, 500); setTimeout(function() { // $('#content').fadeIn(300); // $('#content').addClass('animated slideInUp'); }, 750); setTimeout(function() { $('#loading-circle').fadeOut(650); $('#content').fadeIn(650); }, 1200); } }, 1000); }, fn_reveal_content: function() { alert('ok1'); setTimeout(function() { $('body').fadeIn(0); $('body').addClass('animated bounceInUp'); }, 300); }, fn_hide_rendering_icons: function() { setTimeout(function() { $('.rendering-container').addClass('display-none'); }, 3000); }, fn_change_category: function(e) { hyphen_index = e.target.id.indexOf("-"); element_id = e.target.id.substr(0, hyphen_index); if (element_id == this.current_category) { return; } $('#' + element_id + '-container').addClass('selected'); $('#' + this.current_category + '-container').removeClass('selected'); if ($('.upvote-container').hasClass('upvoted') == true) { $('.upvote-container').removeClass(this.current_category); $('.upvote-text').removeClass(this.current_category); $('.upvote-icon').removeClass(this.current_category); $('.upvote-container').addClass(element_id); $('.upvote-text').addClass(element_id); $('.upvote-icon').addClass(element_id); } this.current_category = element_id; }, fn_tap_upvote: function() { if ($('.upvote-container').hasClass('upvoted') == true) { $('.upvote-container').removeClass('upvoted'); setTimeout(function() { $('.upvote-container').removeClass('tapped us world sports business technology entertainment'); $('.upvote-text').removeClass('us world sports business technology entertainment'); $('.upvote-text').html(30); $('.upvote-icon').removeClass('us world sports business technology entertainment'); }, 300); } else { $('.upvote-container').addClass('upvoted'); setTimeout(function() { $('.upvote-container').addClass('tapped ' + that.current_category); $('.upvote-text').addClass(that.current_category); $('.upvote-text').html(31); $('.upvote-icon').addClass(that.current_category); }, 300); } }, }; return Upvote; })(window, document);
JavaScript
0.000002
@@ -1326,20 +1326,8 @@ %09 -alert('ok'); %0A @@ -3748,43 +3748,8 @@ %09%09%0A - %09%09alert('ok1');%0A %09%09%0A
565087faabc1dbbee7ab0802e4fc10175ef6b825
add change for dist dir
dist/geom/ShapeUtils.js
dist/geom/ShapeUtils.js
/** * Created by Samuel Gratzl on 27.12.2016. */ import { AShape } from './AShape'; import { Rect } from './Rect'; import { Circle } from './Circle'; import { Ellipse } from './Ellipse'; import { Line } from './Line'; import { Polygon } from './Polygon'; export class ShapeUtils { static wrapToShape(obj) { if (!obj) { return obj; } if (obj instanceof AShape) { return obj; } if (obj.hasOwnProperty('x') && obj.hasOwnProperty('y')) { if (obj.hasOwnProperty('radius') || obj.hasOwnProperty('r')) { return Circle.circle(obj.x, obj.y, obj.hasOwnProperty('radius') ? obj.radius : obj.r); } if ((obj.hasOwnProperty('radiusX') || obj.hasOwnProperty('rx')) && (obj.hasOwnProperty('radiusY') || obj.hasOwnProperty('ry'))) { return Ellipse.ellipse(obj.x, obj.y, obj.hasOwnProperty('radiusX') ? obj.radiusX : obj.rx, obj.hasOwnProperty('radiusY') ? obj.radiusY : obj.ry); } if (obj.hasOwnProperty('w') && obj.hasOwnProperty('h')) { return Rect.rect(obj.x, obj.y, obj.w, obj.h); } if (obj.hasOwnProperty('width') && obj.hasOwnProperty('height')) { return Rect.rect(obj.x, obj.y, obj.width, obj.height); } } if (obj.hasOwnProperty('x1') && obj.hasOwnProperty('y1') && obj.hasOwnProperty('x2') && obj.hasOwnProperty('y2')) { return Line.line(obj.x1, obj.y1, obj.x2, obj.y2); } if (Array.isArray(obj) && obj.length > 0 && obj[0].hasOwnProperty('x') && obj[0].hasOwnProperty('y')) { return Polygon.polygon(obj); } // TODO throw error? return obj; //can't derive it, yet } } //# sourceMappingURL=ShapeUtils.js.map
JavaScript
0
@@ -254,15 +254,8 @@ n';%0A -export clas @@ -1797,9 +1797,8 @@ s.js.map -%0A
5b440fc021d50bec3dbdd9464d80b626a6929988
add Triangle
javascripts/enemies/triangle.js
javascripts/enemies/triangle.js
JavaScript
0.999986
@@ -0,0 +1,349 @@ +Triangle = Class.create(Enemy, %7B%0A initialize: function(x, y) %7B%0A Sprite.call(this, 50, 50);%0A this.image = game.assets%5B'images/triangle_glow.png'%5D;%0A this.frame = 0;%0A%0A this.x = x;%0A this.y = y;%0A%0A this.speed = 2;%0A this.scoreValue = 10;%0A %7D,%0A%0A onenterframe: function() %7B%0A this.collisionDetect();%0A this.followPlayer();%0A %7D%0A%7D);%0A
1cdcd3227d9d70e0e11bf4ec30d0402638c98e3c
Remove Sample app comment
index.ios.js
index.ios.js
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image } from 'react-native'; import Guco from './Guco'; const views = [ { title: 'Guco' }, { title: 'McGucci' }, { title: 'Go Hord' } ]; const images = [ 'https://images.unsplash.com/photo-1494249465471-5655b7878482?dpr=2&auto=format&fit=crop&w=1080&h=720', 'https://images.unsplash.com/photo-1459909633680-206dc5c67abb?dpr=2&auto=format&fit=crop&w=1080&h=720', 'https://images.unsplash.com/photo-1490237014491-822aee911b99?dpr=2&auto=format&fit=crop&w=1080&h=720' ]; export default class ParallaxSwiper extends Component { render() { return ( <View style={styles.container}> <Guco dividerWidth={4} parallaxStrength={300} dividerColor="white" backgroundImages={images} ui={ views.map((view, i) => ( <View key={i} style={styles.slideInnerContainer}> <Text style={styles.slideText}> Slide {i} </Text> </View> )) } showsHorizontalScrollIndicator={false} onMomentumScrollEnd={() => console.log('Swiper finished swiping')} /> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'white', }, slideInnerContainer: { flex: 1, alignItems: 'center', justifyContent: 'center', }, slideText: { fontSize: 36, fontWeight: '900', letterSpacing: -0.4, }, }); AppRegistry.registerComponent('ParallaxSwiper', () => ParallaxSwiper);
JavaScript
0
@@ -1,93 +1,4 @@ -/**%0A * Sample React Native App%0A * https://github.com/facebook/react-native%0A * @flow%0A */%0A%0A impo
432a1e3c69f697ee21544720659b3e37594f33b7
Update main.js
web-ui/js/main.js
web-ui/js/main.js
var KrempelAirApp = angular.module('KrempelAirApp', ['ngRoute']); var uri = "/api" KrempelAirApp.config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix(''); }]); KrempelAirApp.config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: '../views/air.html', controller: 'AirFlowController' }) .when('/login', { templateUrl: '../views/login.html', controller: 'LoginCtrl' }) .otherwise({ redirectTo: '/' }); }) KrempelAirApp.directive('selectOnClick', ['$window', function ($window) { return { restrict: 'A', link: function (scope, element, attrs) { element.on('click', function () { if (!$window.getSelection().toString()) { // Required for mobile Safari this.setSelectionRange(0, this.value.length) } }); } }; }]); KrempelAirApp.factory('Auth', function ($rootScope, $window, $http) { return { login: function (user, successHandler, errorHandler) { if (user.username == 'test' && user.password == 'test') { this.setLoggedInUser(user); successHandler(user); } else { alert("please use username/password as test/test to login"); errorHandler(user); } // call the server side login restful api // $http.post('api/login', user).success(function(user) { // this.setLoggedInUser(user); // successHandler(user); // }).error(errorHandler); }, getLoggedInUser: function () { if ($rootScope.user === undefined || $rootScope.user == null) { var userStr = $window.sessionStorage.getItem('user'); if (userStr) { $rootScope.user = angular.fromJson(userStr); } } return $rootScope.user; }, isLoggedIn: function () { return this.getLoggedInUser() != null; }, setLoggedInUser: function (user) { $rootScope.user = user; if (user == null) { $window.sessionStorage.removeItem('user'); } else { $window.sessionStorage.setItem('user', angular.toJson($rootScope.user)); } } }; }) KrempelAirApp.run(['$window', '$rootScope', '$location', 'Auth', function ($window, $rootScope, $location, Auth) { $rootScope.$on("$routeChangeStart", function (event) { if (!Auth.isLoggedIn() && $location.path() !== '/login') { $location.path('/login'); } }); }]); KrempelAirApp.controller('LoginCtrl', function ($scope, Auth, $location, $http) { $scope.user = {}; $scope.login = function () { Auth.login($scope.user, function () { $location.path('/'); }, function (e) { // do some error handling. }); }; }) KrempelAirApp.controller('MainCtrl', function ($scope, Auth, $location) { $scope.logout = function () { Auth.setLoggedInUser(null); $location.path('/somewhere'); }; }) KrempelAirApp.controller('AirFlowController', function AirFlowController($scope, $http, $timeout) { $scope.Refresh = function(){ $http.get(uri+"/").then(function (response) { $scope.status = response.data; }); $http.get(uri+"/stoerung").then(function (response) { $scope.stoerung = response.data; }); $http.get(uri+"/lueftung/temperatur").then(function (response) { $scope.temperatur = response.data; // sollTemp if(!$scope.sollTemp){ $scope.sollTemp = response.data["TempSoll"]; } // sollTempNAK if(!$scope.sollTempNAK){ $scope.sollTempNAK = response.data["TempSoll"]; } }); $timeout(function(){ $scope.Refresh(); },800); } $scope.Klick = function(Klick){ $http.get(uri+"/lueftung/stufe/"+Klick); $scope.Refresh(); } $scope.SolltempClick = function(){ $http.get(uri+"/lueftung/temperatur/sollTemp/"+parseFloat($scope.sollTemp)); alert("Gespeichert") } $scope.NAKClick = function(){ $http.get(uri+"/lueftung/temperatur/sollTempNAK/"+parseFloat($scope.sollTempNAK)); alert("Gespeichert") } $scope.updateNAK = function(){ if($scope.NAK){ $http.get(uri+"/lueftung/NAK/1"); }else{ $http.get(uri+"/lueftung/NAK/0"); } } $scope.Refresh(); });
JavaScript
0.000001
@@ -3734,32 +3734,35 @@ e.data%5B%22TempSoll +NAK %22%5D;%0A
edf3a7fb5b8b65065d2f0ad296a83f56e70221e2
fix test case class name
src/Component/Stopwatch/test/StopwatchTest.js
src/Component/Stopwatch/test/StopwatchTest.js
import { expect } from 'chai'; const Stopwatch = Jymfony.Component.Stopwatch.Stopwatch; const StopwatchEvent = Jymfony.Component.Stopwatch.StopwatchEvent; const TestCase = Jymfony.Component.Testing.Framework.TestCase; export default class StopwatchPeriodTest extends TestCase { get testCaseName() { return '[Stopwatch] ' + super.testCaseName; } testStart() { const stopwatch = new Stopwatch(); const event = stopwatch.start('foo', 'cat'); expect(event).to.be.instanceOf(StopwatchEvent); expect(event.category).to.be.equal('cat'); expect(stopwatch.getEvent('foo')).to.be.equal(event); } testStartWithoutCategory() { const stopwatch = new Stopwatch(); const event = stopwatch.start('bar'); expect(event.category).to.be.equal('default'); expect(stopwatch.getEvent('bar')).to.be.equal(event); } testIsStarted() { const stopwatch = new Stopwatch(); expect(stopwatch.isStarted('foo')).to.be.equal(false); stopwatch.start('foo', 'cat'); expect(stopwatch.isStarted('foo')).to.be.equal(true); stopwatch.stop('foo'); expect(stopwatch.isStarted('foo')).to.be.equal(false); } testGetEventShouldThrowOnUnknownEvent() { const stopwatch = new Stopwatch(); expect(() => stopwatch.getEvent('foo')).to.throw(LogicException); } testStopWithoutStart() { const stopwatch = new Stopwatch(); expect(() => stopwatch.stop('foo')).to.throw(LogicException); } testSections() { const stopwatch = new Stopwatch(); stopwatch.openSection(); stopwatch.start('foo', 'cat'); stopwatch.stop('foo'); stopwatch.start('bar', 'cat'); stopwatch.stop('bar'); stopwatch.stopSection('1'); stopwatch.openSection(); stopwatch.start('foobar', 'cat'); stopwatch.stop('foobar'); stopwatch.stopSection('2'); stopwatch.openSection(); stopwatch.start('foobar', 'cat'); stopwatch.stop('foobar'); stopwatch.stopSection('0'); expect(Object.keys(stopwatch.getSectionEvents('1'))).to.have.length(3); expect(Object.keys(stopwatch.getSectionEvents('2'))).to.have.length(2); expect(Object.keys(stopwatch.getSectionEvents('0'))).to.have.length(2); } testReopenSection() { const stopwatch = new Stopwatch(); stopwatch.openSection(); stopwatch.start('foo', 'cat'); stopwatch.stopSection('section'); stopwatch.openSection('section'); stopwatch.start('bar', 'cat'); stopwatch.stopSection('section'); const events = stopwatch.getSectionEvents('section'); expect(Object.keys(events)).to.have.length(3); expect(events['__section__'].periods).to.have.length(2); } }
JavaScript
0.000003
@@ -247,14 +247,8 @@ atch -Period Test
a035ae76d303fad9747a16f747f2e51f2e327935
Fix bug with Ember.Handlebars.helper
packages/ember-handlebars-compiler/lib/main.js
packages/ember-handlebars-compiler/lib/main.js
/** @module ember @submodule ember-handlebars-compiler */ // Eliminate dependency on any Ember to simplify precompilation workflow var objectCreate = Object.create || function(parent) { function F() {} F.prototype = parent; return new F(); }; var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars); if(!Handlebars && typeof require === 'function') { Handlebars = require('handlebars'); } Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars && Handlebars.COMPILER_REVISION === 2); /** Prepares the Handlebars templating library for use inside Ember's view system. The `Ember.Handlebars` object is the standard Handlebars library, extended to use Ember's `get()` method instead of direct property access, which allows computed properties to be used inside templates. To create an `Ember.Handlebars` template, call `Ember.Handlebars.compile()`. This will return a function that can be used by `Ember.View` for rendering. @class Handlebars @namespace Ember */ Ember.Handlebars = objectCreate(Handlebars); Ember.Handlebars.helper = function(name, value) { if (Ember.View.detect(value)) { Ember.Handlebars.registerHelper(name, function(name, options) { Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3); return Ember.Handlebars.helpers.view.call(this, value, options); }); } else { Ember.Handlebars.registerBoundHelper.apply(null, arguments); } } /** @class helpers @namespace Ember.Handlebars */ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers); /** Override the the opcode compiler and JavaScript compiler for Handlebars. @class Compiler @namespace Ember.Handlebars @private @constructor */ Ember.Handlebars.Compiler = function() {}; // Handlebars.Compiler doesn't exist in runtime-only if (Handlebars.Compiler) { Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype); } Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler; /** @class JavaScriptCompiler @namespace Ember.Handlebars @private @constructor */ Ember.Handlebars.JavaScriptCompiler = function() {}; // Handlebars.JavaScriptCompiler doesn't exist in runtime-only if (Handlebars.JavaScriptCompiler) { Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype); Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler; } Ember.Handlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars"; Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() { return "''"; }; /** @private Override the default buffer for Ember Handlebars. By default, Handlebars creates an empty String at the beginning of each invocation and appends to it. Ember's Handlebars overrides this to append to a single shared buffer. @method appendToBuffer @param string {String} */ Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) { return "data.buffer.push("+string+");"; }; var prefix = "ember" + (+new Date()), incr = 1; /** @private Rewrite simple mustaches from `{{foo}}` to `{{bind "foo"}}`. This means that all simple mustaches in Ember's Handlebars will also set up an observer to keep the DOM up to date when the underlying property changes. @method mustache @for Ember.Handlebars.Compiler @param mustache */ Ember.Handlebars.Compiler.prototype.mustache = function(mustache) { if (mustache.isHelper && mustache.id.string === 'control') { mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]); mustache.hash.pairs.push(["controlID", new Handlebars.AST.StringNode(prefix + incr++)]); } else if (mustache.params.length || mustache.hash) { // no changes required } else { var id = new Handlebars.AST.IdNode(['_triageMustache']); // Update the mustache node to include a hash value indicating whether the original node // was escaped. This will allow us to properly escape values when the underlying value // changes and we need to re-render the value. if(!mustache.escaped) { mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]); mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]); } mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped); } return Handlebars.Compiler.prototype.mustache.call(this, mustache); }; /** Used for precompilation of Ember Handlebars templates. This will not be used during normal app execution. @method precompile @for Ember.Handlebars @static @param {String} string The template to precompile */ Ember.Handlebars.precompile = function(string) { var ast = Handlebars.parse(string); var options = { knownHelpers: { action: true, unbound: true, bindAttr: true, template: true, view: true, _triageMustache: true }, data: true, stringParams: true }; var environment = new Ember.Handlebars.Compiler().compile(ast, options); return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); }; // We don't support this for Handlebars runtime-only if (Handlebars.compile) { /** The entry point for Ember Handlebars. This replaces the default `Handlebars.compile` and turns on template-local data and String parameters. @method compile @for Ember.Handlebars @static @param {String} string The template to compile @return {Function} */ Ember.Handlebars.compile = function(string) { var ast = Handlebars.parse(string); var options = { data: true, stringParams: true }; var environment = new Ember.Handlebars.Compiler().compile(ast, options); var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); return Ember.Handlebars.template(templateSpec); }; }
JavaScript
0
@@ -1318,22 +1318,16 @@ unction( -name, options)
6217aff4445e16885e5e05debc19e8bd298a82b2
remove duplicate test
packages/ember-metal/tests/performance_test.js
packages/ember-metal/tests/performance_test.js
/* This test file is designed to capture performance regressions related to deferred computation. Things like run loops, computed properties, and bindings should run the minimum amount of times to achieve best performance, so any bugs that cause them to get evaluated more than necessary should be put here. */ module("Computed Properties - Number of times evaluated"); test("computed properties that depend on multiple properties should run only once per run loop", function() { var obj = {a: 'a', b: 'b', c: 'c'}; var count = 0; Ember.defineProperty(obj, 'abc', Ember.computed(function(key) { count++; return 'computed '+key; }).property('a', 'b', 'c')); Ember.beginPropertyChanges(); Ember.set(obj, 'a', 'aa'); Ember.set(obj, 'b', 'bb'); Ember.set(obj, 'c', 'cc'); Ember.endPropertyChanges(); Ember.get(obj, 'abc'); equal(count, 1, "The computed property is only invoked once"); }); test("computed properties that depend on multiple properties should run only once per run loop", function() { var obj = {a: 'a', b: 'b', c: 'c'}; var cpCount = 0, obsCount = 0; Ember.defineProperty(obj, 'abc', Ember.computed(function(key) { cpCount++; return 'computed '+key; }).property('a', 'b', 'c')); Ember.addObserver(obj, 'abc', function() { obsCount++; }); Ember.beginPropertyChanges(); Ember.set(obj, 'a', 'aa'); Ember.set(obj, 'b', 'bb'); Ember.set(obj, 'c', 'cc'); Ember.endPropertyChanges(); Ember.get(obj, 'abc'); equal(cpCount, 1, "The computed property is only invoked once"); equal(obsCount, 1, "The observer is only invoked once"); }); test("computed properties are not executed if they are the last segment of an observer chain pain", function() { var foo = { bar: { baz: { } } }; var count = 0; Ember.defineProperty(foo.bar.baz, 'bam', Ember.computed(function() { count++; })); Ember.addObserver(foo, 'bar.baz.bam', function() {}); Ember.propertyDidChange(Ember.get(foo, 'bar.baz'), 'bam'); equal(count, 0, "should not have recomputed property"); });
JavaScript
0.000409
@@ -377,558 +377,8 @@ );%0A%0A -test(%22computed properties that depend on multiple properties should run only once per run loop%22, function() %7B%0A var obj = %7Ba: 'a', b: 'b', c: 'c'%7D;%0A var count = 0;%0A Ember.defineProperty(obj, 'abc', Ember.computed(function(key) %7B%0A count++;%0A return 'computed '+key;%0A %7D).property('a', 'b', 'c'));%0A%0A Ember.beginPropertyChanges();%0A Ember.set(obj, 'a', 'aa');%0A Ember.set(obj, 'b', 'bb');%0A Ember.set(obj, 'c', 'cc');%0A Ember.endPropertyChanges();%0A%0A Ember.get(obj, 'abc');%0A%0A equal(count, 1, %22The computed property is only invoked once%22);%0A%7D);%0A%0A test
f7a460c37b6a4fdbbd40610f8fc45d70253742be
Update utils-constants.js
dataprep-webapp/src/services/utils/constants/utils-constants.js
dataprep-webapp/src/services/utils/constants/utils-constants.js
(function() { 'use strict'; angular.module('data-prep.services.utils') /** * @ngdoc object * @name data-prep.services.utils.service:apiUrl * @description The REST api base url */ .constant('apiUrl', 'http://10.42.10.99:8888') /* VM1 */ // .constant('apiUrl', 'http://10.42.40.91:8888') /* VINCENT */ //.constant('apiUrl', 'http://192.168.40.134:8888') /* MARC VM DOCKER */ /** * @ngdoc object * @name data-prep.services.utils.service:disableDebug * @description Application option. Disable debug mode (ex: in production) for performance */ .constant('disableDebug', false); })();
JavaScript
0.000001
@@ -283,175 +283,8 @@ 88') - /* VM1 */%0A // .constant('apiUrl', 'http://10.42.40.91:8888') /* VINCENT */%0A //.constant('apiUrl', 'http://192.168.40.134:8888') /* MARC VM DOCKER */ %0A
fc45b842cdce2a3208ba3fd910d1eaed9bdde454
add jsdoc example to execution context
packages/execution-context/ExecutionContext.js
packages/execution-context/ExecutionContext.js
export default class ExecutionContext { /** * @param {Executor} executor — an instance that handles code running * @param {Number} concurrent — number of routines that can be executed at once * @param {Boolean} manual — set to `true` if manual queue execution needed */ constructor(executor, concurrent = 1, manual = false) { this.executor = executor; this.concurrent = concurrent; this.manual = manual; this.queue = []; this.current = Promise.resolve(); } /** * @param {Function} routine — arbitrary code to execute * @return {Promise} — async result of executed routine */ execute(routine) { return new Promise((resolve, reject) => { this.queue.push({ routine, resolve, reject }); if (!this.manual && this.queue.length === 1) { this.flush(); } }); } /** * @return {Promise} — return a promise that is fulfilled when queue is empty */ flush() { return this.current.then(() => { const tasks = this.queue.splice(0, this.concurrent); if (tasks.length > 0) { this.current = this.executor.execute(batchTasks(tasks)); return this.queue.length === 0 || this.flush(); } return false; }); } } function batchTasks(tasks) { return function batch() { try { for (var task of tasks) { task.resolve(task.routine()); } } catch (error) { task.reject(error); } }; }
JavaScript
0.000001
@@ -1,8 +1,306 @@ +/**%0A * Executes arbitrary code asynchronously and concurrently.%0A * @example%0A * const executor = new ImmediateExecutor()%0A * const context = new ExecutionContext(executor);%0A * const result = context.execute(() =%3E 'Hello, World!');%0A * result.then(message =%3E console.log(message));%0A */%0A export d
2a4ecd94bba80ae245976f4c724c0f52a98a32ab
Update comments
helpers/sortByMapping.js
helpers/sortByMapping.js
/* jslint node: true */ 'use strict'; var _ = require( 'lodash' ); module.exports = function( dust ) { /* * @description Sorting method that orders a list of things based on a provided map * @param {object} sortObject - Object to sort * @param {string} map - Map to use to sort with * @param {string} indexes - index structure of response to sort on * @example {@_sortByMapping sortObject=packageRatesReply.packageRates indexes="links, hotelProducts, ids" map="PAUGLA, PAUFOR, PAUELM, PAUFAR"} {/_sortByMapping} */ dust.helpers._sortByMapping = function( chunk, context, bodies, params ) { // Object to sort var sortObject = params.sortObject; // Mapping to sort to the object to var map = params.map; // Index structure required for correct mapping var keysParam = params.indexes.split(','); var mappedObject = []; var pickParameters = function( matchedobject, pickparams ) { // Loop over the sort parameter structure provided from the tpl for ( var i = 0; i < pickparams.length; i++ ) { if ( !matchedobject ) return null; matchedobject = matchedobject[pickparams[i]]; } return matchedobject; }; // Loop over the mapping order provided _.forEach( map, function( id ) { // Loop over the object to be sorted _.forEach( sortObject, function( matchObject ) { var requiredProduct = pickParameters( matchObject, keysParam ); // Is the value in the map array? if ( _.include( id, requiredProduct ) ) { // If it matches then push this object into the mappedObject mappedObject.push( matchObject ); } } ); } ); // Smush everything else we havn't already addedd into sortObject sortObject = _.union( mappedObject, sortObject ); // Release - the wall didn't like me deleting this, hence null. mappedObject = null; _.forEach( sortObject, function( item ) { chunk = chunk.render( bodies.block, context.push( item ) ); } ); return chunk; }; };
JavaScript
0
@@ -520,16 +520,196 @@ apping%7D%0A + * At present their is no unit test coverage for this helper, this is being addressed by changing the structure of our helpers to ensure functions available outside scope of dust%0A */%0A%0A @@ -1131,22 +1131,43 @@ the -sort parameter +object to be sorted using the index str
933f9ad8a581679654e511879016d20ae2c895da
remove deprecated jQuery .ready() syntax (#2738)
resources/scripts/app.js
resources/scripts/app.js
/** * External Dependencies */ import 'jquery'; $(document).ready(() => { // console.log('Hello world'); });
JavaScript
0.000001
@@ -50,24 +50,8 @@ %0A%0A$( -document).ready( () =
8e9371e3d3259deea1a922d47686967bee54c00f
fix proptypes warning with router prop
src/views/SearchPictogramsView.js
src/views/SearchPictogramsView.js
import React, {Component, PropTypes} from 'react' import { defineMessages, FormattedMessage } from 'react-intl' import SearchBox from 'components/SearchBox.js' import FilterPictograms from 'components/Filter/Filter' import Toggle from 'material-ui/lib/toggle' import { connect } from 'react-redux' import { resetErrorMessage } from 'redux/modules/error' import { loadKeywords } from 'redux/modules/keywords' import { toggleShowFilter } from 'redux/modules/showFilter' import { withRouter } from 'react-router' const messages = defineMessages({ advancedSearch: { id: 'searchPictograms.advancedSearch', description: 'label for filtering Search', defaultMessage: 'Advanced Search' } }) class SearchPictogramsView extends Component { constructor(props) { super(props) this.handleDismissClick = this.handleDismissClick.bind(this) this.renderErrorMessage = this.renderErrorMessage.bind(this) this.handleChange = this.handleChange.bind(this) } /* static defaultProps = { showFilters: false } */ handleDismissClick(e) { this.props.resetErrorMessage() e.preventDefault() } handleChange(nextValue) { // not re-rendering, just the push????? // browserHistory.push(`/pictograms/search/${nextValue}`) // would need to configure router context: // this.context.router.push(`/pictograms/search/${nextValue}`) // starting in react 2.4 using a higher class: this.props.router.push(`/pictograms/search/${nextValue}`) } componentDidMount() { this.props.loadKeywords(this.props.locale) } renderErrorMessage() { const { errorMessage } = this.props if (!errorMessage) { return null } return ( <p style={{ backgroundColor: '#e99', padding: 10 }}> <b>{errorMessage}</b> {' '} (<a href='#' onClick={this.handleDismissClick}> Dismiss </a>) </p> ) } render() { const { children, searchText } = this.props const {showFilter, filters} = this.props const { keywords } = this.props.keywords return ( <div> <div className='row end-xs'> <div className='col-xs-6 col-sm-4 col-md-3'> <Toggle label={<FormattedMessage {...messages.advancedSearch} />} onToggle={this.props.toggleShowFilter} defaultToggled={showFilter} /> </div> </div> <div className='row start-xs'> <SearchBox value={searchText} fullWidth={true} dataSource={keywords} onChange={this.handleChange} /> <hr /> <p>{this.props.searchText}</p> {this.renderErrorMessage()} </div> {showFilter ? <FilterPictograms filter={filters} /> : null} {children} </div> ) } } SearchPictogramsView.propTypes = { // Injected by React Redux errorMessage: PropTypes.string, resetErrorMessage: PropTypes.func.isRequired, toggleShowFilter: PropTypes.func.isRequired, loadKeywords: PropTypes.func.isRequired, searchText: PropTypes.string, keywords: PropTypes.object, showFilter: PropTypes.bool, locale: PropTypes.string.isRequired, filters: PropTypes.object.isRequired, // Injected by React Router children: PropTypes.node } const mapStateToProps = (state, ownProps) => { const errorMessage = state.errorMessage const { searchText } = ownProps.params const { entities: { keywords } } = state const {locale} = state const {gui: {filters}} = state const {gui: {showFilter}} = state return { errorMessage, searchText, // inputValue, locale, keywords: keywords[locale], filters, showFilter } } export default connect(mapStateToProps, {resetErrorMessage, loadKeywords, toggleShowFilter})(withRouter(SearchPictogramsView))
JavaScript
0
@@ -1370,13 +1370,8 @@ %7D%60)%0A - %0A @@ -1405,23 +1405,89 @@ ing -a higher class: +HOC: https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.4.0.md %0A @@ -3262,16 +3262,58 @@ pes.node +,%0A router: React.PropTypes.any.isRequired %0A%7D%0A%0Acons
08b359d6f8d3627efe88688ba57c2acd040bff37
change cursor style for datepicker
packages/tocco-ui/src/DatePicker/DatePicker.js
packages/tocco-ui/src/DatePicker/DatePicker.js
import React, {useRef} from 'react' import PropTypes from 'prop-types' import {injectIntl, intlShape} from 'react-intl' import styled, {withTheme} from 'styled-components' import {theme} from '../utilStyles' import {useDatePickr} from './useDatePickr' const WrapperStyle = styled.div` .flatpickr-calendar.open { top: auto !important; } ` export const DatePicker = props => { const {value, children, intl, onChange} = props const wrapperElement = useRef(null) const locale = intl.locale const fontFamily = theme.fontFamily('regular')(props) useDatePickr(wrapperElement, {value, onChange, fontFamily, locale}) return ( <WrapperStyle data-wrap ref={wrapperElement} > <div data-toggle> <input style={{display: 'none'}} type="text" data-input /> {children} </div> </WrapperStyle> ) } DatePicker.propTypes = { /** * Any content to wrap a onclick around to open a calendar */ children: PropTypes.node.isRequired, /** * Function triggered on every date selection. First parameter is the picked date as iso string. */ onChange: PropTypes.func.isRequired, /** * To set the selected date from outside the component. */ value: PropTypes.any, intl: intlShape.isRequired } export default withTheme(injectIntl(DatePicker))
JavaScript
0
@@ -280,16 +280,38 @@ ed.div%60%0A + cursor: pointer;%0A %0A .flatp