Skip to content

Instantly share code, notes, and snippets.

View catwhocode's full-sized avatar

Cat who code catwhocode

View GitHub Profile
@catwhocode
catwhocode / insert.js
Created December 30, 2021 04:36
Connect to MongoDB and insert one data
const mongodb = require('mongodb')
const MongoClient = require('mongodb').MongoClient
const url = 'mongodb://localhost:27017/mydb'
MongoClient.connect(url, function(err, db){
if (err) throw err;
console.log('Connected to mydb')
const dbo = db.db('mydb')
@catwhocode
catwhocode / insert-many.js
Created December 30, 2021 09:47
Connect to MongoDB and insert many data
const mongodb = require('mongodb')
const MongoClient = require('mongodb').MongoClient
const url = 'mongodb://localhost:27017/mydb'
MongoClient.connect(url, function(err, db){
if (err) throw err;
console.log('Connected to mydb')
const dbo = db.db('mydb')
@catwhocode
catwhocode / showHide.html
Created January 13, 2022 14:14
Menampilkan dan Menyembunyikan Elemen HTML Menggunakan Javascript
<!DOCTYPE html>
<head><title>.</title>
</head>
<body>
<h3>Demo: Menampilkan dan Menyembunyikan Elemen Dengan Javascript</h3>
<button style="width:100px;" id="btnToggle" onclick="toggle()">Show</button>
<p id="teks" style="visibility:hidden">
Bridging Kamar BPJS 2021 Implementasi Bridging di RSUD ALIHSAN
Ketersediaan Kamar
#Monitoring Hasil bridging Live Production
https://faskes.bpjs-kesehatan.go.id/aplicares/#/app/dashboard
#Base Url
Development: https://dvlp.bpjs-kesehatan.go.id:8888/
Production: https://new-api.bpjs-kesehatan.go.id/
#Referensi Kamar
@catwhocode
catwhocode / NaiveBayes.py
Created February 19, 2022 06:42 — forked from tuttelikz/NaiveBayes.py
Naive Bayes From Scratch in Python
#How To Implement Naive Bayes From Scratch in Python
#http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/
#Dataset
#https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data
import csv
import math
import random
#Handle data
@catwhocode
catwhocode / progressbar.html
Created February 21, 2022 22:56
JS: Simple Progress Bar
<!DOCTYPE html>
<html>
<head>
<title>CountDown</title>
<!-- source: http://crowdforthink.com/blogs/how-to-create-a-countdown-timer-with-progress-bar-in-javascript -->
</head>
<body>
<progress value="0" max="3600" id="pbar" ></progress>
<p id="counting">3600</p>
@catwhocode
catwhocode / main.js
Created March 4, 2022 09:38
Javascript: Add scroll to top button
// source:
// https://twitter.com/Amit_T18/status/1499329628804112385
const scrollToTop = document.querySelector('.scrollToTop');
scrollToTop.addEventListener('click', () => {
window.scrollTo({top:0, behaviour:"smooth",})
});
@catwhocode
catwhocode / msaccess.php
Created March 5, 2022 10:06
PHP: Accessing MS Access Database
<!DOCTYPE html>
<html>
<head><title>phpAccessBrowser</title>
<style>
hr {border:1px solid #ccc;}
table th,td {border:solid 1px #ccc;padding:5px;}
table tr:hover {background-color:#00ffff;}
.tablename {font-size:larger;font-weight:bold;margin-bottom:10px;background-color:#ccc;padding:5px;margin-top:-5px;}
</style>
</head>
# [CONFIGURATION]
# Ensure WSL2 container is started and SSH is running
wsl sudo /etc/init.d/ssh start
# Ports to be forwarded
$ports = @(22) + @(6543,6544) + @(6800..6810);
# Change $addr to restrict connections to a particular interface IP
$listen_addr = '0.0.0.0';
@catwhocode
catwhocode / component.php
Created March 23, 2022 22:25
Laravel LiveWire: Hide session flash for a few seconds
<?php
public function save()
{
session()->flash('message','Errorrrrr');
$this->emit('alert_remove');
return;
}