having fun with code

Category Archives: uncategorized

Command line scripting with Node.js

I often write custom deploy scripts for the projects I work on. In most cases, I choose python. You can do pretty much everything with shell and system commands, but python dictionaries and lists make it very easy to manipulate data, lists of files, text, etc. Networking is also very easy in python (http, ftp, [...]

Uninstalling brew (so I can reinstall)

Uninstall cd `brew —-prefix` rm -rf Cellar brew prune rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew rm -rf ~/Library/Caches/Homebrew http://superuser.com/questions/203707/how-to-uninstall-homebrew-osx-packet-manager Reinstall /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" https://github.com/mxcl/homebrew/wiki/Installation

Python script: remove empty folders

One of the scripts I often use is this one to remove empty folders under a specific location on your hard drive. The usage is simple: $ [path to the script]/remove_empty_folders.py [path_to_clean] Here is the code: #! /usr/bin/env python import os, sys   def removeEmptyFolders(path):   if not os.path.isdir(path):     return     # [...]

My Sublime Text 2 settings

My Sublime Text 2 settings: // Settings in here override those in "Default/Base File.sublime-settings", and // are overridden in turn by file type specific settings. Place your settings // here, to ensure they're preserved when upgrading. {  // Set to false for horizontal scrolling  "word_wrap": false,  // Set to false to disable detection of tabs [...]

Clone your OSX terminal window

Sometimes, when working on a terminal window I would like to open a new window on the exact same location or path. This little AppleScript will do the trick: tell app "Terminal" to do script "cd \"'`pwd`'\"" From the command line: osascript -e 'tell app "Terminal" to do script "cd \”'`pwd`'\”"' You can also create [...]

Titanium Studio and Titanium Mobile 1.7

Titanium Studio: will this change anything? It is a big step, and offers something I really missed while working with Titanium in the past: integrated debugging. I think I will rather stay with XCode and code native Objective-C. Link: Introducing Titanium Studio and Titanium Mobile 1.7.

Step back and watch what the “normals” do

“We as developer must remember that we are not the target for 99% of the software that is written. We are not the final judge on what will or will not work. If anything, we are the last people that should have an opinion on what is good or bad. We should be the ones [...]

location.hash is dead (on html5 browsers)

Pretty cool technique to actually change the url of the page (something until now impossible to do in Javascript for security reasons): http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate Also good to read, the browser history MDC documentation: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history And finally, pjax, a new script that combines the use oj Ajax calls and this technique to manipulate the url to achieve [...]

Angry Birds as a Web App

Really, really cool, Rovio has released Angry Birds (and all the game assets) as a web app, Javascript and Canvas based. I can’t wait to see clones of Angry Birds with custom assets, maps and sounds. via Angry Birds as a Web App.

Finding duplicate ID’s on an HTML page

Looks like sometimes we forgot element ID’s are meant to be unique on a HTML page. Here is a little bit of code I just wrote to find duplicate ID’s on a page (run the code on your browser’s javascript console): var idList = {}; var nodes = document.getElementsByClassName(''); for (var i in nodes) { [...]

About the blog

This is a blog about development, focused mainly on Javascript but also other languages like python, shell scripts and more.

About the author

Eneko Alonso is a software engineer and UI developer with more than eight years of experience in software and web development. He lives in San Luis Obispo, California and works at LEVEL Studios.

Contact Info

Contact Info

PromoteJS

JavaScript JS Documentation