Skip to content

Instantly share code, notes, and snippets.

@chrisyour
chrisyour / development.rb
Created September 9, 2013 21:47
Limit the size of your development.log and test.log files in your Rails 4 and Rails 3 apps.
# Add this to config/environments/development.rb
# Limit your development log file to 5 MB
config.logger = Logger.new(config.paths["log"].first, 1, 5242880) # 5 megabytes
@chrisyour
chrisyour / _twitter_wjs.js.coffee
Created January 10, 2014 07:29
CoffeeScript to load Twitter's twitter-wjs JavaScript. Tip: Any link that goes to an intent URL (like http://twitter.com/intent/tweet) acts like a Twitter button with all the Widget-wjs functionality with events, so you can customize the look of your button without having to use the Twitter generated iFrame buttons.
# Load Twitter Widgets
window.twttr = ((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
unless d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = "//platform.twitter.com/widgets.js"
fjs.parentNode.insertBefore js, fjs
window.twttr || t = { _e: [], ready: (f)-> t._e.push(f) }
@chrisyour
chrisyour / gist:11183907
Created April 22, 2014 15:36
Build Help: Get Started with Rails
# Open bash.rc in Terminal using the 'mate' command
mate ~/.bashrc
# Do you have this line in your .bashrc file? The PostgresApp should have added PostgresApp to your PATH.
PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"
@chrisyour
chrisyour / s3.md
Last active March 15, 2018 21:41
AWS S3 Command Line Tool for Backups

How to quickly copy an AWS S3 bucket to your local hard drive (without FTP):

aws s3 sync s3://mybucket .

The Problem

Using FTP to backup a large S3 bucket is slow. That's because FTP creates a new request for each file, downloads the file, and closes the request. That adds a lot of time to your download.