Skip to content

Instantly share code, notes, and snippets.

@AriaMinaei
AriaMinaei / babel-plugin-reify-typescript-annotations.ts
Created March 13, 2020 15:00
A babel plugint that turns typescript annotations into runtime values
import transformTypescript from "@babel/plugin-transform-typescript"
import {declare} from "@babel/helper-plugin-utils"
import {types as t, PluginObj, Node, NodePath} from "@babel/core"
import template from "@babel/template"
import {
TSTypeAliasDeclaration,
TSType,
TSTypeParameter,
TSUnionType,
TSTypeReference,

Keybase proof

I hereby claim:

  • I am ariaminaei on github.
  • I am ariaminaei (https://keybase.io/ariaminaei) on keybase.
  • I have a public key whose fingerprint is 0116 1433 70DF 17FA 0C72 8334 3575 AF6F 9450 73B4

To claim this, I am signing this object:

@AriaMinaei
AriaMinaei / latency.txt
Created October 26, 2015 21:57 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@AriaMinaei
AriaMinaei / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AriaMinaei
AriaMinaei / gist:3378224
Created August 17, 2012 11:43
Different rules for different browsers
.box {
box-shadow: blah;
.no-boxshadow & {
border: 1px solid #CCC;
}
.ie8 & {
position: relative;
top: -4px;
<?php
/**
* Truncates a text without breaking the last word.
* @param String $text
* @param Int $length
* @param String $lastString
* @return String
*/
function safe_truncate_text($text, $length = 160, $lastString = '...')