Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile
@gertig
gertig / gist:817199
Created February 8, 2011 20:46 — forked from Arcath/gist:481321
def gravatar_url(email,options = {})
require 'digest/md5'
hash = Digest::MD5.hexdigest(email)
url = "http://www.gravatar.com/avatar/#{hash}"
options.each do |option|
option == options.first ? url+="?" : url+="&"
key = option[0].to_s
value = option[1].to_s
url+=key + "=" + value
end
##
# Inside: Rails.root/config/compass.rb
if Rails.env.production?
css_dir = "tmp/stylesheets/compiled"
else
css_dir = "public/stylesheets/compiled"
end
##
# Inside: Rails.root/config/initializers/compass.rb
require 'rake/clean'
HAML = FileList['**/*.haml']
LESS = FileList['**/*.less']
COFFEE = FileList['**/*.coffee']
HTML = HAML.ext('html')
CSS = LESS.ext('css')
JS = COFFEE.ext('js')
Host heroku.com
HostName heroku.com
User git
IdentityFile ~/.ssh/heroku.identity
IdentitiesOnly yes
www:
requirements:
- faye
- jade
@gertig
gertig / gist:988056
Created May 24, 2011 02:40 — forked from Gregg/gist:968534
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this screencast if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent then a phone call or screen sharing.
@gertig
gertig / peepcode.rb
Created August 18, 2011 20:40 — forked from jmazzi/peepcode.rb
A script to download all Peepcode screencasts with ruby & wget (supports resume)
require 'mechanize'
@username = 'user@domain.com'
@password = 'hi2u'
@download_path = File.expand_path 'downloads'
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt'
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"
exit
@gertig
gertig / hn_scraper.rb
Created November 12, 2011 15:38
grab top stories from hacker news (supports pagination)
require 'rubygems'
require 'nokogiri'
require 'open-uri'
def is_numeric_or_short(str)
return str.length <= 5
end
url = "http://news.ycombinator.com"
doc = Nokogiri::HTML(open(url))
@gertig
gertig / api.rb
Created January 6, 2012 03:31 — forked from lucatironi/api.rb
Snippets for an API with grape
# Server App
# This file must be in lib/myapp/api.rb
module MyApp
module Entities
class Products < Grape::Entity
expose :id, :code, :name, :short_description
expose :description, :unless => { :collection => true }
expose (:category) { |model, options| model.category.name }
expose (:brand) { |model, options| model.brand.name }
end
- (void)viewDidLoad {
self.currentPage = 0;
self.dataSource = [[NSMutableArray alloc] init];
}
- (void)fetchData {
[[SVHTTPClient sharedClient] GET:@"https://api.github.com/users/AndrewGertig/watched"
parameters:[NSDictionary dictionaryWithValue:[NSNumber numberWithInt:self.currentPage] forKey:@"page"]
completion:^(id response, NSError *error) {
[self.dataSource addObjectsFromArray:response];