Skip to content

Instantly share code, notes, and snippets.

Timothy Elliott ender672

View GitHub Profile
View gist:211921
irb(main):001:0> class Object; def require(*args, &block); puts "requiring #{args[0]}"; super *args, █ end; end
=> nil
irb(main):003:0> require 'config/environment.rb'
requiring config/environment.rb
requiring /home/tim/Documents/grub_website/config/boot
requiring rails
requiring rails/initializer
requiring pathname
requiring rails/initializable
requiring rails/application
View gist:211923
tim@tim-laptop:~/Documents/grub_website$ unicorn
I, [2009-10-16T10:53:20.843724 #7796] INFO -- : listening on addr=0.0.0.0:8080 fd=3
I, [2009-10-16T10:53:20.850217 #7796] INFO -- : worker=0 spawning...
I, [2009-10-16T10:53:20.851834 #7800] INFO -- : worker=0 spawned pid=7800
I, [2009-10-16T10:53:20.852031 #7800] INFO -- : Refreshing Gem list
I, [2009-10-16T10:53:20.855752 #7796] INFO -- : master process ready
/usr/local/lib/ruby/gems/1.9.1/gems/arel-0.1.0/lib/arel/algebra/relations/relation.rb:49:in `block in <module:Operable>': undefined method `classify' for "where":String (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/arel-0.1.0/lib/arel/algebra/relations/relation.rb:46:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/arel-0.1.0/lib/arel/algebra/relations/relation.rb:46:in `<module:Operable>'
from /usr/local/lib/ruby/gems/1.9.1/gems/arel-0.1.0/lib/arel/algebra/relations/relation.rb:30:in `<class:Relation>'
View gist:238217
module Sliceable
def slice!
if @sliced
puts "The #{name} is already sliced!\n"
else
@sliced = true
puts "Done slicing the #{name}.\n"
end
end
end
View gist:302049
From 9f498d662e0b1cd1ddfdb985928fb6b2a4d50dcf Mon Sep 17 00:00:00 2001
From: ender672 <tle@holymonkey.com>
Date: Thu, 11 Feb 2010 14:29:12 -0800
Subject: [PATCH] Remove a hack for bin wrappers that caused an error with unicorn
---
lib/bundler/runtime.rb | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
View template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Web Development &amp; Programming Thoughts</title>
<meta name="description" content="Timothy Elliott's Technical Blog" />
<meta name="keywords" content="Web Development, Programming" />
<style>
body {
background-color: #EEE;
View gist:1449283
require 'nokogiri'
html = '<html><body><br/></body></html>'
# Nokogiri's new HTML encoding detection uses a custom SAX document handler to
# "peek" at an IO before parsing it.
#
# It interrupts the SAX parser by throwing from the context of a SAX document
# handler callback:
# https://github.com/tenderlove/nokogiri/blob/master/lib/nokogiri/html/document.rb#L144
View gist:1452707
require 'nokogiri'
# This test runs an infinite loop which throws from random Nokogiri SAX handler
# callbacks.
#
# It uses the sample XML files in Nokogiri's test suite, and expects to run from
# the Nokogiri folder, e.g. via:
# $ cd ~/workspace/nokogiri
# $ ruby -Ilib smokesax.rb
View gist:1468631
require 'nokogiri'
ENTER_PROMPT = 'Running. Press <Enter> to pause.'
def ui
loop do
puts '(c)ontinue'
puts '(n)ext'
puts '(q)uit'
print '> '
View gist:1485439
require 'nokogiri'
xml = <<END
<foo xmlns="http://example.com">
<bar xmlns:n1="http://bar.com">
<baz xmlns:n2="http://baz.com">
</baz>
</bar>
</foo>
END
@ender672
ender672 / config.ru
Created Jan 28, 2012
Dynamic, image-resizing rack application
View config.ru
require 'rack'
require 'rack/cache'
require './squint'
use Rack::Chunked
use Rack::Cache,
:verbose => true,
:allow_reload => false,
:metastore => 'file:cache/meta',
You can’t perform that action at this time.