Skip to content

Instantly share code, notes, and snippets.

View Muqito's full-sized avatar
🦀
Rustacean by heart

Christoffer Lantz Muqito

🦀
Rustacean by heart
View GitHub Profile
@Muqito
Muqito / what-forces-layout.md
Created March 10, 2020 17:08 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@Muqito
Muqito / async await ie11.js
Created May 20, 2020 13:00 — forked from DejanBelic/async await ie11.js
How to use async await in ie11
// Async await func
async function getTimelineData() {
var response = await fetch('/some-api-url')
return response.json()
}
async function populateTimelineInit() {
var data = await getTimelineData();
new vis.DataSet(data);
@Muqito
Muqito / audit-on-push.yml
Created June 6, 2020 21:45 — forked from LukeMathWalker/audit.yml
GitHub Actions - Rust setup
name: Security audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
@Muqito
Muqito / compile-nginx-brotli-modules.sh
Created September 27, 2022 22:46 — forked from jivanpal/compile-nginx-brotli-modules.sh
Compile Brotli modules for Nginx 1.18.0 on Ubuntu 20.04
#!/bin/bash -e
sudo apt install \
curl \
build-essential \
libpcre3-dev \
libssl-dev \
zlib1g-dev \
libxml2-dev \
libxslt1-dev \
@Muqito
Muqito / main.rs
Created January 18, 2024 20:23
reduce heap allocation with mem::take
// ref: https://ferrous-systems.com/blog/rustls-borrow-checker-p1/
#[derive(Debug)]
struct Reader<'a> {
buffer: &'a mut [u8]
}
impl<'a> Reader<'a> {
pub fn new(buffer: &'a mut [u8]) -> Self {
Self {
buffer,
}