Skip to content

Instantly share code, notes, and snippets.

@scottlee
scottlee / array-push-assoc.php
Last active December 22, 2015 04:18
Push items onto a multidimensional array.
<?php
/**
* Add items to multidimensional array
*/
function array_push_assoc( $array, $key, $value ){
$array[$key] = $value;
return $array;
}
#!/bin/bash
# Get IP address from output file in Dropbox.
ip=`cat ~/Dropbox/HomeNetworkIP.txt`
# Establish SSH session
ssh $ip
# To connect:
# ./Dropbox/scripts/connect_to_home.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@scottlee
scottlee / wp-cli-commands.md
Last active January 15, 2016 01:50
A list of common WP-CLI commands.

Export/Import db

wp db export nameoffile.sql wp db import nameoffile.sql

Export WXR

wp export --dir=../wxr-exports --url=example.com wp export --dir=~/wxr-exports --url=example.com --start_date=2015-08-01 --end_date=2015-09-18

Using Bash

for f in ~/path-to-xmls/*.xml; do wp import $f --url=example.com --authors=create; done

@scottlee
scottlee / reload-browser.scpt
Last active March 7, 2024 19:25
Applescript for reloading a browser in the background. Useful when paired up with an Automator application and PhpStorm external tool shortcut.
# Choose your browser:
# Chrome
# tell application "Google Chrome"
# reload active tab of (get window 1)
# end tell
#
# # Safari
# tell application "Safari"
# tell window 1
@scottlee
scottlee / mamp3.x-and-object-caching.md
Last active March 15, 2019 15:22
Getting object caching working with MAMP, Memcached, and WordPress

MAMP 3.x

Steps

  1. Install Brew
  2. brew install memcached
  3. brew install libmemcached
  4. Grab a memcached.so file from here. Like this one for PHP 7.0.0.
  5. Move the memcached.so file to: /Applications/MAMP/bin/php/php7.x.x/lib/php/extensions/no-debug-non-zts-200xxxxx
  6. Add the following to the end of the php.ini: extension=memcached.so
@scottlee
scottlee / slackspotify.sh
Last active October 17, 2018 20:11 — forked from jgamblin/slackspotify.sh
A Script To Set Current Spotify Song As Slack Status - MacOS
#!/bin/bash
APIKEY="From Here https://api.slack.com/custom-integrations/legacy-tokens"
trap onexit INT
function reset() {
echo 'Resetting status'
curl -s -d "payload=$json" "https://slack.com/api/users.profile.set?token="$APIKEY"&profile=%7B%22status_text%22%3A%22%22%2C%22status_emoji%22%3A%22%22%7D" > /dev/null
}