Skip to content

Instantly share code, notes, and snippets.

View solanoize's full-sized avatar

Solanoize solanoize

View GitHub Profile
app.post('/person', function (req, res) {
var personInfo = req.body; //Get the parsed information
if (!personInfo.name || !personInfo.age || !personInfo.nationality) {
res.render('show_message', {
message: "Sorry, you provided worng info",
type: "error"
});
} else {
var newPerson = new Person({
@solanoize
solanoize / table.component.html
Created September 22, 2023 06:42
Dynamic Table
<table class="table">
<tbody>
<tr>
<td *ngFor="let value of objects?.values(limit)">
{{ value }}
</td>
</tr>
<tr *ngFor="let obj of data">
<ng-container *ngFor="let item of obj | keyvalue;">
<td *ngIf="objects?.keys(limit)?.includes(item.key)">{{ item.value }}</td>
@solanoize
solanoize / App.jsx
Created August 31, 2023 11:07
Update Array Item in React useState
import { useState } from "react";
import Message from "./components/Message";
import Motor from "./components/Motor"
import Uhuy from "./components/Uhuy"
const App = () => {
let [data, setData] = useState({
name: "",
items: [
@solanoize
solanoize / index.html
Created August 24, 2023 13:00
pertemuan4
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<input type="number" id="angka1" >
/**
* Yanwar Solahudin
* ================
* I built this simple code to implement the game logic of card combat and
* using energy scores. I enjoyed it, and the code is rudimentary as it
* needs to be updated to take advantage of the defense features and possibly
* additional game logic if the cards go over two.
*/
let temmplatePlayer = {
name: "",
const computedTotal = useMemo(() => {
let sum = 0;
if (itemSales.length > 0) {
for (let item of itemSales) {
sum += item.price * item.qty;
}
}
setSale((values) => ({ ...values, total: sum }));
return null;
}, [itemSales]);
import { useEffect, useState } from "react";
import { Button, Form } from "react-bootstrap";
const POSPage = () => {
const [total, setTotal] = useState(0);
const [data, setData] = useState([
{
id: 1,
name: "Poduct 1",
price: 10000,
@solanoize
solanoize / async01.js
Created March 24, 2023 10:41
Asynchronous Programming di JavaScript
// Aku akan menyelesaikannya nanti!
// Fungsi yang berjalan paralel dengan fungsi lain disebut asinkron
// set time out
setTimeout(() => {
document.getElementById("demo").innerHTML = "Urutan 1";
}, 3000);
setTimeout(() => {
document.getElementById("demo").innerHTML = "Urutan 2";
@solanoize
solanoize / index.html
Created March 17, 2023 13:46
Hitung Progress JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="number" placeholder="Target BAB" class="targetBab" />
var buttonEqual = document.querySelector(".equal");
var buttonDelete = document.querySelector(".delete");
var inputText = document.querySelector(".output");
var actions = document.querySelectorAll(".action");
var clear = document.querySelector(".clear");
let evals = [];
buttonEqual.addEventListener("click", function () {
let evaluate = inputText.value;
let result = Function(`return ${evaluate}`);