fixed the price ticker for real this time

Hey all… its been a long time… I shouldn’t’ve left you (lol).  Welp I’ve been really too busy… far far too busy.  If you’re coming in at random, thanks for dropping by kind stranger!  Some of the things I’ve been doing since this update:

 

  • Working for a while….
  • Broke a TV and in the market for something new….
  • Less crypto research lately (which is THANKFULLY going to change soon)…
  • Just found out I can ‘letsEncrypt my entire setup!’ so we’re now doin SSL thangs baby via gratis without complaint….
  • Fixed the custom honeybadgerofmoney price ticker – for real this time!

So about that last point:

I was likely churning through any free tier service that offerred API access to the market price.  I originally wanted something private/premium but settled on going the free tier with coinmarketcap’s pro service.  I’m running local script that pulls ticker data for bitcoin (via cron), saves it to a JSON file – that’s then served by the ticker.  A MAJOR improvement I had been meaning to tackle for a while was getting rid of jQuery… I found a slick library that also grows/shrinks the text so it’s naturally flush with the parent div… that way when we’re all living the lambo dream and bitcoin is a billion dollars* a pop it won’t look unsightly in the ticker in the slightlest.

* Million dollars+

+ Few dozen thousand dollars

	<div id="tickerBox" style="background-size: cover; border-radius: 5px; background-image: url(&quot;https://farm2.staticflickr.com/1903/43910927340_064e85f4c3_b.jpg&quot;);"><div id="ticker" style="font-size: 51.9231px; font-weight: bold; letter-spacing: 2px; text-shadow: black 1px 2px 2px; padding-left: 10px; padding-top: 1rem; padding-bottom: 0.5rem; color: green;">$6419.12 <span id="super" style="font-size: small; vertical-align: top; letter-spacing: 0px;">USD</span></div><div id="checked" style="padding-left: 10px; color: white; text-shadow: black 2px 2px 1px;">Last Updated:6:57:48 PM</div></div>
<script>
        function generateBG(){
            var script = document.createElement("script");
            script.src = "https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=handleFlickr&tags=Mellivora+capensis&tagmode=any&format=json";
            document.head.appendChild(script);
        }

        function handleFlickr(data) {
            // console.log(data);
            var rnd = Math.floor(Math.random() * data.items.length);
            var image_src = data.items[rnd]['media']['m'].replace("_m", "_b");
            document.getElementById('tickerBox').style.backgroundImage = "url('" + image_src + "')";
        }
        var tickerBox = document.getElementById('tickerBox');
        var divTicker = document.createElement('div');

        divTicker.setAttribute("id", "ticker");
        tickerBox.appendChild(divTicker);
        divTicker.style.fontSize = "4rem";
        divTicker.style.fontWeight = "bold";
        divTicker.style.letterSpacing = "2px";

        var checked = document.createElement('div');
        checked.setAttribute("id", "checked");
        tickerBox.appendChild(checked);
        var dataLast;

        function priceData() {
            var ticker = document.getElementById('ticker');
            var lastUpdated = document.getElementById('checked');
            var datetime = "Last Updated:" + new Date().toLocaleTimeString();

            fetch("https://honeybadgerofmoney.com/price.json")
                .then(response => response.json())
                .then(result => {
                    var data = result.price;
                    // console.log(data);
                    //data = data[0].price_usd;
                    if (parseFloat(data) >= parseFloat(dataLast)) {
                        divTicker.style.color = "green";
                    } else {
                        divTicker.style.color = "red";
                    }
                    var formatted = parseFloat(data).toFixed(2);
                    ticker.innerHTML = "$" + formatted.toString() + " <span id='super'>USD</span>";
                    window.fitText(document.getElementById('ticker'), .52);
                    superscript = document.getElementById('super');
                    superscript.style.fontSize = "small";
                    superscript.style.verticalAlign = "top";
                    superscript.style.letterSpacing = "0px";
                    checked.innerHTML = datetime;
                    dataLast = data;

                });
                generateBG();


        };
        priceData();
        setInterval(priceData, 10000);
        checked.style.paddingLeft = "10px";
        checked.style.color = "white";
        checked.style.textShadow = "2px 2px 1px black";
        ticker.style.textShadow = "1px 2px 2px black";
        ticker.style.paddingLeft = "10px";
        tickerBox.style.backgroundSize = "cover";
        //tickerBox.style.width = "20rem";
        //tickerBox.style.height = "8rem";
        ticker.style.paddingTop = "1rem";
        ticker.style.paddingBottom = ".5rem";
        tickerBox.style.borderRadius = "5px";
        // tickerBox.style.backgroundPosition="40px 0px";
    </script>

    <script>
        /*!	
         * FitText.js 1.0 jQuery free version
         *
         * Copyright 2011, Dave Rupert http://daverupert.com 
         * Released under the WTFPL license 
         * http://sam.zoy.org/wtfpl/
         * Modified by Slawomir Kolodziej http://slawekk.info
         *
         * Date: Tue Aug 09 2011 10:45:54 GMT+0200 (CEST)
         */
        (function() {

            var addEvent = function(el, type, fn) {
                if (el.addEventListener)
                    el.addEventListener(type, fn, false);
                else
                    el.attachEvent('on' + type, fn);
            };

            var extend = function(obj, ext) {
                for (var key in ext)
                    if (ext.hasOwnProperty(key))
                        obj[key] = ext[key];
                return obj;
            };

            window.fitText = function(el, kompressor, options) {

                var settings = extend({
                    'minFontSize': -1 / 0,
                    'maxFontSize': 1 / 0
                }, options);

                var fit = function(el) {
                    var compressor = kompressor || 1;

                    var resizer = function() {
                        el.style.fontSize = Math.max(Math.min(el.clientWidth / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)) + 'px';
                    };

                    // Call once to set.
                    resizer();

                    // Bind events
                    // If you have any js library which support Events, replace this part
                    // and remove addEvent function (or use original jQuery version)
                    addEvent(window, 'resize', resizer);
                    addEvent(window, 'orientationchange', resizer);
                };

                if (el.length)
                    for (var i = 0; i < el.length; i++)
                        fit(el[i]);
                else
                    fit(el);

                // return set of elements
                return el;
            };
        })();
    </script>

What’s left to tinker with before getting back to seeking paying work :p

 

  1. Let’s see I’m going to fix the craigslist job listings widget OR make my own scraper similar to the ticker so we can show bitcoin jobs… although… THESE DAYS… we have a TON of cryptocurrency gig economy sites to find paying work.  Back in my day these were all but non-existent so I was trying to niche out some way to find these kind of endeavors.

  2. I made a client side QR code generator that all lives in a single file (JUST LIKE the way the ticker v3 works)…. for this…. I’m going to set it up to do two sets of QR codes with correlated private key space to cut out so that these coins can be loaded
  3. I wrote a poor mans bitcoin mining script that used directory.io and eventually bitcoinlist.io.  The way it worked was it pulled a page at random from this place and sees if a balance exists… they way I see it though, that site could potentially just sweep the funds while telling you that the balance was zero… therefore I’m going to build my own client-side generator that works with a url parameter to generate a list of private keys and correlated public keys to parse and seek a balance for… based on some feedback from github on the subject, I’m going to have the script feed the keys into a wallet, perodically check (like once every 30 minutes or so) the balance, then generate a new wallet, dump keys into that new wallet, repeat… essentially at the end of each day, compress the generated wallets if u wished.
  4. bonus: private ad space that appears despite ad blocking via randomization and proxy loading of content to circumvent tracker blockers (maybe)

 

 

 

 

Post Author: Frankenmint

From the pristine land of the internetz, the Frankenment was bred from machine. While looking to embrace the new world Linux regime he is truly a windows bred. I've come from the darkness to the light to share with you other internetz fol-ken to share the message of virtual money. Through our actions, we can make the virtual world yet again beyond the decree of the internet, with the decree of internetz money! Bitcoin, the Supercurrency, the official tender of the internetz that will be accepted by all countries and all fol-ken Alike!