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
delimiter = "[-/.]+" | |
century_prefix = "(?:19|20)" | |
under_ten = "(?:0[1-9]+)" | |
ten_to_twelve = "(?:1[012]+)" | |
ten_and_under_thirty = "(?:[12]+[0-9]+)" | |
thirties = "(?:3[01]+)" | |
pattern = %r[ | |
( |
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
http://ujihisa.blogspot.com/2009/06/rubygems-best-practice.html |
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
namespace :facebooker do | |
tunnel_ns = namespace :tunnel do | |
# Courtesy of Christopher Haupt | |
# http://www.BuildingWebApps.com | |
# http://www.LearningRails.com | |
desc "Create a reverse ssh tunnel from a public server to a private development server." | |
task :start => [ :environment, :config ] do | |
puts @notification | |
system @ssh_command |
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 A | |
def initialize(foo) | |
dispatch if respond_to? :dispatch | |
end | |
end | |
class B < A | |
def dispatch | |
puts "called dispatch" | |
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
<% if @current_site.google_analytics_web_property_id %> | |
<script type="text/javascript"> | |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
</script> | |
<script type="text/javascript"> | |
try { | |
var pageTracker = _gat._getTracker("<%= @current_site.google_analytics_web_property_id %>"); | |
pageTracker._trackPageview(); | |
} catch(err) {} |
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
- filtered_filenames(@items).each do |name| | |
%p do some stuff |
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
-(@items || []).map {|i| i[%r[/(?!index|hide-[^/]+)([^/]+)\.haml],1]}.compact.each do |name| | |
%p do some stuff |
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
- if @items | |
- @items.each do |item| | |
- name = item.gsub(/views\/.+\/(.+).haml/, '\1') | |
- unless name == "index" || name[/^hide-/] | |
%p do some stuff |
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 f(ra,n) | |
ra.select {|x| x.include? n}.size | |
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
class String | |
class TextHelperSingleton | |
def self.instance; @instance ||= new end | |
include ActionView::Helpers::TextHelper | |
end | |
def method_missing(method, *args, &block) | |
if TextHelperSingleton.instance.respond_to?(method) | |
self.class.send(:define_method, method, &block) do | |
TextHelperSingleton.instance.send(method, self, *args, &block) |
NewerOlder