Skip to content

Instantly share code, notes, and snippets.

@campaul
campaul / tarnish.rs
Created December 11, 2015 01:52
Simple HTTP proxy in Rust.
/*
Simple HTTP proxy in Rust. Hard coded to proxy rust-lang.org.
*/
extern crate hyper;
use std::io::Read;
use hyper::Client;
use hyper::header::Connection;
@a1k0n
a1k0n / ylogo.c
Created October 22, 2015 01:02
Expanded version of the code featured in http://www.a1k0n.net/2011/06/26/obfuscated-c-yahoo-logo.html
#include <math.h>
#include <stdio.h>
#include <unistd.h>
// Each character encodes an angle of a plane we are checking
const char plane_angles[] = "O:85!fI,wfO8!yZfO8!f*hXK3&fO;:O;#hP;\"i[";
// and these encode an offset from the origin s.t. (x, y) dot (cos(a), sin(a)) < offset
const char plane_offsets[] = "<[\\]O=IKNAL;KNRbF8EbGEROQ@BSXXtG!#t3!^";
// this table encodes the offsets within the above tables of each polygon
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
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
@ryancdotorg
ryancdotorg / frag32.py
Created August 20, 2015 16:27
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)