text
stringlengths 2
6.14k
|
|---|
// Generated by CoffeeScript 1.8.0
module.exports = (function(_this) {
return function(stream, stdout, stderr) {
var count, type;
type = null;
count = 0;
return stream.on('readable', function() {
var header, payload;
while (true) {
while (count > 0) {
payload = stream.read(1);
if (payload == null) {
return;
}
count--;
if (type === 2) {
stderr.write(payload);
} else {
stdout.write(payload);
}
}
header = stream.read(8);
if (header == null) {
return;
}
type = header.readUInt8(0);
count = header.readUInt32BE(4);
}
});
};
})(this);
|
/**
* Created by sam on 17/1/2.
*/
"use strict";
const mongoose = require('mongoose');
const SystemConfig = require('./config');
const {
exceptionLogger: ExceptionLogger,
dbMongoLogger : MongoLogger
} = require('./logger');
const ProcessExitError = require('./error').ProcessExitError;
const mongoConfig = SystemConfig.getSection('datasources/mongod');
exports.connect = function connect() {
var port = mongoConfig.port;
var connectArgs = [mongoConfig.host, mongoConfig.name || 'planer'];
// port
if (port) connectArgs.push(port);
let user = mongoConfig.user;
let pass = mongoConfig.pwd || mongoConfig.password;
if (pass != null) {
pass = pass.toString();
}
if (user == null || pass == null) {
MongoLogger.warn({
user: user,
pass: pass
}, 'try to connect mongo db without authentication, it is not safe enough and may cause commands execute failed! Make sure that this is expected behavior!')
}
// options
connectArgs.push({
auth: true,
user: user,
pass: pass
});
// callback
connectArgs.push(function(err) {
if (err) {
let processExitError = new ProcessExitError({
cause: err
}, 'process exit because of mongo connection failed');
ExceptionLogger.error(processExitError);
process.exit(1);
}
});
// 配置有效性的校验交给mongoose 来完成
return mongoose.connect.apply(mongoose, connectArgs);
};
|
~function () {
/**
* Create a new player.
*/
function Player(params) {
params || (params = {});
for (var key in params)
this[key] = params[key];
_createAnimation(this);
_createMesh(this);
_setThirdPersonCamera(this);
this.score = 0;
this.target = this.mesh.position.clone();
}
Player.prototype.run = function () {
this.anim.play("run");
}
/**
* Update the player at each frame.
* @param delta The delta time between this frame and
* the previous one.
*/
Player.prototype.update = function (delta) {
this.anim.update(delta * 1000);
if (THREE.Input.isKeyDown('leftArrow'))
_moveLeft(this);
if (THREE.Input.isKeyDown('rightArrow'))
_moveRight(this);
this.mesh.position.lerp(this.target, delta * 10);
if (this.isInvinsible()) {
this.invinsibleDelay -= delta;
this.mesh.visible = ~~(this.invinsibleDelay * 10) % 2;
} else
this.mesh.visible = true;
}
/**
* Check collision between the player and another entity.
*/
Player.prototype.hit = function (entity) {
var d = entity.mesh.position.z + 35 - this.mesh.position.z;
return d >= 0 && d <= 50 &&
entity.mesh.position.x === this.target.x;
}
/**
* Return true if the player is in invisible mode.
*/
Player.prototype.isInvinsible = function () {
return this.invinsibleDelay > 0;
}
/**
* Increase player score.
*/
Player.prototype.increaseScore = function () {
this.score++;
}
/**
* Decrease player lifes.
*/
Player.prototype.decreaseLifes = function () {
if (this.isInvinsible())
return ;
this.lifes--;
this.invinsibleDelay = 2;
}
/**
* Translate the player to the left.
*/
var _moveLeft = function (self) {
if (self.target.x === -50)
return ;
self.target.x -= 50;
}
/**
* Translate the player to the right.
*/
var _moveRight = function (self) {
if (self.target.x === 50)
return ;
self.target.x += 50;
}
/**
* Create the player sprite animation.
*/
var _createAnimation = function (self) {
var texture = new THREE.ImageUtils.loadTexture("resources/mario.png");
self.anim = new THREE.SpriteAnimation({
texture: texture,
tilesHorizontal: 6,
tilesVertical: 4,
numberOfTiles: 24,
delay: 42
});
self.anim.add("idle", {from: 22, to: 22});
self.anim.add("run", {from: 18, to: 23});
self.anim.play("idle");
}
/**
* Create the player mesh.
*/
var _createMesh = function (self) {
var material = new THREE.MeshBasicMaterial({
map: self.anim.texture
});
material.transparent = true;
self.mesh = new THREE.Mesh(
new THREE.PlaneGeometry(50, 50),
material
);
self.mesh.position.y += 25;
self.mesh.position.z += 25;
self.scene.add(self.mesh);
}
/**
* Attach a third person camera to the player.
*/
var _setThirdPersonCamera = function (self) {
self.controls = new THREE.ThirdPersonControls({
camera: self.camera,
target: self.mesh,
lerp: 0.05,
offset: new THREE.Vector3(0, 90, 200),
moveSpeed: 0, // on block les mouvements
contraints: new THREE.Vector2(1, 1) // et les rotations
});
self.camera.position.set(5000, 4000, 5000);
}
window.Player = Player;
}();
|
"use strict";
/* exported deleteGroupOnClick */
function deleteGroupOnClick(event)
{
var name = "";
for(var i = 0; i < GROUPS.length; i++)
{
if(GROUPS[i].id === getAttribute(event, "id"))
{
name = GROUPS[i].name
break;
}
}
var aq = new ActionQueue([new Action(CONFIG.apiuri + "/group/" + encodeURIComponent(getAttribute(event, "id")), "DELETE")]);
dialog("Opravdu si přejete smazat skupinu \"" + name + "\"?", "Ano", aq.closeDispatch, "Ne", function(){history.back();});
history.pushState({"sidePanel": "open"}, "title", "/admin/groups");
refreshLogin();
}
|
jQuery(document).ready(
function (){
$('#ingresar').click(
function () {
var $usuario = $('input[name=usuario]');
var $pass = $('input[name=pass]');
//alert($usuario.val() + "-" + $pass.val());
//----//
if ($usuario.val()=='') {
$('#usuario').attr('required', true);
document.getElementById("usuario").style.border="2px solid red";
document.getElementById("usuario").focus();
return false;
} else {
$('#usuario').attr('required', false);
document.getElementById("usuario").style.border="2px solid green";
}
//----//
if ($pass.val()=='') {
$("#pass").attr('undefined', true);
document.getElementById("pass").style.border="2px solid red";
document.getElementById("pass").focus();
return false;
} else {
$("#pass").attr('required', false);
document.getElementById("pass").style.border="2px solid green";
}
//----//
var data = "usuario=" + $usuario.val() + "&pass=" + $pass.val();
$.ajax(
{
type: "POST",
url: "validar.php",
data: data,
dataType: "html",
cache: false,
success: function (data) {
$('#tip').fadeIn(1000);
$('#tip').fadeOut(4000);
$('#tip').html(data);
}
}
);
return false;
}
);
}
);
|
(function () {
'use strict';
var url = $('.cart-item-selector').data('variant-action'),
stockMessage = $("#stockMessage"),
totalPrice = $('#totalPrice'),
selectedSKUID = $('#selectedVariantID');
$('.js-variant-selector').change(function () {
var id = $(this).val();
updateVariantSelection(id);
});
function updateVariantSelection(variantId) {
$.post(url, { variantID: variantId }, function (data) {
stockMessage.text(data.stockMessage);
totalPrice.text(data.totalPrice);
selectedSKUID.val(variantId);
});
}
}());
|
var inherits = require('inherits')
var Stream = require('stream')
function Leveler(fn) {
Stream.call(this)
this.readable = this.writable = true
this.points = 0
this.reached = Object.create(null)
this.level = 0
this.fn = fn || function(x) {
return Math.floor(Math.floor(25 + Math.sqrt(625 + 100 * x)) / 50)
}
this.on('levelup', this.levelup.bind(this))
}
inherits(Leveler, Stream)
module.exports = function(opts) {
return new Leveler(opts)
};
module.exports.Leveler = Leveler
Leveler.prototype.write = function(points) {
this.points += parseFloat(points)
var level = this.fn(this.points)
if (level !== false) this.levelup(level)
}
Leveler.prototype.end = function(points) {
this.write(points || 0)
}
Leveler.prototype.levelup = function(level) {
if (this.reached[level]) return false
this.reached[level] = this.points
this.level = level
this.emit('data', level)
}
|
const router = require('express').Router()
const { users } = require('./users')
const { todos } = require('./todos')
router.use('/', users)
router.use('/', todos)
module.exports = { routes : router }
|
// All symbols in the Supplemental Arrows-B block as per Unicode v5.0.0:
[
'\u2900',
'\u2901',
'\u2902',
'\u2903',
'\u2904',
'\u2905',
'\u2906',
'\u2907',
'\u2908',
'\u2909',
'\u290A',
'\u290B',
'\u290C',
'\u290D',
'\u290E',
'\u290F',
'\u2910',
'\u2911',
'\u2912',
'\u2913',
'\u2914',
'\u2915',
'\u2916',
'\u2917',
'\u2918',
'\u2919',
'\u291A',
'\u291B',
'\u291C',
'\u291D',
'\u291E',
'\u291F',
'\u2920',
'\u2921',
'\u2922',
'\u2923',
'\u2924',
'\u2925',
'\u2926',
'\u2927',
'\u2928',
'\u2929',
'\u292A',
'\u292B',
'\u292C',
'\u292D',
'\u292E',
'\u292F',
'\u2930',
'\u2931',
'\u2932',
'\u2933',
'\u2934',
'\u2935',
'\u2936',
'\u2937',
'\u2938',
'\u2939',
'\u293A',
'\u293B',
'\u293C',
'\u293D',
'\u293E',
'\u293F',
'\u2940',
'\u2941',
'\u2942',
'\u2943',
'\u2944',
'\u2945',
'\u2946',
'\u2947',
'\u2948',
'\u2949',
'\u294A',
'\u294B',
'\u294C',
'\u294D',
'\u294E',
'\u294F',
'\u2950',
'\u2951',
'\u2952',
'\u2953',
'\u2954',
'\u2955',
'\u2956',
'\u2957',
'\u2958',
'\u2959',
'\u295A',
'\u295B',
'\u295C',
'\u295D',
'\u295E',
'\u295F',
'\u2960',
'\u2961',
'\u2962',
'\u2963',
'\u2964',
'\u2965',
'\u2966',
'\u2967',
'\u2968',
'\u2969',
'\u296A',
'\u296B',
'\u296C',
'\u296D',
'\u296E',
'\u296F',
'\u2970',
'\u2971',
'\u2972',
'\u2973',
'\u2974',
'\u2975',
'\u2976',
'\u2977',
'\u2978',
'\u2979',
'\u297A',
'\u297B',
'\u297C',
'\u297D',
'\u297E',
'\u297F'
];
|
import React, {Component, PropTypes} from 'react';
import moment from 'moment';
import theme from '../../Item/components/FieldsView.scss';
const tripHelps = {
auto: 'Автомобиль',
plane: 'Самолет',
train: 'Поезд'
};
export default class TripFields extends Component {
static propTypes = {
fields: PropTypes.object.isRequired
};
render() {
const {fields} = this.props;
const startDate = moment(fields.startDate);
const endDate = moment(fields.endDate);
return (
<div className={theme.fields}>
<h5>Основные сведения</h5>
<table className={theme.table}>
<tbody>
<tr>
<td className={theme.key}>Тип поездки:</td>
<td className={theme.value}>
<pre>{fields.tripType === 'trip' ? 'Командировка' : 'Служебная поездка'}</pre>
</td>
</tr>
<tr>
<td className={theme.key}>Период:</td>
<td className={theme.value}>
<pre>{startDate.format('DD.MM.YYYY')} - {endDate.format('DD.MM.YYYY')}</pre>
</td>
</tr>
<tr>
<td className={theme.key}>Сотрудники:</td>
<td className={theme.value}>
<pre>
{Object.keys(fields.forUsers).map((key) => {
return <span key={key}>{fields.forUsers[key].title}</span>;
})}
</pre>
</td>
</tr>
<tr>
<td className={theme.key}>Цель поездки:</td>
<td className={theme.value}>
<pre>{fields.target}</pre>
</td>
</tr>
</tbody>
</table>
<h5>Местоназначение</h5>
<table className={theme.table}>
<tbody>
<tr>
<td className={theme.key}>Страна, город:</td>
<td className={theme.value}><pre>{fields.country} {fields.city}</pre></td>
</tr>
<tr>
<td className={theme.key}>Организация:</td>
<td className={theme.value}><pre>{fields.company}</pre></td>
</tr>
<tr>
<td className={theme.key}>Проезд туда:</td>
<td className={theme.value}><pre>{tripHelps[fields.tripTo]}</pre></td>
</tr>
<tr>
<td className={theme.key}>Проезд обратно:</td>
<td className={theme.value}><pre>{tripHelps[fields.tripBack]}</pre></td>
</tr>
<tr>
<td className={theme.key}>Другие расходы:</td>
<td className={theme.value}><pre>{fields.otherExpenses}</pre></td>
</tr>
</tbody>
</table>
</div>
);
}
}
|
import React, { Component } from "react";
class PageHeader extends Component {
render() {
return (
<div>
Page Header
</div>
);
}
}
export default PageHeader;
|
// Code borrowed from:
// https://github.com/DockYard/ember-one-way-controls/blob/v2.0.0/addon/-private/dynamic-attribute-bindings.js
import Mixin from '@ember/object/mixin';
export default Mixin.create({
attributeBindings: [],
NON_ATTRIBUTE_BOUND_PROPS: ['class', 'classNames'],
concatenatedProperties: ['NON_ATTRIBUTE_BOUND_PROPS'],
_isKeyBoundToAttribute(key) {
return (
this.NON_ATTRIBUTE_BOUND_PROPS.indexOf(key) === -1
&& this.attributeBindings .indexOf(key) === -1
);
},
init() {
this._super(...arguments);
const newAttributeBindings =
Object
.keys(this.attrs)
.filter(key => this._isKeyBoundToAttribute(key));
const attributeBindings = this.attributeBindings.concat(newAttributeBindings);
this.setProperties({attributeBindings});
}
});
|
angular
.module('sectorWeb.ctrl.reports', [])
.controller('reportsCtrl', [
'$scope',
'$location',
'reportsService',
'$routeParams',
function ($scope, $location, reportsService, $routeParams) {
$scope.list = [];
$scope.searchText = $routeParams.param ? $routeParams.param: "";
$scope.refresh = function () {
$scope.list = [];
reportsService.list()
.then(function successCallback(response) {
$scope.list = response.data;
});
};
$scope.search = function () {
if ($scope.searchText.length >= 3) {
$scope.go("/reports/" + $scope.searchText);
}
}
$scope.refresh();
}]);
|
var pins={};
module.exports={
setup:function(pin, direction, callback){
pins[pin]={value:0, direction:direction};
callback(null);
},
read:function(pin, callback){
callback(null, pins[pin].value);
},
write:function(pin, value, callback){
pins[pin].value=value;
callback(null);
}
}
|
'use strict';
/**
* @ngdoc function
* @name anyandgoApp.controller:MemosNewCtrl
* @description
* # MemosNewCtrl
* Controller of the anyandgoApp
*/
angular.module('anyandgoApp')
.controller('MemosNewCtrl', function ($scope, $routeParams, PeopleService, $interval) {
if(typeof chatInterval !== 'undefined') {
//Cancel it
$interval.cancel(chatInterval);
}
var CKupdate = function(){
var instance;
for(instance in CKEDITOR.instances) {
CKEDITOR.instances[instance].updateElement();
}
CKEDITOR.instances[instance].setData('');
}
$scope.usersto = {};
var configS2 = {
placeholder: "Destinatarios...",
ajax: {
url : '/services/search/people/tags',
dataType: 'json',
quietMillis: 250,
data: function (term, page) {
return {
keyword: term
};
},
results: function (data, page) {
console.log(data);
return { results: data };
},
cache: true
},
tags:[],
//minimumInputLength: 3,
id: function(data){ return data._id; },
dropdownCssClass: "bigdrop",
initSelection: function(element, callback) {
//console.log(element, callback);
callback(data);
},
formatSelection: function(data) {
return data.name;
},
formatResult: function(data) {
var markup = '<div class="row-fluid">';
markup += data.name + " - " + data.email;
markup += '</div>';
return markup;
}
};
var usuario = $('#usuarios');
usuario.select2(configS2);
usuario.on('select2-selecting', function(e) {
//console.log(e);
});
// https://github.com/lemonde/angular-ckeditor
//$('#message').wysihtml5();
// Editor options.
$scope.options = {
language: 'en',
allowedContent: true,
entities: false
};
// Called when the editor is completely ready.
$scope.onReady = function () {
// ...
};
$scope.sendMemo = function (e) {
e.preventDefault();
e.stopPropagation();
// You cannot use double binding with hidden field.
// http://stackoverflow.com/questions/18446359/angularjs-does-not-send-hidden-field-value
PeopleService.sendMemo($('#usuarios').val(), $scope.memocontent).then(function(r){
// console.log(r.data);
// Clear the form
CKupdate();
$('#usuarios').select2('data',null);
});
};
});
|
var Type = require("@kaoscript/runtime").Type;
module.exports = function() {
var __ks_Foobar = {};
__ks_Foobar.__ks_func_foobar_0 = function() {
};
__ks_Foobar._im_foobar = function(that) {
var args = Array.prototype.slice.call(arguments, 1, arguments.length);
if(args.length === 0) {
return __ks_Foobar.__ks_func_foobar_0.apply(that);
}
throw new SyntaxError("Wrong number of arguments");
};
function foo(x) {
if(arguments.length < 1) {
throw new SyntaxError("Wrong number of arguments (" + arguments.length + " for 1)");
}
if(x === void 0 || x === null) {
throw new TypeError("'x' is not nullable");
}
else if(!Type.isBoolean(x)) {
throw new TypeError("'x' is not of type 'Boolean'");
}
let y = null;
y = bar();
if(y !== null) {
__ks_Foobar._im_foobar(y);
}
}
function bar() {
}
};
|
const compose = require('koa-compose')
const helmet = require('koa-helmet')
const cors = require('kcors')
const compress = require('koa-compress')
const bodyParser = require('koa-bodyparser')
const handleErrors = require('./errors')
const middlewares = () => compose([
handleErrors(), // handle thrown or uncaught exceptions anywhere down the line
helmet(), // reset HTTP headers (e.g. remove x-powered-by)
cors(), // allow cross-origin
compress({}), // HTTP compression
bodyParser() // parse request body into ctx.request.body
])
module.exports = middlewares
|
'use strict';
const commonTags = require('common-tags');
const prepareFilenameToContentMap = require('../lib/prepare_filename_to_content_map');
describe('prepareFilenameToContentMap()', () => {
it('should return a map with file name to file contents', () => {
const filepaths = ['./path1/slide1.md', './path2/slide2.md'];
const fileToContents = {
'./path1/slide1.md': 'Slide 1 contents',
'./path2/slide2.md': 'Slide 2 contents'
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read);
expect(result.get('slide1')).not.toBeUndefined();
expect(result.get('slide2')).not.toBeUndefined();
});
it('should keep the given path in case slideResolutionFullPath is given as option', () => {
const filepaths = ['./path1/slide1.md', './path2/slide2.md'];
const fileToContents = {
'./path1/slide1.md': 'Slide 1 contents',
'./path2/slide2.md': 'Slide 2 contents'
};
const options = {
slideResolutionFullPath: true
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read, options);
expect(result.get('./path1/slide1')).not.toBeUndefined();
expect(result.get('./path2/slide2')).not.toBeUndefined();
});
it('should return an object with a data and an attribute property as contents', () => {
const filepaths = ['./path1/slide1.md', './path2/slide2.md'];
const fileToContents = {
'./path1/slide1.md': 'Slide 1 contents',
'./path2/slide2.md': 'Slide 2 contents'
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read);
// We have no sections, front matter or options.layoutAttributes -> data only has a section with content
expect(result.get('slide1').data).toEqual({filename: 'slide1', sections: {content: 'Slide 1 contents'}});
// We have no front matter -> empty attributes
expect(result.get('slide1').attributes).toEqual({});
expect(result.get('slide2').data).toEqual({filename: 'slide2', sections: {content: 'Slide 2 contents'}});
expect(result.get('slide2').attributes).toEqual({});
});
it('should contain front matter attributes in the data and attributes properties', () => {
const filepaths = ['./path1/slide1.md', './path2/slide2.md'];
const slide1Contents = commonTags.stripIndents`---
title: Slide 1
---
Contents of slide 1`;
const slide2Contents = commonTags.stripIndents`---
title: Slide 2
---
Contents of slide 2`;
const fileToContents = {
'./path1/slide1.md': slide1Contents,
'./path2/slide2.md': slide2Contents
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read);
expect(result.get('slide1').data.title).toEqual('Slide 1');
expect(result.get('slide1').attributes).toEqual({title: 'Slide 1'});
expect(result.get('slide2').data.title).toEqual('Slide 2');
expect(result.get('slide2').attributes).toEqual({title: 'Slide 2'});
});
it('should override attributes in options.layoutAttributes which have the same name as attributes in the front matter (only in the data property)', () => {
const filepaths = ['./path1/slide1.md', './path2/slide2.md'];
const slide1Contents = commonTags.stripIndents`---
slideTitle: Slide 1
---
Contents of slide 1`;
const slide2Contents = commonTags.stripIndents`---
title: Slide 2
---
Contents of slide 2`;
const fileToContents = {
'./path1/slide1.md': slide1Contents,
'./path2/slide2.md': slide2Contents
};
const options = {
layoutAttributes: {
title: 'Title for all slides'
}
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read, options);
expect(result.get('slide1').data.title).toEqual('Title for all slides');
expect(result.get('slide1').data.slideTitle).toEqual('Slide 1');
expect(result.get('slide1').attributes).toEqual({slideTitle: 'Slide 1'});
expect(result.get('slide2').data.title).toEqual('Slide 2');
expect(result.get('slide2').attributes).toEqual({title: 'Slide 2'});
});
it('should have a sections property in the data with all slide sections', () => {
const filepaths = ['./path1/slide1.md'];
const slide1Contents = commonTags.stripIndents`---
title: Slide 1
---
---section1---
Contents of slide 1 section 1
---section2---
Contents of slide 1 section 2
`;
const fileToContents = {
'./path1/slide1.md': slide1Contents
};
function read(path) {
return fileToContents[path];
}
const result = prepareFilenameToContentMap(filepaths, read);
expect(result.get('slide1').data.sections.section1).toBe('\nContents of slide 1 section 1\n\n');
expect(result.get('slide1').data.sections.section2).toBe('\nContents of slide 1 section 2');
});
});
|
import CharacterNav from './CharacterNav'
export default CharacterNav
|
module.exports = {
invokeCallback: function (callback, error, result) {
return (this.isFunction(callback)) ? callback(error, result) : null;
},
isFunction: function (f) {
return f && typeof f === 'function';
}
};
|
/*global chart $*/
var requestsAll;
var colorPattern = ['#003d66', '#4d004d', '#00ccff'];
$(document).ready(function() {
var max;
var dates = ['x'];
var theDate = new Date();
for (var i = 0; i < 7; i++) {
theDate = new Date(new Date().setDate(new Date().getDate()-i));
dates.push( theDate.getFullYear()+'-'+(theDate.getMonth()+1)+'-'+theDate.getDate());
}
requestsAll = c3.generate({
bindto: '#requests-all',
size: {
height: 250
},
data: {
x: 'x',
columns: [
dates,
['total', 0, 0, 0, 0, 0, 0, 0, 0],
['wishlist', 0, 0, 0, 0, 0, 0, 0, 0],
['requests', 0, 0, 0, 0, 0, 0, 0, 0]
],
type: 'bar',
names: {
total: 'Total',
requests: 'Requests',
wishlist: 'Wishlists'
}
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%b %e'
}
},
y: {
show: true
}
},
color: {
pattern: colorPattern
},
legend: {
show: true
}
});
});
var updateCharts = function(data) {
requestsAll.load({
json: data,
keys: {
value: ['x', 'total', 'wishlist', 'requests']
}
});
};
var loadChart = function(){
var current_url_data = window.location.pathname.split('/');
var id = current_url_data[2];
var startDate = $('#start-date').val();
var endDate = $('#end-date').val();
var url = '/teachers/' + id + '/retrieve_charts_data';
$.ajax({
type: 'get',
url: url,
data: {},
success: function(data) {
placeCorrectCharts(data);
}
});
};
var placeCorrectCharts = function(data) {
updateCharts(data.result);
max = data.max;
}
|
/*!
* js-file-browser
* Copyright(c) 2011 Biotechnology Computing Facility, University of Arizona. See included LICENSE.txt file.
*
* With components from: Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
/* This file is automaticly generated by create_language_js.py */
// some data used in the examples
Ext.namespace('Ext.exampledata');
// TODO: complete and sort the list
Ext.exampledata.languages = [
['af', 'Afrikaans', 'ISO-8859-2'],
['bg', 'Bulgarian', 'utf-8'],
['ca', 'Catalonian', 'ascii'],
['hr', 'Croatian', 'utf-8'],
['cs', 'Czech', 'utf-8'],
['da', 'Danish', 'utf-8'],
['nl', 'Dutch', 'ascii'],
['en', 'English', 'ascii'],
['en_UK', 'English (UK)', 'ascii'],
['fa', 'Farsi (Persian)', 'utf-8'],
['fr_CA', 'France (Canadian)', 'UTF-8'],
['fr', 'France (France)', 'UTF-8'],
['de', 'German', 'utf-8'],
['el_GR', 'Greek', 'utf-8'],
['gr', 'Greek (Old Version)', 'utf-8'],
['he', 'Hebrew', 'windows-1255'],
['hu', 'Hungarian', 'utf-8'],
['id', 'Indonesian', 'ascii'],
['it', 'Italian', 'ascii'],
['ja', 'Japanese', 'utf-8'],
['ko', 'Korean', 'utf-8'],
['lv', 'Latvian', 'utf-8'],
['lt', 'Lithuanian', 'utf-8'],
['mk', 'Macedonia', 'utf-8'],
['no', 'Norwegian', 'utf-8'],
['pl', 'Polish', 'utf-8'],
['pt_BR', 'Portuguese/Brazil', 'ascii'],
['ro', 'Romanian', 'utf-8'],
['ru', 'Russian', 'UTF-8'],
['sr_RS', 'Serbian Cyrillic', 'UTF-8'],
['sr', 'Serbian Latin', 'utf-8'],
['zh_CN', 'Simplified Chinese', 'utf-8'],
['sk', 'Slovak', 'utf-8'],
['sl', 'Slovenian', 'utf-8'],
['es', 'Spanish/Latin American', 'utf-8'],
['sv_SE', 'Swedish', 'utf-8'],
['th', 'Thailand', 'utf-8'],
['zh_TW', 'Traditional Chinese', 'UTF-8'],
['tr', 'Turkish', 'utf-8'],
['ukr', 'Ukrainian', 'UTF-8'],
['vn', 'Vietnamese', 'UTF-8']
];
|
var group__freemaster__demo =
[
[ "FreeMASTER Demo Introduction", "group__freemaster__demo__introduction.html", "group__freemaster__demo__introduction" ],
[ "FreeMASTER Demo User's Guide", "group__freemaster__demo__user__guide.html", "group__freemaster__demo__user__guide" ]
];
|
var wru = require('wru');
var collection = [];
var functions = require('./..');
var setBit = functions.setBit;
var resetBit = functions.resetBit;
var isSetBit = functions.isSetBit;
var toggleBit = functions.toggleBit;
var result;
collection[collection.length] = function() {
var bitMask = 5; // 1 + 0 + 4
wru.assert("setBit test 1", setBit(bitMask, 2) === 7);
wru.assert("setBit test 2", setBit(bitMask, 4) === 5);
};
collection[collection.length] = function() {
var bitMask = 5; // 1 + 0 + 4
wru.assert("resetBit test 1", resetBit(bitMask, 2) === 5);
wru.assert("resetBit test 2", resetBit(bitMask, 4) === 1);
};
collection[collection.length] = function() {
var bitMask = 5; // 1 + 0 + 4
wru.assert("isSetBit test 1", isSetBit(bitMask, 2) === false);
wru.assert("isSetBit test 2", isSetBit(bitMask, 4) === true);
};
collection[collection.length] = function() {
var bitMask = 5; // 1 + 0 + 4
wru.assert("toggleBit test 1", toggleBit(bitMask, 2) == 7);
wru.assert("toggleBit test 2", toggleBit(bitMask, 4) == 1);
};
wru.test(collection);
|
const squads = (state = [], action) => {
return state;
}
export default squads;
|
PageModule.controller('PageFormController', function PageFormController($scope, $http, $q) {
/**
*
* @type {String}
*/
var rootUrl = '';
/**
*
* @returns {void}
*/
$scope.generateSlug = function() {
var pageHeader = $('#Page_header').val();
$http({
method: 'GET',
url: rootUrl + '/generateSlug?header=' + pageHeader,
}).success(function(data) {
$('#Page_route').val(data);
});
};
/**
*
* @returns {void}
*/
$scope.generateKeywords = function() {
console.log('asdasdasd');
var pageContent = $('#Page_content').val();
$http({
method: 'POST',
url: rootUrl + '/generateKeywords',
data: $.param({content: pageContent}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).success(function(data) {
$('#Page_meta_keywords').val(data);
});
};
/**
*
* @returns {void}
*/
$scope.generateDescription = function() {
console.log('asdasdasd');
var pageContent = $('#Page_description').val();
$('#Page_meta_description').val(pageContent);
};
/**
*
* @returns {void}
*/
$scope.generateTitle = function() {
var pageContent = $('#Page_header').val();
$('#Page_meta_title').val(pageContent);
};
/**
*
* @param {String} url
* @returns {void}
*/
$scope.init = function(url) {
rootUrl = url;
};
});
|
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import {Router, Route, browserHistory} from 'react-router';
import injectTapEventPlugin from 'react-tap-event-plugin';
import {Main} from './app/main';
import './index.less';
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
ReactDOM.render(
<Router history={browserHistory}>
<Route path="/" component={Main}/>
</Router>,
document.getElementById('root')
);
|
/*
* Kendo UI v2014.2.1008 (http://www.telerik.com/kendo-ui)
* Copyright 2014 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
(function(f, define){
define([], f);
})(function(){
(function( window, undefined ) {
var kendo = window.kendo || (window.kendo = { cultures: {} });
kendo.cultures["ca-ES"] = {
name: "ca-ES",
numberFormat: {
pattern: ["-n"],
decimals: 2,
",": ".",
".": ",",
groupSize: [3],
percent: {
pattern: ["-n %","n %"],
decimals: 2,
",": ".",
".": ",",
groupSize: [3],
symbol: "%"
},
currency: {
pattern: ["-n $","n $"],
decimals: 2,
",": ".",
".": ",",
groupSize: [3],
symbol: "€"
}
},
calendars: {
standard: {
days: {
names: ["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"],
namesAbbr: ["dg.","dl.","dt.","dc.","dj.","dv.","ds."],
namesShort: ["dg","dl","dt","dc","dj","dv","ds"]
},
months: {
names: ["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre",""],
namesAbbr: ["gen","feb","març","abr","maig","juny","jul","ag","set","oct","nov","des",""]
},
AM: [""],
PM: [""],
patterns: {
d: "dd/MM/yyyy",
D: "dddd, d' / 'MMMM' / 'yyyy",
F: "dddd, d' / 'MMMM' / 'yyyy HH:mm:ss",
g: "dd/MM/yyyy HH:mm",
G: "dd/MM/yyyy HH:mm:ss",
m: "dd MMMM",
M: "dd MMMM",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "HH:mm",
T: "HH:mm:ss",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "MMMM' / 'yyyy",
Y: "MMMM' / 'yyyy"
},
"/": "/",
":": ":",
firstDay: 1
}
}
}
})(this);
return window.kendo;
}, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
|
var expect = require("chai").expect
, comment = require("../app/service/comment");
/*
* Mocks
*/
var socket = {
request: {
user: {
logged_in: true,
id: 1
}
}
};
describe("app/service/comment", function () {
describe('#post()', function () {
it('if user is logged out then socket should emit an error', function (done) {
socket.request.user.logged_in = false;
socket.emit = function (key, data) {
expect(key).to.equal('comment/post/error');
done();
};
comment.post(socket, {
thread_id: 1,
replyTo: 0
});
});
});
describe('#like()', function () {
it('if user is logged out then socket should emit an error', function (done) {
socket.request.user.logged_in = false;
socket.emit = function (key, data) {
expect(key).to.equal('comment/like/error');
done();
};
comment.like(socket, {comment_id: 1});
});
it('if comment doesn\'t exist then socket should emit an error', function (done) {
socket.request.user.logged_in = true;
socket.emit = function (key, data) {
expect(key).to.equal('comment/like/error');
done();
};
comment.like(socket, {comment_id: 100000000});
});
});
});
|
/*global describe:false,expect:false,rIt:false*/
describe("utils", function() {
"use strict";
describe("format", function() {
rIt("should format single param", ["utils"], function(utils) {
expect(utils.format("The Winner is %", "John Doe"))
.toEqual("The Winner is John Doe");
});
rIt("should format multiple params", ["utils"], function(utils) {
expect(utils.format("% should %", "You", "hack!"))
.toEqual("You should hack!");
});
rIt("allows escaping of params", ["utils"], function(utils) {
expect(utils.format("% get %\\% on the %!", "You", "5", "price"))
.toEqual("You get 5% on the price!");
});
});
describe("assert", function() {
rIt("should not throw errors when successful",
["config", "utils"],
function(config, utils) {
config.enableAssertions = true;
utils.assert(true, "Some message");
});
rIt("should throw errors", ["config", "utils"], function(config, utils) {
config.enableAssertions = true;
try {
utils.assert(false, "The error is: %", "Unknown");
throw new Error("This should fail!");
} catch (e) {
expect(e.message).toEqual("Assertion error: The error is: Unknown");
}
});
rIt("should not throw errors when deactivated",
["config", "utils"],
function(config, utils) {
config.enableAssertions = false;
try {
utils.assert(false, "Some message");
} finally {
config.enableAssertions = true;
}
});
});
describe("assertFunction", function() {
rIt("should identify functions", ["config", "utils"],
function(config, utils) {
config.enableAssertions = true;
utils.assertFunction(describe, "This is a valid function");
});
rIt("should fail for != function", ["config", "utils"],
function(config, utils) {
config.enableAssertions = true;
try {
utils.assert(false, "I need a %", "callback");
throw new Error("This should fail!");
} catch (e) {
expect(e.message).toEqual("Assertion error: I need a callback");
}
});
});
describe("onlyAllowInUnitTest", function() {
var functionCalled = false;
var testFn = function() {
functionCalled = true;
};
rIt("should fail for mode != unit test",
["config", "utils"],
function(config, utils) {
functionCalled = false;
config.unitTestMode = false;
var wrappedFn = utils.onlyAllowInUnitTest(testFn);
try {
wrappedFn();
} catch (e) {
// the assertion error is the right one in this case
expect(e.message.indexOf("Assertion error")).not.toEqual(-1);
}
expect(functionCalled).toBe(false);
});
rIt("should work in unit test mode",
["config", "utils"],
function(config, utils) {
functionCalled = false;
config.unitTestMode = true;
var wrappedFn = utils.onlyAllowInUnitTest(testFn);
wrappedFn();
expect(functionCalled).toBe(true);
});
});
});
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _linglog = require('linglog');
var _linglog2 = _interopRequireDefault(_linglog);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _linglog2.default)('gulp-insert-md', {
timeFormat: 'HH:mm:ss'
});
module.exports = exports['default'];
|
import {createCustomOsc} from './oscillator'
export function createChorus(ctx: Object) {
const merger = ctx.createChannelMerger(2)
const input = ctx.createGain()
const output = ctx.createGain()
const feedbackL = ctx.createGain()
const feedbackR = ctx.createGain()
const delayL = ctx.createDelay()
const delayR = ctx.createDelay()
const lfoLGain = ctx.createGain()
const lfoRGain = ctx.createGain()
const lfoL = createCustomOsc(ctx)
const lfoR = createCustomOsc(ctx)
input.connect(output)
input.connect(delayL)
input.connect(delayR)
lfoL.connect(lfoLGain)
lfoL.start(0)
lfoR.connect(lfoRGain)
lfoR.start(0)
lfoRGain.connect(delayR.delayTime)
lfoLGain.connect(delayL.delayTime)
lfoLGain.connect(lfoR.frequency)
delayL.connect(feedbackL)
delayR.connect(feedbackR)
feedbackL.connect(delayL)
feedbackR.connect(delayR)
feedbackL.connect(merger, 0, 0)
feedbackR.connect(merger, 0, 1)
merger.connect(output)
const setters = {
frequency(value) {
lfoL.frequency.value = value
lfoR.frequency.value = value
},
feedback(value) {
feedbackL.gain.value = value
feedbackR.gain.value = value
}
}
return {
__setters: setters,
input,
connect(node) { output.connect(node) },
init(patch) {
lfoL.init({
frequency: patch.frequency,
type: patch.type,
phase: 180
})
lfoR.init({
frequency: patch.frequency,
type: patch.type,
phase: 0
})
// TODO: Add public access to chorus depth here
input.gain.value = 0.6934
lfoLGain.gain.value = 0.002
lfoRGain.gain.value = 0.002
feedbackL.gain.value = patch.feedback
feedbackR.gain.value = patch.feedback
},
set(key, val) {
setters[key](val)
}
}
}
|
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* ClassManager.js *
* *
* hprose ClassManager for HTML5. *
* *
* LastModified: Nov 18, 2016 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
(function (hprose, global) {
'use strict';
var WeakMap = global.WeakMap;
var classCache = Object.create(null);
var aliasCache = new WeakMap();
function register(cls, alias) {
aliasCache.set(cls, alias);
classCache[alias] = cls;
}
function getClassAlias(cls) {
return aliasCache.get(cls);
}
function getClass(alias) {
return classCache[alias];
}
hprose.ClassManager = Object.create(null, {
register: { value: register },
getClassAlias: { value: getClassAlias },
getClass: { value: getClass }
});
hprose.register = register;
register(Object, 'Object');
})(hprose, hprose.global);
|
/*
* The MIT License (MIT)
* Copyright (c) 2016 SK PLANET. All Rights Reserved. *
* 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. */
/*!
* \RecentWordPluginLocalStorageAddOn.js
* \Addon source for RecentWordPlugin.js
* \copyright Copyright (c) 2016, SK PLANET. All Rights Reserved.
* \license This project is released under the MIT License.
* \contributor Jisu Youn (jisu.youn@gmail.com)
* \warning dont'use this source in other library source.
*/
class RecentWordPluginLocalStorageAddOn {
constructor(sKey, nMaxList) {
this.sKey = sKey;
this.nMaxList = nMaxList;
}
saveKeyword(sKeyword) {
if (this.validStorage()) return;
let aLegacy = this.getKeywords();
//to Array
if (aLegacy === null) aLegacy = [];
else aLegacy = JSON.parse(aLegacy);
//save data
let nIndex = aLegacy.indexOf(sKeyword);
if ( nIndex > -1) {
if(nIndex === (aLegacy.length-1)) return;
aLegacy.splice(nIndex, 1);
}
aLegacy.unshift(sKeyword);
if (aLegacy.length >= this.nMaxList) aLegacy.length = this.nMaxList;
localStorage.setItem(this.sKey, JSON.stringify(aLegacy));
}
getKeywords(){
if (this.validStorage()) return;
let sResult = localStorage.getItem(this.sKey);
return sResult;
}
removeKeywords() {
if (this.validStorage()) return;
return localStorage.removeItem(this.sKey);
}
validStorage() {
if ( typeof(Storage) === "undefined") return;
}
}
|
"use strict";
module.exports = {
entry: {
playground: "./playground/index.js"
},
output: {
filename: "[name].js",
path: __dirname + "/static/"
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: ["env", "react"]
}
}
]
},
externals: {
clipboard: "ClipboardJS",
codemirror: "CodeMirror",
react: "React",
"react-dom": "ReactDOM"
}
};
|
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports', '../node_modules/skatejs/lib/index'], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require('../node_modules/skatejs/lib/index'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, global.index);
global.properties = mod.exports;
}
})(this, function (exports, _index) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.string = exports.number = exports.boolean = exports.array = undefined;
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var props = _index2.default.properties;
var array = props.array;
var boolean = props.boolean;
var number = props.number;
var string = props.string;
exports.default = props;
exports.array = array;
exports.boolean = boolean;
exports.number = number;
exports.string = string;
});
|
/*
tags: basic
<p>This example shows how you can implement a simple Minecraft renderer in regl.</p>
*/
const canvas = document.body.appendChild(document.createElement('canvas'))
const fit = require('canvas-fit')
const regl = require('../regl')(canvas)
const mat4 = require('gl-mat4')
const camera = require('canvas-orbit-camera')(canvas)
window.addEventListener('resize', fit(canvas), false)
// configure intial camera view.
camera.rotate([0.0, 0.0], [0.0, -0.4])
camera.zoom(15.0)
// all the positions of a single block.
var blockPosition = [
// side faces
[[-0.5, +0.5, +0.5], [+0.5, +0.5, +0.5], [+0.5, -0.5, +0.5], [-0.5, -0.5, +0.5]], // positive z face.
[[+0.5, +0.5, +0.5], [+0.5, +0.5, -0.5], [+0.5, -0.5, -0.5], [+0.5, -0.5, +0.5]], // positive x face
[[+0.5, +0.5, -0.5], [-0.5, +0.5, -0.5], [-0.5, -0.5, -0.5], [+0.5, -0.5, -0.5]], // negative z face
[[-0.5, +0.5, -0.5], [-0.5, +0.5, +0.5], [-0.5, -0.5, +0.5], [-0.5, -0.5, -0.5]], // negative x face.
// top faces
[[-0.5, +0.5, -0.5], [+0.5, +0.5, -0.5], [+0.5, +0.5, +0.5], [-0.5, +0.5, +0.5]]
]
// all the uvs of a single block.
var blockUv = [
// side faces
[[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]],
[[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]],
[[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]],
[[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]],
// top
[[0.0, 0.0], [0.5, 0.0], [0.5, 0.5], [0.0, 0.5]]
]
// all the normals of a single block.
var blockNormal = [
// side faces
[[0.0, 0.0, +1.0], [0.0, 0.0, +1.0], [0.0, 0.0, +1.0], [0.0, 0.0, +1.0]],
[[+1.0, 0.0, 0.0], [+1.0, 0.0, 0.0], [+1.0, 0.0, 0.0], [+1.0, 0.0, 0.0]],
[[0.0, 0.0, -1.0], [0.0, 0.0, -1.0], [0.0, 0.0, -1.0], [0.0, 0.0, -1.0]],
[[-1.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [-1.0, 0.0, 0.0]],
// top
[[0.0, +1.0, 0.0], [0.0, +1.0, 0.0], [0.0, +1.0, 0.0], [0.0, +1.0, 0.0]]
]
// the terrain is just described by some sine functions.
var evalHeight = (x, z) => {
var freq = 30.0
return Math.round(
2.0 * Math.sin(freq * 1.0 * 3.14 * x) * Math.sin(freq * 2.0 * 3.14 * z) +
3.0 * Math.cos(freq * 4.0 * 3.14 * x + 2.1) * Math.sin(freq * 5.0 * 3.14 * z + 0.9) +
1.0 * Math.cos(freq * 8.0 * 3.14 * x + 43.43) * Math.cos(freq * 3.0 * 3.14 * z + 34.3))
}
// these contains all the geometry of the world.
// you can add blocks to these arrays by calling addBlock()
var uv = []
var elements = []
var position = []
var normal = []
var addBlock = (x, y, z) => {
var index = position.length
for (var i = 0; i < 5; i++) {
if (i === 0 && y <= evalHeight(x, z + 1)) { // positive z face
continue // not visible, skip
}
if (i === 1 && y <= evalHeight(x + 1, z)) { // positive x face
continue // not visible, skip
}
if (i === 2 && y <= evalHeight(x, z - 1)) { // negative z face
continue // not visible, skip
}
if (i === 3 && y <= evalHeight(x - 1, z)) { // negative x face
continue // not visible, skip
}
var j
// add positions.
for (j = 0; j < blockPosition[i].length; j++) {
var p = blockPosition[i][j]
position.push([p[0] + x, p[1] + y, p[2] + z])
}
// add normals.
for (j = 0; j < blockNormal[i].length; j++) {
var n = blockNormal[i][j]
normal.push([n[0], n[1], n[2]])
}
// add uvs.
for (j = 0; j < blockUv[i].length; j++) {
var a = blockUv[i][j]
uv.push([a[0], a[1]])
}
// add quad face.
elements.push([2 + index, 1 + index, 0 + index])
elements.push([2 + index, 0 + index, 3 + index])
index += 4 // next quad.
}
}
const S = 40 // world size.
// create world:
for (var x = -S; x <= S; x++) {
for (var z = -S; z <= S; z++) {
var y = evalHeight(x, z)
addBlock(x, y, z)
}
}
// now the world has been created. Now create the draw call.
const drawWorld = regl({
cull: {
enable: true,
face: 'back'
},
context: {
view: () => camera.view()
},
frag: `
precision mediump float;
varying vec2 vUv;
varying vec3 vNormal;
uniform sampler2D atlas;
void main () {
vec3 lightDir = normalize(vec3(0.4, 0.9, 0.3));
vec3 tex = texture2D(atlas, vUv).rgb;
vec3 ambient = 0.3 * tex;
vec3 diffuse = 0.7 * tex * clamp( dot(vNormal, lightDir ), 0.0, 1.0 );
gl_FragColor = vec4(ambient + diffuse, 1.0);
}`,
vert: `
precision mediump float;
attribute vec3 position, normal;
attribute vec2 uv;
varying vec2 vUv;
varying vec3 vNormal;
uniform mat4 projection, view;
void main() {
vUv = uv;
vNormal = normal;
gl_Position = projection * view * vec4(position, 1);
}`,
uniforms: {
view: regl.context('view'),
projection: ({viewportWidth, viewportHeight}) =>
mat4.perspective([],
Math.PI / 4,
viewportWidth / viewportHeight,
0.01,
1000),
atlas: regl.prop('atlas')
},
attributes: {
position: regl.prop('position'),
uv: regl.prop('uv'),
normal: regl.prop('normal')
},
elements: regl.prop('elements')
})
require('resl')({
manifest: {
atlas: {
type: 'image',
src: 'assets/atlas.png',
parser: (data) => regl.texture({
mag: 'nearest',
mipmap: true,
min: 'linear mipmap linear',
data: data
})
}
},
onDone: ({ atlas }) => {
regl.frame(() => {
drawWorld({position, elements, uv, normal, atlas})
camera.tick()
})
}
})
|
module.exports = {
output: {
library: 'RadioGroup',
libraryTarget: 'umd'
},
externals: [
{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
}
}
],
module: {
loaders: [
{test: /\.jsx?$/, exclude: /build|node_modules/, loader: 'babel-loader'},
]
},
resolve: {
extensions: ['.js', '.jsx']
}
};
|
export const RouteAuth = {
REQUIRED: 2,
DISABLED: 0,
OPTIONAL: 1,
};
|
// Entry point for the notebook bundle containing custom model definitions.
//
// Setup notebook base URL
//
// Some static assets may be required by the custom widget javascript. The base
// url for the notebook is not known at build time and is therefore computed
// dynamically.
__webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/jupyter-canvas/';
// Export widget models and views, and the npm package version number.
module.exports = require('./jupyter-canvas.js');
module.exports['version'] = require('../package.json').version;
|
"use strict";
module.exports = {
home: require("./home")
};
|
describe('inventory routes', () => {
var expect = chai.expect;
describe('state', () => {
var view = 'inventory/inventory.html';
beforeEach(function () {
angular.mock.module('app.inventory');
bard.inject(this, '$rootScope', '$state', '$templateCache');
$templateCache.put(view, '');
});
bard.verifyNoOutstandingHttpRequests();
it('should map state inventory to url /inventory ', () => {
console.log("inventory should map state inventory to url");
expect($state.href('inventory', {})).to.equal('/inventory');
});
it('should map /inventory route to inventory View template', () => {
console.log("inventory should map /inventory route to inventory View template");
expect($state.get('inventory').views['@'].templateUrl).to.equal(view);
});
it('should work with $state.go', () => {
console.log("inventory should work with $state.go");
$state.go('inventory');
$rootScope.$apply();
expect($state.is('inventory'));
});
it('should have title "inventory" ', () => {
console.log('inventory should have title "inventory"');
$state.go('inventory');
$rootScope.$apply();
expect($state.current.data.pageTitle).to.equal('Inventory');
});
});
});
|
export default class ChatService {
constructor(webSocketService, $q, $rootScope) {
this.channelName = 'chat';
this.webSocketService = webSocketService;
this.$q = $q;
}
enterChat(){
var deferred = this.$q.defer();
if(this.webSocketService.isConnected()){
this.webSocketService.enterRoom(this.channelName, (data) => {
deferred.resolve(data);
});
}
return deferred.promise;
}
leaveChat(){
this.webSocketService.leaveRoom(this.channelName, () => {
this.webSocketService.socket.off('chat new message');
this.webSocketService.socket.off('chat user joined');
this.webSocketService.socket.off('chat user left');
});
}
sendMessage(message){
var deferred = this.$q.defer();
this.webSocketService.socket.emit('chat message', message, (resp) => {
deferred.resolve(resp);
});
return deferred.promise;
}
listenNewMessage(cb){
this.webSocketService.listen('chat new message', cb);
}
listenUserJoin(cb){
this.webSocketService.listen('chat user joined', cb);
}
listenUserLeave(cb){
this.webSocketService.listen('chat user left', cb);
}
}
ChatService.$inject = ['webSocketService', '$q', '$rootScope'];
|
'use strict';
angular.module('yeoMeanApp')
.controller('ContactCtrl', function ($rootScope, $scope) {
$rootScope.metaTitle = "Contact | Brian Mitchell";
$rootScope.metaDescription = "Where to find Brian Mitchell";
$rootScope.metaType = "website";
$rootScope.metaImage = "/assets/images/BM-Logo-Large.png";
});
|
// Importing from `.json.js` a workaround for a bug in web browsers' "native"
// ES6 importing system which is uncapable of importing "*.json" files.
// https://github.com/catamphetamine/libphonenumber-js/issues/239
import metadata from '../metadata.mobile.json.js'
export default metadata
export function withMetadata(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
args.push(metadata)
return func.apply(this, args)
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:ba917294e0f245eed27f8fcafe6ff796ed9b6f99a4025eb0271300e09e1c464d
size 1209
|
import { reducerFactory } from 'retax';
import { userTheme, adminTheme } from 'themes';
import {
SET_ADMIN_THEME,
SET_USER_THEME,
} from 'constants/actions';
export default reducerFactory(
userTheme,
{
[SET_ADMIN_THEME]() {
return adminTheme;
},
[SET_USER_THEME]() {
return userTheme;
},
}
);
|
import { expect } from 'chai';
import HttpSmartError from 'http-smart-error';
import { RSError } from '../src';
import RSBaseError from '../src/error/base';
describe('RSError', () => {
it('checks the error classes', () => {
const classes = [
'InvalidInputType',
'InvalidArgumentType',
'InvalidParameterType',
'MissingParameter',
'MissingApiKey',
'InvalidApiKey',
'MissingAccessToken',
'InvalidAccessToken',
'Timeout',
'NotFound',
];
expect(RSError).to.have.all.keys(classes);
for (const cls of classes) {
if (cls === 'InvalidInputType') {
continue;
}
expect(new RSError[cls]()).to.be.an.instanceOf(RSBaseError);
expect(new RSError[cls]()).to.be.an.instanceOf(HttpSmartError);
}
});
it('checks the default error', () => {
const e = new RSError();
expect(e).to.be.an.instanceOf(HttpSmartError);
expect(e).to.have.all.keys(['statusCode', 'code', 'message']);
expect(e.statusCode).to.be.equal(500);
expect(e.message).to.be.equal('Internal Server Error');
expect(e.code).to.be.equal('ERR_INTERNAL_SERVER_ERROR');
expect(e.getDescription()).to.be.equal(null);
const f = RSError.toErrorField();
expect(f).to.have.all.keys(['code', 'description']);
expect(f.code).to.be.equal(e.code);
expect(f.description).to.be.equal(e.getDescription());
});
it('checks the default error with message and payload', () => {
const e = new RSError('Test error', { test: 'test' });
expect(e).to.be.an.instanceOf(HttpSmartError);
expect(e).to.have.all.keys(['statusCode', 'code', 'message', 'test']);
expect(e.statusCode).to.be.equal(500);
expect(e.message).to.be.equal('Test error');
expect(e.code).to.be.equal('ERR_INTERNAL_SERVER_ERROR');
expect(e.getDescription()).to.be.equal(null);
expect(e.test).to.be.equal('test');
const f = RSError.toErrorField();
expect(f).to.have.all.keys(['code', 'description']);
expect(f.code).to.be.equal(e.code);
expect(f.description).to.be.equal(e.getDescription());
});
it('checks the subclass of the RSError', () => {
class BadRequestError extends RSError {
_getStatusCode() {
return HttpSmartError.BAD_REQUEST;
}
}
const e = new BadRequestError();
expect(e).to.be.an.instanceOf(HttpSmartError);
expect(e).to.be.an.instanceOf(RSError);
expect(e).to.have.all.keys(['statusCode', 'code', 'message']);
expect(e.statusCode).to.be.equal(HttpSmartError.BAD_REQUEST);
expect(e.message).to.be.equal('Bad Request');
expect(e.code).to.be.equal('ERR_BAD_REQUEST');
expect(e.getDescription()).to.be.equal(null);
const f = BadRequestError.toErrorField();
expect(f).to.have.all.keys(['code', 'description']);
expect(f.code).to.be.equal(e.code);
expect(f.description).to.be.equal(e.getDescription());
});
it('checks the subclass of the RSError with custom message and code', () => {
class BadRequestError extends RSError {
getDescription() {
return 'Returned if something went wrong.';
}
_getStatusCode() {
return HttpSmartError.BAD_REQUEST;
}
_getMessage() {
return 'Custom message error';
}
_getCode() {
return 'wrong_request';
}
}
const e = new BadRequestError();
expect(e).to.be.an.instanceOf(HttpSmartError);
expect(e).to.be.an.instanceOf(RSError);
expect(e).to.have.all.keys(['statusCode', 'code', 'message']);
expect(e.statusCode).to.be.equal(HttpSmartError.BAD_REQUEST);
expect(e.message).to.be.equal('Custom message error');
expect(e.code).to.be.equal('ERR_WRONG_REQUEST');
expect(e.getDescription()).to.be.equal('Returned if something went wrong.');
const f = BadRequestError.toErrorField();
expect(f).to.have.all.keys(['code', 'description']);
expect(f.code).to.be.equal(e.code);
expect(f.description).to.be.equal(e.getDescription());
});
});
|
/**
* Selfbits API V2
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 2.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Organization.js.map
|
define(function (require) {
var fs = require('fs'),
when = require('when');
return Constructor;
function Constructor(debugLogger, filePath) {
var self = this;
self.diff = function diff(otherFile) {
var deferred = when.defer();
fs.stat(filePath, function (err, stats) {
// debugLogger.log('stats');
var diffResult = !!err || stats.size != parseInt(otherFile.size);
// debugLogger.log(diffResult);
deferred.resolve(diffResult);
});
return deferred.promise;
};
}
});
|
var path = require('path')
var fs = require('fs')
var argv = require('optimist').argv;
var express = require('express')
var webpack = require('webpack')
var config = require('../config')
var opn = require('opn')
var proxyMiddleware = require('http-proxy-middleware')
var webpackConfig = process.env.NODE_ENV === 'testing'
? require('./webpack.prod.conf')
: require('./webpack.dev.conf')
// default port where dev server listens for incoming traffic
var port = process.env.PORT || config.dev.port
// Define HTTP proxies to your custom API backend
// https://github.com/chimurai/http-proxy-middleware
var proxyTable = config.dev.proxyTable
var app = express()
var compiler = webpack(webpackConfig)
var devMiddleware = require('webpack-dev-middleware')(compiler, {
publicPath: webpackConfig.output.publicPath,
stats: {
colors: true,
chunks: false
}
})
var hotMiddleware = require('webpack-hot-middleware')(compiler)
// force page reload when html-webpack-plugin template changes
compiler.plugin('compilation', function (compilation) {
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
hotMiddleware.publish({ action: 'reload' })
cb()
})
})
// proxy api requests
// Object.keys(proxyTable).forEach(function (context) {
// var options = proxyTable[context]
// if (typeof options === 'string') {
// options = { target: options }
// }
// app.use(proxyMiddleware(context, options))
// });
// mock/proxy api requests
var mockDir = path.resolve(__dirname, '../mock');
(function setMock(mockDir) {
fs.readdirSync(mockDir).forEach(function (file) {
var filePath = path.resolve(mockDir, file);
var mock;
if (fs.statSync(filePath).isDirectory()) {
setMock(filePath);
}
else {
mock = require(filePath);
app.use(mock.api, argv.proxy ? proxyMiddleware({target: 'http://' + argv.proxy}) : mock.response);
}
});
})(mockDir);;
// handle fallback for HTML5 history API
app.use(require('connect-history-api-fallback')({
index: '/index.html'
}))
// serve webpack bundle output
app.use(devMiddleware)
// enable hot-reload and state-preserving
// compilation error display
app.use(hotMiddleware)
// serve pure static assets
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
app.use(staticPath, express.static('./static'))
module.exports = app.listen(port, function (err) {
if (err) {
console.log(err)
return
}
var uri = 'http://localhost:' + port
console.log('Dev server listening at ' + uri + '\n')
// opn(uri)
})
|
module.exports = function(mongoose) {
var config = require(process.cwd() + '/config');
var sha256 = require('sha256');
return function(req, res) {
if(req.method == "GET") {
if(req.session.user) {
res.json(req.session.user);
console.log("User logged in: ", req.session.user.username);
} else {
res.json(false);
}
} else if(req.method == "POST") {
if(!req.body.username || !req.body.password) {
res.json(false);
return;
}
// encrypt password
req.body.password = sha256(config.hashSalt + req.body.password);
mongoose.model("User").findOne(req.body, function(err, data) {
if(err) {
throw err;
}
// we never store the password
data && (data.password = undefined);
// store the other info in session
data && (req.session.user = data);
// return the logged in user if there is one
res.json(data ? data : false);
});
} else if(req.method == "DELETE") {
req.session.destroy(function(err) {
if(err) {
throw err;
}
res.json(true);
});
} else {
res.json({error: "Method not allowed"});
}
};
};
|
/* eslint-disable ember/no-mixins, ember/no-new-mixins */
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import Route from '@ember/routing/route';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
module('ApplicationRoute', function(hooks) {
setupTest(hooks);
hooks.beforeEach(function() {
this.owner.register('route:application', Route.extend(ApplicationRouteMixin));
});
test('is still testable when using the ApplicationRouteMixin', function(assert) {
const route = this.owner.lookup('route:application');
assert.ok(route);
});
});
|
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, '../techbot_web/static');
var APP_DIR = path.resolve(__dirname, 'src/app');
var config = {
entry: APP_DIR + '/index.jsx',
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx', '.scss'],
modules: [
'node_modules'
]
},
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
loader : 'babel-loader',
query: {
presets: ['es2015', 'react']
}
},
{ test: /\.css/, loader: "style-loader!css-loader" },
{test: /\.scss$/, loaders: [ 'style', 'css', 'sass' ]},
{
test: /\.(png|jpg|)$/,
loader: 'url-loader?limit=200000'
},
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: 'file-loader',
options: {
name: '../techbot_web/static/fonts/[name].[ext]',
},
}
]
}
};
module.exports = config;
|
/**
* PipelineTimer
* Keeps track of the time left for a HIT and updates the page as necessary.
* onExpiration will be de-thunked when the timer expires.
*/
PipelineTimer.create = function(serverTimestamp, counterId, totalSeconds, endTime, onExpiration) {
var offset = new ClientOffset(serverTimestamp);
OnLoadHandler.functions.push(function() {
var counter = document.getElementById(counterId);
var timer = new PipelineTimer(offset, counter, totalSeconds, endTime, onExpiration);
timer.start();
});
}
function PipelineTimer(offset, counterElement, totalSeconds, endTime, onExpiration) {
this.offset = offset;
this.counterElement = counterElement;
this.totalSeconds = totalSeconds;
this.endTime = endTime;
this.onExpiration = onExpiration;
}
PipelineTimer.prototype.start = function() {
this.looping = true;
this.loop();
}
PipelineTimer.prototype.stop = function() {
this.looping = false;
}
PipelineTimer.prototype.loop = function() {
this.count();
if (this.looping) {
var _this = this;
setTimeout(function() { _this.loop() }, 1000);
}
}
PipelineTimer.prototype.count = function() {
var now = new Date();
var millisecondsRemaining = this.endTime.getTime() - now.getTime() + this.offset.getMilliseconds();
var secondsRemaining = Math.floor(millisecondsRemaining / 1000);
if (secondsRemaining > 0) {
var secondsElapsed = Math.max(totalSeconds - secondsRemaining, 0);
this.setCounter(secondsElapsed);
} else {
this.onExpiration && this.onExpiration();
this.setCounter(this.totalSeconds);
this.stop();
}
}
PipelineTimer.prototype.setCounter = function(seconds) {
var counterValue = this.formatTime(seconds);
this.counterElement.innerHTML = counterValue;
this.counterElement.size = counterValue.length - 1;
}
PipelineTimer.prototype.formatTime = function(totalSeconds) {
var seconds = totalSeconds % 60;
var minutes = Math.floor(totalSeconds / 60) % 60;
var hours = Math.floor(totalSeconds / (60 * 60)) % 24;
var days = Math.floor(totalSeconds / (60 * 60 * 24));
var disp = " ";
if (days > 0) {
disp += days + (days == 1 ? ' day ' : ' days ')
}
disp += this.formatNumber(hours) + ':' + this.formatNumber(minutes) + ':' + this.formatNumber(seconds);
return disp;
}
PipelineTimer.prototype.formatNumber = function(value) {
var string = value + '';
if (string.length < 2) { string = '0' + string }
return string;
}
/**
* ClientOffset
* Calculates the client's offset from the server's time
*/
ClientOffset.cookieName = 'clientOffset';
ClientOffset.loadDelayMilliseconds = 500;
function ClientOffset(serverTimestamp) {
var cookie = Cookie.get(ClientOffset.cookieName);
if (cookie && cookie.value) {
this.milliseconds = parseInt(cookie.value);
if (!this.milliseconds) { cookie.remove() }
} else {
if (!serverTimestamp) { alert('No server timestamp was set!') }
var serverGmtMilliseconds = parseInt(serverTimestamp);
var clientGmtMilliseconds = (new Date()).getTime();
this.milliseconds = clientGmtMilliseconds - serverGmtMilliseconds - ClientOffset.loadDelayMilliseconds;
Cookie.create(ClientOffset.cookieName, this.milliseconds);
}
}
ClientOffset.prototype.getMilliseconds = function() {
return this.milliseconds
}
/**
* Cookie
* Wrapper class for cookies
*/
Cookie.get = function(name, path, domain) {
var prefix = name + "=";
var begin = document.cookie.indexOf("; " + prefix);
if (begin == -1) {
begin = document.cookie.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = document.cookie.length;
}
var value = unescape(document.cookie.substring(begin + prefix.length, end));
return new Cookie(name, value, path, domain);
}
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current session)
* [path] Path where the cookie is valid (default: path of calling document)
* [domain] Domain where the cookie is valid
* (default: domain of calling document)
* [secure] Boolean value indicating if the cookie transmission requires a
* secure transmission
*/
Cookie.create = function(name, value, expires, path, domain, secure) {
document.cookie = name + '=' + escape(value) +
(expires ? '; expires=' + expires.toGMTString() : '') +
(path ? '; path=' + path : '') +
(domain ? '; domain=' + domain : '') +
(secure ? '; secure' : '');
return new Cookie(name, value, path, domain);
}
function Cookie(name, value, path, domain) {
this.name = name;
this.value = value;
this.path = path;
this.domain = domain;
}
Cookie.prototype.remove = function() {
document.cookie = this.name + '=' +
(this.path ? '; path=' + this.path : '') +
(this.domain ? '; domain=' + this.domain : '') +
'; expires=Thu, 01-Jan-70 00:00:01 GMT';
}
|
webpackJsonp([60335399758886],{199:function(t,e){t.exports={data:{site:{siteMetadata:{title:"Ted"}}},layoutContext:{}}}});
//# sourceMappingURL=path----39eaccc68746c5e5b853.js.map
|
module.exports = {
onInput: function (input) {
this.state = {
heading: input.heading || "",
message: input.message || "",
colors: input.colors || []
};
}
};
|
var gulp = require('gulp'),
sass = require('gulp-sass'),
gp_concat = require('gulp-concat'),
gp_uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
minifyCss = require('gulp-minify-css'),
rev = require('gulp-rev'),
replace = require('gulp-replace'),
notify = require('gulp-notify'),
revReplace = require('gulp-rev-replace');
//var css_rev = gulp.src('.css/rev-manifest.json');
//var js_rev = gulp.src('.js/rev-manifest.json');
gulp.task('sass', function () {
return gulp.src('./scss/main.scss')
.pipe(sass({errLogToConsole: true}))
.pipe(gulp.dest('./css'));
});
gulp.task('mincss',['sass'],function(){
gulp.src(['./css/normalize.css','./css/main.css'])
.pipe(gp_concat('main.big.css'))
.pipe(gulp.dest('./css'))
.pipe(minifyCss())
.pipe(rename('main.min.css'))
.pipe(gulp.dest('./css'))
})
gulp.task('watch',function(){
gulp.watch('./scss/*', function() {
gulp.run(['mincss']);
});
gulp.watch('./js/*.js', function() {
gulp.run(['ugly']);
});
});
gulp.task('ugly',function(){
return gulp.src(['./js/main.js'])
.pipe(gp_uglify())
.pipe(rename('main.min.js'))
.pipe(gulp.dest('./js/'))
})
gulp.task('deploy',function(){
return gulp.src([
'./css/main.min.css',
'./js/main.min.js'
], {base: './'})
.pipe(rev())
.pipe(gulp.dest('./'))
.pipe(notify(this))
.pipe(rev.manifest())
.pipe(gulp.dest('./'))
})
|
var BlockView = Backbone.View.extend({
tagName : 'div',
initialize : function() {
this.render();
},
render: function() {
this.$el.attr({
class : 'block gimmick-' + this.model.get('gimmick'),
'data-gimmick' : this.model.get('gimmick')
});
},
collide: function() {
if (this.model.get('isDead'))
return;
var ballX = app.ball.model.get('ballX'),
ballY = app.ball.model.get('ballY'),
ballRadius = app.ball.model.get('ballRadius'),
blockX = this.model.get('blockX'),
blockY = this.model.get('blockY'),
blockW = this.model.get('blockW'),
blockH = this.model.get('blockH');
// Collision
if (ballX + ballRadius < blockX || ballX - ballRadius > blockX + blockW)
return;
if (ballY + ballRadius < blockY || ballY - ballRadius > blockY + blockH)
return;
// Dead
this.die();
this.model.set('isDead', true);
// Updating ball
var prevBallPos_x = app.ball.model.get('prevBallPos.x');
app.ball.model.set('ballX', prevBallPos_x);
var prevBallPos_y = app.ball.model.get('prevBallPos.y');
app.ball.model.set('ballY', prevBallPos_y);
var ballDirectionY = app.ball.model.get('ballDirectionY');
app.ball.model.set('ballDirectionY', ballDirectionY *= -1.0);
},
die : function() {
app.blockCount++;
this.$el.remove();
this.remove();
}
});
|
import {
moduleForComponent,
test
} from 'ember-qunit';
moduleForComponent('plottable-chart', {
unit: true
// specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar']
});
test('it renders', function(assert) {
assert.expect(2);
// creates the component instance
var component = this.subject();
assert.equal(component._state, 'preRender');
// renders the component to the page
this.render();
assert.equal(component._state, 'inDOM');
});
|
/** @license MIT License (c) copyright 2014 original authors */
/** @author Karolis Narkevicius */
var path = require('path');
var knox = require('knox-s3');
var when = require('when');
var thunkify = require('thunkify');
var cp = require('fs-cp');
module.exports = function (config) {
return new S3(config);
};
/**
* Amazon S3 Storage Adapter for CNPM
*
* @param {Object} knox config
* @api public
*/
function S3(config) {
this.config = config;
this.client = knox.createClient(this.config);
this.client.getFile = thunkify(this.client.getFile);
this.client.deleteFile = thunkify(this.client.deleteFile);
}
/**
* Upload a package from filepath to S3.
*
* @param {String} filepath the path of the file to upload
* @param {Object} options with key and size
* @return {Object} an object with the key
* @api public
*/
S3.prototype.upload = function* (filepath, options) {
var s3Config = this.config;
var client = this.client;
var dest = this.getPath(options.key);
var uploadOptions = {};
if (s3Config.storageClass) {
uploadOptions['x-amz-storage-class'] = s3Config.storageClass;
}
yield when.promise(function (resolve, reject) {
client.putFile(filepath, dest, uploadOptions, function (err, res) {
if (err) return reject(err);
if (res.statusCode !== 200) { return reject(new Error('putFile failed with ' + res.statusCode)); }
resolve();
}).on('error', function (err) {
reject(new Error('Network error' + err.message));
});
});
return { key: options.key };
};
/**
* Upload a package from filepath to S3.
*
* @param {String} contents of the file to upload
* @param {Object} options with key and size
* @return {Object} an object with the key
* @api public
*/
S3.prototype.uploadBuffer = function* (content, options) {
var client = this.client;
var filepath = this.getPath(options.key);
var headers = {
'Content-Type': 'application/x-gzip'
};
yield when.promise(function (resolve, reject) {
client.putBuffer(content, filepath, headers, function(err, res) {
if (err) return reject(err);
if (res.statusCode !== 200) return reject(new Error('putBuffer failed with ' + res.statusCode));
resolve();
}).on('error', function (err) {
reject(new Error('Network error' + err.message));
});
});
return { key: options.key };
};
/**
* Download a package from S3.
*
* @param {String} package key
* @param {String} download path
* @param {options} an object with timeout
* @api public
*/
S3.prototype.download = function* (key, savePath) {
var client = this.client;
var filepath = this.getPath(key);
var res = yield client.getFile(filepath);
yield cp(res, savePath);
};
/**
* Remove a package from S3
*
* @param {String} package key
* @api public
*/
S3.prototype.remove = function* (key) {
var client = this.client;
var filepath = this.getPath(key);
yield client.deleteFile(filepath);
};
/**
* escape '/' and '\'
* prepend the config.folder
*/
S3.prototype.getPath = function (key) {
key = key.replace(/\//g, '-').replace(/\\/g, '_');
key = path.join(this.config.folder, key);
return key;
};
|
define( "add", [
"../core/vi"
], function( vi ) {
/**
* func Add
* @param {Int} a
* @param {Int} b
* @return {Int} a+b
*/
vi.add = function( a, b ) {
return a + b;
};
return vi.add;
});
|
/**
* Error parser for apeman.
* @module apemanerror
* @version 5.3.2
*/
'use strict';
var _assign = require('babel-runtime/core-js/object/assign');
var _assign2 = _interopRequireDefault(_assign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var apemanerror = require('./apemanerror');
var buildin = require('./buildin');
var lib = apemanerror.bind(undefined);
(0, _assign2.default)(lib, apemanerror, {
buildin: buildin
});
module.exports = lib;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbImFwZW1hbmVycm9yIiwicmVxdWlyZSIsImJ1aWxkaW4iLCJsaWIiLCJiaW5kIiwibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztBQU1BOzs7Ozs7OztBQUVBLElBQU1BLGNBQWNDLFFBQVEsZUFBUixDQUFwQjtBQUNBLElBQU1DLFVBQVVELFFBQVEsV0FBUixDQUFoQjs7QUFFQSxJQUFJRSxNQUFNSCxZQUFZSSxJQUFaLFdBQVY7O0FBRUEsc0JBQWNELEdBQWQsRUFBbUJILFdBQW5CLEVBQWdDO0FBQzlCRTtBQUQ4QixDQUFoQzs7QUFJQUcsT0FBT0MsT0FBUCxHQUFpQkgsR0FBakIiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoibGliIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFcnJvciBwYXJzZXIgZm9yIGFwZW1hbi5cbiAqIEBtb2R1bGUgYXBlbWFuZXJyb3JcbiAqIEB2ZXJzaW9uIDUuMy4yXG4gKi9cblxuJ3VzZSBzdHJpY3QnXG5cbmNvbnN0IGFwZW1hbmVycm9yID0gcmVxdWlyZSgnLi9hcGVtYW5lcnJvcicpXG5jb25zdCBidWlsZGluID0gcmVxdWlyZSgnLi9idWlsZGluJylcblxubGV0IGxpYiA9IGFwZW1hbmVycm9yLmJpbmQodGhpcylcblxuT2JqZWN0LmFzc2lnbihsaWIsIGFwZW1hbmVycm9yLCB7XG4gIGJ1aWxkaW5cbn0pXG5cbm1vZHVsZS5leHBvcnRzID0gbGliXG4iXX0=
|
dojo.provide("t.unit.plugins.dojox.module");
try{
dojo.require("t.unit.plugins.dojox.timing.test");
}
catch(e) {
doh.debug(e);
}
|
import { moduleForModel, test } from 'ember-qunit';
moduleForModel('task', 'Unit | Model | task', {
// Specify the other units that are required for this test.
needs: ['model:unfuddle-project']
});
test('it exists', function(assert) {
let model = this.subject();
// let store = this.store();
assert.ok(!!model);
});
|
/**
* Factory based on OS output
*
*/
var OS = require( "os" );
//Webcam types
var FSWebcam = require( "./webcams/FSWebcam.js" );
var ImageSnapWebcam = require( "./webcams/ImageSnapWebcam.js" );
var WindowsWebcam = require( "./webcams/WindowsWebcam.js" );
//Main singleton
var Factory = new function() {
var scope = this;
//Main Class get
scope.create = function( options, type ) {
var p = type || Factory.Platform;
var Type = Factory.Types[ p ];
if( ! Type ) {
throw new Error( "Sorry, no webcam type specified yet for platform " + p );
}
return new Type( options );
};
};
Factory.Platform = OS.platform();
//OS Webcam types
Factory.Types = {
linux: FSWebcam,
darwin: ImageSnapWebcam,
fswebcam: FSWebcam,
win32: WindowsWebcam,
win64: WindowsWebcam
};
//Export
module.exports = Factory;
|
// "C" is for cookie, that's good enough for me.
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
var expires = "expires=" + d.toUTCString();
document.cookie =
cname + "=" + cvalue + "; " + expires + ";domain=.pokejisho.com;path=/";
}
// COOKIE COOKIE COOKIE STARTS WITH "C"
|
export default class Player extends Phaser.Sprite {
constructor(game) {
super(game, 0, 0, 'hero');
// enable physics for the player
this.game.physics.arcade.enableBody(this);
this.scale.setTo(1.1);
this.body.collideWorldBounds = true;
this.game.physics.arcade.enable(this);
// camera follows player
this.game.camera.follow(this);
// walking animations for the player
this.animations.add("walk-left", [117, 118, 119, 120, 121, 122, 123, 124, 125], 8, true);
this.animations.add("walk-right", [143, 144, 145, 146, 147, 148, 149, 150, 151], 8, true);
this.animations.add("walk-up", [104, 105, 106, 107, 108, 109, 110, 111, 112], 8, true);
this.animations.add("walk-down", [130, 131, 132, 133, 134, 135, 136, 137, 138,], 8, true);
// create control inputs for player
this.cursors = this.game.input.keyboard.createCursorKeys();
}
update() {
this.body.velocity.x = 0;
this.body.velocity.y = 0;
// player moves in specified direction or stands still
if (this.cursors.left.isDown) {
this.animations.play("walk-left");
this.body.velocity.x =- 180;
} else if (this.cursors.right.isDown) {
this.animations.play("walk-right");
this.body.velocity.x =+ 180;
} else {
this.body.velocity.x = 0;
}
if (this.cursors.up.isDown) {
this.animations.play("walk-up");
this.body.velocity.y =- 180;
} else if (this.cursors.down.isDown) {
this.animations.play("walk-down");
this.body.velocity.y =+ 180;
} else {
this.body.velocity.y = 0;
}
if (this.body.velocity.x === 0 && this.body.velocity.y === 0) {
this.animations.stop();
}
}
}
|
//GET /quizes/question
exports.question = function(req, res){
res.render('quizes/question', {pregunta: 'Capital de Italia'});
};
//GET quizes/answer
exports.answer = function(req, res){
if(req.query.respuesta === 'Roma'){
res.render('quizes/answer', {respuesta: 'Correcto'});
}else{
res.render('quizes/answer', {respuesta: 'Incorrecto'});
}
};
|
(function () {
window._paddingsTest = function () {
var test = function (padding) {
for (var len = 0; len <= 32; len++) {
var initialArray = random.default.getUint8Array(len);
var padded = padding.pad(initialArray, 16, random.default);
var padCount = padding.unpad(padded);
if (padCount == -1) {
console.log('Failed! 1');
return;
}
var unpadded = padded.subarray(0, padded.length - padCount);
if (initialArray.length != unpadded.length) {
console.log('Failed! 2');
return;
}
for (var i = 0; i < len; i++)
if (initialArray[i] != unpadded[i]) {
console.log('Failed! 3');
return;
}
}
console.log('passed');
};
console.log('ANSI X.923 test');
test(paddings['ANSI X.923']);
console.log('ISO 10126 test');
test(paddings['ISO 10126']);
console.log('PKCS7 test');
test(paddings['PKCS7']);
console.log('ISO/IEC 7816-4 test');
test(paddings['ISO/IEC 7816-4']);
};
var a40 = [25, 215, 226, 12, 106, 44, 159, 200, 49, 56, 86, 185, 11, 129, 90, 44, 125, 56, 126, 161, 114, 118, 212, 181, 23, 207, 189, 3, 55, 60, 7, 51, 5, 40, 199, 63, 151, 19, 88, 63];
window._md2Test = function () {
var test = function (bytes, hex) {
return bh.byteArrayToHex(hashAlgorithms.md2.computeHash(bytes)) == hex;
};
var result = true;
result &= test([], '8350e5a3e24c153df2275c9f80692773');
result &= test([255], '0797438d0baf3d71b7194ab3c71746b6');
result &= test(a40, '92183ec96932db4a26396b23d4df87a3');
console.log(result ? 'Passed' : 'Failed');
};
window._md4Test = function () {
var test = function (bytes, hex) {
return bh.byteArrayToHex(hashAlgorithms.md4.computeHash(bytes)) == hex;
};
var result = true;
result &= test([], '31d6cfe0d16ae931b73c59d7e0c089c0');
result &= test([255], '82c167af8e345bd055487af8d2b540c9');
result &= test(a40, 'c146aadc86111c7de36c7f319fa8a15d');
console.log(result ? 'Passed' : 'Failed');
};
window._md5Test = function () {
var test = function (bytes, hex) {
return bh.byteArrayToHex(hashAlgorithms.md5.computeHash(bytes)) == hex;
};
var result = true;
result &= test([], 'd41d8cd98f00b204e9800998ecf8427e');
result &= test([255], '00594fd4f42ba43fc1ca0427a0576295');
result &= test(a40, '332f73d56f380cea8ab0d51e855bac41');
console.log(result ? 'Passed' : 'Failed');
}
window._sha1Test = function () {
var test = function (bytes, hex) {
return bh.byteArrayToHex(hashAlgorithms.sha1.computeHash(bytes)) == hex;
};
var result = true;
result &= test([], 'da39a3ee5e6b4b0d3255bfef95601890afd80709');
result &= test([255], '85e53271e14006f0265921d02d4d736cdc580b0b');
result &= test(a40, '7a4ce8e483c6fb3460501e660fb164a4d2928c57');
console.log(result ? 'Passed' : 'Failed');
};
window._sha2Test = function () {
var test = function (bytes, ver, hex) {
if (ver == 224)
return bh.byteArrayToHex(hashAlgorithms.sha224.computeHash(bytes)) == hex;
if (ver == 256)
return bh.byteArrayToHex(hashAlgorithms.sha256.computeHash(bytes)) == hex;
if (ver == 384)
return bh.byteArrayToHex(hashAlgorithms.sha384.computeHash(bytes)) == hex;
if (ver == 512)
return bh.byteArrayToHex(hashAlgorithms.sha512.computeHash(bytes)) == hex;
};
console.log('SHA-224');
var result = true;
result &= test([], 224, 'd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f');
result &= test([255], 224, 'e33f9d75e6ae1369dbabf81b96b4591ae46bba30b591a6b6c62542b5');
result &= test(a40, 224, '4beabeb77adf912c2270c455dd215f818662c0d61b85508c7def6a73');
console.log(result ? 'Passed' : 'Failed');
console.log('SHA-256');
var result = true;
result &= test([], 256, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
result &= test([255], 256, 'a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89');
result &= test(a40, 256, '9792f39846b22bee11dbaa2a34014141c90cb4ef2f2c16dc83a48b0456f4705d');
console.log(result ? 'Passed' : 'Failed');
console.log('SHA-384');
var result = true;
result &= test([], 384, '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b');
result &= test([255], 384, '43950796d9883503655e35b5190aee687a2dd99f265012625b95753978e4efff3e8414d178a6e2318480d8eb6ddee643');
result &= test(a40, 384, '1fde9ca46c6d627edfbda629ce47e9101e803674e9156f9706d7a9406e5fe1c91e981e4276b37c78ce8c329b4a30a765');
console.log(result ? 'Passed' : 'Failed');
console.log('SHA-512');
var result = true;
result &= test([], 512, 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e');
result &= test([255], 512, '6700df6600b118ab0432715a7e8a68b0bf37cdf4adaf0fb9e2b3ebe04ad19c7032cbad55e932792af360bafaa09962e2e690652bc075b2dad0c30688ba2f31a3');
result &= test([97, 98, 99], 512, 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f');
test(a40, 512, 'a8e64de4f5fa72e7a1a1bee705d87acc50748a810482a088535e53ad741ed68fb0c7cb08035802f63d466ba629b13823705db763f5ec043918f20c2266c0a783');
console.log(result ? 'Passed' : 'Failed');
};
window._ripemd160Test = function () {
var test = function (bytes, hex) {
return bh.byteArrayToHex(hashAlgorithms.ripemd160.computeHash(bytes)) == hex;
};
var result = true;
result &= test([], '9c1185a5c5e9fc54612808977ee8f548b2258d31');
result &= test([255], '2c0c45d3ecab80fe060e5f1d7057cd2f8de5e557');
result &= test(a40, '7b78ec9d05702f000dbb1d88c2c941795b4f62bd');
console.log(result ? 'Passed' : 'Failed');
};
window._hashAlgoTest = function () {
console.log('md2'); _md2Test();
console.log('md4'); _md4Test();
console.log('md5'); _md5Test();
console.log('sha1'); _sha1Test();
_sha2Test();
console.log('ripemd160'); _ripemd160Test();
};
})();
|
#!/usr/bin/env node
const NumberUtil = require("../js/lib/number-util.js");
var Z80_assemble = require('../js/Z80/assembler');
var MZ_TapeHeader = require('../js/lib/mz-tape-header');
var changeExt = require('../js/lib/change-ext.js');
var fs = require('fs');
var getPackageJson = require("./lib/get-package-json");
var npmInfo = getPackageJson(__dirname + "/..");
var Getopt = require('node-getopt');
var getopt = new Getopt([
['m', 'map=FILENAME', 'output map file name'],
['z', 'output-MZT-header', 'output MZT header'],
['a', 'loading-address=ADDR', 'set loading address'],
['e', 'execution-address=ADDR', 'set execution address'],
['t', 'reuse-mzt-header=FILENAME', "reuse the MZT header."],
['o', 'output-file=FILENAME', 'filename to output'],
['h', 'help', 'display this help'],
['v', 'version', 'show version']
]);
var cli = getopt.parseSystem();
var description = "A simple Z80 assembler -- " + npmInfo.name + "@" + npmInfo.version;
getopt.setHelp(
"Usage: mzasm [OPTION] filename [filename ...]\n" +
description + "\n" +
"\n" +
"[[OPTIONS]]\n" +
"\n" +
"Installation: npm install -g mz700-js\n" +
"Repository: https://github.com/takamin/mz700-js");
if(cli.options.help) {
getopt.showHelp();
process.exit(0);
}
if(cli.options.version) {
console.log(description);
process.exit(0);
}
var args = require("hash-arg").get(["input_filenames:string[]"], cli.argv);
if(cli.argv.length < 1) {
console.error('error: no input file');
process.exit(-1);
}
// Determine the output filename
var output_filename = null;
if('output-file' in cli.options) {
output_filename = cli.options['output-file'];
} else {
var ext = null;
if('reuse-mzt-header' in cli.options
|| 'output-MZT-header' in cli.options)
{
ext = ".mzt";
} else {
ext = ".bin";
}
let input_filename = args.input_filenames[0];
output_filename = changeExt(input_filename, ext);
}
// Determine filename of address map
var fnMap = null;
if('map' in cli.options) {
fnMap = cli.options['map'];
} else {
fnMap = changeExt(output_filename, ".map");
}
//
// MZT-Header
//
var mzt_header = null;
if('reuse-mzt-header' in cli.options) {
//
// Load MZT-Header from other MZT-File.
//
var mzt_filebuf = fs.readFileSync(cli.options['reuse-mzt-header']);
mzt_header = new MZ_TapeHeader(mzt_filebuf, 0);
} else if('output-MZT-header' in cli.options) {
//
// Create MZT-Header from the informations specified in command line options
//
var load_addr = 0;
var exec_addr = 0;
if('loading-address' in cli.options) {
load_addr = parseInt(cli.options['loading-address'], 0);
exec_addr = load_addr;
}
if('execution-address' in cli.options) {
exec_addr = parseInt(cli.options['execution-address'], 0);
}
mzt_header = MZ_TapeHeader.createNew();
mzt_header.setFilename(output_filename);
mzt_header.setAddrLoad(load_addr);
mzt_header.setAddrExec(exec_addr);
}
(async function() {
let sources = [];
await Promise.all(args.input_filenames.map( input_filename => {
return new Promise( (resolve, reject) => {
fs.readFile(input_filename, 'utf-8', function(err, data) {
if(err) {
reject(err);
} else {
sources.push(data);
resolve(data);
}
});
});
}));
//
// Assemble
//
let asm = Z80_assemble.assemble(sources);
//
// Set binary size to MZT Header
//
var mzt_header_buf = [];
if(mzt_header != null) {
if(mzt_header.addrLoad == 0) {
mzt_header.setAddrLoad(asm.minAddr);
}
if(mzt_header.addrExec == 0) {
mzt_header.setAddrExec(asm.minAddr);
}
mzt_header.setFilesize(asm.buffer.length);
mzt_header_buf = mzt_header.buffer;
}
//
// Write out
//
fs.writeFileSync(
output_filename,
Buffer.from(mzt_header_buf.concat(asm.buffer)));
//
// Output address map
//
let map = Z80_assemble.hashMapArray(asm.label2value).map(function(item) {
return [item.label, ":\t", NumberUtil.HEX(item.address, 4), "H"].join('');
}).join("\n");
if(map.length > 0) {
fs.writeFileSync(fnMap, map);
}
}());
|
var path = require('path');
var gulp = require('gulp');
var tsc = require('gulp-tsc');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var compass = require('gulp-compass');
const CONF_PATH = 'conf/';
const SRC_PATH = 'frontend_src/';
const PUBLIC_PATH = 'public/';
gulp.task('tsc', function() {
gulp.src(_pj(SRC_PATH, 'ts/**/*.ts'))
.pipe(tsc({
target: 'ES5'
}))
.pipe(concat('app.js'))
.pipe(uglify({
outSourceMap: true
}))
.pipe(gulp.dest(_pj(PUBLIC_PATH, 'js')))
});
gulp.task('compass', function() {
gulp.src(_pj(SRC_PATH, 'sass/**/*.sass'))
.pipe(compass({
config_file : _pj(CONF_PATH, 'compass_config.rb'),
sass : _pj(SRC_PATH, 'sass'),
css : _pj(PUBLIC_PATH, 'css'),
sourcemap : true,
}));
});
gulp.task('develop', ['default'], function() {
gulp.watch([
_pj(SRC_PATH, 'ts/**/*.ts')
], ['tsc']);
gulp.watch([
_pj(SRC_PATH, 'sass/**/*.sass')
], ['compass']);
});
gulp.task('default', ['compass', 'tsc']);
function _pj() {
return path.join.apply(null, arguments);
}
|
[25, "hi", true]
|
import Page from '../layouts/page';
import MainContent from '../layouts/main-content';
import PersonHeader from '../components/person-header';
import LevelContainer from '../components/level-container';
export default () => (
<Page>
<PersonHeader />
<MainContent>
<LevelContainer />
</MainContent>
</Page>
);
|
_tmpl.link_entity = function( entity, tagName, returnHTML, count ){
if( !entity )
return false
if( tagName && typeof tagName == 'object' )
return _tmpl.link_entity(
entity,
tagName['tagName'] || null,
tagName['returnHTML'] || null,
tagName['count'] || null
)
tagName = tagName || 'a'
returnHTML = returnHTML || false
count = typeof count == 'undefined' ? false : count
if( typeof entity != 'object' ){
var entityId = parseInt(entity)
entity = _g.data.entities[entityId]
}else{
var entityId = entity['id']
}
return _tmpl.export(
'<' + tagName
+ (tagName == 'a' ? ' href="?infos=entity&id='+entityId+'"' : '')
+ ' class="link_entity" data-entityid="' + entityId + '" data-infos="[[ENTITY::' + entityId + ']]">'
+ (entity.picture && entity.picture.avatar
? '<i style="background-image:url(' + entity.picture.avatar + ')"></i>'
: '<i></i>'
)
+ '<span>'
+ entity._name
+ ( typeof count == 'undefined'
? ''
: ' <small>(' + count + ')</small>'
)
+ '</span>'
+ '</' + tagName + '>',
returnHTML
)
}
|
/* eslint-disable no-await-in-loop */
const assert = require('assert');
const TestUtils = require('../utils');
const query1 = `SELECT 1 AS id, 'blue' AS color`;
function wait(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function testBatchToCompletion(config) {
const utils = new TestUtils(config);
await utils.init(true);
const connection = await utils.post('admin', '/api/connections', {
name: 'test connection',
driver: 'sqlite',
data: {
filename: './test/fixtures/sales.sqlite',
},
});
let batch = await utils.post('admin', `/api/batches`, {
connectionId: connection.id,
batchText: query1,
});
while (batch.status !== 'finished' && batch.status !== 'error') {
await wait(25);
batch = await utils.get('admin', `/api/batches/${batch.id}`);
}
const statements = await utils.get(
'admin',
`/api/batches/${batch.id}/statements`
);
const statement1 = statements[0];
let result1 = await utils.get(
'admin',
`/api/statements/${statement1.id}/results`
);
assert.deepEqual(result1, [[1, 'blue']], 'results as expected');
// remove should succeed
await utils.models.statements.removeById(statement1.id);
await utils.get('admin', `/api/statements/${statement1.id}/results`, 404);
}
describe('api/query-result-stores', function () {
it('file', async function () {
return testBatchToCompletion({ queryResultStore: 'file' });
});
it('redis', async function () {
const available = await TestUtils.redisAvailable('redis://localhost:6379');
if (!available || process.env.SKIP_INTEGRATION === 'true') {
return this.skip();
}
return testBatchToCompletion({
queryResultStore: 'redis',
redisUri: 'redis://localhost:6379',
});
});
it('database', async function () {
return testBatchToCompletion({
queryResultStore: 'database',
});
});
it('memory', async function () {
return testBatchToCompletion({
queryResultStore: 'memory',
});
});
});
|
import { h } from 'omi';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(h("path", {
d: "M22 4H2v16h20V4zm-2 4l-8 5-8-5V6l8 5 8-5v2z"
}), 'MailSharp');
|
/* file : collection-test.js
MIT License
Copyright (c) 2016 Thomas Minier
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';
require('chai').should();
const Collection = require('../../src/collections/collection.js');
describe('Collection', () => {
it('should be abstract', () => {
(() => new Collection()).should.throw(TypeError);
});
});
|
/*
* Kendo UI v2015.1.408 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
(function(f, define){
define([], f);
})(function(){
(function( window, undefined ) {
var kendo = window.kendo || (window.kendo = { cultures: {} });
kendo.cultures["pa-Arab-PK"] = {
name: "pa-Arab-PK",
numberFormat: {
pattern: ["- n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
percent: {
pattern: ["% n-","% n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "%"
},
currency: {
pattern: ["-$ n","$ n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "Rs"
}
},
calendars: {
standard: {
days: {
names: ["پير","منگل","بدھ","جمعرات","جمعه","هفته","اتوار"],
namesAbbr: ["پير","منگل","بدھ","جمعرات","جمعه","هفته","اتوار"],
namesShort: ["پ","م","ب","ج","ج","ه","ا"]
},
months: {
names: ["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],
namesAbbr: ["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"]
},
AM: ["AM","am","AM"],
PM: ["PM","pm","PM"],
patterns: {
d: "dd-MM-yy",
D: "dd MMMM yyyy dddd",
F: "dd MMMM yyyy dddd h.mm.ss tt",
g: "dd-MM-yy h.mm tt",
G: "dd-MM-yy h.mm.ss tt",
m: "dd MMMM",
M: "dd MMMM",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "h.mm tt",
T: "h.mm.ss tt",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "MMMM, yyyy",
Y: "MMMM, yyyy"
},
"/": "-",
":": ".",
firstDay: 1
}
}
}
})(this);
return window.kendo;
}, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
|
import {
VFadeTransition,
VSlideXTransition
} from '~components/transitions'
export default {
name: 'v-progress-linear',
components: {
VFadeTransition,
VSlideXTransition
},
props: {
active: {
type: Boolean,
default: true
},
buffer: Boolean,
bufferValue: Number,
error: Boolean,
height: {
type: [Number, String],
default: 7
},
indeterminate: Boolean,
info: Boolean,
secondary: Boolean,
success: Boolean,
query: Boolean,
warning: Boolean,
value: {
type: [Number, String],
default: 0
},
colorFront: {
type: String,
default: null
},
colorBack: {
type: String,
default: null
}
},
computed: {
classes () {
return {
'progress-linear--query': this.query,
'progress-linear--secondary': this.secondary,
'progress-linear--success': this.success,
'progress-linear--info': this.info,
'progress-linear--warning': this.warning,
'progress-linear--error': this.error
}
},
styles () {
const styles = {}
if (!this.active) {
styles.height = 0
}
if (this.buffer) {
styles.width = `${this.bufferValue}%`
}
return styles
},
bufferStyles () {
const styles = {}
if (!this.active) {
styles.height = 0
}
return styles
}
},
methods: {
genDeterminate (h) {
return h('div', {
ref: 'front',
class: ['progress-linear__bar__determinate', this.colorFront],
style: { width: `${this.value}%` }
})
},
genBar (h, name) {
return h('div', {
class: [
'progress-linear__bar__indeterminate',
name,
this.colorFront
]
})
},
genIndeterminate (h) {
return h('div', {
ref: 'front',
class: {
'progress-linear__bar__indeterminate': true,
'progress-linear__bar__indeterminate--active': this.active
}
}, [
this.genBar(h, 'long'),
this.genBar(h, 'short')
])
}
},
render (h) {
const fade = h('v-fade-transition', [this.indeterminate && this.genIndeterminate(h)])
const slide = h('v-slide-x-transition', [!this.indeterminate && this.genDeterminate(h)])
const bar = h('div', { class: ['progress-linear__bar', this.colorBack], style: this.styles }, [fade, slide])
return h('div', {
class: ['progress-linear', this.classes],
style: { height: `${this.height}px` },
on: this.$listeners
}, [bar])
}
}
|
"use strict";
var fs = require("fs");
var path = require("path");
var Sequelize = require("sequelize");
const appRoot = require('app-root-path');
const config = require(`${appRoot}/lib/config`)();
const sequelize = new Sequelize(config.db);
var db = {};
fs
.readdirSync(__dirname)
.filter(function(file) {
return (file.indexOf(".") !== 0) && (file !== "index.js");
})
.forEach(function(file) {
var model = sequelize.import(path.join(__dirname, file));
db[model.name] = model;
});
console.log(db);
Object.keys(db).forEach(function(modelName) {
if ("associate" in db[modelName]) {
console.log('SE ASOCIA : ' + modelName + db)
db[modelName].associate(db);
console.log("MODELO" + db[modelName]);
}
});
// db['Page'].belongsTo(db['Unit']);
// db['Unit'].hasMany(db['Page'], {as: 'Pages'})
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;
|
import test from 'ava'
import configureStore from 'redux-mock-store'
import { mount } from 'enzyme'
import { createElement } from 'react'
import Home from '../../src/containers/home'
const mockStore = configureStore()
test('home', t => {
const store = mockStore()
const wrapper = mount(createElement(Home, {
store
}))
t.is(wrapper.find('h1').text(), 'Home')
})
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (calc, node, precision) {
var str = stringify(node, precision);
if (node.type === "MathExpression") {
// if calc expression couldn't be resolved to a single value, re-wrap it as
// a calc()
str = calc + "(" + str + ")";
}
return str;
};
var order = {
"*": 0,
"/": 0,
"+": 1,
"-": 1
};
function round(value, prec) {
if (prec !== false) {
var precision = Math.pow(10, prec);
return Math.round(value * precision) / precision;
}
return value;
}
function stringify(node, prec) {
switch (node.type) {
case "MathExpression":
{
var left = node.left,
right = node.right,
op = node.operator;
var str = "";
if (left.type === 'MathExpression' && order[op] < order[left.operator]) str += "(" + stringify(left, prec) + ")";else str += stringify(left, prec);
str += " " + node.operator + " ";
if (right.type === 'MathExpression' && order[op] < order[right.operator]) str += "(" + stringify(right, prec) + ")";else str += stringify(right, prec);
return str;
}
case "Value":
return round(node.value, prec);
case 'CssVariable':
return node.value;
default:
return round(node.value, prec) + node.unit;
}
}
module.exports = exports["default"];
|
import { assert, expect } from 'chai';
import 'angular';
import 'angular-mocks/angular-mocks';
import '../src/component';
describe('User factory', ()=>{
var Client;
beforeEach(angular.mock.module('component'));
beforeEach(angular.mock.inject(function(_client_) {
Client = _client_;
}));
it('sould return "default" when calling loggedUser ', ()=> {
expect(Client.loggedUser()).to.be.equal('default');
});
});
|
export const flatTree = (tree, getBody = node => node.body) => {
let flatList = [];
[].concat(tree).forEach(node => {
const body = getBody(node);
if (body && body.length) {
flatList = flatList.concat(node, flatTree(body, getBody));
} else {
flatList.push(node);
}
});
return flatList;
};
|
var People = function(names) {
this.allNames = [];
names.forEach(function(name) {
name = name.charAt(0).toUpperCase() + name.slice(1);
this.allNames.push(name);
}.bind(this));
};
People.prototype.getNames = function() {
return this.allNames;
};
People.prototype.sort = function() {
this.allNames.sort();
return this.getNames();
};
|
var Watcher = require('./watcher')
var middleware = require('./middleware')
var http = require('http')
var connect = require('connect')
exports.serve = serve
function serve (builder, options) {
options = options || {}
console.log('Serving on http://' + options.host + ':' + options.port + '\n')
var watcher = options.watcher || new Watcher(builder, {verbose: true})
var app = connect().use(middleware(watcher))
var server = http.createServer(app)
// We register these so the 'exit' handler removing temp dirs is called
function cleanupAndExit() {
builder.cleanup().catch(function(err) {
console.error('Cleanup error:')
console.error(err && err.stack ? err.stack : err)
}).finally(function() {
process.exit(1)
})
}
process.on('SIGINT', cleanupAndExit)
process.on('SIGTERM', cleanupAndExit)
watcher.on('change', function(results) {
console.log('Built - ' + Math.round(results.totalTime / 1e6) + ' ms @ ' + new Date().toString())
})
watcher.on('error', function(err) {
console.log('Built with error:')
// Should also show file and line/col if present; see cli.js
if (err.file) {
console.log('File: ' + err.file)
}
console.log(err.stack)
console.log('')
})
server.listen(parseInt(options.port, 10), options.host)
}
|
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});
Router.map(function() {
this.route('home', { path: '/' });
this.route('apple');
this.route('banana');
this.route('coconut');
this.route('durian');
this.route('elderberry');
this.route('fig');
this.route('grape');
this.route('honeydew');
});
export default Router;
|
var backgrounds = [
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/google_hq_azlr3e.jpg')",
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/apple_hq_bmqqhh.jpg')",
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/microsoft_hq_c88f8g.jpg')",
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/facebook_hq_bb66i0.jpg')",
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/twitter_hq_cshigs.jpg')",
"url('http://res.cloudinary.com/dklyjqkxa/image/upload/v1476149119/facebook_hq2_q3fuww.jpg')"
// "img/hq/google_hq.jpg",
// "img/hq/apple_hq.jpg",
// "img/hq/microsoft_hq.jpg",
// "img/hq/facebook_hq.jpg",
// "img/hq/twitter_hq.jpg",
// "img/hq/facebook_hq2.jpg"
];
// var images = [];
//
// function preload(){
// for (var i=0; i<backgrounds.length; i++){
// images[i] = new Image();
// images[i].src = backgrounds[i];
// }
// }
var check = true;
var slideIndex =-1;
// preload();
auto();
function auto() {
if (check) {
slideIndex+=1;
carousel();
setTimeout(auto, 8000);
}
}
function currentDiv(n) {
if (check) {
slideIndex = n;
carousel();
}
}
function carousel() {
var i;
check = false;
var x = document.getElementsByClassName("imageselect");
if (slideIndex>=backgrounds.length){slideIndex=0}
for (i=0; i< x.length; i++) {
x[i].className = x[i].className.replace(" whitehover", "");
}
x[slideIndex].className += " whitehover";
document.getElementsByClassName("header")[0].style.background = backgrounds[slideIndex];
document.getElementsByClassName("header")[0].style.backgroundSize = "cover";
document.getElementsByClassName("header")[0].style.backgroundPosition = "center";
setTimeout(function(){
check = true;
}, 500);
}
|
import React from 'react';
import styles from './button.css';
let Button = React.createClass({
render() {
return (
<div className={styles.container}>
<button className={styles.button}>Click me!</button>
</div>
);
}
});
React.render(<Button />, document.getElementById('content'));
|
Package.describe({
summary: 'Meteor package to wrap TopoJSON: An extension to GeoJSON that encodes topology'
});
Package.on_use(function(api) {
api.export('topojson');
api.add_files('meteor-topojson.js', 'server');
api.add_files('topojson.js', 'client');
});
Package.on_test(function (api) {
api.use(['topojson', 'tinytest']);
api.add_files('topojson_tests.js', ['server', 'client']);
});
Npm.depends({
topojson: '1.6.8'
});
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=property.js.map
|
describe('ds.utils.loadGoogleMapsAPI()', function() {
this.timeout(20000);
it('should load google maps api', function(done) {
ds.utils.loadGoogleMapsAPI().done(function(google) {
expect(google).to.be.an('object');
done();
});
});
it('should not make a http request second time google is requested', function(done) {
var start = new Date().getTime();
ds.utils.loadGoogleMapsAPI().done(function() {
var elapsed = new Date().getTime() - start;
expect(elapsed).to.be.lessThan(10);
done();
});
});
});
|
import { Resource } from '../api-resource';
import logger from 'kolibri.lib.logging';
const logging = logger.getLogger(__filename);
export default class FacilityUserResource extends Resource {
static resourceName() {
return 'facilityuser';
}
getCurrentFacility() {
const promise = new Promise(
resolve => {
this.client({ path: this.currentFacilityUrl() }).then(
response => {
resolve(response.entity);
},
response => {
logging.error('An error occurred', response);
}
);
},
reject => {
reject(reject);
}
);
return promise;
}
get currentFacilityUrl() {
return this.urls[`currentfacility_list`];
}
}
|
module.exports = (config) => {
const defaults = {
isWarmingUp: (event) => event.source === 'serverless-plugin-warmup',
onWarmup: (event) => console.log('Exiting early via warmup Middleware'),
waitForEmptyEventLoop: null
}
const options = Object.assign({}, defaults, config)
return ({
before: (handler, next) => {
if (options.isWarmingUp(handler.event)) {
options.onWarmup(handler.event)
if (options.waitForEmptyEventLoop !== null) {
handler.context.callbackWaitsForEmptyEventLoop = Boolean(options.waitForEmptyEventLoop)
}
return handler.callback(null, 'warmup')
}
next()
}
})
}
|
'use strict'
var Transform = require('stream').Transform
, util = require('util')
, Segment = require('./segment')
, Message = require('./message')
, utils = require('./utils')
// MLP end frames
var FS = String.fromCharCode(0x1c)
, CR = String.fromCharCode(0x0d)
exports.Message = Message
exports.Segment = Segment
exports.Parser = Parser
exports.utils = utils
/**
* Constructor
*/
function Parser() {
var opts = { objectMode: true }
if (!(this instanceof Parser))
return new Parser(opts)
Transform.call(this, opts)
this._messages = []
this.current = null
}
util.inherits(Parser, Transform)
Parser.prototype._tryParseSegment = function _tryParseSegment(data, delims) {
var self = this
try {
return new Segment(data, delims)
} catch (err) {
self.emit('error', err)
return null
}
}
/**
* Transform for parser
*
* **NOTE: The stream should have been pipe through `split()` already**
*
* @param {Buffer} data The segment as a buffer
* @param {String} encoding The encoding of the buffer
* @param {Function} cb function(err, res)
* @api private
*/
Parser.prototype._transform = function(data, encoding, done) {
var delims = this.current
? this.current.delimiters()
: null
var segment = this._tryParseSegment(data, delims)
if (!segment) return
if (segment && segment.parsed) {
var isHeader = utils.segmentIsHeader(segment)
if (isHeader && this.current) {
this.emit('message', this.current)
var message = new Message()
message.addSegment(segment)
this._messages.push(message)
this.current = message
} else if (isHeader && !this.current) {
this.current = new Message()
this.current.addSegment(segment)
} else {
this.current.addSegment(segment)
}
/*
If the message ended with FS+CR, this indicates the end of the message
and it should be pushed over the transform stream now.
http://www.hl7standards.com/blog/2007/05/02/hl7-mlp-minimum-layer-protocol-defined/
*/
if (data.indexOf(FS + CR) !== -1) {
this.emit('message', this.current)
this.current = null
}
}
done()
}
Parser.prototype._flush = function(done) {
if (this.current && this.current.segments.length) {
this.emit('message', this.current)
this._messages.push(this.current)
this.current = null
}
this.emit('messages', this._messages)
done()
}
|
'use strict';
import imageSearchPage from '../../pageobjects/image-search.page';
module.exports = function() {
this.Given(/^I am on the google image search page$/, () => {
imageSearchPage.open();
});
// Enter term in search: google.js
this.Given(/^I press the image search button$/, () => {
imageSearchPage.pressSearchButton();
});
this.Then(/^I see the results of my image search$/, () => {
expect(imageSearchPage.searchResults).toBeTruthy();
});
};
|
import React from 'react'
import { mount, shallow } from 'enzyme'
import { Dummy } from './utils'
import { withHandlers } from '..'
describe('withHandlers', () => {
it('passes immutable handlers', () => {
const enhance = withHandlers({
handler: () => () => null,
})
const EnhancedDummy = enhance(Dummy)
expect(EnhancedDummy.displayName).toBe('withHandlers(Dummy)')
const wrapper = shallow(<EnhancedDummy />)
const handler = wrapper.prop('handler')
wrapper.setProps({ foo: 'bar' })
expect(wrapper.prop('foo')).toBe('bar')
expect(wrapper.prop('handler')).toBe(handler)
})
it('caches handlers properly', () => {
const handlerCreationSpy = jest.fn()
const handlerCallSpy = jest.fn()
const enhance = withHandlers({
handler: props => {
handlerCreationSpy(props)
return val => {
handlerCallSpy(val)
}
},
})
const EnhancedDummy = enhance(Dummy)
const wrapper = shallow(<EnhancedDummy foo="bar" />)
const handler = wrapper.prop('handler')
// Don't create handler until it is called.
expect(handlerCreationSpy).toHaveBeenCalledTimes(0)
expect(handlerCallSpy).toHaveBeenCalledTimes(0)
handler(1)
expect(handlerCreationSpy).toHaveBeenCalledTimes(1)
expect(handlerCreationSpy).toHaveBeenCalledWith({ foo: 'bar' })
expect(handlerCallSpy).toHaveBeenCalledTimes(1)
expect(handlerCallSpy).toHaveBeenCalledWith(1)
// Props haven't changed; should use cached handler.
handler(2)
expect(handlerCreationSpy).toHaveBeenCalledTimes(1)
expect(handlerCallSpy).toHaveBeenCalledTimes(2)
expect(handlerCallSpy.mock.calls[1]).toEqual([2])
wrapper.setProps({ foo: 'baz' })
handler(3)
// Props did change; handler should be recreated.
expect(handlerCreationSpy).toHaveBeenCalledTimes(2)
expect(handlerCreationSpy.mock.calls[1]).toEqual([{ foo: 'baz' }])
expect(handlerCallSpy).toHaveBeenCalledTimes(3)
expect(handlerCallSpy.mock.calls[2]).toEqual([3])
})
it('throws if handler is not a higher-order function', () => {
/* eslint-disable no-console */
const originalError = console.error
console.error = jest.fn()
const EnhancedDummy = withHandlers({
foo: () => {},
})(Dummy)
const wrapper = shallow(<EnhancedDummy />)
expect(() => wrapper.prop('foo').call()).toThrowError()
expect(console.error).toBeCalledWith(
// eslint-disable-line no-console
'withHandlers(): Expected a map of higher-order functions. ' +
'Refer to the docs for more info.',
)
console.error = originalError
/* eslint-enable no-console */
})
it('allows handers to be a factory', () => {
const enhance = withHandlers(initialProps => {
let cache
return {
handler: () => () => {
if (cache) {
return cache
}
cache = { ...initialProps }
return cache
},
}
})
const componentHandlers = []
const componentHandlers2 = []
const Component = enhance(({ handler }) => {
componentHandlers.push(handler())
return null
})
const Component2 = enhance(({ handler }) => {
componentHandlers2.push(handler())
return null
})
const wrapper = mount(<Component hello="foo" />)
wrapper.setProps({ hello: 'bar' })
expect(componentHandlers[0]).toBe(componentHandlers[1])
// check that cache is not shared
mount(<Component2 hello="foo" />)
expect(componentHandlers[0]).toEqual(componentHandlers2[0])
expect(componentHandlers[0]).not.toBe(componentHandlers2[0])
})
})
|
var lexer = require('../../index').lex.lexer;
var parser = require('../../index').parse.parser;
var $ = require('../$');
var testParser = function(stream) {
var result = parser.parseStream(stream);
return result.body[0].expression;
};
exports.empty = function(test) {
var result = testParser(lexer.lex("({});"));
test.equal(result.properties.length, 0);
test.done();
};
exports.init_values = function(test) {
var result = testParser(lexer.lex("({ 'a': 0 , 'b': 1, '9': 2});"));
test.equal(result.properties.length, 3);
test.equal(result.properties[0].type, 'ObjectValue');
$.string(test, result.properties[0].key, 'a');
$.number(test, result.properties[0].value, 0);
test.equal(result.properties[1].type, 'ObjectValue');
$.string(test, result.properties[1].key, 'b');
$.number(test, result.properties[1].value, 1);
test.equal(result.properties[2].type, 'ObjectValue');
$.string(test, result.properties[2].key, '9');
$.number(test, result.properties[2].value, 2);
test.done();
};
exports.init_values = function(test) {
var result = testParser(lexer.lex("({ catch: 0 , true: 1, null: 2});"));
test.equal(result.properties.length, 3);
test.equal(result.properties[0].type, 'ObjectValue');
$.id(test, result.properties[0].key, 'catch');
$.number(test, result.properties[0].value, 0);
test.equal(result.properties[1].type, 'ObjectValue');
$.id(test, result.properties[1].key, 'true');
$.number(test, result.properties[1].value, 1);
test.equal(result.properties[2].type, 'ObjectValue');
$.id(test, result.properties[2].key, 'null');
$.number(test, result.properties[2].value, 2);
test.done();
};
|
var locale = require('relative-time-format/locale/sr')
module.exports = {
locale: locale.locale,
// Standard styles.
long: locale.long,
short: locale.short,
narrow: locale.narrow,
// Quantifier.
quantify: locale.quantify
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.