Skip to content

Instantly share code, notes, and snippets.

View mwafa's full-sized avatar
🍄
small touch big problem solved

Muhammad Wafa mwafa

🍄
small touch big problem solved
View GitHub Profile
@mwafa
mwafa / board.h
Created June 22, 2024 14:24
TOFU Board FIle
#ifndef __BOARD_TOFU_H__
#define __BOARD_TOFU_H__
#define TOFU_BUTTON1_PIN 33
#define TOFU_BUTTON2_PIN 25
#define TOFU_BUTTON3_PIN 32
#define TOFU_NOTIFICATION_PIN 4
#define TOFU_STEPUP_PIN 14
import { HamburgerIcon } from "@chakra-ui/icons"
import {
Box,
Button,
Flex,
HStack,
IconButton,
Image,
useDisclosure,
VStack,
@mwafa
mwafa / useObject.tsx
Created December 28, 2021 07:32
Custom Hook
import { useState } from "react"
export function useObject<T>(data: T) {
const [obj, setObj] = useState(data)
const updateObj = (state: Partial<T>) =>
setObj((last) => ({ ...last, ...state }))
return [obj, updateObj] as [T, (state: Partial<T>) => void]
}
@mwafa
mwafa / typescript.json
Created July 23, 2021 23:38
Typescript dan Typescript-React User Snippet for Vscode
{
"Create Next Api": {
"prefix": "nextapi",
"body": [
"import { NextApiRequest, NextApiResponse } from \"next\"",
"export default async (req: NextApiRequest, res: NextApiResponse) => {",
" try {",
" switch (req.method) {",
" default:",
" throw new Error()",
@mwafa
mwafa / debounce.md
Last active May 19, 2021 22:54
Debounce on React

Basic hook

function useDebounce(state, timeout){
  const [current, setState] = useState(state)

  useEffect(() => {
    const run = setTimeout(() => {
      setState(state)
 }, timeout)
@mwafa
mwafa / show-me.js
Created March 22, 2021 12:24
console me
console.log(
"%cSistem ini dibuat oleh:\n\n %c %c Muhammad Wafa \n",
"font-size: 16px",
"font-size:20px;padding:10px; background:url(https://github.com/mwafa.png) no-repeat;background-size: 40px 40px;",
"font-size: 20px; vertical-align:middle; font-weight:bold",
"\nGithub >> https://github.com/mwafa\n",
"\nLinkedin >>\n\n https://www.linkedin.com/in/muhammad-wafa-587440126/\n\n"
)
@mwafa
mwafa / server.yml
Created April 23, 2020 22:20
server spec
Server spec:
- RAM: 1024 MB
- CPU: 2 core
- Storage: 30 GB
Software Version:
Docker: version 18.09.7, build 2d0083d
Container:
- MYSQL: 5.7
- Redis: latest
@mwafa
mwafa / Fix iot.ino
Last active December 21, 2019 03:14
#include <SoftwareSerial.h>
#include <EEPROM.h>
#include <GravityTDS.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT22
#define pinTrig 3
#define pinEcho 4
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAA