Skip to content

Instantly share code, notes, and snippets.

View ivanpepelko's full-sized avatar
🐧
Kowalski, analysis!

Ivan Pepelko ivanpepelko

🐧
Kowalski, analysis!
View GitHub Profile
@ivanpepelko
ivanpepelko / dotabuff-trendline.js
Last active September 3, 2015 19:54
Dotabuff trendline
(function () {
var svg = $('.player-chart-container svg'); //selector is valid only for charts under Trends pages
if (typeof (svg[0]) !== 'undefined') { //if there is no graph in page, do nothing
$('#trendline').remove(); //remove previously drawn line
var points = $('circle'); //get all graph points
//calculate parameters needed for trendline
var cnt = points.length;
var sumx, sumy, sumx2, sumxy;
sumx = sumy = sumx2 = sumxy = 0;
points.each(function () {
@ivanpepelko
ivanpepelko / dotabuff-trendline-bookmarklet.js
Last active August 29, 2015 14:22
Dotabuff trendline bookmark
javascript:(function(){var%20t=$(".player-chart-container%20svg");if("undefined"!=typeof%20t[0]){$("#trendline").remove();var%20e=$("circle"),a=e.length,r=0,n=0,i=0,c=0;e.each(function(){var%20t=$(this);x=parseFloat(t.attr("cx")),y=parseFloat(t.attr("cy")),r+=x,n+=y,i+=Math.pow(x,2),c+=x*y});var%20l=(a*c-r*n)/(a*i-Math.pow(r,2)),o=(n-l*r)/a,p=e.eq(0).attr("cx"),s=e.last().attr("cx"),d=l*p+o,h=l*s+o,f=p+","+d+","+s+","+h,v="FBB829";v=d>h?"A9CF54":"C23C2A";var%20g='<g%20class=line%20id=trendline><path%20stroke="#'+v+'"%20stroke-width="2"%20fill="none"%20d="M'+f+'"></g>';t.find("g[transform]").eq(0).append(g),t[0].innerHTML=t[0].innerHTML.replace("</path>","")}})()
@ivanpepelko
ivanpepelko / dotabuff-sort-v2.js
Last active September 30, 2015 09:35
Dotabuff heroes sorting
(function () {
$('.tableAd').remove();
$('.score').remove();
var totalMatches = parseInt($('.game-record .wins').text().replace(',', ''))
+ parseInt($('.game-record .losses').text().replace(',', ''))
+ parseInt($('.game-record .abandons').text().replace(',', ''));
$('table thead tr').append('<th class="nosort score" data-sortcolumn="5" data-sortkey="5-0">Score</th>');
$('table tbody tr').each(function() {
var MP = parseInt($(this).find('td').eq(2).text());
@ivanpepelko
ivanpepelko / dotabuff-sort.min.js
Created June 16, 2015 23:45
Dotabuff heroes sorting minified
(function(){$(".tableAd").remove();var t=parseInt($(".game-record .wins").text().replace(",",""))+parseInt($(".game-record .losses").text().replace(",",""))+parseInt($(".game-record .abandons").text().replace(",",""));console.log(t),parseFloat($("table tbody tr").eq(0).find("td").eq(4).text());var e=$("table tbody tr").sort(function(e,a){var r=parseInt($(e).find("td").eq(2).text()),d=parseFloat($(e).find("td").eq(3).text()),n=parseFloat($(e).find("td").eq(4).text()),o=parseInt($(a).find("td").eq(2).text()),s=parseFloat($(a).find("td").eq(3).text()),l=parseFloat($(a).find("td").eq(4).text()),p=r/t*d*n,i=o/t*s*l;return i-p});$("table tbody").html(e)})();
@ivanpepelko
ivanpepelko / redirect-to-multitwitch-tv.js
Created June 24, 2015 01:16
Creates checkboxes under stream thumbnails to create link to multitwitch.tv
$('.meta [type=checkbox]').remove();
$('h2.title #go-multi').remove();
$('#go-multi').off('click');
$('.meta').append('<input type=checkbox>');
$('h2.title').append('<a id=go-multi href=#>Go Multi</a>');
$('#go-multi').on('click', function () {
var mt = 'http://multitwitch.tv';
$('.meta [type=checkbox]:checked').closest('.content').find('a.cap').each(function () {
@ivanpepelko
ivanpepelko / redirect-to-multitwitch-bookmark.js
Created June 24, 2015 01:19
Redirect to multitwitch Bookmark
javascript:(function(){$(".meta%20[type=checkbox]").remove(),$("h2.title%20#go-multi").remove(),$("#go-multi").off("click"),$(".meta").append("<input%20type=checkbox>"),$("h2.title").append("<a%20id=go-multi%20href=#>Go%20Multi</a>"),$("#go-multi").on("click",function(){var%20t="http://multitwitch.tv";$(".meta%20[type=checkbox]:checked").closest(".content").find("a.cap").each(function(){t+=$(this).attr("href")}),window.location=t})})()
javascript:!function(){var r=prompt("Complexity?","ABCDEFGH"),t="";if(null===r)return!1;var n=parseInt(r);if(Number.isNaN(n))t=r.split("");else{isN=isN>16?8:isN;for(var o=0;o<isN;o++)t+=String.fromCharCode(65+o);t=t.split("")}var i=[];t.forEach(function(r){i.push([r,5*Math.round(4*Math.random()+1)])}),i=i.sort(function(r,t){return r[1]-t[1]});var a="",e="";return i.forEach(function(r){a+=r[0].repeat(r[1]),e+=r[0]+": "+r[1]+"\n"}),confirm(e)?void(location.href="http://huffman.ooz.ie/?text="+a):!1}();
; ===============================================
; Postavljnje MCU i kofiguracijska rijec
; ===============================================
PROCESSOR 16F84A
#include "p16f84a.inc" ; ova datoteka sadrzi sva imena registara specijalnih namjena i njihove adrese od PIC16F84A mikrokontrolera
ERRORLEVEL -224
__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF ; procesorske direktive
org 0x0 ; pocetna adresa od koje mikrokontroler krece nakon dovodenja napajanja
@ivanpepelko
ivanpepelko / zadatak2.asm
Last active December 22, 2015 15:47
22-12-2015
; ===============================================
; Postavljnje MCU i kofiguracijska rijec
; ===============================================
PROCESSOR 16F84A
#include "p16f84a.inc" ; ova datoteka sadrzi sva imena registara specijalnih namjena i njihove adrese od PIC16F84A mikrokontrolera
ERRORLEVEL -224
__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF ; procesorske direktive
org 0x0 ; pocetna adresa od koje mikrokontroler krece nakon dovodenja napajanja
;*******************************************************************************
;*
;* PORTA
;* RA1 - Crveni led
;* RA2 - Zuti led
;* RA3 - Zeleni led
;*
;* PORTB
;* RB0-RB7 - 7-segmentni display
;*