Skip to content

Instantly share code, notes, and snippets.

@benrothe
Created November 2, 2013 17:17
Show Gist options
  • Save benrothe/7281227 to your computer and use it in GitHub Desktop.
Save benrothe/7281227 to your computer and use it in GitHub Desktop.
A TextExpander snippet to convert clipboard contents: “Curly” quotes to "straight", em-dashes to double-hyphens and ellipses to three periods.
#!/usr/bin/env php
<?php
$str = `pbpaste`;
$find = array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6");
$replace = array("'", "'", '"', '"', '-', '--', '...');
echo str_replace($find, $replace, $str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment