Skip to content

Instantly share code, notes, and snippets.

View carldanley's full-sized avatar

Carl Danley carldanley

View GitHub Profile
@carldanley
carldanley / box-example.js
Created August 28, 2012 21:04
Box Example
function createBoxes(){
var html = '';
var boxesToCreate = 50;
//create the container node
var container = document.createElement( 'div' );
container.className = 'container';
//create the boxes and add them to the container
for( var i = 0; i < boxesToCreate; i++ ){
@carldanley
carldanley / cd-twitter.php
Created August 29, 2012 14:13
CD Twitter Caching
<?php
//------------------------------------------------------------------------------
class CD_Twitter{
protected $_base_twitter_url = 'https://api.twitter.com/1/statuses/user_timeline.json?';
protected $_default_options = array(
'include_entities' => true,
'include_rts' => true,
'screen_name' => 'carldanley',
'count' => 10
);
@carldanley
carldanley / tour.js
Created September 1, 2012 05:13
tour.js Beta Code
var myTour = tours.createTour( 'my-awesome-tour' );
//feature the menu now
myTour.disableScrolling()
.createBackground( '#000', 0.00 )
.fadeBackground( 0.4, 500 )
.scrollTo( 'body', 1000 )
.wait( 500 )
.showCursor( )
.trackProgress( true )
@carldanley
carldanley / dom-ready.js
Created September 5, 2012 16:35
Simple DOM ready() detection without jQuery
var DOM = new function(){
var IS_READY = false;
var CALLBACKS = [];
var SELF = this;
SELF.ready = function( callback ){
//check to see if we're already finished
if( IS_READY === true && typeof callback === 'function' ){
callback();
return;
<?php
/**
* Class WP_Stripe
* Author: Carl Danley
*
* This class handles processing any Stripe actions by letting the WP HTTP API do all of the heavy lifting.
*
*/
@carldanley
carldanley / .jshintignore
Last active December 21, 2015 23:48 — forked from haschek/.jshintrc
// --------------------------------------------------------------------
// WordPress JSHint Ignored
// --------------------------------------------------------------------
wp-admin/js/farbtastic.js
wp-admin/js/iris.min.js
wp-includes/js/crop/*
wp-includes/js/imgareaselect/*
wp-includes/js/jcrop/*
wp-includes/js/jquery/*
wp-includes/js/mediaelement/*
@carldanley
carldanley / wp-modules.js
Last active December 22, 2015 00:28
Example of WP modules object
// new modules object introduction
( function( window, undefined ) {
window.wp = window.wp || {};
window.wp.modules = window.wp.modules || {};
} )( window );
// example Mediator module
wp.modules.Mediator = ( function( window, undefined ) {
@carldanley
carldanley / bookmarklet.js
Last active April 29, 2016 15:36
JSConf 2014 Schedule Bookmarker
( function() {
function highlightSchedule( tableIndex, scheduleValues ) {
var tables = document.querySelectorAll( 'table.schedule' );
if( tableIndex >= tables.length ) {
return;
}
var table = tables[ tableIndex ];
var rows = table.querySelectorAll( 'tr' );
for( var i = 0, len = scheduleValues.length; i < len; i++ ) {
@carldanley
carldanley / bash.sh
Last active August 29, 2015 14:16
SSH Agent Scripts
# adds all keys in the ~/.ssh folder
function add_ssh_keys {
for i in `find ~/.ssh -name '*.pub' | sed 's/.\{4\}$//'`;
do ssh-add $i;
done
}
SSH_ENV=$HOME/.ssh/environment
function start_agent {
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
ANSIBLE_PATH = '.' # path targeting Ansible directory (relative to Vagrantfile)
# Set Ansible roles_path relative to Ansible directory
ENV['ANSIBLE_ROLES_PATH'] = File.join(ANSIBLE_PATH, 'vendor', 'roles')