This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zip_with(other, op=nil) | |
return [] if self.empty? || other.empty? | |
clipped = self[0..other.length-1] | |
zipped = clipped.zip(other) | |
if op | |
zipped.map { |a, b| a.send(op, b) } | |
else | |
zipped.map { |a, b| yield(a,b) } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'rexml/document' | |
include REXML | |
doc = Document.new(File.new(ARGV[0])) | |
format = ARGV[1] || "apache" | |
formats = { | |
:apache => "RewriteRule ^%s$ /%s [R=301,L]", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'date' | |
require 'yaml' | |
require 'rexml/document' | |
include REXML | |
doc = Document.new(File.new(ARGV[0])) | |
FileUtils.mkdir_p "_posts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns step1) | |
(defn fact | |
[n] | |
(if (< n 2) 1 (* n (fact (dec n))))) | |
;; (fact 5) => 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use '(incanter core charts io)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Ruby/Rails development | |
;; RVM support | |
;; Ruby Version Manager | |
(require 'rvm) | |
(rvm-use-default) | |
;; automatically add 'end' after class, module, def etc. | |
;; automatically pair braces, single and double quotes | |
(require 'ruby-electric) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the official Emacs repo: | |
git clone http://repo.or.cz/r/emacs.git/ | |
# Get the fullscreen patch | |
git remote add typester git://github.com/typester/emacs.git | |
git fetch typester | |
# Create a patch and apply to HEAD | |
# I had merge conflicts when rebasing and | |
# build failures for origin/emacs-23 |