Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View almirsarajcic's full-sized avatar

Almir Sarajčić almirsarajcic

View GitHub Profile
@almirsarajcic
almirsarajcic / ignore_added_heroicons.js
Created October 12, 2023 09:03
Ignore Heroicons during PR review
document.querySelectorAll('.file.js-file[data-file-type=".svg"][data-tagsearch-path*="heroicons"] .js-reviewed-checkbox:not([checked])').forEach((checkbox) => checkbox.click())
@almirsarajcic
almirsarajcic / github-branches-removal.js
Created March 13, 2017 14:15
Remove branches from the GitHub repo
var preservedBranches = [
'master', 'develop'
];
// Remove branches on the current page
var branches = document.getElementsByClassName('branch-summary');
for (var i = 0; i < branches.length; i++) {
var branchName = branches[i].dataset.branchName;
var KrizaljkaCtrl = angular.element('.krizaljka').scope();
KrizaljkaCtrl.switchAutoProvjera();
for (i = 0; i < KrizaljkaCtrl.krizaljka.odgovori.length; i++) {
var hash = KrizaljkaCtrl.krizaljka.odgovori[i];
if (hash.tip == 'odgovor' || hash.tip == 'istaknutiodgovor') {
hash.inputValue = hash.val;
$('.kockica[x="' + hash.coords.x + '"][y="' + hash.coords.y + '"] input')
var interval = 500.5,
container = $('#container'),
score = $('#score'),
lastScore = 0,
addend = -1,
clickCount = 0,
clickLimit = 40,
playButton = $('#play'),
restartButton = $('.restart');
@almirsarajcic
almirsarajcic / determine_playerslot.php
Last active December 14, 2015 09:28
Function returns decimal player slot for $player_slot returned by DOTA2 WebAPI. $player_slot∈(0, 4)∪(128, 132) result∈(0, 9)
<?php
function determine_playerslot($player_slot)
{
$binary = sprintf('%08b', $player_slot);
$team = substr($binary, 0, 1);
$slot = bindec(substr($binary, 1));
return $team * 5 + $slot;
}
@almirsarajcic
almirsarajcic / steamid_conversion.php
Last active October 20, 2020 22:06
Functions used to convert 64bit Steam ID to 32bit and the other way around.
<?php
function convert_steamid_64bit_to_32bit($id)
{
$result = substr($id, 3) - 61197960265728;
return (string) $result;
}
function convert_steamid_32bit_to_64bit($id)
{
@almirsarajcic
almirsarajcic / login.html
Created July 31, 2012 07:44
phpBB3 login form
<form action="/forum/ucp.php?mode=login" method="post">
<input type="text" name="username" size="18" placeholder="Username">
<input type="password" name="password" size="18" placeholder="Password">
<input type="checkbox" name="remember" value="yes" checked="">
<input type="hidden" name="autologin" value="on">
<input type="hidden" name="redirect" value="/">
<button value="Log in" name="login" type="submit">Log in</button>
<a href="/forum/ucp.php?mode=sendpassword">Forgotten password?</a>
<a href="/forum/ucp.php?mode=register">Register</a>
</form>