Skip to content

Instantly share code, notes, and snippets.

@8ig8
8ig8 / Paypal.php
Last active April 11, 2016 15:06 — forked from Headline/Paypal.php
PayPal API Requests
<?php
class Paypal
{
/**
* API Version
*/
const VERSION = 51.0;
/**
@8ig8
8ig8 / parse-wp-config.sh
Last active February 10, 2016 18:14
Parse DB details from wp-config.php
#!/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)"
@8ig8
8ig8 / csv_to_array.php
Created December 4, 2015 20:59 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
<?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
@8ig8
8ig8 / etchosts.sh
Created October 22, 2015 12:21 — forked from mikeflynn/etchosts.sh
An /etc/hosts manager bash script (v1.1) -- Added import and export commands!
#!/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()
{
#!/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
@8ig8
8ig8 / clients.md
Created October 21, 2015 12:04 — forked from defunkt/clients.md
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@8ig8
8ig8 / mac.sh
Last active October 19, 2015 18:21
Mac/OSX config, etc.
# 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.
#
@8ig8
8ig8 / gist:fb08e5b2e73f9fdc32c2
Last active August 29, 2015 14:06
Keyboard Maestro JS Trials
function saySomething() {
return 'Something';
}
saySomething();
// Self-executing anonymous function
// KM can then capture the returned value
// Same as above, but cleaner
(function(){
@8ig8
8ig8 / View.php
Last active December 15, 2015 12:14
Simple PHP view class
<?php
// http://stackoverflow.com/a/529923
class View {
protected $filename;
protected $data;
function __construct( $filename ) {
$this->filename = $filename;
}
@8ig8
8ig8 / .profile
Last active August 29, 2015 13:56
# 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