Skip to content

Instantly share code, notes, and snippets.

View sonnylazuardi's full-sized avatar
🎯
Focusing

Sonny Lazuardi sonnylazuardi

🎯
Focusing
View GitHub Profile
@tkesgar
tkesgar / run.js
Last active April 29, 2021 01:39
// https://twitter.com/antonybudianto/status/1387211508296261633
async function serialCon(fns, limit) {
const queue = [...fns]
const workers = []
for (let i = 0; i < limit; i += 1) {
workers.push((async () => {
while (queue.length > 0) {
const fn = queue.shift()
await fn()
@Jack-Works
Jack-Works / 2018.js
Last active March 1, 2024 02:23
cRAzY eSnEXt (*all* proposals mixed in)
#! Aaaaaaaaaaa this is JS!!!
// https://github.com/tc39/proposal-hashbang
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A // https://github.com/tc39/proposal-pipeline-operator
|> do { // https://github.com/tc39/proposal-do-expressions
case(?) { // https://github.com/tc39/proposal-pattern-matching
when {val}: class {
@awebartisan
awebartisan / useDragDrop.ts
Last active November 2, 2020 19:35
useDragDrop hook that handles DragStart, DragOver and Drop operations
import React from 'react';
const handleDragStart = (event: React.DragEvent) => {
event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setData(
'text/plain',
event.currentTarget.getAttribute('data-index'),
);
};
@agungjk
agungjk / [slug].js
Last active April 7, 2024 15:22
Crawler example on Vercel using Puppeteer and NextJS API routes
const puppeteer = require('puppeteer-core');
const cheerio = require('cheerio');
const chrome = require('chrome-aws-lambda');
export default async (req, res) => {
const slug = req?.query?.slug;
if (!slug) {
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ id: null }))
@steveruizok
steveruizok / Resizer.tsx
Created June 19, 2019 08:38
A Framer X Code Component that will resize to fit its text content.
import * as React from "react"
import {
Frame,
FrameProps,
useMotionValue,
addPropertyControls,
ControlType,
} from "framer"
type Props = FrameProps & {
@koenbok
koenbok / store.ts
Last active November 10, 2023 00:17
import * as React from "react";
/**
A hook to simply use state between components
Warning: this only works with function components (like any hook)
Usage:
// You can put this in an central file and import it too
const useStore = createStore({ count: 0 })
@bruskowski
bruskowski / MagicMoveHover.tsx
Last active January 2, 2019 07:17
Adds hover trigger with reverse animation to Henrique Gusso's Magic Move Framer X component.
import * as React from 'react'
import { PropertyControls, ControlType, Animatable, animate } from 'framer'
interface Props {
width: number
height: number
animate: string
delay: number
target: React.ReactChild
source: React.ReactChild
import * as React from "react";
import * as Vue from "vue/dist/vue";
import VueElement from "./VueElement";
import { PropertyControls, ControlType } from "framer";
// Define type of property
interface Props {
text: string;
}
@jjvillavicencio
jjvillavicencio / setup.sh
Last active June 2, 2025 12:00
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin