Public Gists by sprsquish

Gravatar
Mon Oct 05 07:20:49 -0700 2009
1
config.middleware.use "Hostname", %x"hostname".chomp
Gravatar
Tue Sep 15 10:44:48 -0700 2009
1
2
3
/*
     File: QuickTime/QuickTime.h
 
Gravatar
Sat May 30 17:37:11 -0700 2009
1
2
3
/opt/jruby-1.3.0/lib/ruby/1.8/ffi/managedstruct.rb:51:in `bind_connect_server': no connectTcpServer with arguments matching [class org.jruby.RubyNil, class org.jruby.RubyNil, class org.jruby.RubyString, class org.jruby.RubyFixnum] on object #<EventMachine::JEM:0xd3633c @java_object=#<Java::JavaObject:0x18317f>> (NameError)
from /opt/jruby-1.3.0/lib/ruby/gems/1.8/gems/eventmachine-0.12.8-java/lib/jeventmachine.rb:88:in `connect_server'
from /opt/jruby-1.3.0/lib/ruby/gems/1.8/gems/eventmachine-0.12.8-java/lib/eventmachine.rb:710:in `bind_connect'
Gravatar
Mon May 25 10:15:15 -0700 2009
1
2
3
# plaintext
say 'j@d', 'this will be sent as plaintext'
 
Gravatar
Tue May 19 09:32:53 -0700 2009
1
2
3
require 'nokogiri'
include Nokogiri::XML
 
Gravatar
Sun May 17 15:43:57 -0700 2009
1
2
3
n = Nokogiri::XML::Node.new('root', Nokogiri::XML::Document.new)
n << Nokogiri::XML::Node.new('child', n.document)
n << (c = Nokogiri::XML::Node.new('child', n.document))
Gravatar
Sun May 17 13:12:57 -0700 2009
1
2
3
<?xml version="1.0"?>
<inventory xmlns="http://alicesautosupply.example.com/">
  <tire name="super slick racing tire" />
Gravatar
Sun May 17 09:45:12 -0700 2009
1
2
3
attributes_array.each do |item|
  if key
    case key
Gravatar
Thu May 14 00:12:30 -0700 2009
1
2
3
# A single ruby script that plays ping pong with itself over XMPP
# That's two separate clients connected to the same server using different resource IDs
# Ping will wait until it knows Pong is online, then it'll start the match
Gravatar
Fri May 08 16:17:28 -0700 2009
1
2
3
iq
|-- pubsub
| |-- pubsub_affiliations
Gravatar
Fri May 08 14:18:11 -0700 2009
1
2
3
arr = [1,2,3,4,5,6,7]
half = arr.size / 2
first_half = arr[0...half]
Gravatar
Wed Apr 29 08:27:37 -0700 2009
1
2
3
# PubSub ping pong in Blather
 
setup 'ping-pong@jabber.local', 'ping-pong'
Gravatar
Tue Apr 21 06:15:56 -0700 2009
1
2
3
      def type
        case attributes['type']
          when 'cancel' then :cancel
Gravatar
Mon Mar 09 10:11:07 -0700 2009
1
2
3
<p>
<a href="http://www.facebook.com/l.php?u=http://www.dci.org%2Fcountdown%2F" target="_blank">
<img src="http://www.facebook.com/l.php?u=http://www.dci.org%2Fimages%2F_vd%2Fcountdown%2F2009%2F2009_countdown_main.jpg" border="0">
Gravatar
Tue Feb 10 21:31:29 -0800 2009
1
2
3
module JustinFrench
  module Formtastic
    class SemanticFormBuilder < JustinFrench::Formtastic::SemanticFormBuilder
Gravatar
Sun Feb 08 11:31:01 -0800 2009
1
2
3
class ImageModelsController < ApplicationController
  before_filter :find_image_model, :only => [:update]
 
Gravatar
Fri Feb 06 06:57:36 -0800 2009
1
2
3
# using active record you can easily hit this common performance issue
#
 
Gravatar
Thu Feb 05 13:26:51 -0800 2009
1
2
3
(function($) {
 
    $.fn.tweet = function(o){
Gravatar
Tue Jan 27 15:48:05 -0800 2009
1
2
3
function parse_git_dirty {
  [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "☠"
}
Gravatar
Tue Jan 06 16:56:28 -0800 2009
1
2
3
class Foo
  def bar
  end