Skip to content

Instantly share code, notes, and snippets.

View bpierre's full-sized avatar
✌️

Pierre Bertet bpierre

✌️
View GitHub Profile
@bpierre
bpierre / index.html
Created September 26, 2012 23:49
Mini clock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Clock demo</title>
<style>
svg {
display: block;
position: absolute;
left: 50%;
@bpierre
bpierre / eternal-ff.txt
Created September 21, 2012 11:03
My Twitter followings
@BKcore
@codylindley
@KerbalSpaceP
@GilbertWehrle
@dlctbl
@FREE_FACTS
@tabatkins
@marijnjh
@rocket2guns
@stripe
@bpierre
bpierre / parseurl.js
Created September 5, 2012 23:40
ParseURL
/*
ParseURL by James Padolsey: http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
*/
// This function creates a new anchor element and uses location
// properties (inherent) to get the desired URL data. Some String
// operations are used (to normalize results across browsers).
function parseURL(url) {
var a = document.createElement('a');
@bpierre
bpierre / index.html
Created August 23, 2012 13:37
Mini Slider: zero dependencies, IE8+.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mini slider</title>
<link rel="stylesheet" href="mini-slider.css">
</head>
<body>
<div id="slider">
<!-- The previous button is inserted here -->
@bpierre
bpierre / anchor-select.js
Created May 8, 2012 14:48
CSS Selectors anchors: /mypage.html#anchor-select(#content > h1)
(function(window) {
function getSelector(hash) {
var matches;
hash = hash.slice(1);
matches = hash.match(/^anchor-select\((.+)\)$/);
if (matches) {
return decodeURIComponent(matches[1]);
}
return false;
@bpierre
bpierre / gist:2603011
Created May 5, 2012 14:45
hasOwnProperty style
var obj = {
foo: 1,
bar: 2
};
Object.prototype.oops = function(){};
// Meh.
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
@bpierre
bpierre / documentup-bookmarklet.js
Created May 1, 2012 16:01
Switch between documentup.com and github.com
// javascript:(function(){var%20w%20=%20window,h%20=%20w.location.host,p%20=%20w.location.pathname,r%20=%20p.match(/^(\/[^\/]+\/[^\/]+)/),gh%20=%20%27github.com%27,du%20=%20%27documentup.com%27;if%20(r%20&&%20h%20==%20gh)%20{w.location%20=%20%27http://%27%20+%20du%20+%20r[1];}%20else%20if%20(r%20&&%20h%20==%20du)%20{w.location%20=%20%27https://%27%20+%20gh%20+%20r[1];}})();
(function(){
var w = window,
h = w.location.host,
p = w.location.pathname,
r = p.match(/^(\/[^\/]+\/[^\/]+)/),
gh = 'github.com',
du = 'documentup.com';
if (r && h == gh) {
@bpierre
bpierre / mini-lightbox.js
Created November 6, 2011 00:08
A mini lightbox (jQuery)
/* A small script to display lightboxes. No IE6 support. */
/*global jQuery: false*/
(function($, window){
"use strict";
$.miniLightbox = {};
var EVENT_NS = 'minilightbox';
var DEFAULT_SETTINGS = {
'class': '',
@bpierre
bpierre / Makefile
Created November 5, 2011 17:34
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
@bpierre
bpierre / Makefile
Created November 5, 2011 03:18 — forked from abackstrom/Makefile
CSS and JavaScript Minification/Compression Makefile
#
# css/js minification/compression makefile
#
#
# JS_TARGETS -- js files to minify/gzip
# CSS_TARGETS -- css files to minify/gzip
# CLEANUP -- additional files to delete during "make clean"
#