Skip to content

Instantly share code, notes, and snippets.

View lewdev's full-sized avatar

Lewis Nakao lewdev

View GitHub Profile
@lewdev
lewdev / #README.md
Last active May 3, 2024 20:34
🤖 Technology Acronym Generator - Letters to Words

🤖 Technology Acronym Generator - Letters to Words

After multiple discussions at work and among friends about making acronyms for words, I dug into it to build this minimal Letters to Words Technology Acronym Generator.

Given that you want to create a new acronym with your creative use of letters, you can create an acronym with randomly selected words.

Word list sources: (removed acronyms)

@lewdev
lewdev / #README.md
Last active April 19, 2024 00:52
👉 Clean JSON Inputs & Validate

👉 Clean JSON Inputs & Validate

I keep receiving JSON data with odd characters so I made a small app that corrects all those issues and does an JSON.parse check to see if it passes. Parsing errors will display if any.

🔖 Bookmarklet (329b)

data:text/html,<h3>Clean JSON</h3><h5>Input</h5><textarea id=i></textarea><h5>Output</h5><textarea id=o></textarea><p id=err></p><script>i.onchange=_=>{o.value=v=i.value.replace(/[\u000B\u001C\u001D]/g, "").replace(/\u0019/g,"'").replace(/\u0013/g, "-");try{JSON.parse(v);err.innerHTML="Valid"}catch(e){err.innerHTML=e}}</script>

👨‍💻 Clean Version

@lewdev
lewdev / #README.md
Last active November 12, 2024 19:39
🚂 Random Text Generator in a Bookmark (bookmarklet)

🚂 Random Text Generator in a Bookmark (bookmarklet)

Do you need to quickly generate random text?

Use this bookmarklet to quickly gen up some text. This uses words found in the keys of the window object and splits Camel-cased names and removes on at the start and single-character words. Then randomly puts 5-9 words into 5-9 sentences in 5-9 paragraphs.

Object.keys(window).reduce((a,b)=>[...a,...b.split(/^on|(?=[A-Z])/).filter(a=>a.length>1)],[])
@lewdev
lewdev / #README.md
Created March 14, 2024 00:42
⛳ Code Golf: Arrows Solution

⛳ Code Golf: Arrows Solution

https://code.golf/arrows#javascript

p=[0,0]
arguments.map(g=>{[a,b]=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1],[0,0],[0,0]]["↙↲⇙←⇐⇦↖↰⇖↓⇓⇩↑⇑⇧↘↳⇘→⇒⇨↗↱⇗↔↕⇔⇕⥀⥁".indexOf(g)/3>>0]
p[0]+=a
p[1]+=b
print(p.join` `)})
@lewdev
lewdev / #README.md
Last active February 29, 2024 21:36
⛳ I Code Golfed Somebody Else's Dweet

⛳ I Code Golfed Somebody Else's Dweet

I'm hoping this is interesting to somebody out there that likes code golfing or is interested in knowing what it looks like.

I saw a dweet with a lot of parts that I could add code golf techniques to. I was able to reduce the dweet from 150 to 131 bytes; a 19-byte reduction of code that does the same thing.

I golfed this (150b):

x.font="108pt _";x.fillStyle="#ffffff22";x.fillRect(0,0,1920,1080);x.fillStyle="#000";onmousemove=e=>x.fillText("dwitter",e.offsetX*3.1,e.offsetY*3.1)
@lewdev
lewdev / #README.md
Last active September 23, 2024 01:42
💀 Dweetegem Hero #helldivers #strategem as a Dweet

💀 Dweetegem Hero #helldivers #strategem as a Dweet

I love the new Helldivers 2 game and made a Dweet-sized version of Strategem Hero.

a="⬅⬆➡⬇"
t?c.width=99:n=b=0
x.fillText((s=[...Object.keys(this)[n]].map(v=>a[v.charCodeAt()%4]).join``).substr(b),1,9)
onkeyup=e=>a[(e.keyCode-5)%4]==s[b]&&++b>=s.length&&(b=0,n++)
@lewdev
lewdev / README.md
Last active November 15, 2024 03:24
🤏 Dweet/Tiny Code Tips

🤏 Dweet/Dwitter/Tiny Code/Code Golf Tips

A collection of tips when writing tinycode or dweets. It's getting hard for me to find the dweets that have neat tricks. I'll add more as I find more.

👉 Tip 1: Math.floor equivalents: value|0, value>>0, and ~~(value)

For example when rounding down a value multiplied by Math.random, you can add |0.

Example getting a random integer from 0 to 254 (inclusive):

@lewdev
lewdev / #README.md
Last active December 28, 2024 22:55
🏯💳 Dungeon Generator on a business card #bookmarklet
@lewdev
lewdev / readme.md
Created December 22, 2023 05:14
💎 Link's Awakening DX HD PC Port
@lewdev
lewdev / Install⁄Update Xone
Created December 1, 2023 09:13 — forked from cdleveille/Install⁄Update Xone
Install or update xone driver for Steam Deck (desktop shortcut and bash script)
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=bash $HOME/xone_install_or_update.sh
GenericName[en_US]=
GenericName=
Icon=preferences-desktop-gaming
MimeType=
Name[en_US]=Install⁄Update Xone
Name=Install⁄Update Xone