Skip to content

Instantly share code, notes, and snippets.

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

Andre Alves Leocadio Hiweus

🏠
Working from home
View GitHub Profile
@Hiweus
Hiweus / masks.js
Last active December 29, 2022 12:45
Methods to format masks in javascript, the second one is more generic to be implemented in any language
/*
* the first implementation is simpler but not much smart because, if a pattern long than value is passed
* to function all remaining pattern will be write to outputValue and not crop immediately
* for all purposes use second function, the first one is only a option more compact for understanding
*/
function makeString(value, pattern) {
let position = 0
return pattern.replace(/#/g, () => {
if(position >= value.length) {
return ''
@Hiweus
Hiweus / README.md
Last active March 30, 2023 02:11
Fetch last elements on table in each group

Fetch the last messages in each group by the attribute name

SELECT m1.*
FROM messages m1 LEFT JOIN messages m2
 ON (m1.name = m2.name AND m1.id < m2.id)
WHERE m2.id IS NULL;
@Hiweus
Hiweus / AsyncButton.js
Last active July 23, 2023 04:47
React components
import { useState } from 'react'
import { Button, Spinner } from 'react-bootstrap'
function AsyncButton({ onClick, children, externalLoading = false, ...props }) {
const [internalLoading, setInternalLoading] = useState(false)
const handleClick = async () => {
setInternalLoading(true)
await onClick?.()
setInternalLoading(false)
@Hiweus
Hiweus / index.html
Created August 4, 2023 13:26
Demo SSE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
@Hiweus
Hiweus / grokking_to_leetcode.md
Created February 18, 2024 22:13 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@Hiweus
Hiweus / README.md
Last active April 17, 2025 05:34
Activate windows

Activate windows

Reference

Keys

Pro: W269N-WFGWX-YVC9B-4J6C9-T83GX
Pro N: MH37W-N47XK-V7XM9-C7227-GCQG9
Home: TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home N: 3KHY7-WNT83-DGQKR-F7HPR-844BM
@Hiweus
Hiweus / gist:e4f60dfd9de7ec4f99a82c4ff3e3baa1
Created May 4, 2024 13:29 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@Hiweus
Hiweus / App.css
Last active May 22, 2024 16:57
Example of composite component in react
.card {
background: red;
color: white;
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
width: 900px;
}
@Hiweus
Hiweus / README.md
Created December 9, 2024 02:47
bash autocompletion

Autocomplete

bash shell generally handle autocomplete using a specific function, example:

My function

function aa() {
  echo "$@";
 }
@Hiweus
Hiweus / Dockerfile
Created January 24, 2025 01:30
busybox react host
FROM busybox
WORKDIR /app
# Copy React build files
COPY dist/ /app
# Set up the httpd configuration
# Http request will result in 404
# But the response content will be the site, so will render anyway