Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️

Pierre Bertet bpierre

✌️
View GitHub Profile
@bpierre
bpierre / eternal-ff.txt
Created Sep 21, 2012
My Twitter followings
View eternal-ff.txt
@BKcore
@codylindley
@KerbalSpaceP
@GilbertWehrle
@dlctbl
@FREE_FACTS
@tabatkins
@marijnjh
@rocket2guns
@stripe
View parseurl.js
/*
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 Aug 23, 2012
Mini Slider: zero dependencies, IE8+.
View index.html
<!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
CSS Selectors anchors: /mypage.html#anchor-select(#content > h1)
View anchor-select.js
(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
hasOwnProperty style
View gist:2603011
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
Switch between documentup.com and github.com
View documentup-bookmarklet.js
// 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 Nov 6, 2011
A mini lightbox (jQuery)
View mini-lightbox.js
/* 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 Nov 5, 2011
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
View Makefile
# 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 Nov 5, 2011 — forked from abackstrom/Makefile
CSS and JavaScript Minification/Compression Makefile
View 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"
#
@bpierre
bpierre / _init-routes.js
Created Oct 15, 2011
A simple routing function for jQuery history
View _init-routes.js
// Use it with jQuery history: http://tkyk.github.com/jquery-history-plugin/
// Hashes should begin with #!/ (see hash.slice(2) below)
(function($) {
$.history.initRoutes = function (routes) {
$(function() {
$.history.init(function(hash) {
hash = hash.slice(2);
var routeFound = false;
for (var rpath in routes) {
if (routes.hasOwnProperty(rpath)) {