Skip to content

Instantly share code, notes, and snippets.

View gbonanome's full-sized avatar
🦄

Giulio Bonanome gbonanome

🦄
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@gbonanome
gbonanome / pre-commit
Last active December 28, 2015 19:08
Pre-commit hook to make tasks like: run composer, bower, grunt (less, requirejs). Add everything. And so commit.
#!/bin/bash
### Check the DIR
DIR=$(git rev-parse --show-toplevel)
### Composer update
echo "Updating Composer"
if [ -e "$DIR/composer.json" ]; then
if [ -d "$DIR/vendor" ]; then
composer install
@gbonanome
gbonanome / gist:6766255
Last active December 24, 2015 07:49
Better formatting

Removed variables

@black: #000;
@white: #fff;
@blue: #049cdb;
@blueDark: #0064cd;
@green: #46a546;
@red: #9d261d;

@yellow: #ffc40d;

@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@gbonanome
gbonanome / lesscdir
Last active December 15, 2015 16:59
Compile every .less files founded inside a specified folder
#!/bin/bash
# file name: lesscdir
# Compile every .less found under a specified folder
# $1 is the folder to search
# $2 allows to use a lessc parameters for compiling
if [[ -z $1 ]];then
echo 'Specify a directory to search'
exit
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done