Skip to content

Instantly share code, notes, and snippets.

View samhernandez's full-sized avatar
🎈

Sam Hernandez samhernandez

🎈
  • Precocity LLC
  • Plano TX
  • X @sam_h
View GitHub Profile
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@dsanson
dsanson / any2pandoc.sh
Created August 30, 2011 17:52
any2pandoc.sh: script that tries to convert documents thrown at it to pandoc's extended markdown
#!/bin/sh
# any2pandoc.sh
#
# A shell script that tries its best to convert documents thrown at it
# to pandoc's extended markdown.
#
# https://gist.github.com/1181510
#
# Depends on: