Quick, what’s wrong with this Rails migration?
add_column :users, :admin, :boolean
Yep – it can be null. Your Boolean column is supposed to be only true or false. But now you’re in the madness of three-state Booleans: it can be true, false, or NULL.
Awesome post from the genius guys at Thoughtbot. This is how to do booleans in Rails:
add_column :users, :admin, :boolean, null: false, default: false
Avoid the Three-state Boolean Problem.
It’s ok for the blokes to wear them
A Modern Web Designer\’s Workflow by Chris Coyier
via A Modern Web Designer's Workflow // Speaker Deck.
Recently I became frustrated with the amount of inexplicable disk access going on on my old iMac – something was thrashing the hard disk relentlessly and blocking other apps.
Using sudo fs_usage I found that the main activity after login was Dropbox (which was fair enough), the Akamai background downloader for Adobe Creative Cloud (which wasn’t) and Spotify’s background web service (which was just bizarre)
So I found and deleted the akamai downloader for Adobe Creative Cloud:
/Applications/Akamai/admintool uninstall -force
Then told Spotify not to open at startup and not to allow itself to be started from the web:
sudo fs_usage then reported a lot of access from the launch services daemon which seemed to be thrashing th disk for no reason, so dumped and rebuilt its database:
sudo /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
And now, touch wood-coloured plastic, it all seems to be much improved. Launch services and spotify still do a lot after login but it settles down after a minute or two instead of this constant thrashing it was doing.
So that’s all good then.
So I found myself needing to make some local customisations to database.yaml and didn’t want to commit these. Turns out the solution is twofold
You don’t want to gitignore the whole file because that removes it from VCS for everyone. Instead, add the file to your local excludes file
git update-index –assume-unchanged config/database.yaml
And voila – git status no longer includes the local mods
Quick notes on adding an existing project to github
Check you’ve got public key auth set up properly on github:
ssh -T email@example.com
# Attempts to ssh to github
You may see this warning:
# The authenticity of host ‘github.com (220.127.116.11)’ can’t be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
Don’t worry, this is supposed to happen. Verify that the fingerprint matches the one here and type “yes”.
# Hi username! You’ve successfully authenticated, but GitHub does not
# provide shell access.
If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.
In the local project, assuming it’s not under any VCS at the moment:
git add .
git commit -m "initial commit"
Create a new repository on the command line
On github, create a new empty repo
Note the lines it tells you under “Push an existing repository from the command line” – or edit these ones:
git remote add origin firstname.lastname@example.org:Polsonby/test.git
git push -u origin master
Do those in the new working directory, which will add the github repo as an upstream origin repository for your local one, then push the entire history up to the master branch on there, synchronising them.
as needed to sync between local and remote.
ttf2eot on the web!.
via ttf2eot on the web!.
Excellent conversion tool to convert TTF to EOT