Skip to content

Instantly share code, notes, and snippets.

View TFlexSoom's full-sized avatar
🃏
Playing Magic

Tristan Hilbert TFlexSoom

🃏
Playing Magic
View GitHub Profile
"""
filename: highlight_problem.py
author: Tristan Hilbert
desc: This was a problem I brought up to a research fellow.
I was trying to show that storing highlighted text that can
have multiple layers is difficult. Below I have created a python
function and a series of tests. Try to get the tests to pass by
modifying the function below. Feel free to add functions but do not modify the tests!
"""
class_name Behavior
const behavior_owner_field_name: String = "behaviors"
const behavior_owner_keyed_prefix: String = "behavior_item_"
static func assertAssignParent(self_ref: Node, host: Node):
if host != null:
return host
var possible = self_ref.get_node(NodePath(".."))
@TFlexSoom
TFlexSoom / JsonParser.hs
Created July 20, 2023 01:01
Toy JsonParser For Haskell Written For Parsec
module Text.JsonParser
( Json (..),
withFileAndMapper,
)
where
import qualified Data.Either as Either
import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
import qualified Text.Parsec as Parsec
@TFlexSoom
TFlexSoom / try-finally-yield.py
Created November 23, 2021 22:59
Try Finally Testing With Asynchronous and Synchronous Generators
import time
import logging
import asyncio
def get_generator():
try:
yield "hello there!"
finally:
logging.info("Finally Block Has Been Run!")
// Globals for the browser:
// window, document, JSON, String, Math
var canvas = document.getElementById("canvas");
var turtle = canvas.getContext("2d");
var score1 = 0;
var score2 = 0;
var ball = {
"""
TODO
2nd, Because I used recursion for the Quicksort it seems to run much slower than insertion sort on the last run.
"""
#####################################################################
# Quicksort
def partition(lst, start, end):
pivot = lst[start]
start_i = start
end_i = end
# Step 1 Setup the Stage
stage.set_background("winter")
stage.disable_all_walls()
stage.set_gravity(0.2)
snowflakes = []
# Step 2 Function to Spawn Snowflakes
answer = random.randint(1,1000)
last_guess = 0
num_guesses = 0
def make_a_guess(guess):
global last_guess, answer, num_guesses
last_guess = guess
num_guesses += 1
# Right Here goes the next lines of code!
import java.awt.*;
public class LinesMain {
public static void main(String[] args) {
TristansFrame frame = new TristansFrame();
Window window = new Window(null, null);
Stroke stroke = new BasicStroke(2.0f);
@TFlexSoom
TFlexSoom / CodestersHangman.py
Created June 10, 2020 23:50
A Codesters Hangman Game
display = codesters.Text("____________", 0, 0, "red")
display.set_size(2)
wrong_text = codesters.Text("Wrong Guesses: 0", -150, 200, "red")
## WAY 1
pool = []
pool.append("treasure")
pool.append("computer")