This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uuidgen generates a UUID, but in capital letters | |
# The generated UUID is piped into tr which transforms it to lowercase | |
# The lowercase output is piped into another tr, but this removes any newline characters | |
# Finally, that output is piped into pbcopy, which copies the UUID to the clipboard | |
uuidgen | tr "[:upper:]" "[:lower:]" | tr -d '\n' | pbcopy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Compute the check digit of a UPC | |
* | |
* Example : 01595830676 | |
* Product : 015958306760 | |
* | |
* @param string $upc | |
* @return string $upc |