Skip to content

Instantly share code, notes, and snippets.

View jfernandez's full-sized avatar
🦀
Rust and eBPF

Jose Fernandez jfernandez

🦀
Rust and eBPF
View GitHub Profile
module GlobalScopes
def self.included(base)
base.class_eval do
named_scope :created_at_equals, lambda { |date| { :conditions => ["DATE(`#{table_name}`.`created_at`) = ?", Date.parse(date)] } }
named_scope :created_at_gt, lambda { |date| { :conditions => ["DATE(`#{table_name}`.`created_at`) > ?", Date.parse(date)] } }
named_scope :created_at_gte, lambda { |date| { :conditions => ["DATE(`#{table_name}`.`created_at`) >= ?", Date.parse(date)] } }
named_scope :created_at_lt, lambda { |date| { :conditions => ["DATE(`#{table_name}`.`created_at`) < ?", Date.parse(date)] } }
named_scope :created_at_lte, lambda { |date| { :conditions => ["DATE(`#{table_name}`.`created_at`) <= ?", Date.parse(date)] } }
end
end
jose:~/Development/pas [git:master] → rails --version
/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path': can't find executable rails for railties-3.0.0.beta3 (Gem::Exception)
from /usr/bin/rails:19
def created_on_off_hours?
return false unless self.created_at
created_on_weekend = [0, 6].include?(self.created_at.wday)
created_friday_night = self.created_at.wday == 5 && self.created_at.hour >= 19
created_on_weekend || created_friday_night
end
# Notify hoptoad of deploy
if @configuration[:environment] == "production"
run "cd #{release_path} && rake hoptoad:deploy TO=#{@configuration[:environment]} REVISION=#{@configuration[:revision]} REPO=#{@configuration[:repository]}"
run "cd #{release_path} && bin/newrelic_cmd deployments -e #{@configuration[:environment]} -r #{@configuration[:revision]}"
run "cd #{release_path} && script/runner 'GlobalMailer.deliver_production_deploy_email'"
end
if @configuration[:environment] == "production"
# Notify Hoptoad of deploy
run "cd #{release_path} && rake hoptoad:deploy TO=#{@configuration[:environment]} REVISION=#{@configuration[:revision]} REPO=#{@configuration[:repository]}"
# Notify New Relic of deploy
run "cd #{release_path} && newrelic_cmd deployments -e #{@configuration[:environment]} -r #{@configuration[:revision]}"
end
{% for offer in bonus_offers %}
{% if offer.network == "Merge Gaming" }
<tr class="offer" link="{{ offer.review_page }}">
<th><a href="{{ offer.review_page }}">{{ offer.name }}</a></th>
<td>{{ offer.reward }}</td>
</tr>
{% endif %}
{% endfor %}
[Thu, 29 Apr 2010 13:08:25 -0700] INFO: Ran execute[reporting for ssh keys] successfully
[Thu, 29 Apr 2010 13:08:25 -0700] INFO: Setting mode to 755 for directory[/home/pasadmin/.ssh]
[Thu, 29 Apr 2010 13:08:26 -0700] ERROR: ruby_block[copy-ssh-keys-for-pasadmin] (/etc/chef/recipes/cookbooks/ssh_keys/recipes/default.rb line 32) had an error:
no address for
/usr/local/ey_resin/ruby/lib/ruby/1.8/resolv.rb:233:in `getaddress'/usr/local/ey_resin/ruby/lib/ruby/1.8/resolv.rb:204:in `getaddress'/etc/chef/recipes/cookbooks/ey-base/libraries/cluster_info.rb:9:in `private_ip_for'/etc/chef/recipes/cookbooks/ey-base/libraries/cluster_info.rb:14:in `cluster'/etc/chef/recipes/cookbooks/ey-base/libraries/cluster_info.rb:13:in `map'/etc/chef/recipes/cookbooks/ey-base/libraries/cluster_info.rb:13:in `cluster'/etc/chef/recipes/cookbooks/ssh_keys/recipes/default.rb:36:in `from_file'/etc/chef/recipes/cookbooks/ey-base/libraries/ruby_block.rb:33:in `call'/etc/chef/recipes/cookbooks/ey-base/libraries/ruby_block.rb:33:in `action_c
ENV['APP_ROOT'] ||= File.dirname(__FILE__)
$:.unshift "#{ENV['APP_ROOT']}/vendor/plugins/newrelic_rpm/lib"
require 'newrelic_rpm'
require 'new_relic/agent/instrumentation/rack'
module Toto
class Server
include NewRelic::Agent::Instrumentation::Rack
end
end
{% if current_page == "rakeback/full-tilt.html" %}
HTML for Full Tilt goes here!
{% elsif current_page == "rakeback/party-poker.html" %}
HTML for Party Poker goes here!
{% else %}
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
# Rails cache_store
Rails.cache.instance_variable_get(:@data).reset if Rails.cache.class == ActiveSupport::Cache::MemCacheStore
# Reset the session_store, value could be nil depending on how you set it up
ActionController::Base.session_options[:cache].reset
# Reset the cache_fu connection (if used)