Skip to content

Instantly share code, notes, and snippets.

Alex King alexkingorg

Block or report user

Report or block alexkingorg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bigdawggi / mailtrap-filter.php
Last active Jun 3, 2019
Mailtrap filter for WordPress
View mailtrap-filter.php
* Routes all email from WP installation to specific Mailtrap
* account inbox.
* All you need to do is change the "Username" and "Password"
* settings to the appropriate box in Mailtrap. Then all
* mail **should** be routed to that box. Exceptions would
* be other functionality that overwrite the wp_mail() functions
* and may not use this filter, or other filters that change
* this behavior after we set it, or millions of other things.
ryanduff / gist:4229573
Created Dec 7, 2012
Fake activation hook
View gist:4229573
function faux_activation_function() {
if ( 'activated' !== get_option( 'your_activation_option' ) ) {
//do stuff you'd normally run in activation hook
update_option( 'your_activation_option', 'activated' );
koop / gallery.js
Created Dec 3, 2012
Query all attachments uploaded to a post.
View gallery.js
gordonbrander / derp-modules.js
Created Oct 9, 2012
Simple, tiny, dumb JavaScript Modules
View derp-modules.js
// Simple, tiny, dumb module definitions for Browser JavaScript.
// What it does:
// * Tiny enough to include anywhere. Intended as a shim for delivering
// browser builds of your library to folks who don't want to use script loaders.
// * Exports modules to `__modules__`, a namespace on the global object.
// This is an improvement over typical browser code, which pollutes the
// global object.
// * Prettier and more robust than the
dougalcampbell / uploadables.php
Created Sep 28, 2012
WordPress snippet: add uploadable file types
View uploadables.php
* Add uploadable mime types / file extensions
function dc_add_uploadables($arr = array()) {
$new = array(
// Add file extension => mime type mapping here
'keynote|key' => 'application/',
'numbers' => 'application/',
'pages' => 'application/'
evansolomon / gist:3568555
Created Sep 1, 2012
Bash helpers for navigating WordPress code
View gist:3568555
# Alias ST2's command line tool for a shorter (easier-to-remember) name
alias st="/Applications/Sublime\ Text\"
# Search for an open Sublime Text to a function definition
function fx() {
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st
# Example usage from the root of a WordPress repository
gordonbrander / tiny-state-machine.js
Created May 25, 2012
World's Tiniest JavaScript State Machine
View tiny-state-machine.js
var StateMachine = {
// Register valid states for this object.
__states__: {
'success': ['failure'],
'failure': ['success']
// Set initial state.
__state__: 'success',
View opengraphbookmarklet.js
bdha / vbox_to_kvm.txt
Created Mar 1, 2012
Migrating from VirtualBox to KVM on ZFS
View vbox_to_kvm.txt
# It's important to convert the vbox image (VMDK or VDI or whatever) using
# the same version of VirtualBox that created it. You can try converting the image
# with qemu-img or kvm-img, but weird version mismatches will possibly make it not
# work.
# On your VirtualBox machine:
VBoxManage clonehd machine.vmdk machine.img --format RAW
scp machine.img root@kvm-host:/somewhere
markjaquith / .all
Last active Oct 10, 2018
Bash stuff
View .all
for f in ~/Dropbox/bash/*; do source $f; done
You can’t perform that action at this time.