Skip to content

Instantly share code, notes, and snippets.

View grindarius's full-sized avatar
💭
I may be slow to respond.

Bhattarapong Somwong grindarius

💭
I may be slow to respond.
View GitHub Profile
@CryogenicPlanet
CryogenicPlanet / .eslintrc
Created June 6, 2021 12:29
Typescript Mono Repo Guide
// .eslintrc
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"react-app",
"plugin:react/recommended",
@sindresorhus
sindresorhus / esm-package.md
Last active September 27, 2024 05:05
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.
//use .nest()function to group data so the line can be computed for each group
var sumstat = d3.nest()
.key(d => d.media)
.entries(data);
console.log(sumstat)
//set color pallete for different vairables
var mediaName = sumstat.map(d => d.key)
var color = d3.scaleOrdinal().domain(mediaName).range(colorbrewer.Set2[6])
@FGRibreau
FGRibreau / 1_stripe-schema.md
Last active September 7, 2024 14:46
Stripe database schema (extracted from their sigma product) as of 2019-10-09
jqn -r markdown-table 'map(x => "## " + x.name + "\n\n" + markdownTable(x.columns.map(y => [y.name, y.type]))  ) | join("\n\n")' < /tmp/stripe.json

accounts

id varchar
business_name varchar
business_url varchar
@xavierfoucrier
xavierfoucrier / gpg-signing.md
Last active September 16, 2024 06:24
GPG signing with Git and Github Desktop

GPG signing – git github-desktop

Here is a short guide that will help you setup your environment to create signed commits or signed tags with Git locally. This has been extensively tested on Windows with Git and the Github Desktop application: I use it every day for my professional development projects.

I you face any issue, feel free to leave a comment below.

Summary

  1. Sign commits or tags
  2. Key passphrase
  3. Disable signatures
  4. Renew a GPG key
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active September 26, 2024 04:20
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@troyfontaine
troyfontaine / 1-setup.md
Last active September 27, 2024 06:03
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@larsenmtl
larsenmtl / .block
Last active June 28, 2023 12:30
MathJax and d3
license: mit
@jacobian
jacobian / gridfs-vs-lobjects.py
Last active December 29, 2021 11:21
Benchmarking MongoDB's GridFS vs PostgreSQL's LargeObjects.
import io
import pymongo
import psycopg2
import gridfs
import timeit
# For fairness use the same chunk size - 512k.
CHUNK_SIZE = 1024 * 512
def bench_mongo(fs, size):