Skip to content

Instantly share code, notes, and snippets.

View p7g's full-sized avatar

Patrick Gingras p7g

View GitHub Profile
@grantjenks
grantjenks / xml_rpc_client_unix_domain_socket.py
Created October 22, 2019 03:42
Python 3 XML-RPC Using Unix Domain Sockets
import http.client
import socket
import xmlrpc.client
class UnixStreamHTTPConnection(http.client.HTTPConnection):
def connect(self):
self.sock = socket.socket(
socket.AF_UNIX, socket.SOCK_STREAM
)
@cyrilzakka
cyrilzakka / ContentView.swift
Created July 26, 2019 21:03
Simple Image Viewer using SwiftUI
//
// ContentView.swift
// Scribe
//
// Created by Cyril Zakka on 7/21/19.
// Copyright © 2019 Cyril Zakka. All rights reserved.
//
import SwiftUI
struct ContentView: View {
@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
@ahendrix
ahendrix / gist:7030300
Created October 17, 2013 18:56
bash stacktrace
function errexit() {
local err=$?
set +o xtrace
local code="${1:-1}"
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
then
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))