Skip to content

Instantly share code, notes, and snippets.

View nucliweb's full-sized avatar

Joan León nucliweb

View GitHub Profile
@marcosvpj
marcosvpj / vscode-remove-duplicate-lines.md
Last active July 17, 2024 19:08
How to remove duplicate lines in Visual Studio Code?

If the order of lines is not important##

Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question: https://stackoverflow.com/q/1573361/3258851)

  1. Control+F

  2. Toggle "Replace mode"

  3. Toggle "Use Regular Expression" (the icon with the .* symbol)

@ntkog
ntkog / propuestas.js
Created April 18, 2019 09:57
Propuestas Partidos políticos según newtral
function propuestas(partido) {
let lista = [...document.querySelectorAll('.e-module div[data-option]')].map(el=>({
partido: el.dataset.option,
texto: [...el.querySelectorAll('p')].reduce((old,cur)=>old + cur.textContent, "")
})).filter(obj=> (partido === "all" ? true : obj.partido === partido) && obj.texto.length > 0);
partido === "all" ? console.table(lista) : console.table(lista,["texto"]);
let csv = lista.map(r => `"${r.partido}"|"${r.texto.replace(/\n/g, " ")}"`);
csv.unshift(`"partido"|"texto"`);
// Copia al portapapeles todos los datos a un CSV
@rviscomi
rviscomi / CrashCourseInCrUX.md
Last active October 8, 2024 18:14
"Crash Course in CrUX" for the PerfMatters conference, April 2019
@joshuacerbito
joshuacerbito / useScroll.js
Last active January 8, 2024 13:44
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);
@jakub-g
jakub-g / async-defer-module.md
Last active May 14, 2025 13:50
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@gimenete
gimenete / readme.md
Last active March 9, 2024 16:36
Notas para orientación profesional como programador

Tras este tweet que publiqué

He sido freelance, emprendedor y trabajo desde hace años para empresas USA de diversos tamaños en remoto como programador fullstack. Ahora en GitHub. Si puedo ayudar a alguien en orientar su carrera, mis DMs están abiertos. Ask me anything.

he recibido muchos mensajes y escribo aquí algunos de los consejos que he dado en resumen. Nota: algunas cosas son concretas de trabajar en España. Si vas a trabajar desde Sudamérica sólo una nota: tienes la ventaja de la zona horaria para trabajar con EEUU.

Inglés

Tener un buen nivel de inglés es fundamental para poder trabajar con clientes extranjeros. El conocimiento del idioma tiene que mantenerse en el tiempo. Es como mantenerse en forma física; si lo dejas, lo pierdes. Personalmente aunque trabajo 100% en inglés desde hace bastantes años, intento crearme un entorno diario con el idioma para no perderlo:

@luruke
luruke / bunny.js
Created October 27, 2018 07:51
draw bunny on terminal
const drawille = require('drawille')
const bunny = require('bunny')
const glmatrix = require('gl-matrix')
const width = 200
const height = 200
const canvas = new drawille(width, height)
const mat4 = glmatrix.mat4
const vec3 = glmatrix.vec3
let points = []
@yuanchuan
yuanchuan / index.html
Last active October 19, 2018 07:31
Alien land
<css-doodle>
:doodle {
@grid: 20x1 / 60vmin;
overflow: hidden;
}
:container {
transform: scale(25);
filter: @svg-filter(<svg>
<filter>
<feTurbulence baseFrequency="@r(.016, .056, .001)" seed="@r(100)" numOctaves="@r(8, 15)" />
@LadyScream
LadyScream / lissajous.pde
Created October 3, 2018 20:01
Inspired by Daniel Shiffman on The Coding Train
boolean recording = false;
int frame = 1;
float theta = 0;
float phi = 0;
float time = 0;
float r = 50;
int cols = 5;
int rows = 5;
Lissajou[][] curves;
@mattdesl
mattdesl / index.html
Created July 12, 2018 01:30
paint worklet + generative art (brute force circle packing demo)
<!doctype html>
<div id="sketch"></div>
<style>
body {
margin: 0;
overflow: hidden;
background: #383838;
}
#sketch {