I'm Daven, a Canadian and aspiring developer living in Japan.
- B.A. Economics: University of Waterloo (2008-2012)
- Study abroad at Ritsumeikan APU (立命館アジア太平洋大学)
- English teacher for 8 years
# Initialize Mechanize Agent | |
agent = Mechanize.new | |
# Visit a web page | |
agent.get 'http://localhost:3000/' | |
# get the url of the current page | |
agent.page.uri #=> http://localhost:3000 | |
# agent remembers the scheme + host, so no need to supply it when navigating somewhere else |
#! /usr/bin/env ruby | |
require 'socket' | |
def log(source, message) | |
time = Time.now.strftime("%Y-%m-%d %H:%M:%S") | |
puts "[%s] %s => %s" % [time, source, message] | |
end | |
# Class representing HTTP Requests |
#! /usr/bin/env ruby | |
require 'socket' | |
def log( source, message) | |
time = Time.now.strftime("%Y-%m-%d %H:%M:%S") | |
puts "[%s] %s => %s" % [time, source, message] | |
end | |
server = TCPServer.new ARGV.first.to_i |
# Rough implementation of BW transform | |
# As described at the wikipedia page: https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform | |
EOF_CHAR = '|' | |
def bwt(string) | |
string_with_eof = string + EOF_CHAR | |
rotations = [] | |
0.upto(string_with_eof.length - 1) do |i| | |
rotations << string_with_eof.chars.rotate(i).join |
I hereby claim:
To claim this, I am signing this object:
puts 'hello world' |
def test_gist_from_cli | |
puts "hello world" | |
end |
# So your PicsController probably looks something like this: | |
class PicsController < ApplicationController | |
def update | |
@pic = Pic.find(params[:id]) | |
@pic.update_attributes(params[:pic]) | |
end | |
end | |
# You want to change that to this: | |
class PicsController < ApplicationController |
A literal haskell gist file
someHaskellCode :: a -> [a]