Skip to content

Instantly share code, notes, and snippets.

View dhigginbotham's full-sized avatar
😸
happycat

David Higginbotham dhigginbotham

😸
happycat
View GitHub Profile
var _s
, FacebookConnect = {
settings: {
status: null,
friends: null,
me: null
},
init: function() {
_s = this.settings;
@dhigginbotham
dhigginbotham / app.js
Created February 13, 2013 11:53
hapi js example question
// Load modules
var Crypto = require('crypto');
var Hawk = require('hawk');
var Hapi = require('hapi');
// Declare internals
var internals = {
@dhigginbotham
dhigginbotham / super.builder.js
Created February 15, 2013 22:51
Folder structure creator, so i dont have to keep doing it... prolly going to add file gen too
//super.builder.js
var mkdirp = require('mkdirp');
var fs = require('fs');
var path = require('path');
var output_path = path.join(__dirname, 'build');
var paths = [
{route: "conf", children: ["schema"]},
{route: "library", children: ["less"]},
//scripts.schema.js
//this schema will allow us to conditionally load stuff, without a huge mess.
var scriptLoader = {};
scriptLoader.files = [
//header scripts
{path:'//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js', name:'jquery', where:'head', url:'/', type: 'js'},
{path:'//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js', name:'bootstrap', where:'head', url: '/', type: 'js'},
{path:'/socket.io/socket.io.js', name:'socket-io', where:'head', url: '/', type: 'js'},
var lessFiles = __dirname + '/../src'
, cssFiles = __dirname + '/../public/css';
var less = require('less')
, fs = require('fs');
var onModify = function(filename){
fs.readFile(lessFiles + '/' + filename, function(err, lessCss){
if(err)
throw new Error(err);
@dhigginbotham
dhigginbotham / scripts.module.js
Last active December 14, 2015 14:29
script loader with obj array pattern
var colors = require('colors');
//scripts.schema.js
var scriptLoader = {};
scriptLoader.files = [
//header scripts
{path:'//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', name:'jquery', where:'head', url:'/', type: 'js'},
{path:'//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js', name:'bootstrap', where:'head', url: '/', type: 'js'},
@dhigginbotham
dhigginbotham / filter-nav.php
Created March 30, 2013 02:53
Nav filter for wordpress
add_filter('wp_nav_menu_items','search_box_function', 10, 2);
function search_box_function( $nav, $args ) {
if( $args->theme_location == 'main-nav' ) {
//echo count($nav);
//print_r($nav);
//$navbit = explode("\n", $nav);
//print_r($navbit);
if (!is_front_page()){
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
echo '';
}
function change_post_object_label() {
forms = module.exports = {}
forms.donate = [
{name: "first_name", type: "text", level: null, req: true, label: "First Name:", active: true},
{name: "last_name", type: "text", level: null, req: true, label: "Last Name:", active: true},
{name: "email", type: "text", level: null, req: true, label: "Email:", active: true},
{name: "message", type: "textarea", level: null, label: "Message:", active: false},
{name: "cell_number", type: "text", level: null, label: "Cell Phone:", active: true},
{name: "receive_text", type: "checkbox", level: null, label: "Would you like to receive text messages in the future?", active: true},
{name: "donate", type: "button", level: null, text: "Donate <i class='icon-chevron-right'>&nbsp;</i>", active: true, class: "btn btn-primary disabled pull-right clearfix"},
@dhigginbotham
dhigginbotham / init.js
Created April 23, 2013 23:52
yepnope with Zepto & jQuery fallback for IE working Twitter bootstrap
yepnope({
test: navigator.appName.match(/Explorer/), // IE?
yep: '//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js',
nope: '//cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js',
callback: function(testResult, key) {
if (key === false) {
Zepto.browser = {webkit: true},
window.jQuery = Zepto
}
}