Skip to content

Instantly share code, notes, and snippets.

View raflyfahrezi's full-sized avatar
🔥

Farhan Rafly Fahrezi S raflyfahrezi

🔥
View GitHub Profile
@raflyfahrezi
raflyfahrezi / readme.md
Created October 26, 2024 06:46
Basic Backend Features

Basic Backend Features

  • CRUD
  • ⁠Authentication
  • ⁠Authorization for Admin
  • ⁠Create with file support
  • ⁠Pagination
  • ⁠Caching
  • ⁠Logging
  • ⁠WebSocket
  • ⁠Race Condition handler
@raflyfahrezi
raflyfahrezi / script.js
Last active November 20, 2023 04:07
Delete all stylesheet link tags at head
// Delete Stylesheet
const head = document.head;
const linkTags = head.getElementsByTagName('link');
// Remove all <link> tags that have a 'stylesheet' type
for (let i = linkTags.length - 1; i >= 0; i--) {
const linkTag = linkTags[i];
if (linkTag.getAttribute('rel') === 'stylesheet') {
head.removeChild(linkTag);
}
@raflyfahrezi
raflyfahrezi / index.js
Last active August 8, 2022 06:27
Dicoding Auto Next Module Script
// Open course on dicoding.com and paste this script on console.
document.getElementsByClassName("js-btn-next-tutorial")[0].click()
@raflyfahrezi
raflyfahrezi / index.jsx
Created May 26, 2021 10:34
fetching data using getStaticProps and SWR
import useSWR from 'swr'
import axios from 'axios'
import React from 'react'
const index = ({ initialData }) => {
const { data } = useSWR('...some API path...', fetcher, {
initialData: initialData,
refreshInterval: 5000,
})
@raflyfahrezi
raflyfahrezi / index.jsx
Created May 25, 2021 23:12
fetcing data using swr
import React from 'react'
import useSWR from 'swr'
import { fetcher } from '../utils'
const index = () => {
const { data } = useSWR('... some API Fetch ...', fetcher)
return (
<div>
@raflyfahrezi
raflyfahrezi / index.jsx
Created May 25, 2021 22:41
fetching data using getServerSideProps
import React from 'react'
import axios from 'axios'
const index = ({ data }) => {
return (
<div>
{data.map((item, index) => {
return (
<div key={index}>{item.name}</div>
)
@raflyfahrezi
raflyfahrezi / index.jsx
Last active May 25, 2021 22:42
fetching data using getStaticProps
import React from 'react'
import axios from 'axios'
const index = ({ data }) => {
return (
<div>
{data.map((item, index) => {
return (
<div key={index}>{item.name}</div>
)
@raflyfahrezi
raflyfahrezi / index.jsx
Last active May 25, 2021 22:42
fetching data in useEffect
import React, { useEffect, useState } from 'react'
import axios from 'axios'
const index = () => {
const [data, setData] = useState([])
useEffect(async () => {
const response = await axios.get('...some API path...')
setData(response.data)
@raflyfahrezi
raflyfahrezi / index.js
Created January 9, 2021 14:02
Script TikTok Video Downloader - Open some videos, open devtools, paste this code at console. Your are done.
const videos = document.getElementsByTagName("VIDEO")
window.open(videos[0].src)
@raflyfahrezi
raflyfahrezi / fonts.jsx
Last active February 3, 2021 01:46
Declare fonts for theming
const Fonts = {
fontFamily: 'your fonts name',
fontSize: {
12: '12px',
14: '14px',
16: '16px',
20: '20px',
24: '24px',
32: '32px',
48: '48px',