This file contains hidden or 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
def generate_code | |
generated_code = nil | |
loop do | |
srand(Time.now.to_f) | |
chars = ("A".."Z").to_a + ("2".."9").to_a | |
generated_code = "" | |
1.upto(5) { |i| generated_code << chars[rand(chars.size - 1)] } | |
break if Lead.count(:conditions => {:code => generated_code}) == 0 |
This file contains hidden or 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
class ProductImage < ActiveRecord::Base | |
belongs_to :product, :counter_cache => true | |
has_attached_file :image, | |
:styles => { :medium => "150x150>", :thumb => "100x100>" }, | |
:convert_options => { :all => "-quality 90 -strip" }, | |
:processors => Proc.new {|a| Rails.logger.info("Lambda at #{Time.now.to_f}"); a.processors }, | |
:url => "/product_images/:id/:style/:basename.:extension", | |
:path => ":rails_root/public/product_images/:id/:style/:basename.:extension" |
This file contains hidden or 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
#!/usr/bin/perl -w | |
# Parallelpool - Run a bunch of proccesses in parallel, similar to | |
# make's -j option. | |
# Erasmus Darwin, 2008. No rights reserved. This is just a quick | |
# hack and doesn't conform to proper coding conventions. It also does | |
# some inefficient stuff like creating an array of all arguments. Do | |
# with this what you want. You can even remove my name and claim you | |
# wrote it. |
This file contains hidden or 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
kmarsh@myhost:~/disks$ pwd | |
/export/home/kmarsh/disks | |
kmarsh@myhost:~/disks$ ll | |
total 241M | |
-rw------T 1 root 10M Jul 14 17:57 disk1 | |
-rw------T 1 root 10M Jul 14 17:57 disk10 | |
-rw------T 1 root 10M Jul 14 17:57 disk11 | |
-rw------T 1 root 10M Jul 14 17:57 disk12 | |
-rw------T 1 root 10M Jul 14 17:57 disk13 | |
-rw------T 1 root 10M Jul 14 17:57 disk14 |
This file contains hidden or 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
kmarsh@storage_a:~/src/eventmachine-eventmachine-1250ffc$ uname -a | |
SunOS storage_a 5.11 NexentaOS_20081207 i86pc i386 i86pc Solaris | |
kmarsh@storage_a:~/src/eventmachine-eventmachine-1250ffc$ rake build | |
(in /export/home/kmarsh/src/eventmachine-eventmachine-1250ffc) | |
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31: command not found: git ls-files | |
cd ext | |
/usr/bin/ruby1.8 extconf.rb | |
checking for rb_trap_immediate in ruby.h,rubysig.h... yes | |
checking for rb_thread_blocking_region()... no |
This file contains hidden or 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
kmarsh@storage_a:~$ sudo gem install --verbose eventmachine | |
[sudo] password for kmarsh: | |
GET 200 OK: http://gemcutter.org/latest_specs.4.8.gz | |
GET 200 OK: http://gems.rubyforge.org/latest_specs.4.8.gz | |
GET 200 OK: http://gems.github.com/latest_specs.4.8.gz | |
Installing gem eventmachine-0.12.10 | |
Downloading gem eventmachine-0.12.10.gem | |
GET 302 Found: http://gems.rubyforge.org/gems/eventmachine-0.12.10.gem | |
GET 200 OK: http://gems.rubyforge.vm.bytemark.co.uk/gems/eventmachine-0.12.10.gem | |
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/.gitignore |
This file contains hidden or 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
kmarsh@storage_a:~/tmp/amqp-0.6.0$ ruby examples/mq/simple-ack.rb | |
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:39:in `new': undefined method `associate_callback_target' for #<#<Class:0x838e3cc>:0x838e2f0> (NoMethodError) | |
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:36:in `instance_eval' | |
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:36:in `new' | |
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:720:in `bind_connect' | |
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:692:in `connect' | |
from /export/home/kmarsh/tmp/amqp-0.6.0/lib/amqp/client.rb:177:in `connect' | |
from /export/home/kmarsh/tmp/amqp-0.6.0/lib/amqp.rb:23:in `connect' | |
from /export/home/kmarsh/tmp/amqp-0.6.0/lib/amqp.rb:82:in `start' | |
from /export/home/kmarsh/tmp/amqp-0.6.0/lib/ext/em.rb:17:in `call' |
This file contains hidden or 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
kmarsh@storage_a:~/tmp/amqp-0.6.5$ ruby examples/mq/pop.rb | |
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so: ld.so.1: ruby1.8: fatal: relocation error: file /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so: symbol _ZNKSs4sizeEv: referenced symbol not found - /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so (LoadError) | |
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' | |
from examples/mq/pop.rb:2 | |
kmarsh@storage_a:~/tmp/amqp-0.6.5$ ll /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so | |
-rwxr-xr-x 1 root 424K Oct 30 01:20 /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so* | |
kmarsh@storage_a:~/tmp/amqp-0.6.5$ file /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so | |
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/rubyeventmachine.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped |
This file contains hidden or 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
kmarsh@storage_a:~$ ruby -rpp -rrbconfig -e' pp Config::CONFIG ' | |
{"sitedir"=>"/usr/local/lib/site_ruby", | |
"MAKEFILES"=>"Makefile", | |
"LIBRUBY"=>"libruby1.8.so.1.8", | |
"MAKEDIRS"=>"mkdir -p", | |
"PACKAGE_VERSION"=>"", | |
"GREP"=>"/usr/bin/grep", | |
"prefix"=>"/usr", | |
"COMMON_LIBS"=>"", | |
"rubylibdir"=>"/usr/lib/ruby/1.8", |
This file contains hidden or 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
kmarsh@storage_a:~/tmp$ cd eventmachine-eventmachine-b9ef039 | |
kmarsh@storage_a:~/tmp/eventmachine-eventmachine-b9ef039$ ll | |
total 6.0K | |
-rw-r--r-- 1 kmarsh 3.7K Oct 28 14:35 README | |
-rw-r--r-- 1 kmarsh 12K Oct 28 14:35 Rakefile | |
drwxr-xr-x 2 kmarsh 16 Oct 28 14:35 docs/ | |
-rw-r--r-- 1 kmarsh 6.0K Oct 28 14:35 eventmachine.gemspec | |
drwxr-xr-x 2 kmarsh 5 Oct 28 14:35 examples/ | |
drwxr-xr-x 3 kmarsh 30 Oct 28 14:35 ext/ | |
drwxr-xr-x 3 kmarsh 5 Oct 28 14:35 java/ |