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
@Victa
Victa / gist:3979257
Created October 30, 2012 09:35
Add Javascript String.trim() Support for Older Browsers
String.prototype.trim = typeof (String.prototype.trim) != "undefined" ?
String.prototype.trim :
function() { return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); };
@Victa
Victa / async.js
Created September 5, 2012 08:34
Asynchronous Script Loading
function asyncLoad(scriptURL,callback)
{
if(!scriptURL){return;}
var firstScriptTag=document.getElementsByTagName('script')[0];
var js=document.createElement('script');
js.type='text/javascript';
js.src=scriptURL;
js.async=true;
if(callback && typeof(callback)===typeof(Function))
@Victa
Victa / retina.css
Created August 24, 2012 14:43 — forked from maximevalette/retina.css
Capturer les écrans Retina avec une media query
@media
only screen and (-webkit-min-device-pixel-ratio: 1.3),
only screen and (min-device-pixel-ratio: 1.3),
only screen and (min-resolution: 120dpi) {
/* Votre code ici pour les écrans Retina */
}
@Victa
Victa / keys.json
Created August 22, 2012 12:04
My Sublime Text 2 config
[
{ "keys": ["ctrl+s"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+i"], "command": "toggle_setting", "args": {"setting": "gutter"} }
]
@Victa
Victa / gist:3313052
Created August 10, 2012 09:46
Sass Button Mixin - Inspired by Bourbon button mixin
/*------------------------------------*\
Auto Button Mixin
\*------------------------------------*/
@mixin button( $base-color: #f9f9f9,
$radius: 4px,
$bold: true,
$drop-shadow: true,
$padding: '.5em 1.5em'){
@Victa
Victa / dabblet.css
Created July 13, 2012 09:57
Checkbox Custom Style
/* Checkbox Custom Style
* ========================
* Courtesy of ??? (I don't remember who showed me this trick)
* @_victa
*/
/* Old Skool Reset */
*{margin:0;padding:0}
html,body{height:100%}
body{
@Victa
Victa / dabblet.css
Created July 11, 2012 16:54
Pure CSS Icons (Folder/File)
/* Pure CSS Icons (Folder/File) */
body{text-align:center;background:#eff3f6;margin:2em;}
i{display:inline-block;position:relative;margin:0 .1em;}
i::before{content:"";position:absolute;display:block;}
.folder{
width:14px;
height:10px;
background-image:linear-gradient(#a7c3d9, #709fc2);
box-shadow:inset 0 1px 0 #c6d9e7, 0 1px 0 #bbbfc3;
@Victa
Victa / gist:2984645
Created June 24, 2012 19:43
<i> Cloud
/* <i> Cloud */
html {
min-height: 100%;
background: linear-gradient(#b4bcbf, #fff);
}
.cloud {
display: inline-block;
background-color: #fff;
@Victa
Victa / gist:2894433
Created June 8, 2012 08:17
addEventListner Polyfill
// addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}
@Victa
Victa / gist:2876160
Created June 5, 2012 16:44
conditional resource loading
yepnope({
test : window.matchMedia("(max-device-width: 640px)").matches,
yep : "",
nope : "slider.js"
});