Skip to content

Instantly share code, notes, and snippets.

View imsus's full-sized avatar
🏠
Working from home

Imam Susanto imsus

🏠
Working from home
View GitHub Profile
@imsus
imsus / pesticide-bookmarklet.js
Created February 28, 2023 06:29
Pesticide bookmarklet without cdn
var pesticide_id = '__bookmarklet__pesticide__';
var pesticide_element = document.getElementById(pesticide_id);
if (!pesticide_element) {
pesticide_element = document.createElement('style');
pesticide_element.id = '__bookmarklet__pesticide__';
pesticide_element.innerHTML = `body{outline:1px solid #2980b9!important}article{outline:1px solid #3498db!important}nav{outline:1px solid #0088c3!important}aside{outline:1px solid #33a0ce!important}section{outline:1px solid #66b8da!important}header{outline:1px solid #99cfe7!important}footer{outline:1px solid #cce7f3!important}h1{outline:1px solid #162544!important}h2{outline:1px solid #314e6e!important}h3{outline:1px solid #3e5e85!important}h4{outline:1px solid #449baf!important}h5{outline:1px solid #c7d1cb!important}h6{outline:1px solid #4371d0!important}main{outline:1px solid #2f4f90!important}address{outline:1px solid #1a2c51!important}div{outline:1px solid #036cdb!important}p{outline:1px solid #ac050b!important}hr{outline:1px solid #ff063f!important}pre{outline:
@imsus
imsus / responsive-viewer.json
Last active September 28, 2023 10:22
Responsive Viewer Config (Chrome Extension)
{
"screens": [
{
"height": 768,
"highlighted": false,
"id": "b14b5495-0b85-4daf-973b-68ba4eaccdea",
"name": "<sm",
"userAgent": "Google Chrome",
"visible": true,
"width": 480
@imsus
imsus / readme.md
Last active August 8, 2023 01:43
How to use Tailwindcss forms to unocss

Usage

  1. Add unocss-forms.ts somewhere in your code (example src/styles/unocss-forms.ts)
  2. Reference unocss-forms in unocss.config.ts preflight key. See code below for further changes
  3. Reload dev server
// unocss.config.ts

import {
<?php
namespace App\Services\Vite;
use Illuminate\Support\Str;
class ViteAssetsTransformer
{
public static function transform($entry)
{
@imsus
imsus / workbox-config.js
Created May 24, 2020 05:35
Workbox configuration for Hugo
module.exports = {
cacheId: "imsus.dev-production",
globDirectory: "./public",
globPatterns: ["**/*.{css,js,eot,ttf,woff,woff2,otf}"],
swDest: "./public/service-worker.js",
modifyURLPrefix: {
"": "/",
},
clientsClaim: true,
skipWaiting: true,
@imsus
imsus / README.md
Last active December 10, 2020 07:18
SOLVED: Laravel Mix Dynamic Import with Extract enabled that causes 0 bytes CSS

Motivation:

  1. I need Dynamic Import needed for lazyload Inertia Pages
  2. I also need Mix.extract() function enabled on webpack.mix.js in order to separate bundle based on vendor
  3. If we doing both without "mini-css-extract-plugin" app.css will be build with 0 bytes.

After tinkering for 2 hours, I find a way how to integrate "mini-css-extract-plugin" to laravel mix. Since this is the root cause of the "0 bytes of css" problem.

Info: My folder structure for resources

/* eslint-disable camelcase */
const axios = require(`axios`)
const cheerio = require(`cheerio`)
const parseResponse = response => {
const $ = cheerio.load(response.data)
const scripts = $(`html > body > script`)
// Code smells #40 and #42
// I should verify why i get the script before the body tag
let id = 0
@imsus
imsus / .php_cs.laravel.php
Last active May 2, 2020 14:39 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
'blank_line_after_namespace' => true,
@imsus
imsus / sample.txt
Created February 6, 2019 10:13
Telegram Instant View Boilerplate
# This sample template explores how we can turn the Telegram blog post on the left into an Instant View page as shown on the right — in several simple steps. If you're unsure what some of the elements used here do, check out the full documentation here: https://instantview.telegram.org/docs
# Place the version at the beginning of template. We recommend always using the latest available version of Instant View.
~version: "2.0"
### STEP 1: Define which pages get Instant View and which don't
# That's easy because we only need IV pages for posts on the Telegram blog.
# This *condition* does the trick.
# ?path: /blog/.+
@imsus
imsus / list.md
Created May 21, 2018 20:59 — forked from notwaldorf/list.md
Meownica's packing list

Meownica's packing list

I travel a lot so I'm down to like 30 minutes of packing per any kind of trip. I always bring one carry-on suitcase for any trips up to 2 weeks (that I never check in unless forced) -- I have an Away suitcase because it's got a built-in (removable) battery, and amazing wheels.

🚨

  • 🆔Wallet & Passport
  • 💧Travel water bottle
  • 💳Travel credit cards (don't pay foreign currency fees!)
  • 💳Insurance cards
  • 💵Local currency you have
  • 🚎Local public transport cards