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
task :write_memcache_config, :roles => :app, :except => {:no_release => true, :no_symlink => true} do | |
get("#{shared_path}/config/memcached.yml.tmpl", 'memcached.yml.tmpl') | |
template = IO.read "memcached.yml.tmpl" | |
File.unlink "memcached.yml.tmpl" | |
put template.sub(/%NAMESPACE%/, "lh#{File.basename latest_release}"), "#{release_path}/config/memcached.yml", :mode => 0644 | |
end | |
task :lh_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do | |
write_memcache_config | |
# other custom crap |
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 ActiveRecord::Base | |
@@cache_store = nil | |
def self.cache_store | |
@@cache_store ||= ActionController::Base.cache_store | |
end | |
def self.caches(method_name, key = nil, options = {}, &block) | |
if key.is_a?(Hash) | |
options = key | |
key = nil |
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 << Addressable::URI | |
# ActionController::Routing passes an unsafe char regex to URI.escape. However, | |
# Addressable::URI.escape has the correct unsafe char regexes for each url part. | |
def escape(uri, whatever) | |
encode(uri) | |
end | |
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
def self.encode(uri, character_class=nil, returning=String) | |
return nil if uri.nil? | |
if !uri.respond_to?(:to_str) | |
raise TypeError, "Can't convert #{uri.class} into String." | |
end | |
if ![String, ::Addressable::URI].include?(returning) | |
raise TypeError, | |
"Expected String or Addressable::URI, got #{returning.inspect}" | |
end | |
uri_object = uri.kind_of?(self) ? uri : self.parse(uri.to_str) |
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/ruby | |
# Post your direct messages from certain users as public tweets | |
# | |
# (ex) Broadcast DM's from tyler-durden and spacemonkey | |
# | |
# $ ruby twitter_bot.rb project-mayhem:password tyler-durden spacemonkey | |
# | |
# Stores the last modified and highest id in a yaml file in the pwd by the anme of 'twitter_bot.cache' | |
# Should block against dupes and be easy against twitter's servers |
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
module Lighthouse | |
ApiSpec.document Project do | |
action "Retrieve a list of projects for the current account." do | |
@projects = Project.all | |
end | |
action "Retrieve a single projects for the current account." do | |
@project = Project.get(@projects.first.id) | |
end | |
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
<div id="archives"> | |
{% for m in site.home_section.months %} | |
{{ m | strftime: "%Y" | assign_to: 'current_year' }} | |
{% if displayed_year != current_year %} | |
{% if displayed_year %} | |
</div> | |
{% endif %} | |
<div class="archive-year"> | |
<h4>{{ current_year }}</h4> | |
{% endif %} |
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 Foo | |
def foo | |
end | |
private | |
def bar | |
end | |
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
~> irb -rubygems -rcollections | |
irb(main):001:0> require 'collections/sequenced_hash' | |
irb(main):003:0> h=SequencedHash.new | |
irb(main):005:0> h[:a]=1 | |
irb(main):006:0> h[:b]=2 | |
irb(main):007:0> h[0] | |
=> nil | |
irb(main):008:0> h.at 0 | |
=> 1 | |
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
diff --git a/lib/lighthouse.rb b/lib/lighthouse.rb | |
index 4b89352..ebe6713 100644 | |
--- a/lib/lighthouse.rb | |
+++ b/lib/lighthouse.rb | |
@@ -23,6 +23,8 @@ rescue LoadError | |
puts | |
end | |
+$LOAD_PATH.unshift '/Users/technoweenie/p/rails/git/activeresource/lib' | |
+$LOAD_PATH.unshift '/Users/technoweenie/p/rails/git/activesupport/lib' |