Skip to content

Instantly share code, notes, and snippets.

View dnafication's full-sized avatar
🏔️
chill

Dina Basumatary dnafication

🏔️
chill
View GitHub Profile
@dnafication
dnafication / esm-package.md
Created September 16, 2022 07:31 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from 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.
@dnafication
dnafication / ApolloIdempotent.ts
Created March 11, 2022 04:05 — forked from jmagnuss/ApolloIdempotent.ts
Empty plugin sample for Apollo Server
import {
ApolloServerPlugin,
GraphQLRequestContext,
GraphQLRequestListener,
GraphQLServiceContext,
GraphQLResponse,
} from 'apollo-server-plugin-base';
import {
ApolloError,
AuthenticationError,

Sequence of Gatsby's bootstrap lifecycle with links to source code as of v2.0.0

  1. open and validate gatsby-config (get-config-file.js)
  2. load plugins (load-plugins/index.js) from the list given in gatsby-config.js
  3. onPreBootstrap: runs onPreBootstrap if it is implemented in any plugins, for example gatsby-plugin-typography. Receives handy [apiCallArgs](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/util
@dnafication
dnafication / docker-automation.py
Created December 8, 2017 05:56 — forked from yetanotherchris/docker-automation.py
Automating Docker images and containers with Python ()
'''
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
@dnafication
dnafication / jmeter-results.conf
Created November 30, 2017 06:07 — forked from jpotts/jmeter-results.conf
Logstash config that can be used to read in JMeter test results and store them in Elasticsearch
input {
file {
path => [ "/Users/jpotts/Documents/code/es-test/results.csv"]
}
}
filter {
if ([message] =~ "responseCode") {
drop { }
} else {
csv {