Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
1
vote
"cat"-like program
TeaScript, 1 byte
x
Input is given in the first input field.
Compile online here.
2
votes
Let's abbreviate those numbers! Now reverse?
JavaScript, 545 524 522 518 514 508 504 498 494 214 bytes
Thanks to @ETHproductions for saving 180 bytes!
d=F=>F.map(f=>1/f.slice(-1)?f=(f=f.replace(/,/g,""))[9]?(f/1e8|0)/10+"B":f[6]?(f/1e5|0)/10+"M" …
1
vote
Shortest program that continuously allocates memory
Fission, 3 bytes
RX+
Continuously creates atoms and increments its mass.
Try it online!
R creates an atom moving right
X clones atom, one keeps moving to the right, th …
1
vote
Implement a Truth-Machine
Haystack, 9 bytes
id?v
|o<o
Try it online!
I'm aware that there already is a Haystack answer, but that answer uses the older version of Haystack, this answer uses Haystack 2016 (and it's much shorter …
1
vote
Calculator that adds char values
Minkolang, 6 bytes
$o$+N.
Try it online!
Explanation
$o takes all characters from input as chars (the characters are automatically
converted to their character codes)
$+ su …
3
votes
Shortest auto-destructive loop
Octave, 30 23 bytes
Thanks to @StewieGriffin for golfing off 7 bytes!
for i=32:35,eval(i),end
Try it online!
I was inspired by this Octave answer where eval was used in a similar fashion.
Old answer …
8
votes
I copied my password to the clipboard! Can you delete it?
Bash, 11 10 8 7 bytes
2 bytes saved thanks to @seshoumara for using ls instead of echo
Thanks to hexafraction, isaacg and Riker for suggesting several 7-byters
w|xclip
The clipboard is set to the re …
1
vote
Shortest code to produce infinite non-periodic output
Processing, 30 29 bytes
1 byte saved thanks to QwerpDerp for using millis() instead of frameRate
void draw(){print(millis());}
Continuously prints the number of milliseconds since the start of the p …
2
votes
Tell me my screen resolution!
Processing, 51 bytes
void setup(){fullScreen();print(width+"x"+height);}
This outputs in this format: width height. Also, the program creates a window that is the size of the screen you are using (be …
5
votes
Shortest infinite loop producing no output
Processing, 8 bytes
for(;;);
This is based on Geobit's answer in Java
Although the code below is not the shortest, it is one of Processing's specialties.
void draw(){}
This draw statement r …
1
vote
Shortest infinite loop producing no output
Pushy, 2 1 bytes
[
Try it online!
Hah, [ is just an infinite loop, that's its only function if you see here.
4
votes
Press any key to continue
Processing, 89 81 bytes
void setup(){print("Press any key to continue...");}void draw(){if(key>0)exit();}
Explanation
void setup(){print("Press any key to continue...");}
This is required sinc …
2
votes
Help the dealer rebuild the deck
sed, 157 + 1 (-r flag) = 170 158 bytes
x
s/$/;A2345678910JQK/
s/.+/&H&D&S&C;No missing cards/
:
s/(10|\w)(\w+)(.);/\1\3 \2\3;/
t
G
:s
s/(10.|[^ ;1]{2})(.*\n.*)\1/\2/
ts
s/[ ;]+/ /g
s/^ //
s/ N.+//
…
5
votes
Reversed Iota's
shell + sed, 15 bytes
seq $1|sed G\;h
Try it online!
Outputs like so, 1\n\n2\n1\n\n3\n2\n1\n\n[...]
seq $1 creates a sequence from 1 to the first argument $1
|sed ... which is piped into a sed …
15
votes
Unlolify a lolified message
dc, 2 bytes
?P
Try it online!
A full program that ? reads input as an integer and P prints the string resulting from the operation specified in the challenge.
From its manual page:
P Pops of …