Skip to content

Instantly share code, notes, and snippets.

View DavidJRobertson's full-sized avatar

David Robertson DavidJRobertson

View GitHub Profile
@DavidJRobertson
DavidJRobertson / cgol.rb
Last active August 29, 2015 13:58
Simple implementation of Conway's Game of Life
#! /usr/bin/env ruby
module LiveCell
def self.to_s
'o'
end
def self.next_generation(neighbours)
case neighbours.count(LiveCell)
when 2..3 then LiveCell
import Canvas
import string
import re
def pos_cmd(state, x, y):
state['pos'] = [int(x), int(y)]
def move_cmd(state, x, y):
pos = state['pos']
;-----------------------------------------------------------------------
; Sigma16 Program BarChart
;
; CS1Q Systems Exercise 1
; David Robertson 2133246R TU02/LB02
; 18 February 2015
;-----------------------------------------------------------------------
; Status Report
# David Robertson
# CS1P Lab Exam 2
import string, operator
def get_books(filename='books.txt'):
books_file = open(filename, 'r')
books_file_lines = books_file.readlines()
books_file.close()
class String
def last(n)
self[-n,n]
end
end
require "digest"
def hash_message(message)
sha256 = Digest::SHA2.new(256)
puts "XOR tool"
hexvals = Array.new
puts "Enter first value in hex: "
hexvals << gets.chomp
puts "Enter second value in hex: "
hexvals << gets.chomp
vals = Array.new
@DavidJRobertson
DavidJRobertson / dcpu-asm.md
Created October 15, 2012 18:47
DCPU ASSEMBLER

Scroll down for assembler ruby source code

DCPU Assembler

Comments

Start with a # and can be on their own line or at the end of a line of code

Labels

require 'rubygems'
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
config.consumer_secret = "SYfZQUh6kGgEG3zAtQwO9jJwGEDcVXBMRg1QUTRIMZqBqDHMUR"
end
tumblr = Tumblr.new
require 'rubygems'
require 'tumblr_client'
require 'active_record'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"
require 'rubygems'
require 'tumblr_client'
require 'uri'
GIF_MAX_WIDTH = 1024
GIF_MAX_HEIGHT = 768
Tumblr.configure do |config|
config.consumer_key = "AcHYlG5GaS9xf842H1RC8WF81cvAH9zqf7fvxGSrfHQSy7ksqO"