Skip to content

Instantly share code, notes, and snippets.

@carlthuringer
carlthuringer / forth.rb
Created August 4, 2017 11:40 — forked from fogus/forth.rb
Forth interpreter in 64 lines of Ruby
#!/usr/bin/env ruby
def pop; $stack.pop || raise(StackUnderflow); end
def push(expression); $stack << expression; end
def unary; -> { push(yield pop) }; end
def binary; -> { push(yield pop, pop) }; end
def unary_boolean; -> { push(if yield pop then 1 else 0 end) }; end
def binary_boolean; -> { push(if yield pop, pop then 1 else 0 end) }; end
def swap; $stack[-2,2] = $stack[-2,2].reverse; end
$stack = []
@carlthuringer
carlthuringer / tmux.md
Last active August 29, 2015 14:09 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Sessions, windows, panes

Session is a set of windows, plus a notion of which window is current.

Window is a single screen covered with panes. (Once might compare it to a ‘virtual desktop’ or a ‘space’.)

require 'formula'
class Libstemmer < Formula
# upstream is constantly changing the tarball,
# so doing checksum verification here would require
# constant, rapid updates to this formula.
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
homepage 'http://snowball.tartarus.org/'
end
#!/bin/bash
if [ -z "$1" ]; then
wdir="."
else
wdir=$1
fi
for f in $( find . -name '*erb' ); do
out="${f%.erb}.haml"
if [ -e $out ]; then