Skip to content

Instantly share code, notes, and snippets.

View brianfeister's full-sized avatar
🧙‍♂️

Brian Feister brianfeister

🧙‍♂️
View GitHub Profile
@blobaugh
blobaugh / gist:5165152
Created March 14, 2013 20:54
options.php in plugin
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*
*/
function optionsframework_option_name() {
@blobaugh
blobaugh / gist:5165142
Created March 14, 2013 20:53
Original options.php
<?php
// Grab the original options.php file
require_once( WOT_PLUGIN_DIR . '3rd-party/options.php' );
add_filter( 'wot_options_page', 'wot_theme_add_options' );
/**
* Add any custom fields that are required to the options framework
@eduardozulian
eduardozulian / wp-customize-image-reloaded.php
Last active November 16, 2023 02:50
Extend WP_Customize_Image_Control class allowing access to files uploaded within the same context.
<?php
/**
* Customize Image Reloaded Class
*
* Extend WP_Customize_Image_Control allowing access to uploads made within
* the same context
*/
class My_Customize_Image_Reloaded_Control extends WP_Customize_Image_Control {
/**
* Constructor.
@isochronous
isochronous / Application.root.js
Last active November 17, 2018 10:13
Root app for drop-in multi-app Marionette framework using requireJS and the subapprouter it works with
define([
"underscore",
"backbone",
"marionette",
"vent"
],
/**
* Creates the primary `Marionette.Application` object that runs the admin framework. Provides a central point
* from which all other sub-applications are started, shown, hidden, and stopped.
@nblumoe
nblumoe / angularjs_resource_tokenhandler.js
Created July 5, 2012 07:34
AngularJS service to send auth token with $resource requests
.factory('TokenHandler', function() {
var tokenHandler = {};
var token = "none";
tokenHandler.set = function( newToken ) {
token = newToken;
};
tokenHandler.get = function() {
return token;
@turtlesoupy
turtlesoupy / child_monitor.coffee
Created June 25, 2012 01:12
A node.js process supervisor and a sample use with health checks - see http://blog.argteam.com/coding/hardening-nodejs-production-process-supervisor/
{_} = require 'underscore'
child_process = require 'child_process'
async = require 'async'
healthCheckInterval = 60 * 1000
bounceInterval = 60 * 1000
bounceWait = bounceInterval + 30 * 1000
delayTimeout = (ms, func) -> setTimeout func, ms
class MonitoredChild
@jaredhanson
jaredhanson / gist:2559730
Created April 30, 2012 16:20
Restify and Passport /cc Hal Robertson
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'
@evansolomon
evansolomon / git-completion.sh
Created April 1, 2012 08:36
Git auto-complete script
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@evansolomon
evansolomon / .bashrc
Created April 1, 2012 08:36
Bash prompt
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 30 ]; then CurDir=${DIR:0:12}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
# show git branch name in prompt
PS1='\[\e[1;32m\]\u: $CurDir $(__git_ps1 " (%s)")\$\[\e[0m\] '
# make bash autocomplete with up arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# make tab cycle through commands instead of listing
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";