Tom Leo's Blog

Home    Ask me anything   

Hacker with a Computer Science Degree

July 16, 2014 at 8:15pm
0 notes

Learn SVG or face the wrath of Dmitry Baranovskiy

July 6, 2014 at 12:55pm
0 notes

Shout out to Alan Kay and the team at Xerox for creating the GUI which is almost unchanged since its inception in 1982.

July 3, 2014 at 10:54pm
0 notes

Webpage Rendering →

this piece of code will only trigger one reflow and repaint:

var $body = $('body');
$body.css('padding', '1px'); // reflow, repaint
$body.css('color', 'red'); // repaint
$body.css('margin', '2px'); // reflow, repaint
// only 1 reflow and repaint will actually happen
However, as mentioned above, accessing an element property triggers a forced reflow. This will happen if we add an extra line that reads an element property to the previous block:

var $body = $('body');
$body.css('padding', '1px');
$body.css('padding'); // reading a property, a forced reflow
$body.css('color', 'red');
$body.css('margin', '2px');
As a result, we get 2 reflows instead of one. Because of this, you should group reading element properties together to optimize performance.

June 25, 2014 at 6:13pm
0 notes

adding 'rebeccapurple' color to CSS Color Level 4 →

This is really cool.

June 12, 2014 at 6:20pm
0 notes

fengsp/plan →

This is a python utility that makes provides an API for generating cron jobs or outputting a crontab syntax to insert yourself.

I think the cron job syntax is very stupid and easy to mess up, I hope this utility will help with that.

June 4, 2014 at 5:06pm
0 notes

How to merge two git commits into one? →

$ git rebase --abort
$ git log --pretty=oneline
a931ac7c808e2471b22b5bd20f0cad046b1c5d0d c
b76d157d507e819d7511132bdb5a80dd421d854f b
df239176e1a2ffac927d8b496ea00d5488481db5 a
$ git rebase --interactive HEAD~2
Then in the editor
pick b76d157 b
s a931ac7 c

May 23, 2014 at 9:50am
0 notes

First npm package

Just published my first npm package, it’s a yeoman generator for getting started quickly with mock-ups.


May 9, 2014 at 4:13pm
0 notes

Interesting solutions when dealing with timezone aware applications

May 5, 2014 at 2:52pm
0 notes

First dj pull request →

First pull-request merged into Django woot woot

April 24, 2014 at 10:13am
0 notes

Python Scope

Some basic scoping examples in python

The result should be

1. foo test
in-place addition is actually performing a new binding to the name x

2. foo test - nonlocal

3. kwarg inital values gotcha
[1, 1]
[1, 1, 1]