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.
6
votes
How much bounty is out on Stackoverflow?
PHP, 134, 131, 127
while($q=array_sum(preg_filter('#.*>\+#',0,file("http://stackoverflow.com/questions?sort=featured&page=".++$n))))$s+=$q;echo$s;
Will loop through all pages, pagesize is not set to …
1
vote
Running length of the movie in a human readable format
PHP, 77 76 bytes
$m=($i=$argv[1])%60;echo$h=$i/60|0," hour","s"[$h<2]," $m minute","s"[$m<2];
horible, horible, horible!
PHP only issues a couple of Notices for "s"[$h<2]
To run: php -r 'CODE' '15 …
2
votes
Chemical sentences! Decrypting
Python 2.x, 295 bytes
Golfed code:
import re;print''.join([re.findall('[A-Z ][a-z]*',' HHeLiBeBCNOFNeNaMgAlSiPSClArKCaScTiVCrMnFeCoNiCuZnGaGeAsSeBrKrRbSrYZrNbMoTcRuRhPdAgCdInSnSbTeIXeCsBaLaCePrNdPmS …
2
votes
The unique multiplication spiral
Python, 99 95 90 89 87 81 bytes
Golfed code:
n=range(1,input()+1);m=[]
for x in n:l=[(x*y,0)[x*y in m]for y in n];m+=l;print l
Ungolfed:
n=range(1,input()+1);
m=[]
for x in n:
l=[(x*y,0)[x*y …
9
votes
Tips for Regex Golf
Optimize you OR's
Whenever you have 3 or more alternatives in your RegEx:
/aliceblue|antiquewhite|aquamarine|azure/
Check to see if there's a common start:
/a(liceblue|ntiquewhite|quamarine|z …
4
votes
The sum is always 15
Python2powered by RegEx: 158 155 bytes
Made in python with love and almost no math.
Or Regex Math if you will, unary math.
'Real' math used only to 'fix' the last requirement:
If the sum of the final …
10
votes
Cops and Robbers: Reverse Regex Golf
PCRE - 96bytes UTF8, no delimiters, no flags
[Defeated] because nneonneo is a wise-guy
(?<Warning>[You] \Will (*FAIL)!|\So just (*SKIP)this one!|\And (*ACCEPT)defeat!|[^\d\D]{16,255})
Nothing to …