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
# deploy to dir in ruby load paths | |
# ruby -rd [program] | |
require 'rubygems' | |
require 'ruby-debug' | |
Debugger.start | |
Debugger.post_mortem | |
module Kernel | |
def d | |
debugger | |
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
# Usage: | |
# ruby twitter_stream_api_test.rb USERNAME PASSWORD | |
require 'rubygems' | |
require "socket" | |
require 'base64' | |
require 'json' | |
username, password = *ARGV[0..1] |
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
% ruby test.rb | |
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:636: [BUG] Bus Error | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9] |
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
diff --git a/lib/plugins/defaults/retweet.rb b/lib/plugins/defaults/retweet.rb | |
index 560128a..cb3debc 100644 | |
--- a/lib/plugins/defaults/retweet.rb | |
+++ b/lib/plugins/defaults/retweet.rb | |
@@ -1,18 +1,18 @@ | |
# -*- coding: utf-8 -*- | |
config.plugins.retweet.set_default(:format, '<%= comment %>RT @<%=s.user.screen_name%>: <%=s.text%>') | |
-config.plugins.retweet.set_default(:block_protected, 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
# ~/.termtter/config | |
Termtter::Client.init do |t| | |
... | |
t.register_hook(:highlight_keywords, :point => :pre_coloring) do |text, event| | |
text.gsub(/(@jugyo|termtter)/i, '<on_red><white>\1</white></on_red>') | |
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
diff --git a/lib/termtter/client.rb b/lib/termtter/client.rb | |
index d28e242..eceb371 100644 | |
--- a/lib/termtter/client.rb | |
+++ b/lib/termtter/client.rb | |
@@ -296,16 +296,22 @@ module Termtter | |
@init_block = block | |
end | |
+ def load_plugins | |
+ plug 'defaults' |
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
# sample to clone attachement_fu object. | |
class Foo < ActiveRecord::Base | |
has_attachment :storage => :file_system, :path_prefix => 'assets/foo' | |
# create clone, but thumbnails are not cloned. | |
def create_clone | |
returning clone do |c| | |
c.temp_paths.unshift create_temp_file | |
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
# add a utility method 'set_file' | |
module Technoweenie | |
module AttachmentFu | |
module InstanceMethods | |
def set_file(path, content_type = Mime::TEXT) | |
raise ArgumentError, "No such file - #{path}" unless File.exists?(path) | |
self.filename = File.basename(path) | |
self.content_type = content_type | |
set_temp_data File.read(path) | |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# | |
# lingr twitter gateway | |
# | |
require 'rubygems' | |
require 'sinatra' | |
require 'logger' |
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
module Rack | |
class Foo | |
def initialize app | |
@app = app | |
end | |
def call(env) | |
[200, { 'Content-Type' => 'text/html' }, 'OK'] | |
end | |
end |