Skip to content

Instantly share code, notes, and snippets.

View ilhamgusti's full-sized avatar
👀
whoopss

ilhamgusti ilhamgusti

👀
whoopss
View GitHub Profile
// https://stackoverflow.com/questions/51403615/spread-syntax-ecmascript
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
@ilhamgusti
ilhamgusti / cancelfetch.js
Last active October 8, 2020 10:40
cancel fetching axios redux
useEffect(() => {
const cancelToken = customAxios.CancelToken.source();
dispatch(fetchDataABC(match.params.id, cancelToken.token));
return () => {
cancelToken.cancel(`Cancel fetchData ${match.params.id}`)
}
}, []);
@ilhamgusti
ilhamgusti / debounce.js
Created February 19, 2020 02:53
menunda event berjalan. menjalankan event ketika sekian detik aksi
function debounced(delay, fn) {
let timerId;
return function (...args) {
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(() => {
fn(...args);
timerId = null;
}, delay);
@ilhamgusti
ilhamgusti / decode.js
Created December 16, 2019 10:52
Decoding HTML tag
function decodeHtml(str) {
//buat element baru
let d = document.createElement("div");
//masukan nilai
d.innerHTML = str;
//return nilai yang telah dimasukan
return typeof d.innerText !== 'undefined' ? d.innerText : d.textContent;
}
function useInterval(callback) {
const savedCallback = useRef();
useEffect(() => {
savedCallback.current = callback;
});
useEffect(() => {
function tick() {
savedCallback.current();
@ilhamgusti
ilhamgusti / gradient-animation.css
Created July 21, 2019 12:14
gradient animation
background: linear-gradient(270deg, #b012f9, #2935ea, #25e399);
background-size: 600% 600%;
-webkit-animation: .bg-a-gradient 15s ease infinite;
-moz-animation: .bg-a-gradient 15s ease infinite;
-o-animation: .bg-a-gradient 15s ease infinite;
animation: .bg-a-gradient 15s ease infinite;
@-webkit-keyframes .bg-a-gradient {
0%{background-position:0% 50%}
@ilhamgusti
ilhamgusti / sftp.json
Created June 25, 2019 00:14
SFTP config VSCode
[{
"name": "ini config root pemrograman",
"host": "ini host",
"protocol": "ftp",
"port": 21,
"username": "ini username",
"password": "ini password",
"remotePath": "/",
"uploadOnSave": true,
"downloadOnOpen": true,
server {
listen 80;
listen [::]:80;
# Log files for Debugging
access_log /var/log/nginx/laravel-access.log;
error_log /var/log/nginx/laravel-error.log;
# Webroot Directory for Laravel project
root /var/www/example.com/public;
@ilhamgusti
ilhamgusti / index.html
Created August 4, 2018 02:45
Simple Pure CSS3 404 Error Page
<body>
<section id="not-found">
<div id="title">Simple Pure CSS3 &bull; 404 Error Page</div>
<div class="circles">
<p>404<br>
<small>PAGE NOT FOUND</small>
</p>
<span class="circle big"></span>
<span class="circle med"></span>
<span class="circle small"></span>