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
#!/usr/bin/env ruby | |
# Invoke with `ruby md2cre.rb filename.md` | |
# | |
# Setup: `gem install redcarpet` | |
require 'rubygems' | |
require 'redcarpet' | |
class Creole < Redcarpet::Render::Base | |
def normal_text(text) |
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
import Data.Yaml | |
import qualified Data.Map as M | |
main = do | |
Just f <- decodeFile "programs.yml" | |
let Just x = M.lookup "SENG" f | |
case x of | |
Nothing -> fail "InvalidFile" | |
Just a -> putStrLn a |
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
# run `rspec api_spec.rb` | |
RSpec.configure do |config| | |
config.color_enabled = true | |
end | |
require 'faraday' | |
require 'json' | |
describe :api do |
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 'prawn' | |
# Page size: 595.28 x 841.89 | |
$WIDTH = 595.28 | |
$HEIGHT = 841.89 | |
Prawn::Document.generate("hello.pdf", :margin => 0, :page_size => [$WIDTH, $HEIGHT]) do | |
def put(img, x, y) | |
image "game/#{img}.png", :at => [$WIDTH * (x / 3.0), $HEIGHT * ((y+1) / 4.0)], :height => $HEIGHT / 4 | |
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 'faraday' | |
require 'json' | |
require 'couchrest' | |
@couch = CouchRest.new("http://127.0.0.1:5984") | |
@db = @couch.create_db('items') | |
# http://127.0.0.1:5984/_utils/ | |
# TODO: download images as attachments |
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
RewriteEngine on | |
RewriteBase /~maxs/ | |
RewriteRule ^cgi-bin - [L,NC] | |
RewriteRule (.*) http://maxpow4h.com/$1 [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
-- Copyright (C) 2012 by Maxwell Swadling | |
-- | |
-- Permission is hereby granted, free of charge, to any person obtaining a copy | |
-- of this software and associated documentation files (the "Software"), to deal | |
-- in the Software without restriction, including without limitation the rights | |
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
-- copies of the Software, and to permit persons to whom the Software is | |
-- furnished to do so, subject to the following conditions: | |
-- | |
-- The above copyright notice and this permission notice shall be included in |
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 'tk' | |
class App | |
def make_row(window, name) | |
var = TkVariable.new | |
row = TkFrame.new(window) do | |
# Frame for a row | |
pack { fill 'both'; side 'top' } |
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
import Data.List | |
data Domain = Domain { domain :: String, dns :: DNS } deriving (Show) | |
data Service = Service { name :: String, servtype :: ServType, description :: String } deriving (Show) | |
data ServType = Heroku | GitHubPages | Redirect deriving (Show, Eq) | |
data DNS = DNS { dprovider :: String, dname :: String, services :: [Service] } deriving (Show) | |
-- presentation |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Sheet where | |
import qualified Data.Map as M | |
import Text.PrettyPrint.Boxes | |
import Data.List | |
type Row a = M.Map Key a | |
type Key = String |