Skip to content

Instantly share code, notes, and snippets.

View WillsonSmith's full-sized avatar

Willson Smith WillsonSmith

View GitHub Profile
@WillsonSmith
WillsonSmith / Swipe.js
Created July 3, 2012 17:19
Swipe Events (on end touch)
(function(){ //Self executing, anonymous function
//Leave out above if including in already existing script
function Swipe(){
var firstX, lastX;
function swipeRight(){
@WillsonSmith
WillsonSmith / HTMLTemplateSnippet.html
Last active December 16, 2015 22:09
A snippet for the basics of an HTML page.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css">
</head>
@WillsonSmith
WillsonSmith / FloatClearfix.css
Last active December 16, 2015 22:18
Small, effective way to clear floats in css
/* Apply the class "group" to your container element ie8+*/
.group:after {
content: "";
display: table;
clear: both;
}
@WillsonSmith
WillsonSmith / BlingSelect.js
Created May 2, 2013 21:18
Quick and small way to make a "bling" element selector. Avoid JQuery when it is not necessary.
var $ = document.querySelectorAll.bind(document);
Element.prototype.on = Element.prototype.addEventListener;
$('@cursor')[0].on('touchstart', handleTouch);
@WillsonSmith
WillsonSmith / tinygrid.scss
Last active December 17, 2015 08:09
A nothing-fancy, tiny grid sass file.
@mixin breakpoint($point) {
@if $point == papa-bear {
@media (max-width: 1600px) { @content; }
}
@else if $point == mama-bear {
@media (max-width: 1250px) { @content; }
}
@else if $point == baby-bear {
@media (max-width: 650px) { @content; }
}
@WillsonSmith
WillsonSmith / tinygrid.css
Created May 14, 2013 18:49
tinygrid.scss (sass) compiled to css - could be optimized a little.
*, *:before, *:after {
box-sizing: border-box;
}
.grid-full {
width: 100%;
}
.grid-1-2 {
float: left;
@WillsonSmith
WillsonSmith / Fisher-Yates-Shuffle.js
Created May 26, 2013 17:37
Fisher-Yates shuffle algorithm.
/*
* Add a shuffle function to Array object prototype
* Usage :
* var tmpArray = ["a", "b", "c", "d", "e"];
* tmpArray.shuffle();
*/
Array.prototype.shuffle = function (){
var i = this.length, j, temp;
if ( i == 0 ) return;
while ( --i ) {
@WillsonSmith
WillsonSmith / ScreenShot.rb
Created October 29, 2013 04:19
Move all screenshots (Mac) from desktop into a temporary (tmp) folder.
require 'fileutils'
files = Dir.glob "*.png"
files = files.map { |file| [file.count("?/"), file] }
files = files.sort.map { |file| file[1] }
files.each do |file|
rena = file.include? 'Screen Shot'
dchk = 'temp'
if rena
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+
(function(){
'use strict';
var c = document.getElementById('container');
var start,
move,
end;
c.addEventListener('touchstart', function(e){