Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile

I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer.

I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc).

Install rvm (no sudo!)

------------------------------------------------------

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) source ~/.rvm/scripts/rvm rvm install ree-1.8.7-2010.02

<?php
// Encode a string to URL-safe base64
function encodeBase64UrlSafe($value)
{
return str_replace(array('+', '/'), array('-', '_'),
base64_encode($value));
}
// Decode a string from URL-safe base64
function decodeBase64UrlSafe($value)

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",