Skip to content

Instantly share code, notes, and snippets.

View Victa's full-sized avatar
🏠
Working from home

Victor Coulon Victa

🏠
Working from home
View GitHub Profile
/**
* jQuery.preload
*
* Preload images using the promise pattern.
*
* Usage:
*
* $.preload(img_uri, img_uri, ...).done(function(img, img, ...) {
* // Do stuff with the arguments
* });
@Victa
Victa / script.js
Created February 6, 2013 15:22
# Basic example of an infinite touch carousel By @bdc (open it on any iOS device) http://sharedfil.es/ios-carousel-3DWDjXht64.html https://twitter.com/bdc/status/299161246031298562
var deviceWidth = document.width,
gallery = document.createElement("section"),
numberOfPages = 3,
positions = {
startX: 0,
currentX: 0,
direction: null,
upcomingPage: null
},
touchEvents = {
@Victa
Victa / gist:4464100
Created January 5, 2013 22:40
Strip Whitespace From String
// Remove leading and trailing whitespace
// Requires jQuery
var str = " a b c d e f g ";
var newStr = $.trim(str);
// "a b c d e f g"
// Remove leading and trailing whitespace
// JavaScript RegEx
var str = " a b c d e f g ";
var newStr = str.replace(/(^\s+|\s+$)/g,'');
@Victa
Victa / gist:4442341
Created January 3, 2013 09:59
Lighten / Darken Color
function LightenDarkenColor(col, amt) {
var usePound = false;
if (col[0] == "#") {
col = col.slice(1);
usePound = true;
}
var num = parseInt(col,16);
@Victa
Victa / i.html
Created September 2, 2011 08:41
CSS News Ticker
<div id="ticker">
<p><a href="#">Latest News</a></p>
<ul>
<li><a href="#">iPhone 5</a></li>
<li><a href="#">iPad 3</a></li>
<li><a href="#">MacBook Air</a></li>
<li><a href="#">MacBook Pro</a></li>
</ul>
</div>
@Victa
Victa / gist:4234257
Created December 7, 2012 16:07
Showing Git Commit Counts
# Show total number of commits in the current repository
git shortlog | grep -E '^[ ]+\w+' | wc -l
# Show number of commits by developer
git shortlog -s -n
@Victa
Victa / bookmarklet.js
Created November 27, 2012 13:18
Gisties Bookmarklet
void ((function(){
var parser = document.createElement('a');
parser.href = document.URL;
if(parser.host === 'gist.github.com'){
var id = parser.pathname.split('/').filter(function(e){return e;})[0];
var user = document.querySelector('#owner .name a').innerText;
window.location = 'http://lite.gisti.es/'+user+'/'+id;
}
})());
@Victa
Victa / LICENSE.txt
Created November 21, 2012 20:27 — forked from atk/LICENSE.txt
polyfill an ES5-compatible Array.prototype.indexOf
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alex Kloss <alexthkloss@web.de>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Victa
Victa / index.html
Created November 20, 2012 13:55
140byt.es loading spinner
<body>
<div id="spinner"></div>
</body>​