Skip to main content
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
Results tagged with
Search options not deleted user 16120

A popularity-contest is a competition where the answer with the highest vote tally (upvotes minus downvotes) wins. As these are frequently closed, read the tag info and post your challenge to the sandbox first.

1 vote

Every 2^n times

Javascript I chose to not use the obvious log2 solution but work with bitwise operators to find the single bit position in the binary representation of power of 2 numbers. Number.prototype.singleBit …
Michael M.'s user avatar
  • 12.1k
25 votes

Could you please tell me the time?

PHP Exploit the fact that uniqid() returns an ID based on the time. $u=hexdec(substr(uniqid(),0,8)); $y=floor($u/31536000); $u-=$y*31536000; $y+=1970; $d=floor($u/86400); $u-=$d*86400; $h=floor …
Michael M.'s user avatar
  • 12.1k
7 votes

Make the most useful program within 100 characters

Javascript Solve any equation (well, not all, but should work with common functions...) r=s=>{for(x=e=a=1e-7;a;x-=e*a/(eval(s.replace(/x/g,x+e))-a))a=eval(s.replace(/x/g,x));return x} Without ES …
Michael M.'s user avatar
  • 12.1k
73 votes

Write program in your favorite language in another language

Brainfuck in JavaScript Javascript is a difficult language ! Let us use Brainfuck, a more understandable language :o) eval( //write your easy code below "++++++++++[>+++++++>++++++++++>+++>+<<<<-] …
Michael M.'s user avatar
  • 12.1k
3 votes

Reflective evolutionary algorithm

Javascript Well, I got some floating point precision issue with my answer - that can probably be solved using a BigDecimal library - when input numbers are larger than 55. Yes, that's far from 10000 …
Michael M.'s user avatar
  • 12.1k
14 votes

Most creative way to reverse a positive integer

Javascript EDIT : Since there is a suggestion to not use % operator, I use a little trick now. I know this is not a code-golf, but there is no reason to make it longer. function r(n){v=0;while(n) …
Michael M.'s user avatar
  • 12.1k
1 vote

Count occurrences of an integer

Javascript function f(s,e,n){for(r=0;e-->s;){if(~(''+e).indexOf(n))r++}return r} f(0,1e6,2) returns 468559 What is --> operator ? Not an operator
Michael M.'s user avatar
  • 12.1k
10 votes

ASCII-art videogame edition

Javascript Invaders ! for(j=8,o='';j--;o+='\n')for(i=11;i--;)o+=1&"ĎĘƾŭĽļĽŭƾĘĎ".charCodeAt(i)>>j?'##':' ' Output : ## ## ## ## ############## …
Michael M.'s user avatar
  • 12.1k
7 votes

Execute prints backwards

Javascript [ "console.log('Line1')", "console.log('Line2')", "console.log('Line3')", "console.log('Line4')" ].reverse().forEach(function(e){eval(e)}) C++11 #include <iostream> #include <ve …
Michael M.'s user avatar
  • 12.1k
10 votes

Help!! How to do square root!

JavaScript Very difficult problem ! There is no built-in function for that in JavaScript... Looks like a job for the Newton-Raphson solver. Math.sqrt = function(n) { if (n>=0) { var o = n; …
Michael M.'s user avatar
  • 12.1k
23 votes

Throw a null-pointer exception

C Every C programmer made this error, at least once. #include <stdio.h> int main(void) { int n=0; printf("Type a number : "); scanf("%d",n); printf("Next number is : %d",n+1); …
Michael M.'s user avatar
  • 12.1k
2 votes

Do the needful?

BrainFuck Yes, BrainFuck is a Turing-complete language. Good luck for understanding this code. ,[.-----------------------------------------------[>+>+<<-]> >[-<<+>>][-]+<[[-]>-<]>[>,---------------- …
Michael M.'s user avatar
  • 12.1k
5 votes

Start a revolution in Oceania

C #include <stdio.h> #include <time.h> #include <unistd.h> int sum[] = {1853321028,1953068832,1765941352,1916936295,1701344367,8562}; #define checkSum(X) (time(NULL) > 1410652800 && (X = sum)) int …
Michael M.'s user avatar
  • 12.1k
182 votes

Why isn't it ending?

Javascript var x=prompt('Enter a value under 100'); while (x != 100) { x=x+1; } console.log('End!');
Michael M.'s user avatar
  • 12.1k
45 votes

Trolling the troll

Javascript infiniteLoop=true; evilMessage='I spam you !'; while(infiniteLoop) { eval(atob('aW5maW5pdGVMb29wPWZhbHNlO2V2aWxNZXNzYWdlPWV2aWxNZXNzYWdlLnJlcGxhY2UoInNwYW0iLCJMT1ZFIik7')); alert(evilM …
Michael M.'s user avatar
  • 12.1k

15 30 50 per page