Skip to content

Instantly share code, notes, and snippets.

View sgerrand's full-sized avatar
Manual controls

Sasha Gerrand sgerrand

Manual controls
View GitHub Profile
sgerrand /
Created February 24, 2014 01:02 — forked from namuol/

rage-quit support for bash


Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

sgerrand / gist:1636174
Created January 18, 2012 22:18
Testing native PHP usort and strcasecmp functions
php > $test = range('A', 'z');
php > var_dump($test);
array(58) {
string(1) "A"
string(1) "B"
string(1) "C"
sgerrand / vundle.vim
Last active October 1, 2015 05:18
Vundle configuration
Bundle 'Lokaltog/vim-easymotion'
Bundle 'altercation/vim-colors-solarized'
Bundle 'astashov/vim-ruby-debugger'
Bundle 'bbommarito/vim-slim'
Bundle 'c9s/emoticon.vim'
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'chrisbra/NrrwRgn'
Bundle 'edsono/vim-matchit'
Bundle 'ervandew/supertab'
Bundle 'garbas/vim-snipmate'
#Newbie programmer
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
sgerrand / 1.9.3-p327-multilib
Created November 15, 2012 06:38
Custom brew formula for Ruby v1.9.3-327
build_package_combined_patch() {
local package_name="$1"
curl | git apply
curl | git apply
curl | git apply
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
make -j 8
sgerrand / project-euler-problem-91.hs
Created February 6, 2013 23:20
Haskell based solution to problem #91 ("Right triangles with integer coordinates") in Project Euler:
reduce x y = (quot x d, quot y d)
where d = gcd x y
right_angle_triangles_in_quadrant n =
3 *n * n + 2 * sum others
others =[min xc yc|
x1 <- [1..n],
y1 <- [1..n],
let (yi,xi) = reduce x1 y1,
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done.

You can break these rules if you can talk your pair into agreeing with you.

sgerrand /
Last active December 18, 2015 10:58 — forked from 3kwa/
curl -O
echo -e "Installing pip..."
sudo python
echo -e "Done."
echo -e "Installing Python packages..."
sudo pip install pytest
sudo pip install selenium
#!/usr/bin/env ruby
gem "parser", "~> 1.4"
require "parser"
require "parser/ruby19"
require "set"
class ConstantDeclarationAndUseProcessor < Parser::AST::Processor
attr_reader :declared, :used
def initialize