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
{% 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 %}
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
# 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
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
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
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
require 'rack-rewrite'
DOMAIN = 'www.production-hacks.com'
# Redirect to the www version of the domain in production
use Rack::Rewrite do
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_ENV'] == "production"
}
end
jose:~ → rvm gemset copy ree-1.8.7-2010.01 ree-1.8.7-2010.02
info: Copying gemset from ree-1.8.7-2010.01 to ree-1.8.7-2010.02
info: Making gemset for ree-1.8.7-2010.02 pristine.
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
/Users/jose/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby extconf.rb
creating Makefile
map.resources :users do |users|
users.resources :events
end
module ActionMailer
class Base
def template_path
File.join(template_root, mailer_name)
end
end
end