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
<textarea name="article_comment[body]" id="article_comment_body"> | |
</textarea> | |
<input type="submit" value="Save" name="submit"/> | |
<form method="post" action="/article_comment"> | |
<textarea name="article_comment[body]" id="article_comment_body"></textarea> | |
<input type="submit" value="Save" name="submit"/> | |
</form> | |
<hr/> |
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
sql_attr_multi = uint feature_ids from query; \ | |
SELECT DISTINCT ON (feature_options.feature_id) restaurants.id, feature_options.id \ | |
FROM feature_options \ | |
INNER JOIN restaurant_feature_options ON feature_options.id = restaurant_feature_options.feature_option_id \ | |
INNER JOIN restaurants ON restaurants.id = restaurant_feature_options.restaurant_id \ | |
INNER JOIN features ON features.id = feature_options.feature_id \ | |
WHERE features.radio = 't' \ | |
ORDER BY feature_options.feature_id ASC, restaurant_feature_options.votes DESC; |
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 | |
# | |
# Usage: pages_count.rb /path/to/docx_file.docx | |
require 'rubygems' | |
require 'zip/zip' | |
require 'zip/zipfilesystem' | |
require 'nokogiri' | |
# open zipfile from arguments |
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 ActiveSupport::Cache::MyMemCacheStore < ActiveSupport::Cache::MemCacheStore | |
def initialize(*addresses) | |
super(*addresses) | |
extend ActiveSupport::Cache::Strategy::LocalCache | |
end | |
def read(key, options = nil) | |
super.untaint | |
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
Before do | |
$rails_server ||= Culerity::run_rails | |
sleep 5 | |
$server ||= Culerity::run_server | |
$browser = Culerity::RemoteBrowserProxy.new $server, {:browser => :firefox} | |
$browser.webclient.setJavaScriptEnabled(false) | |
@host = 'http://localhost:3001' | |
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 Foo | |
@@actions = [:a, :b] | |
def self.show | |
puts @@actions.inspect | |
end | |
end | |
class Bar < Foo | |
def initialize |
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
Riddle::Client.connection_proc = Proc.new { |client| | |
config = ThinkingSphinx::Configuration.instance | |
controller = DaemonController.new( | |
:identifier => 'Sphinx search server', | |
:start_command => "#{config.bin_path}searchd --pidfile --config #{config.config_file}", | |
:before_start => Proc.new {}, | |
:ping_command => lambda { TCPSocket.new(client.server, client.port) }, | |
:pid_file => config.pid_file, | |
:log_file => config.searchd_log_file |
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
ThinkingSphinx::Test.init(true) | |
ThinkingSphinx::Test.start_with_autostop | |
Before("@sphinx") do | |
ThinkingSphinx::Test.index | |
sleep(0.5) | |
end | |
at_exit do | |
ThinkingSphinx::Test.stop |
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 words | |
@words ||= 'something something something... ' | |
end | |
end | |
class Bar < Foo | |
def words | |
@words ||= super + 'dark side!' | |
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 ArticlesPart < Parts::Base | |
def index | |
return if fragment_exist?([:articles_part, Article.last]) | |
@articles = Articles.recent | |
render | |
end | |
end |