Skip to content

Instantly share code, notes, and snippets.

View anakornk's full-sized avatar
🎯
Focusing

Anakorn Tata Kyavatanakij anakornk

🎯
Focusing
View GitHub Profile
@diauweb
diauweb / esmRequire.js
Created September 21, 2021 01:48
Requiring a ES Module into CJS environment
/**
* @file import compiled ES modules as a workaround
*/
const esm = require('esm')
const fs = require('fs')
const Module = require('module')
// Node: bypass [ERR_REQUIRE_ESM]
@kepano
kepano / obsidian-web-clipper.js
Last active May 10, 2024 01:34
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@sindresorhus
sindresorhus / esm-package.md
Last active May 13, 2024 08:32
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.
@br3ndonland
br3ndonland / github-actions-notes.md
Last active May 5, 2024 07:39
Getting the Gist of GitHub Actions
@moeinrahimi
moeinrahimi / Matrix.js
Last active June 20, 2023 03:35
using matrix-js-sdk on react-native
import React, { Component } from 'react';
import Promise from 'bluebird';
Promise.config({
warnings: false
});
import {
TextInput,
Button,
StyleSheet,
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html;
index index.html;
location / {
@alex-miller-0
alex-miller-0 / eth-utxo.md
Last active February 3, 2024 15:20
UTXO tokens on Ethereum

Suppose we wish to model a UTXO system on the EVM. We need to represent UTXO tokens such that all value is preserved when tokens are spent. Note: For this example, we are not concerned about the security of the system and are satisfied with giving authorities the power to create tokens (e.g. as in a plasma system).

Consider the following object:

{
  owner: <address>,
  value: <uint>,
@Haseeb-Qureshi
Haseeb-Qureshi / coinflip_security_hints.md
Last active July 8, 2018 17:58
Coinflip game hints

Your task:

  • Build a secure coinflip betting game between two players on Ethereum.

ONLY READ THIS DOCUMENT IF YOU WANT TO SPOIL BUILDING THE GAME. FIRST TRY TO BUILD IT YOURSELF, THEN SEE IF IT SURVIVES THE FOLLOWING ATTACKS.

.

.

.

.

@oliveratgithub
oliveratgithub / emojis.json
Last active May 9, 2024 20:25
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "&#128104;&zwj;&#128105;&z
@parshap
parshap / node-modules-in-react-native.md
Last active November 15, 2023 11:15
Running Node Modules in React Native

Running Node Modules in React Native

How to use packages that depend on Node.js core modules in React Native.

See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.

Node.js Core Modules