Exclusive Dealers Apparently, JK Rowling made a deal with Sony to exclusively sell Harry Potter e-books on the Sony e-book through the Pottermore site, through January 2012. What I found out today was that I still had to go to that site in order to buy any e-book version of the Harry Potter books. That posed a major […]
Author Archives: tech0x20
Monkey patching if you need to force an error in delayed_job
I wanted to force an error condition in my cucumber tests, but the code ran through a DelayedJob, so I couldn’t redefine the code running under the .delay chain, because the DelayedJob worker will reload the normal code base for its processing. I finally realized that simply patching the delay instance method to return self […]
How long until a randomly chosen string of letters with no results shows up in Google if I include it in a post?
Inquiring minds want to know. So, I’m including a string of letters that looks Slavic – yznvenskya – in the first couple of lines of a post. Update: Looks like it took less than 16 minutes to show up.
On Mac OSX Lion: “ERROR: Error installing ruby-oci8: ERROR: Failed to build gem native extension”
Running Mac OSX Lion, trying to bundle install a project that included the ruby-oci8 gem, I received the following error: Building native extensions. This could take a while… ERROR: Error installing ruby-oci8: ERROR: Failed to build gem native extension. The fix: Fortunately, the 64-bit client for Oracle has now been updated for Lion/Mountain Lion. Download […]
zsh grep and mvim: search for a string in a directory in file type, and open that point
open_all {pattern} {extension} #!/bin/zsh grep -n $1 **/*$2 | sed ‘s/^([a-zA-Z_/.]*):([0-9]*).*$/2 1/’ | while read line file do mvim –remote-tab-silent +$line $file done Usage: # find all occurrences of “def” as a whole word and open the files in separate tabs: open_all ” .rb
Fun with the Ruby & (unary ampersand) and String#to_proc
In trying to grasp the unary & operator in ruby, I ran across [Stupid Ruby Tricks: String#to_proc]. Therefore, I decided I had to further twist the language features to my own will. Like many things in Ruby with duck-typing, the following syntax: (‘a’..’z’).map &:upcase …makes use of the fact that Symbol has a #to_proc method, […]
Twitter Bootstrap Modal Won’t Load Content from Another (“Remote”) Page
Short answer You apparently need a skeleton [modal … modal-body … /modal] for your data-target, not just an empty modal with the data-target. A Programmer’s False Assumptions – The API is Broken or Old Initially, I was concerned that my Rails plugin wasn’t using a version of Bootstrap that didn’t include the remote loading of […]
Experimenting with Rails’ String Manipulation from ActiveSupport::CoreExtensions::String::Inflections
This is my experimentation with the string manipulation methods used [largely internally] in Rails. This is largely a repeat of the documentation here, but I did dig into pluralize/singularize and a couple of other examples more in depth. Look at [path to active_support gem version]/lib/active_support/inflections.rb for the full list of plural, singular, irregular, and uncountable […]
Background on Mac OS X Lion Gets Stuck on Gray Linen Background and Menu Bar is Black
I’ve been having this problem intermittently when plugging in and unplugging my external monitor. I found a fix to the black menu bar that involved going into System Preferences->Desktop & Screen Saver and toggling the “Translucent Menu Bar” setting. However, my backgrounds were still the gray linen background. Upon further searching for that system, I […]
Script to Change the Title of Your Terminal Window
I decided to create a small bash script to change the title of my current terminal window in bash on my Mac: change_title: #!/bin/bash echo -ne “33]0;” $* “07” The script then runs as: change_title Your title goes here.