Skip to content

Instantly share code, notes, and snippets.

View InsiderJanggo's full-sized avatar
🏠
Working from home

Wisly ong InsiderJanggo

🏠
Working from home
View GitHub Profile
@InsiderJanggo
InsiderJanggo / useForm.ts
Created September 30, 2021 13:36
Custom hooks for form
import { useState } from "react";
type State = any;
const useForm = (initialstates: State) => {
const [values, setValues] = useState(initialstates);
const handleChange = (e: any) => {
setValues({
...values,
@InsiderJanggo
InsiderJanggo / users.sql
Created September 3, 2021 03:23
Simple User Table
CREATE TABLE `users`(
`id` INT NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`password` VARCHAR(255) NOT NULL,
`avatar` VARCHAR(255) NOT NULL DEFAULT 'default.png',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`username`)
@InsiderJanggo
InsiderJanggo / app.js
Created August 26, 2020 08:18
A Simple Discord OAUTH2 Login
const express = require('express');
const session = require('express-session');
const PORT = 3000;
const app = express();
app.set('port', PORT);
@InsiderJanggo
InsiderJanggo / upload.php
Created July 7, 2020 00:50
A Simple Upload script
<?php
// retrieve data file
$filename = $_FILES['berkas']['name'];
$tempname = $_FILES['berkas']['tmp_name'];
//specify the location of the file to be moved
$dirUpload = "terupload/";
// move the file