text
stringlengths
2
6.14k
// Copyright (C) 2016 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-white-space description: > Mongolian Vowel Separator is not recognized as white space. info: | 11.2 White Space WhiteSpace :: <TAB> <VT> <FF> <SP> <NBSP> <ZWNBSP> <USP> <USP> :: Other category “Zs” code points General Category of U+180E is “Cf” (Format). negative: phase: parse type: SyntaxError features: [u180e] ---*/ throw "Test262: This statement should not be evaluated."; // U+180E between "var" and "foo"; UTF8(0x180E) = 0xE1 0xA0 0x8E var᠎foo;
// This file was procedurally generated from the following sources: // - src/async-generators/yield-as-identifier-reference-escaped.case // - src/async-generators/syntax/async-class-expr-method.template /*--- description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method as a ClassExpression element) esid: prod-AsyncGeneratorMethod features: [async-iteration] flags: [generated] negative: phase: parse type: SyntaxError info: | ClassElement : MethodDefinition MethodDefinition : AsyncGeneratorMethod Async Generator Function Definitions AsyncGeneratorMethod : async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } IdentifierReference : Identifier It is a Syntax Error if this production has a [Yield] parameter and StringValue of Identifier is "yield". ---*/ throw "Test262: This statement should not be evaluated."; var C = class { async *gen() { void yi\u0065ld; }};
L.CommunistWorker = L.AbstractWorker.extend({ statics: { // number of web workers, not using web workers when falsy NUM_WORKERS: 2 }, initialize: function (workerFunc) { this.workerFunc = workerFunc; }, onAdd: function (map) { this._workers = L.CommunistWorker.createWorkers(this.workerFunc); }, onRemove: function (map) { if (this._workers) { // TODO do not close when other layers are still using the static instance //this._workers.close(); } }, process: function(tile, callback) { if (this._workers){ tile._worker = this._workers.data(tile.datum).then(function(parsed) { if (tile._worker) { tile._worker = null; tile.parsed = parsed; tile.datum = null; callback(null, tile); } else { // tile has been unloaded, don't continue with adding //console.log('worker aborted ' + tile.key); } }); } else { callback(null, tile); } }, abort: function(tile) { if (tile._worker) { // TODO abort worker, would need to recreate after close //tile._worker.close(); tile._worker = null; } } }); L.communistWorker = function (workerFunc) { return new L.CommunistWorker(workerFunc); }; L.extend(L.CommunistWorker, { createWorkers: function(workerFunc) { if ( L.CommunistWorker.NUM_WORKERS && typeof Worker === "function" && typeof communist === "function" && !("workers" in L.CommunistWorker)) { L.CommunistWorker.workers = communist({ //data : L.TileLayer.Vector.parseData data : workerFunc }, L.CommunistWorker.NUM_WORKERS); } return L.CommunistWorker.workers; } });
/** * Copyright (c) 2013, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * https://raw.github.com/facebook/regenerator/master/LICENSE file. An * additional grant of patent rights can be found in the PATENTS file in * the same directory. */ var assert = require("assert"); var types = require("ast-types"); var n = types.namedTypes; var b = types.builders; var inherits = require("util").inherits; function Entry() { assert.ok(this instanceof Entry); } function FunctionEntry(returnLoc) { Entry.call(this); n.Literal.assert(returnLoc); Object.defineProperties(this, { returnLoc: { value: returnLoc } }); } inherits(FunctionEntry, Entry); exports.FunctionEntry = FunctionEntry; function LoopEntry(breakLoc, continueLoc, label) { Entry.call(this); n.Literal.assert(breakLoc); n.Literal.assert(continueLoc); if (label) { n.Identifier.assert(label); } else { label = null; } Object.defineProperties(this, { breakLoc: { value: breakLoc }, continueLoc: { value: continueLoc }, label: { value: label } }); } inherits(LoopEntry, Entry); exports.LoopEntry = LoopEntry; function SwitchEntry(breakLoc) { Entry.call(this); n.Literal.assert(breakLoc); Object.defineProperties(this, { breakLoc: { value: breakLoc } }); } inherits(SwitchEntry, Entry); exports.SwitchEntry = SwitchEntry; function TryEntry(catchEntry, finallyEntry) { Entry.call(this); if (catchEntry) { assert.ok(catchEntry instanceof CatchEntry); } else { catchEntry = null; } if (finallyEntry) { assert.ok(finallyEntry instanceof FinallyEntry); } else { finallyEntry = null; } Object.defineProperties(this, { catchEntry: { value: catchEntry }, finallyEntry: { value: finallyEntry } }); } inherits(TryEntry, Entry); exports.TryEntry = TryEntry; function CatchEntry(firstLoc, paramId) { Entry.call(this); n.Literal.assert(firstLoc); n.Identifier.assert(paramId); Object.defineProperties(this, { firstLoc: { value: firstLoc }, paramId: { value: paramId } }); } inherits(CatchEntry, Entry); exports.CatchEntry = CatchEntry; function FinallyEntry(firstLoc, nextLocTempVar) { Entry.call(this); n.Literal.assert(firstLoc); n.Identifier.assert(nextLocTempVar); Object.defineProperties(this, { firstLoc: { value: firstLoc }, nextLocTempVar: { value: nextLocTempVar } }); } inherits(FinallyEntry, Entry); exports.FinallyEntry = FinallyEntry; function LeapManager(emitter) { assert.ok(this instanceof LeapManager); var Emitter = require("./emit").Emitter; assert.ok(emitter instanceof Emitter); Object.defineProperties(this, { emitter: { value: emitter }, entryStack: { value: [new FunctionEntry(emitter.finalLoc)] } }); } var LMp = LeapManager.prototype; exports.LeapManager = LeapManager; LMp.withEntry = function(entry, callback) { assert.ok(entry instanceof Entry); this.entryStack.push(entry); try { callback.call(this.emitter); } finally { var popped = this.entryStack.pop(); assert.strictEqual(popped, entry); } }; LMp._leapToEntry = function(predicate, defaultLoc) { var entry, loc; var finallyEntries = []; var skipNextTryEntry = null; for (var i = this.entryStack.length - 1; i >= 0; --i) { entry = this.entryStack[i]; if (entry instanceof CatchEntry || entry instanceof FinallyEntry) { // If we are inside of a catch or finally block, then we must // have exited the try block already, so we shouldn't consider // the next TryStatement as a handler for this throw. skipNextTryEntry = entry; } else if (entry instanceof TryEntry) { if (skipNextTryEntry) { // If an exception was thrown from inside a catch block and this // try statement has a finally block, make sure we execute that // finally block. if (skipNextTryEntry instanceof CatchEntry && entry.finallyEntry) { finallyEntries.push(entry.finallyEntry); } skipNextTryEntry = null; } else if ((loc = predicate.call(this, entry))) { break; } else if (entry.finallyEntry) { finallyEntries.push(entry.finallyEntry); } } else if ((loc = predicate.call(this, entry))) { break; } } if (loc) { // fall through } else if (defaultLoc) { loc = defaultLoc; } else { return null; } n.Literal.assert(loc); var finallyEntry; while ((finallyEntry = finallyEntries.pop())) { this.emitter.emitAssign(finallyEntry.nextLocTempVar, loc); loc = finallyEntry.firstLoc; } return loc; }; function getLeapLocation(entry, property, label) { var loc = entry[property]; if (loc) { if (label) { if (entry.label && entry.label.name === label.name) { return loc; } } else { return loc; } } return null; } LMp.emitBreak = function(label) { var loc = this._leapToEntry(function(entry) { return getLeapLocation(entry, "breakLoc", label); }); if (loc === null) { throw new Error("illegal break statement"); } this.emitter.clearPendingException(); this.emitter.jump(loc); }; LMp.emitContinue = function(label) { var loc = this._leapToEntry(function(entry) { return getLeapLocation(entry, "continueLoc", label); }); if (loc === null) { throw new Error("illegal continue statement"); } this.emitter.clearPendingException(); this.emitter.jump(loc); };
/** * The main application class. An instance of this class is created by app.js when it calls * Ext.application(). This is the ideal place to handle application launch and initialization * details. * * */ Ext.define('Sample.Application', { extend: 'Devon.App', name: 'Sample', requires:[ 'Sample.Simlets' ], controllers: [ 'Sample.controller.main.MainController', 'Sample.controller.table.TablesController', 'Sample.controller.cook.CookController' ], launch: function() { Devon.Log.trace('Sample.app launch'); console.log('Sample.app launch'); if (document.location.toString().indexOf('useSimlets')>=0){ Sample.Simlets.useSimlets(); } this.callParent(arguments); } });
// Copyright (C) 2018 Andrew Paprocki. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-date.parse es6id: 20.3.3.2 description: > Date.parse return value is limited to specified time value maximum range info: | Date.parse ( string ) parse interprets the resulting String as a date and time; it returns a Number, the UTC time value corresponding to the date and time. A Date object contains a Number indicating a particular instant in time to within a millisecond. Such a Number is called a time value. The actual range of times supported by ECMAScript Date objects is slightly smaller: exactly -100,000,000 days to 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. This gives a range of 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC. includes: [propertyHelper.js] ---*/ const minDateStr = "-271821-04-20T00:00:00.000Z"; const minDate = new Date(-8640000000000000); assert.sameValue(minDate.toISOString(), minDateStr, "minDateStr"); assert.sameValue(Date.parse(minDateStr), minDate.valueOf(), "parse minDateStr"); const maxDateStr = "+275760-09-13T00:00:00.000Z"; const maxDate = new Date(8640000000000000); assert.sameValue(maxDate.toISOString(), maxDateStr, "maxDateStr"); assert.sameValue(Date.parse(maxDateStr), maxDate.valueOf(), "parse maxDateStr"); const belowRange = "-271821-04-19T23:59:59.999Z"; const aboveRange = "+275760-09-13T00:00:00.001Z"; assert.sameValue(Date.parse(belowRange), NaN, "parse below minimum time value"); assert.sameValue(Date.parse(aboveRange), NaN, "parse above maximum time value");
var crypto = require('crypto'); var Canvas = require('canvas'); var _ = require('lodash'); var bu = require('./bufutil'); var fmt = require('util').format; var unpack = require('./unpack'); var bright = require('./bright'); function fprint(buf, len) { if (len > 64) throw new Error(fmt("sha512 can only generate 64B of data: %dB requested", len)); return _(crypto.createHash('sha512').update(buf).digest()) .groupBy(function (x, k) { return Math.floor(k/len); }) .reduce(bu.xor); } function idhash(str, n, minFill, maxFill) { var buf = new Buffer(str.length + 1); buf.write(str); for (var i=0; i<0x100; i++) { buf[buf.length - 1] = i; var f = fprint(buf, Math.ceil(n/8)+6); var pixels = _(f.slice(6)) .map(function (x) { return unpack(x); }) .flatten().take(n); var setPixels = pixels.filter().size(); var c = [ f.slice(0, 3), f.slice(3, 6)]; c.sort(bright.cmp); if (setPixels > (minFill * n) && setPixels < (maxFill * n)) return { colors: c.map(function (x) { return x.toString('hex'); }), pixels: pixels.value() }; } throw new Error(fmt("String '''%s''' unhashable in single-byte search space.", str)); } function reflect(id, dimension) { var mid = Math.ceil(dimension / 2); var odd = Boolean(dimension % 2); var pic = []; for (var row=0; row<dimension; row++) { pic[row] = []; for (var col=0; col<dimension; col++) { var p = (row * mid) + col; if (col>=mid) { var d = mid - (odd ? 1 : 0) - col; var ad = Math.abs(d); p = (row * mid) + mid - 1 - ad; } pic[row][col] = id.pixels[p]; // console.error(fmt("looking for %d, of %d for %d,%d", p, id.pixels.length, row, col)) } } return pic; } function retricon(str, opts) { opts = _.merge({}, retricon.defaults, opts); var dimension = opts.tiles; var pixelSize = opts.pixelSize; var border = opts.pixelPadding; var mid = Math.ceil(dimension / 2); var id = idhash(str, mid * dimension, opts.minFill, opts.maxFill); var pic = reflect(id, dimension); var csize = (pixelSize * dimension) + (opts.imagePadding * 2); var c = Canvas.createCanvas(csize, csize); var ctx = c.getContext('2d'); if (_.isString(opts.bgColor)) { ctx.fillStyle = opts.bgColor; } else if (_.isNumber(opts.bgColor)) { ctx.fillStyle = '#' + id.colors[opts.bgColor]; } if (! _.isNull(opts.bgColor)) ctx.fillRect(0, 0, csize, csize); var drawOp = ctx.fillRect.bind(ctx); if (_.isString(opts.pixelColor)) { ctx.fillStyle = opts.pixelColor; } else if (_.isNumber(opts.pixelColor)) { ctx.fillStyle = '#' + id.colors[opts.pixelColor]; } else { drawOp = ctx.clearRect.bind(ctx); } for (var x=0; x<dimension; x++) for (var y=0; y<dimension; y++) if (pic[y][x]) drawOp((x*pixelSize) + border + opts.imagePadding, (y*pixelSize) + border + opts.imagePadding, pixelSize - (border * 2), pixelSize - (border * 2)); return c; } retricon.defaults = { pixelSize: 10, bgColor: null, pixelPadding: 0, imagePadding: 0, tiles: 5, minFill: 0.3, maxFill: 0.90, pixelColor: 0 }; retricon.style = { github: { pixelSize: 70, bgColor: '#F0F0F0', pixelPadding: -1, imagePadding: 35, tiles: 5 }, gravatar: { tiles: 8, bgColor: 1 }, mono: { bgColor: '#F0F0F0', pixelColor: '#000000', tiles: 6, pixelSize: 12, pixelPadding: -1, imagePadding: 6 }, mosaic: { imagePadding: 2, pixelPadding: 1, pixelSize: 16, bgColor: '#F0F0F0' }, mini: { pixelSize: 10, pixelPadding: 1, tiles: 3, bgColor: 0, pixelColor: 1 }, window: { pixelColor: null, bgColor: 0, imagePadding: 2, pixelPadding: 1, pixelSize: 16 } }; module.exports = retricon;
var compilerSupport=require('../../src/compilerSupport');var main = function () { var __builder = new compilerSupport.TaskBuilder(), __state = 0, __continue = __builder.CONT, __ex; var data; return __builder.run(function () { switch (__state) { case 0: { data = 12345; console.log("data: " + data); __state = -1; __builder.ret(data); break; } default: throw 'Internal error: encountered wrong state'; } }); }; main().then(function(x) { console.log("returned: " + x); }, function(y) { console.log("failed: " + y); });
var searchData= [ ['lcd_2ec',['lcd.c',['../lcd_8c.html',1,'']]], ['lcd_2eh',['lcd.h',['../lcd_8h.html',1,'']]], ['light_2ec',['light.c',['../light_8c.html',1,'']]], ['light_2eh',['light.h',['../light_8h.html',1,'']]] ];
var files = [ [ "Code", "dir_a44bec13de8698b1b3f25058862347f8.html", "dir_a44bec13de8698b1b3f25058862347f8" ] ];
// Copyright (C) 2015 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-array.from es6id: 22.1.2.1 description: Value returned by mapping function (traversed via iterator) info: | [...] 2. If mapfn is undefined, let mapping be false. 3. else a. If IsCallable(mapfn) is false, throw a TypeError exception. b. If thisArg was supplied, let T be thisArg; else let T be undefined. c. Let mapping be true [...] 6. If usingIterator is not undefined, then [...] g. Repeat [...] vii. If mapping is true, then 1. Let mappedValue be Call(mapfn, T, «nextValue, k»). 2. If mappedValue is an abrupt completion, return IteratorClose(iterator, mappedValue). 3. Let mappedValue be mappedValue.[[value]]. features: [Symbol.iterator] ---*/ var thisVals = []; var nextResult = { done: false, value: {} }; var nextNextResult = { done: false, value: {} }; var firstReturnVal = {}; var secondReturnVal = {}; var mapFn = function(value, idx) { var returnVal = nextReturnVal; nextReturnVal = nextNextReturnVal; nextNextReturnVal = null; return returnVal; }; var nextReturnVal = firstReturnVal; var nextNextReturnVal = secondReturnVal; var items = {}; var result; items[Symbol.iterator] = function() { return { next: function() { var result = nextResult; nextResult = nextNextResult; nextNextResult = { done: true }; return result; } }; }; result = Array.from(items, mapFn); assert.sameValue(result.length, 2); assert.sameValue(result[0], firstReturnVal); assert.sameValue(result[1], secondReturnVal);
var _ = require('lodash'); var requireAll = require('require-all'); function load(router, options) { if (_.isString(options)) options = {dirname: options}; return requireAll(_.defaults(options, { filter: /(.*Controller)\.js$/, recursive: true, resolve: function (Controller) { var c = new (Controller.__esModule ? Controller.default : Controller)(); c.register && c.register(router); return c; } })); } module.exports = load;
/** * Layout Select UI * * @package zork * @subpackage form * @author Kristof Matos <kristof.matos@megaweb.hu> */ ( function ( global, $, js ) { "use strict"; if ( typeof js.layoutSelect !== "undefined" ) { return; } js.require( "jQuery.fn.vslider"); /** * Generates layout select user interface from radio inputs * * @memberOf Zork.Form.Element */ global.Zork.prototype.layoutSelect = function ( element ) { js.style('/styles/scripts/layoutselect.css'); element = $( element ); var defaultKey = element.data( "jsLayoutselectDefaultkey") || "paragraph.form.content.layout.default", descriptionKeyPattern = element.data( "jsLayoutselectDescriptionkey") || "paragraph.form.content.layout.default-description", imageSrcPattern = element.data( "jsLayoutselectImagesrc") || "", selectType = element.data( "jsLayoutselectType") || "locale", itemsPerRow = parseInt(element.data("jsLayoutselectItemsperrow"))>0 ? parseInt(element.data("jsLayoutselectItemsperrow")) : ( selectType == "local" ? 6 : 3 ); element.addClass( "layout-select "+selectType); element.find( "label" ).each( function(idx,eleRadioItem) { var input = $(eleRadioItem).find( ":radio" ), inner = $('<div class="inner"/>').append(input), title = $('<div class="title"/>').html( $(eleRadioItem).html() || js.core.translate(defaultKey) ), overlay = $('<div class="overlay"/>'), innerButtons = $('<div class="buttons"/>').appendTo(inner), innerDescription = $('<p class="description"/>').appendTo(inner), innerButtonsSelect = $('<span class="select"/>') .html( js.core.translate("default.select" ,js.core.userLocale) ) .appendTo(innerButtons), dateCreated = input.data("created") || '-', dateModified = input.data("lastModified") || '-'; $(eleRadioItem).html('') .append(inner) .append(title) .append(overlay); if( selectType == 'import' ) { innerDescription.html( js.core.translate( descriptionKeyPattern.replace("[value]", input.attr( "value")) ,js.core.userLocale)); var imageSrc = imageSrcPattern .replace("[value]",input.attr( "value")); inner.prepend( $( "<img alt='icon' />" ).attr( "src", imageSrc )); } else//selectType == 'locale' { if( input.attr( "value") ) { innerDescription .append( $('<div/>') .append( $('<span/>').html( js.core.translate("default.lastmodified", js.core.userLocale) +': ') ) .append( $('<span/>').html(dateModified) ) ) .append( $('<div/>') .append( $('<span/>').html( js.core.translate("default.created", js.core.userLocale) +': ') ) .append( $('<span/>').html(dateCreated) ) ); js.core.translate("default.created",js.core.userLocale) innerButtons.prepend( $('<a class="preview"/>') .html( js.core.translate("default.preview" ,js.core.userLocale) ) .attr('href','/app/'+js.core.userLocale +'/paragraph/render/'+input.attr( "value")) .attr('target','_blank') ); } } innerButtonsSelect.on( "click", function(evt) { element.find( "label" ).removeClass("selected"); $(evt.target.parentNode.parentNode.parentNode).addClass("selected"); } ); } ); var eleRow, eleRowsContainer = $('<div/>').appendTo(element); element.find( "label" ).each( function(idxItem,eleItem) { if( idxItem%itemsPerRow==0 ) { eleRow = $('<div />').appendTo(eleRowsContainer); } eleRow.append(eleItem); } ); $(eleRowsContainer).vslider({"items":"div", "itemheight":( selectType == 'local' ? 300 : 255 )}); { setTimeout( function(){ $('.ui-vslider').vslider('refresh') },100 ); } }; global.Zork.prototype.layoutSelect.isElementConstructor = true; } ( window, jQuery, zork ) );
/** * @author */ imports("Controls.Composite.Carousel"); using("System.Fx.Marquee"); var Carousel = Control.extend({ onChange: function (e) { var ul = this.find('.x-carousel-header'), t; if (t = ul.first(e.from)) t.removeClass('x-carousel-header-selected'); if(t = ul.first(e.to)) t.addClass('x-carousel-header-selected'); }, init: function (options) { var me = this; me.marquee = new Marquee(me, options.direction, options.loop, options.deferUpdate); if (options.duration != null) me.marquee.duration = options.duration; if (options.delay != null) me.marquee.delay = options.delay; me.marquee.on('changing', me.onChange, me); me.query('.x-carousel-header > li').setWidth(me.getWidth() / me.marquee.length).on(options.event || 'mouseover', function (e) { me.marquee.moveTo(this.index()); }); me.onChange({to: 0}); me.marquee.start(); } }).defineMethods("marquee", "moveTo moveBy start stop");
import React from "react"; import { expect } from "chai"; import { mount } from "enzyme"; import { Provider } from "react-redux"; import Editor from "../../../src/notebook/providers/editor"; import { dummyStore } from "../../utils"; import { UPDATE_CELL_SOURCE, FOCUS_CELL_EDITOR } from "../../../src/notebook/constants"; describe("EditorProvider", () => { const store = dummyStore(); const setup = (id, cellFocused = true) => mount( <Provider store={store}> <Editor id={id} cellFocused={cellFocused} /> </Provider> ); it("can be constructed", () => { const component = setup("test"); expect(component).to.not.be.null; }); it("onChange updates cell source", () => new Promise(resolve => { const dispatch = action => { expect(action.id).to.equal("test"); expect(action.source).to.equal("i love nteract"); expect(action.type).to.equal(UPDATE_CELL_SOURCE); resolve(); }; store.dispatch = dispatch; const wrapper = setup("test"); const onChange = wrapper .findWhere(n => n.prop("onChange") !== undefined) .first() .prop("onChange"); onChange("i love nteract"); })); it("onFocusChange can update editor focus", () => new Promise(resolve => { const dispatch = action => { expect(action.id).to.equal("test"); expect(action.type).to.equal(FOCUS_CELL_EDITOR); resolve(); }; store.dispatch = dispatch; const wrapper = setup("test"); const onFocusChange = wrapper .findWhere(n => n.prop("onFocusChange") !== undefined) .first() .prop("onFocusChange"); onFocusChange(true); })); });
var NETKI_PUBAPI_HOST = 'https://pubapi.netki.com'; var NETKI_API_HOST = 'https://api.netki.com'; var SHORTCODES = { 'btc': 'Bitcoin', 'tbtc': 'Bitcoin Testnet', 'ltc': 'Litecoin', 'dgc': 'Dogecoin', 'nmc': 'Namecoin', 'tusd': 'tetherUSD', 'teur': 'tetherEUR', 'tjpy': 'tetherJPY', 'oap': 'Open Asset', 'fct': 'Factom Factoid', 'fec': 'Factom Entry Credit', 'eth': 'Ethereum Ether' }; function isWalletName(walletName) { var pattern = /^(?!:\/\/)([a-zA-Z0-9]+\.)?[a-zA-Z0-9][a-zA-Z0-9-]+\.[a-zA-Z]{2,24}?$/i; return pattern.test(walletName); }
/* eslint-disable no-underscore-dangle */ export default function ({ client, filterQuery, mustContain, busy, encodeQueryAsString, }) { return { listUsers(query) { const params = filterQuery( query, 'text', 'limit', 'offset', 'sort', 'sortdir' ); return busy( client._.get('/user', { params, }) ); }, createUser(user) { const expected = [ 'login', 'email', 'firstName', 'lastName', 'password', 'admin', ]; const params = filterQuery(user, ...expected); const { missingKeys, promise } = mustContain(user, ...expected); return missingKeys ? promise : busy(client._.post(`/user${encodeQueryAsString(params)}`)); }, changePassword(old, newPassword) { const params = { old, new: newPassword, }; return busy(client._.put(`/user/password${encodeQueryAsString(params)}`)); }, resetPassword(email) { const params = { email, }; return busy( client._.delete('/user/password', { params, }) ); }, deleteUser(id) { return busy(client._.delete(`/user/${id}`)); }, getUser(id) { return busy(client._.get(`/user/${id}`)); }, updateUser(user) { const expected = ['email', 'firstName', 'lastName', '_id']; const params = filterQuery(user, ...expected.slice(0, 3)); // Remove '_id' const { missingKeys, promise } = mustContain(user, ...expected); return missingKeys ? promise : busy(client._.put(`/user/${user._id}${encodeQueryAsString(params)}`)); }, }; }
/** * Swedish translation for bootstrap-wysihtml5 */ (function($){ $.fn.wysihtml5.locale["sv-SE"] = { font_styles: { normal: "Normal Text", h1: "Rubrik 1", h2: "Rubrik 2", h3: "Rubrik 3" }, emphasis: { bold: "Fet", italic: "Kursiv", underline: "Understruken" }, lists: { unordered: "Osorterad lista", ordered: "Sorterad lista", outdent: "Minska indrag", indent: "Öka indrag" }, link: { insert: "Lägg till länk", cancel: "Avbryt" }, image: { insert: "Lägg till Bild", cancel: "Avbryt" }, html: { edit: "Redigera HTML" }, colours: { black: "Svart", silver: "Silver", gray: "Grå", maroon: "Kastaniebrun", red: "Röd", purple: "Lila", green: "Grön", olive: "Olivgrön", navy: "Marinblå", blue: "Blå", orange: "Orange" } }; }(jQuery));
// Benchpress: A collection of micro-benchmarks. var allResults = [ ]; // ----------------------------------------------------------------------------- // F r a m e w o r k // ----------------------------------------------------------------------------- function Benchmark(string, run) { this.string = string; this.run = run; } // Run each benchmark for two seconds and count number of iterations. function time(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 2000; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; allResults.push(usec); print('Time (' + benchmark.string + '): ' + Math.floor(usec) + ' us.'); } function error(string) { print(string); } // ----------------------------------------------------------------------------- // L o o p // ----------------------------------------------------------------------------- function loop() { var sum = 0; for (var i = 0; i < 200; i++) { for (var j = 0; j < 100; j++) { sum++; } } if (sum != 20000) error("Wrong result: " + sum + " should be: 20000"); } var Loop = new Benchmark("Loop", loop); // ----------------------------------------------------------------------------- // M a i n // ----------------------------------------------------------------------------- time(Loop); var logMean = 0; for (var i = 0; i < allResults.length; i++) logMean += Math.log(allResults[i]); logMean /= allResults.length; print("Geometric mean: " + Math.round(Math.pow(Math.E, logMean)) + " us.");
'use strict'; myApp.controller('editProfileController', ['$scope', '$state', 'loadingMaskService', 'CONSTANTS', '$uibModal', '$log', '$rootScope', '$http', function ($scope, $state, loadingMaskService, CONSTANTS, $uibModal, $log, $rootScope, $http) { var userInfo = JSON.parse(localStorage.getItem(CONSTANTS.LOCAL_STORAGE_KEY)); $scope.email = userInfo.email; $scope.date = userInfo.birthDate; $scope.firstName = userInfo.firstName; $scope.lastName = userInfo.lastName; $scope.relations = userInfo.relations; $scope.relationOptions = ['Мама', 'Отец', 'Брат']; $scope.submit = function () { if ($scope.editProfileForm.$valid && $scope.editProfileForm.$dirty) { // if form is valid var userInfo = { email: $scope.email, birthDate: $scope.date, firstName: $scope.firstName, lastName: $scope.lastName, relations: $scope.relations }; $http({ method: 'POST', url: '/editRelation', data: { email: userInfo.email, relations: $scope.relations } }).then(function successCallback(response) { localStorage.setItem(CONSTANTS.LOCAL_STORAGE_KEY, JSON.stringify(userInfo)); loadingMaskService.sendRequest(); $state.go('mainPageState.userProfile'); }, function errorCallback(response) { // called asynchronously if an error occurs // or server returns response with an error status. }); } }; $rootScope.$on('relationsUpdated', function(event, relations){ $scope.relations = relations; }); $rootScope.$on('relationRemoved', function(event, relations){ $scope.relations = relations; }); $scope.removeRelation = function(index) { var modalInstance = $uibModal.open({ templateUrl: 'app/pages/src/editProfilePage/src/tpl/removeRelationConfirm.tpl.html', controller: 'removeRelationController', resolve: { index: function () { return index } } }); } $scope.open = function (size) { var modalInstance = $uibModal.open({ templateUrl: 'app/pages/src/editProfilePage/src/tpl/addARelation.tpl.html', controller: 'addRelationController' }); }; }]);
/* * Copyright (c) 2011 Yahoo! Inc. All rights reserved. */ YUI.add('master', function(Y, NAME) { /** * The master module. * * @module master */ var DIMENSIONS = { device: 'smartphone', region: 'CA', skin : 'grey' }; /** * Constructor for the Controller class. * * @class Controller * @constructor */ Y.mojito.controllers[NAME] = { init: function(config) { this.config = config; }, /** * Method corresponding to the 'index' action. * * @param ac {Object} The ActionContext that provides access * to the Mojito API. */ index: function(ac) { var dims = ac.params.getFromUrl(), self = this, config = { view: 'index', children: { primary: { type: 'primary', action: 'index' }, secondary: { type: 'secondary', action: 'index' } } }; ac.composite.execute(config, function (data, meta) { data.buttons = self.createButtons(ac, dims); ac.done(data, meta); }); }, createButtons: function (ac, dims) { var buttons = [], className, label, url; Y.each(Y.Object.keys(DIMENSIONS), function (dim) { var params = Y.merge({}, dims); className = 'nav nav-' + dim + (dims[dim] ? ' active' : ''); params[dim] ? delete params[dim] : params[dim] = DIMENSIONS[dim]; url = ac.url.make('htmlframe', 'index', null, 'GET', params); label = dim.substring(0,1).toUpperCase() + dim.substring(1); buttons.push('<a href="'+url+'" class="'+className+'">'+label+'</a>'); }); return buttons.join('\n'); } }; }, '0.0.1', {requires: ['mojito', 'mojito-assets-addon']});
import React from 'react'; import 'isomorphic-fetch'; import {RouteHandler} from 'react-router'; import Transmit from 'react-transmit'; import {createStore, combineReducers} from 'redux'; import {Provider} from 'react-redux'; import * as reducers from '../reducers/index'; class AppContainer extends React.Component { static propTypes = { initialState: React.PropTypes.object.isRequired } render() { const reducer = combineReducers(reducers); const store = createStore(reducer, this.props.initialState); return ( <Provider store={store}> {() => <RouteHandler /> } </Provider> ); } } export default Transmit.createContainer(AppContainer, { queries: {} });
require("../pc.v0"); require("util").puts(JSON.stringify({ "name": "pc", "version": pc.version, "description": "property creation for reusable d3.js code.", "keywords": ["d3", "visualization"], "homepage": "http://milroc.github.com/pc/", "author": {"name": "Miles McCrocklin", "url": "http://www.milesmccrocklin.com" }, "repository": {"type": "git", "url": "http://github.com/milroc/pc.git"}, "devDependencies": { "uglify-js": "1.2.6", "vows": "0.6.0" } }, null, 2));
var sbModule = angular.module('sbServices', ['ngResource']); sbModule.factory('App', function($resource) { return $resource('/api/v1/app/:name', { q: '' }, { get: { method: 'GET' }, //isArray: false }, query: { method: 'GET'} //, params: { q: '' }//, isArray: false } }); });
'use strict'; describe('Directive: searchFilters', function () { // load the directive's module beforeEach(module('searchApp')); var element, scope; beforeEach(inject(function ($rootScope) { scope = $rootScope.$new(); })); it('should make hidden element visible', inject(function ($compile) { element = angular.element('<search-filters></search-filters>'); element = $compile(element)(scope); expect(element.text()).toBe('this is the searchFilters directive'); })); });
// 1000-page badge // Awarded when total read page count exceeds 1000. var sys = require('sys'); var _ = require('underscore'); var users = require('../../users'); var badge_template = require('./badge'); // badge key, must be unique. var name = "1000page"; exports.badge_info = { id: name, name: "1,000 Pages", achievement: "Reading over 1,000 pages." } // the in-work state of a badge for a user function Badge (userid) { badge_template.Badge.apply(this,arguments); this.id = name; this.page_goal = 1000; }; // inherit from the badge template sys.inherits(Badge, badge_template.Badge); // Steps to perform when a book is added or modified in the read list Badge.prototype.add_reading_transform = function(reading,callback) { var pages = parseInt(reading.book.pages); if (_.isNumber(pages)) { this.state[reading.book_id] = pages } callback(); }; // Steps to perform when a book is removed from the read list. Badge.prototype.remove_book_transform = function(book,callback) { delete(this.state[book.id]); callback(); }; // determine if the badge should be awarded, and if yes, do so Badge.prototype.should_award = function(callback) { // sum all page counts in state var pagecount = 0; for (bookid in this.state) { pagecount += this.state[bookid] } return (pagecount >= this.page_goal); } exports.Badge = Badge;
var $ = require('jquery'); var CoreView = require('backbone/core-view'); var checkAndBuildOpts = require('builder/helpers/required-opts'); var REQUIRED_OPTS = [ 'el' ]; module.exports = CoreView.extend({ events: { 'click .js-foo': '_fooHandler' }, initialize: function (opts) { checkAndBuildOpts(opts, REQUIRED_OPTS, this); this._onWindowScroll = this._onWindowScroll.bind(this); this._topBoundary = this.$el.offset().top; this._initBinds(); }, _initBinds: function () { this._bindScroll(); }, _onWindowScroll: function () { this.$el.toggleClass('is-fixed', $(window).scrollTop() > this._topBoundary); }, _unbindScroll: function () { $(window).unbind('scroll', this._onWindowScroll); }, _bindScroll: function () { this._unbindScroll(); $(window).bind('scroll', this._onWindowScroll); }, clean: function () { this._unbindScroll(); } });
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. (function() { "use strict"; var runFunc; var count = 0; function getId() { return "code" + (count++); } function text(node) { var s = ""; for (var i = 0; i < node.childNodes.length; i++) { var n = node.childNodes[i]; if (n.nodeType === 1 && n.tagName === "SPAN" && n.className != "number") { var innerText = n.innerText === undefined ? "textContent" : "innerText"; s += n[innerText] + "\n"; continue; } if (n.nodeType === 1 && n.tagName !== "BUTTON") { s += text(n); } } return s; } function init(code) { var id = getId(); var output = document.createElement('div'); var outpre = document.createElement('pre'); var stopFunc; function onKill() { if (stopFunc) { stopFunc(); } } function onRun(e) { onKill(); outpre.innerHTML = ""; output.style.display = "block"; run.style.display = "none"; var options = {Race: e.shiftKey}; stopFunc = runFunc(text(code), outpre, options); } function onClose() { onKill(); output.style.display = "none"; run.style.display = "inline-block"; } var run = document.createElement('button'); run.innerHTML = 'Run'; run.className = 'run'; run.addEventListener("click", onRun, false); var run2 = document.createElement('button'); run2.className = 'run'; run2.innerHTML = 'Run'; run2.addEventListener("click", onRun, false); var kill = document.createElement('button'); kill.className = 'kill'; kill.innerHTML = 'Kill'; kill.addEventListener("click", onKill, false); var close = document.createElement('button'); close.className = 'close'; close.innerHTML = 'Close'; close.addEventListener("click", onClose, false); var button = document.createElement('div'); button.classList.add('buttons'); button.appendChild(run); // Hack to simulate insertAfter code.parentNode.insertBefore(button, code.nextSibling); var buttons = document.createElement('div'); buttons.classList.add('buttons'); buttons.appendChild(run2); buttons.appendChild(kill); buttons.appendChild(close); output.classList.add('output'); output.appendChild(buttons); output.appendChild(outpre); output.style.display = "none"; code.parentNode.insertBefore(output, button.nextSibling); } var play = document.querySelectorAll('div.playground'); for (var i = 0; i < play.length; i++) { init(play[i]); } if (play.length > 0) { if (window.connectPlayground) { runFunc = window.connectPlayground("ws://" + window.location.host + "/socket"); } else { // If this message is logged, // we have neglected to include socket.js or playground.js. console.log("No playground transport available."); } } })();
var PgQuery = require('bindings')('pg-query'); module.exports = { parse: function(query) { var result = PgQuery.parse(query); if (result.query) { result.query = JSON.parse(result.query); } if (result.error) { var err = new Error(result.error.message); err.fileName = result.error.fileName; err.lineNumber = result.error.lineNumber; err.cursorPosition = result.error.cursorPosition; err.functionName = result.error.functionName; err.context = result.error.context; result.error = err; } return result; } };
// Replacement for jquery.ui.accordion to avoid dealing with // jquery.ui theming. // // Usage: $('#container').squeezebox(options); // where the direct child elements of '#container' are // sequential pairs of header/panel elements, and options // is an optional object with any of the following properties: // // activeHeaderClass: Class name to apply to the active header // headerSelector: Selector for the header elements // nextPanelSelector: Selector for the next panel from a header // speed: Animation speed (function($) { $.fn.squeezebox = function(options) { // Default options. options = $.extend({ activeHeaderClass: 'squeezebox-header-on', headerSelector: '> *:even', nextPanelSelector: ':first', speed: 500 }, options); var headers = this.find(options.headerSelector); // When a header is clicked, iterate through each of the // headers, getting their corresponding panels, and opening // the panel for the header that was clicked (slideDown), // closing the others (slideUp). headers.click(function() { var clicked = this; $.each(headers, function(i, header) { var panel = $(header).next(options.nextPanelSelector); if (clicked == header) { panel.slideDown(options.speed); $(header).addClass(options.activeHeaderClass); } else { panel.slideUp(options.speed); $(header).removeClass(options.activeHeaderClass); } }); }); }; })(jQuery);
define(function () { return [ { "default": { name: 'form1', label: 'Form 1', "_elements": [ { "default": { "name": "id", "type": "hidden" } }, { "default": { "name": "test1", "type": "text", "label": "Test1", "defaultValue": "test1", "page": 0 } }, { "default": { "name": "test2", "type": "text", "label": "Test2", "defaultValue": "test2", "page": 0 } }, { "default": { "name": "calc_button", "type": "button", "label": "Calculate", "persist": false, "page": 0 } }, { "default": { "name": "calc", "type": "message", "label": "Calc", "labelPlacement": "default", "labelStyle": "Plain", "showTextbox": "show", "calculationType": "manual", "buttonText": "Calculate", "persist": true, "page": 0 } } ], "_checks": [ ], "_actions": [ { "default": { "javascript": "\"[test1]\"+\"[test2]\"", "outputTarget": "calc", "name": "CALC_calc" } } ], "_behaviours": [ { "default": { "name": "auto_calculations", "trigger": { "formElements": ["calc_button"] }, "actions": [ "CALC_calc" ] } } ] } } ]; });
////functionen hämtar alla artiklar med hjälp av getJSON //och får tillbaka en array med alla artiklar //efter den är klar kallar den på functionen ShoArtTab. //som skriver ut alla artiklar i en tabell. function getAllAdminProducts() { $.getJSON("index2.php/getAllProducts").done(showArtTab); } //functionen showArtTab får en array av getAllArticle funktionen //som den loopar igenom och anväder för att skapa upp en tabell med alla de olika //artiklarna function showArtTab(cart){ var mainTabell = document.createElement('div'); mainTabell.setAttribute('id', 'mainTabell'); var tbl = document.createElement('table'); tbl.setAttribute('border', '1'); var tr = document.createElement('tr'); var th2 = document.createElement('th'); var txt2 = document.createTextNode('Produktid'); var th3 = document.createElement('th'); var txt3 = document.createTextNode('Produktnamn'); var th4 = document.createElement('th'); var txt4 = document.createTextNode('Kategori'); var th5 = document.createElement('th'); var txt5 = document.createTextNode('Pris'); var th6 = document.createElement('th'); var txt6 = document.createTextNode('Bild'); var th7 = document.createElement('th'); var txt7 = document.createTextNode('Delete'); var th8 = document.createElement('th'); var txt8 = document.createTextNode('Update'); th2.appendChild(txt2); tr.appendChild(th2); th3.appendChild(txt3); tr.appendChild(th3); th4.appendChild(txt4); tr.appendChild(th4); th5.appendChild(txt5); tr.appendChild(th5); th6.appendChild(txt6); tr.appendChild(th6); th7.appendChild(txt7); tr.appendChild(th7); th8.appendChild(txt8); tr.appendChild(th8); tbl.appendChild(tr); var i = 0; do{ var row = tbl.insertRow(-1); row.insertCell(-1).innerHTML = cart[i].produktid; var cell2 = row.insertCell(-1); cell2.innerHTML = cart[i].namn; var cell3 = row.insertCell(-1); cell3.innerHTML = cart[i].kategori; var cell4 = row.insertCell(-1); cell4.innerHTML = cart[i].pris; var cell6 = row.insertCell(-1); cell6.innerHTML = '<img src="' + cart[i].img + '" height="70" width="70"/>'; var cell7 = row.insertCell(-1); cell7.innerHTML = "<a href='#' onclick='removeArt(\"" +cart[i].produktid+ "\",\""+ "\");'>Remove</a>"; var cell8 = row.insertCell(-1); cell8.innerHTML = "<a href='#' onclick='getUpdate(\"" +cart[i].produktid+ "\",\""+ "\");'>Update</a>"; tbl.appendChild(row); i++; }while(i< cart.length); $('#main').html(tbl); } //öppnar en dialogruta när man trycker på "Add Article" knappen //med det som finns i diven med id:addArt function showAddArt(){ $('#addArt').dialog({ show:'fade', position:'center' }); } //när man trycker på "Add Article" knappen i dialogrutan så ska den lägga till datan //från formuläret som görs med .serialize som hämtar datan från textfälten. function addArticle(){ $.post('index2.php/AdminController/addProduct',$('#addArtForm').serialize()).done(getAllAdminProducts); $("#addArt").dialog('close'); } //tar bort en artikel med att hämta in dess namn och skicka förfrågningen till modellen function deleteArt(prodid) { $.getJSON("index2.php/AdminController/deleteProduct/"+prodid); } function removeArt(prodid){ var r=confirm("Vill du ta bort den här produkten?"); if (r==true) { x="JA"; } else { x="NEJ"; } if(x === "JA"){ deleteArt(prodid); getAllAdminProducts(); } } //en function som tar in namnet //och använder det när man kallar på getArt function getUpdate(prodid){ getArt(prodid); } //får in artikelid och använder det för att hämta alla artiklar som har samma //id med hjälp av modellen. function getArt(prodid){ $.getJSON("index2.php/Controller/getProdById/"+prodid).done(showArt); } //en function som visar en dialog ruta med färdig i fylld data i textfällten //från den uppgift man vill uppdatera. function showArt(data){ $('#updateId').attr('value',data[0].produktid); $('#updateNamn').attr('value',data[0].namn); $('#updateKategori').attr('value',data[0].kategori); $('#updatePris').attr('value',data[0].pris); $('#updateImg').attr('value',data[0].img); $('#update').dialog({ show:'fade', position:'center', }); } //när man trycker på uppdatera så hämtar den datan från forumlätert med hjälp av // .serialize och skickar datan till modellen. //stänger sen dialogrutan. function updateArt(){ $.post("index2.php/AdminController/updateProduct/", $('#updateForm').serialize()).done(getAllAdminProducts); $("#update").dialog('close'); }
'use strict'; module.exports = function (Logger, $rootScope) { return { restrict: 'A', scope: { hasRank: '=' }, link: function ($scope, elem, attrs) { $rootScope.$watch('currentUser', function () { Logger.info('Checking for rank: ' + $scope.hasRank); if ($rootScope.currentUser && $rootScope.currentUser.rank >= $scope.hasRank) { elem.show(); } else { elem.hide(); } }); } }; };
/* * jQuery File Upload Plugin JS Example 8.9.1 * https://github.com/blueimp/jQuery-File-Upload * * Copyright 2010, Sebastian Tschan * https://blueimp.net * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ /* global $, window */ $(function () { 'use strict'; // Initialize the jQuery File Upload widget: $('#fileupload').fileupload({ // Uncomment the following to send cross-domain cookies: //xhrFields: {withCredentials: true}, url: root_url + '/media/upload' }); // Enable iframe cross-domain access via redirect option: $('#fileupload').fileupload( 'option', 'redirect', window.location.href.replace( /\/[^\/]*$/, '/cors/result.html?%s' ) ); if (window.location.hostname === 'blueimp.github.io') { // Demo settings: $('#fileupload').fileupload('option', { url: '//jquery-file-upload.appspot.com/', // Enable image resizing, except for Android and Opera, // which actually support image resizing, but fail to // send Blob objects via XHR requests: disableImageResize: /Android(?!.*Chrome)|Opera/ .test(window.navigator.userAgent), maxFileSize: 5000000, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i }); // Upload server status check for browsers with CORS support: if ($.support.cors) { $.ajax({ url: '//jquery-file-upload.appspot.com/', type: 'HEAD' }).fail(function () { $('<div class="alert alert-danger"/>') .text('Upload server currently unavailable - ' + new Date()) .appendTo('#fileupload'); }); } } else { // Load existing files: $('#fileupload').addClass('fileupload-processing'); $.ajax({ // Uncomment the following to send cross-domain cookies: //xhrFields: {withCredentials: true}, url: $('#fileupload').fileupload('option', 'url'), dataType: 'json', context: $('#fileupload')[0] }).always(function () { $(this).removeClass('fileupload-processing'); }).done(function (result) { $(this).fileupload('option', 'done') .call(this, $.Event('done'), {result: result}); }); } /////////////////////////////////////////////// });
/*! * speedt * Copyright(c) 2015 speedt <13837186852@qq.com> * BSD 3 Licensed */ 'use strict'; var utils = require('speedt-utils'); var Service = function(app){ var self = this; // TODO self.serverId = app.getServerId(); self.connCount = 0; self.loginedCount = 0; self.logined = {}; }; module.exports = Service; var proto = Service.prototype; proto.increaseConnectionCount = function(){ return ++this.connCount; }; proto.decreaseConnectionCount = function(uid){ var self = this; // TODO var result = [--self.connCount]; // TODO if(uid) result.push(removeLoginedUser.call(self, uid)); return result; }; proto.replaceLoginedUser = function(uid, info){ var self = this; // TODO var user = self.logined[uid]; if(user) return updateUserInfo.call(self, user, info); // TODO self.loginedCount++; // TODO info.uid = uid; self.logined[uid] = info; }; var updateUserInfo = function(user, info){ var self = this; // TODO for(var p in info){ if(info.hasOwnProperty(p) && typeof 'function' !== info[p]){ self.logined[user.uid][p] = info[p]; } // END } // END }; var removeLoginedUser = function(uid){ var self = this; // TODO if(!self.logined[uid]) return; // TODO delete self.logined[uid]; // TODO return --self.loginedCount; }; proto.getStatisticsInfo = function(){ var self = this; return { serverId: self.serverId, connCount: self.connCount, loginedCount: self.loginedCount, logined: self.logined }; };
exports.dbname = "lrdata"; exports.dbuser = "lrdata"; exports.dbpassword = "test"; exports.lfmApiKey = 'c0db7c8bfb98655ab25aa2e959fdcc68'; exports.lfmApiSecret = 'aff4890d7cb9492bc72250abbeffc3e1'; exports.tagAgeBeforeRefresh = 14; // In days exports.tagFetchFrequency = 1000; // In milliseconds
const initialState = { country: 'es', language: 'es-ES' } const settings = (state = initialState, action) => { switch (action.type) { default: return state } } export default settings
define(['App', 'jquery', 'underscore', 'backbone', 'hbs!template/subreddit-picker-item', 'view/basem-view'], function(App, $, _, Backbone, SRPitemTmpl, BaseView) { return BaseView.extend({ template: SRPitemTmpl, events: { 'click .add': 'subscribe', 'click .remove': 'unsubscribe' }, initialize: function(data) { this.model = data.model; }, subscribe: function(e) { e.preventDefault() e.stopPropagation() var target = this.$(e.currentTarget) target.removeClass('add').addClass('remove').html('unsubscribe') var params = { action: 'sub', sr: this.model.get('name'), sr_name: this.model.get('name'), uh: $.cookie('modhash') }; console.log(params) this.api("api/subscribe", 'POST', params, function(data) { console.log("subscribe done", data) //edit the window and cookie App.trigger('header:refreshSubreddits') }); }, unsubscribe: function(e) { e.preventDefault() e.stopPropagation() var target = this.$(e.currentTarget) target.removeClass('remove').addClass('add').html('subscribe') var params = { action: 'unsub', sr: this.model.get('name'), uh: $.cookie('modhash') }; console.log(params) this.api("api/subscribe", 'POST', params, function(data) { console.log("unsubscribe done", data) App.trigger('header:refreshSubreddits') }); } }); });
"use strict"; var mapnik = require('../'); var assert = require('assert'); var path = require('path'); mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'geojson.input')); describe('mapnik.Geometry ', function() { it('should throw with invalid usage', function() { // geometry cannot be created directly for now assert.throws(function() { mapnik.Geometry(); }); }); it('should access a geometry from a feature', function() { var feature = new mapnik.Feature(1); var point = { "type": "MultiPoint", "coordinates": [[0,0],[1,1]] }; var input = { type: "Feature", properties: {}, geometry: point }; var f = new mapnik.Feature.fromJSON(JSON.stringify(input)); var geom = f.geometry(); assert.equal(geom.type(),mapnik.Geometry.MultiPoint); assert.deepEqual(JSON.parse(geom.toJSONSync()),point); var expected_wkb = new Buffer('0104000000020000000101000000000000000000000000000000000000000101000000000000000000f03f000000000000f03f', 'hex'); assert.deepEqual(geom.toWKB(),expected_wkb); }); it('should fail on toJSON due to bad parameters', function() { var feature = new mapnik.Feature(1); var point = { "type": "MultiPoint", "coordinates": [[0,0],[1,1]] }; var input = { type: "Feature", properties: {}, geometry: point }; var f = new mapnik.Feature.fromJSON(JSON.stringify(input)); var geom = f.geometry(); assert.equal(geom.type(),mapnik.Geometry.MultiPoint); assert.throws(function() { geom.toJSONSync(null); }); assert.throws(function() { geom.toJSONSync({transform:null}); }); assert.throws(function() { geom.toJSONSync({transform:{}}); }); assert.throws(function() { geom.toJSON(null, function(err,json) {}); }); assert.throws(function() { geom.toJSON({transform:null}, function(err, json) {}); }); assert.throws(function() { geom.toJSON({transform:{}}, function(err, json) {}); }); }); it('should throw if we attempt to create a Feature from a geojson geometry (rather than geojson feature)', function() { var geometry = { type: 'Point', coordinates: [ 7.415119300000001, 43.730364300000005 ] }; // starts throwing, as expected, at Mapnik v3.0.9 (https://github.com/mapnik/node-mapnik/issues/560) if (mapnik.versions.mapnik_number >= 300009) { assert.throws(function() { var transformed = mapnik.Feature.fromJSON(JSON.stringify(geometry)); }); } }); it('should throw from empty geometry from toWKB', function() { var s = new mapnik.Feature(1); assert.throws(function() { var geom = s.geometry().toWKB(); }); }); });
import { takeLatest, call, put } from 'redux-saga/effects'; import { gql } from 'react-apollo'; import { push } from 'react-router-redux'; import jwtDecode from 'jwt-decode'; import { setJwtToken } from '../../utils/auth'; import { bootstrap } from '../../utils/sagas'; import { registerError, registerSuccess } from './actions'; import { REGISTER } from './constants'; import { loginSuccess } from '../Login/actions'; import { client } from '../../graphql'; import { homePage } from '../../local-urls'; const RegisterMutation = gql` mutation RegisterMutation($nick: String!, $password: String!, $name: String!, $email: String!){ register(nick: $nick, password: $password, name: $name, email: $email) } `; function sendRegister(user) { return client.mutate({ mutation: RegisterMutation, variables: user }); } function* register({ user }) { try { const response = yield call(sendRegister, user); const token = response.data.register; const userInfo = jwtDecode(token); setJwtToken(token); yield put(registerSuccess()); yield put(loginSuccess(userInfo)); yield put(push(homePage())); } catch (e) { yield put(registerError()); } } function* registerSaga() { yield takeLatest(REGISTER, register); } export default bootstrap([ registerSaga, ]);
$(function () { var colors = Highcharts.getOptions().colors, categories = ['已关闭', 'NEW', '已解决'], name = 'Browser brands', data = [{ y: 290, color: colors[0], drilldown: { name: 'close bug version', categories: ['当前版本', '历史版本'], data: [20,270], color: colors[0] } }, { y: 64, color: colors[1], drilldown: { name: 'fix bug version', categories: ['当前版本', '历史版本'], data: [8,56], color: colors[1] } }, { y: 82, color: colors[2], drilldown: { name: 'NEW bug versions', categories: ['当前版本', '历史版本'], data: [5,77], color: colors[2] } }]; // Build the data arrays var browserData = []; var versionsData = []; for (var i = 0; i < data.length; i++) { // add browser data browserData.push({ name: categories[i], y: data[i].y, color: data[i].color }); // add version data for (var j = 0; j < data[i].drilldown.data.length; j++) { var brightness = 0.2 - (j / data[i].drilldown.data.length) / 5 ; versionsData.push({ name: data[i].drilldown.categories[j], y: data[i].drilldown.data[j], color: Highcharts.Color(data[i].color).brighten(brightness).get() }); } } // Create the chart $('#container11').highcharts({ chart: { type: 'pie' }, title: { text: '当前版本在历史版本总和占比' }, yAxis: { title: { text: 'Total percent market share' } }, plotOptions: { pie: { shadow: false, center: ['50%', '50%'] } }, tooltip: { valueSuffix: '' //这里更改tooltip显示的单位 }, series: [{ name: 'Browsers', data: browserData, size: '80%', dataLabels: { formatter: function() { return this.y > 5 ? this.point.name : null; }, color: 'white', distance: -30 } }, { name: 'Versions', data: versionsData, size: '100%', innerSize: '80%', dataLabels: { formatter: function() { // display only if larger than 1 return this.y > 0 ? '<b>'+ this.point.name +':</b> '+ this.y+'个' : null; } } }] }); });
YUI.add('enc-utf16-test', function (Y) { var C = CryptoJS; Y.CryptoJSTestSuite.add(new Y.Test.Case({ name: 'Utf16', testStringify1: function () { Y.Assert.areEqual('z', C.enc.Utf16.stringify(C.lib.WordArray.create([0x007a0000], 2))); }, testStringify2: function () { Y.Assert.areEqual('水', C.enc.Utf16.stringify(C.lib.WordArray.create([0x6c340000], 2))); }, testStringify3: function () { Y.Assert.areEqual('𐀀', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd800dc00], 4))); }, testStringify4: function () { Y.Assert.areEqual('𝄞', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd834dd1e], 4))); }, testStringify5: function () { Y.Assert.areEqual('􏿽', C.enc.Utf16.stringify(C.lib.WordArray.create([0xdbffdffd], 4))); }, testStringifyLE: function () { Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(C.lib.WordArray.create([0xffdbfddf], 4))); }, testStringifyLEInputIntegrity: function () { var wordArray = C.lib.WordArray.create([0xffdbfddf], 4); Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(wordArray)); Y.Assert.areEqual('􏿽', C.enc.Utf16LE.stringify(wordArray)); }, testParse1: function () { Y.Assert.areEqual(C.lib.WordArray.create([0x007a0000], 2).toString(), C.enc.Utf16.parse('z').toString()); }, testParse2: function () { Y.Assert.areEqual(C.lib.WordArray.create([0x6c340000], 2).toString(), C.enc.Utf16.parse('水').toString()); }, testParse3: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xd800dc00], 4).toString(), C.enc.Utf16.parse('𐀀').toString()); }, testParse4: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xd834dd1e], 4).toString(), C.enc.Utf16.parse('𝄞').toString()); }, testParse5: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xdbffdffd], 4).toString(), C.enc.Utf16.parse('􏿽').toString()); }, testParseLE: function () { Y.Assert.areEqual(C.lib.WordArray.create([0xffdbfddf], 4).toString(), C.enc.Utf16LE.parse('􏿽').toString()); } })); }, '$Rev$');
import React from "react"; import { Text, View } from "react-native"; import { defaultProps, propTypes } from "./caption-prop-types"; import styles from "./styles"; const renderCredits = (style, credits) => { if (!credits || credits === "") { return null; } return ( <Text style={[styles.text, styles.credits, style.text, style.credits]}> {credits.toUpperCase()} </Text> ); }; const renderText = (style, text) => { if (!text || text === "") { return null; } return <Text style={[styles.text, style.text, style.caption]}>{text}</Text>; }; const Caption = ({ children, credits, style, text }) => ( <View> {children} <View style={[styles.container, style.container]}> {renderText(style, text)} {renderCredits(style, credits)} </View> </View> ); Caption.propTypes = propTypes; Caption.defaultProps = defaultProps; export default Caption; export { default as CentredCaption } from "./centred-caption";
var Turtle = function () { this.d = 0; this.x = 0; this.y = 0; this.rounding = false; this.invert = false; } Turtle.prototype.setX = function (val) { this.x = val; return this; } Turtle.prototype.setY = function (val) { this.y = val; return this; } Turtle.prototype.setDegree = function (deg) { this.d = deg; return this; } Turtle.prototype.setInvert = function (bool) { this.invert = bool; return this; } Turtle.prototype.setRounding = function (bool) { this.rounding = bool; return this; } Turtle.prototype.rt = function (degrees) { if (this.invert) { this.d += degrees; } else { this.d -= degrees; this.d += 360; // to ensure that the number is positive } this.d %= 360; return this; } Turtle.prototype.lt = function (degrees) { if (this.invert) { this.d -= degrees; this.d += 360; // to ensure that the number is positive } else { this.d += degrees; } this.d %= 360; return this; } Turtle.prototype.adj = function (degrees, hyp) { var adj = Math.cos(degrees * Math.PI / 180) * hyp; if (this.rounding) { return Math.round(adj); } else { return adj; } } Turtle.prototype.opp = function (degrees, hyp) { var opp = Math.sin(degrees * Math.PI / 180) * hyp; if (this.rounding) { return Math.round(opp); } else { return opp; } } Turtle.prototype.fd = function (magnitude) { if (this.d < 90) { // x == adjacent this.x += this.adj(this.d, magnitude); // y == opposite this.y += this.opp(this.d, magnitude); } else if (this.d < 180) { // x == -opposite this.x -= this.opp(this.d - 90, magnitude); // y == adjacent this.y += this.adj(this.d - 90, magnitude); } else if (this.d < 270) { // x == -adjacent this.x -= this.adj(this.d - 180, magnitude); // y == -opposite this.y -= this.opp(this.d - 180, magnitude); } else if (this.d < 360) { // x == opposite this.x += this.opp(this.d - 270, magnitude); // y == -adjacent this.y -= this.adj(this.d - 270, magnitude); } return this; } Turtle.prototype.bk = function (magnitude) { if (this.d < 90) { // x -= adjacent this.x -= this.adj(this.d, magnitude); // y -= opposite this.y -= this.opp(this.d, magnitude); } else if (this.d < 180) { // x == +opposite this.x += this.opp(this.d - 90, magnitude); // y == -adjacent this.y -= this.adj(this.d - 90, magnitude); } else if (this.d < 270) { // x == opposite this.x += this.adj(this.d - 180, magnitude); // y == adjacent this.y += this.opp(this.d - 180, magnitude); } else if (this.d < 360) { // x == -opposite this.x -= this.opp(this.d - 270, magnitude); // y == adjacent this.y += this.adj(this.d - 270, magnitude); } return this; }
define(['../Property', '../Model', 'dojo/_base/declare', 'json-schema/lib/validate'], function (Property, Model, declare, jsonSchemaValidator) { // module: // dstore/extensions/JsonSchema // summary: // This module generates a dstore schema from a JSON Schema to enabled validation of objects // and property changes with JSON Schema return function (jsonSchema) { // create the schema that can be used by dstore/Model var modelSchema = {}; var properties = jsonSchema.properties || jsonSchema; // the validation function, this can be used for all the properties function checkForErrors() { var value = this.valueOf(); var key = this.name; // get the current value and test it against the property's definition var validation = jsonSchemaValidator.validate(value, properties[key]); // set any errors var errors = validation.errors; if (errors) { // assign the property names to the errors for (var i = 0; i < errors.length; i++) { errors[i].property = key; } } return errors; } // iterate through the schema properties, creating property validators for (var i in properties) { var jsDefinition = properties[i]; var definition = modelSchema[i] = new Property({ checkForErrors: checkForErrors }); if (typeof jsDefinition.type === 'string') { // copy the type so it can be used for coercion definition.type = jsDefinition.type; } if (typeof jsDefinition['default'] === 'string') { // and copy the default definition['default'] = jsDefinition['default']; } } return declare(Model, { schema: modelSchema }); }; });
import Ember from 'ember'; import ajax from 'ic-ajax'; import config from '../config/environment'; import SlydApi from '../utils/slyd-api'; import Timer from '../utils/timer'; import ApplicationUtils from '../mixins/application-utils'; var UUID = Ember.Object.extend(ApplicationUtils, {}); export function initialize(container, application) { application.deferReadiness(); var hash = {}; hash.type = 'GET'; hash.url = (config.SLYD_URL || window.location.protocol + '//' + window.location.host) + '/server_capabilities'; ajax(hash).then(function(settings) { this.set('serverCapabilities', settings['capabilities']); this.set('serverCustomization', settings['custom']); container.register('api:capabilities', Ember.Object.create().setProperties(application.get('serverCapabilities')), { instantiate: false }); container.register('app:custom', Ember.Object.create().setProperties(application.get('serverCustomization')), { instantiate: false }); var api = new SlydApi(); api.set('username', settings.username); api.set('sessionid', new UUID().shortGuid()); api.set('serverCapabilities', container.lookup('api:capabilities')); api.set('timer', new Timer()); container.register('api:slyd', api, { instantiate: false }); application.inject('route', 'slyd', 'api:slyd'); application.inject('adapter', 'slyd', 'api:slyd'); application.inject('controller', 'slyd', 'api:slyd'); application.inject('component', 'slyd', 'api:slyd'); application.inject('controller', 'customizations', 'app:custom'); application.inject('component', 'customizations', 'app:custom'); application.inject('controller', 'capabilities', 'api:capabilities'); application.inject('route', 'capabilities', 'api:capabilities'); this.advanceReadiness(); }.bind(application)); } export default { name: 'register-api', initialize: initialize };
"use strict" function checkEnvironmentForConfig(config:Object) : Object { let mentionBotEnvConfig; try { mentionBotEnvConfig = JSON.parse(process.env.MENTION_BOT_CONFIG); } catch(e) { mentionBotEnvConfig = {}; } return Object.keys(config).reduce((previousValue, key) => { let defaultConfigValue = config[key]; let environmentVariable = mentionBotEnvConfig[key]; let configElement = {}; configElement[key] = environmentVariable === undefined ? defaultConfigValue : environmentVariable; return {...previousValue, ...configElement}; }, {}); } module.exports = { checkEnvironmentForConfig }
var request = require('request'), log = require('bole')('npme-send-data'), config = require('../../../config') module.exports = function (formGuid, data, callback) { var hubspot = config.license.hubspot.forms .replace(":portal_id", config.license.hubspot.portal_id) .replace(":form_guid", formGuid); request.post(hubspot, function (er, resp) { // we can ignore 302 responses if (resp.statusCode === 204 || resp.statusCode === 302) { return callback(null); } log.error('unexpected status code from hubspot; status=' + resp.statusCode + '; data=', data); callback(new Error('unexpected status code: ' + resp.statusCode)); }).form(data); }
module.exports = { env: { mocha: true }, plugins: [ 'mocha' ] };
/* eslint-disable flowtype/require-parameter-type, flowtype/require-return-type, no-magic-numbers */ import {test} from "tap" import {spy} from "sinon" import aside from "./" test(({equal, end}) => { const unction = spy(() => "b") equal(aside([unction])("a"), "a") end() }) test(({ok, end}) => { const unction = spy(() => "b") aside([unction])("a") ok(unction.calledWith("a")) end() }) test(({equal, end}) => { const unction = spy(() => "b") equal(aside([unction])("a"), "a") end() }) test(({ok, equal, end}) => { const unctionA = spy(() => "b") const unctionB = spy(() => "c") equal(aside([unctionA, unctionB])("a"), "a") ok(unctionA.calledWith("a")) ok(unctionB.calledWith("b")) end() })
var doNothing = function () {} /** * The `Base` log defines methods that transports will share. */ var Base = module.exports = function (config, defaults) { var cedar = require('../../cedar') // A log is a shorthand for `log.log`, among other things. var log = function () { log.log.apply(log, arguments) } // Don't run `setMethods` until all config properties are set. var setMethods = doNothing // Define properties that trigger `setMethods`. Base.resetters.forEach(function (property) { var value Object.defineProperty(log, property, { get: function () { return value }, set: function (newValue) { value = newValue setMethods.apply(log) } }) }) // Copy `config` properties to the `log`. Base.decorate(log, config, true) // Apply default properties. Base.decorate(log, defaults || Base.defaults) // Set up logging methods. Base.setMethods.apply(log) // Re-run `setMethods` if `resetters` change. setMethods = Base.setMethods // Return the fully-decorated log function. return log } /** * Some properties will reset methods if changed. */ Base.resetters = ['level', 'prefixes', 'format', 'showTrace'] /** * Cedar supports 7 levels of logging. */ Base.levels = ['trace', 'debug', 'log', 'info', 'warn', 'error', 'fatal'] /** * Share defaults between log objects. */ Base.defaults = { // Show all log messages by default. level: 'trace', // Stream to `stdout` (using `write`). stream: process.stdout, // Don't add any space to JSON. space: '', // Stringify with `JSON.stringify`. stringify: JSON.stringify, // Join arguments together as an array. join: function (args) { var list = [] for (var index = 0, length = args.length; index < length; index++) { var arg = args[index] if (arg instanceof Error) { arg = '"' + (arg.stack || arg.toString()).replace(/\n/, '\\n') + '"' } else { arg = JSON.stringify(arg, null, this.space) } list.push(arg) } return '[' + list.join(',') + ']' }, // Start messages with a prefix for each log method. prefixes: { trace: 'TRACE ', debug: 'DEBUG ', log: 'LOG ', info: 'INFO ', warn: 'WARN ', error: 'ERROR ', fatal: 'FATAL ' }, // Format a log message. format: function (message, type, prefix) { return prefix + message + '\n' } } /** * Decorate an object with the properties of another. */ Base.decorate = function (object, defaults, shouldOverwrite) { object = object || {} for (var key in defaults) { if (shouldOverwrite || (typeof object[key] === 'undefined')) { object[key] = defaults[key] } } return object } /** * Create logging methods based on the configured `level`. */ Base.setMethods = function () { var self = this var found = false if ((Base.levels.indexOf(self.level) < 0) && self.level !== 'nothing') { self.error('Unknown log level: "' + self.level + '".') } else { Base.levels.forEach(function (methodName, index) { if (methodName === self.level) { found = true } var prefix = self.prefixes[methodName] || '' var format = self.format // If this log is an Emitter, we can catch and emit errors. if (self.emit) { self[methodName] = found ? function () { var message = self.join(arguments) message = format.call(self, message, methodName, prefix) try { self.stream.write(message) } catch (e) { self.emit('error', e) } } : doNothing // Otherwise, they'll just throw. } else { self[methodName] = found ? function () { var message = self.join(arguments) message = format.call(self, message, methodName, prefix) self.stream.write(message) } : doNothing } }) // Wrap the trace method with a stack tracer. if (self.trace !== doNothing) { var traceMethod = self.trace self.trace = function () { var e = new Error('') Error.captureStackTrace(e, self.trace) var l = arguments.length arguments[l] = e.stack.split('\n').splice(2).join('\n') arguments.length = ++l traceMethod.apply(self, arguments) } } } }
import type {ResponseType} from "./base.type"; function parseJSON(response: ResponseType): Object { return response.json(); } export {parseJSON};
var request = require('request'), mongoose = require('mongoose'), util = require('util'), url = require('url'), helpers = require('./helpers'), sync = require('./sync') // turn off request pooling request.defaults({ agent:false }) // cache elasticsearch url options for elmongo.search() to use var elasticUrlOptions = null /** * Attach mongoose plugin for elasticsearch indexing * * @param {Object} schema mongoose schema * @param {Object} options elasticsearch options object. Keys: host, port, index, type */ module.exports = elmongo = function (schema, options) { // attach methods to schema schema.methods.index = index schema.methods.unindex = unindex schema.statics.sync = function (cb) { options = helpers.mergeModelOptions(options, this) return sync.call(this, schema, options, cb) } schema.statics.search = function (searchOpts, cb) { options = helpers.mergeModelOptions(options, this) var searchUri = helpers.makeTypeUri(options) + '/_search?search_type=dfs_query_then_fetch&preference=_primary_first' return helpers.doSearchAndNormalizeResults(searchUri, searchOpts, cb) } // attach mongoose middleware hooks schema.post('save', function () { options = helpers.mergeModelOptions(options, this) this.index(options) }) schema.post('remove', function () { options = helpers.mergeModelOptions(options, this) this.unindex(options) }) } /** * Search across multiple collections. Same usage as model search, but with an extra key on `searchOpts` - `collections` * @param {Object} searchOpts * @param {Function} cb */ elmongo.search = function (searchOpts, cb) { // merge elasticsearch url config options elasticUrlOptions = helpers.mergeOptions(elasticUrlOptions) // determine collections to search on var collections = searchOpts.collections; if (elasticUrlOptions.prefix) { // prefix was specified - namespace the index names to use the prefix for each collection's index if (searchOpts.collections && searchOpts.collections.length) { // collections were specified - prepend the prefix on each collection name collections = collections.map(function (collection) { return elasticUrlOptions.prefix + '-' + collection }) } else { // no collections specified, but prefix specified - use wildcard index with prefix collections = [ elasticUrlOptions.prefix + '*' ] } } else { // no prefix used // if collections specified, just use their names without the prefix if (!collections) { // no collections were specified so use _all (searches all collections), without prefix searchOpts.collections = [ '_all' ] } } var searchUri = helpers.makeDomainUri(elasticUrlOptions) + '/' + collections.join(',') + '/_search?search_type=dfs_query_then_fetch&preference=_primary_first' return helpers.doSearchAndNormalizeResults(searchUri, searchOpts, cb) } /** * Configure the Elasticsearch url options for `elmongo.search()`. * * @param {Object} options - keys: host, port, prefix (optional) */ elmongo.search.config = function (options) { // only overwrite `options` values that are being specified in this call to `config` if (elasticUrlOptions) { Object .keys(elasticUrlOptions) .forEach(function (key) { elasticUrlOptions[key] = options[key] || elasticUrlOptions[key] }) } // normalize the `options` object elasticUrlOptions = helpers.mergeOptions(options) } /** * Index a document in elasticsearch (create if not existing) * * @param {Object} options elasticsearch options object. Keys: host, port, index, type */ function index (options) { var self = this // strip mongoose-added functions, depopulate any populated fields, and serialize the doc var esearchDoc = helpers.serializeModel(this) var indexUri = helpers.makeDocumentUri(options, self) var reqOpts = { method: 'PUT', url: indexUri, body: JSON.stringify(esearchDoc) } // console.log('index:', indexUri) helpers.backOffRequest(reqOpts, function (err, res, body) { if (err) { var error = new Error('Elasticsearch document indexing error: '+util.inspect(err, true, 10, true)) error.details = err self.emit('error', error) return } self.emit('elmongo-indexed', body) }) } /** * Remove a document from elasticsearch * * @param {Object} options elasticsearch options object. Keys: host, port, index, type */ function unindex (options) { var self = this var unindexUri = helpers.makeDocumentUri(options, self) // console.log('unindex:', unindexUri) var reqOpts = { method: 'DELETE', url: unindexUri } helpers.backOffRequest(reqOpts, function (err, res, body) { if (err) { var error = new Error('Elasticsearch document index deletion error: '+util.inspect(err, true, 10, true)) error.details = err self.emit('error', error) return } self.emit('elmongo-unindexed', body) }) }
/** * Copyright 2015 Telerik AD * * 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. */ (function(f, define){ define([], f); })(function(){ (function( window, undefined ) { var kendo = window.kendo || (window.kendo = { cultures: {} }); kendo.cultures["qut"] = { name: "qut", numberFormat: { pattern: ["-n"], decimals: 2, ",": ",", ".": ".", groupSize: [3], percent: { pattern: ["-n %","n %"], decimals: 2, ",": ",", ".": ".", groupSize: [3], symbol: "%" }, currency: { name: "", abbr: "", pattern: ["($n)","$n"], decimals: 2, ",": ",", ".": ".", groupSize: [3], symbol: "Q" } }, calendars: { standard: { days: { names: ["juq\u0027ij","kaq\u0027ij","oxq\u0027ij","kajq\u0027ij","joq\u0027ij","waqq\u0027ij","wuqq\u0027ij"], namesAbbr: ["juq\u0027","kaq\u0027","oxq\u0027","kajq\u0027","joq\u0027","waqq\u0027","wuqq\u0027"], namesShort: ["ju","ka","ox","kj","jo","wa","wu"] }, months: { names: ["nab\u0027e ik\u0027","ukab\u0027 ik\u0027","urox ik\u0027","ukaj ik\u0027","uro ik\u0027","uwaq ik\u0027","uwuq ik\u0027","uwajxaq ik\u0027","ub\u0027elej ik\u0027","ulaj ik\u0027","ujulaj ik\u0027","ukab\u0027laj ik\u0027"], namesAbbr: ["nab\u0027e","ukab\u0027","urox","ukaj","uro","uwaq","uwuq","uwajxaq","ub\u0027elej","ulaj","ujulaj","ukab\u0027laj"] }, AM: ["a.m.","a.m.","A.M."], PM: ["p.m.","p.m.","P.M."], patterns: { d: "dd/MM/yyyy", D: "dddd, dd' rech 'MMMM' rech 'yyyy", F: "dddd, dd' rech 'MMMM' rech 'yyyy h:mm:ss tt", g: "dd/MM/yyyy h:mm tt", G: "dd/MM/yyyy h:mm:ss tt", m: "d' rech 'MMMM", M: "d' rech 'MMMM", s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss", t: "h:mm tt", T: "h:mm:ss tt", u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", y: "MMMM' rech 'yyyy", Y: "MMMM' rech 'yyyy" }, "/": "/", ":": ":", firstDay: 1 } } } })(this); return window.kendo; }, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
// flow-typed signature: 573c576fe34eb3c3c65dd7a9c90a46d2 // flow-typed version: b43dff3e0e/http-errors_v1.x.x/flow_>=v0.25.x declare module 'http-errors' { declare class SpecialHttpError extends HttpError { constructor(): SpecialHttpError; } declare class HttpError extends Error { expose: bool; message: string; status: number; statusCode: number; } declare module.exports: { (status?: number, message?: string, props?: Object): HttpError; HttpError: typeof HttpError; BadRequest: typeof SpecialHttpError; Unauthorized: typeof SpecialHttpError; PaymentRequired: typeof SpecialHttpError; Forbidden: typeof SpecialHttpError; NotFound: typeof SpecialHttpError; MethodNotAllowed: typeof SpecialHttpError; NotAcceptable: typeof SpecialHttpError; ProxyAuthenticationRequired: typeof SpecialHttpError; RequestTimeout: typeof SpecialHttpError; Conflict: typeof SpecialHttpError; Gone: typeof SpecialHttpError; LengthRequired: typeof SpecialHttpError; PreconditionFailed: typeof SpecialHttpError; PayloadTooLarge: typeof SpecialHttpError; URITooLong: typeof SpecialHttpError; UnsupportedMediaType: typeof SpecialHttpError; RangeNotStatisfiable: typeof SpecialHttpError; ExpectationFailed: typeof SpecialHttpError; ImATeapot: typeof SpecialHttpError; MisdirectedRequest: typeof SpecialHttpError; UnprocessableEntity: typeof SpecialHttpError; Locked: typeof SpecialHttpError; FailedDependency: typeof SpecialHttpError; UnorderedCollection: typeof SpecialHttpError; UpgradeRequired: typeof SpecialHttpError; PreconditionRequired: typeof SpecialHttpError; TooManyRequests: typeof SpecialHttpError; RequestHeaderFieldsTooLarge: typeof SpecialHttpError; UnavailableForLegalReasons: typeof SpecialHttpError; InternalServerError: typeof SpecialHttpError; NotImplemented: typeof SpecialHttpError; BadGateway: typeof SpecialHttpError; ServiceUnavailable: typeof SpecialHttpError; GatewayTimeout: typeof SpecialHttpError; HTTPVersionNotSupported: typeof SpecialHttpError; VariantAlsoNegotiates: typeof SpecialHttpError; InsufficientStorage: typeof SpecialHttpError; LoopDetected: typeof SpecialHttpError; BandwidthLimitExceeded: typeof SpecialHttpError; NotExtended: typeof SpecialHttpError; NetworkAuthenticationRequired: typeof SpecialHttpError; } }
/** * A wrapper around JSLint to drop things into the console * * Copyright (C) 2011 Nikolay Nemshilov */ var RightJS = require('./right-server.js'); var JSLint = require('./jslint').JSLINT; var fs = require('fs'); exports.Linter = new RightJS.Class({ extend: { Options: { debug: false, // no debug devel: false, // no console.log s evil: false, // no evals passfail: false, // don't stop on errors onevar: false, // allow more than one 'var' definition forin: true , // allow for in without ownershipt checks indent: 2 , // enforce 2 spaces indent maxerr: 12 , // max number of errors }, Okays: [ "Move 'var' declarations to the top of the function.", "Do not use 'new' for side effects.", "The Function constructor is eval." ] }, /** * Basic constructor * * @param {String} the source * @param {String} the linter options * @return void */ initialize: function(src, options) { this.source = src; this.options = options; }, /** * Runs the linter * * @return {Linter} this */ run: function() { var options = {}, okays = [], patches = ''; // extracting the additional options try { // skipping non-existing patch files patches = fs.readFileSync(this.options).toString(); } catch(e) {} eval(patches); JSLint.okays = this.constructor.Okays.concat(okays); JSLint( fs.readFileSync(this.source).toString(), Object.merge(this.constructor.Options, options) ); this.errors = JSLint.errors.compact(); this.failed = this.errors.length > 0; return this; }, /** * Prints out the check report * * @return {Linter} this */ report: function() { if (this.errors.empty()) { console.log("\u001B[32m - JSLint check successfully passed\u001B[0m"); } else { console.log("\u001B[31m - JSLint check failed in: "+ this.source + "\u001B[0m"); this.errors.each(function(error) { var report = "\n", j=0, pointer=''; for (; j < error.character-1; j++) { pointer += '-'; } report += " \u001B[35m"+ error.reason +"\u001B[0m "; if (error.evidence) { report += "Line: "+ error.line + ", Char: "+ error.character + "\n"; report += " "+ error.evidence + "\n"; report += " \u001B[33m"+ pointer + "^\u001B[0m"; } console.log(report); }); console.log("\n") } return this; } });
import React, { PropTypes } from 'react' import ActionDelete from 'material-ui/svg-icons/action/delete' import { colors } from '/styles' import moduleStyles from '/styles/fileTree' const RemoveBtn = ({ onClick }) => ( <ActionDelete onClick={onClick} style={moduleStyles.listIcon.base} color={colors.light} hoverColor={colors.hover.red} /> ) export default RemoveBtn
import { Observable } from './observable' export default function drop(count, source) { return Observable(add => { let dropped = 0 return source.subscribe((val, name) => { if (dropped++ >= count) add(val, name) }) }) }
import React, { Component } from 'react' import { FlexGrid, Content, Container, AdminItemsViewTable, Table, Button } from 'components' import { AddItemAboutContainer, AddItemPhotoContainer, SpecialSetupContainer } from 'containers' import { adminLink } from 'config' import s from './AdminItemsView.sass' class ToggleButton extends Component { state = {value: this.props.value}; componentWillMount() { this.setState({value: this.props.value}) } componentWillReceiveProps(nextProps) { if (nextProps.value !== this.props.value) { this.setState({value: nextProps.value}); } } onClick = () => { if (!this.props.onChange) return; const { field, id, value } = this.props; const newValue = !value; this.props.onChange({ [field]: newValue, id }); this.setState({value: newValue}) }; render() { const { children } = this.props; const { onClick } = this; const { value } = this.state; return ( <FlexGrid className={s.toggle} direction="column" justify="center" align="center"> <Content size="5" center gray>{children}</Content> <Table.RowItem className={s.toggle__icon} tag="span" onClick={onClick} circle circleActive={value}/> </FlexGrid> ) } } export default class AdminItemsView extends Component { render() { const { data, parent_id, brands, categories, onChange, onDelete, onAboutChange, aboutData, onSave, onColorChange, onSpecialChange } = this.props; if (!data || data.id == null) return null; const { id } = data; return ( <div className={s.wrapper}> <AdminItemsViewTable data={data} brands={brands} onChange={onChange} categories={categories} /> <div className={s.line} /> <Container className={s.content}> <FlexGrid justify="start" align="start"> <div className={s.grid}> <FlexGrid className={s.toggle__wrapper} justify="start" align="start"> <ToggleButton id={id} onChange={onChange} field="is_top" value={data.is_top}>Топ</ToggleButton> <ToggleButton id={id} onChange={onChange} field="is_new" value={data.is_new}>Новинка</ToggleButton> <ToggleButton id={id} onChange={onChange} field="is_special_active" value={data.is_special_active}>Акция</ToggleButton> <ToggleButton id={id} onChange={onChange} field="warranty" value={data.warranty}>Гарантия</ToggleButton> </FlexGrid> <Content className={s.title} regular size="5"> Изображения </Content> <AddItemPhotoContainer __onChange={onColorChange} color={data.color} custom/> <SpecialSetupContainer onChange={onSpecialChange} /> </div> <div className={s.grid}> <AddItemAboutContainer data={aboutData} custom onSave={onSave} __onChange={onAboutChange}/> </div> </FlexGrid> <div className={s.actions}> <Button type="blue" to={`${adminLink.path}/items/${parent_id}`}> Отредактировать модель </Button> <Button className={s.btn} type="pink" onClick={onDelete}> Удалить </Button> </div> </Container> </div> ) } }
const LogTestPlugin = require("../../helpers/LogTestPlugin"); /** @type {import("../../../").Configuration} */ module.exports = { mode: "production", entry: "./index", stats: "normal", plugins: [new LogTestPlugin()] };
import { expect } from 'chai' import browser from '../../src/util/browser' describe('util (node)', () => { describe('browser', () => { it('is false', () => { expect(browser).to.be.false }) }) })
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M21 5H3c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-2 12H5V7h14v10zm-9-1h4c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1v-1c0-1.11-.9-2-2-2-1.11 0-2 .9-2 2v1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1zm.8-6c0-.66.54-1.2 1.2-1.2s1.2.54 1.2 1.2v1h-2.4v-1z" }), 'ScreenLockLandscapeOutlined'); exports.default = _default;
'use strict'; // MODULES // var tape = require( 'tape' ); var pow = require( 'math-power' ); var MAX_INT16 = require( './../lib' ); // TESTS // tape( 'the main export is a number', function test( t ) { t.ok( true, __filename ); t.equal( typeof MAX_INT16, 'number', 'main export is a number' ); t.end(); }); tape( 'the value equals 2**15 - 1', function test( t ) { t.equal( MAX_INT16, pow(2,15) - 1, 'equals 2**15 - 1' ); t.end(); });
var path = require('path'), fs = require('fs'), Source = require(hexo.lib_dir + '/core/source'), config_dir = path.dirname(hexo.configfile), config = hexo.config; function testver(){ var ver = hexo.env.version.split('.'); var test = true; if (ver[0] < 2) test = false; else if (ver[0] == 2 && ver[1] < 5) test = false; if (test) return; var hexo_curver = 'hexo'.red + (' V' + hexo.env.version).green; var theme_curver = 'chenall'.green + ' V2.2'.red; var error = 'Current version of ' + hexo_curver + ' Does not apply to the theme ' + theme_curver; error += ',Please use theme ' + 'chenall '.green + 'V1.0'.red + ' or upgrade to' + ' hexo 2.5.0 '.green + 'or latest.'; error +='\n\n\t当前版本 ' + hexo_curver + ' 不适用于主题 ' + theme_curver + '\n请使用' + 'chenall '.green + 'V1.0'.red + ' 版主题或升级hexo到' + ' 2.5.0 '.green + '以上'; error +='\n\nchenall V1.0:\n' + 'svn co https://github.com/chenall/hexo-theme-chenall/tags/V1.0 themes/chenall'.yellow; error +='\n\nhexo latest(升级):\n\t' + 'npm update hexo'.yellow; error +='\n\nhexo V2.5.X(安装指定版本):\n\t' + 'npm install hexo@2.5.3 -g'.yellow; error += '\n\n\t有什么疑问可以联系我 http://chenall.net'; hexo.log.e(error); process.exit(1); } function checkenv(){ var store = hexo.extend.renderer.store; var error = ''; if (!store['ejs']) error += '\tnpm install hexo-renderer-ejs\n'; if (!store['md']) error += '\tnpm install hexo-renderer-marked\n'; if (!store['styl']) error +='\tnpm install hexo-renderer-stylus\n'; if (error){ hexo.log.e('\t主题使用环境检测失败\n\n\t缺少必要插件,请使用以下命令安装:\n\n',error); process.exit(1); } } testver(); checkenv(); if (hexo.hasOwnProperty('env') && hexo.env.hasOwnProperty('debug')) hexo.debug = hexo.env.debug; hexo.__dump = function(obj){ var cache = []; return JSON.stringify(obj,function(key, value){ if (typeof value === 'object' && value !== null) { if (cache.indexOf(value) !== -1) { // Circular reference found, discard key return; } cache.push(value); } return value; }); } if (config.CustomDir && typeof(config.CustomDir) == 'object'){ var joinPath = function(){ var str = path.join.apply(this, arguments); if (str[str.length - 1] !== path.sep) str += path.sep; return str; }; var custom = config.CustomDir; ['public_dir','source_dir','scaffold_dir'].forEach(function(p){ if (!custom[p]) return; if (custom[p] == 'auto'){ hexo.constant(p,joinPath(config_dir,p)); } else { var test = custom[p].match(/^:config(.*)$/); if (test){ hexo.constant(p,joinPath(config_dir,test[1])); } else { hexo.constant(p,joinPath(config_dir,custom[p])); } } }) hexo.source = new Source(); } var load_default_usercfg = function(){ var cfg = global.usercfg = { ajax_widgets: true, updated: true, cached_widgets:true }; cfg.twbs_style = ['primary','success','info','warning','danger']; var user_cfg = hexo.source_dir + '_' + hexo.config.theme + '.yml'; if (!fs.existsSync(user_cfg)){ user_cfg = hexo.theme_dir + '_config.yml'; cfg.themeconfig = hexo.render.renderSync({path: user_cfg}); hexo.log.i("Theme config file: " + user_cfg.green); } cfg.twbs_sty = function(i){return cfg.twbs_style[i%4];} hexo.log.d('Using theme ' + 'chenall V2.2'.green); } hexo.on('ready',load_default_usercfg);
//@flow const {foo, Bar, baz, qux} = require('./jsdoc-exports'); const { DefaultedStringEnum, InitializedStringEnum, NumberEnum, BooleanEnum, SymbolEnum, } = require('./jsdoc-objects'); /** a JSDoc in the same file */ function x() {} ( ); // ^
ace.define("ace/mode/tex_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TexHighlightRules = function(textClass) { if (!textClass) textClass = "text"; this.$rules = { "start" : [ { token : "comment", regex : "%.*$" }, { token : textClass, // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b", next : "nospell" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])" }, { token : "paren.keyword.operator", regex : "[[({]" }, { token : "paren.keyword.operator", regex : "[\\])}]" }, { token : textClass, regex : "\\s+" } ], "nospell" : [ { token : "comment", regex : "%.*$", next : "start" }, { token : "nospell." + textClass, // non-command regex : "\\\\[$&%#\\{\\}]" }, { token : "keyword", // command regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b" }, { token : "keyword", // command regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])", next : "start" }, { token : "paren.keyword.operator", regex : "[[({]" }, { token : "paren.keyword.operator", regex : "[\\])]" }, { token : "paren.keyword.operator", regex : "}", next : "start" }, { token : "nospell." + textClass, regex : "\\s+" }, { token : "nospell." + textClass, regex : "\\w+" } ] }; }; oop.inherits(TexHighlightRules, TextHighlightRules); exports.TexHighlightRules = TexHighlightRules; }); ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { "use strict"; var Range = require("../range").Range; var MatchingBraceOutdent = function() {}; (function() { this.checkOutdent = function(line, input) { if (! /^\s+$/.test(line)) return false; return /^\s*\}/.test(input); }; this.autoOutdent = function(doc, row) { var line = doc.getLine(row); var match = line.match(/^(\s*\})/); if (!match) return 0; var column = match[1].length; var openBracePos = doc.findMatchingBracket({row: row, column: column}); if (!openBracePos || openBracePos.row == row) return 0; var indent = this.$getIndent(doc.getLine(openBracePos.row)); doc.replace(new Range(row, 0, row, column-1), indent); }; this.$getIndent = function(line) { return line.match(/^\s*/)[0]; }; }).call(MatchingBraceOutdent.prototype); exports.MatchingBraceOutdent = MatchingBraceOutdent; }); ace.define("ace/mode/tex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/tex_highlight_rules","ace/mode/matching_brace_outdent"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Mode = function(suppressHighlighting) { if (suppressHighlighting) this.HighlightRules = TextHighlightRules; else this.HighlightRules = TexHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "%"; this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.allowAutoInsert = function() { return false; }; this.$id = "ace/mode/tex"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { ace.require(["ace/mode/tex"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } }); })();
(function(){ 'use strict'; angular .module('app') .factory('ceUsers', ceUsers); ceUsers.$inject = ['$resource']; function ceUsers ($resource) { console.log('ok'); return $resource('https://mysterious-eyrie-9135.herokuapp.com/users/:username', {username: '@username'}, {'update': { method: 'PUT'}} ); } })();
'use strict'; import gulp from 'gulp'; import gutil from 'gulp-util'; import uglify from 'gulp-uglify'; import stylus from 'gulp-stylus'; import watch from 'gulp-watch'; import plumber from 'gulp-plumber'; import cleanCss from 'gulp-clean-css'; import imagemin from 'gulp-imagemin'; import concat from 'gulp-concat'; import babel from 'gulp-babel'; // Minificação dos arquivos .js gulp.task('minjs', () => { return gulp // Define a origem dos arquivos .js .src(['src/js/**/*.js']) // Prevençãao de erros .pipe(plumber()) // Suporte para o padrão ES6 .pipe(babel({ presets: ['es2015'] })) // Realiza minificação .pipe(uglify()) // Altera a extenção do arquivo .pipe(concat('app.min.js')) // Salva os arquivos minificados na pasta de destino .pipe(gulp.dest('dist/js')); }); gulp.task('stylus', () => { return gulp // Define a origem dos arquivos .scss .src('src/stylus/**/*.styl') // Prevençãao de erros .pipe(plumber()) // Realiza o pré-processamento para css .pipe(stylus()) // Realiza a minificação do css .pipe(cleanCss()) // Altera a extenção do arquivo .pipe(concat('style.min.css')) // Salva os arquivos processados na pasta de destino .pipe(gulp.dest('dist/css')); }); gulp.task('images', () => gulp.src('src/assets/*') .pipe(imagemin()) .pipe(gulp.dest('dist/assets')) ); gulp.task('watch', function() { gulp.start('default') gulp.watch('src/js/**/*.js', ['minjs']) gulp.watch('src/stylus/**/*.styl', ['stylus']) gulp.watch('src/assets/*', ['images']) }); gulp.task('default', ['minjs', 'stylus', 'images']);
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M21 17h-1v-6c0-1.1-.9-2-2-2H7v-.74c0-.46-.56-.7-.89-.37L4.37 9.63c-.2.2-.2.53 0 .74l1.74 1.74c.33.33.89.1.89-.37V11h4v3H5c-.55 0-1 .45-1 1v2c0 1.1.9 2 2 2h2c0 1.66 1.34 3 3 3s3-1.34 3-3h7c.55 0 1-.45 1-1s-.45-1-1-1zm-10 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm7-6h-4v-3h3c.55 0 1 .45 1 1v2zm-8-8h7v.74c0 .46.56.7.89.37l1.74-1.74c.2-.2.2-.53 0-.74l-1.74-1.74c-.33-.33-.89-.1-.89.37V4h-7c-.55 0-1 .45-1 1s.45 1 1 1z" }), 'RvHookupRounded'); exports.default = _default;
import HomeRoute from 'routes/Home'; describe('(Route) Home', () => { let _component; beforeEach(() => { _component = HomeRoute.component(); }); it('Should return a route configuration object', () => { expect(typeof HomeRoute).to.equal('object'); }); it('Should define a route component', () => { expect(_component.type).to.equal('div'); }); });
import 'docs/src/modules/components/bootstrap'; // --- Post bootstrap ----- import React from 'react'; import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; import markdown from './input.md'; function Page() { return <MarkdownDocs markdown={markdown} />; } export default Page;
var searchData= [ ['clear',['clear',['../d8/d84/a00001.html#a11dc3b617f2fedbb3b499971493b9c4f',1,'ArrayBase']]] ];
const ASSETS_MODS_LENGTH = 13;//'/assets/mods/'.length; const CONTENT_TYPES = { 'css': 'text/css', 'js': 'text/javascript', 'json': 'application/json', 'png': 'image/png', 'jpg': 'image/jpeg', 'jpeg': 'image/jpeg', 'html': 'text/html', 'htm': 'text/html' }; /** * @type {Map<string, JSZip>} */ const jszipCache = new Map(); //Not exported because serviceworkers can't use es6 modules // eslint-disable-next-line no-unused-vars class PackedManager { /** * * @param {string} url */ async get(url) { try { const zip = await this._openZip(url); const file = zip.file(this._assetPath(url)); if (file === null) { return new Response(new Blob(), { status: 404, statusText: 'not found' }); } return new Response(await file.async('blob'), { headers: { 'Content-Type': this._contentType(url) }, status: 200, statusText: 'ok' }); } catch (e) { console.error('An error occured while reading a packed mod', e); return e; } } /** * * @param {string} url * @returns {Promise<string[]>} */ async getFiles(url) { const zip = await this._openZip(url); const folder = this._openFolder(zip, this._assetPath(url)); const result = []; folder.forEach((relativePath, file) => { if (!file.dir) { result.push(relativePath); } }); return result; } /** * * @param {string} url * @returns {Promise<boolean>} */ async isDirectory(url) { const zip = await this._openZip(url); const file = zip.file(this._assetPath(url)); return file && file.dir; } /** * * @param {string} url * @returns {Promise<boolean>} */ async isFile(url) { const zip = await this._openZip(url); const file = zip.file(this._assetPath(url)); return !!file; } /** * * @param {string} url */ packedName(url) { url = this._normalize(url); return decodeURIComponent(url.substring(ASSETS_MODS_LENGTH, url.indexOf('/', ASSETS_MODS_LENGTH))); } /** * * @param {string} url */ async _openZip(url) { const zip = this._zipPath(url); const cached = jszipCache.get(zip); if (cached) { return cached; } const request = new Request('http://' + location.hostname + '.cc' + zip); const cache = await caches.open('zips'); let response = await cache.match(request); if (!response) { response = await fetch(zip); cache.put(request, response.clone()); } const result = await JSZip.loadAsync(response.blob()); jszipCache.set(zip, result); return result; } /** * * @param {JSZip} root * @param {string} path */ _openFolder(root, path) { const folders = path.split(/\//g); for (const folder of folders) { root = root.folder(folder); } return root; } /** * @param {string} url * @returns {string} */ _contentType(url) { url = this._normalize(url); return CONTENT_TYPES[url.substr(url.lastIndexOf('.') + 1)] || 'text/plain'; } /** * * @param {string} url */ _zipPath(url) { url = this._normalize(url); return url.substr(0, url.indexOf('/', ASSETS_MODS_LENGTH)); } /** * * @param {string} url */ _assetPath(url) { url = this._normalize(url); return url.substr(url.indexOf('/', ASSETS_MODS_LENGTH) + 1); } /** * * @param {string} url */ _normalize(url) { url = url.replace(/\\/g, '/').replace(/\/\//, '/'); //TODO: resolve absolute paths if (!url.startsWith('/')) { url = '/' + url; } if (url.startsWith('/ccloader')) { url = url.substr(9); // '/ccloader'.length } return url; } }
/* micropolisJS. Adapted by Graeme McCutcheon from Micropolis. * * This code is released under the GNU GPL v3, with some additional terms. * Please see the files LICENSE and COPYING for details. Alternatively, * consult http://micropolisjs.graememcc.co.uk/LICENSE and * http://micropolisjs.graememcc.co.uk/COPYING * */ Micro.GameTools = function (map) { return { airport: new Micro.BuildingTool(10000, Tile.AIRPORT, map, 6, false), bulldozer: new Micro.BulldozerTool(map), coal: new Micro.BuildingTool(3000, Tile.POWERPLANT, map, 4, false), commercial: new Micro.BuildingTool(100, Tile.COMCLR, map, 3, false), fire: new Micro.BuildingTool(500, Tile.FIRESTATION, map, 3, false), industrial: new Micro.BuildingTool(100, Tile.INDCLR, map, 3, false), nuclear: new Micro.BuildingTool(5000, Tile.NUCLEAR, map, 4, true), park: new Micro.ParkTool(map), police: new Micro.BuildingTool(500, Tile.POLICESTATION, map, 3, false), port: new Micro.BuildingTool(3000, Tile.PORT, map, 4, false), rail: new Micro.RailTool(map), residential: new Micro.BuildingTool(100, Tile.FREEZ, map, 3, false), road: new Micro.RoadTool(map), query: new Micro.QueryTool(map), stadium: new Micro.BuildingTool(5000, Tile.STADIUM, map, 4, false), wire: new Micro.WireTool(map), }; };
export { default as createShallow } from './createShallow'; export { default as createMount } from './createMount'; export { default as createRender } from './createRender'; export { default as findOutermostIntrinsic, wrapsIntrinsicElement } from './findOutermostIntrinsic'; export { default as getClasses } from './getClasses'; export { default as unwrap } from './unwrap';
var expect = require("chai").expect; var reindeerRace = require("../../src/day-14/reindeer-race"); describe("--- Day 14: (1/2) distance traveled --- ", () => { it("counts the distance traveled after 1000s", () => { var reindeerSpecs = [ "Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.", "Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds." ]; expect(reindeerRace.race(reindeerSpecs, 1000).winnerByDistance.distanceTraveled).to.equal(1120); }); }); describe("--- Day 14: (2/2) points awarded --- ", () => { it("counts the points awarded for being in the lead after 1000s", () => { var reindeerSpecs = [ "Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.", "Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds." ]; expect(reindeerRace.race(reindeerSpecs, 1000).winnerByPoints.pointsAwarded).to.equal(689); }); });
/* * Copyright 2017 Hewlett Packard Enterprise Development Company, L.P. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. */ define([ 'underscore', 'jquery', 'find/idol/app/page/dashboard/widgets/updating-widget', 'find/idol/app/page/dashboard/update-tracker-model' ], function(_, $, UpdatingWidget, UpdateTrackerModel) { 'use strict'; const spies = jasmine.createSpyObj('spies', ['onComplete', 'onIncrement', 'onCancelled', 'doUpdate']); const TestUpdatingWidget = UpdatingWidget.extend(spies); describe('Updating Widget', function() { beforeEach(function() { jasmine.addMatchers({ toShowLoadingSpinner: function() { return { compare: function(actual) { const pass = !actual.$loadingSpinner.hasClass('hide'); return { pass: pass, message: 'Expected the view ' + (pass ? 'not ' : '') + 'to show a loading spinner' }; } } } }); this.widget = new TestUpdatingWidget({ name: 'Test Widget' }); this.widget.render(); this.updateDeferred = $.Deferred(); this.updateTrackerModel = new UpdateTrackerModel(); }); afterEach(function() { _.each(spies, function(spy) { spy.calls.reset(); }) }); describe('when the update is synchronous', function() { beforeEach(function() { this.widget.doUpdate.and.callFake(function(done) { done(); }); this.widget.update(this.updateTrackerModel); }); it('it should increment the model when the done callback is called', function() { expect(this.updateTrackerModel.get('count')).toBe(1); }); it('should call onIncrement when the count increases', function() { // count increased when the widget updated expect(this.widget.onIncrement.calls.count()).toBe(1); }); it('should call onComplete when the model is set to complete', function() { this.updateTrackerModel.set('complete', true); expect(this.widget.onComplete.calls.count()).toBe(1); }); it('should call onCancelled when the model is set to cancelled', function() { this.updateTrackerModel.set('cancelled', true); expect(this.widget.onCancelled.calls.count()).toBe(1); }); }); describe('when the update is asynchronous', function() { beforeEach(function() { // when a test resolves the deferred, call the done callback this.widget.doUpdate.and.callFake(function(done) { this.updateDeferred.done(done); }.bind(this)); }); describe('and the update is called', function() { beforeEach(function() { this.widget.update(this.updateTrackerModel); }); it('should show the loading spinner until the update completes', function() { expect(this.widget).toShowLoadingSpinner(); this.updateDeferred.resolve(); expect(this.widget).not.toShowLoadingSpinner(); }); it('should not increment the model until the update is complete', function() { expect(this.updateTrackerModel.get('count')).toBe(0); this.updateDeferred.resolve(); expect(this.updateTrackerModel.get('count')).toBe(1); }); it('should call onIncrement when the count increases', function() { this.updateTrackerModel.increment(); expect(this.widget.onIncrement.calls.count()).toBe(1); }); it('should call onComplete when the model is set to complete', function() { this.updateTrackerModel.set('complete', true); expect(this.widget.onComplete.calls.count()).toBe(1); }); it('should call onCancelled when the model is set to cancelled', function() { this.updateTrackerModel.set('cancelled', true); expect(this.widget.onCancelled.calls.count()).toBe(1); }); }); }) }); });
import PropTypes from 'prop-types' import React from 'react' import { List } from 'immutable' import Modal from './warningmodal.js' import Path from 'path' const FilesList = ({ folders, folderPathToRemove, actions }) => { const addStorageLocation = () => actions.addFolderAskPathSize() const removeStorageLocation = folder => () => { actions.removeFolder(folder) actions.updateFolderToRemove() } const onResizeStorageLocationClick = folder => () => actions.resizeFolder(folder) const onRemoveStorageLocationClick = folder => () => actions.updateFolderToRemove(folder.get('path')) const hideRemoveStorageModal = () => actions.updateFolderToRemove() // sort folders by their name const sortedFolders = folders.sortBy(folder => folder.get('path')) const FileList = sortedFolders.map((folder, key) => ( <div className='property pure-g' key={key}> <div className='pure-u-3-4'> <div className='name'>{folder.get('path')}</div> </div> <div className='pure-u-1-12'> <div>{Math.floor(folder.get('free')).toString()} GB</div> </div> <div className='pure-u-1-12'> <div>{Math.floor(folder.get('size')).toString()} GB</div> </div> <div className='pure-u-1-24' onClick={onResizeStorageLocationClick(folder)} > <div> <i className='fa fa-edit button' /> </div> </div> <div className='pure-u-1-24' onClick={onRemoveStorageLocationClick(folder)} > <div> <i className='fa fa-remove button' /> </div> </div> {folderPathToRemove && folderPathToRemove === folder.get('path') ? ( <Modal title={`Remove "${Path.basename(folder.get('path'))}"?`} message='No longer use this folder for storage? You may lose collateral if you do not have enough space to fill all contracts.' actions={{ acceptModal: removeStorageLocation(folder), declineModal: hideRemoveStorageModal }} /> ) : null} </div> )) return ( <div className='files section'> <div className='property row'> <div className='title' /> <div className='controls full'> <div className='button left' id='edit' onClick={addStorageLocation}> <i className='fa fa-folder-open' /> Add Storage Folder </div> <div className='pure-u-1-12' style={{ textAlign: 'left' }}> Free </div> <div className='pure-u-1-12' style={{ textAlign: 'left' }}> Max </div> <div className='pure-u-1-12' /> </div> </div> {FileList} </div> ) } FilesList.propTypes = { folderPathToRemove: PropTypes.string, folders: PropTypes.instanceOf(List).isRequired } export default FilesList
// Base64 encoder/decoder with UTF-8 support // // Copyright (c) 2011 Vitaly Puzrin // Copyright (c) 2011 Aleksey V Zapparov // // Author: Aleksey V Zapparov AKA ixti (http://www.ixti.net/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Based on original artworks of base64 encoder/decoder by [Mozilla][1] // [1]: http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js 'use strict'; /* eslint-env browser */ /* eslint-disable no-bitwise */ function noop() {} var logger = { warn: noop, error: noop }, padding = '=', chrTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + '0123456789+/', binTable = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 ]; if (window.console) { logger = window.console; logger.warn = logger.warn || logger.error || logger.log || noop; logger.error = logger.error || logger.warn || logger.log || noop; } // internal helpers ////////////////////////////////////////////////////////// function utf8Encode(str) { var bytes = [], offset = 0, length, char; str = encodeURI(str); length = str.length; while (offset < length) { char = str.charAt(offset); offset += 1; if (char !== '%') { bytes.push(char.charCodeAt(0)); } else { char = str.charAt(offset) + str.charAt(offset + 1); bytes.push(parseInt(char, 16)); offset += 2; } } return bytes; } function utf8Decode(bytes) { var chars = [], offset = 0, length = bytes.length, c1, c2, c3; while (offset < length) { c1 = bytes[offset]; c2 = bytes[offset + 1]; c3 = bytes[offset + 2]; if (c1 < 128) { chars.push(String.fromCharCode(c1)); offset += 1; } else if (191 < c1 && c1 < 224) { chars.push(String.fromCharCode(((c1 & 31) << 6) | (c2 & 63))); offset += 2; } else { chars.push(String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63))); offset += 3; } } return chars.join(''); } // public api //////////////////////////////////////////////////////////////// function encode(str) { var result = '', bytes = utf8Encode(str), length = bytes.length, i; // Convert every three bytes to 4 ascii characters. for (i = 0; i < (length - 2); i += 3) { result += chrTable[bytes[i] >> 2]; result += chrTable[((bytes[i] & 0x03) << 4) + (bytes[i + 1] >> 4)]; result += chrTable[((bytes[i + 1] & 0x0f) << 2) + (bytes[i + 2] >> 6)]; result += chrTable[bytes[i + 2] & 0x3f]; } // Convert the remaining 1 or 2 bytes, pad out to 4 characters. if (length % 3) { i = length - (length % 3); result += chrTable[bytes[i] >> 2]; if ((length % 3) === 2) { result += chrTable[((bytes[i] & 0x03) << 4) + (bytes[i + 1] >> 4)]; result += chrTable[(bytes[i + 1] & 0x0f) << 2]; result += padding; } else { result += chrTable[(bytes[i] & 0x03) << 4]; result += padding + padding; } } return result; } function decode(data) { var value, code, idx = 0, bytes = [], leftbits = 0, // number of bits decoded, but yet to be appended leftdata = 0; // bits decoded, but yet to be appended // Convert one by one. for (idx = 0; idx < data.length; idx += 1) { code = data.charCodeAt(idx); value = binTable[code & 0x7F]; if (value === -1) { // Skip illegal characters and whitespace logger.warn('Illegal characters (code=' + code + ') in position ' + idx); } else { // Collect data into leftdata, update bitcount leftdata = (leftdata << 6) | value; leftbits += 6; // If we have 8 or more bits, append 8 bits to the result if (leftbits >= 8) { leftbits -= 8; // Append if not padding. if (padding !== data.charAt(idx)) { bytes.push((leftdata >> leftbits) & 0xFF); } leftdata &= (1 << leftbits) - 1; } } } // If there are any bits left, the base64 string was corrupted if (leftbits) { logger.error('Corrupted base64 string'); return null; } return utf8Decode(bytes); } exports.encode = encode; exports.decode = decode;
module.exports = require("npm:acorn@2.4.0/dist/acorn");
import actionTypes from '../../client/actions/types'; const defaultState = { data: {}, errors: 'Not Found', }; export default function domainDetailReducer(state = defaultState, action = {}) { switch (action.type) { case actionTypes.getDomainDetail: return Object.assign({}, state, { data: action.data.domain, errors: action.errors, }); default: return state; } }
// This is a manifest file that'll be compiled into including all the files listed below. // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically // be included in the compiled file accessible from http://example.com/assets/application.js // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // //= require jquery //= require jquery_ujs //= require_tree .
/** * Copyright 2014 Pacific Controls Software Services LLC (PCSS). All Rights Reserved. * * This software is the property of Pacific Controls Software Services LLC and its * suppliers. The intellectual and technical concepts contained herein are proprietary * to PCSS. Dissemination of this information or reproduction of this material is * strictly forbidden unless prior written permission is obtained from Pacific * Controls Software Services. * * PCSS MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTANILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGMENT. PCSS SHALL * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ /** * Version : 1.0 * User : pcseg306 * Function : Service for Super/client Admin Notification Functions */ gxMainApp.factory("adminFunctionsService", function($http,$rootScope,gxAPIServiceWrapper){ var _notificationArray = []; var _resultPromise; var _getNotificationArray = function() { _resultPromise = gxAPIServiceWrapper.get("models/superAdmin/dummySuperAdminNotification.json"); console.log(_resultPromise); return _resultPromise; } return{ notificationArray: _notificationArray, getNotificationArray: _getNotificationArray, resultPromise : _resultPromise }; });
define(function(require) { var test = require('../../../test') var count = 0 require.async('./a', function(a) { test.assert(a.name === 'a', 'load CMD module file') done() }) require.async('./b.js', function() { test.assert(global.SPECS_MODULES_ASYNC === true, 'load normal script file') global.SPECS_MODULES_ASYNC = undefined done() }) require.async(['./c1', './c2'], function(c1, c2) { test.assert(c1.name === 'c1', c1.name) test.assert(c2.name === 'c2', c2.name) done() }) function done() { if (++count === 3) { test.next() } } });
const fs = require('fs'); const path = require('path'); const cleanCss = require('../../index.js'); module.exports = { name : 'basic test', this : function () { const str = fs.readFileSync(path.resolve('test/styles/basic.dirty.scss'), 'utf8'); const clean = cleanCss({ css : str }); return clean; }, isEqual : function () { return fs.readFileSync(path.resolve('test/styles/basic.clean.scss'), 'utf8'); } };
angular.module('starter.controllers', []) // A simple controller that fetches a list of data from a service .controller('PetIndexCtrl', function($scope, PetService) { // "Pets" is a service returning mock data (services.js) $scope.pets = PetService.all(); }) // A simple controller that shows a tapped item's data .controller('PetDetailCtrl', function($scope, $stateParams, PetService) { // "Pets" is a service returning mock data (services.js) $scope.pet = PetService.get($stateParams.petId); }) // getting fake favor data .controller('FavorIndexCtrl', function($scope, FavorService) { $scope.favors = FavorService.all(); }) // A simple controller that shows a tapped item's data .controller('FavorDetailCtrl', function($scope, $stateParams, FavorService) { // "Pets" is a service returning mock data (services.js) $scope.favor = FavorService.get($stateParams.favorId); });
/** * Created by maomao on 2020/4/20. */ Java.perform(function() { var cn = "android.telephony.SubscriptionManager"; var target = Java.use(cn); if (target) { target.addOnSubscriptionsChangedListener.overloads[0].implementation = function(dest) { var myArray=new Array() myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE myArray[1] = cn + "." + "addOnSubscriptionsChangedListener"; myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); send(myArray); return this.addOnSubscriptionsChangedListener.overloads[0].apply(this, arguments); }; // target.addOnSubscriptionsChangedListener.overloads[1].implementation = function(dest) { // var myArray=new Array() // myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE // myArray[1] = cn + "." + "addOnSubscriptionsChangedListener"; // myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); // send(myArray); // return this.addOnSubscriptionsChangedListener.overloads[1].apply(this, arguments); // }; target.getActiveSubscriptionInfo.overloads[0].implementation = function(dest) { var myArray=new Array() myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE myArray[1] = cn + "." + "getActiveSubscriptionInfo"; myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); send(myArray); return this.getActiveSubscriptionInfo.overloads[0].apply(this, arguments); }; // target.getActiveSubscriptionInfo.overloads[1].implementation = function(dest) { // var myArray=new Array() // myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE // myArray[1] = cn + "." + "getActiveSubscriptionInfo"; // myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); // send(myArray); // return this.getActiveSubscriptionInfo.overloads[1].apply(this, arguments); // }; target.getActiveSubscriptionInfoCount.implementation = function(dest) { var myArray=new Array() myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE myArray[1] = cn + "." + "getActiveSubscriptionInfoCount"; myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); send(myArray); return this.getActiveSubscriptionInfoCount.apply(this, arguments); }; target.getActiveSubscriptionInfoForSimSlotIndex.implementation = function(dest) { var myArray=new Array() myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE myArray[1] = cn + "." + "getActiveSubscriptionInfoForSimSlotIndex"; myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); send(myArray); return this.getActiveSubscriptionInfoForSimSlotIndex.apply(this, arguments); }; target.getActiveSubscriptionInfoList.implementation = function(dest) { var myArray=new Array() myArray[0] = "SENSITIVE" //INTERESTED & SENSITIVE myArray[1] = cn + "." + "getActiveSubscriptionInfoList"; myArray[2] = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split('\n\tat'); send(myArray); return this.getActiveSubscriptionInfoList.apply(this, arguments); }; } });
"use strict"; const chalk = require("chalk"); const readline = require("readline"); /** * Fill screen with blank lines, move to "0" afterwards and clear screen afterwards. * Note that it is still possible to "scroll back" afterwards. * * Function performs nothing in case the stdout is NOT a TTY. */ exports.cls = function() { if (process.stdout.isTTY) { const blank = "\n".repeat(process.stdout.rows); console.log(blank); readline.cursorTo(process.stdout, 0, 0); readline.clearScreenDown(process.stdout); } }; /** * A less soft version of `cls` above which completely clears out the screen, * without leaving the option to scroll up again. * * Function performs nothing in case the stdout is NOT a TTY. */ exports.hardCls = function() { if (process.stdout.isTTY) { process.stdout.write( process.platform === "win32" ? "\x1Bc" : "\x1B[2J\x1B[3J\x1B[H" ); } }; exports.formatFirstLineMessage = function(text) { return chalk.bgWhite.black(text); };
const assert = require('assert') const crypto = require('crypto') const { createRequest } = require("../util/util") describe('测试搜索是否正常', () => { it('获取到的数据的 name 应该和搜索关键词一致', done => { const keywords = "海阔天空" const type = 1 const limit = 30 const data = 's=' + keywords + '&limit=' + limit + '&type=' + type + '&offset=0' createRequest('/api/search/pc/', 'POST', data) .then(result => { console.log(JSON.parse(result).result.songs[0].mp3Url) assert(JSON.parse(result).result.songs[0].name === '海阔天空') done() }) .catch(err => { done(err) }) }) })
export default function collapseDuplicateDeclarations() { return (root) => { root.walkRules((node) => { let seen = new Map() let droppable = new Set([]) node.walkDecls((decl) => { // This could happen if we have nested selectors. In that case the // parent will loop over all its declarations but also the declarations // of nested rules. With this we ensure that we are shallowly checking // declarations. if (decl.parent !== node) { return } if (seen.has(decl.prop)) { droppable.add(seen.get(decl.prop)) } seen.set(decl.prop, decl) }) for (let decl of droppable) { decl.remove() } }) } }
module.exports = { "env": { "browser": true, "commonjs": true, "es6": true, "jasmine" : true }, "extends": "eslint:recommended", "parserOptions": { "sourceType": "module" }, "rules": { "no-mixed-spaces-and-tabs": [2, "smart-tabs"], "linebreak-style": [ "error", "unix" ], "quotes": [ "error", "single" ], "semi": [ "error", "always" ] } };
version https://git-lfs.github.com/spec/v1 oid sha256:42fcecf8fdabe110af986ac81bb56b598f5a3fa59c6d0c4cc8b80daa2dca0473 size 1121
$(document).ready(function(){ var Previewer = { preview: function(content, output) { $.ajax({ type: 'POST', url: "/govspeak", data: { govspeak: content.val() }, dataType: 'json' }).success(function(data){ output.html(data['govspeak']); }); } }; $("[data-preview]").each(function(){ var source_field = $($(this).data('preview-for')); var render_area = $(this); source_field.keyup(function() { Previewer.preview(source_field, render_area); }) }); $('textarea').autosize(); });
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** * @namespace Phaser.Structs */ module.exports = { List: require('./List'), Map: require('./Map'), ProcessQueue: require('./ProcessQueue'), RTree: require('./RTree'), Set: require('./Set'), Size: require('./Size') };
YUI.add("yuidoc-meta", function(Y) { Y.YUIDoc = { meta: { "classes": [ "Audio" ], "modules": [ "gallery-audio" ], "allModules": [ { "displayName": "gallery-audio", "name": "gallery-audio" } ] } }; });
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FaHouzz = function FaHouzz(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm19.9 26.6l11.5-6.6v13.2l-11.5 6.6v-13.2z m-11.4-6.6v13.2l11.4-6.6z m11.4-19.8v13.2l-11.4 6.6v-13.2z m0 13.2l11.5-6.6v13.2z' }) ) ); }; exports.default = FaHouzz; module.exports = exports['default'];
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; /** * Person object. * */ class PersonResult { /** * Create a PersonResult. * @member {string} personId personId of the target face list. * @member {array} [persistedFaceIds] persistedFaceIds of registered faces in * the person. These persistedFaceIds are returned from Person - Add a Person * Face, and will not expire. * @member {string} [name] Person's display name. * @member {string} [userData] User-provided data attached to this person. */ constructor() { } /** * Defines the metadata of PersonResult * * @returns {object} metadata of PersonResult * */ mapper() { return { required: false, serializedName: 'PersonResult', type: { name: 'Composite', className: 'PersonResult', modelProperties: { personId: { required: true, serializedName: 'personId', type: { name: 'String' } }, persistedFaceIds: { required: false, serializedName: 'persistedFaceIds', type: { name: 'Sequence', element: { required: false, serializedName: 'StringElementType', type: { name: 'String' } } } }, name: { required: false, serializedName: 'name', type: { name: 'String' } }, userData: { required: false, serializedName: 'userData', type: { name: 'String' } } } } }; } } module.exports = PersonResult;
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (fn /*, ...args*/) { var args = (0, _slice2.default)(arguments, 1); return function () /*callArgs*/{ var callArgs = (0, _slice2.default)(arguments); return fn.apply(null, args.concat(callArgs)); }; }; var _slice = require('./internal/slice'); var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } ; /** * Creates a continuation function with some arguments already applied. * * Useful as a shorthand when combined with other control flow functions. Any * arguments passed to the returned function are added to the arguments * originally passed to apply. * * @name apply * @static * @memberOf module:Utils * @method * @category Util * @param {Function} fn - The function you want to eventually apply all * arguments to. Invokes with (arguments...). * @param {...*} arguments... - Any number of arguments to automatically apply * when the continuation is called. * @returns {Function} the partially-applied function * @example * * // using apply * async.parallel([ * async.apply(fs.writeFile, 'testfile1', 'test1'), * async.apply(fs.writeFile, 'testfile2', 'test2') * ]); * * * // the same process without using apply * async.parallel([ * function(callback) { * fs.writeFile('testfile1', 'test1', callback); * }, * function(callback) { * fs.writeFile('testfile2', 'test2', callback); * } * ]); * * // It's possible to pass any number of additional arguments when calling the * // continuation: * * node> var fn = async.apply(sys.puts, 'one'); * node> fn('two', 'three'); * one * two * three */ module.exports = exports['default'];
'use strict'; var path = require('path'); var helpers = require('yeoman-generator').test; var assert = require('yeoman-assert'); describe('test framework', function () { describe('mocha', function () { before(function (done) { helpers.run(path.join(__dirname, '../app')) .inDir(path.join(__dirname, '.tmp')) .withOptions({ 'skip-install': true, 'test-framework': 'mocha' }) .withPrompts({features: []}) .on('end', done); }); it('adds the Grunt plugin', function () { assert.fileContent('package.json', '"grunt-mocha"'); }); it('adds the Grunt task', function () { assert.fileContent('Gruntfile.js', 'mocha'); }); it('uses the ESLint environment', function () { assert.fileContent('package.json', '"mocha"'); }); }); describe('jasmine', function () { before(function (done) { helpers.run(path.join(__dirname, '../app')) .inDir(path.join(__dirname, '.tmp')) .withOptions({ 'skip-install': true, 'test-framework': 'jasmine' }) .withPrompts({features: []}) .on('end', done); }); it('adds the Grunt plugin', function () { assert.fileContent('package.json', '"grunt-contrib-jasmine"'); }); it('adds the Grunt task', function () { assert.fileContent('Gruntfile.js', 'jasmine'); }); it('uses the ESLint environment', function () { assert.fileContent('package.json', '"jasmine"'); }); }); });
var Path = require('path'); var Hapi = require('hapi'); var server = new Hapi.Server(); var port = process.env.PORT || 5000; server.connection({ port: port }); server.views({ engines: { html: require('handlebars') }, path: Path.join(__dirname, 'views') }); server.route([ { path: '/', method: 'GET', config: { auth: false, handler: function(request, reply) { reply.view("index"); } } }, { method: 'GET', path: '/public/{param*}', handler: { directory: { path: Path.normalize(__dirname + '/public') } } } ]); server.start(function(){ console.log('Static Server Listening on : http://127.0.0.1:' +port); }); module.exports = server;