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
// Set API key | |
$.flickr.settings.apiKey = '123' | |
// Option 1: Inline callbacks | |
$.flickr().photos.getRecent({ | |
size: 's' | |
page: 1, | |
beforeSend: function() { | |
$('img#waiting').fadeIn(); | |
}, |
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
// Set API Key | |
var flickr = $.flickr('123'); | |
// Request instance by invoking flickr service method | |
var recent = flickr.photos.getRecent({ | |
size: 's' | |
page: 1, | |
beforeSend: function() { | |
$('img#waiting').fadeIn(); | |
}, |
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
# attr_accessor is "syntatic sugar" for dynamically defining attribute | |
# readers and accessors. Foo and Bar are functionally equivilant. | |
# | |
# Remember @instance_variables are only visible in the scope | |
# of the instance. If you need to access them from outside the instance, | |
# they must be exposed through accessors. | |
class Foo | |
attr_accessor :bar | |
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
\documentclass[12pt,a4paper,titlepage]{article} | |
\usepackage{setspace} | |
\doublespacing | |
\title{Title} | |
\author{Author} | |
\begin{document} | |
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
def get_options(args) | |
args.inject({}) do |args, arg| | |
if arg =~ /^--(\w+)/ | |
key, value = $1.split('=') | |
args[key] = value | |
elsif arg =~ /^-(\w+)/ | |
options[$1.match(/(\w+)$/)[1]] = !$1.match(/^no-/) | |
end | |
args | |
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
def get_options(args) | |
args.inject({}) do |args, arg| | |
if arg =~ /^--(\S+)$/ | |
key, value = $1.split('=') | |
args[key] = value.nil? || value | |
elsif arg =~ /^-(no-?)(\S+)/ | |
if $1 == "no-" | |
args[$2] = false | |
else | |
args[$1] = true |
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
<div id="main"> | |
<%= flash_notifications %> | |
<div id="heading"> | |
<%= yield :heading %> | |
<div class="clear_both"> | |
</div> | |
</div> | |
<% if yield(:left_column) && yield(:right_column) %> | |
<div class="left_column"> | |
<%= yield :left_column %> |
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 'growl' | |
module Jekyll | |
class GrowlGenerator < Generator | |
safe false | |
def generate(site) | |
Growl.notify 'Building...', :title => 'Jekyll' | |
end | |
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
#!/bin/bash | |
FILENAME="dbname.$(date +'%Y%m%d%H%M').sql" | |
BUCKET="bucketname" | |
mysqldump -u dbuser --password=secret dbname > "$FILENAME" | |
gzip "$FILENAME" | |
s3cmd put "$BUCKET:$FILENAME.gz" "$FILENAME.gz" "Content-Type:application/x-gzip" | |
rm "$FILENAME.gz" |
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 'growl' | |
module Jekyll | |
class GrowlPreHook < Hook | |
safe false | |
sequence :pre | |
def run(site) | |
Growl.notify 'Building...', :title => 'Jekyll' | |
end |