Category Archives: Code
Should CSS remain without power?
After a debate in the office about the new vh and vw measurements another broke out about the power of CSS.
An argument was made that CSS should be as simple as possible, and to leave CSS as it is. That we need nothing more, perhaps just refinement of what we do have. That we shouldn’t have a burden of choice.
HTML and CSS are simple (although headachey; thanks IE and Android.) We’ve not even come close to overcomplicating the language yet.
I want to see more power. I want to see more power in the users hands. Giving us the ability to solve more complex layout problems, more solutions to frustrating cross-browser issues and more power giving us less time to focus on building them, and more time coming up with ingenious techniques like responsive web design.
Quite a lot of this boils down to the age old developer vs designer. Generalising the whole thing, the designer just wants a minimalist syntax that looks cool and who cares if it functions well as long as it’s cool, and a developer just wants an overcomplicated kitchen sink that can make coffee while solving the meaning of life. My proposition is more in the middle ground.
The vh/vw units are nigh useless. We can solve most of the problems with REMs or percentages in this day. But there is room for more. While I would like SASS to be the standard thing – I’m not proposing that. I just don’t think it’s a bad thing CSS is adding more or innovating.
A point was that it’s not a language and should stay that way. Why? If it evolves past a key/value system, why is that such a problem? Will the web combust and explode? Will we all be out of jobs? Not at all. We can keep simplicity, and give more power though.
It was suggested that features get garbled after the draft process. That developers discuss what features a designer want, and then umpteen different browsers implement them completely different. It’s true this process needs to be tidied up, but with more weapons in our arsenal we have more creative solutions. Comparing when CSS started to get popular to now I know that the browsers have matured, but my life is simpler because the browsers matured.
Most of all, I’m not asking that everyone programs. I’m just asking for the power – you can take it, or leave it using only a 10th of the power. But giving up on CSS and feeling like it’s complete is a fool’s errand. It’s not, and the web is evolving. We need as much power as we can get to help evolve it.
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.