I am currently working on a dashboard for my life. It will include things like the weather, news, movie release dates, OneBusAway information and other fun stuff. I am building it with rails and mongomapper. I am hoping to hang a screen on my wall and have it powered by a mac mini. Step one is to get it all working.
Other projects: Revisited IMDB and updated it to run again thanks to someone who wanted to use it. The problem with scr...
[ Read more ]
number = (1/0.to_f)
number = 0 unless 1<=>number
No more checking number.nan? || number.infinite?
Been busy. Started a new job. Gist.com Working on a few different ideas and been living. I hope to post something new soon.
I just got a G1 phone and I was playing around with google charts. Turns out they do QR bar codes. It turns out that the barcode scanner on my G1 reads the QR. So I made a greasemonkey script that adds the barcode to the bottom of every page. (After the body tag until I figure it out more)
http://deathbyescalator.com/barcode.user.js
I can now just view a site, scan it and bookmark it on my phone.
In case you have set up your db with out utf8 support by default you can change it with active record.
tables = ActiveRecord::Base.connection.execute("show tables;")
tables.each{|table|
create_table = ActiveRecord::Base.connection.execute("show create
table #{table};")
unless create_table.fetch_hash["Create Table"].include?("CHARSET=utf8")
ActiveRecord::Base.connection.execute("ALTER TABLE #{table} CONVERT TO CHARAC... <a href="/main/index/db_charsets_in_rails">[ Read more ]</a>
I am reading the perl cookbook and they are talking about some fun ways to use sort. I like that they are describing sort_by. I read some where that the concept was coded and posted in perl long ago. I wish they had a sort_by wrapper for it. anyway. I was reading that you can use an or statement in perl so if the first two are even sort it by a second value. I never thought of this in ruby.
I was asked to check a file for palindromes. Here is the code I wrote.
def find_palindromes(file)
if !file || !File.exist?(file) || !File.readable?(file)
raise "Trouble with the file"
end
words = File.open(file,"r").read
words = words.split(/\s/)
words.uniq!
palindrome = Hash.new(Arra
...
[ Read more ] I am working on a pure ruby bittorrent library. I want to use pirate bay and bittorrent to chart out how many people are downloading a file. Then I want to track a new movie and chart that against its box office/dvd sales. Depending on the movie I dont think I will see a correlation between files downloaded and box office sales. I do think that the release of the dvd will have an effect on the charts.
In other good news I think I will cha...
[ Read more ]Or How to Stall For Time Because the Site is Broken. I still have a nice fun bug where I only show this months stuff. Sure its no blogger but you know what? I built it. Other then that Duck Confit turned out well.