Skip to content

Instantly share code, notes, and snippets.

View thisislawatts's full-sized avatar

Luke Watts thisislawatts

View GitHub Profile
min = function( a, b ) {
return a > b ? b : a;
};
max = function( a, b) {
return a > b ? a : b;
};
coverDimensions = function ( child_w, child_h, container_w, container_h ) {
@thisislawatts
thisislawatts / hotswap
Last active August 29, 2015 14:02
Tiny Bookmarklet for swapping between sites
(function(w) {
var HotSwap = function () {
this.version = 2;
this.storageKey = 'LAHotSwapTarget_' + this.version;
}
HotSwap.prototype.init = function() {
var dest = window.localStorage.getItem( this.storageKey );
/////////////////////
//
// Atomic Styles
//
// Useful for little interventions
//
/////////////////////
.fl {float: left}
.fr {
@thisislawatts
thisislawatts / .htaccess
Created May 22, 2014 11:11
DCD .htaccess
Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
Options +Indexes
RewriteEngine On
RewriteRule ^student/(.*)$ index1.php?page=student&subpage=$2 [L,QSA]
# If the requested file doesn't exist as directory or file
# pass to app(index1.php) to handle the routing
RewriteCond %{REQUEST_FILENAME} !-d
@thisislawatts
thisislawatts / gist:8f7892a363911ca0b16a
Created May 8, 2014 08:29
Resrc.js w/ Event emitter
/*!
* EventEmitter v4.2.7 - git.io/ee
* Oliver Caldwell
* MIT license
* @preserve
*/
(function(){"use strict";function t(){}function r(t,n){for(var e=t.length;e--;)if(t[e].listener===n)return e;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var e=t.prototype,i=this,s=i.EventEmitter;e.getListeners=function(n){var r,e,t=this._getEvents();if(n instanceof RegExp){r={};for(e in t)t.hasOwnProperty(e)&&n.test(e)&&(r[e]=t[e])}else r=t[n]||(t[n]=[]);return r},e.flattenListeners=function(t){var e,n=[];for(e=0;e<t.length;e+=1)n.push(t[e].listener);return n},e.getListenersAsObject=function(n){var e,t=this.getListeners(n);return t instanceof Array&&(e={},e[n]=t),e||t},e.addListener=function(i,e){var t,n=this.getListenersAsObject(i),s="object"==typeof e;for(t in n)n.hasOwnProperty(t)&&-1===r(n[t],e)&&n[t].push(s?e:{listener:e,once:!1});return this},e.on=n("addListener"),e.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},e.once=n("addOnceListener"),e.defineE
@thisislawatts
thisislawatts / actions.php
Last active August 29, 2015 13:56
WordPress Tidy Up
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'rsd_link', 10 );
remove_action( 'wp_head', 'wlwmanifest_link', 10 );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
remove_action( 'wp_head', 'locale_stylesheet', 10 );
remove_action( 'wp_head', 'wp_generator', 10 );
remove_action( 'wp_head', 'rel_canonical', 10 );
<form action="#">
<fieldset>
<legend>Legend</legend>
<div>
<label for="text">Text Input <abbr title="Required">*</abbr></label>
<input id="text" class="text" type="text">
<em>Note about this field</em>
</div>
<div>
<label for="password">Password</label>
@thisislawatts
thisislawatts / gist:8384252
Last active January 3, 2016 00:39
Ribbon
// Grid
var gridSize = 25,
cols = Math.floor( window.innerWidth / (gridSize * 1.75) ),
rows = Math.floor( window.innerHeight / (gridSize * 1.5 ) ) * 2;
var offsetX = -20;
//
for ( var x = 1; x <= cols; x++) {
for (var y = 1; y < rows; y++ ) {
@thisislawatts
thisislawatts / debug-bar-action-and-filters-addon.php
Last active January 2, 2016 00:19
Shows hooked functions for actions
<?php
/**
* Plugin Name: Debug Bar Actions and Filters Addon
* Plugin URI: http://wordpress.org/extend/plugins/debug-bar-actions-and-filters-addon/
* Description: This plugin add two more tabs in the Debug Bar to display hooks(Actions and Filters) attached to the current request. Actions tab displays the actions hooked to current request. Filters tab displays the filter tags along with the functions attached to it with priority.
* Version: 1.4.1
* Author: Subharanjan
* Author Email: [email protected]
* Author URI: http://www.subharanjan.in/
* License: GPLv2

Revised date: 12/05/2014

Between me, Luke Watts (LA Code & Design) and you [customer name]

Summary:

I'll always do my best to fulfil your needs and meet your expectations, but it's important to have things written down so that we both know what's what, who should do what and when, and what will happen if something goes wrong. In this contract you won't find any complicated legal terms or long passages of unreadable text. I've no desire to trick you into signing something that you might later regret. What I do want is what's best for both parties, now and in the future.

So in short;