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 / index.html
Created September 19, 2011 09:07
CSS3 inset text-shadow trick
<h1 class="inset-text">Inset text-shadow trick</h1>
@Victa
Victa / gist:1152681
Created August 17, 2011 21:25
iPhone Calling and Texting Links
<a href="tel:1-408-555-5555">1-408-555-5555</a>
<a href="sms:1-408-555-1212">New SMS Message</a>
@Victa
Victa / gist:2169221
Created March 23, 2012 10:08
Force Hardware Acceleration in WebKit with translate3d
/* warp speed ahead */
.animClass {
-webkit-transform: translate3d(0, 0, 0);
/* more specific animation properties here */
}
/*
The use of translate3d pushes CSS animations into hardware acceleration.
Even if you're looking to do a basic 2d translation, use translate3d for more power!
If your animation is still flickering after switching to the transform above,
@Victa
Victa / gist:1209370
Created September 11, 2011 09:13
Font sizing with REM and PX (LESS)
// ABOUT
A simple LESS (http://lesscss.org) snippet based on http://snook.ca/archives/html_and_css/font-size-with-rem
It doesn't do much but saves you typing things twice, allowing you to use rem as a unit for font-sizes
and giving a px fallback for IE
// MIXIN
.font-size(@font-size: 16){
@rem: (@font-size / 10);
font-size: @font-size * 1px;
font-size: ~"@{rem}rem";
@Victa
Victa / gist:1485536
Created December 16, 2011 10:29
My Textmate 2 .tm_properties
# Basic Settings
#
fontName = "Monaco"
fontSize = 12
# Extra files to include
#
myExtraIncludes = ".tm_properties,.htaccess,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
include = "{$include,$myExtraIncludes}"
@Victa
Victa / Years between two dates
Created August 30, 2012 07:30 — forked from banksy89/Years between two dates
Get the number of years between two dates using PHP DateTime class
// My Birthday :)
$date_1 = new DateTime( '1989-06-15' );
// Todays date
$date_2 = new DateTime( date( 'Y-m-d' ) );
$difference = $date_2->diff( $date_1 );
// Echo the as string to display in browser for testing
echo (string)$difference->y;
@Victa
Victa / gist:3937605
Created October 23, 2012 08:19
is_email JavaScript
function is_email(id){return (/^([\w!.%+\-\*])+@([\w\-])+(?:\.[\w\-]+)+$/).test(id);}
@Victa
Victa / i.html
Created December 8, 2011 09:38
Scrollbar Annotation (path)
<div id="scrollbubble"></div>
<div style="height: 2000px">
<p>Scroll<br />down<br />↓ ↓ ↓</p>
</div>
@Victa
Victa / gist:1539485
Created December 30, 2011 11:50
jQuery .nextOrFirst()
$.fn.nextOrFirst = function(selector){
var next = this.next(selector);
return (next.length) ? next : this.prevAll(selector).last();
};
$.fn.prevOrLast = function(selector){
var prev = this.prev(selector);
return (prev.length) ? prev : this.nextAll(selector).last();
};
@Victa
Victa / gist:1569879
Created January 6, 2012 09:37
Async Script Loader with Callback
var Loader = function () { }
Loader.prototype = {
require: function (scripts, callback) {
this.loadCount = 0;
this.totalRequired = scripts.length;
this.callback = callback;
for (var i = 0; i < scripts.length; i++) {
this.writeScript(scripts[i]);
}