Skip to content

Instantly share code, notes, and snippets.

View ianjsikes's full-sized avatar

Ian J Sikes ianjsikes

View GitHub Profile
fn main() {
println!("Hello, world!");
}
// Functions that you wish to access from Javascript
// must be marked as no_mangle
#[no_mangle]
pub fn add(a: i32, b: i32) -> i32 {
return a + b
}
@ianjsikes
ianjsikes / screenshake.lua
Last active September 1, 2017 00:34
pico-8 Snippets
-- screenshake
shake = 0
if shake>0 then
shake-=1
camera()
if shake>0 then
camera(-2+rnd(5),-2+rnd(5))
end
end
@ianjsikes
ianjsikes / index.js
Last active September 28, 2017 18:53
const wasm = require('./main.rs')
wasm.initialize({noExitRuntime: true}).then(module => {
// Create a Javascript wrapper around our Rust function
const add = module.cwrap('add', 'number', ['number', 'number'])
console.log('Calling rust functions from javascript!')
console.log(add(1, 2))
})
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: __dirname + '/build',
},
module: {
rules: [
{
test: /\.rs$/,
@ianjsikes
ianjsikes / states.json
Created December 5, 2017 18:15
US States and Territories JSON Array
[
"Alabama",
"Alaska",
"American Samoa",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
@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
@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 / 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
{
"v": "5.1.16",
"fr": 29.9700012207031,
"ip": 0,
"op": 60.0000024438501,
"w": 342,
"h": 400,
"nm": "loadingModule",
"ddd": 0,
"assets": [