VI bindings in iex:
brew install rlwrap # on OSX
echo "alias iex='rlwrap -a foo iex'" >> ~/.bash_profile
echo "set editing-mode vi" >> ~/.inputrc
source ~/.bash_profile
\iex
| <html> | |
| <head> | |
| <title>Test Body No Scoll</title> | |
| <style> | |
| body{ | |
| background-color: black; | |
| color: white; | |
| } | |
| </style> | |
| </head> |
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'selenium-webdriver' | |
| # Configs | |
| FIN = "YOUR_FIND_NUMBER" | |
| APPLICATION_NUMBER = "YOUR-PR-APPLICATION-NUMBER" | |
| APPNUM_ARR = APPLICATION_NUMBER.split "-" |
| Spree::ProductProperty.class_eval do | |
| belongs_to :value_object, class_name: 'Spree::PropertyValue', foreign_key: :value_id | |
| before_validation { self.value = value_object.value if value_id and changes[:value_id] } | |
| end |
| import java.util.Random; | |
| import java.util.Set; | |
| import java.util.TreeSet; | |
| public class MontyHall { | |
| static Random rand = new Random(); | |
| public static void main(String args[]){ | |
| # Git Remove Merged Branch | |
| git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d | |
| # Git List branch, with commit id and message, ordered by last commit date | |
| git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | |
| # Remote the deleted branch in the remote `origin` | |
| git remote prune origin | |
| # This gist records the steps to setup a new Ubuntu Server | |
| # User Setup - add user with sudo | |
| sudo adduser $USERNAME | |
| sudo adduser $USERNAME sudo | |
| # Add SSH Login | |
| mkdir ~$USERNAME/.ssh/ | |
| cat public_key > ~$USERNAME/.ssh/authorized_keys | |
| chmod 500 -R ~$USERNAME/.ssh/ |
| module Logger | |
| extend self | |
| attr_accessor :output, :log_actions | |
| def log(&event) | |
| self.log_actions ||= [] | |
| self.log_actions << event | |
| end |
| # Put this file in your home foler | |
| -d postgresql | |
| -T |
| // This would get GeekTime Article in the format of: "title \t date \t links" | |
| s = "" | |
| document | |
| .querySelectorAll(".article-item") | |
| .forEach(function(n){ | |
| s += ( | |
| n.querySelector(".article-item-title").textContent + "\t" + | |
| n.querySelector(".article-item-time").textContent + "\t" + |