Skip to content

Instantly share code, notes, and snippets.

@J-maxx
J-maxx / scripter.rb
Created October 7, 2011 22:00
pdf-reader
require 'rubygems'
require 'pdf/reader'
class Script
def show_text(string)
puts string
end
end
@J-maxx
J-maxx / test.txt
Created September 23, 2011 19:20
SCREENPLAY SAMPLE TEXT
ONE DAY
by
David Nicholls
Based on the novel by David Nicholls
Yellow Pages - 27th July, 2010
Pink Pages - 14th July, 2010
Blue pages- 12th July, 2010
Shooting draft - 2nd July, 2010
Interim draft #2 - 11th June, 2010
Interim draft - 28th May, 2010
@J-maxx
J-maxx / script_parse.rb
Created September 16, 2011 20:54
SCRIPT PARSE with Regex
File.foreach("script_test.txt") do |line|
match = /^EXT\.|^INT\.|^\d{1,3}\s|^\d{1,3}[A-Z]\s|^SCENE/
if line =~ match
puts line
end
end
str = File.read("test.txt")
mch = (/^EXT\..+\n/).match(str)
mch.post_match
@J-maxx
J-maxx / order.rb
Created April 2, 2011 16:11
Testing ways to price our hotdogs...
MENU = {:hotdog => 2,:coke => 1,:chips => 20}
order = ["coke", "hotdog"]
h = Hash.new
order.each do |f|
h[f.to_sym] = MENU.fetch(f.to_sym)
end
@J-maxx
J-maxx / module_example.rb
Created March 28, 2011 02:31
Modules: 2 Classes with same name
# An example below demonstrating 2 classes with the same name in different modules
# Modules simply provide ways to organize classes, methods, and constants into
# separate namespaces...courtesy of Peter Cooper
module Toolbox
class Ruler
attr_accessor :length
end
end
@J-maxx
J-maxx / paymenew.rb
Created March 12, 2011 22:01
LESS STANK PAYROLL
class Payroll
def initialize(args)
@rate = args[ :rate].to_f
@call = args[ :call].to_f
@wrap = args[ :wrap].to_f
@lunch = args[ :lunch].to_f
@dinner = args[ :dinner].to_f
end
@J-maxx
J-maxx / payroll.rb
Created March 10, 2011 18:42
PAYROLL
# Calculates Daily Pay Hours & Pay for Tier 3 Agreement Productions
class Payroll
def initialize(rate, call, wrap, lunch, dinner)
@rate = rate.to_f
@call = call.to_f
@wrap = wrap.to_f
@lunch = lunch.to_f
@dinner = dinner.to_f