This file contains hidden or 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
.text | |
.globl | |
getCharAsInt: | |
pushl %ebp | |
movl %esp, %ebp | |
movl 8(%ebp), %eax | |
movl 12(%ebp), %edx | |
addl %edx, %eax | |
movb (%eax), %al | |
movsbl %al, %eax |
This file contains hidden or 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
.text | |
.globl max | |
max: | |
pushl %ebp | |
movl %esp, %ebp | |
mrmovl 8(%esp), %ecx | |
rrmovl %ecx, %eax #; pointer to numbers[] | |
mrmovl (%ecx), %ecx #; ecx holds greatest encountered | |
#; number |
This file contains hidden or 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
.text | |
.globl _max | |
_max: | |
pushl %ebp | |
movl %esp, %ebp | |
movl 8(%ebp), %ecx #; assume first number is the greatest | |
movl %ecx, %eax #; eax points to the beggining of numbers[] | |
movl (%ecx), %ecx #; %ecx stores the highest number found | |
movl 12(%ebp), %edx #; len |
This file contains hidden or 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 'sinatra' | |
require 'pty' | |
get '/' do | |
"<form action='/' method='POST'><input type='text' name='command'><input type='submit' value='run'></form>" | |
end | |
post '/' do | |
stream do |out| | |
out << "<html><body><pre>" |
This file contains hidden or 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 'sinatra' | |
require 'sequel' | |
# $ gem install thin mysql sequel | |
# the mysql gem is a MASSIVE pain in the ass, would rather | |
# use something saner like Postgres or Mongo or Redis | |
# thin is required, WEBRick is terrible | |
set :server, :thin | |
get '/' do |
This file contains hidden or 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 'sinatra' | |
require 'sinatra/namespace' | |
require 'mongoid' | |
ENV["RACK_ENV"] ||= "development" | |
Mongoid.load!("mongoid.yml") | |
class Note | |
include Mongoid::Document | |
field :body, type: String |
This file contains hidden or 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 Router | |
attr_accessor :routes | |
def initialize | |
@routes = {} | |
end | |
def add_route(path, &block) | |
@routes[path] = block | |
end |
This file contains hidden or 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 'rack' | |
require 'flea' | |
interpreter = Flea::Interpreter.new | |
run Proc.new { |env| | |
interpreter.run(File.read(File.new("server.scm"))) | |
a = interpreter.evaluate([:call, env]).map! {|x| | |
interpreter.evaluate(x) | |
} |
This file contains hidden or 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
#tell whether the tree is visually symmetric (it is) | |
class Node | |
attr_reader :value, :left, :right | |
def initialize(value, left, right) | |
@value, @left, @right = value, left, right | |
end | |
#added in to see output | |
def to_s; @value.to_s; end | |
def inspect; @value.to_s; end |
This file contains hidden or 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
typedef struct stump { | |
char * name; | |
int data; | |
} stump; | |
typedef struct container { | |
stump ** node_array; | |
} container; | |
int compare_stumps(const void *a, const void *b) { |