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 / 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)
import { Identifiable } from '@applier/framework/dist/definitions/Identifiable';
import { v4 } from 'uuid';
import { IRepository } from '@applier/framework/dist/definitions/IRepository';
export const useRepository = <T extends Identifiable>(entities: T[], setEntities: (newValues: T[]) => void): IRepository<T> => {
return {
getAll: function() {
return entities;
},
insert: function(entity: T) {
@YannickFricke
YannickFricke / Knex.js
Last active August 15, 2020 19:09
Select mutliple IDs with TypeORM and Knex.JS from a SQLite database
let queryBuilder = knex<Message>('')
.from('message');
if (!user.isGameMaster) {
queryBuilder = queryBuilder
.whereIn(
'recipient',
all.concat('Alle'),
)
.or
@YannickFricke
YannickFricke / debug-grid.css
Created June 13, 2020 01:23 — forked from kesor/debug-grid.css
debug css grid
/* DEBUG Grid */
body {
position: relative;
background: blue;
}
body:after {
background-size: var(--grid-size) var(--grid-size);
background-repeat: repeat;
background-image:
linear-gradient(