Install by running the following command in your terminal:
exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)
#!/usr/bin/env sh | |
# Download lists, unpack and filter, write to stdout | |
curl -s https://www.iblocklist.com/lists.php \ | |
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| xargs wget -O - \ | |
| gunzip \ | |
| egrep -v '^#' |
// | |
// Example usage: phantomjs screenshot.js http://yahoo.com /tmp/yahoo.png | |
// | |
var system = require('system'); | |
var url = system.args[1]; | |
var filename = system.args[2]; | |
var page = new WebPage(); | |
page.open(url, function (status) { |
#!/bin/bash | |
# Call this script from a local git repo to set up a dropbox remote you can push and pull to | |
# I keep this script under ~/Dropbox/git/gitbox.sh | |
# Inspired from http://stackoverflow.com/questions/1960799/using-gitdropbox-together-effectively | |
PWD=`pwd` | |
PROJECT=`basename $PWD` | |
pushd $HOME/Dropbox/git | |
git init --bare $PROJECT.git |
class Post < ActiveRecord::Base | |
# for SO: http://stackoverflow.com/questions/10481389/friendly-id-with-two-parameters | |
# EXAMPLE ASSUMES YOU ARE USING FRIENDLYID 4.X | |
# AND THAT YOU HAVE A SLUG:STRING COLUMN ON THE MODEL | |
# ... | |
extend FriendlyId | |
friendly_id :generate_custom_slug, :use => :slugged | |
# ... |
require "rubygems" | |
require "pivotal-tracker" | |
namespace :pt do | |
desc "list avail pivotal tracker tix from which to create a git fea branch" | |
task :list do | |
def truncate_words(text, length = 5) | |
return if text == nil | |
words = text.split() | |
words = words - %w(feature scenario for in on a an the of so that they be able to are it its with) #remove non critical words (experiment with this) |
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" |
require 'formula' | |
class Vim < Formula | |
homepage 'http://www.vim.org/' | |
url 'https://vim.googlecode.com/hg/', :revision => '2d107086903a' | |
version '7.3.584' | |
def install | |
system "./configure", | |
"--with-features=huge", |
" Reload Google Chrome on Mac from Vim. | |
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/ | |
function! ChromeReload() | |
python << EOF | |
from subprocess import call | |
browser = """ | |
tell application "Google Chrome" to tell the active tab of its first window | |
reload | |
end tell | |
tell application "Google Chrome" to activate |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |