Skip to content

Instantly share code, notes, and snippets.

@bradberger
bradberger / Gulpfile.js
Last active August 29, 2015 14:02
A sample Gulpfile for use with any Go HTTP server to automatically recompile the Go binary when any file changes.Adjust the projectName and srcDir to match your project's layout. Tested on Linux (Ubuntu) but should work wherever "sh" is available.
var projectName = 'main',
srcDir = './src',
gulp = require('gulp'),
exec = require('gulp-exec');
gulp.task('serve', function() {
var opts = { continueOnError: true, pipeStdout: true },
goCmd = 'sh -c "go run ' + __dirname + '/src/*.go&"',
killCmd = 'killall -q go ' + projectName;
@bradberger
bradberger / gist:6360391
Last active December 21, 2015 20:19
Simple fly-out menu for a WordPress sidebar menu. Supports unlimited nesting.
<script>
jQuery(function() {
if ('undefined' !== typeof submenuItems) {
submenuItems.off();
}
if ('undefined' !== typeof primaryItems) {
primaryItems.off();
}
if ('undefined' !== typeof sidebar) {
sidebar.off();