Skip to content

Instantly share code, notes, and snippets.

View xeniode's full-sized avatar
Drilling curve balls for breakfast.

ZX xeniode

Drilling curve balls for breakfast.
View GitHub Profile
@xeniode
xeniode / useToggle.js
Last active July 4, 2022 03:23
[Custom React Hook - useToggle] A custom react hook to toggle between true or false #react #javascript #reactHooks
import { useState } from "react";
export default function useToggle(defaultValue){
const [value, setValue] = useState(defaultValue);
function toggleValue(value) {
setValue(currValue => typeof value === "boolean" ? value : !currValue)
}
return [value, toggleValue]
@xeniode
xeniode / currentDateTime.js
Last active March 24, 2020 16:32
[JS-Current Date Time Func] #javascript #datetime
export function getCurrentDate(separator=''){
let newDate = new Date()
let date = newDate.getDate();
let month = newDate.getMonth() + 1;
let year = newDate.getFullYear();
return `${year}${separator}${month<10?`0${month}`:`${month}`}${separator}${date}`
}
@xeniode
xeniode / keybase.md
Last active April 9, 2020 22:42
Keybase Proof #KeybaseProof

Keybase proof

I hereby claim:

  • I am garretjames on github.
  • I am garretjames (https://keybase.io/garretjames) on keybase.
  • I have a public key ASAYuuBeEADzn-CSHKtZGMKL6yOLRgaOBGRtOGk8cJ-9pwo

To claim this, I am signing this object: