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.
2
votes
Triforce ReBoot
HTML+CSS, 352 290 261 257
<div style="width:0;border:50px solid #fff;border-bottom-color:#00f">
<p style="border:25px solid #00f;border-top-color:#fff;border-bottom:0;margin:25px 0 0 -25px">
<p style …
2
votes
Homework time! Find me the lowest even digit in a string
Powershell, 76 73 71
$s=read-host;2,4,6,8|%{if($i=$s.indexof("$_")+1){"$i,$_";break}};"-1,0"
$s=read-host stores user input into $s
2,4,6,8|%{...} runs what's inside {} for digits 2,4,6, …
7
votes
minigolf - display anything 3d
Logo, 31 characters
My Logo is a bit rusty, but this should draw a torus:
repeat 180[rt 2 circle 45 fw 3]
Run it online: http://logo.twentygototen.org/9NxYy2Pw.
2
votes
Triforce ReBoot
HTML, 101
<img style=position:absolute;clip:rect(30px,130px,110px,20px) src=https://i.sstatic.net/iE6m9.png>
5
votes
Shortest Code to Legitimately Slack Off
MSBuild, 130 bytes
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="X">
<Exec Command="msbuild"/>
</Target>
</Project>
Save this as a file with .pro …
10
votes
100 Day Countdown
PowerShell, 10 bytes
(date)+1e2
Thanks to ConnorLSW for the +1e2 trick.
It appears that doubles (1e2 is a double) are also added as days.
Previous version, 12 bytes:
(date)+"100"
Apparently you can …
3
votes
Output with the same length as the code
Powershell, 3 bytes
1E2
Prints 100
5
votes
Output with the same length as the code
Powershell, 38 bytes
Just for fun, an answer that returns different output each time it's called.
[System.Guid]::NewGuid().ToString("B")
Prints a GUID surrounded with braces ("B"), such as:
{24cc14a3 …
8
votes
How many friday the 13th in a year?
Powershell, 68 63 58 52 50
Thanks Iszi for the tip.
$n=$args;(1..12|?{!+(date $n-$_).DayOfWeek}).Count
Using the fact that if the 1st day in the month is Sunday, the 13th will be Friday.
I've a …
2
votes
What's the time, chap?
Powershell, 49 bytes
"It's {0:hh:mm}$("ap"[($d=date).hour/23]).m."-f$d
(date).hour/23 seems to work as an index for "ap" because it rounds to 0 for hours less than 12 and 1 for 12 and above.
4
votes
Output the Current Time
Powershell, 19 bytes
for(){date;sleep 1}
3
votes
Cover up zeroes in a list
Powershell, 32 bytes
param($x)$x|%{($t=($_,$t)[!$_])}
$x|%{...} does the script block for each element in $x. ($_,$t) is an array of current element and $t, and [!$_] means that we use !$_ to index …
30
votes
Produce the number 2014 without any numbers in your source code
PowerShell, 9 bytes
+"ߞ"[""]
Try it online!
ߞ (U+07DE NKO LETTER KA) is counted as two bytes according to the code-golf tag info.
[""] returns the first character from the string ("" is converted to …
7
votes
Display Continued Fractions
XSLT 1.0
I thought it'd be nice to display the fractions with HTML, so here's an XSLT solution.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19 …
164
votes
Draw the Olympic Games logo
Commodore 64 BASIC
Writing directly in the screen and color memory.
Output:
Here's how you do this with sprites.