Skip to content

Instantly share code, notes, and snippets.

View qutek's full-sized avatar
💻
Working from home

Lafif Astahdziq qutek

💻
Working from home
View GitHub Profile
@qutek
qutek / index.html
Created March 11, 2025 16:58
SIngle file super simple cooming soon page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coming Soon</title>
<style>
/* Reset */
* {
margin: 0;
@qutek
qutek / simple-react-recorder.jsx
Created December 20, 2024 03:54 — forked from cassidoo/simple-react-recorder.jsx
A simple React microphone component, recording audio and showing the blob in the browser, styled with Tailwind.
"use client";
import { useState, useEffect, useRef } from "react";
function SimpleRecordButton() {
const [isRecording, setIsRecording] = useState(false);
const [audioStream, setAudioStream] = useState(null);
const [mediaRecorder, setMediaRecorder] = useState(null);
const [audioBlob, setAudioBlob] = useState(null);
const [recordingTime, setRecordingTime] = useState(0);
const timerRef = useRef(null);
@qutek
qutek / webpack.config.js
Created September 19, 2023 03:08 — forked from bahiirwa/webpack.config.js
Multiple entry points for webpack.config.js using @wordpress/scripts
// Set from https://www.npmjs.com/package/@wordpress/scripts
// Add package.json with the @wordpress/scripts dependency.
// Add a root file called webpack.config.js
// Import the original config from the @wordpress/scripts package.
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
// Import the helper to find and generate the entry points in the src directory
const { getWebpackEntryPoints } = require( '@wordpress/scripts/utils/config' );
@qutek
qutek / wpcli-ai1wm.md
Created September 17, 2023 05:27 — forked from Niq1982/wpcli-ai1wm.md
Site migration using All in One WP Migration and WP CLI

Do a backup

Install the plugin

wp plugin install all-in-one-wp-migration --activate

You must reload the page once before continuing

Do the backup

@qutek
qutek / encrypt.js
Created June 13, 2023 02:33
[javascript] Encrypt data in javascript browser as base64 code without padding
export const encode = (str) =>
btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/\=+$/, '');
export const decode = (str) => {
if (str.length % 4 != 0) {
str += '==='.slice(0, 4 - (str.length % 4));
}
return atob(str.replace(/-/g, '+').replace(/_/g, '/'), 'base64');
};
@qutek
qutek / replace.js
Created February 9, 2023 05:30
[Replace Variable With Data] Simple variable template replacement like mustache / handlebars
const replacePlaceholder = (template, data) => {
try {
return template.replace(/{(\w+)}/g, (keyVariable, keyData) =>
data.hasOwnProperty(keyData) ? data[keyData] : variable
);
} catch (error) {
console.error('replacePlaceholder', error);
throw error;
}
};
@qutek
qutek / client.js
Created November 9, 2022 15:07 — forked from roboncode/client.js
Lightweight Axios replacement using Fetch
class Client {
static _instance
static defaultHeaders = { 'Content-Type': 'application/json' }
config = {
baseUrl: '',
urlHandler: (baseUrl, uri, query) => {
var url = `${baseUrl}${uri}`
if (uri.includes('://')) {
url = uri
@qutek
qutek / grid.css
Created June 23, 2022 13:28
[Super Simple Responsive CSS] Simple css for responsive layout with flex #css
.container {
margin: 0 auto;
max-width: 980px;
min-width: 320px;
}
.row {
display: flex;
flex-wrap: wrap;
}
@qutek
qutek / sphp.sh
Created June 14, 2022 08:17 — forked from rhukster/sphp.sh
Easy Brew PHP version switching
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
osx_patch_version=${osx_patch_version:-0}
osx_version=$((${osx_major_version} * 10000 + ${osx_minor_version} * 100 + ${osx_patch_version}))
homebrew_path=$(brew --prefix)
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
@qutek
qutek / index.js
Created May 19, 2022 08:06
[Medusa Local File Service] Custom service to upload files / image directly to server #medusajs #nodejs
// src/api/index.js
import express from 'express';
const uploadDir = 'static';
export default () => {
const router = express.Router();
router.use(`/${uploadDir}`, express.static(uploadDir));