Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
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 | |
class Paypal | |
{ | |
/** | |
* API Version | |
*/ | |
const VERSION = 51.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
#!/bin/bash | |
## | |
# Parse wp-config.php | |
# | |
# https://gist.github.com/8ig8/1fcdee3dddcd840083f2 | |
# curl https://gist.githubusercontent.com/8ig8/1fcdee3dddcd840083f2/raw/parse-wp-config.sh | bash | |
# curl -k https://gist.githubusercontent.com/8ig8/1fcdee3dddcd840083f2/raw/parse-wp-config.sh | bash | |
WPDBNAME="$(cat ./wp-config.php | grep DB_NAME | cut -d \' -f 4)" |
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 | |
/** | |
* Convert a comma separated file into an associated array. | |
* The first row should contain the array keys. | |
* | |
* Example: | |
* | |
* @param string $filename Path to the CSV file | |
* @param string $delimiter The separator used in the file | |
* @return array |
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 | |
HOSTSFILE="/etc/hosts" | |
BAKFILE="$HOSTSFILE.bak" | |
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$" | |
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" | |
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$" | |
backup() | |
{ |
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 | |
## | |
# Install rsync on WH | |
# http://forums.westhost.com/showthread.php?13812-Easily-Install-rsync-On-WestHost-Accounts&highlight=rsync | |
# | |
# Requires gcc | |
# | |
# https://gist.github.com/8ig8/2e7c1c9ce43448d8ced5 | |
# curl https://gist.githubusercontent.com/8ig8/2e7c1c9ce43448d8ced5/raw/install-rsync-wh.sh | bash |
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
# Most of these are from: | |
# https://github.com/paulirish/dotfiles/blob/master/.osx | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# To check a value use `read`: | |
# | |
# defaults read com.apple.LaunchServices LSQuarantine | |
# | |
# If value does not exist, then it has been manually set. | |
# |
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
function saySomething() { | |
return 'Something'; | |
} | |
saySomething(); | |
// Self-executing anonymous function | |
// KM can then capture the returned value | |
// Same as above, but cleaner | |
(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
<?php | |
// http://stackoverflow.com/a/529923 | |
class View { | |
protected $filename; | |
protected $data; | |
function __construct( $filename ) { | |
$this->filename = $filename; | |
} |
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
# set PATH so it includes user's private bin if it exists | |
# http://askubuntu.com/questions/279285/why-profile-and-not-bashrc-appends-bin-to-path | |
if [ -d "$HOME/bin" ] ; then | |
PATH="$HOME/bin:$PATH" | |
fi | |
# WP-CLI Bash completions | |
source $HOME/.wp-completion.bash |
NewerOlder