Skip to content

Instantly share code, notes, and snippets.

View ianjsikes's full-sized avatar

Ian J Sikes ianjsikes

View GitHub Profile
export const dedupItems = (
items: DumplingItem[]
): [DumplingItem[], DumplingItem[]] => {
let dupeItems = [];
let newItems = [];
for (const item of items) {
let i = newItems.findIndex(({ sellerId }) => sellerId === item.sellerId);
if (i !== -1) {
dupeItems.push(item);
newItems[i].categories.push(...item.categories);
export const readJsonl = (path: string): any[] => {
const text = fs.readFileSync(path, 'utf8');
return text.split('\n').map(line => JSON.parse(line));
};
export const writeJsonl = (path: string, data: any[]) => {
const text = data.map(item => JSON.stringify(item)).join('\n');
fs.writeFileSync(path, text);
};
@ianjsikes
ianjsikes / README.md
Created April 19, 2019 03:33
SCRIPT-8
@ianjsikes
ianjsikes / README.md
Created April 19, 2019 03:17
SCRIPT-8
{"v":"4.10.1","fr":60,"ip":0,"op":47,"w":400,"h":400,"nm":"Icon-HeartV2","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"ExplodingHeartGroup","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.718],"y":[1.135]},"o":{"x":[0.389],"y":[0]},"n":["0p718_1p135_0p389_0"],"t":0,"s":[0],"e":[100]},{"t":31}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[199.972,192.185,0],"ix":2},"a":{"a":0,"k":[-1.442,-100.281,0],"ix":1},"s":{"a":0,"k":[15,15,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"sr","sy":1,"d":1,"pt":{"a":0,"k":5,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"ir":{"a":0,"k":525.076,"ix":6},"is":{"a":0,"k":0,"ix":8},"or":{"a":0,"k":1050.152,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":1,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"st","c":{"a":0,"k":[0.34968778491,0.452370464802,0.487561285496,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{
{
"v": "5.1.16",
"fr": 29.9700012207031,
"ip": 0,
"op": 60.0000024438501,
"w": 342,
"h": 400,
"nm": "loadingModule",
"ddd": 0,
"assets": [
@ianjsikes
ianjsikes / hsi-stat-blocks.json
Created February 17, 2019 22:59
Improved Initiative stat blocks for the creatures in the Hot Springs Island setting.
{
"ImprovedInitiative.Creatures.mqhpvhf8": "{\"Id\":\"mqhpvhf8\",\"Name\":\"Night Axe Bonebinder\",\"Path\":\"HSI\",\"Source\":\"\",\"Type\":\"Large giant\",\"HP\":{\"Value\":78,\"Notes\":\"(12d10+12)\"},\"AC\":{\"Value\":14,\"Notes\":\"(natural armor)\"},\"InitiativeModifier\":2,\"InitiativeAdvantage\":false,\"Speed\":[\"30 ft.\"],\"Abilities\":{\"Str\":13,\"Dex\":15,\"Con\":12,\"Int\":13,\"Wis\":17,\"Cha\":14},\"DamageVulnerabilities\":[],\"DamageResistances\":[\"acid\",\"cold\",\"fire\",\"bludgeoning, piercing, and slashing from nonmagical weapons\"],\"DamageImmunities\":[],\"ConditionImmunities\":[\"exhaustion\",\"frightened\"],\"Saves\":[],\"Skills\":[],\"Senses\":[\"darkvision 60 ft.\",\"passive Perception 13\"],\"Languages\":[\"Giant\"],\"Challenge\":\"5\",\"Traits\":[{\"Name\":\"Adaptable\",\"Content\":\"Night Axe Ogres are immune to the effects of extreme heat and cold.\",\"Usage\":\"\"},{\"Name\":\"Strategist\",\"Content\":\"Using its water gourd, the bonebinder can unleash animated ropes of water
@ianjsikes
ianjsikes / json-to-homebrewery.js
Created February 17, 2019 21:53
A node script to convert Improved Initiative-style JSON data to Homebrewery-formatted Markdown stat blocks for DnD 5e creatures
/**
Copyright 2019 Ian J Sikes
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
@ianjsikes
ianjsikes / Halloween Spooktacular 2018.md
Created October 29, 2018 21:03
A recap of our Halloween game of "Adventure Skeletons!"

Halloween Spooktacular 2018

System: "Adventure Skeletons!"

Cast

Wakk

  • Player: Mac
  • Ancestry: Goblin
  • Favorite Bone: Humerus
@ianjsikes
ianjsikes / map_with_index.dart
Created May 27, 2018 05:28
Dart utility method to map over a list, getting the value __and__ index.
typedef B MapWithIndexCallback<B, A>(A a, int index);
Iterable<B> mapWithIndex<B, A>(List<A> l, MapWithIndexCallback<B, A> cb) {
Map<int, A> map = l.asMap();
return map.keys.map((key) {
return cb(map[key], key);
});
}
// Example usage