Skip to content

Instantly share code, notes, and snippets.

Avatar
👀
whoopss

ilhamgusti ilhamgusti

👀
whoopss
View GitHub Profile
@ilhamgusti
ilhamgusti / index.html
Created Aug 4, 2018
Pure CSS 404 Error Page
View index.html
<div id="clouds">
<div class="cloud x1"></div>
<div class="cloud x1_5"></div>
<div class="cloud x2"></div>
<div class="cloud x3"></div>
<div class="cloud x4"></div>
<div class="cloud x5"></div>
</div>
<div class='c'>
<div class='_404'>404</div>
View error-pages.markdown
View nginx-laravel.conf
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;
View gradient-animation.css
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%}
View useInterval.js
function useInterval(callback) {
const savedCallback = useRef();
useEffect(() => {
savedCallback.current = callback;
});
useEffect(() => {
function tick() {
savedCallback.current();
@ilhamgusti
ilhamgusti / decode.js
Created Dec 16, 2019
Decoding HTML tag
View decode.js
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;
}
@ilhamgusti
ilhamgusti / index.html
Created Aug 4, 2018
Simple Pure CSS3 404 Error Page
View index.html
<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>
@ilhamgusti
ilhamgusti / debounce.js
Created Feb 19, 2020
menunda event berjalan. menjalankan event ketika sekian detik aksi
View debounce.js
function debounced(delay, fn) {
let timerId;
return function (...args) {
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(() => {
fn(...args);
timerId = null;
}, delay);
@ilhamgusti
ilhamgusti / cancelfetch.js
Last active Oct 8, 2020
cancel fetching axios redux
View cancelfetch.js
useEffect(() => {
const cancelToken = customAxios.CancelToken.source();
dispatch(fetchDataABC(match.params.id, cancelToken.token));
return () => {
cancelToken.cancel(`Cancel fetchData ${match.params.id}`)
}
}, []);
View runAllFunction.js
// https://stackoverflow.com/questions/51403615/spread-syntax-ecmascript
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))