Skip to content

Instantly share code, notes, and snippets.

View promatik's full-sized avatar
🌊

António Almeida promatik

🌊
View GitHub Profile
@promatik
promatik / facebook-share.html
Created April 15, 2013 02:38
Simple Facebook Share Button, very easy to replicate. Example here: http://promatik.no.sapo.pt/data/facebook-share.html
<!DOCTYPE html>
<html>
<head>
<title>Simple Facebook Share Button</title>
<style>
.fb-share-div {
float: left;
height: 18px!important;
border-radius: 3px;
border: 1px solid #CAD4E7;
@promatik
promatik / guessing-game
Created May 26, 2015 10:46
Guessing Game Simulator
function guessingGame(testcases, useMidPoint) {
useMidPoint = useMidPoint || false;
var correct = i = 0,
r = Math.random;
for (i=testcases;i;i--) {
var a = r(), b = r(), k = useMidPoint ? 0.5 : r();
correct += (k < a && a > b) || (k > a && a < b);
}
@promatik
promatik / monty-hall-simulation
Created April 7, 2015 14:32
Monty Hall Simulation
function montyhallSimulation(playerChangeOpt, testcases)
{
playerChangeOpt = typeof playerChangeOpt !== 'undefined' ? playerChangeOpt : true;
testcases = typeof testcases !== 'undefined' ? testcases : 100;
var right = 0, wrong = 0;
for(i=0 ; i<testcases ; i++) {
var carPos = Math.floor(Math.random()*3);
var playerOpt = Math.floor(Math.random()*3);