Skip to content

Instantly share code, notes, and snippets.

@jacius
jacius / about_ls_r.txt
Created December 20, 2009 23:25
ls_r: recursively list (and process) directories
Return a hash of directory contents, recursively.
Given a directory structure like this:
a/
|-- b.txt
`-- c/
|-- d.txt
`-- e/
@jacius
jacius / untar
Created October 5, 2009 20:34
untar: A simple shell script to untar a tarball.
#!/bin/bash
#
# A simple command to untar any tarball.
#
# For times when you don't care whether it was compressed
# with bzip2 or gzip, you just want to untar it already!
#
# Usage: untar [-v|--verbose] file
#
@jacius
jacius / smarttabs.el
Created September 18, 2009 09:13
Emacs smart tabs - indent with tabs, align with spaces!
;;
;; Emacs smart tabs functionality
;; Intelligently indent with tabs, align with spaces!
;;
;; Note: Indenting only uses tabs when indent-tabs-mode is non-nil,
;; otherwise it uses spaces as usual.
;;
;; To use: save as smarttabs.el in your .emacs.d directory, and add
;; "(require 'smarttabs)" to your .emacs file.
;;
@jacius
jacius / git-cherry-pick-range.sh
Created August 11, 2009 02:16
Cherry pick a range of git commits.
#!/bin/sh
#
# A very simple shell script to "cherry pick" a range of commits in Git.
# I might add more features later, like validation.
#
# Credit goes to Alex Riesen:
# http://www.nabble.com/cherry-pick---since---td10105685.html
#
# This script is released to the public domain. You can do whatever you want with it.
#!/bin/env ruby
# One way of making an object start and stop moving gradually:
# make user input affect acceleration, not velocity.
require "rubygame"
# Include these modules so we can type "Surface" instead of
@jacius
jacius / load_image.rb
Created June 21, 2009 06:34
A sample script to demonstrate Ruby-SDL-FFI (as of June 21, 2009)
#!/bin/env ruby
# A sample script to demonstrate Ruby-SDL-FFI (as of June 21, 2009).
# NOTE: Ruby-SDL-FFI API is still in flux.
require 'ruby-sdl-ffi'
path = ARGV[0]
if path.nil?
require 'rubygame'
include Rubygame
include Rubygame::EventTriggers
# Factory method to create KeyReleaseTriggers easily.
def released( key )
return KeyReleaseTrigger.new( key )
end