Skip to content

Instantly share code, notes, and snippets.

View Whoops's full-sized avatar

Walton Hoops Whoops

View GitHub Profile
@Whoops
Whoops / demo.rb
Created September 2, 2014 16:02
Prawn_rails explanation
require 'prawn'
# NOTE: this file won't actually run
# How the prawn documentation is written:
# provides a block without an argument,
# recognized methods are implicity called
# on the resulting PDF
Prawn::Document.generate("demo.pdf") do
move_cursor_to 50
@Whoops
Whoops / corrupted.txt
Last active August 29, 2015 14:05
nfs wierdness 2

Keybase proof

I hereby claim:

  • I am whoops on github.
  • I am whoops (https://keybase.io/whoops) on keybase.
  • I have a public key whose fingerprint is 0281 C082 B629 25AE 2532 B187 E772 87E0 1F77 E2E5

To claim this, I am signing this object:

@Whoops
Whoops / dup.rb
Created May 24, 2011 22:34
Demonstration of shallow copy
require 'pp'
class DupMe
attr_accessor :stuff
def initialize
@stuff=[1,2,3,4,5,6]
end
def copy
new = self.dup
@Whoops
Whoops / output
Created January 24, 2011 21:23
demonstrate inheritance and polymorphism
C:\Users\walton.hoops\Desktop>ruby vehicle.rb
Cruisin in my Car
Cruisin in my Truck
get a long little doggie!
Tow that gosh durn Car
C:\Users\walton.hoops\Desktop>
create table authors ( id INTEGER primary key, name TEXT not null);
create table posts ( id INTEGER primary key, author_id INTEGER not null, title text not null,
content text not null );
insert into authors (name) values ('some guy');
insert into authors (name) values ('another guy');
--cheat here, I know the first id will be 1
insert into posts(author_id, title, content)
values (1, 'My first article', 'introductory text here');
insert into posts(author_id, title, content)
values (1, 'My second article', 'itermediate text here');
room ('coconut room') do
description 'This room has a massive amount of coconuts'
door do
to 'banjo room'
on_open do
# some stuff
end
locked true
end
end
module Drive
def go
start_engine
plan_route
follow_route
end
def start_engine
#code here
end
require 'rubygems'
require 'sinatra/base'
require 'omniauth'
require 'openid/store/filesystem'
require 'sinatra/mongomatic'
require 'models.rb'
class Teste < Sinatra::Base
register Sinatra::Mongomatic
foo='foo'
bar='bar'
class A
def self.call_block
foo="I've got a lovely bunch of coconuts"
bar='detitly doo'
#note, yield calls the block assigned to a function
yield foo, bar
end