Skip to content

Instantly share code, notes, and snippets.

View caillou's full-sized avatar

Pierre Spring caillou

View GitHub Profile
.tree > ul > li > ul > li > ul > li {
@levelPadding: 25px;
padding-left: @levelPadding;
& > ul > li {
margin-left: -@levelPadding;
padding-left: @levelPadding * 2;
& > ul > li {
margin-left: -@levelPadding * 2;
padding-left: @levelPadding * 3;
<!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>
@caillou
caillou / gist:2021918
Created March 12, 2012 13:25
Track mailto, file download and external links using Google Analytics
/*globals pageTracker: true */
(function () {
"use strict";
var delegate, clickCallback, handleLink, track;
// generic delegate function
delegate = function (element, tagName, eventName, callback) {
var eventListener;
@caillou
caillou / gist:1931490
Created February 28, 2012 09:19
Rewrite URLs in Wordpress
<?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:1420463
Created December 1, 2011 22:48
Possible addition to moment.js
// 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:1390151
Created November 23, 2011 22:41
Google's clearQuery code
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();
// 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';
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>
@caillou
caillou / gist:11077724
Created April 19, 2014 08:18
Naturally Aligned
// 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
@caillou
caillou / foo1.coffee
Last active August 29, 2015 13:57
CoffeeScript is mad!
(->
x = ->
foo = false
# If a variable is used after a function definition
# for the first time...
foo = true
)()