Meet Dom

Things I Share

2 notes

Undo with Paper Trail in Rails 2.3.8

I was recently impressed by Ryan Bates recent Railscast on Undo with Paper Trail, but faced a few difficulties trying to port it into a Rails 2.3.8 project.

Rails 3+ has access to the view_context in the controller. It took me a while to find this because I’ve never needed it, but Rails 2.3.8 has similar access to the link_to helper via @template.

I also found that the undo action taken immediately after a create caused an Activerecord::RecordNotFound error, caused by a redirect_to the show action of the record that was just destroyed.

After fixing these issues I decided to fork Ryan’s source and provide a Rails 2.3.8 version. You can find this at https://github.com/MeetDom/railscasts-episodes/tree/rails238/episode-255. I hope someone else finds this useful.

Filed under rails Rails 2.3.8 Paper Trail Railscasts Ryan Bates

2 notes

Using Knox to Secure my Code

Bought a Knox family license to secure source code and personal stuff. This Mac software is great in that each vault is a sparse bundle and is mounted and unmounted as a volume. You can even turn on Spotlight for the volume so OS X keeps working the way you expect it to with regard to searching. With 256-bit encryption my stuff will be safe in case of accidental loss now.

Filed under knox vault security

0 notes

brought to you by

This is pretty cool. I bet a bit of work went in scripting, choreography and production for a few minutes of this funny surprise.

Filed under video joke shadow

4 notes

Just watched a presentation by R. S. Williams at HP Labs about memristor technology. If you’re interested in electronics and the very near future of computing then you may find this as amazing as I did. Williams speculates that we’ll have a petabit (1000 terabits) of non-volatile memory in as little space as a square centimetre. Even more interesting is that we will be able to emulate (as opposed to simulate) biological synapses (brain function) using a combination of memristors, cmos and phototonics. Looks like I’ll actually be around to witness this incredible technology!

Filed under memristor photonics R. S. Williams HP Labs

0 notes

Google’s CAPTCHA Keeps Humans Out Too!

CAPTCHA is a type of challenge-response test used in computing to ensure that the response is not generated by a computer. It is a contrived acronym for “Completely Automated Public Turing test to tell Computers and Humans Apart.”

While attempting to confirm I was human when verifying a Gmail account, this is the CAPTCHA I was presented with. I don’t know about you, but I was not able to work this one out. I challenge anyone at Google to work this one out for me!

Filed under Google Gmail CAPTCHA

0 notes

Industrial strength asset packaging in Ruby

BEFORE

AFTER

In the process of getting my first major Ruby application out the door, I’ve been assessing the various asset packaging systems. Asset packaging offers a number of advantages on production websites, including obfuscation through compression of CSS and JS files, and embedding of images and fonts. The biggest advantage however is the speed gained by reducing the number of bits sent to the client from the server.

Jammit offers all of this in a nice ruby friendly gem. It can compress your JS and CSS using either Yahoo’s YUI Compressor, or Google’s Closure. I chose Closure, but installed both (YUI Compressor gem and Closure Compiler gem) in case I decided to change.

Another benefit of Jammit is it’s ability to provide GZIP’d assets if supported. Fonts and images are embedded using Base64, and IE compatibility is provided using MHTML.

All of this is packed up nicely in a small gem. All you have to provide is a small configuration file in the form of YAML, specifying the files to compress and few other options, and it’s all good to go.

I’ve seen amazing performance gains even just in development, especially where webpages have lots of small images referred to in CSS, and with a number of @fontface rules. Admittedly, the results pictured above show development (un-minified) Javascript libraries. However, I’m impressed by the simplicity of installation, and by the gains I’m seeing in development so far. Check it out, and let me know your thoughts.

Filed under Ruby Rails Jammit Embedding @fontface Base64 CSS3