Skip to content

Instantly share code, notes, and snippets.

View lilrooness's full-sized avatar

Joseph Frangoudes lilrooness

View GitHub Profile
@lilrooness
lilrooness / index.html
Created March 23, 2024 10:58
Simple auidio recording based on MDN Media Stream Article
<html>
<head>
</head>
<body>
<button id="record">Record</button>
<button id="stop">Stop</button>
<div id="soundclips"></div>
@lilrooness
lilrooness / string_split.cpp
Last active November 17, 2021 22:00
Split an STL string without using STL just because
#include <string>
#include "stdio.h"
#include "string.h"
int _get_first_string_chunk(
const char *in,
char *out_buffer,
int buffer_length,
char delimiter,
# Spawn example
spawn(fn() -> IO.inspect(5 * 5) end)
# Spawn extended example
a = fn(x) ->
import random
PRODUCTION_PRICES = [10, 20, 30]
CYCLE = 0
class Person(object):
def __init__(self, endowment, productivities, preferences, investmentPref, savingsPref, riskReserve):
self.liquidity = endowment
self.productivities = productivities
self.preferences = preferences
@lilrooness
lilrooness / Clickable.lua
Created January 25, 2018 22:29
defold clickable game object helper module
local M = {}
local N = {}
function N.toggleSelect(self)
if self.isHovering then
self.isHovering = false
if not self.isSelected then
msg.post("SpriteContainer#white_sprite", "enable")
msg.post("SpriteContainer#green_sprite", "disable")
@lilrooness
lilrooness / mouse.script
Created January 24, 2018 21:18
Defold mouse script
function init(self)
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
if action_id == nil then
local pos = go.get_position()
pos.x = action.x
pos.y = action.y
(function() {
var context = document.getElementById('canvas').getContext('2d');
var points = [];
var npoints = 200;
var grid = [];
var gridWidth = 400;
@lilrooness
lilrooness / commander.py
Last active April 19, 2016 22:54
Prototype for commander main gameplay loop
def ALERT(message):
print("ALERT: " + message)
class Game:
def __init__(self):
self.state = {
"buildQueue": [],
"steel": 100,
"credits": -100000,
"turnsLeft": 100,
@lilrooness
lilrooness / core.cljs
Created December 27, 2015 14:03
Clojure spritesheet rendering
(ns resource.core
(:require [clojure.browser.repl :as repl]
[resource.sprites :as sprites]
))
;; (defonce conn
;; (repl/connect "http://localhost:9000/repl"))
(enable-console-print!)
(ns counter.core
(:require [clojure.browser.repl :as repl]))
;; (defonce conn
;; (repl/connect "http://localhost:9000/repl"))
(enable-console-print!)
(def ctr (atom {:count 0}))