Skip to content

Instantly share code, notes, and snippets.

View eoghanmurray's full-sized avatar

Eoghan Murray eoghanmurray

View GitHub Profile
@mdellavo
mdellavo / gtfs.py
Created March 22, 2012 15:37
SQLAlchemy GTFS Models
from sqlalchemy import create_engine, Column, Integer, String, DateTime, \
Boolean, Unicode, Numeric as _Numeric, Date, Time, ForeignKey, Table, and_, \
create_engine
from sqlalchemy.orm import sessionmaker, scoped_session, relation, class_mapper
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.orm.properties import ColumnProperty, RelationshipProperty
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.types import TypeDecorator
@epicserve
epicserve / redis_key_sizes.sh
Last active June 29, 2024 03:41
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@paulirish
paulirish / what-forces-layout.md
Last active July 5, 2024 08:26
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