Skip to content

Instantly share code, notes, and snippets.

View jackhftang's full-sized avatar

Jack Tang jackhftang

View GitHub Profile
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active April 26, 2024 13:33
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@ericksli
ericksli / README.md
Last active January 11, 2020 11:37
Move PNG files for Android and iOS project

movepng

Move PNG files for Android and iOS project.

Suppose you have these images exported from Avocode in ~/Downloads/test:

.
├── image_distance-hdpi.png
├── image_distance-mdpi.png
@numinit
numinit / 0-index.md
Last active April 6, 2024 21:54
patch -p0 < fix-vega-reset.patch
@zacharycarter
zacharycarter / wclwn.md
Last active March 12, 2024 12:45
Binding to C Libraries with Nim
@ParthDesai
ParthDesai / generic_demo.go
Last active September 3, 2021 09:54
Generic map function in golang
package main
import (
"fmt"
"reflect"
)
func main() {
r := genericMap([]int{1, 2, 3, 4}, func(x int) string {
return "Hello"
@Varriount
Varriount / nbe-strings.mkd
Last active March 31, 2024 01:12
Nim-By-Example: Strings

String Literals

Strings literals in Nim can be written by surrounding text with either a single pair of double-quotes or with three pairs of double-quotes. Single-quoted string literals may only span one line, while triple-quoted string literals may span multiple lines.

"Hello World"
"""
  Hello
@jacquerie
jacquerie / foobar.py
Last active October 28, 2023 16:09
How to decode the message at the end of Google Foobar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
MESSAGE = '''
EUYQGhMMSx0cU0FIU1MCFAQPG01NQ0gTAEICChUGBxZTRVxBSQoZFQYKHQpKSUNURhcVEgoUFR1I
SltDSBkBTRwKEAgQHxFCSkFJDgkJCgoGCkMLAQBGUklUQhMPAgAJCgYLV0MOSR0VAxAaABZBQVRP
TRICCRVIAk5IEg4dVFRfRkYZBgRARBI=
'''
@frafra
frafra / dnsmasq-block-ads.sh
Last active June 26, 2016 02:50
dnsmasq block ads
#!/bin/bash
curl -s "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" \
| sed 's;^\(.*\)$;address="/\1/127.0.0.1";' | sudo tee /etc/dnsmasq.d/ads >/dev/null
@Carreau
Carreau / kernel.js
Created December 13, 2012 20:09
A node.js kernel for IPython notebook. You can see the explanation of the ipynb rendered in http://nbviewer.ipython.org
zmq = require("zmq")
fs = require("fs")
var config = JSON.parse(fs.readFileSync(process.argv[2]))
var connexion = "tcp://"+config.ip+":"
var shell_conn = connexion+config.shell_port
var pub_conn = connexion+config.iopub_port
var hb_conn = connexion+config.hb_port
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""