Skip to content

Instantly share code, notes, and snippets.

View Lucent's full-sized avatar

Michael Dayah Lucent

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active May 26, 2024 09:59
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
@mbostock
mbostock / .block
Last active August 7, 2020 22:45
D3 Custom Bundle
license: gpl-3.0

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@panzi
panzi / gist:7551381
Created November 19, 2013 19:49
Download currently playing HTML5 audio/video bookmarklet.
Create a new bookmark and set it's URL to this:
javascript:(function(xs)%7Bfor(var%20i%3D0%3Bi%3Cxs.length%3B%2B%2Bi)%7Bif(xs%5Bi%5D.currentSrc)%7Breturn%20window.open(xs%5Bi%5D.currentSrc)%3B%7D%7D%7D)(document.querySelectorAll('audio%2Cvideo'))%3B
When media is playing using HTML5 audio/video you can click this bookmark to open a new tab/window with the media. Then to download it use the context menu action "Save As..." (right mouse button -> Save As...).
If you use Chrome/Safari/recent Opera (WebKit/Blink) you can do better(!) and immediately download the file using this bookmarklet instead:
javascript:(function(xs)%7Bfor(var%20i%3D0%3Bi%3Cxs.length%3B%2B%2Bi)%7Bif(xs%5Bi%5D.currentSrc)%7Bvar%20a%3Ddocument.createElement('a')%3Ba.target%3D'_blank'%3Ba.download%3D''%3Ba.href%3Dxs%5Bi%5D.currentSrc%3Ba.click()%3Breturn%3B%7D%7D%7D)(document.querySelectorAll('audio%2Cvideo'))%3B
@freshlogic
freshlogic / app.js
Last active July 8, 2019 18:53
Check an area code for available Google Voice numbers and post the results to Campfire
var Campfire = require('campfire').Campfire;
var request = require('request');
var areaCode = 972;
var campfire = new Campfire({ ssl: true, token: 'YOUR CAMPFIRE API TOKEN HERE', account: 'YOUR CAMPFIRE SUBDOMAIN NAME HERE' });
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' };
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US';
request.get({ url: url, headers: headers }, function(error, response, body) {
var json = JSON.parse(body);
ALL OREAND THE GIFCHERRY BUSH DA BOON CHASED DA WHEASELGIFPASTECLITNUGGET SHIT
WH0A WHUT W00D PEEPUHL THEEENK IF DAY GN00 EYE WUZ A JEEEZUS FREEEK?!
EYE WENT TO THE TRAK TO WAATCH THE PONYNUGGETS RHUN AROUND THE GIFPASTE
MY MOM HAS A GARDUN WAREZ SHE GROZE KUMKUWAITS
THERE'S AN ASSNUGGET 4 ALL YA JEWS AND HOMERSEXULES
A DIQ IZ FER DISPENISING JIZZJ00CE IN DA CLITSAQ JIZZPOQIT
NO WAY JAQNAD, EYE GOT ENOUGH OF DEM SHITSTAYN THINGYS FOR GNO MHORE
EYE WHISH I COULD LIFT H’VY TINGS LYKE DOZE GUIZ ON TEEVHEE
AOL E_MAILWAREZ IS 2 31337 FOR THE CLITSAQLIKES OFF MIZZEE
SIMPSONS WIN95 THEME R0X! THOT I'D LET Y'ALL KNOW