Skip to content

Instantly share code, notes, and snippets.

View Lorezz's full-sized avatar
Working from home

Lorenzo Ponticelli Lorezz

Working from home
View GitHub Profile
@cassidoo
cassidoo / simple-react-recorder.jsx
Last active October 11, 2024 21:27
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);
@khalidx
khalidx / node-typescript-esm.md
Last active October 10, 2024 02:26
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@tomhicks
tomhicks / plink-plonk.js
Last active July 26, 2024 01:10
Listen to your web pages
@mikowl
mikowl / oneliners.js
Last active June 29, 2024 17:39
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
@noelboss
noelboss / git-deployment.md
Last active October 12, 2024 16:09
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@parmentf
parmentf / GitCommitEmoji.md
Last active October 18, 2024 11:37
Git Commit message Emoji
@ericelliott
ericelliott / essential-javascript-links.md
Last active October 4, 2024 20:52
Essential JavaScript Links
@hamstu
hamstu / parallax.js
Last active February 7, 2024 15:20
Parallax Example: JavaScript
var ParallaxManager, ParallaxPart;
ParallaxPart = (function() {
function ParallaxPart(el) {
this.el = el;
this.speed = parseFloat(this.el.getAttribute('data-parallax-speed'));
this.maxScroll = parseInt(this.el.getAttribute('data-max-scroll'));
}
ParallaxPart.prototype.update = function(scrollY) {
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active September 10, 2024 19:39
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#!/usr/bin/env node
var program = require('commander');
var request = require('request');
var chalk = require('chalk');
program
.version('0.0.1')
.usage('[options] <keywords>')
.option('-o, --owner [name]', 'Filter by the repositories owner')