Skip to content

Instantly share code, notes, and snippets.

View jim-toth's full-sized avatar
🚀

Jim Toth jim-toth

🚀
View GitHub Profile
@jordaaash
jordaaash / .mocharc.json
Created October 25, 2021 01:18
Mocha + TypeScript + ESM
{
"extension": ["ts"],
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm"],
"spec": ["test/**/*.test.ts"]
}
@sindresorhus
sindresorhus / esm-package.md
Last active May 1, 2024 07:18
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.
@mattlockyer
mattlockyer / client.js
Last active February 22, 2023 18:30
s3 upload as stream using req stream (extra info in request header)
const file = this.input.files[0];
//console.log(file);
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
console.log(e.target.response);
});
xhr.open('POST', host + 'fileuploadstream', true);
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name }));
xhr.send(file);
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 15, 2024 09:41
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@louismullie
louismullie / gist:9726991
Last active September 23, 2022 02:39
OpenGL 3.0 SHA256
#version 130
#pragma optionNV(unroll all)
uint ROTLEFT(in uint a, in int b) { return (a << b) | (a >> (32-b)); }
uint ROTRIGHT(in uint a, in int b) { return (a >> b) | (a << (32-b)); }
uint CH(in uint x,in uint y,in uint z) { return (x & y) ^ (~x & z); }
uint MAJ(in uint x,in uint y,in uint z) { return (x & y) ^ (x & z) ^ (y & z); }
uint EP0(in uint x) { return ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22); }
uint EP1(in uint x) { return ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25); }
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶