Skip to content

Instantly share code, notes, and snippets.

View tipiirai's full-sized avatar

Tero Piirainen tipiirai

View GitHub Profile
@tipiirai
tipiirai / gist:a1f2d1f203de0b5f45a1
Created July 2, 2014 02:12
Riot.js full router
(function() {
var routes = [];
function on(route, fn) {
var keys = ['match'];
route = route.replace(/[\/\=\?\$\^]/g, '\\$&').replace(/\{(\w+)\}/g, function(match, key) {
keys.push(key);
return '(\\w+)';
});
@tipiirai
tipiirai / gist:4544584
Created January 16, 2013 04:13
jQuery.browser for v1.9+
/*
jQuery.browser for 1.9+
We all love feature detection but that's sometimes not enough.
@author Tero Piirainen
*/
!function($) {
if (!$.browser) {
@tipiirai
tipiirai / gist:783992
Last active September 24, 2015 17:37
The most minimal draggable
var draggable
// disable IE specialities
document.ondragstart = function () { return false }
// bound dragging into document
var doc = $(document).bind("mousedown mouseup", function(e) {
var el = $(e.target)
@tipiirai
tipiirai / another.js
Created November 5, 2010 20:22
working with gists
// foo
var bar = "baz";