Today I learned:

Converting Unicode quotation marks in PHP

Unicode quotation marks (sometimes called smart quotes) are those curved/slanted single and double quotation marks: “ ” ‘ ’. The ASCII ones look like this: " '. They are usually interchangeable in word processing, but the stylized ones sometimes cause issues on the web (in a parser, for example).

To convert one to the other in PHP, use iconv():

<?php
$output = iconv('UTF-8', 'ASCII//TRANSLIT', $input);

If you use OS X and want to turn off smart quotes, go to System Preferences > Keyboard > Text and uncheck “Use smart quotes and dashes.”


Remote git repositories

Using git locally is one thing, but it is far more powerful (and exciting!) to push that code to a remote repository like Github for display and collaboration.

Assuming you have a local repository that wasn’t cloned from a remote one, you’ll need to hook it up to a remote repository:

$ git remote add origin <URL to remote repository>

If there is code already on the remote repository, you’ll need to merge it in to your local:

$ git pull
$ git merge origin/master

Then push your committed files to the remote repository:

$ git push origin master

For a great beginner’s guide to git, check out Roger Dudler’s git - the simple guide.


Toggl Slash Command for Slack

Today I released my first personal project on Github: Toggl Slash Command for Slack.

It is a custom slash command that enables users to put time entries into Toggl from Slack.

If you use it, I’d love to know! It is in its rough early stages, but I have some future additions planned for it, so stay tuned.

View more TIL posts