Skip to content

Instantly share code, notes, and snippets.

View rosskevin's full-sized avatar

Kevin Ross rosskevin

View GitHub Profile
@ryankirkman
ryankirkman / formatjson.js
Last active September 16, 2019 02:12 — forked from kristopherjohnson/formatjson.js
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
@martindemello
martindemello / chain-of-responsibility.rb
Created February 20, 2015 21:30
chain of responsibility example in ruby
class PurchaseApprover
# Implements the chain of responsibility pattern. Does not know anything
# about the approval process, merely whether the current handler can approve
# the request, or must pass it to a successor.
attr_reader :successor
def initialize successor
@successor = successor
end
@Globegitter
Globegitter / es.sh
Last active November 18, 2020 12:52
Easy install for elasticsearch on Ubuntu 14.04
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@mattclar
mattclar / simple_form.rb
Last active December 21, 2015 13:58 — forked from tommarshall/simple_form.rb
this is a simple form initializer that is ALMOST compatible with Bootstrap3 apart from a way to set the class of the label this would work perfectly
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
@puffnfresh
puffnfresh / npm_chpwd_hook.sh
Created November 27, 2012 01:17
Adds node_modules/.bin to the PATH (zsh)
# Adds node_modules/.bin to the PATH
npm_chpwd_hook() {
if [ -n "${PRENPMPATH+x}" ]; then
PATH=$PRENPMPATH
unset PRENPMPATH
fi
if [ -f package.json ]; then
PRENPMPATH=$PATH
PATH=$(npm bin):$PATH
fi
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')