This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agent=$HOME/Library/LaunchAgents/org.mongodb.mongod.plist | |
brew install mongodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emacs -q --eval '(condition-case err (progn (load "~/.emacs") (kill-emacs 0)) (error (kill-emacs 1)))' | |
# Source http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bed5b2bd8b237f5a?pli=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# History search with up and down arrow keys | |
bindkey '^[[A' history-beginning-search-backward | |
bindkey '^[[B' history-beginning-search-forward |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rexml/parsers/pullparser' | |
require 'htmlentities' | |
class String | |
# Truncate strings containing HTML code | |
# Usage example: "string".truncate_html(50, :word_cut => false, :tail => '[+]') | |
def truncate_html(len = 30, opts = {}) | |
opts = {:word_cut => true, :tail => ' ...'}.merge(opts) | |
p = REXML::Parsers::PullParser.new(self) | |
tags = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List what ports are in use on OS X | |
sudo lsof -iTCP -sTCP:LISTEN -P |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# I deliberately didn't DRY /usr/local references into a variable as this | |
# script will not "just work" if you change the destination directory. However | |
# please feel free to fork it and make that possible. | |
# | |
# If you do fork, please ensure you add a comment here that explains what the | |
# changes are intended to do and how well you tested them. | |
# | |
# 30th March 2010: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste this file in your terminal | |
# The following will create a dir which contains the rails repo. | |
# You can start edit this later on. It will also create a Gemfile and a Vagrantfile. | |
# It will run bundle and it will # download and activate the virtualbox that contains | |
# everything you need to start # testing. | |
mkdir rails_test_box | |
cd rails_test_box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What's the output of this program? | |
# Compare Ruby 1.8 to 1.9. | |
def fl; lambda { return 1 }.call; 2; end | |
def fp; proc { return 1 }.call; 2; end | |
def fPn; Proc.new { return 1 }.call; 2; end | |
puts fl | |
puts fp | |
puts fPn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# To install: | |
# about:config | |
# create a new boolean network.protocol-handler.external.txmt with value true | |
# create a new string network.protocol-handler.app.txmt with value path to the script | |
require 'rubygems' | |
require 'cgi' | |
require 'uri' |
OlderNewer