Skip to content

Instantly share code, notes, and snippets.

View jaxrtech's full-sized avatar

Josh Bowden jaxrtech

View GitHub Profile
class HoverComponent extends Component {
// "Leaked" implementation detail of our `HoverSystem`
var time: Float
}
class PositionComponent extends Component {
var x: Float
var y: Float
}
@jaxrtech
jaxrtech / nominal_and_structural.txt
Last active July 13, 2016 01:30
Idea for Nominal and Structural Types
alias Named = { name: string }
// same as `type City = { name: string }`
// the structural type on the rhs will get "tagged" by the name on the lhs so
// that the original structural type becomes a nominal type
//
type City = Named
type State = Named
@jaxrtech
jaxrtech / static_type_inference.txt
Last active July 13, 2016 02:34
Idea for inferring and constraining structural types...
// `@foo` is a symbol that can be treated as a type or a value
// `a :: T` is a forward type declaration where value `a` is of type `T`
// I'm using this for mainly for explanatory purposes to show what structural
// type inference might allow for
// `<'x>` declares a type variable `'x`
// I've prefixed the type variables with an apostrophe to make clear what is a
// regular type and what a type variable is (borrowing from F#/OCaml notation)
@jaxrtech
jaxrtech / lalex_grammar.pegjs
Created July 22, 2016 15:22
Lalex's grammar in broken PEG.js
// Some expressions are from the JavaScript example grammar (which is very useful)
// https://github.com/pegjs/pegjs/blob/master/examples/javascript.pegjs
Program
= Statement+
Statement "statement"
= Expression
/ Comment
@jaxrtech
jaxrtech / github-tab-fix.js
Created January 12, 2018 06:18
Tampermonkey Scripts
// ==UserScript==
// @name Github Code Tab-Size Fix
// @version 0.1
// @description Sets a reasonably tab-size to make code using tabs a bit more readible
// @match https://github.com/*
// @run-at document-start
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
@jaxrtech
jaxrtech / typesafe-ast-nodes.ts
Created May 15, 2018 05:54
So you said you wanted typesafe AST nodes (based on TypeScript's compiler design)...
enum ShapeKind {
Circle,
Rectangle,
Square
}
type Shape =
| Circle
| Rectangle
| Square
pragma solidity ^0.8.19;
/**
* @notice Game of chicken
*/
interface IChicken {
// ----------- state vars
function lastGuesser() external returns (address);
function winner() external returns (address);
// function owner() external returns (address);