Skip to content

Instantly share code, notes, and snippets.

View MBing's full-sized avatar
🍫
Our Dreams Will Break The Boundaries Of Our Fears.

Martin I. Demiddel MBing

🍫
Our Dreams Will Break The Boundaries Of Our Fears.
View GitHub Profile
@sochix
sochix / app.js
Created April 16, 2019 15:48
Proper way to measure request duration in a Node.js + Express application
const app = require('express')()
const getDurationInMilliseconds = (start) => {
const NS_PER_SEC = 1e9
const NS_TO_MS = 1e6
const diff = process.hrtime(start)
return (diff[0] * NS_PER_SEC + diff[1]) / NS_TO_MS
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 23, 2024 03:59
Swift Concurrency Manifesto

Parens And Performance

Years ago, some smart folks that worked on JS engines realized that not all JS that's loaded into a page/app initially is needed right away. They implemented JIT to optimize this situation.

JIT means Just-In-Time, which means essentially that the engine can defer processing (parsing, compiling) certain parts of a JS program until a later time, for example when the function in question is actually needed. This deferral means the engine is freer to spend the important cycles right now on the code that's going to run right now. This is a really good thing for JS performance.

Some time later, some JS engine devs realized that they needed to get some hints from the code as to which functions would run right away, and which ones wouldn't. In technical speak, these hints are called heuristics.

So they realized that one very common pattern for knowing that a function was going to run right away is if the first character before the function keyword was a (, because that usually m

@lopspower
lopspower / README.md
Last active May 23, 2024 07:29
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@olexpono
olexpono / flexbox_workshop.md
Last active November 14, 2015 00:44
Flexbox Workshop Notes
import Cocoa
enum CoroutineState {
case Fresh, Running, Blocked, Canceled, Done
}
struct CoroutineCancellation: ErrorType {}
class CoroutineImpl<InputType, YieldType> {
let body: (yield: YieldType throws -> InputType) throws -> Void
@imjasonh
imjasonh / markdown.css
Last active May 17, 2024 07:30
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}