Skip to content

Instantly share code, notes, and snippets.

Avatar

Pierre Spring caillou

View GitHub Profile
View iOS-7-web-app.html
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
@caillou
caillou / foo1.coffee
Last active Aug 29, 2015
CoffeeScript is mad!
View foo1.coffee
(->
x = ->
foo = false
# If a variable is used after a function definition
# for the first time...
foo = true
)()
@caillou
caillou / gist:11077724
Created Apr 19, 2014
Naturally Aligned
View gist:11077724
// I love the fact that my code aligns perfectly due to the fact that ...
console.log('top|bottom'.length === 'left|right'.length);
// ... returns true.
$overlay.data('region', region)
.css({
top: (region === 'bottom') ? '50%' : 0,
bottom: (region === 'top') ? '50%' : 0,
left: (region === 'right') ? '50%' : 0,
right: (region === 'left') ? '50%' : 0
View gist:575956b159a1f00e6a84
npm ERR! tar.unpack untar error /var/folders/j3/46mh29p162z7mq5s33x1k7xh0000gn/T/npm-31264-74dEmpCn/registry.npmjs.org/hawk/-/hawk-1.0.0.tgz
npm WARN optional dep failed, continuing hawk@https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz
npm WARN optional dep failed, continuing hawk@https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz
npm WARN optional dep failed, continuing hawk@https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz
npm ERR! Error: ENOENT, lstat '/Users/caillou/Projects/unic/cs-gulp/node_modules/bower/node_modules/request/node_modules/node-uuid/uuid.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
View simple sequencer
// https://github.com/caillou/motion-synth
// If you have a computer, open the
// dev tools and type this:
ctx = new AudioContext();
osc = ctx.createOscillator();
// Try 'triange', 'sawtooth', 'sine'
osc.type = 'square';
@caillou
caillou / gist:1390151
Created Nov 23, 2011
Google's clearQuery code
View gist:1390151
gh.addEventListener("mousedown", function(a) {
a.preventDefault();
S.value = "";
S.value = S.value; // hrhrhr...
if (T)
jh.innerText = T.innerText = ""; // hrhrhr...
yg++;
vg = ug = 0;
S.focus(); // interesting. it really has no effect.
zh();
@caillou
caillou / gist:1420463
Created Dec 1, 2011
Possible addition to moment.js
View gist:1420463
// We assume it's Friday, December 2nd, 2 PM
// This could be interesting for a listing of events in a calendar.
// Two Questions:
// 1. How would you call the function?
// 2. What would you return for the dates in 1 and 2 weeks?
moment().xxx() // "Today at 2 PM"
moment().add('hours', 1).xxx() // "Today at 3 PM"
@caillou
caillou / gist:1931490
Created Feb 28, 2012
Rewrite URLs in Wordpress
View gist:1931490
<?php
/*
Plugin Name: ReWrite
Plugin URI: http://nelm.io/
Description: A Plugin to ReWrite URLs.
Version: 0.1
Author: Pierre Spring
Author URI: http://nelm.io/pierre
License: GPL2
*/
@caillou
caillou / gist:2021918
Created Mar 12, 2012
Track mailto, file download and external links using Google Analytics
View gist:2021918
/*globals pageTracker: true */
(function () {
"use strict";
var delegate, clickCallback, handleLink, track;
// generic delegate function
delegate = function (element, tagName, eventName, callback) {
var eventListener;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
path {
fill: none;
stroke: black;
}
</style>