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 binsearch(ar, v, s=0, e=ar.length) | |
#if we have an empty slice, return nil | |
return nil if s >= e | |
#if we have a slice with one element, return index if it's the value else nil | |
return ar[s] == v ? s : nil if e-s == 1 | |
#get pivot as average of start and end | |
pivot = (e+s) / 2 |
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" |