Skip to content

Instantly share code, notes, and snippets.

View micahalles's full-sized avatar

Micah Alles micahalles

View GitHub Profile
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
int fdin, fdout, retval;
char buf[2048];
ssize_t nread, nwrote;
fdin = open("readfile", O_RDONLY);
fdout = open("writefile", O_CREAT | O_WRONLY, 0644);
nread = read(fdin, buf, 2048);
nwrote = write(fdout, buf, (size_t)nread);
desc 'generate a class in lib/ and a spec in spec/lib/ for name=underscored_class_name'
task :genclass do
require 'erb'
filename = ENV['name']
raise 'must specify name=underscored_class_name' unless filename
classname = filename.camelize
class_file_template = ERB.new <<-EOF
class <%= classname %>
iPhone Developer: Micah Alles (S54AU7NS4Z)
Motion::Project::App.setup do |app|
...
app.codesign_certificate = File.read(".devcert").strip if File.exists?(".devcert")
...
end
@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 = [];
@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:14
Removing Elements
$("#my-template").expand({ author: false })
@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:11
Setting Properties
$("#my-template").expand({
"$input[name=like]": { ":checked": true }
})