Skip to content

Instantly share code, notes, and snippets.

View lewdev's full-sized avatar

Lewis Nakao lewdev

View GitHub Profile
@lewdev
lewdev / tiny-dwitter-editor.html
Last active April 24, 2023 22:57
⬛ Tiny Dwitter Editor. Run dweets on your own (Ctrl-Enter to run)
<style>/*Dwitter Shim by Frank Force 2020 - MIT License (https://codepen.io/KilledByAPixel/pen/YzyyOEr)*/*{box-sizing:border-box;margin:0}textarea,iframe{width:100%;height:50vh}</style>
<script>let shim=`<canvas id=c width=1920 height=1080></canvas><script>u=t=>{z}
let time = frame = nextFrameMs = 0
,FPS = 60
,x = c.getContext("2d")
,S = Math.sin
,C = Math.cos
,T = Math.tan
,R = (r,g,b,a=1) => "rgba("+[r|0,g|0,b|0,a]+")"
,loop = frameTime => {
@lewdev
lewdev / MiniDwitter-by-xem.md
Last active April 6, 2023 23:00
⬛ Dwitter Shim by KilledByAPixel in one HTML file

Source: https://xem.github.io/codegolf/minidwitter.html

<body onload='t=0;x=c.getContext`2d`;with(Math)S=sin,C=cos,T=tan;R=(r,g,b,a=1)=>`rgba(${[r|0,g|0,b|0,a]})`;setInterval("eval(A.value);t+=.016",16)'><canvas id=c width=1920 height=1080 style=width:5in></canvas><br><textarea id=A cols=60 oninput=t=0>
for(i=0;i<65;i++)for(j=0;j<65;j++)x.fillStyle=R(i*9,j*9,C(t)*255),x.fillRect(900+400*S((i+t/9)*3)*C((j+t/9)*1.5),500+400*S((j+t/9)*1.5),5,5)
@lewdev
lewdev / #code-minifier.md
Last active February 26, 2023 11:04
👨‍💻 My general HTML/CSS/JavaScript Code Minifier

👩‍🔧 My general HTML/CSS/JavaScript Code Minifier

This is by no means, a reliable code minifier. It makes several assumptions and treats ALL common code characters (i.e. brackets, parenthesis, operators, etc.) as "code" such that if you are writing text as example code, that will get minified.

The general assumption is you will be writing purely code and not English trying to explain code.

I found other solutions but they were isolated by their languages. i.e. HTML minifier, CSS minifier, & JavaScript terser.

There wasn't one single solution and I didn't want something very complicated since I'm making my code smaller by hand anyway.

@lewdev
lewdev / speak-japanese.html
Last active February 10, 2023 22:48
🗣 Speech Synthesis in Japanese
<p id=o></p>
<script>
/*
Sources:
* https://manu.ninja/using-the-speech-synthesis-interface-of-the-web-speech-api/
* https://css-tricks.com/using-the-web-speech-api-for-multilingual-translations/
* https://www.zeolearn.com/magazine/the-new-speech-synthesis-web-api
*/
let syn = speechSynthesis;
@lewdev
lewdev / my-modal.html
Created February 8, 2023 22:12
🖼 CSS-Only Modal with outside-click close & fade animation
<style>
.my-modal:target {
opacity: 1;
pointer-events: auto;
}
.my-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
@lewdev
lewdev / gist-browser.html
Last active February 14, 2023 09:03
📦 Gist Browser. Search and copy gist code
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<style>
a { text-decoration: none }
ul { margin-bottom: 0 }
</style>
<div class="container mt-2">
<div class="justify-content-between d-flex">
<input id="searchField" type="text" class="form-control w-100 mb-2" placeholder="Search..." oninput="render()"/>
@lewdev
lewdev / js-css-notify-implementation
Created February 6, 2023 10:04
JS/CSS Notify Implementation with Bootstrap 5.
<!doctype html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<style>
.notify {
position: fixed;
top: -5rem;
left: 20%;
width: 60%;
@lewdev
lewdev / ace-c9-code-editor.html
Created February 1, 2023 22:33
👨‍💻 ACE Cloud9 Code Editor
<!DOCTYPE html>
<html lang="en">
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
/*
#editor {
position: absolute;
top: 0;
right: 0;
@lewdev
lewdev / #matrix-digital-rain.md
Last active June 9, 2024 02:09
👨‍💻 My Matrix Digital Rain implementation

👨‍💻 Matrix Digital Rain

I was really curious about implementing the Matrix Digital Rain effect and looked at many implementations.

The best implementation I saw was Digital Rain by javascriptacademy.

I think the others were a little overly complicated.

Naturally, I had to code golf it and make it work in an address bar:

@lewdev
lewdev / Canceling Plans Excuse Generator.html
Created January 20, 2023 02:32
😆 Generate an excuse to cancel plans
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="container my-4">
<h1>❌ Canceling Plans Excuse Generator</h1>
<div class="card card-body p-4 m-4">
<div id="o"></div>
</div>
<div class="text-center my-3">