This file contains hidden or 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
# http://www.ruby-forum.com/topic/75258#116892 | |
# you could eventually put this in your rails config/environment.rb | |
module Kernel | |
private | |
def this_method | |
caller[0] =~ /`([^']*)'/ and $1 | |
end | |
end |
This file contains hidden or 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
begin | |
raise "boom" | |
rescue => detail | |
Rails.logger.warn detail.backtrace.join("\n") | |
end | |
# ripped from here: http://codesnippets.joyent.com/posts/show/1983 |
This file contains hidden or 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 'irb/completion' | |
require 'map_by_method' | |
require 'what_methods' | |
require 'pp' | |
require 'wirble' | |
Wirble.init | |
Wirble.colorize | |
IRB.conf[:AUTO_INDENT] = true |
This file contains hidden or 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
# tons of warnings when trying to run rails3b3 activemodel's test suite: | |
portal:activemodel olistik$ rake | |
(in /Volumes/data/code/ruby/rails/projects/rails3/contribute/rails/activemodel) | |
/Users/olistik/.rvm/gems/ruby-1.9.2-head@rails3beta3/gems/bundler-0.9.19/lib/bundler.rb:70: warning: instance variable @setup not initialized | |
/Users/olistik/.rvm/gems/ruby-1.9.2-head@rails3beta3/gems/bundler-0.9.19/lib/bundler/shared_helpers.rb:106: warning: method redefined; discarding old gem | |
/Users/olistik/.rvm/gems/ruby-1.9.2-head@rails3beta3/gems/bundler-0.9.19/lib/bundler/shared_helpers.rb:103: warning: previous definition of gem was here | |
/Users/olistik/.rvm/gems/ruby-1.9.2-head@rails3beta3/gems/bundler-0.9.19/lib/bundler/shared_helpers.rb:138: warning: method redefined; discarding old from_gems_in | |
[...] |
This file contains hidden or 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
$ rvm info | |
system: | |
uname: "Darwin portal.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386 i386" | |
shell: "bash" | |
version: "3.2.48(1)-release" | |
rvm: | |
type: "rvm is a function" | |
version: "rvm 0.1.27 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]" |
This file contains hidden or 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
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.buongiorno.gpp.wwf.portlet.core.extension.AnnotationHandlerMapping#0' defined in PortletContext resource [/WEB-INF/context/portlet/registrationPortlet.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Lcom/buongiorno/innovation/gambling/api/ParamDigestService; | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) | |
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) | |
at org.sp |
This file contains hidden or 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
# run me with: ruby wait_for_lucid_lynx.rb | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'ruby-growl' | |
g = Growl.new "localhost", "ruby-growl", | |
["ruby-growl Notification"] |
This file contains hidden or 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 'net/http' | |
module Http | |
def self.get(uri) | |
url = URI.parse uri | |
req = Net::HTTP::Get.new(url.path) | |
res = Net::HTTP.start(url.host, url.port) do |http| | |
http.request(req) | |
end | |
res.body |
This file contains hidden or 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
## IS THERE A SIMPLER WAY OF CHANGING some fields of a DateTime Object? | |
real = DateTime.parse(DateTime.now.to_s) | |
fixed = DateTime.new(real.year, real.month, real.day, real.hour, real.minute, real.second) | |
## SOLUTION | |
## http://api.rubyonrails.org/classes/DateTime.html | |
## DateTime#change | |
new_date = DateTime.now.change({year: 2012, sec: 42}) |
This file contains hidden or 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
/* | |
* I'm using Google Chrome | |
* 1) open http://twitter.com/#!/olistik/following | |
* 2) scroll to the very end of the page | |
* 3) switch to console tab (ALT+CMD+J) | |
*/ | |
var following = []; | |
jQuery('.user-name strong').each(function() { | |
following.push(jQuery(this).html()); |
OlderNewer