Skip to content

Instantly share code, notes, and snippets.

View patriziosotgiu's full-sized avatar

Patrizio Sotgiu patriziosotgiu

View GitHub Profile
@patriziosotgiu
patriziosotgiu / .bash_profile
Last active October 14, 2015 21:12
bash / zsh config, aliases
alias gitr='git'
alias gti='git'
alias got='git'
alias gut='git'
alias gi='git'
alias g='git'
alias gurnt='grunt'
alias gr='grunt'
@patriziosotgiu
patriziosotgiu / .gitconfig
Last active October 14, 2015 21:10
Git Config
[alias]
co = checkout
ci = commit
ca = commit --amend
cia = commit -a
can = commit --amend --no-edit
com = checkout master
st = status
s = status -s
b = branch
@patriziosotgiu
patriziosotgiu / gist:89325b0aa0e32fde207d
Created August 25, 2015 18:44
jQuery - Check when all img and iframe of a div are loaded
// Get height of the block when all elements are loaded
// This fixes some bugs with lazyload in some browsers, and slow connections
var $elements = $('#div').find('img, iframe');
var elementsCount = $elements.length;
var loadedCount = 0;
$elements.on('load', function () {
loadedCount++;
if (loadedCount === elementsCount) {
getSetHeight();
@patriziosotgiu
patriziosotgiu / mixins_sass-scss+less_center
Last active August 29, 2015 14:27
Mixins - Sass/SCSS - Center
// Sass/SCSS
@mixin center($axis: "both") {
position: absolute;
@if $axis == "y" {
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
////////////////////////////////////////////////////////////////////////////////
// PHP - Show single or conditional blocks on url change
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Single
////////////////////////////////////////////////////////////////////////////////
$ads = isset($_GET['ads']) ? $_GET['ads'] : FALSE;
<?php if($ads == 'yes') : ?>