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
import { match, Pattern } from 'ts-pattern' | |
/** | |
* Returns an element of the array matching given pattern or `null` | |
*/ | |
export const find = <T>(data: T[], query: Pattern<T>): T | undefined => | |
data | |
.find(item => | |
match(item) | |
.with(query, () => true) |
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
import { useEffect, useState } from 'react'; | |
const useHistory = <T>( initialValue: T[] = [] ) => { | |
const [isDirty, setIsDirty] = useState( false ); | |
const [step, setStep] = useState( 0 ); | |
const [history, setHistory] = useState<T[]>( initialValue ); | |
useEffect( () => { | |
console.log( { | |
isDirty, |
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 genericButton = document.querySelector('[type="submit"]') | |
const password_input = document.querySelector('[type="password"]') | |
const button = document.createElement('button') | |
button.setAttribute('type', 'button') | |
button.innerText = 'Show Password' | |
button.style = "margin-top: 5px;" | |
if ( genericButton ) { | |
button.setAttribute('class', genericButton.getAttribute('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
pub fn parse_markdown_link(_str_with_link: String) -> String { | |
let chars = _str_with_link.chars(); | |
let mut is_text = false; | |
let mut is_url = false; | |
let mut text : String = String::new(); | |
let mut url : String = String::new(); |
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
#!/bin/zsh | |
TEXT_DIM="\e[2m" | |
TEXT_BOLD="\e[1m" | |
TEXT_UNDERLINE="\e[4m" | |
TEXT_RED="\e[91m" | |
TEXT_BLACK="\e[30m" | |
TEXT_DEFAULT="\e[39m" | |
TEXT_RESET="\e[0m" | |
TEXT_YELLOW="\e[33m" |
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
name: Docker CI | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'develop' | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
inputs: |
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
// Super simple Switch case as React Functional Component | |
import React, { FC, Children, ReactElement } from "react"; | |
const Case: FC<{ value: SwitchValue } | { default: true }> = ( { children } ) => | |
<>{children}</>; | |
const checkCondition = ( condition, value ) => { | |
if ( condition instanceof Function && condition( value ) ) return true; | |
return condition === value; |
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
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> | |
- <System> | |
<Provider Name="Dwminit" /> | |
<EventID Qualifiers="32770">0</EventID> | |
<Version>0</Version> | |
<Level>3</Level> | |
<Task>0</Task> | |
<Opcode>0</Opcode> | |
<Keywords>0x80000000000000</Keywords> | |
<TimeCreated SystemTime="2021-03-24T22:25:17.9398436Z" /> |
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
ERROR: Command errored out with exit status 1: | |
command: /Users/federicovitale/Developer/Chili/chili-aquaman/acquaman/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/m9/7q3cfhks1tzbf400djhj35cw0000gn/T/pip-install-03kuzaxi/confluent-kafka_b002a784c6954fb897cef23347b69f60/setup.py'"'"'; __file__='"'"'/private/var/folders/m9/7q3cfhks1tzbf400djhj35cw0000gn/T/pip-install-03kuzaxi/confluent-kafka_b002a784c6954fb897cef23347b69f60/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/m9/7q3cfhks1tzbf400djhj35cw0000gn/T/pip-record-h2pvufp1/install-record.txt --single-version-externally-managed --compile --install-headers /Users/federicovitale/Developer/Chili/chili-aquaman/acquaman/include/site/python3.9/confluent-kafka | |
cwd: /private/var/folders/m9/7q3cfhks1tzbf400djhj35cw0000gn/T/pip-install-03kuzaxi/co |
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
# | |
# https://downfor.io | |
# Usage: | |
# $ isDown google.com | |
# $ isDown fedevitale.dev | |
# | |
function isDown() { | |
curl "https://api-prod.downfor.cloud/httpcheck/$1" \ | |
--silent \ | |
--fail \ |