Skip to content

Instantly share code, notes, and snippets.

View yoanmarchal's full-sized avatar
💭
I may be slow to respond.

Marchal yoan yoanmarchal

💭
I may be slow to respond.
View GitHub Profile
function get_client_language($availableLanguages, $default='en'){
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langs=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ($langs as $value){
$choice=substr($value,0,2);
if(in_array($choice, $availableLanguages)){
return $choice;
}
}
@yoanmarchal
yoanmarchal / gist:9669376
Created March 20, 2014 17:34
Best order for rendering @font-face in chrome
@font-face {
font-family: 'Rockwell';
src: local('Rockwell'),url('../fonts/rockwellstd-condensed.ttf') format('truetype'),
url('../fonts/rockwellstd-condensed.svg#RockwellStdCondensed') format('svg');
src: url('rockwellstd-condensed.eot');
src: url('rockwellstd-condensed.eot') format('embedded-opentype'),
url('../fonts/rockwellstd-condensed.woff') format('woff');
font-weight: normal;
font-style: normal;
}
<?php
/**
* Using transients on a single loop inside WordPress
*
* @link http://speckyboy.com/2011/12/14/website-speed-part-3-caching-wordpress/
**/
$loop = get_transient( 'loop' );
if ( false === $loop ) {
// Show the last 100 tweets from the custom post type tweets.
@yoanmarchal
yoanmarchal / dabblet.css
Created August 1, 2014 14:29
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body{
background: #f06;
background: linear-gradient(45deg, #333, #222);
min-height: 100%;
}
.loader{
height:100px;
@yoanmarchal
yoanmarchal / dabblet.css
Created August 1, 2014 14:29
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body{
background: #f06;
background: linear-gradient(45deg, #333, #222);
min-height: 100%;
margin:100px;
}
.loader{
@yoanmarchal
yoanmarchal / dabblet.css
Created September 13, 2014 21:03
Styles go here
/* Styles go here */
body{
padding:20px;
}
.loader, .loader:before, .loader:after{
background-color:transparent;
background-image: linear-gradient(transparent 50%, rgba(0,0,0,.2) 50%);
background-size:40px, 40px;
background-position: center center;
-webkit-animation: movebg 1s linear inifite, spin 2s linear infinite;
@yoanmarchal
yoanmarchal / dabblet.css
Last active August 29, 2015 14:06
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body{
background: #f06;
background: #333;
min-height: 100%;
-webkit-perspective: 800;
perspective: 800;
font-size:20pt;
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
$background-color: #fff ;
$link-color: #333 ;
$link-color-active: #55abad ;
$link-underline-width: 1px ;
$link-underline-offset: 2px ;
@function link-total($link-underline-width, $link-underline-offset){
@return $link-underline-width + $link-underline-offset
}
@yoanmarchal
yoanmarchal / mixin-font-face
Created May 30, 2015 14:56
Mix in font face Less
@mixin font-face($font-family, $file-path, $font-weight, $font-style) {
@font-face {
font-family: $font-family;
src: url('#{$file-path}.eot');
src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
url('#{$file-path}.woff') format('woff'),
url('#{$file-path}.ttf') format('truetype'),
url('#{$file-path}.svg##{$font-family}') format('svg');
font-weight: $font-weight;
font-style: $font-style;