<commit_before><!DOCTYPE html>
<head>
    <title>FISH FEEDER</title>
    <script src="https://netpie.io/microgear.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
    <script src="jquery.knob.js"></script>
	<script type="text/javascript">

    var appid, appkey, appsecret;
        var a = location.hash.substring(1).split(':');
        if (a.length==3) {
            appid = a[0];
            appkey = a[1];
            appsecret = a[2];
        }
        else {
            alert("Please parse appid, appkey and appsecret as a hash e.g. :\n\n"+location+"#APPID:APPKEY:APPSECRET");            
        }
        
        var microgear = Microgear.create({
            key: appkey,
            secret: appsecret,
            alias : "feederapp"
        });

        microgear.on('message',function(topic,msg) {
            var foodcounter = document.getElementById("foodcounter");
            foodcounter.innerHTML= msg;
            foodcounter.style['margin-left'] = (-18*msg.length)+'px';
            console.log(msg);
        });

        microgear.on('connected', function() {
            var foodcounter = document.getElementById("foodcounter");
            foodcounter.style.color="#008800";

            microgear.subscribe("/foodcount");
            microgear.chat("fishfeeder","hi");
        });

        microgear.connect(appid);

        $(function() {
            $("input.infinite").knob({
                min : 0
                , max : 20
                , stopper : true
                , change : function (value) {
                    var rotation = Math.floor(value);
                        if(rotation==19){
                        microgear.chat("fishfeeder","start");
                    }
                }
                ,release : function (value) {
                    microgear.chat("fishfeeder","stop");
                    console.log("release");
                }
            });
        });
    </script>
	<style>
		#knobDiv{
			position:absolute;
			z-index:2;
			top:50%;
			left:50%;
		}

		#foodcounter{
			top:50%;
			left:50%;
			position:absolute;
			color:#6E6D6D;
			z-index:1;
		}
	</style>
</head>
<body class='layout-document' bgcolor="#A0A0A0 ">
		<div style="" id="foodcounter">0</div>
		<div class="outer" align="center">
            <div id="knobDiv">
                <input class="infinite" data-thickness=".4" data-displayInput="false" data-cursor=true value="0" id="knob">
            </div
        </div>
</body>
</html>

<script>
	var w = window.innerWidth;
	var h = window.innerHeight;
	document.getElementById('knobDiv').style.height = (h-40)+'px';
	document.getElementById('knobDiv').style.width = (w-40)+'px';
	document.getElementById('knobDiv').style.marginTop = "-"+Math.floor((h/2)-20)+'px';
	document.getElementById('knobDiv').style.marginLeft = "-"+Math.floor((w/2)-20)+'px';

	if(w>h) document.getElementById('foodcounter').style.fontSize = Math.floor(h/5)+"px";
	else document.getElementById('foodcounter').style.fontSize = Math.floor(w/5)+"px";
	document.getElementById('foodcounter').style.marginTop = "-"+Math.floor((document.getElementById('foodcounter').style.fontSize).replace("px","")/2)+'px';<commit_msg>update knob position<commit_after><!DOCTYPE html>
<head>
    <title>FISH FEEDER</title>
    <script src="https://netpie.io/microgear.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
    <script src="jquery.knob.js"></script>
	<script type="text/javascript">

    var appid, appkey, appsecret;
        var a = location.hash.substring(1).split(':');
        if (a.length==3) {
            appid = a[0];
            appkey = a[1];
            appsecret = a[2];
        }
        else {
            alert("Please parse appid, appkey and appsecret as a hash e.g. :\n\n"+location+"#APPID:APPKEY:APPSECRET");            
        }
        
        var microgear = Microgear.create({
            key: appkey,
            secret: appsecret,
            alias : "feederapp"
        });

        microgear.on('message',function(topic,msg) {
            var foodcounter = document.getElementById("foodcounter");
            foodcounter.innerHTML= msg;
            foodcounter.style['margin-left'] = (-18*msg.length)+'px';
            console.log(msg);
        });

        microgear.on('connected', function() {
            var foodcounter = document.getElementById("foodcounter");
            foodcounter.style.color="#008800";

            microgear.subscribe("/foodcount");
            microgear.chat("fishfeeder","hi");
        });

        //microgear.connect(appid);

        $(function() {
            $("input.infinite").knob({
                min : 0
                , max : 20
                , stopper : true
                , change : function (value) {
                    var rotation = Math.floor(value);
                        if(rotation==19){
                        microgear.chat("fishfeeder","start");
                    }
                }
                ,release : function (value) {
                    microgear.chat("fishfeeder","stop");
                    console.log("release");
                }
            });
        });
    </script>
	<style>
		#knobDiv{
			position:absolute;
			z-index:2;
			top:50%;
			left:50%;
		}

		#foodcounter{
			top:50%;
			left:50%;
			position:absolute;
			color:#6E6D6D;
			z-index:1;
		}
	</style>
</head>
<body class='layout-document' bgcolor="#A0A0A0 ">
		<div style="" id="foodcounter">0</div>
		<div class="outer" align="center">
            <div id="knobDiv">
                <input class="infinite" data-thickness=".4" data-displayInput="false" data-cursor=true value="0" id="knob">
            </div
        </div>
</body>
</html>

<script>
	var w = window.innerWidth;
    var h = window.innerHeight;
    var knobSize = 200;
    if(w>h){
        knobSize=h-40;
    }else{
        knobSize=w-40;
    }
	document.getElementById('knobDiv').style.height = (h-40)+'px';
	document.getElementById('knobDiv').style.width = (w-40)+'px';
	document.getElementById('knobDiv').style.marginTop = "-"+(knobSize/2)+'px';
	document.getElementById('knobDiv').style.marginLeft = "-"+Math.floor((w/2)-20)+'px';

	if(w>h) document.getElementById('foodcounter').style.fontSize = Math.floor(h/5)+"px";
	else document.getElementById('foodcounter').style.fontSize = Math.floor(w/5)+"px";
	document.getElementById('foodcounter').style.marginTop = "-"+Math.floor((document.getElementById('foodcounter').style.fontSize).replace("px","")/2)+'px';
{'fraction_non_alphanumeric': 0.1714329175540006, 'fraction_numerical': 0.016884697292363856, 'mean_word_length': 2.1534772182254196, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 56, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '298910', 'n_tokens_mistral': 2164, 'n_tokens_neox': 2012, 'n_words': 304}