Skip to content

Instantly share code, notes, and snippets.

View jeremychone's full-sized avatar

Jeremy Chone jeremychone

View GitHub Profile
@MightyPork
MightyPork / custom-serde.rs
Created June 11, 2019 20:34
example of custom serialize and deserialize in serde
use serde::ser::SerializeMap;
use serde::{Serialize, Serializer, de::Visitor, de::MapAccess, Deserialize, Deserializer};
use std::fmt;
#[derive(Debug)]
struct Custom(String, u32);
impl Serialize for Custom {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@manrajgrover
manrajgrover / .env.sample
Last active January 29, 2024 12:56
Quick Docker Environment for TensorFlowJS Node
root=/path/to/root
project=/path/to/project
@lattner
lattner / TaskConcurrencyManifesto.md
Last active March 26, 2024 00:33
Swift Concurrency Manifesto
@vladimir-ivanov
vladimir-ivanov / softmax.js
Created June 27, 2016 20:22
softmax function implementation in js
let softmax = (arr) => (index) => Math.exp(arr[index]) / arr.map(y => Math.exp(y)).reduce((a, b) => a + b);
@paulirish
paulirish / what-forces-layout.md
Last active March 28, 2024 11:45
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