Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

Converting Obj-C blocks to RubyMotion

A guide on how to translate Objective-C blocks into Ruby blocks.

Ruby Lambda and Proc Syntaxes

block = lamda { |param|  ... }
block = lamda do |param|
	...
@gertig
gertig / gist:6038283
Last active December 19, 2015 23:59 — forked from arkan/gist:5662905
class MyCustomCell < UITableViewCell
# This method is used by ProMotion to instantiate cells.
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier)
super
stylish
self
end
# A delegate method when the user clicks the Row(it's blue by default)
@gertig
gertig / Untitled.m
Created October 14, 2012 15:50
Untitled
// Find the class of an object
const char* classNameChar = class_getName([viewObject class]);
NSString *className = [NSString stringWithFormat:@"%s", classNameChar];
@gertig
gertig / Untitled.txt
Created October 5, 2012 14:58
No description
quintesential
@gertig
gertig / Untitled.js
Created September 16, 2012 18:33
Untitled
/* FACEBOOK EVENTS BEST PRACTICES
===========================
1. For most cases, you will want to subscribe to auth.authResponseChange rather than auth.statusChange.
The response is returned as a javascript array, not encoded as JSON.
2. Note that for some cases, the value of response is unkeyed, but when more than one variable is returned, it contains the appropriate keys.
3. You can subscribe multiple callbacks to one event using different function names.
=========================== */
@gertig
gertig / Carrierwave.html.erb
Created September 10, 2012 04:04
Use remote_avatar_for
<%= form_for @user, :html => {:multipart => true} do |f| %>
<p>
<label>My Avatar URL:</label>
<%= image_tag(@user.avatar_url) if @user.avatar? %>
<%= f.text_field :remote_avatar_url %>
</p>
<% end %>
@gertig
gertig / haiku.coffee
Created September 5, 2012 03:00 — forked from friggeri/haiku
random heroku-like name generator
haiku = ->
adjs = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
"long", "late", "lingering", "bold", "little", "morning", "muddy", "old",
"red", "rough", "still", "small", "sparkling", "throbbing", "shy",
"wandering", "withered", "wild", "black", "young", "holy", "solitary",
"fragrant", "aged", "snowy", "proud", "floral", "restless", "divine",
@gertig
gertig / Creating and Publishing a gem to rubygems.org.rb
Created August 24, 2012 13:12
Creating and Publishing a gem to rubygems.org
#To create a new scaffold for a gem:
Rails andrewgertig$ bundle gem gemname
#To build a gem
$ gem build gemname.gemspec
#To push a gem to Rubygems.org
@gertig
gertig / Mac style drop shadow.css
Created August 23, 2012 20:38
Mac style drop shadow
box-shadow:inset 0 1px 0 rgba(255,255,255,.6), 0 22px 70px 4px rgba(0,0,0,0.56), 0 0 0 1px rgba(0, 0, 0, 0.3);