Skip to content

Instantly share code, notes, and snippets.

View codbugs's full-sized avatar
🙂

Coding Bugs codbugs

🙂
View GitHub Profile
@codbugs
codbugs / pool_metadata.json
Last active May 29, 2021 17:29
Pet Rescue Test Stake Pool Definition
{
"name": "PetRescuePool",
"description": "The test pool for recovering funds to pet rescue centers",
"ticker": "PETRP",
"homepage": "https://www.stillnopage.com"
}
@codbugs
codbugs / useLocalStorage.js
Created December 1, 2021 22:24
React hook for using LocalStorage as the data repository.
import { useEffect, useState } from 'react';
export default function useLocalStorage(key, default_value) {
const [persistedData, setPersistedData] = useState(default_value);
useEffect(() => {
const value = localStorage.getItem(key);
const isNotNull = value !== null;
const isNotUndefined = value !== undefined;
@codbugs
codbugs / useBoolean.js
Created December 1, 2021 22:26
React hook for working with boolean values.
import { useState } from 'react';
export default function useBoolean(initial_value) {
const [value, setValue] = useState(initial_value);
const setTrue = () => setValue(true);
const setFalse = () => setValue(false);
return [value, setTrue, setFalse];
}
@codbugs
codbugs / Download-CsvGistFiles.ps1
Last active February 16, 2022 22:02
Los ficheros de este gist han sido creados con el objetivo de incluirlos en el artículo con título "Mejora el paso de parámetros en tus scripts de PowerShell". The files in this gist have been created with the purpose of including them in the article titled "Improve how to provide parameters in your PowerShell scripts" on the Dev.To platform.
param(
[Parameter(Mandatory=$true)]
[String] $ConfigurationFilePath
)
# Reading the configuration file
$Configuration = Get-Content $ConfigurationFilePath
$Configuration = Import-Csv -Path $ConfigurationFilePath -Delimiter ';'
$Configuration | Foreach {
@codbugs
codbugs / CountAny-Files.ps1
Last active April 2, 2022 19:57
Los ficheros de este gist han sido creados con el objetivo de incluirlos en el artículo con título "Una forma fácil de pasar parámetros en tus scripts de PowerShell" en la plataforma Dev.To. The files in this gist have been created with the purpose of including them in the article titled "An easy way to provide parameters in your PowerShell scri…
param(
[Parameter(Mandatory=$true)]
[String] $Location,
[Parameter(Mandatory=$true)]
[String[]] $Extensions
)
$CmdParams = @{
Path = $Location
@codbugs
codbugs / Merge-CsvFiles.ps1
Last active April 5, 2022 07:23
This PowerShell script merge several CSV files in just one. All CSV files must have the same headers and in the same order to be effective.
param(
[Parameter(Mandatory=$true)]
[String] $Location,
[Parameter(Mandatory=$true)]
[String] $NameFilter,
[Parameter(Mandatory=$true)]
[String] $OutputFile
)