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 lang="en"> | |
| <head> | |
| <script type="text/javascript" src="soundmanager/script/soundmanager2.js"></script> | |
| <script type="text/javascript" src="index.js"></script> | |
| <title>Grrrr!</title> | |
| </head> | |
| <body> | |
| <p id="debug1">Nothing works! ♥</p> |
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
| app.get("/users/:username/sites", function(req, res) { | |
| riak.add("sites") | |
| .map(predicates.findByPropertyValue, ["owner", req.params.username]) | |
| .run(function(e, result, meta) { | |
| if (e) { | |
| res.fail("There was an error while getting sites for this user.", meta.statusCode); | |
| return; | |
| } | |
| res.ok(result, meta.statusCode); |
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 App = function() { | |
| var musicLoopFlag = 0, | |
| delay = null, | |
| frameNumber = 0, | |
| afterFirstLoop = 0, | |
| self = this; | |
| this.setup = function() { | |
| var assetCount = 59; // One for each image in the animation, plus one for the intro and one | |
| // for the loop of the song |
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
| // ES5 Array.slice polyfill. | |
| // Lets you easily turn array-like objects into actual arrays: | |
| // Array.slice(arguments).map(...); | |
| if (!Array.slice) { | |
| Array.slice = function(array, start, end) { | |
| return Array.prototype.slice.call(array, start, end); | |
| }; | |
| } |
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 riakClient = require("riak-js/client"); | |
| var riakHttpClient = require("riak-js/http_client"); | |
| riakClient.prototype.bucketPrefix = ""; | |
| riakClient.prototype.getBucketName = function(name) { | |
| var prefix = ""; | |
| if (this.bucketPrefix) prefix = this.bucketPrefix + "_"; | |
| return prefix + name; | |
| }; |
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
| /** | |
| * And this is the winning version thanks to @gf3. Using Object.keys().forEach() | |
| * is faster than for..in as benchmarked by @creationix here: | |
| * https://gist.github.com/75d0278890e6c5833add | |
| * According to @jdalton, this is because for..in looks up the prototype chain | |
| * while Object.keys looks at own keys. | |
| **/ | |
| var obj1 = { | |
| a: "a", |
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
| // Truncate a string to the closest word | |
| String.prototype.truncateToWord = function(length) { | |
| return this | |
| .slice(0, length + 1) | |
| .split(/\s+/) | |
| .slice(0, -1) | |
| .join(" "); | |
| }; | |
| // Examples |
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 Evented = (function() { | |
| var id = -1; | |
| function uid() { | |
| id++; | |
| return "evented" + id; | |
| } | |
| function getID(obj) { | |
| if (!("__eventedID" in obj)) { |
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 Router = require('geddy-core/lib/router').Router; | |
| router = new Router(); | |
| router.match('/').to({controller: 'Main', action: 'index'}); | |
| router.resource('stuffs'); | |
| exports.router = router; |