Skip to content

Instantly share code, notes, and snippets.

View dtuite's full-sized avatar
🚀
Shipping

David Tuite dtuite

🚀
Shipping
View GitHub Profile
@dtuite
dtuite / non-ascii.sh
Created February 27, 2014 15:26
Find non-ASCII characters. This is useful when (for example) you have a Rails application and you want to specify UTF-8 encoding magic comment on files which need it. This snippet will tell you which files.
find . -type f -exec file --mime {} \; | grep -v us-asci
@dtuite
dtuite / sudo-pipe.md
Created March 3, 2014 02:25
Pipe to a file with sudo permissions

Pipe to a file using sudo

The tee -a command will append changes to a file (just like to >>). The -a flag stands for "append".

echo "some text" | sudo tee -a write-protected.txt

@dtuite
dtuite / README.md
Created April 11, 2014 15:21 — forked from timcheadle/README.md
Environment aware robots.txt for Rails

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

@dtuite
dtuite / 0.md
Last active August 29, 2015 14:00
SQL Date Formatting

SQL Date Formatting

@dtuite
dtuite / docker-basic.md
Last active November 17, 2015 14:16
Basic Docker Commands

Docker Basics

There are two programs:

  1. The docker daemon - a server process which manages all the containers
  2. The docker client - a remote control for the daemon

You can list the commands of the docker client by typing docker with no arguments.

You can use container images which have been created by other people. You find them online in the docker index. You can search for images using docker search [keywords].

@dtuite
dtuite / 0.md
Last active August 29, 2015 14:01
Upstart

Upstart

@dtuite
dtuite / 0.md
Last active August 29, 2015 14:02
Useful Ruby Vim Macros

.vimrc Tips and Tricks

@dtuite
dtuite / 0.md
Last active August 29, 2015 14:08
Interview Stuff
@dtuite
dtuite / 0.md
Last active September 14, 2015 21:30
Gzip assets when deploying with capistrano and Rails 4.2

Gzip assets when deploying with capistrano and Rails 4.2

@dtuite
dtuite / Gemfile
Created September 23, 2015 11:01
Assigning PROs to polymorphic associations
# A sample Gemfile
source "https://rubygems.org"
gem "activerecord"
gem "sqlite3"