Skip to content

Instantly share code, notes, and snippets.

View zaaack's full-sized avatar
🏠
Working from home

Zack Young zaaack

🏠
Working from home
View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active April 16, 2025 11:29
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@zaaack
zaaack / zh_answer.js
Last active December 8, 2021 20:19
知乎想法/答案备份, copy 到 console 执行即可
//知乎答案爬取
var $ = document.querySelector.bind(document)
var $$ = document.querySelectorAll.bind(document)
var zh={
Download:function (content, filename) {
// 创建隐藏的可下载链接
var eleLink = document.createElement('a');
eleLink.download = filename;
eleLink.style.display = 'none';
// 字符内容转变成blob地址
@xiaoxiangmoe
xiaoxiangmoe / react-16-6.d.ts
Last active March 14, 2022 01:58
DefinitelyTyped @types/react
import * as React from "react";
declare module "react" {
function memo<P>(
Component:React.SFC<P>,
propsAreEqual?:((
prevProps: Readonly<P & { children?: ReactNode }>,
nextProps: Readonly<P & { children?: ReactNode }>
)=>boolean
@josephg
josephg / README.md
Last active June 7, 2024 09:37
Getting Zig compiling to WASM

In case anyone else wants to play with Zig on webassembly, here's what you need to do to make it work on a mac today.

1. Get LLVM 7 compiled with webassembly support.

You'll need LLVM to output to the WASM target. This has just been added by default in trunk, so if LLVM >7 is available, you might be able to just brew install llvm.

If you have wasm support already you should see:

$ llc --version
@matthiassb
matthiassb / dns-sync.sh
Last active August 24, 2024 09:43
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@kuitos
kuitos / index.html
Created September 18, 2017 05:08
all fb monster repos
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>github</title>
</head>
<body>
<script src="https://unpkg.com/[email protected]/lodash.js"></script>
<script type="module">
@dexteryy
dexteryy / universal-js-monorepo.md
Last active September 29, 2022 21:26
A monorepo structure for large-scale Universal JS projects

The evolutionary path is: monolithic backend-web-framework-based repo -> multi repos with shared infra -> monorepo contains shared infra

The tool support is becoming matured (Yarn Workspace, VSCode's Multi Root Workspaces)

[monorepo]/
 ├── universal-js-app project for product A/
 │    ├── node_modules/
 │    ├── common/
@busypeoples
busypeoples / PhantomTypeReasonML.md
Last active February 6, 2024 21:29
Phantom types in ReasonML

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.

In JavaScript, all binding declarations are instantiated when control flow enters the scope in which they appear. Legacy var and function declarations allow access to those bindings before the actual declaration, with a "value" of undefined. That legacy behavior is known as "hoisting". let and const binding declarations are also instantiated when control flow enters the scope in which they appear, with access prevented until the actual declaration is reached; this is called the Temporal Dead Zone. The TDZ exists to prevent the sort of bugs that legacy hoisting can create.

Install .NET Core on Debian Stretch

Execute the following :

sudo apt-get install curl libunwind8 gettext
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=847105
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin