Skip to content

Instantly share code, notes, and snippets.

module Searchlogic
module NamedScopes
# Handles dynamically creating named scopes for ordering by columns. Example:
#
# User.ascend_by_id
# User.descend_by_username
#
# See the README for a more detailed explanation.
module Ordering
module InstanceOverrideMethods
@ScotterC
ScotterC / gist:1660408
Created January 23, 2012 03:48
installing ruby-debug on 1.9.3-head
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1660408)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1666223)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@ScotterC
ScotterC / gist:1888600
Created February 23, 2012 00:15
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+X delete line
Ctrl+↩ insert line after
Ctrl+⇧+↩ insert line before
Ctrl+⇧+↑ move line (or selection) up
@ScotterC
ScotterC / gist:3515174
Created August 29, 2012 16:22
bundler fail with jenkins and rubber
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/Artsicle/workspace
Checkout:workspace / /var/lib/jenkins/jobs/Artsicle/workspace - hudson.remoting.LocalChannel@36bb87
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
Fetching upstream changes from git@github.com:Artsicle/artsicle.git
Commencing build of Revision d90fba04f057d1a6d71e7293545ba1a1b0351d57 (origin/master)
Checking out Revision d90fba04f057d1a6d71e7293545ba1a1b0351d57 (origin/master)
No change to record in branch origin/master
@ScotterC
ScotterC / Kongregate Console Log
Created October 15, 2012 21:19
Kongregate Console Log
kongregate log initialized.
OS: Mac OS 10.7.5, 1440x900, current version: MAC 11,4,402,287
[Ansible] Initialized, loading API
[Game] Creating services...
[Game] MessageConnection init, dynamic_names=true
[Game] Listening for connection...
[Game] Bridge created, name=ansible, using JSON=true
kongregate log initialized.
OS: Mac OS 10.7.5, 1440x900, current version: MAC 11,4,402,287
Konduit initialized
@ScotterC
ScotterC / gist:4416022
Last active December 10, 2015 09:39
Airbnb Too Many Redirects
The prompt is to write a reference for user 4518407
Original Link:
http://email.airbnb.com/wf/click?upn=UA0I9ykwW18GFPfCaUOjL77fyjRwqaOP4IsyRP2JzB9BUnh-2FXcFwO0pOKpTGiNn6zz6QVfyFYI-2FeitNsjUj1Wg-3D-3D_9EhIKuuVYjpeTgrK1gYcZKx9z-2BAUe33K-2BeZJp6kaYnzWICQwsbSF7XT0JqlHGTFkqnL8tvbENJusyJVxjjujSra8NKB3E24CyhnbSINfYWd0f8C-2F8u-2FeMfYmdZng4xYRw2x5-2BzhHD72DUnZ4nGlU2OSkFSUCVyJeT1dhiyVuFrV2YlSaHwZFk9X1HdPwh5YOqzW3UplQT3g-2BBLxDOPlRDQ-3D-3D
Resolves as, with too many redirects
https://www.airbnb.com/login?redirect_params[action]=show&redirect_params[controller]=users&redirect_params[id]=4518407&redirect_params[r]=2f2fd&redirect_params[v]=1
This changes to with a redirect loop:
https://www.airbnb.com/users/show/4518407?r=2f2fd&v=1
@ScotterC
ScotterC / gist:4956080
Last active December 13, 2015 18:29
Setting up Wukong-Hadoop on EMR, bootstrap script. (Wukong 3.0)
#!/bin/bash
# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
# in app/controllers/products_controller.rb
def index
@products = Product.all
respond_to do |format|
format.js { render partial: 'shared/app/article',
collection: @products,
as: :object }
format.html
end
@ScotterC
ScotterC / gist:5444179
Created April 23, 2013 14:48
Git completion
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names