Skip to content

Instantly share code, notes, and snippets.

View octaviogb's full-sized avatar

Octavio Turra octaviogb

  • Guia Bolso
View GitHub Profile
@octaviogb
octaviogb / d140.js
Last active November 14, 2020 04:39
Compactar o código como no https://www.dwitter.net/d/20584
function compact(f) {
return unescape(
f
.toString() // garanto que é uma string
.split('') // transformo em array de caracteres
.map( // vou iterar e transformar esses caracteres
(d,n) => `%uD${n%2?'C':'8'}${d.charCodeAt(0).toString(16)}`)
/*
aqui acontece a magia
D é o caracter