Skip to content

Instantly share code, notes, and snippets.

View BASICjfisher's full-sized avatar

Jacob Fisher BASICjfisher

View GitHub Profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# This loads RVM into a shell session.
server() {
open "http://localhost:${1}" && python -m SimpleHTTPServer $1
}
goodMorning() {
osascript .GoodMorning.scpt
cat .goodmorningtext.txt
@BASICjfisher
BASICjfisher / gist:7762857
Created December 3, 2013 02:25
Liquid Template Demo
<div class="slides">
{% for post in site.categories['news'] %}
{% if post.image %}
<div class="slide" data-title="{{ post.title }}" data-time="{{ post.time }}">
<img src="{{ post.image }}" />
</div>
{% endif %}
{% endfor %}
</div>

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:

Keybase proof

I hereby claim:

  • I am mrjacobfisher on github.
  • I am jcbfshr (https://keybase.io/jcbfshr) on keybase.
  • I have a public key whose fingerprint is 9DF7 76E2 8BEC 1A39 D6E6 C675 6A17 FFD9 4156 FEB1

To claim this, I am signing this object:

({
baseUrl: 'app',
out: 'build/main.js',
optimize: 'uglify2',
name: 'libs/almond',
include: ['main'],
exclude: [],
stubModules: ['cs', 'text'],
@BASICjfisher
BASICjfisher / gist:568f9f2871882c31d847
Last active August 29, 2015 14:14
Native Virtual scroll
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Scroll Test</title>
<style>
* {
var VirtualScroll = function() {
var vs = {};
var numListeners, listeners = [], initialized = false;
var touchStartX, touchStartY;
// [ These settings can be customized with the options() function below ]
postcss --config options.json [-o output-file|-d output-directory] [input-file]
options.json
{
"safe": true,
"autoprefixer": {
"browsers": "> 5%"
},
"postcss-cachify": {