Skip to content

Instantly share code, notes, and snippets.

Avatar
🌟
Loading...

Francesco Stella francescostella

🌟
Loading...
View GitHub Profile
@dciccale
dciccale / README.md
Last active May 22, 2018
Cross-browser triggerEvent function done with 127 bytes of JavaScript
View README.md

triggerEvent

Cross-browser function to trigger DOM events.

@utsengar
utsengar / Sync_Async_loading_handlebars.js
Created Apr 2, 2012
synchronous and asynchronous loading of handlebars templates
View Sync_Async_loading_handlebars.js
/*
* This decorates Handlebars.js with the ability to load
* templates from an external source, with light caching.
*
* To render a template, pass a closure that will receive the
* template as a function parameter, eg,
* T.render('templateName', function(t) {
* $('#somediv').html( t() );
* });
* Source: https://github.com/wycats/handlebars.js/issues/82
@jbgo
jbgo / git-recover-branch.md
Last active Nov 8, 2020
How to recover a git branch you accidentally deleted
View git-recover-branch.md

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@paulirish
paulirish / what-forces-layout.md
Last active Nov 27, 2020
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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
You can’t perform that action at this time.