Skip to content

Instantly share code, notes, and snippets.

@slavafomin
slavafomin / 00-typescript-esm.md
Last active July 10, 2024 16:38
Using TypeScript with native ESM

Using TypeScript Node.js with native ESM

This reference guide shows how to configure a TypeScript Node.js project to work and compile to to native ESM.

Rationale

CommonJS module system was introduced by the Node.js developers due to the lack of the notion of "modules" in the original JavaScript (ECMAScript) language specification at that time. However, nowadays, ECMAScript has a standard module system called ESM — ECMAScript Modules, which is a part of the accepted standard. This way CommonJS could be considered vendor-specific and obsolete/legacy. Hopefully, TypeScript ecosystem now supports the "new" standard.

So the key benefits are:

@kaaquist
kaaquist / podman_macos.md
Last active July 10, 2024 14:43
Podman with docker-compose on MacOS.

Podman with docker-compose on MacOS.

Podman an alternative to Docker Desktop on MacOS

Getting podman installed and started is super easy.
Just use brew to install it.

> brew install podman

Now since podman uses a VM just like the Docker Client on MacOS we need to initialize that and start it.

@mangatmodi
mangatmodi / nil_check_working.go
Last active November 3, 2023 18:40
nil_check_working.go
package main
import (
"fmt"
"reflect"
)
type Animal interface {
MakeSound() string
}
@xamox
xamox / kubectl-port-forward_forward.md
Last active January 14, 2022 18:51
How to forward a kubectl port-forward with socat

Yo dawg, I heard you like port-fowards so I'm going to port-forward your port-forward.

Say you want to test something like maybe run something in minikube locally but connect to something running in the kube cluster.

Do your kube port foward

kubectl --context k8s-uw1-gcp port-forward prometheus-prometheus-server-7b6f9d99f8-m4vt6 9090
@bryanhuntesl
bryanhuntesl / make that mac not sleep - let that mac sleep again.markdown
Created January 17, 2018 10:14
make that mac not sleep - let that mac sleep again
sudo pmset -b sleep 0; sudo pmset -b disablesleep 1

and after reenable with

sudo pmset -b sleep 5; sudo pmset -b disablesleep 0
@enricofoltran
enricofoltran / main.go
Last active June 26, 2024 12:16
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@nak3
nak3 / main.go
Created November 26, 2017 05:27
test of viper and glog combination
package main
import (
"flag"
"fmt"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
//var bkg = chrome.extension.getBackgroundPage();
var calls = {};
// Shows settings on install.
chrome.runtime.onInstalled.addListener(function(details) {
if(details.reason && (details.reason === 'install') || (details.reason === 'update')){
chrome.tabs.create({url: "options.html"});
}
});
// Show settings when clicking on the icon.
@sebmarkbage
sebmarkbage / API.js
Last active August 11, 2020 04:03
Custom Stack Frames
type FrameScope = {
[key:string]: mixed
};
type StackFrame = {
name?: string,
fileName?: string,
lineNumber?: number,
columnNumber?: number,
scope?: FrameScope
};