Skip to content

Instantly share code, notes, and snippets.

View micahalles's full-sized avatar

Micah Alles micahalles

View GitHub Profile
$("#my-template").expand({
name: "Cooking with Crowley",
author: { name: "Shawn Crowley" }
})
@micahalles
micahalles / expand.js
Created July 11, 2011 03:07
Selectors
$("#my-template").expand({
"$h2": "Cooking with Crowley",
"$.content p.excerpt": "Step 1, light the grill. Step 2..."
})
@micahalles
micahalles / expand.js
Created July 11, 2011 03:11
Setting Properties
$("#my-template").expand({
"$input[name=like]": { ":checked": true }
})
@micahalles
micahalles / expand.js
Created July 11, 2011 03:12
Calling Functions
$("#my-template").expand({
author: { "addClass()": "awesome" },
"$input[name=comment]": { "val()": "nice post!" }
})
@micahalles
micahalles / expand.js
Created July 11, 2011 03:14
Removing Elements
$("#my-template").expand({ author: false })
@micahalles
micahalles / expand.js
Created July 11, 2011 03:16
Functions
var comments = ["Sounds delicious!", "What next?!?"];
// or, if there are no comments
// var comments = [];
$("#my-template").expand({
content: "Step 1, light the grill. Step 2...",
comments: function(el) {
if (comments.length == 0) {
return false; // this will remove the comments div
@micahalles
micahalles / expand.js
Created July 11, 2011 03:19
Nesting and Functions and Arrays, oh my!
var comments = [
{ author: "Dave Crosby", approved: true, text: "Sounds Delicous!" },
{ author: "Micah Alles", approved: false, text: "What next?!?" },
{ author: "Drew Colthorp", approved: true, text: "Thanks for the info." }
];
$("#my-template").expand({
content: "Step 1, light the grill. Step 2...",
comments: function(el) {
var approvedComments = [];
Motion::Project::App.setup do |app|
...
app.codesign_certificate = File.read(".devcert").strip if File.exists?(".devcert")
...
end
iPhone Developer: Micah Alles (S54AU7NS4Z)