Skip to content

Instantly share code, notes, and snippets.

View jpablobr's full-sized avatar

Pablo Barrantes jpablobr

View GitHub Profile
#!/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
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
# 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:
# History search with up and down arrow keys
bindkey '^[[A' history-beginning-search-backward
bindkey '^[[B' history-beginning-search-forward
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 = []
@jpablobr
jpablobr / ports.sh
Created April 22, 2010 19:55 — forked from defunkt/ports.sh
# List what ports are in use on OS X
sudo lsof -iTCP -sTCP:LISTEN -P
#!/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:
# 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
# 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
#!/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'