The task: coming up with a branching strategy to work with Subversion and Jenkins.
Using Jenkins to replicate WordPress sites
Installing Jenkins on OS X and Ubuntu
Starting an HTTP server from any folder in OS X
One liner to start an HTTP server from any folder in OS X: alias server='open http://localhost:8000 && python -m SimpleHTTPServer'/via Jeffrey Way
Combining images with ImageMagick
Assorted ImageMagick commands to combine images (I use them for screenshots of interesting sites). Latest: arranging images in a grid
Canvas tutorials links
How to Make Your JavaScript Fast
Mozilla's David Mandelin has published an interesting slideshow about JS optimization. Here are the takeaway points in case it disappears.
A Google Apps Script boilerplate
More CSS goodness
CSS is in serious danger of becoming sexy. If animations, transitions, and CSS shaders weren't enough, layout modules are on the way.
How to create a Sublime Text 2 snippet
Snippets are pieces of text, with or without placeholders, that you can have your editor paste in when you type a shortcut. Many editors have them; here's how to create them with the Sublime Text 2 editor.
A script to take screenshots at regular intervals
Setting up Wifi hotspot for mobile development
Virtual Router allows you to set up a WiFi hotspot from your Windows 7 machine. Or you can do the same from the command line without any extra software.
Json to Google Tasks with the PHP API library
Configuration properties for Jasmine maven plugin
The configuration properties for the jasmin maven plugin in XML format. From the the Jasmine maven plugin homepage and the plugin source
Showing passed Jasmine tests by default
I am sure I have missed an obvious config setting, but the quickest way I found to display passed tests in Jasmine when the page loads, without having to click on the checkbox, is with a JS function that uses the proxy / decorator pattern.
Reduce RSS noise with Yahoo! Pipes
A very simple Weekly Challenge to get me started. The task: create a series of aggregators of RSS and twitter feeds, and a simple HTML scraper, using Yahoo! Pipes.
Google Developer Day Berlin, 2011
Interesting day at the GDD Berlin. Didn't learn anything that blew me away, but it was good to see Google's enthusiasm for sharing their technology with developers. Still not convinced about DART, but the food wasn't bad.
[Update] all the slides from GDD Berlin are now available online
Eclipse shortcuts
As I am moving to the Sublime Text editor, here are some Eclipse shortcuts before I forget them through lack of use.
Weekly Challenges
PHPUnit assertions
For my reference, a list of PHPUnit assertions from the PHPUnit book
Handling error messages with jQuery.validate
If you are not happy with the jQuery.validate plugin displaying error messages within label tags (because they are clickable for checkboxes, or for whatever reason), set errorElementto the name of the tag you'd like to use, e.g.$("#form").validate({ errorElement: "span” });
More examples on Mitch Labrador's Tech Blog
Extract, transform, and load (ETL)
Extract, transform, and load (ETL) is a process in database usage and especially in data warehousing that involves: (E) Extracting data from outside sources; (T) Transforming it to fit operational needs (which can include quality levels); (T) Loading it into the end target (database or data warehouse).
Resetting the HTC Hero
Running maven with custom properties
A workaround for when Java developers hardcode local paths in maven scripts and commit the pom files to source control - something would be the name of the path, clean install war:inplace is just a sample command:
mvn -Psomething="/PATH/TO/SOMETHING" clean install war:inplace
Advanced Evernote search
It isn't immediately obvious, but Evernote offers advanced search operators.
Google Maps introduces weather
Facebook continuos integration cycle
There is an interesting screencast by Chuck Rossi, release manager, on how they manage the release process at Facebook. Worth seeing, but if you haven't got the time, here's a quick executive summary.
PHP 5.4 introduces short arrays
The more time I spend coding in Javascript, the more PHP feels old and clumsy. Many developers feel that way, and that's probably why they introduced a small, JS-like improvement in PHP 5.4 - short arrays: $a = [1, 2, 3, 4];
$a = ['one' => 1, 2, 'three' => 3, 4];
Capsule CRM is not much use to a freelancer
I have been using Capsule, a CRM, for a couple of years, to help me manage the endless stream of emails from recruiters. It has some good features, but it is not really suited to freelancers. It may work well for sales people, though. Perhaps.
Beyond polyfills: sugar.js
Avoid the mysql extension in PHP
There are a few different ways of handling MySQL in in PHP. Ext/mysql, i.e. the functions that start with mysql_xxx, is the oldest and most well known. It is also insecure, doesn't use all the database features, and will be phased out and in future releases. Use mysqli instead, or at least pdo_mysql.
Web Intents
Paul Kinlan's Web Intents post ends with "This project will fundamentally change and improve the way we build applications on the web today for our users". A strong statement - and to be fair, the project does look interesting.
Still very early days though.
So far there is a WebIntents API on github, some examples on Intent: Share and some examples on webintents.org.
CSS3 transitions callbacks
Running Chrome with flags
Some of the more bleeding edge features of Chrome are switched off by default. You can switch some on by visiting 'about:flags' in Chrome. For the rest, you'll have to start the browser from the command line and type the option manually. On a mac you do that by typing open -a /Applications/Google\ Chrome.app/ --args --YOUR-FLAGS-HERE
Here's a list of Chrome command line switches
A good place for scripts in OSX
I always used to wonder where to put unix based scripts on my Mac without them getting in the way. The solution is simple: create a bin folder in your home directory, and add it to the path: export PATH=~/bin:$PATH(from the Advanced Command Line Screencasts)
Converting a category to a taxonomy in WordPress
Refreshing bash_profile
If you edit your .bash_profile you will need to either quit your current terminal window and open a new one, or run this command to reload the settings: source ~/.bash_profile.
Hello Alfred, and farewell Quicksilver
Quicksilver has been moribund for a while*, and it was only a matter of time before I switched to Alfred. The switch was much simpler than I anticipated - I had the two apps running side by side until I was satisfied I could do the same things with both. Didn't take long at all.
Disabling auto-revisions in WordPress
Most plastic containers are not recyclable
WordPress external links HTML generator bookmarklet
Here is a bookmarklet to generate HTML code for external links you can paste in your WP editor (or any editor for that matter). Just drag it to your browser's link toolbar.
Awesome Screenshot browser extension by diigo.com
Just installed the Awesome Screenshot browser extension by diigo.com on Chrome - very happy with it. So far it's the best extension of its type I have tried. You can quickly just save the screen grab as is, or you can annotate it first, which is very helpful. 5 stars.
Google Apps Script (GAS) now available for Google Docs
Google have just extended Google Apps Script to work in Google Docs too. API Documentation is available.
Getting rid of the GoogleSoftwareUpdate agent
I installed the latest version of Google Chrome on my Mac, and next time I logged on I got a Little Snitch alert - GoogleSoftwareUpdate was trying to connect to Google. Apparently this happens with all Google software, like Google Earth etc. Here's how to get rid of it.
Getting started with Google Apps Script part 1
Google Apps Script (GAS) is an implementation of Javascript that runs on Google cloud servers and allows access to Google services. Support is still somewhat flaky, but if you are already familiar with Javascript it is an exciting technology to get into. In this simple Google Apps Script primer, we will use a Google Docs spreadsheet to learn the basics
SVN status codes
Running the status command in the command line version of subversion returns a list of files with a one letter code in front of each file name. Here's a list of those one letter codes and what they mean.
svn status
M src/index.php (etc)
Locking screen in OS X with Quicksilver
UPDATE: don't waste your time with Quicksilver. Use Alfred instead.
YUI Docs error: DeprecationWarning
I was happily running YUI Docs when suddenly it stopped working with the error: "DeprecationWarning: the sets module is deprecated". Turns out that YUI Docs doesn't like any code above the first Javadoc block.
The Unix side of OS X – what goes in which directory
One of the nice things about OS X is that it has Unix under the bonnet. That means you can install all sorts of geeky software like ImageMagick or xdebug; but, knowing where to put things can be confusing if you are new to it. Here's a quick guide to the folder in OS X, particularly the Unix (or strictly speaking, FreeBSD) side.
Joining PDF files in OS X from the command line
Domain-driven design
Everyone at work seems excited about Domain-driven design. Here are some useful links
Tenancy Deposit Protection in the UK
The best Italian cheeses
Finding files inside an archive with Terminal
Looking for files inside an archive, without having to extract them first? Using Apple's Terminal, or any Unix / Linux bash shell:
find /dir/ -iname archive.tar -print0 | xargs -0 tar t -f | grep "filename you are searching for" find /dir/ -iname archive.zip -print0 | xargs -0 unzip -l | grep "filename you are searching for" find /dir/ -iname archive.rar -print0 | xargs -0 unrar l | grep "filename you are searching for"
Finding recently changed files with Terminal
To list files that were changed in the last day, sorted by size, using Apple's Terminal, or any Unix / Linux bash shell: sudo find / -type f -mtime -1 -print0 | xargs -0 du -sk | sort -nr(thanks mynamewasgone!)
La Vispa Teresa
Actually titled 'La Farfalletta' (the small butterfly) this is a short children poem written by the milanese Luigi Sailer in the 1850s. Trilussa, a roman poet, added a risqué extension it in 1917.
Google XML Sitemaps plugin for WordPress
XML Sitemaps are documents which list all the pages in a site, including some metadata for each page. They are useful for search engine indexing. Arne Brachhold has created a great free sitemap plugin for WordPress called Google XML Sitemaps
Site redesign – v6.0
Finally finished redesigning the site. Still testing it and cleaning it up, but it's pretty much there. The old one was a bit fiddly, and I wanted to separate the blog from the portfolio proper. Also, I intend to add more Ajax and Flash functionality, bit by bit as I have time.
Quickly removing empty array elements in PHP
A quick way to remove empty elements from an array is using array_filter without a callback function.
$myArray = array_filter( $myArray ); This will also remove 0s (zeroes) though.
Copying files matching a pattern, preserving directory structure, with cpio
Using filter_var to validate email addresses in PHP
As from version 5.2, PHP comes with built-in data filtering. Which makes validating emails and URL very, very easy.
Batch unrar from the command line on Mac OS X
Rar is a popular archive format on the web. When I need to unarchive several rar files at once, I use RarLab's command line tool. Here's how.
Removing black border from Mac OS X Leopard screenshots
Getting ant to read user parameters
You can set use the input task to make Ant ask for parameters on the command line at runtime.
Using OpenOffice to batch convert file formats on OS X
Connecting to mySql from OpenOffice.org on OSX
Setting A Bash Prompt in OS X
To change the command line prompt on bash, my shell of choice, you need to edit the file .bash_profile in your home directory. To do that, UNIX machos will tell you to use vi. This I find only slightly less painful than walking on my knees on dried chickpeas, and I won't touch it (I won't even touch vim, its marginally less awkward cousin).
Sending emails with non ASCII characters from Classic ASP
Serving an Excel Worksheet to a browser.
Converting a collection to a JScript object in ASP
Enumerators are collections of data that can be iterated through. Although useful, they are not compliant with ECMAScript standards, and therefore I prefer not to use them. Some objects in the ASP environment however, such as Request.Form, are provided as Enumerators, and need to be converted them to standard JScript objects. Here's a couple of routines to do so.
Skewing random numbers towards 0
A quick way to skew random numbers towards 0 is to raise them to some powers - the higher the power, the higher the skew. Obviously not the most efficient way of doing it, but could be useful in certain occasions where performance is not an issue.
var num:Number = Math.pow( Math.random(), 2 );
