This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type MutexGuard<T> = Readonly<{ | |
id: string, | |
get: () => T, | |
set: (value: T) => void, | |
unlock: () => void | |
}>; | |
export type Mutex<T> = Readonly<{ | |
lock(): Promise<MutexGuard<T>> | |
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const types: Readonly<{[K: string]: any}> = Object.freeze({ | |
NaN: 'nan', | |
String: 'string', | |
Number: 'number', | |
Boolean: 'boolean', | |
Object: 'object', | |
Undefined: 'undefined', | |
Null: 'null', | |
Function: 'function', | |
Class: 'class', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
title Configurando VSCode | |
echo Adicionando C:\MinGW\bin ao PATH | |
powershell -Command "function Add-Path($path) { $pathContent = [Environment]::GetEnvironmentVariable('path', 'user'); if ($pathContent -ne $null) { if (!($pathContent -split ';' -contains $path)) { $pathContent = $pathContent + [IO.Path]::PathSeparator + $path; [Environment]::SetEnvironmentVariable('Path', $pathContent, 'User'); } } } Add-Path('C:\MinGW\bin')" | |
echo Instalando pacotes do VSCode | |
cmd /c code --force --install-extension MS-CEINTL.vscode-language-pack-pt-BR --install-extension ms-vscode.cpptools --install-extension ms-vscode.cpptools-extension-pack --install-extension danielpinto8zz6.c-cpp-compile-run --install-extension danielpinto8zz6.c-cpp-project-generator | |
echo Iniciando VSCode | |
code --locale pt-BR | exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef UNICODE_H | |
#define UNICODE_H | |
#include <locale.h> | |
#include <wchar.h> | |
#include <stdarg.h> | |
#include <stdio.h> | |
#include <wctype.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
/* | |
Essa é uma função que eu criei parecida com o scanf | |
O intuito é ler um texto digitado pelo teclado com um tamanho máximo determinado | |
Recebe como parâmetro: | |
1. uma mensagem pedindo para o usuário digitar | |
2. um limite máximo de caracteres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ExtendableHTMLElement { | |
/** | |
* Creates a new class that inherits all of the element's properties and methods | |
* @param {string} tagName - HTML Tag name | |
*/ | |
constructor(tagName) { | |
const element = document.createElement(tagName); | |
const constructor = Object.getPrototypeOf(this); | |
const extraConstructors = [Object.getPrototypeOf(constructor) ?? null]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tfm.events = { | |
_handlers = {}, | |
handle = function (self, events) | |
for _, event in next, events do | |
if not _G[event] then | |
self._handlers[event] = {} | |
_G[event] = function(...) | |
self:emit(event, table.unpack(arg)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function table.every(self, predicate) | |
for key, value in next, self do | |
if not predicate(value, key) then | |
return false | |
end | |
end | |
return true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ArrayUtil | |
import ( | |
"sort" | |
"golang.org/x/exp/constraints" | |
) | |
// The IndexOf method returns the index of the first occurrence of a value in an array. If not found, it returns -1. | |
func IndexOf[T comparable](array []T, value T) int { |