Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
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
exports.sliceDomain = sliceDomain; | |
function sliceDomain (list, skip, limit) { | |
if (typeof skip === 'undefined') skip = 0; | |
if (limit < 0) | |
return list.slice(limit); | |
else | |
return list.slice(skip, skip + limit); | |
} |
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
DICTIONARY = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("") | |
encode = (i) -> | |
return DICTIONARY[0] if i is 0 | |
result = "" | |
base = DICTIONARY.length | |
while i > 0 | |
result += DICTIONARY[(i % base)] | |
i = Math.floor(i / base) | |
result.split("").reverse().join "" |
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 | |
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
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
<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
<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
# Whitelist collections | |
ALLOW_COLLECTIONS = { | |
'accounts': true | |
'users': true | |
} | |
module.exports = (shareClient) -> | |
# Hold on to session object for later use. The HTTP req object is only | |
# available in the connect event | |
shareClient.use 'connect', (shareRequest, next) -> |
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
Trace: { [MongoError: E11000 duplicate key error index: myapp.auths.$local.email_1 dup key: { : "[email protected]" }] | |
name: 'MongoError', | |
connectionId: 1963, | |
err: 'E11000 duplicate key error index: myapp.auths.$local.email_1 dup key: { : "[email protected]" }', | |
code: 11000, | |
n: 0, | |
ok: 1 } | |
at /opt/derby/myapp/node_modules/share/lib/server/session.js:660:19 | |
at /opt/derby/myapp/node_modules/share/lib/server/useragent.js:409:23 | |
at /opt/derby/myapp/node_modules/livedb/lib/index.js:342:15 |
OlderNewer