Skip to content

Instantly share code, notes, and snippets.

@danielmahal
danielmahal / gist:1205854
Created September 9, 2011 09:46
Copy folder without .svn folders (in svn)
rsync -aC --exclude .svn suggestions addown
@danielmahal
danielmahal / index.html
Created December 9, 2011 12:17
Testing sample
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Sample</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
@danielmahal
danielmahal / gist:2021037
Created March 12, 2012 10:13
Async template loading
// TODO: Better caching. If there are two template requests at the same time, they will both do a get request.
var templateCache = {};
var template = function(name, callback) {
var template = templateCache[name];
if(!template) {
$.get('templates/' + name + '.html').success(function(data) {
template = templateCache[name] = _.template(data);
callback(template);
@danielmahal
danielmahal / gist:2643602
Created May 9, 2012 10:27
Tap/Click override
if(Modernizr.touch) {
$.event.special.click = {
tapThreshold: 750,
setup: function() {
$(this).on('touchstart', $.event.special.click.touchstart);
},
teardown: function() {
$(this).off('touchstart', $.event.special.click.touchstart);
@danielmahal
danielmahal / test.js
Created October 28, 2012 17:36
Olav example
var config = {
url: 'http://...'
};
var loadXML = function(url) {
}
var getXML = (function() {
var cache = {};
@danielmahal
danielmahal / gist:4071840
Created November 14, 2012 12:31
Prevent page reload
$(window).on('beforeunload', function() {
return 'Sure you want to leave?';
});
#!/usr/bin/env node
var browserify = require('browserify'),
underscore = require('underscore'),
markdown = require('node-markdown').Markdown;
var bundle = browserify({
debug: false
});
float x = 0;
float y = 0;
void setup() {
size(500, 500);
}
void draw() {
background(0);
x += (mouseX - x) * 0.05;
<html>
<head>
<style>
.box {
width: 200px;
height: 200px;
background: blue;
transition: -webkit-transform 100ms linear;
}
<html>
<head>
<style>
.box {
width: 200px;
height: 200px;
background: blue;
transition: -webkit-transform 500ms linear;
}