Skip to content

Instantly share code, notes, and snippets.

@freiguy1
freiguy1 / wasm4.zig
Created December 23, 2021 20:14
Wasm4.zig with stub impl
// WASM-4: https://wasm4.org/docs
// ┌───────────────────────────────────────────────────────────────────────────┐
// │ │
// │ Platform Constants │
// │ │
// └───────────────────────────────────────────────────────────────────────────┘
pub const CANVAS_SIZE: u32 = 160;
@freiguy1
freiguy1 / Grunt.scala
Created March 20, 2015 04:00
Using grunt to compile runtime assets in Play Framework app
import sbt._
import Keys._
import java.net._
import java.io.File
import play.PlayRunHook
/*
Grunt runner should be in project directory to be picked up by sbt
*/
object Grunt {
### Keybase proof
I hereby claim:
* I am freiguy1 on github.
* I am freiguy1 (https://keybase.io/freiguy1) on keybase.
* I have a public key whose fingerprint is E01F 9B01 451F 6626 159C C6DB 66F5 87C6 1E2C 53CC
To claim this, I am signing this object:
@freiguy1
freiguy1 / generate_roundrobin.rs
Created November 6, 2014 21:06
Some code for generating a round robin tourney.
fn generate_roundrobin(teams: &Vec<IdAndName>) -> Vec<Vec<(&IdAndName, &IdAndName)>> {
let static_team: &IdAndName = &teams[0];
let mut other_teams: Vec<&IdAndName> = teams.iter().skip(1).collect();
let mut result: Vec<Vec<(&IdAndName, &IdAndName)>> = Vec::new();
for _ in range(0u, teams.len() - 1) {
let mut session: Vec<(&IdAndName, &IdAndName)> = Vec::new();
session.push((other_teams[0], static_team));
for i in range(0u, (other_teams.len() - 1) / 2) {
@freiguy1
freiguy1 / securesocial-init.sql
Last active August 29, 2015 13:57
This is an initialization script for the securesocial user store. It does not contain a token table, because I kept that in memory, for now. Check out my blog post at http://ethanfrei.com/?p=336 for more info.
CREATE TABLE user (
userId INT AUTO_INCREMENT,
PRIMARY KEY(userId));
CREATE TABLE passwordInfo (
passwordInfoId INT AUTO_INCREMENT,
hasher VARCHAR(128) NOT NULL,
password VARCHAR(128) NOT NULL,
salt VARCHAR(128),
PRIMARY KEY(passwordInfoId));
@freiguy1
freiguy1 / ajax.js
Last active December 19, 2015 01:38
Ajax utility file
/*
********************UTILITY*********************
*/
var Ajaxable = function(url){
this.create = function(newObject, onDone, onFail) {
$.ajax({
type: "POST",
url: "/api/" + url,
data: JSON.stringify(newObject),