Skip to content

Instantly share code, notes, and snippets.

<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/>
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;
#!/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
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
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
class Foo
@@actions = [:a, :b]
def self.show
puts @@actions.inspect
end
end
class Bar < Foo
def initialize
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
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
class Foo
def words
@words ||= 'something something something... '
end
end
class Bar < Foo
def words
@words ||= super + 'dark side!'
end
class ArticlesPart < Parts::Base
def index
return if fragment_exist?([:articles_part, Article.last])
@articles = Articles.recent
render
end
end