This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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') | |
, util = require('util'); | |
function Rewrite(name, options) { | |
Resource.apply(this, arguments); | |
this.rewriteUrl = this.config.rewriteUrl || '/index.html'; | |
} | |
util.inherits(Rewrite, Resource); | |
module.exports = Rewrite; |
This file contains hidden or 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
// AwaitScript sample compiled to JavaScript | |
var async = require('async'); | |
function recurse(path, fn) { | |
var files = []; | |
fs.readdir(path, function(err, dir) { | |
if (err) return fn(err); | |
async.forEach(dir, function(f, fn) { | |
fs.stat(f, function(err, stat) { | |
if (err) return fn(err); |
This file contains hidden or 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
/// <reference path="quintus.d.ts" /> | |
var Q = Quintus() | |
.include("Sprites, Scenes, Input"); | |
// No need to call Q.Sprite.extend | |
class Player extends Q.Sprite { | |
init(p) { | |
super.init(p, { | |
asset: "somegraphic.png", |
This file contains hidden or 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
class SessionsController < ApplicationController | |
layout 'basic' | |
def new | |
end | |
def create | |
puts params[:email] | |
puts params[:password] |
This file contains hidden or 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
// Paste this into the Developer Console for any project that uses jQuery | |
function stopMonkey() { | |
clearInterval(monkey); | |
} | |
monkey = setInterval(function() { | |
var $els = $('body').find('*:visible'); | |
var rand = Math.round(Math.random() * $els.length); | |
$els.eq(rand).click(); |
OlderNewer