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 default template | |
# usage: rails new <app_name> -m template.rb -T -B | |
# command list: http://rdoc.info/github/wycats/thor/master/Thor/Actions.html | |
# gems | |
gem_group :test do | |
gem 'database_cleaner' | |
gem 'rspec-rails' | |
gem 'factory_girl_rails' | |
gem 'capybara' |
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
string = 'Just String' | |
type = defined?(string) | |
list = { | |
"local-variable" => local_variables, | |
"instance-variable" => instance_variables, | |
"global-variable" => global_variables | |
}[type] || [] |
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
<xsl:if test="count(.//year) != 0"> | |
<div> | |
<xsl:for-each select=".//year[generate-id() = generate-id(key('years',.)[1])]"> | |
<xsl:if test="./text() = /.//selected_year "> | |
<xsl:attribute name="class">current</xsl:attribute> | |
</xsl:if> | |
<xsl:if test="position() = 1"></xsl:if><xsl:value-of select="." /> г. | |
</xsl:for-each> | |
</div> | |
</xsl:if> |
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
# The MIT License (MIT) http://vakiliy.mit-license.org | |
# CallBack Module | |
module CallBackHelper | |
class TypeError < StandardError | |
def initialize(msg = 'Callback type error. Required: Symbol, String or Proc') | |
super msg | |
end | |
end | |
class UseError < StandardError |
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
.icon-accept { | |
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKfSURBVDjLpZPrS1NhHMf9O3bOdmwDCWREIYKEUHsVJBI7mg3FvCxL09290jZj2EyLMnJexkgpLbPUanNOberU5taUMnHZUULMvelCtWF0sW/n7MVMEiN64AsPD8/n83uucQDi/id/DBT4Dolypw/qsz0pTMbj/WHpiDgsdSUyUmeiPt2+V7SrIM+bSss8ySGdR4abQQv6lrui6VxsRonrGCS9VEjSQ9E7CtiqdOZ4UuTqnBHO1X7YXl6Daa4yGq7vWO1D40wVDtj4kWQbn94myPGkCDPdSesczE2sCZShwl8CzcwZ6NiUs6n2nYX99T1cnKqA2EKui6+TwphA5k4yqMayopU5mANV3lNQTBdCMVUA9VQh3GuDMHiVcLCS3J4jSLhCGmKCjBEx0xlshjXYhApfMZRP5CyYD+UkG08+xt+4wLVQZA1tzxthm2tEfD3JxARH7QkbD1ZuozaggdZbxK5kAIsf5qGaKMTY2lAU/rH5HW3PLsEwUYy+YCcERmIjJpDcpzb6l7th9KtQ69fi09ePUej9l7cx2DJbD7UrG3r3afQHOyCo+V3QQzE35pvQvnAZukk5zL5qRL59jsKbPzdheXoBZc4saFhBS6AO7V4zqCpiawuptwQG+UAa7Ct3UT0hh9p9EnXT5Vh6t4C22QaUDh6HwnECOmcO7K+6kW49DKqS2DrEZCtfuI+9GrNHg4fMHVSO5kE7nAPVkAxKBxcOzsajpS4Yh4ohUPPWKTUh3PaQEptIOr6BiJjcZXCwktaAGfrRIpwblqOV3YKdhfXOIvBLeREWpnd8ynsaSJoyESFphwTtfjN6X1jRO2+FxWtCWksqBAp |
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
passenger_set_cgi_param HTTP_X_ACCEL_MAPPING /local/storage/=/storage/; | |
location /storage/ { | |
internal; | |
alias /local/storage/; | |
} | |
# From 'lib/rack/sendfile' | |
location ~ /storage/(.*) { | |
internal; | |
alias /local/storage/$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
total_run_times 0 | |
background yes | |
cpu_avg_samples 1 | |
net_avg_samples 2 | |
double_buffer yes | |
no_buffers no | |
text_buffer_size 2048 |
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
-- View Current Lock | |
SELECT c.relname, l.mode, l.granted, l.pid FROM pg_locks as l JOIN pg_class as c on c.oid = l.relation; | |
-- UTF-8 text search by index | |
create index on <table> (<column> text_pattern_ops); | |
-- Generate nodes path | |
create table <table> as select i, format('/%s/%s/', (random() * 10), (random() * 10)) from generate_series(1,100000); | |
-- Create extension |
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
# Arel | |
#"ROW_NUMBER() OVER ()" | |
row_nubmer = Arel::Nodes::NamedFunction.new('ROW_NUMBER', [] ) | |
sql = Arel::Nodes::Over.new(row_number).as('row_number') | |
row_nubmer.over.as('row_number') | |
table = Arel::Table.new :users | |
# COUNT("users"."id") OVER () AS foo | |
table[:id].count.over.as('foo') |
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
<members> | |
<member> | |
<username>brettb</username> | |
<screen_name>Brett Bretterson</screen_name> | |
</member> | |
<member> | |
<username>robr</username> | |
<screen_name>Robert Robertson</screen_name> | |
</member> | |
</members> |
OlderNewer