Skip to content

Instantly share code, notes, and snippets.

View kadamwhite's full-sized avatar

K Adam White kadamwhite

View GitHub Profile
@kadamwhite
kadamwhite / tracking.js
Created April 23, 2012 13:41
A more flexible SiteCatalyst link tracking script wrapper
// Wrapper function for native Omniture SiteCatalyst link tracking (s.tl())
var trackLink = function (referenceObject, trackingData, targetReportSuite) {
if (typeof referenceObject === 'undefined' || typeof trackingData === 'undefined') {
// If you're missing your settings object or any variables/events to fire, you fail
return;
}
var linkTrackVarsArray = [],
// Get values out of the configuration object
tEvents = trackingData.events, // String || undefined
tVars = trackingData.variables, // Object || undefined
@kadamwhite
kadamwhite / wcbos-preprocessors-outline.md
Created July 12, 2012 03:10
CSS Pre-Processors Slide Outline for WordCamp Boston 2012
@kadamwhite
kadamwhite / invader.css
Created September 5, 2012 16:38
Pure-CSS Space Invader
/**
* Pure-CSS Space Invader, adapted to a 2px pixel size from
* the original example at CSS-Tricks "The Shapes of CSS"
*
* @link: http://css-tricks.com/examples/ShapesOfCSS/
*/
.invader {
box-shadow:
-4px -2px white, 4px -2px white,
@kadamwhite
kadamwhite / main.js
Created December 13, 2012 22:20
A basic JW Player plugin to display a text banner overlay at the top of the video player instance
// Pass the plugin reference and configuration parameter ('text') to the embed script
jwplayer('id-of-container').setup({
file: '/path/to/my/video.mp4',
plugins: {
'/path/to/overlay.js': {
text: 'Text that you want to go within the overlayed banner'
}
}
});
@kadamwhite
kadamwhite / bandify.js
Created January 31, 2013 21:08
Based on https://twitter.com/the55/status/295991439484137472, this is (will be) a script to fetch text nodes from the current page, pick a few random phrases, and combine them into an entertaining song name with band, track, and optionally remixer/remix name.
function findTextNodes( node ) {
var text = [];
if ( node.nodeType === 3 ) {
text.push( node.nodeValue );
// TODO: Filter out carriage returns, whitespace.
// POSSIBLE TODO: Restrict to nodes within the main content area of the page? (so don't get ads, etc)
} else {
for ( var i = 0, max = node.childNodes.length; i < max; i++ ) {
text = text.concat( findTextNodes( node.childNodes[i] ) );
}
@kadamwhite
kadamwhite / blokkit.js
Last active June 19, 2017 15:59
Bookmarklet to convert all text on a webpage to the Blokk font, for use when working on mockups in your browser.
(function() {
var css = "*{font-family:\"Blokk Regular\", blokk !important;}",
head = document.getElementsByTagName("head")[0],
style = document.createElement("style");
style.type = "text/css";
if ( style.styleSheet ) {
style.styleSheet.cssText = css;
} else {
style.appendChild( document.createTextNode( css ) );
}
@kadamwhite
kadamwhite / Modules.txt
Created February 28, 2013 14:05
Modules defined within Tweetdeck's main script file, with dependencies
"flight/utils", []
"flight/compose", []
"flight/advice", ["./utils", "./compose"]
"flight/registry", ["./utils"]
"flight/component", ["./advice", "./utils", "./compose", "./registry"]
"data/with_client", []
"data/accounts", ["flight/component", "data/with_client"]
"data/column_manager", ["flight/component"]
"data/embed_tweet", ["flight/component", "data/with_client"]
"util/with_version_comparator", []
@kadamwhite
kadamwhite / multi-line-EVERYTHINGGGG.js
Created May 22, 2013 14:05
AngularJS Declaration Conventions
module.directive('myDirective', [
'$compile',
'$location',
'Notify',
'sharedData',
function(
$compile,
$location,
Notify,
sharedData
@kadamwhite
kadamwhite / ginblossom.md
Last active April 16, 2016 19:59
Drink Recipes

Gin Blossoms

If you thought Smash Mouth has a strong drink connotation, this band's just cheating: There's a delicious drink just sitting there waiting for you, called, appropriately, the

Gin Blossom

BUT there is some contention about what that is. The one I know is apparently

The Clover Club version

@kadamwhite
kadamwhite / thoughts.md
Last active December 27, 2015 10:29
Towards Consistent JavaScript Code Style in WordPress

JavaScript Coding Standards

The core WordPress PHP files become cleaner and easier to read with every release, thanks in part to our strong standards for PHP code style. Our JavaScript, on the other hand, hasn't gotten nearly enough love. This post is intended to open up the recent discussion around JavaScript style to the greater community so we can make up for lost time.

Don't we already have a style guide for JavaScript?

Back in March, @tommcfarlin added a set of coding standards for JavaScript to the developer handbook. These WordPress JS coding standards were a great work-in-progress, but weren't fully comprehensive (leading to some comment threads clarifying various areas). More importantly, without any clear implementation plan the style guide failed to gain traction.

At WordCamp Boston's core