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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
</head> | |
<body> | |
<button onclick="set(s1)">set 1</button> | |
<button onclick="set(s2)">set 2</button> | |
<button onclick="set(s3)">set 3</button> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
</head> | |
<body> | |
<button onclick="clear2()">clear</button> | |
<button onclick="set(s1)">set 1</button> | |
<button onclick="set(s2)">set 2</button> |
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
function flatten(arr) { | |
var arr2 = []; | |
function getValue(val) { | |
if (Array.isArray(val)) { | |
val.forEach(getValue) | |
} | |
else { | |
arr2.push(val); | |
} |
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
> db.items.find().pretty() | |
{ | |
"_id" : "undefined", | |
"_v" : "d951efc6-6869-4f08-bf6d-34b14373cabc 1461410356438|ed5b43c1-59f9-4208-8e20-1b1e4a44325a 1461780511277|b97b82c8-ad20-4e72-8eff-dee460b425e5 1461900 075779", | |
"_ops" : [ | |
{ | |
"type" : "stringSet", | |
"collectionName" : "items", | |
"docId" : "319094ef-bb35-4057-9a84-ea8eefe4f1c6", | |
"value" : [ ], |
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
vagrant@vagrant-ubuntu-trusty-64:/data/tmp/amelisa-crud-example$ npm i | |
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0. | |
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
npm ERR! Linux 3.13.0-55-generic | |
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" | |
npm ERR! node v5.11.0 | |
npm ERR! npm v3.8.6 | |
npm ERR! Maximum call stack size exceeded |
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: src="./home"> | |
<import: src="./list"> | |
<import: src="./things"> | |
<!-- | |
Derby templates are similar to Handlebars, except that they are first | |
parsed as HTML, and there are a few extensions to make them work directly | |
with models. A single HTML template defines the HTML output, the event | |
handlers that update the model after user interaction, and the event handlers | |
that update the DOM when the model changes. |
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
<Body:> | |
<div class="jumbotron"> | |
<h1>Hello world!</h1> | |
<p>Click the buttons in varying order and follow the console...</p> | |
<p><button class="btn" x-bind="click:assign1">set _page.user.section[1] = 'hello 1'</button></p> | |
<p><button class="btn" x-bind="click:assign2">set _page.user.section['abc'] = 'hello 2'</button></p> | |
</div> |
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
app = require('derby').createApp(module) | |
.use(require 'derby-ui-boot') | |
.use(require '../../ui/index.coffee') | |
# ROUTES # | |
# Derby routes are rendered on the client and the server | |
app.get '/', (page) -> | |
page.render 'home' |
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
test | |
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
# Linear partition | |
# Partitions a sequence of non-negative integers into k ranges | |
# Based on Óscar López implementation in Python (http://stackoverflow.com/a/7942946) | |
# Also see http://www8.cs.umu.se/kurser/TDBAfl/VT06/algorithms/BOOK/BOOK2/NODE45.HTM | |
# Dependencies: UnderscoreJS (http://www.underscorejs.org) | |
# Example: linear_partition([9,2,6,3,8,5,8,1,7,3,4], 3) => [[9,2,6,3],[8,5,8],[1,7,3,4]] | |
linear_partition = (seq, k) => | |
n = seq.length | |