Skip to content

Instantly share code, notes, and snippets.

// Set API key
$.flickr.settings.apiKey = '123'
// Option 1: Inline callbacks
$.flickr().photos.getRecent({
size: 's'
page: 1,
beforeSend: function() {
$('img#waiting').fadeIn();
},
// 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();
},
# 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
\documentclass[12pt,a4paper,titlepage]{article}
\usepackage{setspace}
\doublespacing
\title{Title}
\author{Author}
\begin{document}
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
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
<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 %>
require 'growl'
module Jekyll
class GrowlGenerator < Generator
safe false
def generate(site)
Growl.notify 'Building...', :title => 'Jekyll'
end
end
#!/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"
require 'growl'
module Jekyll
class GrowlPreHook < Hook
safe false
sequence :pre
def run(site)
Growl.notify 'Building...', :title => 'Jekyll'
end