This file contains 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
/** | |
* https://www.embracepetinsurance.com/waterbowl/article/measuring-my-cats-body-mass-index-the-fbmi | |
* | |
* ribCage float Circumference of your cat's rib cage in inches. (The level of the 9th rib is ideal). | |
* legLength float Length in inches of your cat's rear leg from knee to ankle. | |
* | |
* If the result is >= 42, your cat is overweight! | |
*/ | |
function catBmi(ribCage, legLength) { | |
return (ribCage / .7062 - legLength) / .9156 - legLength; |
This file contains 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
// Using thephpleague/oauth1-client | |
// https://github.com/thephpleague/oauth1-client | |
require_once __DIR__.'/../../vendor/autoload.php'; | |
// Create server | |
$server = new League\OAuth1\Client\Server\Magento(array( | |
'identifier' => $data['consumerKey'], | |
'secret' => $data['consumerSecret'], | |
'callback_uri' => "http://mage-access.local/oath.php/", |
This file contains 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
/** | |
* @param {string} value The text to copy to the clipboard | |
* This method is designed to circumvent the inability to copy test from an inactive textarea, | |
* Hopefully it gets the keyboard to drop off on mobile too | |
*/ | |
copyToClipboard = () => { | |
const tmpTextArea = document.createElement('textarea'); | |
const newContent = document.createTextNode(this.props.getText()); | |
tmpTextArea.appendChild(newContent); | |
tmpTextArea.style.width = 0; |
This file contains 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 | |
/** | |
* This is such a common thing, I decided to put it in a gist so I don't have to keep reinventing it every time LOL. | |
*/ | |
function substr_to($haystack, $needle) { | |
$iPos = strpos($haystack, $needle); | |
if($iPos === false) { | |
return false; | |
} | |
return substr($haystack, 0, $iPos); |
This file contains 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
#!/bin/bash | |
php -d xdebug.remote_autostart=1 -d xdebug.remote_host=$(echo $SSH_CLIENT | sed 's/ .*//') path-to-php-script.php |
This file contains 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
#/bin/bash | |
# http://disq.us/p/1k1ww01 | |
cert_path=$1 # eg /etc/letsencrypt/live/example.com/cert.pem | |
key_path=$2 # eg /etc/letsencrypt/live/example.com/privkey.pem | |
certbot revoke --cert-path "$1" --key-path "$2" |
This file contains 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
//-------------------------------------------------------------------- | |
// http://solutionoptimist.com/2013/12/27/javascript-promise-chains-2/ | |
//-------------------------------------------------------------------- | |
//-------------------------------------------------------------------- | |
// Pretend calls to a service | |
//-------------------------------------------------------------------- | |
function getDeparture() { | |
return new Promise((resolve) => { | |
setTimeout(function() { |
This file contains 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
#!/bin/bash | |
# Locate files relative to current working directory | |
# Potentially faster than find for deep directories | |
function rlocate | |
{ | |
locate "$1" | grep "$(pwd)" | |
} |
This file contains 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
alias thisdir='basename "$(pwd)"' |
NewerOlder