Skip to content

Instantly share code, notes, and snippets.

View simonwjackson's full-sized avatar
🎯
Focusing

Simon W. Jackson simonwjackson

🎯
Focusing
View GitHub Profile
@simonwjackson
simonwjackson / index.html
Last active February 16, 2017 22:42 — forked from anonymous/index.html
Spatial Navigation with selected element always in view // source http://jsbin.com/mucoses
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>JavaScript SpatialNavigation Demo Page</title>
<script>
function isElementInViewport (el) {
//special bonus for those using jQuery
@simonwjackson
simonwjackson / example.js
Created October 22, 2012 21:14 — forked from addyosmani/example.js
Javascript: Mediator pattern
// Example 1
mediator.name = 'Doug';
mediator.subscribe('nameChange', function(arg){
console.log(this.name);
this.name = arg;
console.log(this.name);
});
mediator.publish('nameChange', 'Jorn');
@simonwjackson
simonwjackson / gist:3934342
Created October 22, 2012 21:09 — forked from tomraithel/gist:3852171
SASS: mixin for absolute center position
@mixin center($width, $height) {
position: absolute;
left: 50%;
top: 50%;
height: $height;
width: $width;
margin-left: - $width / 2;
margin-top: - $height / 2;
}