Skip to content

Instantly share code, notes, and snippets.

View ethnt's full-sized avatar
🐢

Ethan Turkeltaub ethnt

🐢
View GitHub Profile
@lipchyk
lipchyk / gist:667549
Created November 8, 2010 10:15
Using timestamps in MongoMapper Embedded document
class Foo
include MongoMapper::EmbeddedDocument
plugin MongoMapper::Plugins::Timestamps
belongs_to :bar
key :bar_id, ObjectId
#...
timestamps! #voila!
end
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
@ethnt
ethnt / Media.markdown
Created December 10, 2011 03:29
All of the media.

This is all the media that I would like, have but need to be converted to *.m4a or *.m4v, and holes in my collection. To see what I currently do have, look at Tree.txt.

In order to create the directory tree, use the following command in the Media directory.

ls -R | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/' > Tree.txt && mv Tree.txt .Manifest/

Music

  • Disney Parks — Disney's Electrical Parade
@ethnt
ethnt / SOPA.markdown
Created January 18, 2012 15:26
Down with SOPA!

Yesterday, I made this site redirect to SOPA Strike in opposition of SOPA (Stop Online Piracy Act) and PIPA (Protect IP Act). I am vehemently opposed to such draconian, broad bills such as these.

If you don't know, SOPA and PIPA aim to shut down sites that are infringing upon American intellectual property such as music, movies, photos, and books.

That idea is sound, but the methods and language that the bills use are morally and ethically wrong. Sites that are found to be infringed by industry organizations (like the RIAA and MPAA) can be shut down without due process or chance for an appeal. The DMCA (Digital Millennium Copyright Act) handles this by providing "safe harbor" to social networking sites such as Facebook, Twitter and YouTube. But under SOPA or PIPA, these sites would be gone from the Internet.

These bills allow the United States to assert control over all domestically registered domains (.com, .net, .org, et cetera). Any international site that infringes upon

@simenbrekken
simenbrekken / README.md
Created March 8, 2012 06:39
Super simple Backbone + Express + MongoDB REST backend application

Requirements:

If you're on OSX you're probably best off using Homebrew to install this stuff:

$ brew install node mongodb

Usage:

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active March 28, 2024 11:13
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@soffes
soffes / perferences.json
Created August 22, 2012 05:35
My Sublime Text 2 config
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/Espresso Soda.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".gitkeep",
"dump.rdb"
],
@passcod
passcod / Gemfile
Created September 20, 2012 05:15
Padrino + Sidekiq = ♥
# ...
gem 'sidekiq'
# ...
@inertialbit
inertialbit / ansible-ubuntu-ruby-playbook.yml
Created January 21, 2013 18:10
installs rbenv via rbenv-installer, ruby matching $ruby_version and passenger + apache2 module to $user home and updates $user/.bash_profile w/ rbenv env vars
---
- name: install rb-installer
action: shell curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
- name: update PATH in ~/.bash_profile for rb-env
action: lineinfile dest=/home/$user/.bash_profile line=export\ PATH="$HOME/.rbenv/bin:$PATH" regexp=PATH.*rbenv
- name: add rb-env init to ~/.bash_profile
action: lineinfile dest=/home/$user/.bash_profile line='eval "$(rbenv init -)"' regexp=eval.*rbenv
@dirk
dirk / state_machine.rb
Last active December 17, 2015 05:38
The only state machine I'll (probably) ever need.
class StateMachine
def initialize
@transitions = {}
end
def transition(opts, &block)
from = opts[:from]
to = opts[:to]
@transitions[from] ||= {}
@transitions[from][to] = block
end