Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@danneu
danneu / esm-package.md
Created January 17, 2024 06:15 — forked from sindresorhus/esm-package.md
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.
@danneu
danneu / diskio.h
Created February 23, 2021 10:05 — forked from RickKimball/diskio.h
msp430 Petit FatFile System sample
/*-----------------------------------------------------------------------
/ PFF - Low level disk interface modlue include file (C)ChaN, 2009
/-----------------------------------------------------------------------*/
#ifndef _DISKIO
#include "integer.h"
/* Status of Disk Functions */
typedef BYTE DSTATUS;
@danneu
danneu / text_to_svg_path.py
Created August 22, 2020 06:15 — forked from CatherineH/text_to_svg_path.py
Convert a text character to an SVG path.
from svgpathtools import wsvg, Line, QuadraticBezier, Path
from freetype import Face
def tuple_to_imag(t):
return t[0] + t[1] * 1j
face = Face('./Vera.ttf')
@danneu
danneu / index.js
Created March 21, 2020 04:44 — forked from joepie91/index.js
Breaking CloudFlare's "I'm Under Attack" challenge
'use strict';
const parseExpression = require("./parse-expression");
function findAll(regex, target) {
let results = [], match;
while (match = regex.exec(target)) {
results.push(match);
}
@danneu
danneu / plink-plonk.js
Created February 15, 2020 20:00 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@danneu
danneu / .elm
Last active August 6, 2017 16:12 — forked from pablohirafuji/defaultvalue-vs-value.elm
Elm defaultValue vs value -- Paste into http://elm-lang.org/try
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
main =
Html.beginnerProgram { model = Model "" "", view = view, update = update }
type alias Model =
@danneu
danneu / Json.scala
Created July 28, 2017 09:43 — forked from pchiusano/Json.scala
Simple JSON parser combinator library that does not use zippers
// WARNING! totally untested, I have only compiled the code! :)
package json
import collection.immutable.Map
import scalaz.{\/, MonadPlus}
import scalaz.\/._
import scalaz.std.vector._
import scalaz.std.map._
import scalaz.std.list._
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@danneu
danneu / app.js
Created July 10, 2016 06:33 — forked from mjackson/app.js
Using webpack with pixi.js
var PIXI = require('pixi.js')
console.log(PIXI)
@danneu
danneu / gulpfile.js
Created November 11, 2015 03:18 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));