Skip to content

Instantly share code, notes, and snippets.

@bchhun
bchhun / index.html
Created May 10, 2011 17:13
Lien de retour sans javascript
<a href="..">lien de retour</a>
@bchhun
bchhun / gist:1004199
Created June 2, 2011 10:02
Group a list into chunks in Python WITHOUT removing smaller chunks
# source: http://countergram.com/python-group-iterator-list-function
def group_iter(iterator, n=2, strict=False):
""" Transforms a sequence of values into a sequence of n-tuples.
e.g. [1, 2, 3, 4, 5] => [(1, 2), (3, 4), (5,)] (when n == 2)
If strict, then it will raise ValueError if there is a group of fewer
than n items at the end of the sequence. """
accumulator = []
for item in iterator:
accumulator.append(item)
@bchhun
bchhun / gist:1004490
Created June 2, 2011 13:58
lessCSS love
/* LessCSS Variables */
@padding-left: 10px;
@padding-right: 15px;
@padding-top:48px;
@padding-bottom:11px;
@width: 328px;
@height: 113px;
/* the magic happens here */
@bchhun
bchhun / gist:1022476
Created June 13, 2011 08:42
Leading commas VS trailing commas
/* ugly */
a_trailing_commas_list = [
"foo",
"bar",
"foo",
"bar"
];
/* godly */
a_leading_commas_list = [
@bchhun
bchhun / index.html
Created June 18, 2011 09:42
Sticky footer html base
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hôtel des commandants</title>
<link rel="stylesheet" href="css/main.css" media="screen" />
<link rel="stylesheet" href="css/print.css" media="print" />
<!--[if IE 8]>
<link rel="stylesheet" href="css/ie8.css" media="screen" />
<div class="more">
<p><p/> <!-- provenant de ckeditor -->
</div>
class foo {};
$obj = new foo();
$property_name = 'a_unstoppable_property';
$obj->$property_name = "bar";
echo $obj->a_unstoppable_property;
@bchhun
bchhun / index.html
Created October 27, 2011 14:04
Theming jQuery Mobile's Loading Message and customizing its message
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
/* Modifying the loading message before jQuery Mobile kicks in */
$(document).bind("mobileinit", function(){
$.extend($.mobile, {
loadingMessage: "Chargement en cours..."
});
});
@bchhun
bchhun / style.less
Created November 22, 2011 21:33
1, 2 or 3 ?
#foo {
.bar {color:#000;}
.ow { color:red;
.fou {color:#fff;}
}
}
productListDataTable.Rows.Add(RelevanceMoy, product.ID, product.ProductName, productType.Type, product.EffectiveArea, (product.Pmax != null) ? (new Measure(product.Pmax.ToString(), "W")).ToString() : "-1", (product.Emax__1064_nm_ != null) ? (new Measure(product.Emax__1064_nm_.ToString(), "J")).ToString() : "-1", (product.Emax__1064_nm_ != null) ? (new Measure(product.Emax__1064_nm_.ToString(), "J")).ToString() : "-1", ReturnConvection((bool)product.Conv__S__H__L_, (bool)product.Fan__F_, (bool)product.Water__W_), product.Head___Display, product.Head___PC, product.All_in_one, product.Conv__S__H__L_, product.Fan__F_, product.Water__W_, product.E_Pulse, product.Avg_Power, product.E_Pulse_SS, (product.UrlProduitHtml == null) ? "#" : product.UrlProduitHtml.ToString(), (product.UrlProduitPdf == null) ? "#" : product.UrlProduitPdf.ToString(), product.TypeText, product.Size__mm_, product.Shape);