Skip to content

Instantly share code, notes, and snippets.

@Becavalier
Becavalier / UglifyJS.TreeTransformer.js
Last active May 6, 2024 05:26
The basic usage of "UglifyJS.TreeTransformer".
const UglifyJS = require('uglify-js');
var symbolTable = {};
var binaryOperations = {
"+": (x, y) => x + y,
"-": (x, y) => x - y,
"*": (x, y) => x * y
}
var constexpr = new UglifyJS.TreeTransformer(null, function(node) {
if (node instanceof UglifyJS.AST_Binary) {

How to get @DevBlackOps Terminal-Icons module working in PowerShell on Windows

Note: since version 0.1.1 of the module this now works in Windows PowerShell or PowerShell Core.

  1. Download and install this version of Literation Mono Nerd Font which has been specifically fixed to be recognised as monospace on Windows:

https://github.com/haasosaurus/nerd-fonts/blob/regen-mono-font-fix/patched-fonts/LiberationMono/complete/Literation%20Mono%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf

(see this issue for more info: ryanoasis/nerd-fonts#269)

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

attribute highp vec4 a_vertex;
attribute mediump vec2 a_texCoord;
varying mediump vec2 UL;
varying mediump vec2 UR;
varying mediump vec2 DL;
varying mediump vec2 DR;
uniform highp mat4 u_pvmMatrix;
uniform mediump vec2 u_displaySize;
void main()
@kevincennis
kevincennis / v8.md
Last active May 6, 2024 05:25
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 6, 2024 05:24
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 05:24
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@natyusha
natyusha / Naty's FFXIV Endwalker Add-ons, Plugins and Mods.md
Last active May 6, 2024 05:23
All the third party add-ons, plugins and mods I use for FFXIV.

Last Updated: Patch 6.58

The program which most people use for parsing in FFXIV and several other MMOs. For an open source alternative consider using IINACT though configuring it won't be covered here.

Options

  • Main Table Encounters
    • General
      • Uncheck: Number of seconds to wait after the last combat action to begin a new encounter.
      • Uncheck: Number of seconds to wait after the last combat action to pause the encounter duration.

Plugins

@arshednabeel
arshednabeel / vicsek.py
Last active May 6, 2024 05:22
A minimal implementation of the Vicsek model in ~50 lines of code
import numpy as np
from tqdm import trange
def get_neighbour_matrix(x, L, R):
dx = np.subtract.outer(x[:, 0], x[:, 0])
dy = np.subtract.outer(x[:, 1], x[:, 1])
dx[dx > (L / 2) ** 2] -= (L / 2) ** 2
dy[dy > (L / 2) ** 2] -= (L / 2) ** 2
pair_dist = dx ** 2 + dy ** 2
@antonycourtney
antonycourtney / DiamondExample.md
Last active May 6, 2024 05:21
A real world example of recombinant / diamond wiring and feedback with RxJS

A realistic RxJS app with diamond wiring

Consider the following user interface (inspired by Strava) for looking at time-series charts of network data:

esnet-estes-charts

Notes on this interface and my Rx implementation of it:

  • Each chart (stacked vertically) charts a different metric (latency, packet loss and throughput) but over the same time period.
  • As the user moves the mouse left and right on any chart, the vertical line (called the tracker) moves to track the mouse position on all charts. The number displayed in the gray box on the right is the value underneath the tracker for that metric.