Skip to content

Instantly share code, notes, and snippets.

@telamon
telamon / example.txt
Created March 4, 2012 13:21
Minified Sha256 implementation in javascript from: http://www.movable-type.co.uk/scripts/sha256.html
Taken from: http://www.movable-type.co.uk/scripts/sha256.html
Put into: http://closure-compiler.appspot.com/home
exports:
/**
* Generates SHA-256 hash of string
*
* @param {String} msg String to be hashed
* @param {Boolean} [utf8encode=true] Encode msg as UTF-8 before generating hash
@clemensg
clemensg / curl_libuv_example.c
Last active November 21, 2024 09:50
An example on how to use libuv with libcurl's multi interface Should be equally fast on Unixes (uses epoll/kqueue/etc like libev/libevent) but MUCH faster on Windows due to libuv's usage of IO completion ports. Could come in handy if you have to manage several hundreds or thousands of connections!
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
#include <curl/curl.h>
uv_loop_t *loop;
CURLM *curl_handle;
uv_timer_t timeout;
typedef struct curl_context_s {
# ZSH Theme
# Based on gnzh theme
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
alias dim="docker images"
alias dps="docker ps"
alias drm="docker rm"
alias drmi="docker rmi"
alias drme="docker ps -a | grep Exited | cut -d' ' -f1 | xargs docker rm"
# Deletes all docker containers (if stopped, otherwise use -f)
function drma() {
drm $1 $(dps -aq)
}
@sindresorhus
sindresorhus / esm-package.md
Last active May 8, 2025 09:12
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.