text
stringlengths 2
6.14k
|
|---|
var class_subclone_explorer_1_1_tree_traverse_delegate =
[
[ "TreeTraverseDelegate", "class_subclone_explorer_1_1_tree_traverse_delegate.html#af5e6a4a399fd6e4f0244c0517f044b30", null ],
[ "~TreeTraverseDelegate", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a96b550503dc883a3512aea284630ae11", null ],
[ "isTerminated", "class_subclone_explorer_1_1_tree_traverse_delegate.html#aa85b12536ab25909e228d4698145da51", null ],
[ "postprocessNode", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a7eae69d60eee2471c8d99b64c7cd9ed1", null ],
[ "preprocessNode", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a5f8f42f1370d4bc8722808d22344ad55", null ],
[ "processNode", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a1f3c8f8a76da15aefe11595a85511d52", null ],
[ "terminate", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a27e36da1b845ab2502e8d42481a6958f", null ],
[ "_isTerminated", "class_subclone_explorer_1_1_tree_traverse_delegate.html#a035292ae93a3cce9a4317374dbd661dc", null ]
];
|
(function() {
angular.module('angular-linkto', []);
angular.module('angular-linkto').service('keymaster', function() {
return {
replaceKey: function(str, key, params) {
return str.replace(":" + key, params != null ? params[key] : void 0);
},
findKeys: function(str) {
return str.match(/:[\w\d_\-]+/g);
},
replaceKeys: function(str, params) {
var key, keys;
if (params != null ? typeof params.hasAttributes === "function" ? params.hasAttributes() : void 0 : void 0) {
params = params.toJSON();
}
keys = this.findKeys(str);
for (key in params) {
str = this.replaceKey(str, key, params);
}
return str;
}
};
});
angular.module('angular-linkto').filter('linkTo', function(keymaster) {
var containsColon, containsColonAfterProtocol, containsColonBeforeSlash, containsProtocol, dropLastParam, throwUnfilledParamError;
containsColon = function(str) {
return str.indexOf(':') > -1;
};
containsColonAfterProtocol = function(str) {
return str.match(/^\w+:\/\/.*:/);
};
containsColonBeforeSlash = function(str) {
return str.match(/:[\w\d_\-]+\//);
};
containsProtocol = function(str) {
return str.match(/^\w+:\/\/.*/);
};
dropLastParam = function(str) {
return str.substring(0, str.lastIndexOf('/'));
};
throwUnfilledParamError = function(str) {
throw new Error("Must provide all data for named params in linkTo(), missing: " + (keymaster.findKeys(str)) + ", in route: " + str);
};
return function(route, params) {
if (route == null) {
throw new Error('Route required for linkTo()');
}
route = keymaster.replaceKeys(route, params);
if (containsProtocol(route)) {
if (containsColonAfterProtocol(route)) {
if (containsColonBeforeSlash(route)) {
throwUnfilledParamError(route);
} else {
route = dropLastParam(route);
}
}
} else if (containsColon(route)) {
if (containsColonBeforeSlash(route)) {
throwUnfilledParamError(route);
} else {
route = dropLastParam(route);
}
}
return route;
};
});
}).call(this);
/*
//@ sourceMappingURL=angular-linkto.js.map
*/
|
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var schema = new Schema({
imagePath: {
type: String,
required: true
},
title: {
type: String,
required: true
},
description: {
type: String,
required: true
},
price: {
type: Number,
required: true
},
qty: {
type: Number,
required: true
},
});
module.exports = mongoose.model('Product', schema);
|
(function ($) {
Ss_input.fileSystemHandlers['sort'] = Ss_input.Handler.extend({
defaults: {
sortType: 'asc',
sortBy: 'ext',
sortableFields: ['ext', 'name', 'date']
}
})
})(jQuery);
|
/* eslint-disable no-console */
var client = require('bellman');
var AWS = require('aws-sdk');
var sts = new AWS.STS();
var R = {};
R.RoleSessionName = 'assuming-role-from-builder';
R.RoleArn = 'arn:aws:iam::181472263199:role/Deployer';
sts.assumeRole(R, function(err,response) {
if( err ) {
console.log( err );
return;
}
const {
AccessKeyId: accessKey,
SecretAccessKey: secretKey,
SessionToken: sessionToken
} = response.Credentials;
const cfg = {
accessKey,
secretKey,
sessionToken
};
var api = client.prod.deploy(cfg);
api.build().then( ok => console.log( 'OK', ok ) )
.catch( err => console.log( 'ERR', err ));
});
|
Tinytest.add('ServerSession - set', function (test) {
if (Meteor.isServer) {
test.isUndefined(ServerSession.setCondition(function () {
return true;
}));
}
test.throws(function () {
ServerSession.set();
}, Error, 'Should throw an error if no key and value are provided when using set'
);
test.isUndefined(ServerSession.set('testKey', 'testValue'));
test.equal('testValue', ServerSession.get('testKey'));
ServerSession.set('testKey');
test.isTrue(undefined == ServerSession.get('testKey') || null == ServerSession.get('testKey'));
});
Tinytest.add('ServerSession - get', function (test) {
ServerSession.set('null', null);
ServerSession.set('aBool', true);
ServerSession.set('anInteger', 12345);
ServerSession.set('aString', 'meIzAString');
ServerSession.set('anArray', [1, 2, 3, ['4', '5', '6', [12, 23, 34]]]);
ServerSession.set('anObject', { 'keyOfObject' : 'value', 'keyOfObj' : {'a' : ['b', 'c'] } });
test.equal(null, ServerSession.get('null'));
test.equal(true, ServerSession.get('aBool'));
test.equal(12345, ServerSession.get('anInteger'));
test.equal('meIzAString', ServerSession.get('aString'));
test.equal([1, 2, 3, ['4', '5', '6', [12, 23, 34]]], ServerSession.get('anArray'));
test.equal({ 'keyOfObject' : 'value', 'keyOfObj' : {'a' : ['b', 'c'] } }, ServerSession.get('anObject'));
});
Tinytest.add('ServerSession - equals (identical)', function (test) {
ServerSession.set('null', null);
ServerSession.set('true', true);
ServerSession.set('54321', 54321);
ServerSession.set('aRandomString', 'aRandomString1');
ServerSession.set('array', [1, 2, 3, ['4', '5', '6', [11, 12, 31]]]);
ServerSession.set('object', { 'keyOfObject' : '_value'});
ServerSession.set('emptyObj', {});
ServerSession.set('emptyArray', []);
test.isTrue(ServerSession.equals('null', null));
test.isTrue(ServerSession.equals('true', true));
test.isTrue(ServerSession.equals('54321', 54321));
test.isTrue(ServerSession.equals('emptyObj', {}));
test.isTrue(ServerSession.equals('emptyArray', []));
test.isTrue(ServerSession.equals('array', [1, 2, 3, ['4', '5', '6', [11, 12, 31]]]));
test.isFalse(ServerSession.equals('emptyObj', []));
test.isFalse(ServerSession.equals('emptyArray', {}));
test.isFalse(ServerSession.equals('aRandomString', 'aRandomString'));
test.isFalse(ServerSession.equals('array', [1, 2, 3, ['4', '5', '6', [11, 12, 30]]]));
test.isFalse(ServerSession.equals('object', { 'keyOfObject' : 'value'}));
});
Tinytest.add('ServerSession - equals (not identical)', function (test) {
ServerSession.set('54321', 1);
ServerSession.set('null', null);
ServerSession.set('true', true);
ServerSession.set('aStringString', 'stringity');
test.isTrue(ServerSession.equals('null', undefined, false));
test.isTrue(ServerSession.equals('true', !null, false));
test.isTrue(ServerSession.equals('54321', true, false));
test.isFalse(ServerSession.equals('aStringString', 'stringity11', false));
});
if (Meteor.isServer) {
Tinytest.add('ServerSession - Conditions', function (test) {
test.isUndefined(ServerSession.setCondition(function () {
return false;
}));
test.throws(function () {
ServerSession.set('theKey', { foo : 'bar' });
}, Meteor.Error);
test.isFalse(ServerSession.equals('theKey', { foo : 'bar' }));
// Also test with return true
test.isUndefined(ServerSession.setCondition(function () {
return true;
}));
ServerSession.set('newKey', { foo : 'bar' });
test.equal('bar', ServerSession.get('newKey').foo);
ServerSession.set('newKey', undefined);
});
}
|
// ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Apple Inc. and contributors.
// License: Licensed under MIT license (see license.js)
// ==========================================================================
/*global module test equals context ok same */
// ..........................................................
// createChildViews()
//
module("SC.View#createChildViews");
test("calls createChildView() for each class or string in childViews array", function() {
var called = [];
var v = SC.View.create({
childViews: [
SC.View.extend({ key: 0 }), // class - should be called
SC.View.create({ key: 1 }), // NOT class - should NOT be called
'customClassName' // string - should be called
],
// this shuld be used for the 'customClassName' item above
customClassName: SC.View.extend({ key: 2 }),
// patch to record results...
createChildView: function(childView) {
called.push(childView.prototype.key);
ok(childView.isClass, "childView: %@ isClass".fmt(childView));
return sc_super();
}
});
// createChildViews() is called automatically during create.
same(called, [0,2], 'called createChildView for correct children');
// make sure childViews array is correct now.
var cv = v.childViews, len = cv.length, idx;
for(idx=0;idx<len;idx++) {
equals(cv[idx].key, idx, 'has correct index key');
ok(cv[idx].isObject, 'isObject - %@'.fmt(cv[idx]));
}
});
test("should not error when there is a dud view name in childViews list.", function() {
var called = [];
var v = SC.View.create({
childViews: [
"nonExistantClassNme", // string - should NOT be called
'customClassName' // string - should be called
],
// this shuld be used for the 'customClassName' item above
customClassName: SC.View.extend({ key: 2 }),
// patch to record results...
createChildView: function(childView) {
called.push(childView.prototype.key);
ok(childView.isClass, "childView: %@ isClass".fmt(childView));
return sc_super();
}
});
// createChildViews() is called automatically during create.
same(called, [2], 'called createChildView for correct children');
});
test("should not throw error when there is an extra space in the childViews list", function() {
var called = [];
var v = SC.View.create({
childViews: "customClassName customKlassName".w(),
// this shuld be used for the 'customClassName' item above
customClassName: SC.View.extend({ key: 2 }),
customKlassName: SC.View.extend({ key: 3 })
});
ok(true, "called awake without issue.");
});
test("should not create layer for created child views", function() {
var v = SC.View.create({
childViews: [SC.View]
});
ok(v.childViews[0].isObject, 'precondition - did create child view');
equals(v.childViews[0].get('layer'), null, 'childView does not have layer');
});
// ..........................................................
// createChildView()
//
var view, myViewClass ;
module("SC.View#createChildView", {
setup: function() {
view = SC.View.create({ page: SC.Object.create() });
myViewClass = SC.View.extend({ isMyView: YES, foo: 'bar' });
}
});
test("should create view from class with any passed attributes", function() {
var v = view.createChildView(myViewClass, { foo: "baz" });
ok(v.isMyView, 'v is instance of myView');
equals(v.foo, 'baz', 'view did get custom attributes');
});
test("should set newView.owner & parentView to receiver", function() {
var v = view.createChildView(myViewClass) ;
equals(v.get('owner'), view, 'v.owner == view');
equals(v.get('parentView'), view, 'v.parentView == view');
});
test("should set newView.page to receiver.page unless custom attr is passed", function() {
var v = view.createChildView(myViewClass) ;
equals(v.get('page'), view.get('page'), 'v.page == view.page');
var myPage = SC.Object.create();
v = view.createChildView(myViewClass, { page: myPage }) ;
equals(v.get('page'), myPage, 'v.page == custom page');
});
|
"use strict";
angular.module('app.graphs').directive('morrisNoGridGraph', function(){
return {
restrict: 'E',
replace: true,
template: '<div class="chart no-padding"></div>',
link: function(scope, element){
var day_data = [{
"period" : "2012-10-01",
"licensed" : 3407,
"sorned" : 660
}, {
"period" : "2012-09-30",
"licensed" : 3351,
"sorned" : 629
}, {
"period" : "2012-09-29",
"licensed" : 3269,
"sorned" : 618
}, {
"period" : "2012-09-20",
"licensed" : 3246,
"sorned" : 661
}, {
"period" : "2012-09-19",
"licensed" : 3257,
"sorned" : 667
}, {
"period" : "2012-09-18",
"licensed" : 3248,
"sorned" : 627
}, {
"period" : "2012-09-17",
"licensed" : 3171,
"sorned" : 660
}, {
"period" : "2012-09-16",
"licensed" : 3171,
"sorned" : 676
}, {
"period" : "2012-09-15",
"licensed" : 3201,
"sorned" : 656
}, {
"period" : "2012-09-10",
"licensed" : 3215,
"sorned" : 622
}];
Morris.Line({
element : element,
grid : false,
data : day_data,
xkey : 'period',
ykeys : ['licensed', 'sorned'],
labels : ['Licensed', 'SORN']
});
}
}
});
|
'use strict';
var gulp = require('gulp'),
eslint = require('gulp-eslint'),
mocha = require('gulp-mocha');
// lint
gulp.task('lint', function() {
return gulp.src([
'./src/**/*.js',
'./test/**/*.js',
'./gulpfile.js'
])
.pipe(eslint())
.on('error', function() {})
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// travis
gulp.task('test', ['lint'], function() {
return gulp.src('./test/**/*.js')
.pipe(mocha())
.on('error', function() {});
});
// default task
gulp.task('default', ['lint'], function() {});
|
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'sinon'],
files: [
'test.js'
],
exclude: [
],
preprocessors: {
'test.js': ['webpack', 'sourcemap']
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity,
webpack: {
cache: true,
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015']
}
}
]
}
}
})
}
|
// Copyright (c) 2015 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
'use strict';
var allocCluster = require('./lib/alloc-cluster.js');
allocCluster.test('peer should use the identified connection', {
numPeers: 2
}, function t(cluster, assert) {
var server = cluster.channels[0];
var client = cluster.channels[1];
var serverHost = cluster.hosts[0];
server.makeSubChannel({
serviceName: 'server'
});
var subClient = client.makeSubChannel({
serviceName: 'server',
peers: [server.hostPort]
});
client.waitForIdentified({
host: serverHost
}, onIdentified);
function onIdentified(err) {
if (err) {
return assert.end(err);
}
var peer = subClient.peers.get(serverHost);
var socket = peer.makeOutSocket();
var conn = peer.makeOutConnection(socket);
peer.addConnection(conn);
assert.doesNotThrow(
function noThrow() {
subClient.request({
host: peer.hostPort,
hasNoParent: true,
headers: {
as: 'wat',
cn: 'hi'
}
}).send('', '', '', noop);
function noop() {}
},
'should use the identified connection'
);
assert.notEqual(conn, peer.getIdentifiedOutConnection(), 'should return the identified connection');
assert.equals(conn, peer.getOutConnection(), 'should return the latest connection');
client.close();
server.close();
assert.end();
}
});
allocCluster.test('peer should return the latest connection when none is identified', {
numPeers: 2
}, function t(cluster, assert) {
var server = cluster.channels[0];
var client = cluster.channels[1];
var serverHost = cluster.hosts[0];
server.makeSubChannel({
serviceName: 'server'
});
var subClient = client.makeSubChannel({
serviceName: 'server',
peers: [server.hostPort]
});
var peer = subClient.peers.get(serverHost);
var socket = peer.makeOutSocket();
var conn = peer.makeOutConnection(socket);
peer.addConnection(conn);
assert.equals(conn, peer.getIdentifiedOutConnection(), 'should return the latest connection');
assert.equals(conn, peer.getOutConnection(), 'should return the latest connection');
client.close();
server.close();
assert.end();
});
allocCluster.test('peer close should not leak connections', {
numPeers: 2
}, function t(cluster, assert) {
var server = cluster.channels[0];
var client = cluster.channels[1];
var serverHost = cluster.hosts[0];
server.makeSubChannel({
serviceName: 'server'
});
var subClient = client.makeSubChannel({
serviceName: 'server',
peers: [server.hostPort]
});
var peer = subClient.peers.get(serverHost);
var connection = peer.connect();
connection.identifiedEvent.on(onIdentified);
function onIdentified() {
peer = server.peers.values()[0];
var socket = peer.makeOutSocket();
var conn = peer.makeOutConnection(socket);
peer.addConnection(conn);
var count = 2;
peer.removeConnectionEvent.on(function onClose() {
count--;
});
peer.close(function onClose() {
assert.equals(0, count, 'both connections should be closed');
client.close();
server.close();
assert.end();
});
}
});
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Contract Schema
*/
var ContractSchema = new Schema({
name: {
type: String,
default: '',
required: 'Please fill Contract name',
trim: true
},
contract_number: {
type: String,
default: '',
trim: true
},
con_type: {
type: String,
default: '',
trim: true
},
transport_cost: {
type: Number,
default: '',
trim: true
},
days_effective: {
type: Number,
default: '',
trim: true
},
expected_profit: {
type: Number,
default: '',
trim: true
},
created: {
type: Date,
default: Date.now
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
mongoose.model('Contract', ContractSchema);
|
'use strict';
const _ = require('lodash');
const getSecureMiddleware = require('./get-secure-middleware');
const getHeader = require('./get-header');
const mergeOptions = require('./merge-options');
function statelessAuth(options) {
const opts = mergeOptions(_.pick(options, ['jwt', 'jwtCookie', 'secure']));
const header = getHeader(opts);
const secure = getSecureMiddleware(opts);
return {
options: opts,
decodeAuthHeader: header.decode,
jwt: header.jwt,
secure,
};
}
module.exports = statelessAuth;
|
var MongoClient = require('mongodb').MongoClient;
var mongourl = 'mongodb://192.168.17.52:27050/db_bot';
function play(content,userName,groupName,callback){
MongoClient.connect(mongourl, function(err, db) {
var cl_user = db.collection('cl_user');
var query = {'_id':userName};
var now = new Date();
var dur = Math.floor(Math.random()*666666+123456);
var endtime = new Date(now.getTime()+dur);
cl_user.findOne(query, function(err, data) {
if(data){
var end = data.end;
if(now.getTime()>end.getTime()){
var sub = now.getTime()-end.getTime();
var add = Math.floor(sub/60000);
var newhp = (data.hp+add)>(100*lv)?(100*lv):(data.hp+add);
var newmp = (data.mp+add)>(100*lv)?(100*lv):(data.mp+add);
var newtp = (data.tp+add)>(100*lv)?(100*lv):(data.tp+add);
cl_user.updateOne(query,{'$set':{start:now,end:endtime,hp:newhp,mp:newmp,tp:newtp}});
playstart();
}else{
//nowplay();
}
}else{
var init = {'_id':userName,hp:100,mp:100,tp:100,gold:100,lv:1,str:9,int:9,agi:9,love:0,start:now,end:endtime,item:[]};
cl_user.insertOne(init);
data=init;
playstart();
}
});
});
}
function playstart(data,userName,endtime){
var eventts=data.eventts;
var now = new Date();
if(eventts){
var eventdur = now.getTime()-eventts.getTime();
if(eventdur>60000){
newevent();
}else{
nowevent();
}
}else{
newevent();
}
}
function nowplay(){
}
function newevent(){
var nextEvent = Math.floor(Math.random()*99999+12345);
var nexttime = new Date(new Date().getTime()+nextEvent);
setTimeout(function(){
})
}
|
$(function(){
$('.del').click(function(e){
var target = $(e.target);
var id = target.data('id');
var tr = $('.item-id-'+id);
$.ajax({
type:'DELETE',
url:'/movie/del?id='+id
})
.done(function(results){
if(results.success === 1){
if (tr.length > 0) {
tr.remove();
}
}
})
})
$('#douban').blur(function(){
var douban = $(this);
var id = douban.val();
if(id){
$.ajax({
url:'https://api.douban.com/v2/movie/subject/' + id,
cache:true,
type:'get',
dataType:'jsonp',
crossDomain:true,
jsonp:'callback',
success:function(data){
$('#inputTitle').val(data.title)
$('#inputDirector').val(data.directors[0].name)
$('#inputCountry').val(data.countries[0])
$('#inputPoster').val(data.images.large)
$('#inputYear').val(data.year)
$('#inputSummary').val(data.summary)
}
})
}
})
})
|
module.exports = "0.4.0";
|
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Action_1 = require("../Action");
var ShiftAction = (function (_super) {
__extends(ShiftAction, _super);
function ShiftAction(_a) {
var time = _a.time, container = _a.container, _b = _a.n, n = _b === void 0 ? 1 : _b;
var _this = _super.call(this, { time: time }) || this;
_this.container = container;
_this.n = n;
return _this;
}
ShiftAction.prototype.reduce = function (state) {
var fn = this.fn(state).bind(state);
return fn({
n: this.n,
time: this.time,
container: this.container
});
};
return ShiftAction;
}(Action_1.default));
exports.default = ShiftAction;
//# sourceMappingURL=ShiftAction.js.map
|
#!/usr/bin/env node
'use strict';
var app = require('../server/app');
// start sockets for this instance and start server
app.startServer().listen(app.get('port'), app.get('ip'), function serverStarted() {
console.log('vendorApp started server on ip %s on port %d, in %s mode',
app.get('ip'), app.get('port'), app.get('env'));
});
// expose app
exports = module.exports = app;
|
describe('projectFeatured', function() {
// Load the module that contains the `projectDetail` component before each test
beforeEach(module('projectFeatured'));
// Test the controller
describe('ProjectFeaturedController', function() {
var $httpBackend, ctrl;
beforeEach(inject(function($componentController, _$httpBackend_, $routeParams) {
$httpBackend = _$httpBackend_;
$httpBackend.expectGET('projects/xyz.json').respond({name: 'project xyz'});
$routeParams.projectId = 'xyz';
ctrl = $componentController('projectFeatured');
}));
it('should fetch the project details', function() {
expect(ctrl.project).toBeUndefined();
$httpBackend.flush();
expect(ctrl.project).toEqual({name: 'project xyz'});
});
});
});
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms"). Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.
/*---
es5id: 15.2.3.14-5-7
description: >
Object.keys - inherted enumerable data property that is
over-ridden by non-enumerable own data property is not defined in
returned array
includes: [runTestCase.js]
---*/
function testcase() {
var proto = {};
Object.defineProperty(proto, "prop", {
value: 1003,
enumerable: true,
configurable: true
});
var Con = function () { };
Con.prototype = proto;
var obj = new Con();
Object.defineProperty(obj, "prop", {
value: 1004,
enumerable: false,
configurable: true
});
var arr = Object.keys(obj);
for (var p in arr) {
if (arr[p] === "prop") {
return false;
}
}
return true;
}
runTestCase(testcase);
|
App = angular.module('App', ['ngRoute', 'ngMessages', 'ngCookies']);
/* App configuration */
App.config(function($routeProvider, $locationProvider) {
/* remove any hash prefixes in the URL */
$locationProvider.hashPrefix('');
$routeProvider
.when('/', {
templateUrl: 'partials/main.html',
controller: 'MainCtrl',
controllerAs: 'c',
resolve: {
load: function($q, UserSrv, $cookies){
var defer = $q.defer();
var auth = $cookies.get('auth');
if (auth) {
auth = JSON.parse(auth);
UserSrv.setUser(auth);
}
if(UserSrv.getUser()){
defer.resolve();
} else {
defer.reject("not_logged_in");
}
return defer.promise;
}
}
})
.when('/login', {
templateUrl: 'partials/login.html',
controller: 'LoginCtrl',
controllerAs: 'c'
})
.otherwise({
redirectTo: '/'
});
/* remove the '#' from the URL */
$locationProvider.html5Mode(true);
});
|
;(function() {
"use strict";
var app = angular.module("AddressApp",[]);
app.controller("AddressBookController", function() {
var vm = this;
vm.contacts = [
{
name: "Hank",
email: "blahblah@ymail.com",
phone: 9876543210,
address: "Know Your Role Blvd "
},
{
name: "Cookie Monster",
email: "lovecookies@gmail.com",
phone: 1234567890,
address: "Sesame Street"
},
{
name: "Clifford",
email: "bigreddog@aol.com",
phone: 127361239,
address: "Too big for an address"
},
{
name: "Hank",
email: "blahblah@ymail.com",
phone: 9876543210,
address: "Know Your Role Blvd "
},
{
name: "Cookie Monster",
email: "lovecookies@gmail.com",
phone: 1234567890,
address: "Sesame Street"
},
{
name: "Clifford",
email: "bigreddog@aol.com",
phone: 127361239,
address: "Too big for an address"
}
];
vm.addContact = function() {
vm.contacts.push(vm.newContact);
vm.newContact = null;
};
vm.removeContact = function(contact) {
var index = vm.contacts.indexOf(contact);
vm.contacts.splice(index,1);
};
});
})();
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var react_component_1 = require("./react.component");
exports.NguiReactComponent = react_component_1.NguiReactComponent;
var react_module_1 = require("./react.module");
exports.NguiReactModule = react_module_1.NguiReactModule;
//# sourceMappingURL=index.js.map
|
/**
* Created by yuwh on 2017/4/30.
*/
const core=require('./core')
const dom=require('./dom')
const fp=require('./fp')
const type=require('./type')
const array=require('./array')
const convert=require('./convert')
const string=require('./string')
const ajax=require('./ajax')
module.exports={
core:core,
dom:dom,
fp:fp,
type:type,
array:array,
convert:convert,
string:string,
ajax:ajax
};
|
module.exports = {
ADD_SERVERS: 'add_servers',
REMOVE_SERVERS: 'remove_servers',
REPLACE_SERVERS: 'replace_servers',
BIND_SESSION: 'bind_session',
UNBIND_SESSION: 'unbind_session',
CLOSE_SESSION: 'close_session',
ADD_CRONS: 'add_crons',
REMOVE_CRONS: 'remove_crons',
START_SERVER: 'start_server',
START_ALL: 'start_all'
};
|
var url = require('url');
var fs = require('fs');
var postcss = require('postcss');
var path = require('canonical-path');
module.exports = postcss.plugin('postcss-cachebuster', function (opts) {
opts = opts || {};
return function (css) {
var inputFile = css.source.input.file;
css.eachDecl(function(declaration){
// only background, background-image declarations
if (declaration.prop !== 'background' && declaration.prop !== 'background-image') return;
// only url
if (!/url\(('|")?[^'"\)]+('|")?\)/.test(declaration.value)) return;
var background = /^(.*?)url\(('|")?([^'"\)]+)('|")?\)(.*?)$/.exec(declaration.value);
var assetUrl = url.parse(background[3]);
var inputPath = url.parse(inputFile);
// only locals
if (inputPath.host) return;
if (assetUrl.pathname.indexOf('//') == 0) return;
// resolve path
var assetPath = path.dirname(inputPath.pathname)
assetPath = assetPath+'/'+assetUrl.pathname;
assetPath = path.normalize(assetPath);
// cachebuster
var mtime = fs.statSync(assetPath).mtime;
var cachebuster = mtime.getTime().toString(16);
// complete url with cachebuster
if (assetUrl.search) {
assetUrl.search = assetUrl.search + '&v' + cachebuster;
} else {
assetUrl.search = '?v' + cachebuster;
}
// replace old value
declaration.value = background[1]+"url('"+url.format(assetUrl)+"')"+background[5];
})
};
});
|
var twilio = require('twilio');
var accountSid = 'ACd07fa19be220015c1f623bc38c1785e7';
var authToken = '78b4e06ced50c8cc150dbccbf0880ab9';
var client = new twilio.RestClient(accountSid, authToken);
// Pass in parameters to the REST API using an object literal notation. The
// REST client will handle authentication and response serialzation for you.
client.sms.messages.create({
to:'+19162218736',
from:'+12097819195',
body:'Testing text message capabilities for app!'
}, function(error, message) {
// The HTTP request to Twilio will run asynchronously. This callback
// function will be called when a response is received from Twilio
// The "error" variable will contain error information, if any.
// If the request was successful, this value will be "false"
if (!error) {
// The second argument to the callback will contain the information
// sent back by Twilio for the request. In this case, it is the
// information about the text messsage you just sent:
console.log('Success! The SID for this SMS message is:');
console.log(message.sid);
console.log('Message sent on:');
console.log(message.dateCreated);
} else {
console.log('Oops! There was an error.');
}
});
|
function colorRect(topLeftX,topLeftY,boxWidth,boxHeight,fillColor) {
ctx.fillStyle = fillColor;
ctx.fillRect(topLeftX,topLeftY, boxWidth,boxHeight);
}
function drawBall(centerX,centerY,radius,fillColor) {
ctx.fillStyle = fillColor;
ctx.beginPath();
ctx.arc(centerX,centerY,10,0,Math.PI*2,true);
ctx.fill();
}
function colorText(showWords,textX,textY,fillColor,fontface,textAlign = 'left' ) {
ctx.textAlign = textAlign;
ctx.font = fontface;
ctx.fillStyle = fillColor;
ctx.fillText(showWords, textX, textY);
}
|
var structCS__AUDIODEVICE =
[
[ "device_id", "structCS__AUDIODEVICE.html#acaaaa3af3e56f33d6c83612eecc5af5b", null ],
[ "device_name", "structCS__AUDIODEVICE.html#a0bc59d45f53cad0863859f38e573c9a2", null ],
[ "isOutput", "structCS__AUDIODEVICE.html#abe34361d001528d150f4c5976d195d41", null ],
[ "max_nchnls", "structCS__AUDIODEVICE.html#ad290a89b60a4119d913ca98b765e3a2c", null ],
[ "rt_module", "structCS__AUDIODEVICE.html#a2f6742e5f4b735f67adb0a61a0548ed2", null ]
];
|
import Bubble from './bubble';
import * as types from'../../../common/constants';
class CommonBubble extends Bubble {
constructor({ context, levelConfig }) {
super();
this.context = context;
this.radius = Math.floor(Math.random() * 10) + 5;
this.maxY = types.CANVAS_HEIGHT - levelConfig.WATER_BORDER_BOTTOM - this.radius;
this.minY = levelConfig.WATER_BORDER_TOP + this.radius;
this.x = types.OBJECT_INIT_X;
this.y = Math.floor(Math.random() * (this.maxY - this.minY + 1) + this.minY);
this.xSpeed = Math.floor(Math.random() * 3) + 1;
this.ySpeed = Math.floor(Math.random() * 2) + 1;
this.xDirection = 'left';
this.yDirection = null;
this.borderColor = 'black';
this.background = 'white';
this.canChangeDirection = true;
}
}
export default (data) => {
const random = Math.floor(Math.random() * 100) + 1;
return (random < 5) ? new CommonBubble(data) : null ;
};
|
var Bookshelf = require('bookshelf'),
Q = require('q'),
uuid = require('node-uuid'),
Mailgun = require('mailgun').Mailgun;
var conf = require('./config');
var DB = Bookshelf.initialize(conf.database);
var Participant = DB.Model.extend({
tableName: 'participants'
});
var model = new Participant({email: process.argv[2], name: process.argv[3], hash: uuid.v4()});
model.save().then(function() {
if (process.env.MAILGUN_API_KEY) {
var mg = new Mailgun(process.env.MAILGUN_API_KEY);
mg.sendText('Turku Agile Day <info@turkuagileday.fi>', model.get('email'), 'Choose your workshops', 'Hi there!\nYou can choose in which workshops to participate by following the following link: http://localhost:1337/' + model.get('hash') + '\n\nBest regards,\nTurku Agile Day Organizers', function() {
console.log('Check your email for instructions');
process.exit(0);
});
} else {
console.log('Login at http://localhost:1337/%s', model.get('hash'));
process.exit(0);
}
});
|
import MonsterData from '../../data/MonsterData';
import MonsterEncounterData from '../../data/MonsterEncounterData';
import MonsterEncounterStorageService from "./MonsterEncounterStorageService";
import MonsterListData from '../../data/MonsterListData';
import Prefix from "./Prefix";
import Q from "./Q";
import type StorageData from "../../data/StorageData";
import SyncStorageService from "./SyncStorageService";
const getCurrentOrderValue = function (encounterId: string, storageData: StorageData): number {
const lists = MonsterEncounterStorageService.getEncounterLists(encounterId, storageData);
if (!lists || lists.length === 0) return 0;
let maxOrder = 0;
lists.forEach(list => {
if (maxOrder < list.order) maxOrder = list.order;
});
return maxOrder + 1;
};
const getCurrentOrderWithEncounter = function (encounter: MonsterEncounterData): number {
if (!encounter.lists || encounter.lists.length === 0) return 0;
const lastList = encounter.lists[encounter.lists.length - 1];
return lastList.order + 1;
};
class MonsterListStorageService {
static findList(storageId: string, storageData: StorageData): MonsterListData {
return SyncStorageService.findSingle(storageData, Q.clazz("MonsterListData"), Q.eq("storageId", storageId));
}
static findListGroupedByEncounter(storageData: StorageData): Promise<Map<string, MonsterListData[]>> {
const listMap: Map<string, MonsterListData[]> = SyncStorageService.findGroupedBy(storageData, "encounterId", Q.clazz("MonsterListData"));
if (listMap.length === 0) {
return Promise.resolve(listMap);
}
// check existing ordering info
const firstList: MonsterListData = SyncStorageService.findSingle(storageData, Q.clazz("MonsterListData"));
let checkOrderPromise = Promise.resolve();
if (firstList && (firstList.order === null || firstList.order === undefined)) {
const toSaveLists = [];
for (var encounterId of listMap.keys()) {
let lists = listMap.get(encounterId);
if (!lists || lists.length === 0) continue;
lists = lists.sort((a: MonsterListData, b: MonsterListData) => a.name.localeCompare(b.name));
lists.forEach((list, idx) => {
list.order = idx;
toSaveLists.push(list);
});
}
checkOrderPromise = SyncStorageService.updateData(toSaveLists);
}
return checkOrderPromise.then(() => listMap);
}
static getListMonsters(listId: string, storageData: StorageData): MonsterData[] {
return SyncStorageService.find(storageData, Q.clazz("MonsterData"), Q.eq("listId", listId));
}
static createList(name: string, monsterId: string, encounterId: string, storageData: StorageData): Promise<MonsterListData> {
const newList = new MonsterListData(null, encounterId, monsterId, name, 0);
newList.order = getCurrentOrderValue(encounterId, storageData);
return SyncStorageService.createData("MonsterListData", newList);
}
static createCustomList(name: string, hpexp: string, encounter: MonsterEncounterData): Promise<MonsterListData> {
const newLisId = Prefix.createStorageId("MonsterListData");
const customMonsterId = Prefix.createCustomMonsterId();
const newList = new MonsterListData(newLisId, encounter.storageId, customMonsterId, name, 0);
newList.order = getCurrentOrderWithEncounter(encounter);
newList.hpexp = hpexp;
return SyncStorageService.createData(null, newList);
}
static deleteList(list: MonsterListData): Promise {
if (!list) return Promise.resolve();
const toDelete = [];
toDelete.push(list);
if (list.monsters) list.monsters.forEach(monster => toDelete.push(monster));
return SyncStorageService.deleteData(toDelete);
}
}
export default MonsterListStorageService;
|
import { unstable_batchedUpdates } from 'preact/compat';
describe('unstable_batchedUpdates', () => {
it('should call the callback', () => {
const spy = sinon.spy();
unstable_batchedUpdates(spy);
expect(spy).to.be.calledOnce;
});
it('should call callback with only one arg', () => {
const spy = sinon.spy();
unstable_batchedUpdates(spy, 'foo', 'bar');
expect(spy).to.be.calledWithExactly('foo');
});
});
|
var account_app = account_app || {};
(function(){
var Action_btn = account_app.Action_btn = React.createClass({displayName: "Action_btn",
handleClick:function(){
this.props.perform_action();
},
render:function(){
return (React.createElement("button", {className: "btn btn-primary", onClick: this.handleClick}, this.props.content));
}
});
var Username_field = account_app.Username_field = React.createClass({displayName: "Username_field",
handleChange:function(){
this.props.update_username(this.refs.username.value);
},
render:function(){
return (React.createElement("input", {className: "input-base input-username", ref: "username", placeholder: "Input Username", onChange: this.handleChange}));
}
});
var Password_field = account_app.Password_field = React.createClass({displayName: "Password_field",
handleChange:function(){
this.props.update_password(this.refs.pass.value);
},
render:function(){
return (React.createElement("input", {className: "input-base input-password", ref: "pass", type: "password", placeholder: "Input password", onChange: this.handleChange}))
}
});
account_app.Login_window = React.createClass({displayName: "Login_window",
render:function(){
}
});
})();
|
requirejs.config({
paths: {
'text': '../lib/require/text',
'durandal':'../lib/durandal/js',
'plugins' : '../lib/durandal/js/plugins',
'transitions' : '../lib/durandal/js/transitions',
'knockout': '../lib/knockout/knockout-2.3.0',
'jquery': '../lib/jquery/jquery-1.9.1'
}
});
define(function (require) {
var system = require('durandal/system'),
app = require('durandal/app');
system.debug(true);
app.title = 'Durandal Starter Kit';
app.configurePlugins({
router:true,
dialog: true
});
app.start().then(function() {
app.setRoot('shell');
});
});
|
// pages/movies/movie.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
|
/*$(document).ready(function(){
$("#checkout").click(function () {
var dat = [];
for (var counter = 0; counter < shoppingCart.length; counter++)
{
dat.push({
name: shoppingCart[counter][0],
amount: shoppingCart[counter][1]
});
}
console.log(dat);
/*hide("#invoice-card");
hide(floatingButton);
updateShoppingCartNumber();
$.post("?url=Foodmenu/makeOrder", {
ss: JSON.stringify(dat),
address:$("#address").val(),
paymentmethod:$("#payment-method-select").val(),
credit_number:$("#credit-card-number-text").val(),
cvc:$("#cvc-text").val(),
expire_date:$("#expire-date-text").val(),
}, function (data) {
console.log(data);
});
});
});*/
|
export const encode = s =>
encodeURIComponent(String(s || "").replace(/\s/g, "_")).replace(
/"%27"/g,
"%20"
);
export const decode = s =>
decodeURIComponent(String(s || "").replace(/(\s|_|\+)/g, " ")).replace(
/%20/g,
"'"
);
|
import ActionTypes from "./actionTypes";
// Action to hide the panel
export function hide() {
return {
type: ActionTypes.Hide.Panel,
visible: false
};
}
// Action to show the panel
export function show() {
return {
type: ActionTypes.Show.Panel,
visible: true
};
}
|
import { isSelected } from '../../src/utils/selection'
describe('isSelected', () => {
test('it returns true if it is the same object by reference', () => {
const value = {
x: { sample: 'value' },
y: 1,
}
expect(isSelected(value, value)).toBeTruthy()
})
test('it returns true if it is the same object by equality', () => {
const value = {
x: { sample: 'value' },
y: 1,
}
const equalivalentValue = {
x: { sample: 'value' },
y: 1,
}
expect(isSelected(value, equalivalentValue)).toBeTruthy()
})
test('it returns false if the object is not equal', () => {
const value = {
x: { sample: 'value' },
y: 1,
}
const nonEqualivalentValue = {
x: { sample: 'value' },
y: 2,
}
expect(isSelected(value, nonEqualivalentValue)).toBeFalsy()
})
})
|
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(248);
module.exports = __webpack_require__(248);
/***/ }),
/***/ 248:
/***/ (function(module, exports) {
(function( window, undefined ) {
kendo.cultures["mn"] = {
name: "mn",
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: "₮"
}
},
calendars: {
standard: {
days: {
names: ["Ням","Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба"],
namesAbbr: ["Ня","Да","Мя","Лха","Пү","Ба","Бя"],
namesShort: ["Ня","Да","Мя","Лх","Пү","Ба","Бя"]
},
months: {
names: ["1 дүгээр сар","2 дугаар сар","3 дугаар сар","4 дүгээр сар","5 дугаар сар","6 дугаар сар","7 дугаар сар","8 дугаар сар","9 дүгээр сар","10 дугаар сар","11 дүгээр сар","12 дугаар сар"],
namesAbbr: ["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"]
},
AM: [""],
PM: [""],
patterns: {
d: "yyyy-MM-dd",
D: "yyyy 'оны' M'-р сарын' d. dddd 'гариг'.",
F: "yyyy 'оны' M'-р сарын' d. dddd 'гариг'. HH:mm:ss",
g: "yyyy-MM-dd HH:mm",
G: "yyyy-MM-dd HH:mm:ss",
m: "MMMM d.",
M: "MMMM d.",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "HH:mm",
T: "HH:mm:ss",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "yyyy 'оны' MMMM",
Y: "yyyy 'оны' MMMM"
},
"/": "-",
":": ":",
firstDay: 1
}
}
}
})(this);
/***/ })
/******/ });
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// Ecma International makes this code available under the terms and conditions set
// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
// "Use Terms"). Any redistribution of this code must retain the above
// copyright and this notice and otherwise comply with the Use Terms.
/*---
es5id: 15.4.4.19-8-b-10
description: >
Array.prototype.map - deleting property of prototype causes
prototype index property not to be visited on an Array-like Object
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return idx === 1 && typeof val === "undefined";
}
var obj = { 2: 2, length: 20 };
Object.defineProperty(obj, "0", {
get: function () {
delete Object.prototype[1];
return 0;
},
configurable: true
});
try {
Object.prototype[1] = 1;
var testResult = Array.prototype.map.call(obj, callbackfn);
return testResult.length === 20 && typeof testResult[1] === "undefined";
} finally {
delete Object.prototype[1];
}
}
runTestCase(testcase);
|
'use strict';
class Store {
constructor(game, type) {
this.game = game;
this.type = type;
}
draw(context, x, y) {
context.fillStyle = 'green';
context.fillRect(x, y, 100, 100);
}
}
export default Store;
|
'use strict';
//# sourceMappingURL=Transaction.js.map
|
import React, { PropTypes } from 'react';
import { Provider } from 'react-redux';
import { Router } from 'react-router';
import routes from './routes';
let hmrKey = Math.random();
const Root = ({ store, history }) => (
<Provider store={store}>
<Router key={hmrKey} history={history}>
{routes}
</Router>
</Provider>
);
if (module.hot) {
hmrKey = Math.random();
}
Root.propTypes = {
store: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
};
export default Root;
|
/**
* Lo-Dash 2.3.0 (Custom Build) <http://lodash.com/>
* Build: `lodash modularize exports="node" -o ./compat/`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <http://lodash.com/license>
*/
var assign = require('../objects/assign'),
baseEach = require('./baseEach'),
forOwn = require('../objects/forOwn'),
getArray = require('./getArray'),
isArray = require('../objects/isArray'),
isNode = require('./isNode'),
isObject = require('../objects/isObject'),
releaseArray = require('./releaseArray'),
slice = require('./slice'),
support = require('../support');
/** Used to match regexp flags from their coerced string values */
var reFlags = /\w*$/;
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
/** Used to identify object classifications that `_.clone` supports */
var cloneableClasses = {};
cloneableClasses[funcClass] = false;
cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
cloneableClasses[boolClass] = cloneableClasses[dateClass] =
cloneableClasses[numberClass] = cloneableClasses[objectClass] =
cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
/** Used for native method references */
var objectProto = Object.prototype;
/** Used to resolve the internal [[Class]] of values */
var toString = objectProto.toString;
/** Native method shortcuts */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to lookup a built-in constructor by [[Class]] */
var ctorByClass = {};
ctorByClass[arrayClass] = Array;
ctorByClass[boolClass] = Boolean;
ctorByClass[dateClass] = Date;
ctorByClass[funcClass] = Function;
ctorByClass[objectClass] = Object;
ctorByClass[numberClass] = Number;
ctorByClass[regexpClass] = RegExp;
ctorByClass[stringClass] = String;
/**
* The base implementation of `_.clone` without argument juggling or support
* for `thisArg` binding.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep=false] Specify a deep clone.
* @param {Function} [callback] The function to customize cloning values.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates clones with source counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, isDeep, callback, stackA, stackB) {
if (callback) {
var result = callback(value);
if (typeof result != 'undefined') {
return result;
}
}
// inspect [[Class]]
var isObj = isObject(value);
if (isObj) {
var className = toString.call(value);
if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) {
return value;
}
var ctor = ctorByClass[className];
switch (className) {
case boolClass:
case dateClass:
return new ctor(+value);
case numberClass:
case stringClass:
return new ctor(value);
case regexpClass:
result = ctor(value.source, reFlags.exec(value));
result.lastIndex = value.lastIndex;
return result;
}
} else {
return value;
}
var isArr = isArray(value);
if (isDeep) {
// check for circular references and return corresponding clone
var initedStack = !stackA;
stackA || (stackA = getArray());
stackB || (stackB = getArray());
var length = stackA.length;
while (length--) {
if (stackA[length] == value) {
return stackB[length];
}
}
result = isArr ? ctor(value.length) : {};
}
else {
result = isArr ? slice(value) : assign({}, value);
}
// add array properties assigned by `RegExp#exec`
if (isArr) {
if (hasOwnProperty.call(value, 'index')) {
result.index = value.index;
}
if (hasOwnProperty.call(value, 'input')) {
result.input = value.input;
}
}
// exit for shallow clone
if (!isDeep) {
return result;
}
// add the source value to the stack of traversed objects
// and associate it with its clone
stackA.push(value);
stackB.push(result);
// recursively populate clone (susceptible to call stack limits)
(isArr ? baseEach : forOwn)(value, function(objValue, key) {
result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
});
if (initedStack) {
releaseArray(stackA);
releaseArray(stackB);
}
return result;
}
module.exports = baseClone;
|
/**
* Created by Estelle on 16/06/2016.
*/
'use strict';
angular.module('core.context', ['ngResource']);
|
{
var data = "";
req.on("data", function(chunk) {
data += chunk;
});
req.on("end", function() {
console.log("File uploaded");
res.writeHead(200);
res.end();
});
}
|
/**
* Created by zhengguorong on 16/6/22.
*/
import Vue from 'vue'
import Vuex from 'vuex'
import contentManage from './modules/contentManage'
import app from './modules/app'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({
modules: {
contentManage,
app
},
strict: debug
})
|
version https://git-lfs.github.com/spec/v1
oid sha256:051c513c1bccfd5530e6080a7d95f1d567300a748e9668be84ed52b0d109cc5f
size 65815
|
import Application from 'ember-application';
import run from 'ember-runloop';
import { initialize } from '../../../instance-initializers/-sustains';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';
module('Unit | Instance Initializer | sustains', {
beforeEach() {
run(() => {
this.application = Application.create();
this.appInstance = this.application.buildInstance();
});
},
afterEach() {
run(this.appInstance, 'destroy');
destroyApp(this.application);
}
});
// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.appInstance);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
|
var a00015 =
[
[ "player_t", "a00005.html", "a00005" ],
[ "player", "a00015.html#ga423655ccd6f0739c6cd730982fa6de05", null ],
[ "player_init", "a00015.html#ga5c83feea6dbd6e2448404261375365e3", null ],
[ "player_new", "a00015.html#ga75b1ecd76f93fa8893c4f2bab9fbf03b", null ],
[ "player_set_fifo_name", "a00015.html#ga2d7b416518d58ac941d831b808273f2c", null ],
[ "player_set_name", "a00015.html#ga761441bacf27fb156667785386ad8f21", null ]
];
|
//~ name b605
alert(b605);
//~ component b606.js
|
import babel from 'rollup-plugin-babel';
import fs from 'fs';
const pkg = JSON.parse(fs.readFileSync('./package.json'));
export default {
entry: 'src/index.js',
external: ['query-string'],
moduleName: 'hashHandler',
globals: {
'query-string': 'queryString',
},
useStrict: false,
sourceMap: true,
plugins: [
babel({
presets: [['es2015', { modules: false }], 'flow'],
babelrc: false,
}),
],
targets: [
{ dest: pkg.main, format: 'umd' },
{ dest: pkg.module, format: 'es' },
],
};
|
(function () {
'use strict';
var app = angular.module('Fablab');
app.factory('TrainingService', function ($log, $resource, $http) {
var training = $resource(App.API.TRAINING_API + "/:id", {id: '@id'});
return {
list: function (successFn) {
$http(
{
method: 'GET',
url: App.API.TRAINING_API
}
).success(successFn);
},
remove: function (id, successFn) {
$log.debug("TrainingService: remove...");
training.remove({id: id}, successFn);
},
softRemove: function (id, successFn) {
$http.get(App.API.TRAINING_API + "/softRemove?id=" + id).success(successFn);
$log.debug("TrainingService: soft remove...");
},
save: function (trainingParam, successFn, errorFn) {
$log.debug("TrainingService: save...");
var saved = training.save(trainingParam, successFn, errorFn);
return saved;
},
get: function (id, successFn) {
$log.debug("TrainingService: get...");
var trainingRes = training.get({id: id}, successFn);
return trainingRes;
},
getId: function(name, successFn) {
$http.get(App.API.TRAINING_API + "/getId?name=" + name.latinise()).success(successFn);
}
};
});
}());
|
import { uglify } from 'rollup-plugin-uglify'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
export default {
input: 'packages/react/dist/index.js',
plugins: [
resolve({ browser: true }),
uglify(),
commonjs()
],
output: {
name: 'JSONEditor',
file: 'packages/react/dist/react-schema-based-json-editor.min.js',
format: 'umd'
},
external: [
'react',
'react-dom'
]
}
|
var packraturl = 'http://localhost:3000';
$(document).ready(function() {
$.ajaxSetup({
xhrFields: {
withCredentials: true
}
});
var form2object = function(form) {
var data = {};
$(form).find('input').each(function(index, element) {
var type = $(this).attr('type');
if ($(this).attr('name') && type !== 'submit' && type !=='hidden') {
data[$(this).attr('name')] = $(this).val();
}
});
return data;
};
var callback = function callback(error, data) {
if (error) {
console.error(error);
$('#result').val('status: ' + error.status + ', error: ' + error.error);
return;
}
$('#result').val(JSON.stringify(data, null, 4));
};
$('#register').on('submit', function(e) {
e.preventDefault();
var credentials = form2object(this);
console.log(credentials);
packrat.register(credentials, callback);
});
$('#login').on('submit', function(e) {
var credentials = form2object(this);
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
$('#login').each(function(){
this.reset();
});
$(".home-links").hide();
// $("#home-page").hide();
$("#about").hide();
$("#signup").hide();
$("#contact").hide();
$("#logout").show();
};
e.preventDefault();
packrat.login(credentials, cb);
});
$('#get-files').on('click', function(e) {
$(".files").html('');
var images = form2object(this);
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
var urls = data;
// console.log(urls[0].path);
for (var i = 0; i < urls.length; i++) {
console.log(urls[i].name);
$(".files").append("<li> File Name: " + urls[i].name.toString() + " ID: " + urls[i]._id.toString() + "</li>");
}
// $(".files").append("<li>" + data + "</li>");
};
e.preventDefault();
packrat.showfiles(images, cb);
});
$('#update').on('submit', function(e) {
var image = form2object(this);
console.log(image);
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
$('#update').reset();
};
e.preventDefault();
packrat.update(image, cb);
});
$('#deleteall').on('submit', function(e) {
var image = form2object(this);
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
console.log('success');
};
e.preventDefault();
packrat.deleteall(image, cb);
console.log("click handler success");
});
$("#deleteone").on('submit', function(e){
var image = form2object(this);
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
console.log('success');
};
e.preventDefault();
console.log(image);
packrat.deleteone(image, cb);
packrat.deletefile(image, cb);
});
$('#logout').on('click', function(e) {
var cb = function cb(error, data) {
if (error) {
callback(error);
return;
}
callback(null, data);
$(".home-links").show();
// $("#home-page").show();
$("#about").show();
$("#signup").show();
$("#contact").show();
$(".logged-in").hide();
$("#logout").hide();
};
e.preventDefault();
packrat.logout(cb);
});
}); //document.ready
|
import { module, inject } from "angular-mocks";
import "../../../app/auth/auth.module";
(function () {
'use strict';
describe('HttpHeaderInterceptor', function () {
var httpHeaderInterceptor,
CookiesServiceMock;
beforeEach(module('xr.auth'));
beforeEach(module(function ($provide) {
CookiesServiceMock = {
get: function () {}
};
$provide.value('$cookies', CookiesServiceMock);
}));
beforeEach(inject(function (_httpHeaderInterceptor_) {
httpHeaderInterceptor = _httpHeaderInterceptor_;
}));
describe('request', function () {
it('should add Authorization header if token exists', function () {
var token = '1234';
spyOn(CookiesServiceMock, 'get').and.returnValue(token);
var config = httpHeaderInterceptor.request({ headers: {} });
expect(config.headers.Authorization).toBe('Bearer ' + token);
});
it('should not add Authorization header if no token', function () {
var config = httpHeaderInterceptor.request({ headers: {} });
expect(config.headers.Authorization).toBeUndefined();
});
});
});
})();
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const invariant = require('invariant');
const stableCopy = require('./stableCopy');
import type {RequestParameters} from './RelayConcreteNode';
import type {Variables} from './RelayRuntimeTypes';
export opaque type Identifier: string = string;
/**
* Returns a stable identifier for the given pair of `RequestParameters` +
* variables.
*/
function getRequestParametersIdentifier(
parameters: RequestParameters,
variables: Variables,
): Identifier {
const requestID = parameters.id != null ? parameters.id : parameters.text;
invariant(
requestID != null,
'getRequestParametersIdentifier: Expected request `%s` to have either a ' +
'valid `id` or `text` property',
parameters.name,
);
return requestID + JSON.stringify(stableCopy(variables));
}
module.exports = getRequestParametersIdentifier;
|
import * as types from '../actions/action-types'
const initialState = {
blocked: false
}
const commonReducer = function(state = initialState, action) {
switch(action.type) {
case types.BLOCK_UI:
return Object.assign({}, state, {blocked: true})
case types.UNBLOCK_UI:
return Object.assign({}, state, {blocked: false})
}
return state
}
export default commonReducer
|
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
browserSync = require('browser-sync').create(),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
jasmine = require('gulp-jasmine');
// Jasmine Testing
gulp.task('test', function(){
console.log((new Date).toLocaleTimeString() + " Tests Excecuted!");
return gulp.src('spec/test.js')
.pipe(jasmine());
});
// Linting and minifying
gulp.task('js-liniting-compliling',
function(){
console.log((new Date).toLocaleTimeString() + " ReMinified JS!");
return gulp.src('scripts/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('all.js'))
.pipe(gulp.dest('dist/js'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'),
browserSync.reload());
});
gulp.task('js-watch', ['js-liniting-compliling']);
gulp.task('server', function(){
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch("scripts/*.js", ['js-watch']);
gulp.watch("styles/*.css", ['minify-css']);
});
//minify css
gulp.task('minify-css',
function() {
console.log((new Date).toLocaleTimeString() + " ReMinified CSS!");
return gulp.src('styles/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('dist/styles'),
browserSync.reload());
});
|
function JsonUtil() {
/**
* Given a provided object,
* return a string representation of the object type.
*/
this.isType = function (obj_) {
if (obj_ === null) {
return "null";
}
if (obj_ === NaN) {
return "Nan";
}
var _type = typeof obj_;
switch (_type) {
case "undefined":
return "undefined";
case "number":
return "number";
case "boolean":
return "boolean";
case "string":
return "string";
case "function":
return "function";
case "object":
if (this.isArray(obj_)) {
return "array";
}
return "associative";
}
},
/**
* Recursively search and display array as an HTML table.
*/
this.tableifyArray = function (array_) {
if (array_.length === 0) {
return "[ empty ]";
}
var _out = "<table class='arrayTable'>";
_out += "<tr class='label arrayTr'><td class='arrayTd'>"
+ "<span>array</span></td></tr>";
for (var i = array_.length - 1; i >= 0; i--) {
_out += "<tr class='label arrayTr'><td class='arrayTd'><span>index: "
+ i + "</span></td></tr>";
_out += "<tr class='arrayTr'><td class='arrayTd'>"
+ this.tableifyObject(array_[i]) + "</td></tr>";
}
_out += "</table>";
return _out;
},
/**
* Recursively search and display common javascript types as an HTML table.
*/
this.tableifyObject = function (obj_) {
/*
if (obj_ === '') {
return "[ empty ]";
}
*/
switch (this.isType(obj_)) {
case "null":
return "null";
case "undefined":
return "undefined";
case "number":
return obj_;
case "boolean":
return obj_;
case "string":
return obj_;
case "array":
return this.tableifyArray(obj_);
case "associative":
return this.tableifyAssociative(obj_);
}
return "!error converting object!";
},
/**
* Recursively search and display associative array as an HTML table.
*/
this.tableifyAssociative = function (array_) {
if (this.isEmpty(array_)) {
return "{ empty }";
}
var _out = "<table class='associativeTable'>";
_out += "<tr class='label associativeTr'>"
+ "<td class='associativeTd' colspan='2'><span>associative</span></td></tr>";
_out += "<tr class='label associativeTr'>"
+ "<td class='associativeTd'><span>key</span></td><td >"
+ "<span>value</span></td></tr>";
for (var _index in array_) {
_out += "<tr class='associativeTr'><td class='associativeTd'>"
+ this.tableifyObject(_index) + "</td><td class='associativeTd'>"
+ this.tableifyObject(array_[_index]) + "</td></tr>";
}
_out += "</table>";
return _out;
},
/**
* identify if an associative array is empty
*/
this.isEmpty = function (map_) {
for (var _key in map_) {
if (map_.hasOwnProperty(_key)) {
return false;
}
}
return true;
},
/**
* Identify is an array is a 'normal' (not associative) array
*/
this.isArray = function (v_) {
return Object.prototype.toString.call(v_) == "[object Array]";
},
/**
* given the desire to populate a map of maps, adds a master key,
* and child key and value to a provided object.
*/
this.addToMapOfMaps = function (map_, mkey_, key_, value_) {
if (map_ === undefined) {
map_ = {};
}
if (map_[mkey_] === undefined) {
map_[mkey_] = {}
}
if (map_[mkey_][key_] === undefined) {
map_[mkey_][key_] = null;
}
map_[mkey_][key_] = value_;
return map_;
}
}
|
export default '0.0.50';
|
/* @flow */
'use strict';
var React = require('react-native');
var {
AppRegistry,
NetInfo,
Text,
StyleSheet,
View,
} = React;
var NetInfoExample = React.createClass({
getInitialState(){
return {
reachabilityHistory: [],
reachayility: null,
isConnected: null,
};
},
componentDidMoutn: function(){
NetInfo.addEventListener('change', this._handleReachabilityChange);
NetInfo.isConnected.addEventListener('change', this._handleConnectivityChange);
NetInfo.fetch().done((reachability) => {this.setState({reachability})});
NetInfo.isConnected.fetch().done((isConnected) => {this.setState({isConnected})});
},
componentWillUnmount: function(){
NetInfo.removeEventListener('change', this._handleReachabilityChange);
NetInfo.isConnected.removeEventListener('change', this._handleConnectivityChange);
},
_handleReachabilityChange: function (reachability) {
var reachabilityHistory = this.state.reachabilityHistory.slice();
reachabilityHistory.push(reachability);
this.setState({
reachabilityHistory,
reachability,
});
},
_handleConnectivityChange:function (isConnected) {
this.setState({
isConnected,
});
},
render: function() {
return (
<View style={styles.container}>
<Text>
{JSON.stringify(this.state.reachabilityHistory)}
</Text>
<Text>
{this.state.reachability}
</Text>
<Text>
{this.state.isConnected ? 'Online' : 'Offline'}
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
AppRegistry.registerComponent('reactnative', () => NetInfoExample);
|
import {metadata} from 'aurelia-metadata';
import {ValidationConfig} from './validation-config';
import {ValidationEngine} from './validation-engine';
import {validationMetadataKey} from './metadata-key';
export function observeProperty(target, key, descriptor) {
let config = metadata.getOrCreateOwn(validationMetadataKey, ValidationConfig, target);
// TODO: REMOVE
let innerPropertyName = `_${key}`;
// typescript or babel?
let babel = descriptor !== undefined;
if (babel) {
// babel passes in the property descriptor with a method to get the initial value.
// set the initial value of the property if it is defined.
if (typeof descriptor.initializer === 'function') {
target[innerPropertyName] = descriptor.initializer();
}
} else {
descriptor = {};
}
delete descriptor.writable;
delete descriptor.initializer;
descriptor.get = function() { return this[innerPropertyName]; };
descriptor.set = function(newValue) {
let reporter = ValidationEngine.getValidationReporter(this);
this[innerPropertyName] = newValue;
config.validate(this, reporter);
};
descriptor.get.dependencies = [innerPropertyName];
if (!babel) {
Reflect.defineProperty(target, key, descriptor);
}
}
|
/* eslint-disable prefer-destructuring */
const { performance } = require('perf_hooks');
const { createCanvas } = require('canvas');
/**
* To not impact browser performance at all
* I am using the node implementation of canvas,
* doing all the rendering server side and
* returning a base64 string to render within
* an <img/> element
*/
function drawCanvas(colors) {
const width = 256;
const height = 128;
const canvas = createCanvas(width, height);
const ctx = canvas.getContext('2d');
const imgData = ctx.createImageData(width, height);
for (let i = 0; i < imgData.data.length; i += 4) {
const cPos = i / 4;
imgData.data[i] = colors[cPos][0];
imgData.data[i + 1] = colors[cPos][1];
imgData.data[i + 2] = colors[cPos][2];
imgData.data[i + 3] = colors[cPos][3];
}
ctx.putImageData(imgData, 0, 0);
return canvas.toDataURL();
}
export default (req, res) => {
const { query } = req;
const palette = [];
const steps = 32;
const increment = 8;
const params = new Array(steps + 1).fill().map((_, i) => i * increment);
// remove 0 column color so the resulting loop returns 32,768 colors
params.shift();
/**
* This was my first attempt at building out the color array I would use to build the image.
* Nesting loops is usually something to avoid so I wanted to see how well it performed.
* Using the performance module it takes usually ~4ms.
* Since it's still fast and is easy to read and reason about I decided to stick with it.
*/
const startP = performance.now();
const alpha = query.alpha || 255;
params.forEach(r => {
params.forEach(g => {
params.forEach(b => {
/**
* One thing to note, the top value here is 256 which is above the 255 limit
* for an rgb color value. Anything over 255 is treated as 255 when rendered
* in canvas or the browser, so while this works there could be a case to check
* and clamp >=256 down to 255.
*
* Adding alpha value here to match up with canvas pixel data: (r,g,b,a).
*/
palette.push([r, g, b, alpha]);
});
});
});
const endP = performance.now();
console.log('loop time:', `${endP - startP}ms`);
/**
* Sort by total value of all three color components
* Results in a dark to light fade effect while ignoring
* the color itself.
*/
if (query.sort === '1') {
const startS = performance.now();
const reducer = (a, b) => a + b;
palette.sort((a, b) => a.reduce(reducer) - b.reduce(reducer));
const endS = performance.now();
console.log('sort time:', `${endS - startS}ms`);
}
res.end(JSON.stringify(drawCanvas(palette)));
};
|
import Test from '../../_helpers/Test'
import bp from '../../_helpers/breakpoints'
import mq from '../../_helpers/mq'
import report_result_summary from '../../_helpers/report_result_summary'
import sequence from '../../_helpers/sequence'
import ResultTracker from '../../_helpers/ResultTracker'
import apply_style from '../../_helpers/apply_style'
export default function () {
let minHeightResults = new ResultTracker()
class positiveTest extends Test {
constructor({ name, test }) {
super({
name: `positive minHeight ${name}`,
test,
size: [bp.large, bp.large + 1],
mqMatch: true,
localTracker: minHeightResults,
})
}
}
class negativeTest extends Test {
constructor({ name, test }) {
super({
name: `negative minHeight ${name}`,
size: [bp.large],
mqMatch: false,
test: test,
localTracker: minHeightResults,
})
}
}
const positive_tests = [
new positiveTest({
name: `"large" (if)`,
test: () => mq.minHeight('large'),
}),
new positiveTest({
name: `${bp.large} (if)`,
test: () => mq.minHeight(bp.large),
}),
new positiveTest({
name: `"large" (cb)`,
test: () => {
let result = false
mq.minHeight('large', () => {
result = true
})
return result
},
}),
new positiveTest({
name: `${bp.large} (cb)`,
test: () => {
let result = false
mq.minHeight(bp.large, () => {
result = true
})
return result
},
}),
]
const negative_tests = [
new negativeTest({
name: `"large" (if)`,
test: () => mq.minHeight('large'),
}),
new negativeTest({
name: `${bp.large} (if)`,
test: () => mq.minHeight(bp.large),
}),
new negativeTest({
name: `"large" (cb)`,
test: () => {
let result = false
mq.minHeight('large', () => {
result = true
})
return result
},
}),
new negativeTest({
name: `${bp.large} (cb)`,
test: () => {
let result = false
mq.minHeight(bp.large, () => {
result = true
})
return result
},
}),
]
return sequence([
apply_style('minHeight'),
...positive_tests,
...negative_tests,
report_result_summary('minHeight', minHeightResults),
])
}
|
/*!
* angular-translate - v2.5.2 - 2015-01-13
* http://github.com/angular-translate/angular-translate
* Copyright (c) 2015 ; Licensed MIT
*/
angular.module('pascalprecht.translate')
/**
* @ngdoc object
* @name pascalprecht.translate.$translateStaticFilesLoader
* @requires $q
* @requires $http
*
* @description
* Creates a loading function for a typical static file url pattern:
* "lang-en_US.json", "lang-de_DE.json", etc. Using this builder,
* the response of these urls must be an object of key-value pairs.
*
* @param {object} options Options object, which gets prefix, suffix and key.
*/
.factory('$translateStaticFilesLoader', ['$q', '$http', function ($q, $http) {
return function (options) {
if (!options || (!angular.isString(options.prefix) || !angular.isString(options.suffix))) {
throw new Error('Couldn\'t load static files, no prefix or suffix specified!');
}
var deferred = $q.defer();
$http(angular.extend({
url: [
options.prefix,
options.key,
options.suffix
].join(''),
method: 'GET',
params: ''
}, options.$http)).success(function (data) {
deferred.resolve(data);
}).error(function (data) {
deferred.reject(options.key);
});
return deferred.promise;
};
}]);
|
define(function(require) {
var Class = require('class/Class');
//Abstraction of relative positioning information, modeled after jQuery UI
//(more predictable) and jquery.qTip (more precise)
var Position = Class.extend(/** @lends Position.prototype */ {
__defaults: {
x: null,
y: null,
precedence: null
},
/**
* @constructs
*/
constructor: function(opts) {
if (opts && opts.constructor === String) {
return Position.fromString(opts);
}
this._apply(opts);
},
/** @type {String} */
x: { get: null, set: null },
/** @type {String} */
y: { get: null, set: null },
/** @type {String} */
precedence: { get: null, set: null },
/** @type {Array<String>} */
order: {
get: function() {
if (this.precedence === 'x') {
return ['x', 'y'];
}
return ['y', 'x'];
}
},
/** @type {Array<String>} */
parts: {
get: function() {
if (this.precedence === 'x') {
return [this.x, this.y];
}
return [this.y, this.x];
}
},
/**
* @return {joss/geometry/Position}
*/
reverse: function() {
var pos = this.clone();
if (pos.x === 'left') {
pos.x = 'right';
}
else if (pos.x === 'right') {
pos.x = 'left';
}
else {
pos.x = 'center';
}
if (pos.y === 'top') {
pos.y = 'bottom';
}
else if (pos.y === 'bottom') {
pos.y = 'top';
}
else {
pos.y = 'center';
}
return pos;
},
/**
* @return {String}
*/
toString: function() {
if (this.precedence === 'x') {
return this.x + ' ' + this.y;
}
else {
return this.y + ' ' + this.x;
}
}
}); //Position
/**
* translate something like 'left top' into a joss.Position object. order
* doesn't matter.
* @param {String} str
* @return {joss/geometry/Position}
*/
Position.fromString = function(str) {
var parts = str.split(' ');
var axes = [];
if (parts.length === 1) {
parts[1] = 'center';
}
parts.forEach(function(part, i) {
switch (part) {
case 'left':
case 'right':
axes[i] = 'x';
break;
case 'top':
case 'bottom':
axes[i] = 'y';
break;
default:
axes[i] = null;
parts[i] = 'center';
break;
}
});
//each axis, if null ("center" was given), is the opposite of the other axis
axes[0] = axes[0] || ((axes[1] === 'x') ? 'y' : 'x');
axes[1] = axes[1] || ((axes[0] === 'x') ? 'y' : 'x');
var pos = new Position();
pos.precedence = axes[0];
axes.forEach(function(axis, i) {
switch(axis) {
case 'x':
pos.x = parts[i];
break;
case 'y':
pos.y = parts[i];
break;
}
});
return pos;
};
return Position;
});
|
import ReactVelocityTransitionGroup from './lib/ReactVelocityTransitionGroup';
export default ReactVelocityTransitionGroup;
|
function EDMDGraphics(simulation, canvas) {
this._simulation = simulation;
this._canvas = canvas;
this._sim_dt_per_frame = 1000.0;
this.update = function() {
this._simulation.step(this._sim_dt_per_frame);
};
this.show = function() {
this._show_background();
this._show_particles();
this._highlight_first_event();
this._show_time();
this._show_fps();
};
this._show_background = function() {
push();
background(51);
stroke(255);
strokeWeight(1);
pop();
};
this._show_particles = function() {
for (var i=0; i < this._simulation.particles.length; i++) {
this._simulation.particles[i].show();
};
};
this._show_time = function() {
push();
textSize(32);
fill(255, 255, 255);
textAlign(LEFT, TOP);
text(this._simulation.time.toFixed(1)+'s', this._canvas.width*0.02, this._canvas.height*0.02);
pop();
};
this._show_fps = function() {
push()
textAlign(LEFT,BOTTOM);
text(frameRate().toFixed(0) + 'fps', this._canvas.width*0.02, this._canvas.height*0.98);
pop()
};
this._highlight_first_event = function() {
/* Highlight the particle(s) involved in first event (if any exists) */
var event = this._simulation.first_event();
if (event != null) {
event.part_1.highlight();
if (event.part_2) {
event.part_2.highlight();
};
};
};
}
|
angular.module( 'comparcelTester', [
'templates-app',
'templates-common',
'comparcelTester.home',
'ui.state',
'ui.route'
])
.config( function myAppConfig ( $stateProvider, $urlRouterProvider ) {
// default route is home
$urlRouterProvider.otherwise( '/home' );
})
.run( function run ( titleService ) {
titleService.setSuffix( ' | comparcel.com' );
})
.controller( 'AppCtrl', function AppCtrl ( $scope, $location ) {
// some main app stuff goes here
})
;
|
/**
Copyright (c) 2007 Bill Orcutt (http://lilyapp.org, http://publicbeta.cx)
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.
*/
/**
* Construct a new dialog object
* @class
* @constructor
* @extends LilyObjectBase
*/
function $dialog()
{
var thisPtr=this;
this.outlet1 = new this.outletClass("outlet1",this,"result of dialog if any");
this.inlet1=new this.inletClass("inlet1",this,"\"alert\",\"confirm\",\"prompt\"");
this.inlet1["alert"]=function(msg) {
thisPtr.parent.patchView.oWin.alert(msg);
}
this.inlet1["confirm"]=function(msg) {
thisPtr.outlet1.doOutlet(thisPtr.parent.patchView.oWin.confirm(msg));
}
this.inlet1["prompt"]=function(msg) {
thisPtr.outlet1.doOutlet(thisPtr.parent.patchView.oWin.prompt(msg));
}
return this;
}
var $dialogMetaData = {
textName:"dialog",
htmlName:"dialog",
objectCategory:"System",
objectSummary:"Display an alert, confirm or prompt dialog.",
objectArguments:""
}
|
$('.comment').each(function(){
if(this.id.length > 0){
player_id = $("#"+this.id+' .comment-player a').attr("href").substr(9);
$("#"+this.id + ' .comment-body div').after('<div id="comment-sig' + player_id + '"><a target="__new" href="http://getdotastats.com/sig/' + player_id + '.png"><img style="margin:auto; margin-bottom:20px; display:block;" src="http://getdotastats.com/sig/forum.php?aid=' + player_id + '"></a><div style="margin-top:-15px;text-align: center;"><a href="http://strawpoll.me/1511023">Want these to stay? Vote now!</a> || <a href="http://getdotastats.com/dbe/forum_sigs.php">What is this?</a></div></div>');
}
});
|
const DrawCard = require('../../drawcard.js');
const { Locations, Players, CardTypes, PlayTypes} = require('../../Constants');
const AbilityDsl = require('../../abilitydsl');
class WarmWelcome extends DrawCard {
setupCardAbilities() {
this.action({
title: 'Play a conflict card from discard',
condition: context => context.player.opponent && context.player.showBid < context.player.opponent.showBid,
target: {
location: Locations.ConflictDiscardPile,
controller: Players.Self,
gameAction: AbilityDsl.actions.sequential([
AbilityDsl.actions.playCard(context => ({
target: context.target,
playType: PlayTypes.PlayFromHand
})),
AbilityDsl.actions.moveCard(context => ({
target: context.target.type === CardTypes.Event ? context.target : [],
destination: Locations.ConflictDeck, bottom: true
}))
])
}
});
}
}
WarmWelcome.id = 'warm-welcome';
module.exports = WarmWelcome;
|
'use strict';
module.exports = {
db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/store-app',
assets: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.min.css',
'public/lib/fontawesome/css/font-awesome.min.css',
'public/lib/angular-xeditable/dist/css/xeditable.css',
'public/lib/angular-dialog-service/dialogs.min.css',
'public/lib/animate.css/animate.css',
'public/lib/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.css',
],
js: [
'public/lib/jquery/dist/jquery.min.js',
'public/lib/angular/angular.min.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-cookies/angular-cookies.js',
'public/lib/angular-animate/angular-animate.js',
'public/lib/angular-touch/angular-touch.js',
'public/lib/angular-sanitize/angular-sanitize.js',
'public/lib/angular-ui-router/release/angular-ui-router.min.js',
'public/lib/angular-ui-utils/ui-utils.min.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'public/lib/restangular/dist/restangular.min.js',
'public/lib/lodash/dist/lodash.min.js',
'public/lib/angular-xeditable/dist/js/xeditable.min.js',
'public/lib/angular-translate/angular-translate.min.js',
'public/lib/angular-dialog-service/dialogs.min.js',
'public/lib/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js',
'public/lib/bootstrap-tagsinput/dist/bootstrap-tagsinput-angular.js',
'public/lib/inflection/inflection.min.js',
]
},
css: 'public/dist/application.min.css',
js: 'public/dist/application.min.js'
},
facebook: {
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
google: {
clientID: process.env.GOOGLE_ID || 'APP_ID',
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
|
window.Utils = (function() {
const DIGITS = 6;
function numberToFixed (number) {
return parseFloat(number.toFixed(DIGITS));
}
function arrayNumbersToFixed (array) {
for (var i = 0; i < array.length; i++) {
array[i] = numberToFixed(array[i]);
}
return array;
}
function getTooltips (controllerName) {
var tooltips;
var tooltipName;
switch (controllerName) {
case 'windows-motion-samsung-controls': {
tooltipName = '.windows-motion-samsung-tooltips';
break;
}
case 'windows-motion-controls': {
tooltipName = '.windows-motion-tooltips';
break;
}
case 'oculus-touch-controls': {
tooltipName = '.oculus-tooltips';
break;
}
case 'vive-controls': {
tooltipName = '.vive-tooltips';
break;
}
default: {
break;
}
}
tooltips = Array.prototype.slice.call(document.querySelectorAll(tooltipName));
return tooltips;
}
return {
numberToFixed: numberToFixed,
arrayNumbersToFixed: arrayNumbersToFixed,
getTooltips: getTooltips
}
}());
|
/*jshint node: true, browser: true, nomen: true */
/*global projects_ss*/
'use strict';
var Reflux = require('reflux');
var ProjectsActions = require('../actions/projects-actions');
var DataHelpers = require('../mixins/data-helpers');
var ProjectStore = require('./project-store');
var ProjectsStore = Reflux.createStore({
mixins: [DataHelpers],
listenables: ProjectsActions,
init: function () {
this.listenTo(ProjectStore, this.projectsUpdated);
this.projects = typeof projects_ss === 'undefined' ? [] : projects_ss;
},
projectsUpdated: function (evt) {
if (evt.success) {
switch (evt.type) {
case 'create':
this.projects.push(evt.data);
break;
case 'addField':
case 'removeField':
this.UpdateArrayById(this.projects, evt.data);
break;
}
}
this.trigger(this.projects);
},
getDefaultData: function () {
return this.projects;
}
});
module.exports = ProjectsStore;
|
var fs = require('fs'),
still = require('../'),
testutils = require('./testutils'),
build = still.build.build,
server = still.server;
describe('Templates', function () {
afterEach(testutils.teardown);
describe('Swig', function () {
var out = 'tests/tmp/swigout';
it('renders', function (done) {
build({
_: [__dirname + '/templates/swig'],
e: 'swig',
o: out,
verbose: 0,
encoding: 'utf-8'
}, function () {
fs.readFile(out + '/index.html', 'utf8', function (err, data) {
data.should.eql('\nhi\n\n');
done();
});
});
});
});
});
|
export default {
ratio: function(value){
return Math.max(0, Math.min(1, value));
}
};
|
function Paddle(x, y) {
this.x = x;
this.y = y;
this.width = 25;
this.height = 100;
this.up(false);
this.down(false);
this.ai = false;
this.color = "green";
}
Paddle.ACCEL = 3;
Paddle.MAXSPD = 10;
Paddle.FROTT = .8;
Paddle.prototype = new Polygon();
Paddle.prototype.up = function(b) { this.b_up = b; };
Paddle.prototype.down = function(b) { this.b_down = b; };
Paddle.prototype.doAI = function(pong) {
this.b_down = false;
this.b_up = false;
var bally = pong.h / 2;
var balld = Infinity;
var ballx = -Infinity;
var ballvx = -Infinity
for(var i in pong.entities)
if (pong.entities[i] instanceof Ball) {
var ball = pong.entities[i];
var bvx = (this.x - pong.h / 2) * ball.vx;
var vd = Math.abs(ball.x - this.x) / ball.vx;
vd = (vd < 0 ? vd * -2 : vd);
if ( (ballvx < 0 && bvx > 0) || (bvx * ballvx > 0 && vd < balld) || balld == Infinity ) {
balld = vd;
bally = ball.y;
ballx = ball.x;
ballvx = bvx;
}
}
if (balld == Infinity)
return ;
if (pong.debug) {
pong.ctx.beginPath();
pong.ctx.moveTo(this.x + this.width/2 , this.y + this.height/2);
pong.ctx.lineTo(ballx, bally);
pong.ctx.stroke();
pong.ctx.closePath();
}
if (this.y + this.height*3/4 < bally)
this.b_down = true;
if (this.y + this.height/4 > bally)
this.b_up = true;
}
Paddle.prototype.update = function(pong) {
if (this.ai)
this.doAI(pong);
if (this.b_up && this.vy > -Paddle.MAXSPD) this.vy -= Paddle.ACCEL;
if (this.b_down && this.vy < Paddle.MAXSPD) this.vy += Paddle.ACCEL;
this.vy *= Paddle.FROTT;
Polygon.prototype.update.call(this);
if (this.y < 0) {
this.vy *= -1;
this.y = 0;
} else if (this.y > pong.h - this.height) {
this.vy *= -1;
this.y = pong.h - this.height;
}
};
|
import {parseAndGetExpression} from '../../../utils';
import {expect} from 'chai';
describe('LogicalExpression', () => {
it('should return correct type', () => {
expect(parseAndGetExpression('x&&y').type).to.equal('LogicalExpression');
});
it('should accept parentheses', () => {
var assignment = parseAndGetExpression('(x) && (y)');
expect(assignment.operator).to.equal('&&');
expect(assignment.left.name).to.equal('x');
expect(assignment.right.name).to.equal('y');
});
it('should accept &&', () => {
var assignment = parseAndGetExpression('x && y');
expect(assignment.operator).to.equal('&&');
expect(assignment.left.name).to.equal('x');
expect(assignment.right.name).to.equal('y');
});
it('should accept ||', () => {
var assignment = parseAndGetExpression('x || y');
expect(assignment.operator).to.equal('||');
expect(assignment.left.name).to.equal('x');
expect(assignment.right.name).to.equal('y');
});
});
|
//steal/js d3px/scripts/compress.js
load("steal/rhino/rhino.js");
steal('steal/clean',function(){
steal.clean('d3px/d3px.html',{
indent_size: 1,
indent_char: '\t',
jslint : false,
ignore: /jquery\/jquery.js/,
predefined: {
steal: true,
jQuery: true,
$ : true,
window : true
}
});
});
|
define(['backbone.marionette'], function(Marionette) {
'use strict';
return Marionette.AppRouter.extend({
appRoutes: {
'books/': 'showBookList'
//'books/:book': 'showBook'
}
});
});
|
/***
* Created by steve Samson <stevee.samson@gmail.com> on 2/16/14.
*/
var Busboy = require('busboy'),
path = require('path'),
os = require('os'),
qs = require('querystring')
fs = require('fs');
module.exports = function (options) {
options = options || {};
return function (req, res, next) {
var files = {},
body = {},
contentType = req.headers['content-type'],
isUpload = !!contentType && ((contentType.indexOf('multipart/form-data') !== -1) || (contentType.indexOf('application/x-www-form-urlencoded') !== -1)),
isJson = !!contentType && (contentType.indexOf('application/json') !== -1),
decodeChunks = function (cb) {
let chunk = '';
req.on('data', function (chk) {
chunk += chk;
}).on('end', function () {
if(isJson){
body = qs.decode(chunk);
req.body = utils.extend(req.body || {}, body);
return next();
}
console.log('No content type was specified for this request, passing body down as raw.')
req.body = chunk;
next();
});
};
if (!isUpload) {
if(req.method === 'GET'){
return next();
}
return decodeChunks();
}
var busboy = new Busboy({
headers: req.headers
});
busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
var saveTo = options.uploadDir ? path.join(BASE_DIR, options.uploadDir, path.basename(filename)) : path.join(os.tmpDir(), path.basename(filename));
file.pipe(fs.createWriteStream(saveTo));
files[fieldname] = {
name: filename,
encoding: encoding,
path: saveTo,
ext: path.extname(path.basename(filename)),
mime: mimetype,
renameTo: function (dest, cb) {
var self = this;
fs.rename(this.path, dest, function (e) {
if (e) {
cb && cb(e);
} else {
cb && cb(null);
}
});
}
};
});
busboy.on('field', function (fieldname, val, fieldnameTruncated, valTruncated) {
body[fieldname] = val;
});
busboy.on('finish', function () {
req.body = utils.extend(req.body || {}, body);
req.files = files;
next();
});
req.pipe(busboy);
}
}
|
/*
* JavaScript variable examples.
* A JavaScript variable does NOT have to begin with 'var'. A variable that does begin with 'var' is a local
* variable that can only be used in that scope. A variable that does not begin with the keyword 'var' can be
* interpreted as a globar variable.
*/
var Bulbasaur = 001;
var ivysaur;
ivysaur = 002;
var venusaur3 = '003';
var charmander004 = "004";
var Charmeleon_;
var $Charizard$ = 006;
var Squirtle = 007;
var artortle = 008;
var Blastoise = 009;
Charmeleon_ = "#005"
// I am a global variable
Caterpie = 010
|
const argv = require('minimist')(process.argv.slice(2));
var verbose = argv.verbose ? argv.verbose : false;
if (verbose) {
var log = console.log;
} else {
function log(){};
}
module.exports = {
log: log
};
|
import * as types from "./mutation-types";
|
app.configure('production', function () {
app.enable('view cache');
app.enable('model cache');
app.enable('eval cache');
app.enable('merge javascripts');
app.enable('merge stylesheets');
app.use(require('express').errorHandler());
app.settings.quiet = true;
});
|
'use strict';
//angular.module("TimeoutApp.login")
app.service('loginModal', function ($modal, $rootScope) {
function assignCurrentUser (user) {
// $rootScope.currentUser = user;
// var customer = {name : email, phoneNumber : password};
$rootScope.currentUser = user.name;
return user;
}
return function() {
var instance = $modal.open({
templateUrl: 'resources/tpls/login.html',
controller: 'LoginController',
controllerAs: 'LoginController'
})
return instance.result.then(assignCurrentUser);
};
});
|
module.exports = require('./src/enjection');
|
const SET_SWAP_TOKENS = async function (state, tokens) {
state.swapTokens = tokens;
state.prefetched = true;
};
export default { SET_SWAP_TOKENS };
|
var CHANGE_EVENT = 'change'
export default {
emitChange() {
this.emit(CHANGE_EVENT)
},
addChangeListener(callback) {
this.on(CHANGE_EVENT, callback)
},
onChange(callback) {
this.addChangeListener(callback)
},
removeChangeListener(callback) {
this.removeListener(CHANGE_EVENT, callback)
}
}
|
angular.module('woort-cloud-app').component('wcGameBoard', {
templateUrl: 'wc-game-board.tpl.html',
controller: WcGameBoardController,
bindings: {
initRows: '<',
initCols: '<'
//add variables from markup here, must have form "init-rows" instead of "initRows"
}
});
function WcGameBoardController($scope) {
var vm = this;
vm.tableName = "tableName";
vm.rowArray = [];
vm.colArray = [];
vm.addColumnLeft = addColumnLeft;
vm.addColumnRight = addColumnRight;
vm.addRowAbove = addRowAbove;
vm.addRowBelow = addRowBelow;
this.$onInit = function() {
//Init gameboard array
for (var i = 0; i < vm.initRows; i++) {
var cols = [];
for (var j = 0; j < vm.initCols; j++) {
var newCol = {
row: i,
col: j,
multiplier: 0,
background: '',
isStart: false
};
cols.push(newCol);
}
vm.rowArray.push(cols);
}
//Randomize multipliers
var numMultipliers = Math.floor((Math.random() * vm.initRows * vm.initCols / 3) + 1);
for (var mul = 0; mul < numMultipliers; mul++) {
var mr = Math.floor((Math.random() * vm.rowArray.length));
var mc = Math.floor((Math.random() * vm.rowArray[mr].length));
var mu = Math.floor((Math.random() * 5) + 1);
vm.rowArray[mr][mc].multiplier = mu;
}
//Place starting slot
var center = Math.floor(vm.rowArray.length / 2);
var middle = Math.floor(vm.rowArray[center].length / 2);
vm.rowArray[center][middle].isStart = true;
};
function addColumnLeft() {
//Randomize multipliers
var numMultipliers = Math.floor((Math.random() * (vm.rowArray.length + 1) / 3) + 1);
var multipliers = [];
for (var mul = 0; mul < numMultipliers; mul++) {
var mu = Math.floor((Math.random() * 5) + 1);
multipliers.push(mu);
}
//Add new column
for (var i = 0; i < vm.rowArray.length; i++) {
var arr = vm.rowArray[i];
var newCol = {
row: i,
col: 0,
multiplier: 0,
background: '',
isStart: false
};
//Randomly add multiplier and unstack
var mRow = Math.floor((Math.random() * vm.rowArray.length));
if (mRow == i) {
newCol.multiplier = multipliers.pop();
}
arr.unshift(newCol);
}
}
function addColumnRight() {
//Randomize multipliers
var numMultipliers = Math.floor((Math.random() * (vm.rowArray.length + 1) / 3) + 1);
var multipliers = [];
for (var mul = 0; mul < numMultipliers; mul++) {
var mu = Math.floor((Math.random() * 5) + 1);
multipliers.push(mu);
}
//Add new column
for (var i = 0; i < vm.rowArray.length; i++) {
var arr = vm.rowArray[i];
var newCol = {
row: i,
col: arr.length,
multiplier: 0,
background: '',
isStart: false
};
//Randomly add multiplier and unstack
var mRow = Math.floor((Math.random() * vm.rowArray.length));
if (mRow == i) {
newCol.multiplier = multipliers.pop();
}
arr.push(newCol);
}
}
function addRowAbove() {
//Randomize multipliers
var numMultipliers = Math.floor((Math.random() * (vm.rowArray.length + 1) / 3) + 1);
var multipliers = [];
for (var mul = 0; mul < numMultipliers; mul++) {
var mu = Math.floor((Math.random() * 5) + 1);
multipliers.push(mu);
}
//Add new row
var numCols = vm.rowArray[0].length;
var cols = [];
for (var i = 0; i < numCols; i++) {
var newCol = {
row: 0,
col: i,
multiplier: 0,
background: '',
isStart: false
};
//Randomly add multiplier and unstack
var mRow = Math.floor((Math.random() * vm.rowArray.length));
if (mRow == i) {
newCol.multiplier = multipliers.pop();
}
cols.push(newCol);
}
vm.rowArray.unshift(cols);
}
function addRowBelow() {
//Randomize multipliers
var numMultipliers = Math.floor((Math.random() * (vm.rowArray.length + 1) / 3) + 1);
var multipliers = [];
for (var mul = 0; mul < numMultipliers; mul++) {
var mu = Math.floor((Math.random() * 5) + 1);
multipliers.push(mu);
}
//Add new row
var numCols = vm.rowArray[0].length;
var cols = [];
for (var i = 0; i < numCols; i++) {
var newCol = {
row: vm.rowArray.length,
col: i,
multiplier: 0,
background: '',
isStart: false
};
//Randomly add multiplier and unstack
var mRow = Math.floor((Math.random() * vm.rowArray.length));
if (mRow == i) {
newCol.multiplier = multipliers.pop();
}
cols.push(newCol);
}
vm.rowArray.push(cols);
}
}
|
import { resource } from 'src/app/infra/services/http/resource'
export const title = 'Gráficos'
export const api = '/graphics'
export const path = '/dashboard/forms'
export const service = resource(api)
|
/* @flow */
const privates = new WeakMap();
export default class TogglePanel {
constructor(panel: Atom$Panel) {
privates.set(
this,
atom.commands.add(
"atom-workspace",
"textual-velocity:toggle-panel",
() => {
if (panel.isVisible()) {
panel.hide();
} else {
panel.show();
}
}
)
);
}
dispose() {
const disposable = privates.get(this) || {};
disposable.dispose();
privates.delete(this);
}
}
|
/*jslint plusplus:true*/
/* jshint strict: true, -W097, unused:false, undef:true */
/*global window, document, $, io, navigator, setTimeout */
getSocket(function(socket){
if (socket)
socket.emit('selection');
$('#submit').click(function(){
// connecting to socket turns on the display
var boiltemp = $('#boiltemp').val();
var infusetime = $('#infusetime').val();
window.location.href = '/1-boiling.html#' + [boiltemp, infusetime].join("_");
});
});
|
module.exports = (title, message, url) => `
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" initial-scale="1" />
</head>
<body>
<table role="presentation" aria-hidden="true" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td>
<p>
<img src="https://res.cloudinary.com/spendlogs/image/upload/v1578090007/branding/spendlogs-logo-green_ynjqex.png" alt="Spendlogs" style="margin-top: 24px; margin-bottom: 24px; max-width: 180px;"/>
</p>
</td>
</tr>
<tr>
<td>
<h3>${title}</h3>
</td>
</tr>
<tr>
<td>
<p>${message}</p>
</td>
</tr>
<tr>
<td>
<p><a href="${url}">${url}</a></p>
</td>
</tr>
<tr>
<td>
<p>Sent with ❤️ from <a href="https://spendlogs.ml" style="text-decoration: none; color: #333">Spendlogs</a</p>
</td>
</tr>
</table>
</body>
</html>
`;
|
/**
* @file mip-stats-qiyu 七鱼在线客服组件
* @author marhey
*/
define(function (require) {
var $ = require('zepto');
var customElement = require('customElement').create();
customElement.prototype.createdCallback = function () {
var element = this.element;
var token = element.getAttribute('token');
var qiyu = document.createElement('script');
var defer = !!element.hasAttribute('defer');
var async = !!element.hasAttribute('async');
if (defer) {
qiyu.defer = document.createAttribute('defer');
}
if (async) {
qiyu.async = document.createAttribute('async');
}
qiyu.src = 'https://qiyukf.com/script/' + token + '.js';
qiyu.defer = document.createAttribute('defer');
qiyu.async = document.createAttribute('async');
$(element).append(qiyu);
};
return customElement;
});
|
/**
* for esdoc
* @ignore
*/
export function objectValues(obj) {
let keys = Object.keys(obj);
return keys.map(key => obj[key]);
}
/**
* for esdoc
* @ignore
*/
export function isPlainObject(item) {
return Object.prototype
.toString.call(item) === '[object Object]';
}
/**
* for esdoc
* @ignore
*/
export function isArray(x) {
return Array.isArray(x);
}
/**
* for esdoc
* @ignore
*/
export function isFunction(x) {
return typeof x === 'function';
}
/**
* for esdoc
* @ignore
*/
export function isPromise(x) {
return x.toString() === '[object Promise]';
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.