Less, Sass, Scss

Css pre-processors are great. Variables alone make it great, but there is so much more to it. Here’s my notes: Getting it working for development On a Mac OSX 10.13 For scss/sass, install Compass Once you have a project with sass files, let’s say inside ~/Code/example.com/template for example, you’ll need to make sure there’s a […]

iTunes backup using rsync

When the music died After one particular iTunes upgrade, all of my music disappeared. Deleted from the drive they were stored on. It’s OK because I got it back but it was a process, and in the spirit of not getting hosed again, I’m writing down what I did and what I’m now doing to […]

Site backup script example

This handy script will backup a directory and database. To use, create a new file on your server, probably in your user’s root, called backup.sh and add the below, making sure to update the source and destination path varaibles and database name. To run the script, do this:

Ternary Conditional Syntax in PHP

The below two statements are equivalent. The first uses the ternary syntax and the second uses the more traditional verbose syntax. The condition should be a statement or variable that evaluates to true or false. true will be executed if the condition is met. false is executed if the condition fails. You could argue that […]

Write and Rewrite

Whenever I’m adding a new feature and I start poking around, the goal is always to get something working and turned around in a hurry. Unfortunately, a lot of my code does not start out with adaptablitiy and extensibility in mind, so this rarely happens. Instead of doing things right the first time, I’m usually […]

Regular Expressions

Calculating Median and Average w/ PHP

Here’s some handy functions for calculating the median or average of an array of numbers. The median is the number in the middle of an array of numbers, or when the number of items in the array is even, the median is the average of the two numbers that straddle the middle. The below was […]

All About $PATH

When issuing commands from a shell, the system will check for programs in the directories listed in your $PATH variable. Multiple paths are the norm, and each should be divided with a colon. Earlier directories will be searched before whatever follows. Here’s an example $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin To see what’s currently in your $PATH variable Adding […]

See Differences in two git branches

Update or Install Joomla over SSH

This procedure comes in handy if, like me, you have trouble using the one-click Joomla updater on some servers. First, find out the web address of the upgrade or install package that you need straight from joomla.org. Make a note of the URL of the package. Next, shell into your server and cd to the […]