Skip to content

Instantly share code, notes, and snippets.

View remibreton's full-sized avatar
🤖

Rémi Breton remibreton

🤖
  • Ubisoft
  • Montréal
View GitHub Profile
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); // Outputs "fr", "en", "es", etc...
$str = preg_replace('/([.!?])\s*(\w)/e', "strtoupper('\\1 \\2')", ucfirst(mb_strtolower("this string. it will be. PROCESSED!", "utf-8")));
<!--[if lte IE 8]> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <![endif]-->
<!--[if gt IE 8]> <!--> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <!--<![endif]-->
<script>window.jQuery || document.write('<script src="js/libs/jquery.1.10.1.min.js"><\/script>');</script>
<FilesMatch ".(eot|ttf|otf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 144dpi),
(min-resolution: 1.5dppx) {
// CSS
}
<!--[if lte IE 8]> <link rel="stylesheet" href="css/libs/normalize.1.1.2.min.css"> <![endif]-->
<!--[if gt IE 8]> <!--> <link rel="stylesheet" href="css/libs/normalize.2.1.2.min.css"> <!--<![endif]-->
var h = (function(b, d){
return Math.max(b.scrollHeight, b.offsetHeight, d.clientHeight, d.scrollHeight, d.offsetHeight);
})(document.body, document.documentElement);
@remibreton
remibreton / HTML: Mobile first stylesheets
Created August 13, 2013 15:23
Warning: more HTTP requests over file size is usually not a good solution http://stackoverflow.com/questions/9855545/http-requests-vs-file-size
<link rel="stylesheet" href="style.css" media="all">
<link rel="stylesheet" href="style.tablet.css" media="all and (min-width: 570px)">
<link rel="stylesheet" href="style.desktop.css" media="all and (min-width: 960px)">
<!--[if (lt IE 9) & (!IEMobile)]>
<link rel="stylesheet" href="style.tablet.css" media="all">
<link rel="stylesheet" href="style.desktop.css" media="all">
<![endif]-->
function addClass(element, cls){
if(typeof element.classList !== "undefined"){
element.classList.add(cls);
} else {
element.className += element.className.indexOf(cls) == -1 ? cls : ' ' + cls;
}
return element;
}
function removeClass(element, cls){
if(typeof element.classList !== "undefined"){
element.classList.remove(cls);
return element;
} else {
if(element.className.indexOf(cls) != -1){
element.className = element.className.replace(cls, '');
}
return element;
}