<commit_before>
  command: 'curl -s "http://legacy.cafebonappetit.com/api/2/menus?cafe=261"',
  refreshFrequency: 6000000,



  render: function(output) {
    return [
        '<div id="widgetTitle"></div>',
        '<div id="date" class="e"></div>',
        '<div id="food" class="e"></div>',
        '<div id="footer"></div>',
    ].join('')
  },

  update: function(output, domEl) {

    function createOutputString(okItems){
        var str = "";
        for(var i = 0; i < okItems.length; i++){
            str+= okItems[i]+"<br><br>";
        }
        return str;
    }

    function parseDate(x){
        var m,d,y;
        y=x.substr(0,4);
        m=x.substr(5,2);
        d=x.substr(8,2);

        var rawToday = new Date(y+"-"+m+"-"+d);
        var offsetDate = Date(rawToday - rawToday.getTimezoneOffset());
        var todayDate = new Date(offsetDate).toString();
        var today = todayDate.substr(0,10);

        return today.toString();
    }

    function parseMenu(menu){
        // enum object to map diets to numbers
        var diets = {
            "FTF"   : 6, // farm to fork
            "GF"    : 9, // gluten free
            "VEG"   : 1, // vegetarian
            "VEGAN" : 4, // vegan
        };

        // your selected diets
        var preferredDiet = diets.GF;

        console.log ("menu: ")
        console.log(arguments);

        var okItems = [];
        var prevStation = "";

        for(var prop in menu){
            var item = "";
            // looping through the properties on an element
            if(menu.hasOwnProperty(prop)){
                // Icon (filtering dietary restrictions)
                if(menu[prop].cor_icon.hasOwnProperty(preferredDiet)){
                    // Station
                    if(menu[prop].station != prevStation){
                        // clean station string
                        item = cleanUpStationLabel(menu[prop].station + "<br />");
                        // push food label next to the station
                        item += "⚬ " + capitalizeStr(menu[prop].label, 0, 1);
                        // the previous station
                        prevStation = menu[prop].station;
                    }
                    // same station with more items
                    else {
                        // the served food item
                        item = "⚬ " + capitalizeStr(menu[prop].label, 0, 1);
                        // the previous station
                        prevStation = menu[prop].station;
                    }

                    // add it
                    okItems.push(item);
                }
            }
        }
        // Handle update on Mondays and 0 results
        if(okItems.length === 0) {
            // Body
            okItems.push("0 menu items found...");

            // Footer
            var theDay = new Date().getDay();
            if(theDay === 1) {
                var footer = document.getElementById("footer");
                footer.innerHTML = "*Note: the menu usually updates on Mondays";
            }
        }

        return okItems;
    }

    function cleanUpStationLabel(theStation) {
        // replace the @ symbol
        var cleanString = theStation.replace("@", "");
        // capitalize first letter
        var capitalizedStr = capitalizeStr(cleanString, 8, 9);
        // add back in the bold formatting
        capitalizedStr = "<strong>" + capitalizedStr + "</strong>";

        return capitalizedStr;
    }

    var dom,
     theDate,
     theMenu,
     title,
     jstringObj,
     outputString;

    dom = $(domEl);
    jstringObj = JSON.parse(output);
    theDate= parseDate(jstringObj.days[0].date);
    theMenu= jstringObj.items;
    var friendly= parseMenu(theMenu);
    outputString= createOutputString(friendly);

    title = "Stav Hall Menu";

    //Output
    dom.find(widgetTitle).html(title);
    dom.find(date).html(theDate);
    dom.find(food).html(outputString);
  },

  style: [
    "top: 20px",
    "left: 40px",
    "width:400px",
    "margin:0px",
    "padding:0px",
    "background:rgba(#FFF, 0.5)",
    "border:2px solid rgba(#000, 0.5)",
    "border-radius:10px",
    "overflow:hidden",

    "#date",
    "  margin:12pt",
    "  margin-bottom:12pt",
    "  font-family: Helvetica",
    "  font-size: 25pt",
    "  font-weight:bold",
    "  color: rgba(128,0,0,0.75)",

    "#title",
    "  margin-left:50pt",
    "  margin-right:12pt",
    "  font-family: American Typewriter",
    "  font-size: 20pt",
    "  font-weight:bold",

    "#description",
    "  margin-left:12pt",
    "  margin-right:12pt",
    "  font-family: American Typewriter",
    "  font-size: 12pt",
    "  line-height:18pt",
    "  max-height:10pt",
    "  overflow:hidden",
    "  hyphens: auto",

    "#food",
    "  height: auto",

    "#footer",
    "  font-family: Helvetica",
    "  font-size: 9pt",
    "  margin:12pt",
    "  color: rgba(#000, 0.5)",

    "p",
    "  margin: 0 0 0 20px",<commit_msg>Change height<commit_after>
  command: 'curl -s "http://legacy.cafebonappetit.com/api/2/menus?cafe=261"',
  refreshFrequency: 6000000,



  render: function(output) {
    return [
        '<div id="widgetTitle"></div>',
        '<div id="date" class="e"></div>',
        '<div id="food" class="e"></div>',
        '<div id="footer"></div>',
    ].join('')
  },

  update: function(output, domEl) {

    function createOutputString(okItems){
        var str = "";
        for(var i = 0; i < okItems.length; i++){
            str+= okItems[i]+"<br><br>";
        }
        return str;
    }

    function parseDate(x){
        var m,d,y;
        y=x.substr(0,4);
        m=x.substr(5,2);
        d=x.substr(8,2);

        var rawToday = new Date(y+"-"+m+"-"+d);
        var offsetDate = Date(rawToday - rawToday.getTimezoneOffset());
        var todayDate = new Date(offsetDate).toString();
        var today = todayDate.substr(0,10);

        return today.toString();
    }

    function parseMenu(menu){
        // enum object to map diets to numbers
        var diets = {
            "FTF"   : 6, // farm to fork
            "GF"    : 9, // gluten free
            "VEG"   : 1, // vegetarian
            "VEGAN" : 4, // vegan
        };

        // your selected diets
        var preferredDiet = diets.GF;

        console.log ("menu: ")
        console.log(arguments);

        var okItems = [];
        var prevStation = "";

        for(var prop in menu){
            var item = "";
            // looping through the properties on an element
            if(menu.hasOwnProperty(prop)){
                // Icon (filtering dietary restrictions)
                if(menu[prop].cor_icon.hasOwnProperty(preferredDiet)){
                    // Station
                    if(menu[prop].station != prevStation){
                        // clean station string
                        item = cleanUpStationLabel(menu[prop].station + "<br />");
                        // push food label next to the station
                        item += "⚬ " + capitalizeStr(menu[prop].label, 0, 1);
                        // the previous station
                        prevStation = menu[prop].station;
                    }
                    // same station with more items
                    else {
                        // the served food item
                        item = "⚬ " + capitalizeStr(menu[prop].label, 0, 1);
                        // the previous station
                        prevStation = menu[prop].station;
                    }

                    // add it
                    okItems.push(item);
                }
            }
        }
        // Handle update on Mondays and 0 results
        if(okItems.length === 0) {
            // Body
            okItems.push("0 menu items found...");

            // Footer
            var theDay = new Date().getDay();
            if(theDay === 1) {
                var footer = document.getElementById("footer");
                footer.innerHTML = "*Note: the menu usually updates on Mondays";
            }
        }

        return okItems;
    }

    function cleanUpStationLabel(theStation) {
        // replace the @ symbol
        var cleanString = theStation.replace("@", "");
        // capitalize first letter
        var capitalizedStr = capitalizeStr(cleanString, 8, 9);
        // add back in the bold formatting
        capitalizedStr = "<strong>" + capitalizedStr + "</strong>";

        return capitalizedStr;
    }

    var dom,
     theDate,
     theMenu,
     title,
     jstringObj,
     outputString;

    dom = $(domEl);
    jstringObj = JSON.parse(output);
    theDate= parseDate(jstringObj.days[0].date);
    theMenu= jstringObj.items;
    var friendly= parseMenu(theMenu);
    outputString= createOutputString(friendly);

    title = "Stav Hall Menu";

    //Output
    dom.find(widgetTitle).html(title);
    dom.find(date).html(theDate);
    dom.find(food).html(outputString);
  },

  style: [
    "top: 20px",
    "left: 40px",
    "width:400px",
    "margin:0px",
    "padding:0px",
    "background:rgba(#FFF, 0.5)",
    "border:2px solid rgba(#000, 0.5)",
    "border-radius:10px",
    "overflow:hidden",

    "#date",
    "  margin:12pt",
    "  margin-bottom:12pt",
    "  font-family: Helvetica",
    "  font-size: 25pt",
    "  font-weight:bold",
    "  color: rgba(128,0,0,0.75)",

    "#title",
    "  margin-left:50pt",
    "  margin-right:12pt",
    "  font-family: American Typewriter",
    "  font-size: 20pt",
    "  font-weight:bold",

    "#description",
    "  margin-left:12pt",
    "  margin-right:12pt",
    "  font-family: American Typewriter",
    "  font-size: 12pt",
    "  line-height:18pt",
    "  max-height:10pt",
    "  overflow:hidden",
    "  hyphens: auto",

    "#food",
    "  height: 350px",

    "#footer",
    "  font-family: Helvetica",
    "  font-size: 9pt",
    "  margin:12pt",
    "  color: rgba(#000, 0.5)",

    "p",
    "  margin: 0 0 0 20px",
{'fraction_non_alphanumeric': 0.1433309880389989, 'fraction_numerical': 0.02000201025228666, 'mean_word_length': 1.6308831306187201, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 29, 'https://': 0, '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': '1126889', 'n_tokens_mistral': 3200, 'n_tokens_neox': 2948, 'n_words': 650}