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 | |
require 'openssl' | |
=begin | |
Implements the MAC generation process which needs to be applied to Standard 70 | |
transaction requests and replies. Uses example data to assert correctness at | |
each step of the process. | |
This script generates the MAC and MAC residue for the example request message, |
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
$("canvas").remove(); | |
c = document.createElement('canvas'); | |
c.width = c.height = 300; | |
$(document.body).append(c); | |
$(c).css("width", "300px"); | |
$(c).css("height", "300px"); | |
$(c).css("position", "absolute"); | |
$(c).css("top", "0px"); | |
$(c).css("left", "0px"); | |
$(c).css("border", "1px solid #000"); |
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
Jax.getGlobal().ApplicationHelper = Jax.Helper.create | |
patch_world: -> | |
Jax.World.prototype.pick_all_visible = () -> | |
context = this.context | |
w = context.canvas.width | |
h = context.canvas.height | |
data = new Uint8Array(w*h*4) | |
data.w = w | |
data.h = h | |
data.f = f = 4 |
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 | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
module Tty extend self | |
def blue; bold 34; end | |
def white; bold 39; end | |
def red; underline 31; end | |
def reset; escape 0; end | |
def bold n; escape "1;#{n}" 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
REST request | CRUD request | Action | |
----------------|----------------------|------- | |
POST /posts | /posts/create | Create | |
GET /posts/1 | /posts/show/colin | Read | |
PUT /posts/1 | /posts/update/colin | Update | |
DELETE /posts/1 | /posts/destroy/colin | Delete |
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
class Dice | |
def initialize(count, sides) | |
@count, @sides = count, sides | |
end | |
def roll | |
@count.times.inject(0) { |a,i| a + rand(sides) } | |
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
parse = (str) -> | |
vec = str.split /,\s*/ | |
return [ parseFloat(vec[0]), 0.0, parseFloat(vec[1]) ] | |
Jax.getGlobal()['Dungeon'] = Jax.Model.create | |
addTorches: (world) -> | |
if @map | |
for z in [0...@map.length] | |
row = @map[z] | |
for x in [0...row.length] |
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) 2011 by Colin MacKenzie IV | |
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
namespace :assets do | |
task :check => :environment do | |
paths = ["app/assets", "lib/assets", "vendor/assets"] | |
paths.each do |path| | |
dir_path = Rails.root + path | |
if File.exists?(dir_path) | |
dir_files = File.join(dir_path, "**") |
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
set :deploy_to, "public_html" # the remote path where the gem index lives | |
set :build_command, "bundle exec rake build" # the command to build the gem locally | |
set :user, "rubygems" # the user to log in to the server with | |
# the rubygems server to deploy to | |
server "gems.example.com", :app | |
desc "Deploy the gem and rebuild the index" | |
task :deploy do | |
build |
NewerOlder