Skip to content

Instantly share code, notes, and snippets.

View dandv's full-sized avatar
🔍
Weaviate

Dan Dascalescu dandv

🔍
Weaviate
View GitHub Profile
@ejain
ejain / emfitqs.py
Created January 31, 2017 22:00
Retrieves sleep presence records from Emfit QS, and merges the records into a single spreadsheet.
import io, re, requests, sys, time, zipfile
def get_device(token):
r = get("/api/v1/user/get", token)
device = r.json()["user"]["devices"]
print("Device: " + device, file = sys.stderr)
return device
def list_presences(token, device):
r = get("/v4/presence/{0}/latest".format(device), token)
@nitely
nitely / nm-resume.service
Created October 23, 2015 00:14
Ubuntu +15.04 systemd restart network after resume
# sudo nano /lib/systemd/system/nm-resume.service
# sudo systemctl enable nm-resume.service
[Unit]
Description=Restart NetworkManager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
ExecStart=/bin/systemctl --no-block restart NetworkManager.service
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
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