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
SELECT | |
t.tablename, | |
indexname, | |
c.reltuples AS num_rows, | |
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size, | |
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size, | |
CASE WHEN indisunique THEN 'Y' | |
ELSE 'N' | |
END AS UNIQUE, | |
idx_scan AS number_of_scans, |
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 import_file_data(file_path, content, import_type, strategy_name, additional_attributes = {}, options = {}) | |
# probably file_path is a String and the result file_name as well | |
file_name = File.basename(file_path) | |
# no idea what tempfile is, a string? | |
tempfile = write_to_temp_file(content, file_name) | |
uploaded_file = OpenStruct.new(:original_filename => file_name, :tempfile => tempfile) | |
# Is this now an instance of ResourceImport or a result of a resource import? | |
resource_import = ResourceImport.import!(user, project, uploaded_file, file_path, import_type, strategy_name, additional_attributes) |
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
#!upstart | |
description "redis" | |
start on runlevel [23] | |
script | |
export HOME="/home/redis" | |
exec sudo -u redis /home/redis/redis-2.0.0-rc2/redis-server /home/redis/redis-2.0.0-rc2/redis.conf | |
end script |
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
# IRBRC file by Iain Hecker, http://iain.nl | |
# put all this in your ~/.irbrc | |
require 'rubygems' | |
require 'yaml' | |
alias q exit | |
class Object | |
def local_methods | |
(methods - Object.instance_methods).sort |
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
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:71: warning: already initialized constant State | |
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:72: warning: already initialized constant SAFE_STATE_PROTOTYPE | |
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:73: warning: already initialized constant FAST_STATE_PROTOTYPE | |
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/common.rb:80: warning: already initialized constant PRETTY_STATE_PROTOTYPE | |
/Users/heli/.rvm/gems/ruby-1.9.2-p0/gems/json-1.4.6/lib/json/pure.rb:76: warning: already initialized constant JSON_LOADED |
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 Book < ActiveRecord::Base | |
belongs_to :auther | |
searchable do | |
text :title, :default_boost => 2 | |
text :description | |
time :updated_at # for sorting by recent | |
integer :auther_id, :multi => true do | |
authers.map {|auther| auther.auther_id} | |
end | |
boolean :published, :using => :published? |
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
# Rails 2.3.5 - 2.3.11 environment settings (config/environment.rb) | |
config.gem 'airbrake', :version => '2.4.11', :require => "hoptoad_notifier" | |
# Rails 3 - bundler Gemfile(config/Gemfile) | |
gem 'airbrake', '2.4.11', :require => "hoptoad_notifier" | |
# In Hoptoad initializer (config/hoptoad.rb) | |
HoptoadNotifier.configure do |config| | |
config.api_key = '<api key>' | |
config.host = 'airbrakeapp.com' |
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
# Rails 2.3.5 - 2.3.11 environment settings (config/environment.rb) | |
config.gem 'airbrake', :version => '2.4.11', :require => "hoptoad_notifier" | |
# Rails 3 - bundler Gemfile(config/Gemfile) | |
gem 'airbrake', '2.4.11', require => "hoptoad_notifier" | |
# In Hoptoad initializer (config/hoptoad.rb) | |
HoptoadNotifier.configure do |config| | |
config.api_key = '<api key>' | |
config.host = 'airbrakeapp.com' |
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
location = /robots.txt { access_log off; log_not_found off; } | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location ~ /\. { access_log off; log_not_found off; deny all; } | |
location ~ ~$ { access_log off; log_not_found off; deny all; } |
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
# as we’re going to use Unicorn as the application server | |
# we’re not going to use common sockets | |
# but Unix sockets for faster communication | |
upstream linguist { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/.sock fail_timeout=0; |
OlderNewer