Skip to content

Instantly share code, notes, and snippets.

@thebluefish
thebluefish / logging.rs
Last active November 3, 2020 03:39
A simple fern-based logging implementation demonstrating formatting for multiple outputs
use colored::*;
use log::*;
use std::{fs, thread::ThreadId};
/// Please ignore the evil that is parsing debug output
fn parse_thread_id(id: &ThreadId) -> String {
let id_str = format!("{:?}", id);
let parsed = (|| {
let start_idx = id_str.find('(')?;
@thebluefish
thebluefish / gsm.rs
Last active October 6, 2020 02:07
bevy game state manager prototype
use super::states;
use bevy::{prelude::*, ecs::{Schedule, ThreadLocalExecution, SystemId, TypeAccess, ArchetypeAccess, ParallelExecutor}};
use std::borrow::Cow;
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut AppBuilder) {
app
.add_resource(GameState::Stage1(SubState::Done))
@thebluefish
thebluefish / discord_logger.py
Created August 23, 2018 02:46
Basic discord.py-based logger wrapped in a class, runs in separate thread, provides thread-safe logging helpers, locks interactions to single whitelisted guild for security
import discord
from discord.ext import commands
from threading import Thread
import asyncio
import sys
import traceback
import datetime
TOKEN = ''
# Expects the following to contain IDs pulled from discord