Skip to content

Instantly share code, notes, and snippets.

View lilbond's full-sized avatar

lilbond

View GitHub Profile
@lilbond
lilbond / Dataclass.js
Created May 31, 2021 15:03
Simple base class to quickly and somewhat safely create DTO/Model etc.
class Dataclass {
constructor(props, defaults, required) {
if (props) {
for (const key in props) {
if (Object.hasOwnProperty.call(props, key)) {
this[key] = props[key];
}
}
}
@lilbond
lilbond / paper-js-bouncing-ball.js
Created May 30, 2021 16:53
Simple bouncing ball animation using paper js
var radius = 40;
var circle = new Path.Circle({
center: new Point(0,0),
radius: radius,
fillColor: 'blue'
});
var X = view.center.x;
var Y = view.center.y;
@lilbond
lilbond / paper-und-redo-eg.js
Created May 30, 2021 16:07
Simple undo/redo sample with paper.js using mouse and keyboard events
var EventType = {
mouseUp: 1,
mouseDown: 2,
undo: 3,
redo: 4
}
function Event(type, payload) {
this.type = type;
this.payload = payload;
@lilbond
lilbond / variablesInGolang.go
Created February 2, 2017 00:10
Basics of variables in Go. An explanation is provided here http://www.musingscafe.com/golang-part-1-variables/
package main
import (
"fmt"
)
func main() {
shorthand()
}
@lilbond
lilbond / functionsInGolang.go
Last active February 1, 2017 16:57
A gist which touches upon various basic aspects of functions in Go. Explanation can be found here http://www.musingscafe.com/functions-in-golang/
package main
import (
"fmt"
)
func main() {
print("Hello, playground")
fmt.Println(sum(1, 2))
fmt.Println(mul(10, 5))