Skip to content

Instantly share code, notes, and snippets.

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

Brian Feister brianfeister

🧙‍♂️
View GitHub Profile
You will probably want something like this in a run block for your app:
window.NativeBridge.closestLocation = function (location) {
$rootScope.$broadcast('locationChange', location);
};
And then a service to do all the stuff:
.service('ClosestLocation', function ($rootScope) {
var that = this;
@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
@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
@engram-design
engram-design / app.js
Last active December 17, 2015 02:58
A demonstration of using Handlebars with Backbone.Marionette. Utilizes Grunt.js task (grunt-contrib-handlebars) to pre-compile templates, and swaps Handlebars.runtime for further optimization. Feel free to comment if you have any suggestions or questions!
define([
'marionette',
'templates'
], function(Marionette, Templates) {
var app = new Marionette.Application({
root: '/',
templates: Templates
});
@avimar
avimar / gist:5968480
Created July 10, 2013 17:47
Install newrelic with salt-stack on your debian/ubuntu system
#install instructions at https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian
base:
pkgrepo.managed:
- humanname: Newrelic PPA
- name: deb http://apt.newrelic.com/debian/ newrelic non-free
# - dist: precise
- file: /etc/apt/sources.list.d/newrelic.list
- keyid: 548C16BF
- keyserver: subkeys.pgp.net
@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:
#
@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>>'
@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
@narthur
narthur / adjustTableWidths.jsx
Last active May 30, 2018 06:24
InDesign JSX User Script to Adjust Table Widths Relative to Frame Width
// Inspiration:
// https://forums.adobe.com/message/2524327
// http://www.indiscripts.com/post/2009/10/work-around-the-width-height-gap
var myDoc = app.activeDocument;
function getWidth(/*PageItem*/obj, /*bool*/visible)
// return the [width,height] of <obj>
// according to its (geometric|visible)Bounds
{