// Source of true data
const actions = {
d: 'delete',
w: 'write/edit',
c: 'create',
r: 'read',
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Blade { | |
// edge (smooth, saw) [0, 3] | |
// needle/ending (pointy, blunt, hook, flat, ring,) | |
// damaged (undamaged, damaged) [0, 3] | |
// shape (straight, curved) [0, 3] | |
// decoration (undecorated, decorated) [0, 3] | |
// width (thin, fat) [0, 3] | |
// inscriptions (uninscribed, symbols, runes, symbols) | |
// material (wood, metal, stone, bone, glass, plastic, ceramic, paper, cardboard, fabric, leather, rubber, foam, wax, ice, food, other) | |
// color (red, orange, yellow, green, blue, purple, pink, brown, black, white, gray, other) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// frontend | |
import { DeepstreamClient } from "@deepstream/client"; | |
const client = new DeepstreamClient("localhost:6020"); | |
client.login(); | |
client.on("connectionStateChanged", (connectionState) => { | |
if (connectionState === "OPEN") { | |
const record = client.record.getRecord("sincrypto/users.01"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable, of } from 'rxjs' | |
import { skipWhile } from 'rxjs/operators | |
// ... | |
navigator.getUserMedia({ | |
"audio": true | |
}, (stream) => { | |
const buf = new Float32Array(1024) | |
const mediaStreamSource = window.audioContext.createMediaStreamSource(stream) | |
const analyser = window.audioContext.createAnalyser() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SOLUTION 1 (good performance) | |
function flat1(source) { | |
var s = "[" + JSON.stringify(source).replace(/\[|]/g,'') +"]"; | |
var flattened = JSON.parse(s); | |
} | |
console.log(flat1([[1,2,[3]],4, [[1,2,[3]],4], [[1,2,[3]],4], [[1,2,[3]],4]]); | |
// SOLUTION 2 (for small arrays) | |
function flat2(source, pos, prevs, final) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This module defines the tests for the faqEditor controller. | |
*/ | |
// Test dependencies | |
var mockery = require('mockery'); | |
var buster = require('buster'); | |
var assert = buster.referee.assert; | |
var expect = buster.referee.expect; | |
var sinon = require('sinon'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html | |
head | |
meta(name="viewport" content="width=device-width, initial-scale=1") | |
// | |
HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries | |
//if lt IE 9 | |
script(src='https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js') | |
script(src='https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js') | |
link(href='/public/css/bootstrap.css', rel='stylesheet') | |
link(href='/public/css/app.css', rel='stylesheet') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EValidator = require('evalidator'); | |
var mainObject = { | |
propertyObject: new PropertyObject(), | |
ev: new SuperEValidator() | |
}; | |
/** | |
* EValidator extension object | |
* @constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** WHY IS THIS IN NODE.JS ? **/ | |
// file1.js | |
var _ = require('underscore'); | |
require('./routes/document'); // _ will be NOT VISIBLE in document | |
// file2.js | |
_ = require('underscore'); | |
require('./routes/document'); // _ will be VISIBLE in document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('another_file.js'); | |
var whatever = 8; | |
function foo(){ | |
// calling a function from another file | |
foo_with_callback(function(returned_value){ | |
console.log(whatever) // whatever is undefined <--- WHY ??? | |
}); | |
NewerOlder