Skip to content

Instantly share code, notes, and snippets.

View YannickFricke's full-sized avatar
:octocat:
A ❤️ for open source

Yannick Fricke YannickFricke

:octocat:
A ❤️ for open source
View GitHub Profile
@YannickFricke
YannickFricke / content_block.ex
Created December 23, 2023 18:33
Ecto CMS block data casting
defmodule Cms.ContentBlock do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
alias Cms.Blocks.TextBlock
@supported_block_types [
@YannickFricke
YannickFricke / day04.ex
Created December 5, 2023 22:15
AoC 2023 Day 4
defmodule AdventOfCode2023.Day04 do
@moduledoc false
require IEx
require Logger
def run do
input =
"lib/advent_of_code2023/inputs/04/part1.txt"
|> File.read!()
@YannickFricke
YannickFricke / HypeSocket.ts
Last active July 9, 2024 21:54
HypeRate Websocket
type ChannelSpecificCallback = (heartbeat: number) => void | Promise<void>;
type GeneralCallback = (
channel: string,
heartbeat: number,
) => void | Promise<void>;
/**
* An interface for describing the options which are needed by the HypeRateWebsocket
*
@YannickFricke
YannickFricke / day02.ex
Last active December 2, 2023 11:47
AoC 2023 Day 2
defmodule AdventOfCode2023.Day02 do
require Logger
def run() do
input =
File.read!("lib/advent_of_code2023/inputs/02/part1.txt")
|> String.trim()
|> String.split("\n", trim: true)
part1(input)
@YannickFricke
YannickFricke / day01.ex
Created December 1, 2023 14:28
AoC 2023 Day 01
defmodule AdventOfCode2023.Day01 do
def run() do
part1()
part2()
end
defp part1() do
File.read!("lib/advent_of_code2023/inputs/01/part1.txt")
|> String.trim()
|> String.split("\n", trim: true)
@YannickFricke
YannickFricke / Console.hpp
Last active October 23, 2023 19:15
A cross-plattform solution for getting the console columns and rows in C++
#ifdef WIN32
#include <windows.h>
#else
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#endif
class Console {
public:
import { TokenType } from "./TokenType";
import { Keyword } from "./Keywords";
import { SpecialCharacters } from "./SpecialCharacters";
import { type Token } from "./Token";
export type ExpectedToken =
| [TokenType.Identifier]
| [TokenType.String]
| [TokenType.Char]
| [TokenType.Number]
@YannickFricke
YannickFricke / Phoenix.code-snippets
Created August 28, 2021 20:18
Elixir VSCode Snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@YannickFricke
YannickFricke / toggle.js
Created June 7, 2021 10:35
Class Toggler
document.querySelectorAll(".fake-button").forEach((element) =>
element.addEventListener("click", () => {
document.querySelector(element.dataset["target"]).classList.toggle("active");
})
);
@YannickFricke
YannickFricke / .vimrc
Created October 9, 2020 08:59
CoC code fix nvim
"Remap keys for applying codeAction to the current line.
nmap <a-cr> <Plug>(coc-codeaction)
"Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)