Skip to content

Instantly share code, notes, and snippets.


Paolo Insogna ShogunPanda

View GitHub Profile
ShogunPanda / ESM in
Created November 16, 2021 14:09
Usage of ESM modules in CommonJS world.
View ESM in

Import ESM module in a CommonJS module

Do not use requires or top-level imports (if you're transpiling server side code). Replace all occurrences with await import and wrap your code in a async function.


If your original code was:

View pino-esbuild.js
const { dirname, sep, join, resolve } = require('path')
const { build } = require('esbuild')
const { readFile } = require('fs/promises')
// TODO: Check how to solve when [dir] or [hash] are used
function pinoPlugin(options) {
options = { transports: [], ...options }
return {
name: 'pino',
ShogunPanda / fb-comments-stealer.js
Created April 22, 2015 18:14
View fb-comments-stealer.js
#!/usr/bin/env babel-node
import request from "request";
import chalkbars from "chalkbars";
process.on("uncaughtException", e =>{
ShogunPanda / michan-efp-bejelein.css
Created January 27, 2015 04:33
View michan-efp-bejelein.css
@import url(|Ubuntu:300);
font-family: Alegreya;
font-size: 14pt;
line-height: 1.4em;
max-width: 21cm;
word-wrap: break-word;
margin: 0 auto;
ShogunPanda / applause.html
Last active August 29, 2015 14:01
View applause.html
<!doctype html>
<head>Applause Bookmarklet</head>
<h1>Applause Bookmarklet</h1>
<h2><a href="javascript: (function(){var id=prompt('Enter the Applause bug ID'); if(id && id.length > 0)'!&view=issues&subview=issues&bugId=' + id, '_blank'); })();">Open a Bug</a></h2>
ShogunPanda /
Created March 5, 2014 21:14
Clean up large files from GIT repo.
# Copyright (C) 2014 Shogun <>
# Run this script with a single argument which is the threshold size. Example: sh 100k
# Find the files to remove
files=$(find * -type f -size +$1)
echo "Removing $files";
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch $files" --prune-empty --tag-name-filter cat -- --all
ShogunPanda / authenticate.rb
Last active August 29, 2015 13:56
Google Drive
View authenticate.rb
client = :oauth_2, application_name: NAME, application_version: VERSION)
client.client_id = CLIENT_ID
client.client_secret = CLIENT_SECRECT
client.authorization.scope = SCOPES
authorizer = do |auth, req, res|
raise if request.query["error"].present? || request.query["code"].blank?
client.authorization.code = request.query["code"].to_s
ShogunPanda / reek.yml
Created August 21, 2013 19:14
Metrics configuration.
View reek.yml
### Enabled ###
enabled: true
exclude: []
enabled: true
exclude: []
max_calls: 2
allow_calls: []
ShogunPanda / sequence.rb
Created July 16, 2011 11:15 — forked from masatomo/sequence.rb
adds a feature to set sequence number to Mongoid::Document
View sequence.rb
# encoding: utf-8
module Mongoid
# Include this module to add automatic sequence feature (also works for _id field, so SQL-Like autoincrement primary key can easily be simulated)
# usage:
# class KlassName
# include Mongoid::Document
# include Mongoid::Sequence
# ...
# field :number, :type=>Integer
# sequence :number