Skip to content

Instantly share code, notes, and snippets.

2.0.0-p247 :009 > set = (1..2_000_000).to_a; start_time = Time.now; set.index(1_999_999); stop_time = Time.now; puts stop_time - start_time
0.097041
=> nil
2.0.0-p247 :010 > set = (1..2_000_000).to_a; start_time = Time.now; set.index(1_999_999); stop_time = Time.now; puts stop_time - start_time
0.092345
=> nil
2.0.0-p247 :011 > set = (1..2_000_000).to_a; start_time = Time.now; set.index(1_999_999); stop_time = Time.now; puts stop_time - start_time
0.098898
=> nil
2.0.0-p247 :012 > set = (1..2_000_000).to_a; start_time = Time.now; set.index(1_999_999); stop_time = Time.now; puts stop_time - start_time
@@ -26,15 +26,17 @@ module ActiveRecord
# product.touch(:designed_at) # updates the designed_at attribute
def touch(attribute = nil)
current_time = current_time_from_proper_timezone
+ attrs_to_update = []
if attribute
write_attribute(attribute, current_time)
+ attrs_to_update << attribute
else
def get_all_adjs(center_point)
x_width = 6
y_width = 6
adj = []
(-1..1).each do |y_p|
(-1..1).each do |x_p|
adj_point = (center_point + ((y_p * x_width) - x_p))
puts "potential adj_point: #{adj_point}"
cieling = 2_000_000
number_set = []
non_primes = {}
(cieling + 1).times { |num| number_set << num }
2.times { number_set.shift }
number_set.each do |prime|
next unless non_primes[prime].nil? #<--- this is the hash lookup magic vs the old solution
# next if non_primes.include?(prime)
cieling = 20
number_set = []
non_primes = []
(cieling + 1).times { |num| number_set << num }
number_set.shift
number_set.shift
number_set.each do |prime|
next if non_primes.include?(prime)
~ ☊ CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.8.7 --debug
1.8.7 - reinstall
/Users/pbiegaj/.rvm/src/ruby-1.8.7-p370 has already been removed.
/Users/pbiegaj/.rvm/rubies/ruby-1.8.7-p370 has already been removed.
No binary rubies available for: ///ruby-1.8.7-p370.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
found compiler: /usr/local/bin/gcc-4.2
Installing Ruby from source to: /Users/pbiegaj/.rvm/rubies/ruby-1.8.7-p370, this may take a while depending on your cpu(s)...
ruby-1.8.7-p370 - #downloading ruby-1.8.7-p370, this may take a while depending on your connection...
[2012-09-27 15:58:01] /Users/pbiegaj/.rvm/scripts/fetch http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p370.tar.bz2
abstract (1.0.0)
actionpack (3.0.11)
activemodel (3.0.11)
activerecord (3.0.11)
activesupport (3.0.11)
archive-tar-minitar (0.5.2)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.22)
capybara (1.1.2)
img src="homepage.png" alt="bandw logo" "text-align: center"/
PDF:
object type="application/pdf" data="catalogue.pdf" " width="100%" height="90%" < >/object >"
OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 75.101.135.192 [75.101.135.192] port 22.
debug1: Connection established.
debug1: identity file /Users/pbiegaj/.ssh/identity type -1
debug1: identity file /Users/pbiegaj/.ssh/id_rsa type -1
debug1: identity file /Users/pbiegaj/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
default.rb:
# require_recipe "rvm"
require_recipe "ci"
require_recipe "bluepill"
~/solo.rb:
file_cache_path "/root/chef-repo" <-- where my chef-repo directory/git project lives
cookbook_path "/root/chef-repo/cookbooks" <-- where it's cookbooks are with the project
json looks like this: