This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nav | |
def self.padded_selector(sel, max_len) | |
sel.ljust(max_len) | |
end | |
attr_accessor :id, :height, :items, :image | |
def initialize(attrs={}) | |
attrs.each { |k,v| send("#{k}=", v) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'isaac' | |
config do |c| | |
c.nick = "somefanfrickentasticbot" | |
c.server = "irc.freenode.net" | |
c.port = 6667 | |
end | |
on :connect do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Toggler</title> | |
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
(function($) { | |
$.fn.toggler = function(options) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'httparty', '0.2.0' | |
require 'httparty' | |
class JSONPretty | |
include HTTParty | |
def self.generate(url) | |
JSON.pretty_generate(get(url, :format => :json)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "openssl" | |
require "net/smtp" | |
Net::SMTP.class_eval do | |
private | |
def do_start(helodomain, user, secret, authtype) | |
raise IOError, 'SMTP session already started' if @started | |
check_auth_args user, secret, authtype if user or secret | |
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'httparty' | |
require 'time' | |
require 'active_support' | |
File.read("#{ENV['HOME']}/.gitconfig").match(/token = (\w+)/) | |
TOKEN = $1 | |
class Github | |
include HTTParty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# more examples here: http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/ | |
begin | |
retryable( :tries => 2 ) do | |
Timeout::timeout(5) do |t| | |
xml_string = open( my_url, "User-Agent" => "Firefox/2.0" ).read | |
end | |
end | |
rescue Timeout::Error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick wrapper for undocumented and unsupported MyMileMarker.com API | |
require 'rubygems' | |
gem 'httparty', '>= 0.3.1' | |
require 'httparty' | |
module MyMileMarker | |
class Client | |
include HTTParty | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require 'test_help' | |
gem 'jnunemaker-matchy', '>= 0.4.0' | |
require 'matchy' | |
class ActiveSupport::TestCase | |
self.use_transactional_fixtures = true | |
self.use_instantiated_fixtures = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testapp |
OlderNewer