Skip to content

Instantly share code, notes, and snippets.

View LordSmurf's full-sized avatar
☢️

Jules LordSmurf

☢️
View GitHub Profile
@LordSmurf
LordSmurf / app.rs
Created January 20, 2023 18:15
Example of implementing defaults
use eframe::{egui, epi};
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "persistence", serde(default))] // if we add new fields, give them default values when deserializing old state
pub struct TemplateApp {
// Example stuff:
label: String,
// this how you opt-out of serialization of a member
@LordSmurf
LordSmurf / index.js
Created December 7, 2022 11:57
AOC 2022 - Day 4
const fs = require("fs/promises");
const _ = require("lodash");
const mainInput = "input.txt";
const example = "example.txt";
const example2 = "example2.txt";
async function readInput(fileName) {
const file = await fs.readFile(fileName, "utf-8");
return file.trim().replace(/\r/g, "").split("\n");
}
@LordSmurf
LordSmurf / index.js
Created December 5, 2022 01:53
AOC 2022 - Day 3
const fs = require("fs/promises");
const mainInput = "input.txt";
const example = "example.txt";
const example2 = "example2.txt";
async function readInput(fileName) {
const file = await fs.readFile(fileName, "utf-8");
return file.trim().replace(/\r/g, "").split("\n");
}
@LordSmurf
LordSmurf / index.js
Created December 3, 2022 20:51
AOC Day 2 Part 1
const fs = require("fs/promises");
const fileName = "input.txt";
async function readInput(fileName) {
const file = await fs.readFile(fileName, "utf-8");
return file.trim().replace(/\r/g, "").split("\n");
}
async function solveFirst(fileName) {
const inputs = await readInput(fileName);
print("Hello world!");