Skip to content

Instantly share code, notes, and snippets.

View lodestone's full-sized avatar
:octocat:
🤘Grokking Out 🤘

Matt Petty lodestone

:octocat:
🤘Grokking Out 🤘
View GitHub Profile
@lodestone
lodestone / gist:103144
Created April 28, 2009 13:21 — forked from c3mediagroup/gist:103143
broken.html.haml
- if RAILS_ENV == "production"
%script{ :type => "text/javascript" }
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
%script{ :type => "text/javascript" }
var pageTracker = _gat._getTracker("UA-3794127-4");
pageTracker._trackPageview();
/ small.data_status
/ / :float right
/ :position absolute
/ :right 10px
/ :top -10px
/ :margin-right 30px
.advisor_image_medium
:width 170px
:border 10px solid #ccc
/ small.data_status
/ / :float right
/ :position absolute
/ :right 10px
/ :top -10px
/ :margin-right 30px
.advisor_image_medium
:width 170px
:border 10px solid #ccc
/ small.data_status
/ / :float right
/ :position absolute
/ :right 10px
/ :top -10px
/ :margin-right 30px
.advisor_image_medium
:width 170px
:border 10px solid #ccc
# memcached default config file
# 2003 - Jay Bonci <jaybonci@debian.org>
# This configuration file is read by the start-memcached script provided as
# part of the Debian GNU/Linux distribution.
# Run memcached as a daemon. This command is implied, and is not needed for the
# daemon to run. See the README.Debian that comes with this package for more
# information.
-d
module ShouldaContextExtensions
def self.included(base)
base.class_eval do
alias_method_chain :build, :fast_context
alias_method_chain :am_subcontext?, :fast_context
end
end
def fast_context(name, &blk)
@fast_subcontexts ||= []
function project_list {
for n in ~/projects/*
do
if [ -d $n ]
then
echo `basename $n`
fi
done
}
puts "Starting Premium Summary Update at #{start_time=Time.now}"
PremiumSummary.default_advisors.each_with_index do |advisor,idx|
puts "(((((( Advisor:#{idx+1} of #{PremiumSummary.default_advisors.count} )))))))"
[MonthlyPremiumSummary, LifePremiumSummary, LtcPremiumSummary, DiPremiumSummary].each do |summary|
summary.update_period(advisor, 2009, 9)
summary.update_period(advisor, 2009, 10)
end
end
puts "Ending #{end_time=Time.now}"
puts "Process took: #{end_time-start_time}"
def MyModel.random_in_last(since = nil)
if (c = self.count) == 0
nil
else
since ||= 2.weeks.ago
find :first, :select => 'recent_models.*',
:from => "(select * from `#{self.table_name}` where " +
sanitize_sql_array(['created_at > ?', since]) +
") as recent_models",
:offset => rand(c))
class Kozmik
def self.acts_as_frog(species)
(@frog_list ||= []) << species
#self.class.send :attr_accessor, :frog_list
#
# === OR ===
#
# class << self
# attr_accessor :frog_list
# end