Skip to content

Instantly share code, notes, and snippets.

View sprsquish's full-sized avatar

Jeff Smick sprsquish

View GitHub Profile
module JustinFrench
module Formtastic
class SemanticFormBuilder < JustinFrench::Formtastic::SemanticFormBuilder
def initialize(*args)
::ActiveSupport::Deprecation.warn("JustinFrench::Formtastic::SemanticFormBuilder is depreciated. User Formtastic::SemanticFormBuilder instead", caller)
super
end
end
end
end
<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">
</a>
Drum Corps International’s 2009 spring cinema event &quot;The Countdown&quot; comes to theaters nationwide on Wednesday, May 13, and you can help us determine which corps performances will be shown up on the big screen!
</p>
Try that one. The difference was I removed 'align="left"' from the img tag. That will cause the image to float left and the text to flow around the right side of it.
def type
case attributes['type']
when 'cancel' then :cancel
when 'form' then :form
when 'result' then :result
when 'submit' then :submit
else nil
end
end
# PubSub ping pong in Blather
setup 'ping-pong@jabber.local', 'ping-pong'
pubsub.host = 'pubsub.jabber.local'
pubsub_event :node => 'ping' do |node|
pubsub.publish 'pong', node.payload
end
arr = [1,2,3,4,5,6,7]
half = arr.size / 2
first_half = arr[0...half]
last_half = arr[half..-1]
iq
|-- pubsub
| |-- pubsub_affiliations
| |-- pubsub_items
| `-- pubsub_subscriptions
`-- query
|-- disco_info
|-- disco_items
`-- roster
message
# 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
require 'blather/client/dsl'
$stdout.sync = true
module Ping
extend Blather::DSL
def self.run; client.run; end
attributes_array.each do |item|
if key
case key
when "xmlns"
e.namespaces.namespace = XML::Namespace.new(e, nil, item)
when /^xmlns:(.*)$/
e.namespaces.namespace = XML::Namespace.new(e, $1, item)
else
e[key] = item
end
<?xml version="1.0"?>
<inventory xmlns="http://alicesautosupply.example.com/">
<tire name="super slick racing tire" />
<tire name="all weather tire" />
</inventory>
<inventory xmlns="http://bobsbikes.com">
<tire name="narrow street tire" />
<tire name="mountain trail tire" />
</inventory>
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))
c.default_namespace = 'foo:bar'
n.search './child', {'xmlns' => 'foo:bar'}