Skip to content

Instantly share code, notes, and snippets.

@McRipper
McRipper / check_river
Created November 26, 2013 12:58
Check if CouchDb River to Elasticsearch is working
#!/usr/bin/env ruby
# ### README ####
#
# Check if the river is updating and alert if not
#
# gem install elasticsearch
# gem install couchrest
#
@McRipper
McRipper / pre-commit.sh
Created April 19, 2013 11:54
Git Hook to increment version in file
#!/bin/sh
MESSAGE="$1"
VERSION_PATH=`git rev-parse --show-toplevel`"/config/initializers/version.rb"
VER_TOKEN="Version"
VER_STR=$(grep "$VER_TOKEN" $VERSION_PATH | awk '{print $3}' | tr -d '"')
VER_MAJ=$(echo $VER_STR | awk -F. '{print $1}')
VER_MIN=$(echo $VER_STR | awk -F. '{print $2}')
@McRipper
McRipper / payments_controller.rb
Created December 3, 2012 21:01
Rails PayPal recurring monthly payment
class PaymentsController < ActionController::Base
skip_before_filter :verify_authenticity_token, :only => :notification
before_filter :load_subscription
def checkout
redirect_to @subscription.paypal.checkout_url(
return_url: "http://www.example.com" + "/paypal/review/#{@subscription.id}",
cancel_url: "http://www.example.com" + "/paypal/cancel/#{@subscription.id}"
@McRipper
McRipper / gist:1069217
Created July 7, 2011 09:58 — forked from plindberg/gist:990919
Installing Ruby 1.9.2 via RVM, RubyGems, and Passenger on Debian 5.x (for Rails 3.1 deployment)

Install needed packages

apt-get update
apt-get install build-essential bison openssl libreadline5 libreadline5-dev \
  curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 \
  libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libcurl4-openssl-dev

Install RVM

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)