Skip to content

Instantly share code, notes, and snippets.

View celsojr's full-sized avatar
🏠
Working from home

Celso Jr celsojr

🏠
Working from home
View GitHub Profile
@celsojr
celsojr / index.html
Created July 23, 2023 19:19
Simple colored triangle with html and css only. Just for fun imitating the CG api triangles.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
body {
background-color: black;
display: flex;
@celsojr
celsojr / Factorial.cs
Last active July 30, 2021 02:29
Factorial operation with csharp 8 in a functional style (no Tail Call, no TCO)
using System;
using static System.Console;
namespace Snippets
{
static class Program
{
static void Main()
{
static long Fact(long x)
@celsojr
celsojr / Await.cs
Last active August 5, 2021 21:22
Simple custom awaiter
using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
static class Program
{
static async Task Main()
{
Console.WriteLine("One second pls...");
@celsojr
celsojr / App.cs
Last active August 8, 2021 02:20
Small experiment with the parallel programming model and the thread-safe collection BlockingCollection
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
@celsojr
celsojr / StoragePlans.cs
Last active November 26, 2021 07:30
A program that lists all available storage plans
using System;
long n = 8;
for (int i = 0; i < 60; i++)
{
var storage = n << i;
Console.WriteLine($"{storage.Amount()} {storage.Unit()}");
}
static class Extensions
@celsojr
celsojr / CK62 Layers.AHK
Last active August 8, 2020 13:08
Customize the CK62 keyboard. More infos here: https://www.youtube.com/watch?v=cWivLDI0DnU
SetCapsLockState, AlwaysOff
CapsLock & /::Up
CapsLock & SC15D::Down
CapsLock & SC138::Left
CapsLock & SC11D::Right
CapsLock & l::Home
CapsLock & .::End
CapsLock & ,::Delete
CapsLock & `;::PgUp
CapsLock & '::PgDn
@celsojr
celsojr / BeginSecureTransaction.snippet
Last active May 8, 2020 12:13
Begin secure transaction with MSSMS
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone"/>
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
@celsojr
celsojr / RestoreDatabase.snippet
Last active May 8, 2020 23:52
Database restoration snippet for MSSMS
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone"/>
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
// POST api/v1/author/{authorId}/undo
/// <summary>
/// Undo a deleted action on Author
/// </summary>
/// <remarks>Undo a deleted action on Author</remarks>
/// <param name="authorId"></param>
[HttpPost("{authorId:length(24)}/undo", Name = nameof(UndoDeletedAuthor))]
[ProducesResponseType(StatusCodes.Status410Gone)]
[ProducesResponseType(StatusCodes.Status201Created)]
public async Task<IActionResult> UndoDeletedAuthor(string authorId)