Category Archives: Code
Rails Rumble Has Ended. Our app did not make it.
Rails Rumble has ended and unfortunately we couldn’t finish our application in time. While we had a very basic idea we did not foresee two major architectural changes and more importantly some personal drama. There is no fault on any member of our team and it’s a shame but I am very glad we participated all the same. I believe fully in the Rails Rumble idea and what it does for our community.
The premise was to create an application that sent you a SMS or an email you when it found a new term matching a Twitter Search you created. This was handy if you wanted to be alerted to people calling your name (especially at a conference or such that could be time vital.)
It’s a great shame that we did not get it out, but who knows, if there is some interest we may bring it back from the dead after the judging finishes.
I want to thank my Team, you can see them here.
I wish everyone good luck on their application. I can’t wait to see what you all have done
You can see what is left of our efforts at sidetrackapp.com
Rails Rumble Has Started.
This is just a note to say that I am attending and working on a Rails Rumble team. My team “Have Mac… Will Travel” have been going strong so far. I am getting to work with an old work colleague from my days at Hashrocket which is also quite fun.
The team is…
- Myself
- Veez
- Caleb Cornman
- Oscar Del Ben
Also, don’t forget to use one of the banners I created on your app.
Good luck everyone!
HTML5 Is Not That Powerful
I don’t like posting twice in one day and this is usually something I would try to keep for the tl;dr section but something is really getting on my nerves.
HTML5 is a current big buzz-word in the industry and people are very excited about the new technology. There has been a lot of misappropriation about the word and a lot of scathing backlash because of it. I can not forget to mention the obvious recent event of when Jeremy Keith slaughtered Rebecca Lieb for her badly reported article. (In my opinion; it was wrong but it did not call for that level of aggression.) One of the faults she made was grouping multiple technologies into one and calling it HTML5, something a lot of Web Professionals seem to do lately.
Currently on the internet there seems is a lot of love for some of the awesome new experiments like Never Mind The Bullets and The Wilderness Downtown. These are beautiful fun examples of HTML5Javascript.
The truth of the matter is that HTML5 has barely anything to do with those websites. They are attaching themselves to a buzz word for a minor press advantage. Most of the sparkle was achieved through the Javascript and was all achievable in HTML4. Sure HTML5 helped but it was never the underlying technology that made these experiments be able to exist.
What upsets me the most is that HTML5 brings some awesome new features, some harnessed in these experiments but everyone is focussing on the pretty, rather than the functional and relevant.
Once the 500th version of these experiments occur, they will go on the pile of “Annoying and Irrelevant” much like obnoxious flash websites, auto-playing music and “Enter Now” landing pages.
Unless.nil? – Down with double negatives
This is a very small tip aimed for people to clean up their code-base and remove some of the double negatives.
Often I shall see:
unless @user.nil?
The issue with this is approach is that unless is harder to read than if, then you have to mentally process the #nil?
The other approach is:
if @user
However, for a lot of people this is not explicit enough. I find that too few know about #present? method
if @user.present?
#present? is literally the opposite of #blank? and thus checks if it is not nil? or if it is not empty?
Hopefully with this small tidbit of knowledge, you can clean up your code and make it easier to read.
Deploying Thinking Sphinx with Capistrano
I’ve had a lot of issues trying to deploy ThinkingSphinx with Capistrano. This has been for a multitude of reasons. The following is my recipe for deploying and hopefully making it public will make a few people’s lives easier.
This assumes you are using the plugin, not the gem.
In your deploy.rb, add the following at the top:
require 'vendor/plugins/thinking-sphinx/lib/thinking_sphinx/deploy/capistrano'
Then, at the bottom add this:
How to display your last played artist from Last.fm
In this tutorial I will teach you how to display your last listened to track on your website with the jQuery library (although it can be easily translated to any other library). The JSON library for Last.fm is not very well documented.
- Log into the API Account page and fill in the form for your application however you would like. Name the Callback URL ‘
LastPlayed’. Write down your API key. - Create an element somewhere in your page with the id of #song. I use the following:
<strong>Currently listening to:</strong> <span id="song">Nothing</span>That way, for the few seconds that the Javascript has not loaded, it will appear sensicle.
- Right before the
</head>tag on your website, add the following snippet of code: - Finally, add the following code just above the
</body>so that once your page is loaded, it will execute. Don’t forget to replace YOUR_API_KEY with the one you jotted down earlier.
- Reload your page and check it works!
Make Your Rails Development Environment Slower, Easily.
I’m about to do some work on a Rails project that requires the environment to be that of a real production environment for users. I have created 2 bash functions to aid me in this;
I put them in my bash profile. This is my first foray into bash programming, so if you think something could be done better, please tell me.