Skip to content

Instantly share code, notes, and snippets.

View dmao's full-sized avatar

Didier Mahaux dmao

View GitHub Profile
@dmao
dmao / previous directory
Created June 11, 2013 10:25
Go to previous directory
cd -
@dmao
dmao / google-analytics
Created June 12, 2013 11:01
google-analytics asynchrone
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
@dmao
dmao / complement-colour
Created June 12, 2013 11:21
Complement coulour in Sass
.complement {
background-color: complement($bf-orange);
}
@dmao
dmao / .bash_profile
Created June 18, 2013 10:47
my .bash_profile
## use the Mamp version of php
export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:$PATH
## Alias
alias compass-prod='compass compile --output-style compressed --force'
alias ..='cd ..'
alias l="ls -al"
alias ?='pwd'
alias web='cd /Applications/MAMP/htdocs'
@dmao
dmao / ligature
Created June 19, 2013 10:03
Activate ligature
h1 {
-moz-font-feature-settings: "liga=1, dlig=1";
-ms-font-feature-settings: "liga", "dlig";
-webkit-font-feature-settings: "liga", "dlig";
-o-font-feature-settings: "liga", "dlig";
font-feature-settings: "liga", "dlig";
}
@dmao
dmao / scale-image
Last active December 18, 2015 17:59
Proportionally scale images that have dimension attributes
// http://www.456bereastreet.com/archive/201306/how_to_proportionally_scale_images_that_have_dimension_attributes/
img {
width:auto; // for IE8
max-width:100%;
height:auto;
}
@dmao
dmao / custom.js
Created August 8, 2013 12:17 — forked from drewjoh/custom.js
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@dmao
dmao / robust-p
Created September 6, 2013 10:08
Paragraph with indentation
p{
margin-bottom:20px;
}
p+p{
text-indent:2em;
margin-top:-20px;
}
@dmao
dmao / wp-rights
Created September 11, 2013 07:52
Give right to wordpress folder in local
sudo chown -R _www wordpress
sudo chmod -R g+w wordpress
@dmao
dmao / what-forces-layout.md
Created September 23, 2015 07:28 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()