View utf16-to-utf8.rb
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
#!/usr/bin/env ruby | |
# Use as TextMate command to convert | |
require 'iconv' | |
puts Iconv.iconv('utf-8', 'utf-16le', File.read(ENV['TM_FILEPATH'])).first |
View transparent.rb
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
g = Gruff::Line.new(400) | |
g.title = "Transparent Background" | |
g.theme = { | |
:colors => ['black', 'grey', 'red', '#ff43a7'], | |
:marker_color => 'grey', | |
:font_color => 'black', | |
:background_colors => 'transparent' | |
} |
View rexml_spec.rb
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
## | |
# AUTHORS: Geoffrey Grosenbach http://nubyonrails.com | |
# Also http://p.ramaze.net/1887 | |
# | |
# INSTALLATION: | |
# Copy to spec/lib/rexml_spec.rb, or any subdirectory of "spec" | |
# | |
# RUN: | |
# spec spec/lib/rexml_spec.rb | |
# |
View gist:7224
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
/´¯/) | |
/´¯/) ,/¯ / | |
,/¯ / / / | |
/ /´¯/'¯¯'/´¯¯¯`·¸ | |
/ / / / /¨¯\ | |
('( ´ ´ ¯~/' ') | |
\ ' / | |
'' \ _ ·´ | |
\ ( | |
\ \ |
View ad.js
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
(function(i) {u = navigator.userAgent; e = /*@cc_on!@*/false; st = setTimeout; | |
if(/webkit/i.test(u)){st(function(){dr = document.readyState;if(dr=="loaded"|| | |
dr=="complete"){i();}else{st(arguments.callee,10);}},10);}else if((/mozilla/i. | |
test(u)&&!/(compati)/.test(u))||(/opera/i.test(u))){document.addEventListener( | |
"DOMContentLoaded",i,false);} else if(e){(function(){t=document.createElement( | |
'doc:ready');try{t.doScroll('left');i();t= null;}catch(e){st(arguments.callee, | |
0);}})();}else{window.onload = i;}})(function() { | |
// Stylesheet loaded into HEAD tag directly, but in-line it to avoid | |
// making another HTTP request. |
View optparse_example.rb
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
#!/bin/env ruby -w | |
require 'optparse' | |
require File.dirname(__FILE__) + "/../lib/couchrest" | |
# Set defaults | |
options = { | |
:verbose => false, | |
:design_name => "_design", | |
} |
View basic_model.rb
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
# NOTE: See further development and a gem at http://github.com/topfunky/basic_model | |
require 'couchrest' | |
## | |
# A minimal class to help use CouchDB and CouchRest with Rails. | |
# | |
# Provides dot notation access for all attributes, one level deep. | |
# | |
# note.title |
View custom_exceptional_logger.rb
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
# Updated for current plugin | |
def log_to_exceptional(exception) | |
logger.info "Exception #{exception.inspect}" | |
Exceptional.handle(exception, self, request, params) | |
rescue NoMethodError | |
logger.info "Couldn't log to Exceptional" | |
end |
View Rakefile
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
desc "Install merb from the repository" | |
task :default do | |
system "sudo gem install wycats-thor -s http://gems.github.com" | |
system "curl -L http://merbivore.com/merb.thor > merb.thor" | |
system "sudo thor merb:edge --install" | |
system "sudo thor merb:edge:plugins ---install" | |
system "sudo thor merb:edge:do mysql --install" | |
system "sudo thor merb:edge:dm_core --install" | |
system "sudo thor merb:edge:dm_more --install" |
View ruby-error.rb
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
irb> require 'rubygems'; require 'beanstalk-client'; | |
irb> p = Beanstalk::Pool.new(['localhost:11300']) | |
EOFError: EOFError | |
irb> p.put "hello" | |
EOFError: EOFError | |
EOFError: EOFError | |
SocketError: getaddrinfo: Name or service not known | |
Beanstalk::NotConnected: Beanstalk::NotConnected |
OlderNewer