Exactly 10 years ago I revealed "WORLD":
→
A mesmerizing 3D globe encapsulated in its own source code! This
#quine
is crafted in just 1024 bytes of pure HTML + JavaScript, with no external dependencies.
Make sure to view the source!
The most minimalist creative coding environment is alive:
⟶
Control the size and color of a 16x16 dot matrix with a single JavaScript function. The input is limited to 32 characters – but no limits to your creativity!
🔴🔴
🔴🔴
Exactly 10 years ago I revealed "WORLD":
→
A mesmerizing 3D globe encapsulated in its own source code! This
#quine
is crafted in just 1024 bytes of pure HTML + JavaScript, with no external dependencies.
Make sure to view the source!
Time for a new mind-bending project!
#QLOCK
— A JavaScript Quine Clock
It displays the current time in a seven-segment style, embedded within its own JavaScript source code.
🕔 🕝 🕢 🕤 🕑 🕜
(321 bytes)
THE
#MATRIX
An animated quine in only 187 bytes of HTML+JS:
<body onload='setInterval(f=_=>{for(t++,o=i=0,w=35;i<384;o+=i++%+w?(f+f+f)[i].fontcolor(g==9?"
#FFF
":[0,g,0]):"\n")g=0|(i/w-t/((i%w)**5%w+3)+w*t)%w;p.innerHTML=o},t=9)'bgcolor=X><pre id=p>
🐇
Evil note: In JavaScript you can replace some Latin characters with their Cyrillic doppelgänger ("aceijopsxy" => "асеіјорѕху") to use reserved words as your variable names such as:
var vаr = function functіon(functіon){
cаtch = "me";
іf [you = "can"];
}
vаr (breаk = true);
#genuary2021
Jan 5: Code Golf!
Work a Day 12/365: Bitfield 1
Python Code:
from PIL import Image
import numpy as np
r = range(512)
x, y = np.meshgrid(r, r)
i = (1 == (abs(x+y)^abs(x-y)+1)**37 % 7) * 255
Image.fromarray(i).convert('L').save('1.png')
Buginese is a language spoken by five million people in the southern part of Sulawesi Indonesia. They use the Lontara script which characters look super interesting and are valid
#JavaScript
variable names. Here is an `alert(1)` with this writing system:
“No preciso erigir un laberinto,
cuando el universo ya lo es.”
― Jorge Luis Borges
This is one of my favorite quotes and roughly translates into: “There is no need to build a labyrinth when the entire universe is one.”
So I turned it into a typo maze:
OMG:
@kinugawamasato
and
@SylvainPV
found a way to use only 5 different characters to write any JavaScript:
[ ] + | >
Note: This will possibly work in the future by default, if the ESNext "Pipeline Operator" |> proposal will make it. Read more:
I love to see being used in the wild — even if it was never my intention to create a library for XSS.
This bypass was reported to the Expedia Group Bug Bounty program in December 2021 and was fixed in April 2023.
$five =$+[]
After many years of heavy research we finally found a solution to write JavaScript with only 5 different symbols: $+=[]
⟶
Hint: This solution targets some internals of jQuery UI — which is still being used by more than 10% of all websites.
[sic] – Encode JS with 2 different symbols only
⟶
A super tiny library to inject self-executing JavaScript code. The obfuscated code contains nothing but a sequence of square brackets!
[][[][[]]][[]][[]][[][[]]][[][[]]][[][[]]][[][[]]][[]][…
HOT CODE
A JavaScript Quine in 203 Bytes
→
<body bgcolor=🔥 onload=setInterval(e='for(h=``,a[I++*I%17+578]=i=89;i++<630;h+=i%30?(x=a[i]=~~((a[i]+a[i+1]+a[i+29]+a[i+30])/4))&&e[i%142].fontcolor(5<x&&"
#FF0
"):"\\n")p.innerHTML=h',a=[I=30])><pre id=p>
The "Sidewinder" algorithm is one of the easiest way to draw a "perfect" maze with no loops and no isolation:
Randomly carve a couple of cells to the right. Then go back and choose one of the last cells and carve to the top. Proceed until the end of a row and go to the next.
…
This is an even more minimalist coding environment::
⤑
Enter a (t,i,x,y) function after the URL hash and it will render the animated output to the browser's favicon.
🧑💻 (desktop only!)
Here is a nice little hack to hide code inside a
#BigInt
. The idea is use octal escape sequences and replace the backslash \ with the digit 9.
// the encoded `alert(1)`
x = 91419154914591629164950961951n;
// the decoder
[`'${x}'`.replace(/9/g, "\\")].map(eval).map(eval)
~ F L U I D ~
~~~~~~~~~
A HTML, canvas and JavaScript quine in 988 bytes.
~>
The "FLUID" page animates its own source code, where each character is a water particle that drips down with basic physics applied.
💦
There are four ways to evaluate JavaScript code represented as a string:
const CODE = 'alert(1)';
1⃣ eval(CODE)
2⃣ Function(CODE)()()
3⃣ setTimeout(CODE)
4⃣ document.write('<script>'+CODE+'</script>')
And variations such as setInterval, innerHTML, …
Did I miss anything here?
There is so much to learn about HTML and JS hacks from this code:
<svg/onload=throw/**/Uncaught=window.onerror=eval,";alert\501\51">
This is inspired by
@garethheyes
and will execute an 'alert(1)' without using parentheses, spaces or quotes!
Here are the slides of my talk "Daedalus – Though the Maze of Code" at
@jsconfis
about creative coding and code golfing in JavaScript. Thanks all for listening – it was fun!
(Hint: Download the PDF, because it contains links to all examples.)
I'm excited to release "🌍"
— the smallest possible 3D globe in just 75 characters!
(t,i,x,y) =>
'灾擾ϿǾǾῼ羼߰́ࠇ㰇繿ǿÿဎ'.charCodeAt(5*(t-acos((1-x/8)/cos(asin(1-y/8))))%19)&2**y
It includes encoded bitmap data and results in just 98 bytes of JavaScript.
You can now skip `Math.` in your code and access functions and props like `sin` and `PI` directly! This gives you x*5 more space for your art.
I'm impressed by the overwhelming feedback. got 2500 likes, 1000 retweets and 250 replies in less than 24 hours.
# enter the matrix
node -e 'setInterval(_=>{for(Y=y,x=80;x-=2;){Y=(Y+x*x+9)%27;p(x,Y,(X="\\u001B[")+`37m${C=String.fromCharCode(12450+(y*x)%16)}`);for(o=6;--o;)p(x,Y-o,X+`38;5;${46-(o*6)}m${C}`)}y++},y=99,p=(x,y,c)=>y<22&&console.log(X+`40m${X}${y};${x}H${c}`))'
News from !
We all won the 2020 election and celebrate this with the smallest possible Star-Spangled Banner:
// us flag
// in 32 bytes
(t,i,x,y) =>
x>6|y>5?y<12&&sin(y+t+i*6):.3
🇺🇸
Assigning numeric values to Hebrew letters in JavaScript looks different than expected…
const א = 1; // one
const ב = 2; // two
const ג = 3; // three
const ד = 4; // four
const ה = 5; // five
const ו = 6; // six
const ז = 7; // seven
const ח = 8; // eight
An animated ASCII art with three animated metaballs that reveal the underlying JavaScript source code. All done in 256 bytes that fit into a tweet.
Demo:
(Make sure to view the source!)
THE FINAL STEP:
ꝏ - Encode JavaScript with only one symbol!
The code only contains a (VERY!) long sequence of the character `o`. The length is then
1. converted to binary …
2. split into 7-bit groups …
3. encoded as ASCII text …
4. and evaluated.
An ancient alert(1) from 1337 BC was just discovered on Crete:
𐂃='',𐃨=!𐂃+𐂃,𐂝=!𐃨+𐂃,𐃌=𐂃+{},𐁉=𐃨[𐂃++],𐃵=𐃨[𐂓=𐂃],𐀜=++𐂓+𐂃,𐂠=𐃌[𐂓+𐀜],𐃨[𐂠+=𐃌[𐂃]+(𐃨.𐂝+𐃌)[𐂃]+𐂝[𐀜]+𐁉+𐃵+𐃨[𐂓]+𐂠+𐁉+𐃌[𐂃]+𐃵][𐂠](𐂝[𐂃]+𐂝[𐂓]+𐃨[𐀜]+𐃵+𐁉+"(𐂃)")()
This is how JavaScript looks when written with Cuneiform:
𒁰='',𒀰=!𒁰+𒁰,𒁃=!𒀰+𒁰,𒅋=𒁰+{},𒄦=𒀰[𒁰++],𒄡=𒀰[𒃺=𒁰],𒂞=++𒃺+𒁰,𒆟=𒅋[𒃺+𒂞],𒀰[𒆟+=𒅋[𒁰]+(𒀰.𒁃+𒅋)[𒁰]+𒁃[𒂞]+𒄦+𒄡+𒀰[𒃺]+𒆟+𒄦+𒅋[𒁰]+𒄡][𒆟](𒁃[𒁰]+𒁃[𒃺]+𒀰[𒂞]+𒄡+𒄦+"`𒁃𒅋𒃺𒂞`")``
The Hangul Filler (U+3164) is an invisible but valid JavaScript identifier. It can be used for variable names, parameter, functions, arguments, and object properties.
// INVISIBLES …
ᅠᅠ
=ᅠ=>
alert(ᅠ.ᅠ);
ᅠ
({ᅠ: 1})
Demo:
#JS
#HACK
#42
🙈
===============
You only need 42 bytes and a (long) URL to render any web page you like!
…#[ENCODED_SCRIPT]
Make sure to view the source code in this demo and read the following thread.
Hery is a tiny slot machine in in 119 bytes of JavaScript:
c.width=500;x.font='9em"'for(i=3;i--;x.fillText(T[0]+T[1]+T[2],40,200))t%6<i+2?T[i]=[...'💰🔔🍒🍌🍉'][(i*t+9*t|0)%5]:S
@dwitter_net
Well, this is a nice way to obfuscate and execute an 'alert(1)' in JavaScript:
Function`$${atob`YWxlcnQoMSk=`}```
It uses a mix of …
- the function constructor
- tagged template literals
- lesser-known decoder "atob"
Evil work by
@BitK_
🦹
Some basic hints:
1. Click the dots to get detailed instructions.
2. Update the code to create your own animations.
3. Hit "submit" to save the code in the URL.
4. Make sure to share your creations in the comments!
I will pick the best and add them to the default examples.💕
Having fun drawing tweets using JavaScript and Unicode colors!
🟦 🟩 🟨 🟧 🟥 🟪
Here are my favourites:
1️⃣ (x * y) % 10 - 1
2️⃣ (x ^ y) / 2
3️⃣ 12 - (x + y)
4️⃣ x * y >> 4
const colors = [...'🟦🟩🟨🟧🟥🟪'];
let output = '';
for (let y = 0; y < 11; y++) {
for (let x = 0; x < 11; x++) {
let v = (x + y) % 6;
let color = colors[v];
output += color || '⬛';
}
output += '\n';
}
//
// 165 bytes
// HTML+JS
// Game of Life
<body onload=b=!setInterval`for(a=b,b=h=[i=999];i--;_.innerText=h+="▁▉-"[i%47?b[i]=a?d==3|a[i]&d==2:24*i%7%2:2])for(d=0,j=5;e=(2<j--)*44+j;)d+=a[i+e]+a[i-e]` id=_>
//
// based on
I've ported to pure Node.js!
You can now render the examples in the command line as beautiful
#ASCII
art:
> npx tixy-land "sin(t-sqrt((x-7.5)**2+(y-6)**2))"
Some unique and exotic ways to get "undefined" in JavaScript by just using basic types:
- Array: [][[]]
- String: ""[""]
- Function: ($=>$)()
- Object: ({}).$
- Number: 0.0.$
- RegExp: /$/.$
- Boolean: false.true
It is the end of 2020 so I made a super small
#PONG
game in just 90 bytes:
(t,i,x,y)=>
1>hypot(a=(B=(_,o)=>_-((r=o*t%32)<16?r:32-r))(x,9),b=B(y,5))|(!x|14<x)&abs(b+3*sin(a/3))<2
I will explain the basic concepts in the following thread …
(1/9)
Here is a little pixel art editor to draw Tweets with Unicode colors:
// source:
for(x=132;x--;c="⬜")document.write(`<b onclick='${x>10?"innerText=c'>⬛":`c="${i=[..."⬛⬜🟦🟩🟨🟧🟥🟪🟫"][x]}"'>${i||""}`}</b>${x%11?"":"<br>"}`)
Drawing a labyrinth (aka "unicursal maze") is easier than expected: Just take a regular maze and add walls bisecting each passage. This will turn each dead end into a U-turn passageway.
The new unicursal maze will have twice the dimensions of the original maze it was based on.
Taking invisible code to the next level:
// alert("🕵");
[ᅠ,ᅠ︀,ᅠ︁] = [escape, unescape, eval];
[ᅠ``.replace(/u.{8}/g,``)].map(ᅠ︀).map(ᅠ︁);
11 bytes smaller thanks to amazing work by tomxor!
for(X=t?X+r*50:0,i=h=11+6*C(t*4+X%1)<<5;--i;x.fillRect(...t?[X-r*i/4,600+(r*8&3?i-h:h-i),i/4,2]:[i*8,r*999,h,r]))r=Math.random()
I'm scared!
const ᐸscriptᅠtypeꘌˮtextⳆjavascriptˮᅠⳆᐳ = '
#OMG
';
console.log(ᐸscriptᅠtypeꘌˮtextⳆjavascriptˮᅠⳆᐳ);
//
#OMG
---
It uses Unicode confusables in the variable name to make it look like HTML. Demo:
Mona Lisa in a tweet!
Exactly 280 bytes for a 64x64 version of the world's most famous painting – compressed using the WebP image format.
The following tweet shows the source …
JStillery by
@WisecWisec
is an advanced tool to deobfuscation JavaScript via partial evaluation. Here is a demo that will make JSFuck a bit more readable:
@MaximeEuziere
@p01
setInterval(_=>{for(H="<svg>",t+=.01,i=h=400;i--;)Math.cos(t-i)>0&&'榁翻꺿듻ퟝ믭큰삗⢠挎ᩐ肦䰠椉䠊ᑒꊐࢀင'.charCodeAt(i/16)>>i%16&1&&(H+=`<text x=${70+(i*h-i*i)**.5*Math.sin(t-i)/3} y=${9+i/3}>+</text>`);document.body.innerHTML=H},t=9)
//
#HELLO_WORLD
in a tweet