Skip to content

Instantly share code, notes, and snippets.

View forrestgrant's full-sized avatar

Forrest Grant forrestgrant

View GitHub Profile
@forrestgrant
forrestgrant / 0_reuse_code.js
Created February 3, 2016 14:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@forrestgrant
forrestgrant / app.conf
Last active August 29, 2015 14:05
nginx/puma config
# /etc/nginx/sites-available/app.conf
upstream app {
server unix:///var/www/app/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
@forrestgrant
forrestgrant / foo.rb
Created June 3, 2014 12:41
Swift - RubyMotion
numbers = [20, 19, 7, 12]
numbers.map { |n| 3 * n }
@forrestgrant
forrestgrant / routes.rb
Last active August 29, 2015 14:00
API Routing
namespace :api do
namespace :v1 do
resources :foos
resources :bars
end
namespace :v2 do
resources :foos
# :bars should fall back to v1
end
@forrestgrant
forrestgrant / detail_screen.rb
Created January 16, 2014 19:28
Extending UIView
class DetailScreen < PM::Screen
def will_appear
view << UILabel.build(
frame: [[10, 10], [100, 20]],
text: "Foo Bar",
font: UIFont.systemFontOfSize(18),
textColor: UIColor.redColor
)
end
@forrestgrant
forrestgrant / _ios_seven.scss
Created August 23, 2013 14:18
Using multiple stylesheets with pixate, for iOS specific styles.
// _ios_seven.scss
// iOS 7 specific styles
@forrestgrant
forrestgrant / twitter glue
Created April 22, 2011 21:05
Keep twitter app (mac) glued to an OS X space.
tell application "Twitter"
activate
end tell
delay 1
#First Time
set app_identifier to "com.twitter.twitter-mac"
set app_identifier to do shell script "echo " & quoted form of app_identifier & " | /usr/bin/perl -pe 'use encoding utf8; s/(\\w)/\\L$1/gi'"
set displayString to "Assign " & app_identifier & " to Space:"