Working with Frozen Hashes

I discovered a cool method today while working with a frozen hash containing a frozen array. deep_dup From the Rails API Documentation: Returns a deep copy of hash. hash = { a: { b: 'b' } } dup = hash.deep_dup dup[:a][:c] = 'c' hash[:a][:c] # => nil

rbenv installing gems fails with permission error

Helping a new dev setup their machine today with rbenv when trying to bundle I ran into this error: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. Thankfully I already...

Look and Say Sequence

Had some fun recently coming up with a solution to generate any element of the Look-and-say sequence. The sequence was introduced and analyzed by John Conway. Here is an example of the sequence: 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ... The...

Project Euler - Problem 7

I recently applied to gSchool. The code I submitted was my answer to Problem 7 at Project Euler: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10,001st prime number? This was a fun problem...