darrylyeo
  • Member for 6 years, 1 month
  • Last seen more than a week ago
95 answers
114 votes
17k views
Loading... Forever
38 votes

HTML + JS (ES6), 20 + 51 50 = 70 bytes setInterval(_=>a.innerHTML='|/-\\'[i=-~i%4],i=250) Loading... <a id=a>- -1 byte (Zachary T) Check out my 132 byte HTML/CSS answer as well.

View answer
151 answers
48 votes
15k views
Output programming language name
31 votes

HTML, 24 20 bytes &#72;&#84;&#77;&#76; HTML, 16 bytes As pointed out by @Bob, modern browsers will recognize HTML entities without semicolons, though it's technically ...

View answer
32 answers
9 votes
2k views
Square and square
21 votes

JavaScript (ES6), N = 5 With a leading newline instead of a trailing newline. alert ((a=` `+!!0 )+a+a +a+a) JavaScript (ES6), N = 6 alert( (1e5+` `)['r' +'epe\ '+'at\ '](6)) ...

View answer
10 answers
40 votes
2k views
Square, diamond, square, diamond
17 votes

JavaScript (ES6), 294 288 287 284 256 246 240 238 220 bytes My first golf on this site. Pass input string to function f, e.g. f('codegolf') f=s=>{N=n=>(2<<n/2+.5)-3-n%2 D=N(l=s....

View answer
24 answers
46 votes
4k views
The sea in your terminal
16 votes

HTML + CSS, 70 + 181 175 = 245 bytes Makes use of text-shadow, rtl text and CSS keyframe animations. a{display:flex;overflow:hidden;width:80ch}pre{text-shadow:16ch 0,32ch 0,48ch 0,64ch 0,80ch 0;...

View answer
6 answers
46 votes
2k views
Visualize Visual Eyes
15 votes

HTML + CSS + JavaScript (ES6), 93 + 19 + 278 276 = 388 bytes w=7.8125 h=15 with(Math)r=round, (onclick=e=>F.style=`margin:-3.5em -6.5ch;left:${x=r(e.x/w)*w}px;top:${y=r(e.y/h)*h}px`)({y:-40}...

View answer
34 answers
36 votes
10k views
Press any key to continue
15 votes

HTML + JavaScript (ES6), 36 + 25 = 61 bytes You can't really exit a JavaScript program, so clearing the webpage is the best I can think of. onkeyup=_=>a.innerHTML='' <a id=a>Press any ...

View answer
5 answers
21 votes
864 views
Convert a HTML page into a mountain
Accepted answer
14 votes

HTML + CSS + JavaScript, 39 + 141 + 20 = 200 bytes Outputs visually to the webpage. To allow this to work with special elements like <body>, all letters in the input are replaced. p....

View answer
14 answers
87 votes
8k views
[CHRISTMAS THEME DISCLAIMER HERE]
13 votes

JavaScript (ES6), 204 201 196 194 192 bytes N=>` ${(r=x=>x.repeat(N-1))(`.--.__.--`)}. _(_ ${N--,r(` _Y_ `)} _)_ `+` [___] /:' \\ |:: | \\::. / \\::./ '=' `.split` `....

View answer
17 answers
51 votes
8k views
Let's draw Mona Lisa
12 votes

HTML + CSS + JavaScript (ES6), 499 bytes HTML: 33 bytes CSS: 17 bytes JS: 678 ... 478 475 473 465 459 455 451 447 449 bytes It's nowhere near 250 bytes, but I'll definitely settle for under 500 ...

View answer
95 answers
114 votes
17k views
Loading... Forever
11 votes

HTML/CSS, 23 + 109 = 132 bytes Improved upon Neil's answer. pre{display:flex}a{overflow:hidden;animation:a 1s steps(4)infinite;width:1ch}@keyframes a{to{text-indent:-4ch <pre>Loading... &...

View answer
41 answers
26 votes
6k views
All you have to do is print the number 1! ...Twice
10 votes

HTML, 8 bytes <ol><li> 05AB1E, 8 bytes !TQ#!QN# Try it online! Jelly, 8 bytes ([X*(XU* Try it online! Jelly, 8 bytes 5he75eb7 Try it online! Jelly, 8 bytes ;nk=;kh= ...

View answer
29 answers
47 votes
4k views
Goto the Nth Page
10 votes

JavaScript (ES6), 130 122 121 bytes Invoke with currying syntax, e.g. f(3)(10). x=>X=>[x>1&&'prev 1',x>4&&'...',x>3&&x-2,x>2&&x-1,`[${x}]`,(X-=x)>...

View answer
37 answers
20 votes
4k views
Display a Digital Clock
10 votes

HTML + JS (ES6), 8 + 60 = 68 bytes Tested in Chrome. setInterval`a.innerHTML=new Date().toLocaleTimeString('fr')` <a id=a> -1 byte (@ETHProductions): Use French time format instead ...

View answer
6 answers
86 votes
4k views
3D ASCII Block Building
9 votes

JavaScript (ES6), 277 251 bytes a=>(n=55,$=f=>[...Array(n)].map((_,i)=>f(i)),S=$(_=>$(_=>' ')),n=11,$(l=>$(z=>$(y=>$(x=>(x=10-x,X=x*3+y+z,Y=y-z+n,Z=a[y][x])<=z&&...

View answer
50 answers
47 votes
14k views
Draw the Swiss Flag
9 votes

HTML + CSS, 15 + 117 bytes = 132 bytes Using a flexbox wrapper with an inset box-shadow. b{display:flex;box-shadow:red 0 0 0 6px inset;padding:2px;width:28px;flex-wrap:wrap}a{border:solid red ...

View answer
23 answers
39 votes
2k views
Lined up circle, n points
9 votes

HTML + JS (ES6), 34 + 177 164 162 = 196 bytes Using the HTML5 Canvas API. See it on CodePen. f=n=>{with(Math)with(c.getContext`2d`)for(translate(S=300,S),O=n;O--;)for(rotate(a=PI*2/n),N=n;N--...

View answer
57 answers
50 votes
7k views
Generate an RGB colour grid
8 votes

HTML (GIF), 108 bytes It's the battle of the web-based image formats! (Any TIF or JPG contenders out there?) Answer by @A C. <img src=data:image/gif;base64,R0lGODdhAwADAMIGAAAA//8AAP8A/wD/...

View answer
18 answers
23 votes
2k views
Print a shuffled deck of cards
8 votes

JavaScript (ES6), 107 106 108 bytes a=[] for(S of'ABCD')for(N of'123456789ABDE')a.splice(Math.random()*-~a.length,0,eval(`'\\u\{1F0${S+N}}'`)) a a=[] for(S of'ABCD')for(N of'123456789ABDE')a....

View answer
151 answers
48 votes
15k views
Output programming language name
8 votes

CSS, 25 bytes :after{content:'\43\53\53 Note that extra markup is added to Stack Overflow snippets, causing "CSS" to be displayed more than once. Open an .html file with contents <...

View answer
14 answers
11 votes
2k views
ASCII Airplane Banner
7 votes

JavaScript (ES6), 141 138 bytes String and direction are input via currying syntax.'/\n|-DI>-/---< ' for left, '/\n|-DI<-\\---> ' for right. t=>p=>(r=`${s=' '}/${_='-'....

View answer
14 answers
10 votes
1k views
12 hour time conversion
Accepted answer
7 votes

JavaScript (ES6), 69 bytes d=>new Date(d).toLocaleString(0,{hour:n='numeric',minute:n,hour12:1}) f= d=>new Date(d).toLocaleString(0,{hour:n='numeric',minute:n,hour12:1}) console.log( ...

View answer
70 answers
168 votes
24k views
How high can you count?
7 votes

JavaScript (ES7), 16 integers, 137 130 128 bytes I took @ETHproductions' answer and ran with it for a while; it's changed so much that I'm posting it separately. Ideas are welcome. :) ""**"" -~-~{} ...

View answer
42 answers
19 votes
4k views
Make me a s'more!
7 votes

JavaScript (ES6), 71 bytes (W,G,C,M)=>[...'GCMG'].map(X=>`${X.repeat(W)} `.repeat(eval(X))).join`` Woohoo, beat 3 other JavaScript answers! f= (W,G,C,M)=>[...'GCMG'].map(X=>`${X....

View answer
51 answers
53 votes
8k views
Print all ASCII alphanumeric characters without using them
7 votes

JavaScript (ES6), 983 bytes Turns out in ES6 there's a lot of characters you can use in JavaScript variable names! Works great after you exhaust the six 1-2 byte variable names with $ and _. _=~[] $=...

View answer
37 answers
40 votes
6k views
Display a clock face
6 votes

HTML + JavaScript (Canvas), 13 + 161 = 174 bytes Arbitrary canvas positioning uses 6 bytes. with(C.getContext`2d`)with(Math)for(font='9px monospace',textAlign='end',f=x=>round(sin(x*PI/6)*6)*...

View answer
14 answers
14 votes
1k views
Short Date into English Long Date
5 votes

JavaScript (ES6), 142 140 bytes Outputs NaNth Invalid Date for invalid dates. The code for ordinal numbers was adapted from this answer. d=>`${s=(D=new Date(d)).getDate()+''}${[,'st','nd','rd'][...

View answer
11 answers
18 votes
2k views
Swep tha vowels!
5 votes

JavaScript (ES6), 62 106 98 101 bytes s=>s.match(/(\w+)( (\w+))?/g).map(m=>m.replace(/([aeiouy]+)(\w* \w*?)([aeiouy]+)/g,'$3$2$1')).join` ` f= s=>s.match(/(\w+)( (\w+))?/g).map(m=>m....

View answer
9 answers
19 votes
2k views
Penrose Triangle Codegolf
5 votes

HTML + JS (ES6), 34 + 306 = 340 bytes Makes use of a 30 degree horizontal skew - in the 3rd argument of the matrix transform, the tangent of 30° is represented as pow(3,-.5). There are quite a few ...

View answer
14 answers
21 votes
3k views
Cheating Cyclic Quine
5 votes

JavaScript (ES6), 69 60 59 bytes (_0=_=>console.log(`(_0=${_0})()`.replace(/0/g,n=>+!+n)))() Outputs: (_1=_=>console.log(`(_1=${_1})()`.replace(/1/g,n=>+!+n)))() -1 byte (@...

View answer
1
2 3 4 5