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
# inspired by: http://www.infovore.info/blog/2011/09/24/octopress-setup-and-drupal-migration/ | |
# simplified to be dropped in your root Octopress app directory, along with an export (.sql) of your mysql db. | |
###### Creates post in this basic format ###### | |
# --- | |
# layout: post | |
# title: #{title} | |
# date: #{time} | |
# comments: true |
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
someLoader('http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', function () { | |
if (!window.jQuery) { | |
someLoader('local/jquery.min.js', 'jquery.plugin.js'); | |
} else { | |
someLoader('jquery.plugin.js'); | |
} | |
}); |
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
Loader.load('http://json.org/modules/json2.js', | |
function(JSON) { | |
console.log(JSON.stringify([0, {a: true}])); | |
}); |
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
// defining a module | |
// making the hello method accessible | |
exports.hello = function() { | |
return 'Hello World' | |
}; | |
// require the module elsewhere such as app.js - application entry point |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>JavaScript Modules</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script> | |
<script> |
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
define( | |
//The name of this module | |
"one", | |
//The function to execute when all dependencies have loaded. The arguments | |
//to this function are the array of dependencies mentioned above. | |
function(Three) { | |
function One () { | |
this.stuff = []; |
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 socket = new WebSocket('ws://html5hacks.com/socket'); | |
// Once the socket connection is opened ... send a message to the server | |
socket.onopen = function(event) { | |
socket.send('Hello, Html5'); | |
}; | |
// Log any data pushed from the server | |
socket.onmessage = function(event) { | |
console.log(event.data); |
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
// Causes problems | |
// We need synchronous, but bad idea for performance | |
var Employee = require("types/Employee"); | |
function Manager () { | |
this.reports = []; | |
} | |
//Error if require call is async |
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
!!! 5 | |
//if lt IE 7 | |
html.no-js.ie6.oldie(lang='en') | |
//if IE 7 | |
html.no-js.ie7.oldie(lang='en') | |
//if IE 8 | |
html.no-js.ie8.oldie(lang='en') | |
//[if gt IE 8]><! | |
html.no-js(lang='en') | |
//<![end if] |
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
// 3. generate DOM movement | |
var i = -1; | |
while (i++ < num) { | |
characters[i] = new Character(400, 300, i); | |
characters[i].start(); | |
characterMap[characters[i].id] = characters[i]; | |
} |