This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ShapeKind { | |
Circle, | |
Rectangle, | |
Square | |
} | |
type Shape = | |
| Circle | |
| Rectangle | |
| Square |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom based on https://github.com/blinks zsh theme | |
# see http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html | |
_BOLD='%{%B%}' | |
_UNBOLD='%{%b%}' | |
_BKG="%{%K{${bkg}}%}" | |
_FG () { echo "%{%F{$1}%}" } | |
_UNBKG='%{%k%}' | |
_UNFKG='%{%f%}' | |
_UNSET="$_UNBKG$_UNFKG$_UNBOLD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `@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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HoverComponent extends Component { | |
// "Leaked" implementation detail of our `HoverSystem` | |
var time: Float | |
} | |
class PositionComponent extends Component { | |
var x: Float | |
var y: Float | |
} |