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
| /** | |
| * Convert any string into an integer | |
| * | |
| * @param {string} str Input string | |
| * @return {integer} Integer | |
| */ | |
| var strToInt = (function () { | |
| var map = {}; | |
| var size = 0; | |
| var hash; |
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 | |
| /** | |
| * Convert a human-readable string into a slug | |
| * | |
| * 'Sample input string!' gets converted to 'sample-input-string' | |
| * | |
| * @param string Source string | |
| * @return string Slug | |
| * @author Cake Development Corporation (http://cakedc.com) |
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
| <style> | |
| .embed-container { | |
| position: relative; | |
| padding-bottom: 56.25%; | |
| padding-top: 30px; | |
| overflow: hidden; | |
| max-width: 100%; | |
| height: auto; | |
| } | |
| .embed-container iframe, |
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
| find . -type d -exec chmod 0755 {} \; | |
| find . -type f -exec chmod 0644 {} \; |
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
| # .gz | |
| mysqldump -h 'db.example.com' -u'username' -p'password' 'database' --single-transaction | gzip -c | cat > 'database_backup_2014-01-01.sql.gz' | |
| # .sql | |
| mysqldump -h 'db.example.com' -u'username' -p'password' 'database' --single-transaction > 'database_backup_2014-01-01.sql' |
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 | |
| /** | |
| * Convert any string to an integer between 0-9 | |
| * | |
| * @param string $str Any string | |
| * @return integer Integer between 0-9 | |
| */ | |
| function strToInt($str) { | |
| preg_match('/\d/', md5((string) $str), $matches, PREG_OFFSET_CAPTURE); |
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 | |
| App::uses('Model', 'Model'); | |
| App::uses('String', 'Utility'); | |
| class AppModel extends Model { | |
| /** | |
| * @author Reed Dadoune | |
| * distanceQuery |
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
| launchctl unload /System/Library/LaunchAgents/com.apple.soagent.plist && launchctl load /System/Library/LaunchAgents/com.apple.soagent.plist && killall Dock |
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
| tar -cf - relative/path/to/dir | gzip -c | ssh [email protected] 'cd ~/path/to/dir; tar xfz -' | |
| # If using a fast lan (I have just tested gigabyte ethernet) it is faster to not compress the data so the command would be: | |
| # tar -cf - relative/path/to/dir | ssh [email protected] 'cd ~/path/to/dir; tar xf -' |
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 | |
| /** | |
| * Download a remote file to a local file | |
| * | |
| * @param string $url URL to remote file | |
| * @param string $localPathToFile Absolute path to local file where it will be saved | |
| * @return boolean True if file saved successfully | |
| */ | |
| function downloadFile($url, $localPathToFile) { |