My Recent Pastes (435 and counting)
Pastes by technoweenie (435 and counting)
Below are the 15 most recent pasties by technoweenie.
May 16, 2007
10:54PM EDT
by technoweenie
View all 15 lines
def relative_time(time) date = time.to_date today = Time.now.to_date if date == today "today"
May 16, 2007
4:38PM EDT
by technoweenie
View all 37 lines
class ActionController::Caching::Sweeper def expire_found_files(base_path, expression = nil) expire_command(base_path, expression) do |exp, base| cmd = %{find #{exp} | xargs rm} ActionController::Base.benchmark "Expire Found Files in #{base}: #{cmd}" do
May 16, 2007
3:35PM EDT
by technoweenie
# vendor/plugins/view-ar/init.rb require 'application' ApplicationController.view_paths = [File.expand_path(File.join(directory, 'views'))] + ApplicationController.view_paths # custom layout resides in vendor/plugins/view-ar/views/layouts/application.rhtml
May 16, 2007
3:31AM EDT
by technoweenie
View all 92 lines
## config/cap_gem.rb require 'rubygems' require 'capistrano' # Installs within Capistrano as the plugin _gem_. # Prefix all calls to the library with <tt>gem.</tt>
May 15, 2007
11:34AM EDT
by technoweenie
View all 17 lines
/usr/lib64/ruby/1.8/net/protocol.rb:133:in `sysread' /usr/lib64/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' /usr/lib64/ruby/1.8/timeout.rb:56:in `timeout' /usr/lib64/ruby/1.8/timeout.rb:76:in `timeout' /usr/lib64/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
May 11, 2007
5:29PM EDT
by technoweenie
View all 21 lines
class Array # [%w(a 1), %w(b 1), %w(a 2)].uniq_by! { |a| a.first } # => [%w(a 1), %w(b 1)] def uniq_by! arr = dup
May 11, 2007
1:21PM EDT
by technoweenie
View all 80 lines
## console rick@ricks-computer:~/p/mystique/ext% ragel -R mystique.rl | rlgen-ruby rick@ricks-computer:~/p/mystique/ext% irb -r mystique.rb irb(main):001:0> Mystique.parse("{%foo%}")
May 10, 2007
8:25PM EDT
by technoweenie
View all 7 lines
module GuitarHero def self.included(base) class << base attr_accessor :tasty_jams end
May 10, 2007
11:08AM EDT
by technoweenie
View all 89 lines
# Since this mongrel handler is loaded alongside a rails app, # I can just piggyback off that ActiveRecord connection class ImifiedAccount < ActiveRecord::Base end
May 10, 2007
2:37AM EDT
by technoweenie
View all 7 lines
best guess the whole electromagnetic phenomenon bit is the key. they say the philadelphia experiment and montauk myth are inspirations. the philadelphia experiment was basically about using rotating electromagnets to render a ship invisible. myth has it that instead of that it ended up teleporting, and supposedly sailors got stuck phased into walls, flickering in and out of this dimension, etc. montauk, basically rogue cia scientists open up a rift in time and futuristic monsters show up, among all kinds of other kooky mind control conspiracy crap.
May 09, 2007
5:46PM EDT
by technoweenie
View all 27 lines
# comment # variable assignment a = "asdf" a = b = "asdf"
May 09, 2007
1:22PM EDT
by technoweenie
View all 83 lines
Index: test/another_lalr_but_not_slr_grammar.rb =================================================================== --- test/another_lalr_but_not_slr_grammar.rb (revision 1384) +++ test/another_lalr_but_not_slr_grammar.rb (working copy) @@ -1,4 +1,6 @@
May 09, 2007
11:57AM EDT
by technoweenie
View all 99 lines
Index: dhaka-2.1.0/lib/tokenizer/tokenizer.rb =================================================================== --- dhaka-2.1.0/lib/tokenizer/tokenizer.rb (revision 1384) +++ dhaka-2.1.0/lib/tokenizer/tokenizer.rb (working copy) @@ -40,6 +40,7 @@
May 09, 2007
9:55AM EDT
by technoweenie
View all 12 lines
# TODO: Add further character support; this is just for initial release letters = ('a'..'z').to_a numbers = ('0'..'9').to_a printables = letters + numbers + extras
May 08, 2007
5:46PM EDT
by technoweenie
View all 23 lines
class StatusHandler < Mongrel::HttpHandler def initialize @mutex = Mutex.new end