Skip to content

Instantly share code, notes, and snippets.

View prcaen's full-sized avatar
😁

Pierrick CAEN prcaen

😁
View GitHub Profile
@prcaen
prcaen / gist:1435422
Created December 5, 2011 21:23
[PHP] - Two digits
private function twoDigits($number)
{
if($number <= 9)
return '0' . $number;
else
return $number;
}
@prcaen
prcaen / gist:1365016
Created November 14, 2011 20:19
[JS] - strrchr
function strrchr (haystack, needle) {
var pos = 0;
if (typeof needle !== 'string')
needle = String.fromCharCode(parseInt(needle, 10));
needle = needle.charAt(0);
pos = haystack.lastIndexOf(needle);
if (pos === -1)
@prcaen
prcaen / html5-file-kickstart.html
Created November 5, 2011 11:02
HTML5 file kickstart
<!DOCTYPE html>
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="lang"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="lang"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="${1:fr}"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<!-- Geo position -->
@prcaen
prcaen / gist:1153708
Created August 18, 2011 09:13
[PHP] - Distinct double in a multi dimensional array
<?php
/**
* Get a distinct multi dimensional array
*
* @param array $array
* array to distinct
* @param string $keySearch
* string key to search double array
* @param boolean $overwrite = false
* boolean to allow values to be overwritten