Skip to content

Instantly share code, notes, and snippets.

View thierryc's full-sized avatar

Thierry Charbonnel thierryc

View GitHub Profile
@thierryc
thierryc / CSS Mobile First CSS Media Queries in em
Created July 2, 2018 21:37
CSS Mobile First CSS Media Queries in em
/* smartphones, iPhone, portrait 480x320 phones(min-width:320px) */
@media screen and (min-width: 20em) {}
/* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. (min-width:481px) */
@media screen and (min-width: 30.06em) {}
/* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones (min-width:641px) */
@media screen and (min-width: 40.06em) {}
/* tablet, landscape iPad, lo-res laptops ands desktops (min-width:961px) */
@thierryc
thierryc / one-at-a-time.js
Last active May 29, 2021 22:03
Javascript Jenkins's one-at-a-time hash function
// An implementation of Jenkins's one-at-a-time hash
// <http://en.wikipedia.org/wiki/Jenkins_hash_function>
// key: string
// return hex
function oneAtATimeHash(key) {
var hash = 0, i = key.length;
while (i--) {
hash += key.charCodeAt(i);
hash += (hash << 10);
hash ^= (hash >> 6);