Skip to content

Instantly share code, notes, and snippets.

View fathan's full-sized avatar
🎯
Focusing

Fathan Rohman fathan

🎯
Focusing
View GitHub Profile
@fathan
fathan / mac-setup-redis.md
Created November 30, 2021 07:17 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@fathan
fathan / alpine-js-fetch-data-on-x-init.markdown
Created November 20, 2021 22:34 — forked from marcus-at-localhost/alpine-js-fetch-data-on-x-init.markdown
[Alpine.js fetch data on `x-init`] #js #alpinejs
@fathan
fathan / scroll into.js
Created October 29, 2021 09:17 — forked from giventofly/scroll into.js
scroll to element vanilla js
//from https://css-tricks.com/snippets/jquery/smooth-scrolling/
// Scroll to specific values
// scrollTo is the same
window.scroll({
top: 2500,
left: 0,
behavior: 'smooth'
});
@fathan
fathan / meta-tags.md
Created September 30, 2021 08:48 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@fathan
fathan / interval.js
Created June 30, 2021 19:08 — forked from ncou/interval.js
setTimeout and setInterval with pause and resume
// http://stackoverflow.com/questions/7279567/how-do-i-pause-a-window-setinterval-in-javascript
function RecurringTimer(callback, delay) {
var timerId, start, remaining = delay;
this.pause = function() {
window.clearTimeout(timerId);
remaining -= new Date() - start;
};
@fathan
fathan / axios.refresh_token.1.js
Created March 20, 2021 14:51 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@fathan
fathan / wordpress.php
Created February 22, 2021 14:24 — forked from sloyless/wordpress.php
WordPress cheat sheet
<!-- WP Template Dir -->
<?php bloginfo('template_directory'); ?>
<!-- WP Child Theme Template Dir -->
<?php get_stylesheet_directory_uri(); ?>
<!-- WP Home Link -->
<?php echo get_option('home') ?>
<!-- WP Search Form -->
@fathan
fathan / wp-cheat-sheet
Created February 22, 2021 14:24 — forked from loorlab/wp-cheat-sheet
Wordpress cheat sheets
1. Theme Structure
- style file
style.css
- header section
header.php
- main section
index.php
@fathan
fathan / wordpress-cheatsheet.md
Created February 22, 2021 14:23 — forked from mkormendy/wordpress-cheatsheet.md
WordPress Cheatsheet

##Theme Structure

Template Description
header.php Header Section
index.php Main Section
sidebar.php Sidebar Section
single.php Post Template
page.php Page Template
comments.php Comment Template