Skip to content

Instantly share code, notes, and snippets.

@prantlf
prantlf / crash-ref.vsh
Last active April 21, 2024 15:27
Crashes because of wrong recursive generics resolution of a struct reference in V
#!/usr/bin/env -S v run
// import json
// import os
import v.reflection { get_type }
// Declare structures covering a subset of a HAR file
struct HarContent {
size i64
@prantlf
prantlf / main_test.go
Last active March 3, 2023 17:47
Tests and benchmarks for formatting integers with commas separating thousands
// Save this file as main_test.go and run "go test -bench ."
package main
import (
"bytes"
"fmt"
"regexp"
"strconv"
"testing"
@prantlf
prantlf / convertPointFromPageToNode.js
Created December 1, 2022 20:05 — forked from Yaffle/convertPointFromPageToNode.js
function to get the MouseEvent coordinates for an element that has CSS3 Transforms
/*jslint plusplus: true, vars: true, indent: 2 */
/*
convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y}
returns coordinate in element's local coordinate system (works properly with css transforms without perspective projection)
convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y}
returns coordinate in window's coordinate system (works properly with css transforms without perspective projection)
*/
@prantlf
prantlf / japanese-font-family.md
Last active November 7, 2022 09:02 — forked from vanquang9387/japanese-font-family.md
Japanese default css font family

Most Japanese websites use default font sets provided on Windows, Mac or Ubuntu. The latest ones are Meiryo, Hiragino Kaku Gothic Pro and Noto. For older versions such like Windows XP, it is good to add former default fonts MS Gothic(or MS Mincho)/Osaka. Older Linux versions may include Takao fonts.

Some old browsers could not understand those font names in English, some others do not recognize the names in Japanese, so it is safe to write both in Japanese and English.

Meiryo and Hiragino's order is, because Mac users may have Meiryo from MS-Office, and Hiragino is more familiar and matching well on Mac, better by starting Hiragino series.

So the current recommended practice is like this:

font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "MS ゴシック" , "MS Gothic", "Noto Sans CJK JP", TakaoPGothic, sans-serif;
@prantlf
prantlf / trust-npm.sh
Last active March 20, 2022 17:33
Look for unreliable package authors
#!/bin/sh
# Look for NPM modules of the authors below in the local node_modules.
# Author of left-pad unpublished their modules from the NPM registry,
# which broke a lot of packages.
# https://www.theregister.com/2016/03/23/npm_left_pad_chaos/
# https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d
# https://blog.npmjs.org/post/141577284765/kik-left-pad-and-npm
# https://www.reddit.com/r/programming/comments/4bjss2/an_11_line_npm_package_called_leftpad_with_only/
@prantlf
prantlf / logger.js
Last active February 22, 2022 09:56 — forked from rtgibbons/logger.js
Logger Library with winston - Fixed for additional log arguments
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@prantlf
prantlf / icon.for.subtype.txt
Created January 15, 2021 19:00
How to assign a custom icon to a specific subtype.
src/icons/images/mytype.svg:
The icon image content.
src/icons/icons.css:
.binf-widgets .myext-mytype {
background-image: url('images/mytype.svg');
}
@prantlf
prantlf / diablo2_instructions.md
Created December 18, 2020 01:19 — forked from rodrigore/diablo2_instructions.md
Diablo2 on Mac OSX El Capitan

Diablo II LoD on Mac OSX El Capitan

These are the instructions for using Terminal to install the Windows version of the game onto your machine. You can then easily copy the game multiple times for different mods you might want to play.

In this guide you'll end up with:

@prantlf
prantlf / open.pws.txt
Created January 27, 2021 21:09
How to add a menu item opening Personal Workspace to the user profile menu.
src/commands/profile.menuitems.js (add menu items):
define(function () {
return {
profileMenu: [
{
signature: 'myext-open-pws',
name: 'Go to Personal Workspace',
group: 'others'
}
@prantlf
prantlf / icon.for.dwg.documents.txt
Created January 15, 2021 19:01
How to assign a custom icon to AutoCAD drawings.
src/icons/images/dwg.svg:
The icon image content.
src/icons/icons.css:
.binf-widgets .acad-mime-dwg {
background-image: url('images/dwg.svg');
}