Skip to content

Instantly share code, notes, and snippets.

View ilomon10's full-sized avatar
🐢
keep a beloved undangon - stay tuned!

Imanuel Pundoko ilomon10

🐢
keep a beloved undangon - stay tuned!
  • manjo
  • Manado, Sulawesi Utara, Indonesia
  • X @ilomon10
View GitHub Profile
@ilomon10
ilomon10 / components.md
Created February 26, 2018 13:52 — forked from iclanzan/components.md
UI Component Name Ideas

UI component names

As front-end developers we all know the pain of coming up with meaningful component names for CSS classes. I created this gist as a place to collect terms that are suitable as user interface component names.

Please contribute your own ideas!

Interactive components

  • button
@ilomon10
ilomon10 / install-opencv.sh
Created June 13, 2019 21:28 — forked from rodrigobaron/install-opencv.sh
Install OpenCV on Ubuntu or Debian
# SOURCE: (milq) https://github.com/milq/scripts-ubuntu-debian/blob/master/install-opencv.sh
# also http://milq.github.io/install-opencv-ubuntu-debian/
# KEEP UBUNTU OR DEBIAN UP TO DATE
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
@ilomon10
ilomon10 / client.py
Created February 27, 2020 05:52
Send image as base64 buffer from client (python opencv) to server (nodejs) using SocketIO
import cv2
import socketio #python-socketio by @miguelgrinberg
import base64
sio = socketio.Client()
sio.connect('http://x.x.x.x:xxxx)
cam = cv2.VideoCapture(0)
while (True):
@ilomon10
ilomon10 / draggable.js
Created August 31, 2020 08:27
Drag React Component with Handle
import React, { useState, useCallback } from 'react';
const Draggable = ({
children
}) => {
const [isDrag, setIsDrag] = useState(false);
const onDragEndHandler = useCallback((e) => {
setIsDrag(false);
}, []);
const onMouseDownHandler = useCallback((e) => {
@ilomon10
ilomon10 / mapLoop.js
Created September 19, 2020 10:12
Async await in loop
/**
* Ref: https://zellwk.com/blog/async-await-in-loops/
*/
const mapLoop = async _ => {
console.log('Start')
const promises = fruitsToGet.map(async fruit => {
const numFruit = await getNumFruit(fruit)
return numFruit
@ilomon10
ilomon10 / Guide.md
Created November 11, 2020 12:52
Auto start nodejs application with pm2
@ilomon10
ilomon10 / timestampParse.ts
Last active November 11, 2020 13:30
Parse any format of time
// Read:
// https://stackoverflow.com/a/12423012/8271526
// https://stackoverflow.com/a/9186301/8271526
function timestampParse(time: string | number): number {
let t = 0;
if (typeof time === "number")
if (/^[0-9]{10}$/.test(`${time}`)) // is unix
t = time * 1000;
@ilomon10
ilomon10 / passwordHash.js
Last active December 15, 2020 08:03
Hashing password with Crypto
// Ref: https://ciphertrick.com/salt-hash-passwords-using-nodejs-crypto/
'use strict';
var crypto = require('crypto');
/**
* generates random string of characters i.e salt
* @function
* @param {number} length - Length of the random string.
*/
@ilomon10
ilomon10 / AspectRatio.js
Created January 17, 2021 03:16
Aspect ratio react component
import React from 'react';
const AspectRatio = ({ children, className = "", ratio, style = {} }) => {
const r = ratio.split(":");
const val = 100 / parseFloat(r[0]) * parseFloat(r[1]);
return (
<div className={className} style={{ position: 'relative', width: "100%", paddingTop: `${val}%`, ...style }}>
<div style={{ position: 'absolute', top: 0, left: 0, height: "100%", width: "100%" }}>{children}</div>
</div>
)
@ilomon10
ilomon10 / figure.PNG
Last active February 22, 2021 12:54
Finds the volume of the truncated cone
figure.PNG