Skip to content

Instantly share code, notes, and snippets.

View promatik's full-sized avatar
🌊

António Almeida promatik

🌊
View GitHub Profile
@promatik
promatik / pt-PT.php
Created April 6, 2013 03:08
UserCake v2.0.2 pt-PT - Portuguese Language Translation
<?php
/*
UserCake Version: 2.0.2
http://usercake.com
Portuguese Translation
*/
/*
%m1% - Dymamic markers which are replaced at run time by the relevant index.
*/
@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 / 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);
@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 / A.markdown
Last active December 4, 2016 21:27
Sublime Text 2 Twilight Sidebar Theme

This re-styles your sublime text sidebar to be dark, it fits default Twilight theme.

Twilight sidebar

Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.

Based on:

@promatik
promatik / Penalty shootout.js
Created April 12, 2016 22:39
Check whenever penalty shootout game is finished or not
// --------------------
// Penalty Shoot-out
// Ilustrated example at https://jsfiddle.net/promatik/yo00Lr4e/
// --------------------
function checkPenaltyShootOutEnd(round, score1, score2, total_rounds, first_shooter) {
return Math.abs(score1-score2) > (round > total_rounds ? round % 2 : Math.ceil((10-round) / 2) - (first_shooter ^ score1 < score2 ? 0 : round % 2));
}
// --------------------
@promatik
promatik / styles.less
Last active September 22, 2016 22:53 — forked from adrexia/styles.less
Atom - hide file icons and replace arrows
.tree-view {
.icon:before {
display:none;
}
.list-group li:not(.list-nested-item), .list-tree li:not(.list-nested-item), .list-group li.list-nested-item > .list-item, .list-tree li.list-nested-item > .list-item {
line-height: 21px;
}
.list-group .selected:before, .list-tree .selected:before {
height: 21px;
}
@promatik
promatik / A.markdown
Created December 4, 2016 21:16
Sublime Text 3 - Twilight Sidebar Theme

This re-styles your sublime text 3 sidebar to be dark, it fits default Twilight theme.

Twilight sidebar

Go to Menu > Preferences > Browse Packages, save the Default.sublime-theme file into the "User" folder.

Based on:

@promatik
promatik / BladeTranslate.sublime-snippet
Last active April 24, 2017 16:35
Laravel Blade Translate Snippet Shortcut
<snippet>
<content><![CDATA[
{{ __("$TM_SELECTED_TEXT") }}
]]></content>
<tabTrigger>t</tabTrigger>
<scope>text.blade.php</scope>
</snippet>
@promatik
promatik / Main.java
Last active November 28, 2017 17:46
HashMap vs Object variable cast performance test
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
new Main();
}