Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lopopolo
lopopolo / gist:9427762
Created March 8, 2014 09:19
Relink all homebrew formulae after Mavericks upgrade
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@rsim
rsim / 01_thread.rb
Created March 26, 2013 21:15
Code examples from my "Using threads in Ruby applications" presentation in our local Ruby meetup http://www.meetup.com/ruby-on-rails-latvia/events/105142132/
Thread.new do
sleep 5
puts "finished"
end
thread = Thread.new do
sleep 5
puts "finished"
end
thread.join
@pbroschwitz
pbroschwitz / supplant.js
Created October 15, 2012 07:58
supplant - Crockford
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {
@FND
FND / .gitignore
Created September 27, 2012 21:00
template for JavaScript components
/lib
@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"
],
@tjsingleton
tjsingleton / Chef Solo Bootstrap with Ruby 2.2.2
Last active November 5, 2021 21:41 — forked from nyxwulf/Chef Bootstrap Ruby 1.9.3-p194
Chef Solo Bootstrap with Ruby 2.2.2
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev libjemalloc-dev
apt-get -y install autoconf curl bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
curl http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@shapeshed
shapeshed / nginx_rails_3_1
Created October 10, 2011 19:13
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {