Skip to content

Instantly share code, notes, and snippets.

View 200sc's full-sized avatar

Patrick Stephen 200sc

  • strongDM
  • Minneapolis, MN
View GitHub Profile
@200sc
200sc / index.js
Last active November 8, 2015 16:35
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var Crafty = require('craftyjs');
Crafty.init(600, 300);
Crafty.background('rgb(127,127,127)');
//Paddles
paddlea = Crafty.e("Paddle, 2D, WebGL, Color, Multiway")
.attr({ x: 20, y: 100, w: 10, h: 100 })
package main
// Build cross-compiles packages on set of
// OS and architecture pairs.
import (
"bytes"
"flag"
"fmt"
"os"
All public gists https://gist.github.com/200sc
Copyright 2017, Patrick Stephen
MIT License, http://www.opensource.org/licenses/mit-license.php
package main
import (
"bitbucket.org/oakmoundstudio/plasticpiston/plastic"
"bitbucket.org/oakmoundstudio/plasticpiston/plastic/collision"
"bitbucket.org/oakmoundstudio/plasticpiston/plastic/entities"
"bitbucket.org/oakmoundstudio/plasticpiston/plastic/event"
"bitbucket.org/oakmoundstudio/plasticpiston/plastic/render"
"image/color"
"math/rand"
package main
import (
"image/color"
"time"
"github.com/200sc/go-dist/floatrange"
"bitbucket.org/oakmoundstudio/oak"
"bitbucket.org/oakmoundstudio/oak/collision"
package main
// This is a gist copy of https://github.com/200sc/collision-demo/blob/master/core.go
import (
"image/color"
"bitbucket.org/oakmoundstudio/oak"
"bitbucket.org/oakmoundstudio/oak/collision"
"bitbucket.org/oakmoundstudio/oak/entities"
@200sc
200sc / holes.go
Last active October 25, 2017 22:10
a function to get holes from a 2d boolean array
func GetHoles(sh Shape, w, h int) [][]intgeom.Point {
flooding := make(map[intgeom.Point]bool)
for x := 0; x < w; x++ {
for y := 0; y < h; y++ {
if !sh.At(x, y) {
flooding[intgeom.Point{x,y}] = true
}
}
package render
func Recolor(cMap[color.Color]color.Color) Modification {
return func(rgba image.Image) *image.RGBA {
bds := rgba.Bounds()
newRgba := image.NewRGBA(bds)
for x := 0; x < bds.Max.X; x++ {
for y :=0; y < bds.Max.Y; y++ {
@200sc
200sc / convert.go
Created April 12, 2019 14:33
Convert csvs with rows of fields to rows of objects
package main
import (
"encoding/csv"
"fmt"
"os"
"strconv"
)
type Record struct {
package main
import (
"encoding/csv"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"