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
// On GET /users | |
// Get all the todos that this user owns | |
if (query.includeTodos) { // Always make something like this a custom query; otherwise it's easy to bog down your server with unnecessary db calls | |
dpd.todos.get({userId: this.id}, function(res, err) { // Assuming that the userId property of a todo is set when you create it | |
this.todos = res; | |
}); | |
} |
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 Resource = require('deployd/lib/resource') | |
, Script = require('deployd/lib/script') | |
, util = require('util'); | |
function RouteEvent() { | |
Resource.apply(this, arguments); | |
} | |
util.inherits(RouteEvent, Resource); | |
RouteEvent.label = "Route Event"; |
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 'fs'; | |
require 'path'; | |
// Check recursively if any files from this directory have been modified since a certain date | |
async function isRecentlyModified(dir, since) { | |
var files; | |
try { | |
files = await fs.readdir(dir); | |
} catch (ex) { | |
console.error("Warning: " + dir + " does not exist") |
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
// departments has string parentId, string name | |
// On GET /departments | |
if (this.parentId) { | |
// Recursively build an array of parents | |
dpd.departments.get({id: parentId, $limitRecursion: 64}, function(parentDep) { | |
if (parentDep) { | |
this.parents = [parentDep.name]; | |
if (parentDep.parents) { | |
this.parents = parentDep.parents.concat(this.parents); | |
} |
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"> | |
</head> | |
<body> | |
<svg id="svgRoot"> | |
<g id="gElement"> | |
</g> |
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
declare module 'co' { | |
interface ICoStatic { | |
<T>(coroutine: () => IterableIterator<any>): Promise<T> | |
wrap<T>(coroutine: (...args: any[]) => IterableIterator<Promise<any>>): (...args: any[]) => Promise<T> | |
} | |
var co: ICoStatic; | |
export default co; | |
} |
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> | |
<title>Knockout Demo</title> | |
<script type="text/javascript" src="jquery-1.6.4.min.js"></script> | |
<script type="text/javascript" src="jquery.tmpl.js"></script> | |
<script type="text/javascript" src="knockout.js"></script> | |
<style type="text/css"> | |
.selected { | |
border: #FFFF00 3px solid; |
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
let fs = require('fs'); | |
let path = require('path'); | |
let less = require('less'); | |
let bluebird = require('bluebird'); | |
let css = require('css'); | |
async function execute() { | |
let variablesLess = await bluebird.fromNode(cb => fs.readFile(path.join(__dirname, 'less/variables.less'), 'utf-8', cb)); | |
let [parseResult] = await bluebird.fromNode(cb => less.parse(variablesLess, cb)); | |
let varNames = parseResult.rules |
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 FloatingElement = React.createClass({ | |
propTypes: { | |
children: React.PropTypes.element.isRequired, | |
floatingClassName: React.PropTypes.string | |
}, | |
getDefaultProps() { | |
return { | |
floatingClassName: 'floating' |
NewerOlder