Skip to content

Instantly share code, notes, and snippets.

View scarletquasar's full-sized avatar
:electron:
I may be slow to respond.

Scarlet Rose scarletquasar

:electron:
I may be slow to respond.
View GitHub Profile
@scarletquasar
scarletquasar / RecurrentDateTimeOffset.cs
Created October 20, 2024 01:51
RecurrentDateTimeOffset Draft
namespace FitLivre.DataStructures
{
public class RecurrentDateTimeOffset
{
private readonly RecurrentDateTimeKind _recurrencyKind;
private readonly DateTimeOffset[]? _fixedFiniteOccurrences;
private readonly RecurrentWeekDayAndTime[]? _perWeekOccurrences;
private readonly RecurrentMonthDayAndTime[]? _perMonthOccurrences;
private readonly RecurrentYearMonthDayAndTime[]? _perYearOccurrences;
private readonly TimeSpan _tolerance;
@scarletquasar
scarletquasar / accentsAutohotkey.md
Created February 19, 2024 05:21
[Script] Accents in american keyboard using Autohotkey
Combinations Alt Alt + Ctrl Alt + Shift Alt + Shift + Ctrl Right Alt
A á à Á À ã
E é è É È
I í ì Í Ì
O ó ò Ó Ò õ
U ú ù Ú Ù
@scarletquasar
scarletquasar / sortedWords.ts
Created October 4, 2023 19:18
sorted words
const words = ["cat", "act", "tac", "art", "tar"];
const expectedOutput = {
"act": ["cat", "act", "tac"],
"atr": ["art", "tar"],
}
const sortedWords = words
.map(word => word.split(''))
.map(array => array.sort())
class Either<TLeft, TRight> {
protected leftValue: TLeft = null;
protected rightValue: TRight = null;
static left<T>(value: T) {
const either = new Either<T, any>();
either.leftValue = value;
return either;
}
@scarletquasar
scarletquasar / deconstruct.cs
Created December 24, 2022 19:46
Deconstruction implementation C#
class Test
{
public void Deconstruct(out string a, out string b)
{
a = "hello";
b = "world";
}
}
(string a, string b) = new Test();
@scarletquasar
scarletquasar / conditionalSwitchCase.md
Created December 20, 2022 21:59
Switch case with conditions
string s = "0";
switch (s)
{
    case [var c] when c is >= '0' and <= '9':
        Console.WriteLine("break"); 
        break;
    default: break;
}
@scarletquasar
scarletquasar / listify.cs
Created November 28, 2022 00:32
create false 'enumerable' type
public class Listify
{
public int Start { get; }
public int End { get; }
public Listify(int start, int end)
{
Start = start;
End = end;
}
@scarletquasar
scarletquasar / gist.md
Last active September 8, 2022 21:39
RefactorApplyForEntriaGist

Entria

🔥 Applying

To apply to Entria as an intern we wanna know how fast you can learn our stack and how good do you use learn in public. Be creative, code to impress. Build a CRUD GraphQL + Relay hooks. You can also for help on twitter (learn in public) or slack.

/*
* Dynamic assignments to Objects in JavaScript:
* In JavaScript, object field names and other factors can be dynamic because
* all the objects in the language are 'dynamic' and the types/values
* are defined in runtime.
*/
/*
* Getting started: this function returns a dynamic object that depends
* on the passed boolean argument.
const options = {
upload: () => <UploadScreen />,
platformSelection: () => <PlatformSelectionScreen />,
login: => () => <LoginScreen />,
details: => () => <DetailsScreen />,
review: => () => <ReviewScreen />,
finish: => () => <UploadButton />
}
return (