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
let screen = Vector(800., 600.) | |
let ball = Circle 10. | |
let box = Rectangle screen | |
let collision = detectCollision ball box | |
match collision with | |
| NoCollision -> ... | |
| Collision FullContact -> x | |
| Collision (PartialCollision side) -> x |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<script type="module" src="run.js"></script> | |
<style> | |
html, | |
body, |
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
html, body { | |
margin: 0; | |
padding: 0; | |
background-color: black; | |
} |
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
[<Struct>] | |
type Vector = | |
{ X: float; Y: float; Z: float } | |
static member (*) (k, v: Vector) = { X = k * v.X; Y = k * v.Y; Z = k * v.Z } | |
static member (-) (v1: Vector, v2: Vector) = { X = v1.X - v2.X; Y = v1.Y - v2.Y; Z = v1.Z - v2.Z } | |
static member (+) (v1: Vector, v2: Vector) = { X = v1.X + v2.X; Y = v1.Y + v2.Y; Z = v1.Z + v2.Z } | |
static member Dot (v1: Vector, v2: Vector) = v1.X * v2.X + v1.Y * v2.Y + v1.Z * v2.Z | |
static member Mag (v: Vector) = sqrt (v.X * v.X + v.Y * v.Y + v.Z * v.Z) | |
static member Norm (v: Vector) = | |
let mag = Vector.Mag v |
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
html, body { | |
margin: 0; | |
padding: 0; | |
} |
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
const QUOTE = '"'; | |
const SEPARATOR = ','; | |
const ROW_SEPARATOR = '\n'; | |
export function parseCsv(content: string) { | |
const len = content.length; | |
const data = []; | |
let row = []; | |
let isEscaped = false; | |
let value = ''; |
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
const a = new Life(); | |
a.pos = new Vector(10, 10); | |
a.setParameter(Parameter.ENERGY, 100); | |
a.setParameter(Parameter.WEIGHT, 1); | |
a.setParameter(Parameter.FOOD, x => x.hasParameter(Parameter.IS_PLANT)); | |
a.addSense(new Sight({ radius: 10, angle: 270, precision: 1 })) | |
a.addSense(new Hearing({ radius: 1, angle: 360, }) |
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
const DEFAULT_VERSION = 0; | |
export class ClientStorage { | |
constructor(key, { | |
isSessionOnly = false, | |
version = DEFAULT_VERSION, | |
} = {}) { | |
this.key = key; | |
this.version = version; | |
this.storage = isSessionOnly ? sessionStorage : localStorage; |
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
/** | |
* @param {Function} fn Function to curry. | |
* @param {Number} lenght The arguments required to invoke the function. Optional. By default is fn.length | |
* @returns {Function} The currified function. | |
*/ | |
function curry(fn, length) { | |
length = length || fn.length; | |
return function currified() { | |
var args = [].slice.call(arguments); |
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
choco install spotify slack steam greenshot nodejs docker-desktop vscode sublimetext3 notepadplusplus gitkraken visualstudio2017community octave blender magicavoxelviewer -y |