text:
package com.example.bigquery;

// [START bigquery_undelete_table]
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryException;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.CopyJobConfiguration;
import com.google.cloud.bigquery.Job;
import com.google.cloud.bigquery.JobInfo;
import com.google.cloud.bigquery.Table;
import com.google.cloud.bigquery.TableId;
import org.threeten.bp.Instant;

// Sample to undeleting a table
public class UndeleteTable {

  public static void main(String[] args) {
    // TODO(developer): Replace these variables before running the sample.
    String datasetName = "MY_DATASET_NAME";
    String tableName = "MY_TABLE_TABLE";
    String recoverTableName = "MY_RECOVER_TABLE_TABLE";
    undeleteTable(datasetName, tableName, recoverTableName);
  }

  public static void undeleteTable(String datasetName, String tableName, String recoverTableName) {
    try {
      // Initialize client that will be used to send requests. This client only needs to be created
      // once, and can be reused for multiple requests.
      BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();

      // Record the current time.  We'll use this as the snapshot time
      // for recovering the table.
      long snapshotEpoch = Instant.now().toEpochMilli();

      // [START_EXCLUDE]
      // Due to very short lifecycle of the table, ensure we're not picking a time
      // prior to the table creation due to time drift between backend and client.
      Table table = bigquery.getTable(TableId.of(datasetName, tableName));
      Long createdEpoch = table.getCreationTime();
      if (createdEpoch > snapshotEpoch) {
        snapshotEpoch = createdEpoch;
      }
      // [END_EXCLUDE]

      // "Accidentally" delete the table.
      bigquery.delete(TableId.of(datasetName, tableName));

      // Construct the restore-from tableID using a snapshot decorator.
      String snapshotTableId = String.format("%s@%d", tableName, snapshotEpoch);

      // Construct and run a copy job.
      CopyJobConfiguration configuration =
          CopyJobConfiguration.newBuilder(
                  // Choose a new table ID for the recovered table data.
                  TableId.of(datasetName, recoverTableName),
                  TableId.of(datasetName, snapshotTableId))
              .build();

      Job job = bigquery.create(JobInfo.of(configuration));
      job = job.waitFor();
      if (job.isDone() && job.getStatus().getError() == null) {
        System.out.println("Undelete table recovered successfully.");
      } else {
        System.out.println(
            "BigQuery was unable to copy the table due to an error: \n"
                + job.getStatus().getError());
        return;
      }
    } catch (BigQueryException | InterruptedException e) {
      System.out.println("Table not found. \n" + e.toString());
    }
  }
}
// [END bigquery_undelete_table]


text:
  Virieu-le-Petit est
       un village
       localisé dans le département de l'Ain en Rhône-Alpes. Elle totalisait 310 habitants en 2008.

Le parc d'habitations, à Virieu-le-Petit, était réparti en 2011 en 20 appartements et 153 maisons soit
 un marché relativement équilibré.

Si vous pensez emmenager à Virieu-le-Petit, vous pourrez aisément trouver une maison à vendre.

À proximité de Virieu-le-Petit sont positionnées géographiquement les communes de
Vieu à 3 km, 366 habitants,
Chavornay localisée à 2 km, 176 habitants,
Artemare à 4 km, 1 074 habitants,
Champagne-en-Valromey à 3 km, 691 habitants,
Talissieu à 4 km, 453 habitants,
Brénaz à 4 km, 93 habitants,
 entre autres. De plus, Virieu-le-Petit est située à seulement 28 km de Aix-les-Bains.

redpajama_set_name: RedPajamaGithub


text:
.transition-all {
  -webkit-transition: all 0.5s;
  -moz-transition: all 0.5s;
  transition: all 0.5s;
}
.background-cover,
.intro-header {
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;
}
.serif,
body,
.intro-header .post-heading .meta {
  font-family: 'Lora', 'Times New Roman', serif;
}
.sans-serif,
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-custom,
.btn,
.pager li > a,
.pager li > span {
  font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
body {
  font-size: 15px;
  color: #404040;
}

p {
  line-height: 1.7;
  margin: 1.7rem 0;
  font-size: 1.7rem;
}
p,
li {
  line-height: 1.5;
  font-size: 1.5rem;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 400;
}
a {
  color: #404040;
}
a:hover,
a:focus {
  color: #0085a1;
}
a img:hover,
a img:focus {
  cursor: zoom-in;
}
hr {
  margin-top: 5px;
  margin-bottom: 5px;
  border: 0;
  border-top: 1px solid #b7b7b7;
}

label {
  display: inline-block;
  max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: normal;
}

.navbar-custom {
  font-size: 20px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
}
.navbar-custom .navbar-right {
  margin-right: 0px;
}
.navbar-custom .navbar-brand {
  font-weight: 400;
}
.navbar-custom .nav li a {
text-transform
  font-weight: 400;
  text-decoration: none;
}
@media only screen and (min-width: 768px) {
  .navbar-custom {
    background-color: #fafafb;
    border-bottom: 1px solid transparent;
    border-color: #e7e7e7;
  }
  .navbar-custom .container-fluid {
    width: 768px;
  }
  .navbar-custom .navbar-brand {
    color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    font-weight: 700;
    font-family: 'PT Sans Caption', Helvetica, Arial, sans-serif;
  }
  .navbar-custom .navbar-brand:hover,
  .navbar-custom .navbar-brand:focus {
    color: rgba(0, 0, 0, 0.9);
  }
  .navbar-custom .nav li a {
    color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    padding-top: 15px;
    padding-bottom: 15px;
    font-size: 1.7rem;
  }
  .navbar-custom .nav li a:hover,
  .navbar-custom .nav li a:focus {
    color: rgba(0, 0, 0, 0.7);
    font-weight: 500;
    display: inline-block;
  }
}
@media only screen and (min-width: 1170px) {
  .navbar-custom {
    -webkit-transition: background-color 0.3s;
    -moz-transition: background-color 0.3s;
    transition: background-color 0.3s;
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  .navbar-custom .container-fluid {
    width: 800px;
  }
  .navbar-custom.is-fixed {
/* when the user scrolls down, we hide the header right above the viewport */
    position: fixed;
    top: -61px;
    background-color: rgba(255,255,255,0.9);
    border-bottom: 1px solid #f2f2f2;
    -webkit-transition: -webkit-transform 0.3s;
    -moz-transition: -moz-transform 0.3s;
    transition: transform 0.3s;
  }
  .navbar-custom.is-fixed .navbar-brand {
    color: #404040;
  }
  .navbar-custom.is-fixed .navbar-brand:hover,
  .navbar-custom.is-fixed .navbar-brand:focus {
    color: #0085a1;
  }
  .navbar-custom.is-fixed .nav li a {
    color: #404040;
  }
  .navbar-custom.is-fixed .nav li a:hover,
  .navbar-custom.is-fixed .nav li a:focus {
    color: #0085a1;
  }
  .navbar-custom.is-visible {
/* if the user changes the scrolling direction, we show the header */
    -webkit-transform: translate3d(0, 100%, 0);
    -moz-transform: translate3d(0, 100%, 0);
    -ms-transform: translate3d(0, 100%, 0);
    -o-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }
}
.intro-header {
  background-color: #808080;
  background-position: center center;
  background-attachment: scroll;
  margin-bottom: 50px;
}
.intro-header .site-heading,
.intro-header .post-heading,
.intro-header .page-heading {
  padding: 100px 0 50px;
  color: #fff;
}
@media only screen and (min-width: 768px) {
  .intro-header .site-heading,
  .intro-header .post-heading,
  .intro-header .page-heading {
    padding: 150px 0;
  }
}
.intro-header .site-heading.archives,
.intro-header .post-heading.archives,
.intro-header .page-heading.archives {
  color: #0085a1;
  margin-top: 50px;
}
.intro-header .site-heading,
.intro-header .page-heading {
  text-align: center;
}
.intro-header .site-heading h1,
.intro-header .page-heading h1 {
  margin-top: 0;
  font-size: 50px;
}
.intro-header .post-heading h1 {
  font-size: 35px;
}
.intro-header .post-heading .meta {
  font-style: italic;
  font-weight: 300;
  font-size: 20px;
}
.intro-header .post-heading .meta a {
  color: #fff;
}
@media only screen and (min-width: 768px) {
  .intro-header .post-heading h1 {
    font-size: 55px;
  }
}
.post-preview > a {
  color: #404040;
}
.post-preview > a:hover,
.post-preview > a:focus {
  text-decoration: none;
  color: #404040;
}
.post-preview > a > .post-title {
  font-size: 30px;
  margin-top: 10px;
  margin-bottom: 5px;
}
.post-preview > a > .post-title.archive {
  font-size: 22px;
}
.post-preview > a > .post-subtitle {
  margin: 0;
  font-weight: 300;
  margin-bottom: 10px;
}
.post-preview > .post-tag {
  display: inline-block;
  padding: 0.4rem 0.4rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  background-color: #31b0d5;
  border: 1.5px solid #1bb3e9;
}

.panel-body > .post-tag {
  display: inline-block;
  padding: 0.4rem 0.4rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  background-color: #31b0d5;
  border: 1.5px solid #1bb3e9;
}
.panel-body> .post-red-tag {
  display: inline-block;
  padding: 0.4rem 0.4rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  background-color: #a94442;
  border: 1.5px solid #a94442;
}
.post-preview > .post-edit-tag {
  display: inline-block;
  padding: 0.4rem 0.4rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  background-color: #a94442;
  border: 1.5px solid #a94442;
  float: right;
  margin: -3rem 0;
}
.post-preview > .post-red-tag {
  display: inline-block;
  padding: 0.4rem 0.4rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25em;
  background-color: #a94442;
  border: 1.5px solid #a94442;
}

.post-preview > .post-meta {
  color: #808080;
  font-size: 15px;
  margin-top: 0;
  margin-bottom: 0;
  direction: rtl;
}
.post-preview > .post-meta.archive {
  font-size: 16px;
}
.post-preview > .post-meta > a {
  text-decoration: none;
  color: #404040;
}
.post-preview > .post-meta > a:hover,
.post-preview > .post-meta > a:focus {
  color: #0085a1;
}
@media only screen and (min-width: 768px) {
  .post-preview > a > .post-title {
    font-size: 36px;
  }
}
.section-heading {
  font-size: 36px;
  margin-top: 60px;
  font-weight: 700;
}
.caption {
  text-align: center;
  font-size: 14px;
  padding: 10px;
  font-style: italic;
  margin: 0;
  display: block;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
}
.post-tags,
.post-categories {
  font-size: 15px;
  margin-top: 30px;
  margin-bottom: 30px;
}
.post-tags a,
.post-categories a {
  border-bottom: 1px dotted #ababab;
  text-transform: uppercase;
  margin-right: 10px;
}
.post-tags a:hover,
.post-categories a:hover,
.post-tags a:visited,
.post-categories a:visited,
.post-tags a:active,
.post-categories a:active {
  text-decoration: none;
  border-bottom: none;
}
.archive-before-pagination {
  height: 30px;
}
footer {
  padding: 50px 0 65px;
}
footer .list-inline {
  margin: 0;
  padding: 0;
}
footer .copyright {
  font-size: 14px;
  text-align: center;
  margin-bottom: 0;
}
.floating-label-form-group {
  font-size: 14px;
  position: relative;
  margin-bottom: 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #eee;
}
.floating-label-form-group input,
.floating-label-form-group textarea {
  z-index: 1;
  position: relative;
  padding-right: 0;
  padding-left: 0;
  border: none;
  border-radius: 0;
  font-size: 1.5em;
  background: none;
  box-shadow: none !important;
  resize: none;
}
.floating-label-form-group label {
  display: block;
  z-index: 0;
  position: relative;
  top: 2em;
  margin: 0;
  font-size: 0.85em;
  line-height: 1.764705882em;
  vertical-align: middle;
  vertical-align: baseline;
  opacity: 0;
  -webkit-transition: top 0.3s ease, opacity 0.3s ease;
  -moz-transition: top 0.3s ease, opacity 0.3s ease;
  -ms-transition: top 0.3s ease, opacity 0.3s ease;
  transition: top 0.3s ease, opacity 0.3s ease;
}
.floating-label-form-group::not(:first-child) {
  padding-left: 14px;
  border-left: 1px solid #eee;
}
.floating-label-form-group-with-value label {
  top: 0;
  opacity: 1;
}
.floating-label-form-group-with-focus label {
  color: #0085a1;
}
form .row:first-child .floating-label-form-group {
  border-top: 1px solid #eee;
}
.btn {
  text-transform: uppercase;
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 1px;
  border-radius: 0;
}
.btn-lg {
  font-size: 16px;
  padding: 25px 35px;
}
.btn-default:hover,
.btn-default:focus {
  background-color: #0085a1;
  border: 1px solid #0085a1;
  color: #fff;
}
.pager {
  margin: 20px 0 0;
}
.pager li > a,
.pager li > span {
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 15px 25px;
  background-color: #fff;
  border-radius: 0;
}
.pager li > a:hover,
.pager li > a:focus {
  color: #fff;
  background-color: #0085a1;
  border: 1px solid #0085a1;
}
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
  color: #808080;
  background-color: #404040;
  cursor: not-allowed;
}
::-moz-selection {
  color: #fff;
  text-shadow: none;
  background: #0085a1;
}
::selection {
  color: #fff;
  text-shadow: none;
  background: #0085a1;
}
img::selection {
  color: #fff;
  background: transparent;
}
img::-moz-selection {
  color: #fff;
  background: transparent;
}
body {
  webkit-tap-highlight-color: #0085a1;
}
article .container .row img {
  max-width: 100% !important;
  height: auto;
  display: inline-block;
}
article .container .row .video-container {
  position: relative;
  padding-bottom: 56.25%;
  padding-top: 30px;
  height: 0;
  overflow: hidden;
}
article .container .row .video-container iframe,
article .container .row .video-container object,
article .container .row .video-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin-top: 0;
}
article .container .row blockquote {
  font-style: italic;
  font-family: "Georgia", serif;
  font-size: 1.2em;
  padding: 0 30px 15px;
  text-align: center;
}
article .container .row blockquote footer {
  border-top: none;
  font-size: 0.8em;
  line-height: 1;
  margin: 20px 0 0;
  padding-top: 0;
}
article .container .row blockquote footer cite:before {
  content: '—';
  color: #ccc;
  padding: 0 0.5em;
}
article .container .row .pullquote {
  float: right;
  border: none;
  padding: 0;
  margin: 1em 0 0.5em 1.5em;
  text-align: left;
  width: 45%;
  font-size: 1.5em;
}
article .container .row .pullquote.left {
  float: left;
}
figure.highlight {
  background: #eee;
  border: 1px solid #ddd;
  margin-top: 15px;
  padding: 7px 15px;
  border-radius: 2px;
  text-shadow: 0 0 1px #fff;
  line-height: 1.6;
  overflow: auto;
  position: relative;
  font-size: 0.9em;
}
figure.highlight figcaption {
  color: #999;
  font-family: Monaco, Menlo, Consolas, Courier New, monospace;
  margin-bottom: 5px;
  text-shadow: 0 0 1px #fff;
}
figure.highlight figcaption a {
  position: absolute;
  right: 15px;
}
figure.highlight pre {
  border: none;
  padding: 0;
  margin: 0;
  background: none;
}
figure.highlight table {
  margin-top: 0;
  border-spacing: 0;
}
figure.highlight table .gutter {
  color: #999;
  padding-right: 15px;
  border-right: 1px solid #ddd;
  text-align: right;
}
figure.highlight table .code {
  padding-left: 15px;
  border-left: 1px solid #fff;
  color: #666;
}
figure.highlight table .line {
  height: 20px;
}
figure.highlight table .line.marked {
  background: #d6d6d6;
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .doctype,
pre .pi,
pre .lisp .string,
pre .javadoc {
  color: #93a1a1;
  font-style: italic;
}
pre .keyword,
pre .winutils,
pre .method,
pre .addition,
pre .css .tag,
pre .request,
pre .status,
pre .nginx .title {
  color: #859900;
}
pre .number,
pre .command,
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula,
pre .regexp,
pre .hexcolor {
  color: #2aa198;
}
pre .title,
pre .localvars,
pre .chunk,
pre .decorator,
pre .built_in,
pre .identifier,
pre .vhdl,
pre .literal,
pre .id {
  color: #268bd2;
}
pre .attribute,
pre .variable,
pre .lisp .body,
pre .smalltalk .number,
pre .constant,
pre .class .title,
pre .parent,
pre .haskell .type {
  color: #b58900;
}
pre .preprocessor,
pre .preprocessor .keyword,
pre .shebang,
pre .symbol,
pre .symbol .string,
pre .diff .change,
pre .special,
pre .attr_selector,
pre .important,
pre .subst,
pre .cdata,
pre .clojure .title {
  color: #cb4b16;
}
pre .deletion {
  color: #dc322f;
}


text:
(function (){
  var debugPre = document.getElementsByClassName('bluz-debug');
  if (debugPre) {
    var debugText = [];
    for (key in debugPre) {
      if (debugPre[key].innerHTML) {
        var newDebugText = debugPre[key].innerHTML.replace(/>/gi, '>');
        debugText.push(newDebugText);
      }
      if (typeof debugPre[key] === 'object') {
        debugPre[key].style.display = 'none';
      }
    }
    chrome.storage.sync.set({
      debugText: debugText
    })
  }
})()


text:
<?php

// Preferences
require_once('preferences.php');
require_once('database.php');

function showUpdateTime()
{
    // When we last updated
    $lastupdate = getPreference("last_update");
    print "
Data current at ".date("r", $lastupdate)."

        Clear Local Data
";
}

function printDaysLeft()
{
    $difference = mktime(0, 0, 0, 01, 01, 2016) - time();
    if ($difference < 0) { $difference = 0; }
    $daysleft = floor($difference/60/60/24);

    print $daysleft;
}

function hideGetStarted()
{
    // first check if we should show it!
    if(isset($_COOKIE["langchallenge_hidegetstarted"])) {
        print "hide";
    }

    // show it!
}

$userstartype = array();
function printParticipants()
{
    global $preferences;
    global $userstartype;

    // statistics
    $statistics = getStatistics();

    // return all participants, languages, and challenges
    $data = callStoredProcedure("GetGroupedEntries(".
        $statistics['TotalPagesRead'].",".
        $statistics['TotalMinutesWatched'].")");

    $lastusername = ""; $index = 0; $subindex = 0;
    $rowcount = mysqli_num_rows($data); $rowindex = 0;
    $infos = array();
    while($info = mysqli_fetch_array($data)) {
        array_push($infos, $info);
    }

    // first set up needed variables etc
    foreach($infos as &$info)
    {
        // other stuff
        $username = $info['UserName'];
        $displayname = $info['DisplayName'];

        $minuteswatched = $info['MinutesWatched'];
        $pagesread = $info['PagesRead'];

        $books = round($pagesread / $preferences->BOOK_PAGES);
        $films = round($minuteswatched / $preferences->FILM_MINUTES);

        // figure out sort order
        $rowindex++;
        if($username != $lastusername)
        {
            $subindex = 0;
            $index++;
            $lastusername = $username;
        }
        $subindex+=0.01;

        // stars, numbers, or blank?
        $info['FilmEntry'] = getTableEntry($films, $preferences->TARGET_FILMS, "films");
        $info['BookEntry'] = getTableEntry($books, $preferences->TARGET_BOOKS, "books");

        // calculate the star type across a number of entries
        //$userstartype[$username]->type = 0;

        // participant formatting
        $info['UserString'] = ""
                      .$displayname."
 @".$username."";
        $info['CustomKey'] = " sorttable_customkey='".($info['TotalUnits']-$index-$subindex)."'";

        // unset the reference
        unset($info);
    }

    // print the headers
    print "

                Participant
                Studying
                Watched
                Read

";

    // and the table in random order!
    shuffle($infos);
    foreach($infos as $info) {
        $filmentry = $info['FilmEntry']; $bookentry = $info['BookEntry'];
        //$startype = $startypes[$userstartype[$info['UserName']]->type];

        //

        $filmstars = floor($filmentry->count / 25);
        $bookstars = floor($bookentry->count / 25);

        $stars = "

";
        $rank = $filmentry->count + $bookentry->count;
        $bluecount = 0;
        $newstars = getStarsHtml($filmstars, $bookstars, true, $rank, $bluecount) .
                    getStarsHtml($bookstars, $filmstars, false, $rank, $bluecount);
        if($newstars != "") {
            $stars = "

$newstars";
        }

        $sprint = $info['LongestSprint'];
        $streak = $info['CurrentStreak'];

        $badges = getStreakDiv($streak, 5, 10, 20);
        $badges .= getSprintDiv($sprint);

        print "

            "
            .$info['UserString']."
            ".$info['LanguageName']."
            count'>$filmentry->content
            count'>$bookentry->content
            $stars$badges
";
    }

    // the footer
    print "
";
}

/*
 * A little complicated, but basically get a list of all stars for this type,
 * either including or excluding the shared stars
 */
function getStarsHtml($count, $comparecount, $combine, &$rank, &$bluecount)
{
    $stars = "";
    for($i = 0; $i < $count; ++$i)
    {
        $startype = 'blue';
        $localrank = 100;
        if($i == 1 && $comparecount > 1) {$startype = 'bronze'; $stars = ""; $localrank = 1000;}
        if($i == 3 && $comparecount > 3) {$startype = 'silver'; $stars = ""; $localrank = 2000;}
        if($i == 7 && $comparecount > 7) {$startype = 'gold'; $stars = ""; $localrank = 3000;}
        if($i == 15 && $comparecount > 15) {$startype = 'white'; $stars = ""; $localrank = 4000;}
        if($startype == 'blue') {$bluecount ++; }

        if($combine || (!$combine && $startype == 'blue'))
        {
            if(($startype == 'blue' && $bluecount <= 6) ||
                $startype != 'blue')
            {
                $stars .= "

";
            }
            $rank += $localrank;
        }
    }
    return $stars;
}

function getStreakDiv($count, $bronzelevel, $silverlevel, $goldlevel)
{
    $type = "";
    if($count >= $bronzelevel) {$type = 'bronze';}
    if($count >= $silverlevel) {$type = 'silver';}
    if($count >= $goldlevel) {$type = 'gold';}

    return $type == "" ? "" : "

";
}

function getSprintDiv($count)
{
    $type = "";
    if($count >= 5) {$type = 'gold';}
    else if($count >= 2) {$type = 'silver';}
    else if($count >= 1) {$type = 'bronze';}

    $s = $count == 1 ? "" : "s";
    return $type == "" ? "" : "

";
}

function getTableEntry($count, $target, $tail)
{
    $entry = new stdClass();
    $entry->count = $count;
    $entry->target = $target;
    $entry->content = "$count $tail";
    return $entry;
}

function printLanguages()
{
    $count = 0;
    $languagedata = callStoredProcedure("GetLanguages()");
    while($info = mysqli_fetch_array($languagedata))
    {
        $code = $info['Code'];
        $name = $info['Name'];
        print "".$code."".$name."
";

        // show the first three and then hide the rest
        if($count++ == 2) {
            print "
";
        }
    }
    print "
";
}

?>


text:
import * as routes from './routes'
export {routes}
export {errors, errorInfo} from './errors'

export function encode(route: string, data?: any) {
    var obj
    if (arguments.length === 1) {
        obj = [route]
    } else {
        obj = [route, data]
    }
    return JSON.stringify(obj)
}

export function decode(buf) {
    return JSON.parse(buf)
}

export function verifySchema(schema: jsonschema, data: any) {
    // TODO:
    return true
}


text:
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert = __importStar(require("assert"));
const fetch_rails_1 = require("../src/fetch-rails");
describe('helpers', function () {
    describe('#encodeParams(params)', function () {
        // $.param( { page: 2 } )
        it('encode object with one key', function () {
            var result = fetch_rails_1.encodeParams({ page: 2 });
            assert.equal('page=2', result);
        });
        // $.param( { page: 2, favourites: true } )
        it('encode object with two keys', function () {
            var result = fetch_rails_1.encodeParams({ page: 2, favourites: true });
            assert.equal('page=2&favourites=true', result);
        });
        // $.param( { q: { name: "Jhon", age: 20 } } )
        it('encode json object with deep object', function () {
            var result = fetch_rails_1.encodeParams({ q: { name: 'Jhon', age: 20 } });
            assert.equal('q%5Bname%5D=Jhon&q%5Bage%5D=20', result);
        });
        // $.param({ ids: [1, 2, 3] })
        it('encode array in uri params', function () {
            var result = fetch_rails_1.encodeParams({ ids: [1, 2, 3] });
            assert.equal('ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3', result);
        });
        //$.param( { users: [ { name: "Jhon", age: 20 }, { name: "Jhon2", age: 25 } ] } )
        it('encode array of objects in uri params', function () {
            var result = fetch_rails_1.encodeParams({
                users: [
                    { name: 'Jhon', age: 20 },
                    { name: 'Jhon2', age: 25 },
                ],
            });
            assert.equal('users%5B0%5D%5Bname%5D=Jhon&users%5B0%5D%5Bage%5D=20&users%5B1%5D%5Bname%5D=Jhon2&users%5B1%5D%5Bage%5D=25', result);
        });
    });
});


text:
import configuration = require("../configuration");
import express = require("express");

function configure(server: express.Application): void {
    server.use(express.errorHandler());
}

function initialize() {
    var server = this;
    configure(server);
};

export = initialize;


text:
layout: post
title:   "[macOS] Homebrew"
date:   2018-02-07 00:39:18 +0800
categories: macOS
tags: homebrew
author: Sangmok Oh
mathjax: true
---

* content
{:toc}

# Homebrew (package management software)

Homebew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS. (From Wikipedia, the free encyclopedia)

## Install Homebrew
```ruby
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

Type this above at a Terminal prompt.

## Usage of Homebrew

```bash
brew install {package_name}
```
Homebrew installs the packages you need just with a command line And it will be saved into `/usr/local/Cellar`. Here is a example installing `mysql`

```bash
brew install mysql
```

![Homebrew Default Save Address](https://github.com/SangmokDavidOh/sangmokdavidoh.github.io/blob/master/_posts/images/homebrew_terminal_install_address.png?raw=true)


text:
package cz.metacentrum.perun.webgui.json.extSourcesManager;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.view.client.DefaultSelectionEventManager;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import cz.metacentrum.perun.webgui.client.PerunWebSession;
import cz.metacentrum.perun.webgui.client.resources.TableSorter;
import cz.metacentrum.perun.webgui.json.*;
import cz.metacentrum.perun.webgui.json.keyproviders.GeneralKeyProvider;
import cz.metacentrum.perun.webgui.model.ExtSource;
import cz.metacentrum.perun.webgui.model.PerunError;
import cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage;
import cz.metacentrum.perun.webgui.widgets.PerunTable;
import cz.metacentrum.perun.webgui.widgets.UnaccentMultiWordSuggestOracle;

import java.util.ArrayList;
import java.util.Comparator;

/**
 * Ajax query to get all VO ext sources
 *
 * @author Pavel Zlamal <256627@mail.muni.cz>
 */
public class GetVoExtSources implements JsonCallback, JsonCallbackTable<ExtSource>, JsonCallbackOracle<ExtSource> {

	// session
	private PerunWebSession session = PerunWebSession.getInstance();
	// jsonCallback string
	private final String JSON_URL = "extSourcesManager/getVoExtSources";
	// ext sources stored as cellTable widget
	private PerunTable<ExtSource> table;
	// ext sources list data provider (for easy filling from json call)
	private ListDataProvider<ExtSource> dataProvider = new ListDataProvider<ExtSource>();
	// selection model for tables (for easy selection)
	private final MultiSelectionModel<ExtSource> selectionModel = new MultiSelectionModel<ExtSource>(new GeneralKeyProvider<ExtSource>());
	// list of ext sources
	private ArrayList<ExtSource> list = new ArrayList<ExtSource>();
	// external events
	private JsonCallbackEvents events = new JsonCallbackEvents();
	// vo Id
	private int voId = 0;
	// loader image
	private AjaxLoaderImage loaderImage = new AjaxLoaderImage();
	private boolean checkable = true;
	private ArrayList<ExtSource> fullBackup = new ArrayList<ExtSource>();
	private UnaccentMultiWordSuggestOracle oracle = new UnaccentMultiWordSuggestOracle(" ./-");

	/**
	 * Creates a new callback
	 *
	 * @param voId ID of VO to get ext sources for
	 */
	public GetVoExtSources(int voId) {
		this.voId = voId;
	}

	/**
	 * Creates a new callback
	 *
	 * @param voId ID of Vo we want ext sources for
	 * @param events external events
	 */
	public GetVoExtSources(int voId, JsonCallbackEvents events) {
		this.voId = voId;
		this.events = events;
	}

	/**
	 * Return table containing VO external sources
	 *
	 * @return table widget containing VO ext sources
	 */
	public CellTable<ExtSource> getTable() {

		// retrieve data
		retrieveData();

		// Table data provider.
		dataProvider = new ListDataProvider<ExtSource>(list);

		// Cell table
		table = new PerunTable<ExtSource>(list);

		// Connect the table to the data provider.
		dataProvider.addDataDisplay(table);

		// Sorting
		ListHandler<ExtSource> columnSortHandler = new ListHandler<ExtSource>(dataProvider.getList());
		table.addColumnSortHandler(columnSortHandler);

		// table selection
		table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<ExtSource> createCheckboxManager());

		// set empty content & loader
		table.setEmptyTableWidget(loaderImage);
		loaderImage.setEmptyResultMessage("VO has no external source of members.");

		// content
		if(checkable){
			table.addCheckBoxColumn();
		}
		table.addIdColumn("Ext. source ID", null);
		table.addNameColumn(null);

		// Type column
		TextColumn<ExtSource> typeColumn = new TextColumn<ExtSource>() {
			@Override
			public String getValue(ExtSource extSource) {
				return String.valueOf(renameContent(extSource.getType()));
			}
		};

		// sort type column
		typeColumn.setSortable(true);
		columnSortHandler.setComparator(typeColumn, new Comparator<ExtSource>() {
			public int compare(ExtSource o1, ExtSource o2) {
				return o1.getType().compareToIgnoreCase(o2.getType());
			}
		});

		// Add columns to table
		table.addColumn(typeColumn, "Type");

		// return cellTable
		return table;

	}

	/**
	 * Retrieve data from RPC
	 */
	public void retrieveData() {
		JsonClient js = new JsonClient();
		js.retrieveData(JSON_URL, "vo="+voId, this);
	}

	/**
	 * Sorts table by objects Name
	 */
	public void sortTable() {
		list = new TableSorter<ExtSource>().sortByName(getList());
		dataProvider.flush();
		dataProvider.refresh();
	}

	/**
	 * Add object as new row to table
	 *
	 * @param object ExtSource to be added as new row
	 */
	public void addToTable(ExtSource object) {
		list.add(object);
		oracle.add(object.getName());
		oracle.add(renameContent(object.getType()));
		dataProvider.flush();
		dataProvider.refresh();
	}

	/**
	 * Removes object as row from table
	 *
	 * @param object ExtSource to be removed as row
	 */
	public void removeFromTable(ExtSource object) {
		list.remove(object);
		selectionModel.getSelectedSet().remove(object);
		dataProvider.flush();
		dataProvider.refresh();
	}

	/**
	 * Clear all table content
	 */
	public void clearTable(){
		loaderImage.loadingStart();
		list.clear();
		fullBackup.clear();
		oracle.clear();
		selectionModel.clear();
		dataProvider.flush();
		dataProvider.refresh();
	}

	/**
	 * Clears list of selected items
	 */
	public void clearTableSelectedSet(){
		selectionModel.clear();
	}

	/**
	 * Return selected items from list
	 *
	 * @return return list of checked items
	 */
	public ArrayList<ExtSource> getTableSelectedList(){
		return JsonUtils.setToList(selectionModel.getSelectedSet());
	}

	/**
	 * Called, when an error occurs
	 */
	public void onError(PerunError error) {
		session.getUiElements().setLogErrorText("Error while loading external sources.");
		loaderImage.loadingError(error);
		events.onError(error);
	}

	/**
	 * Called, when loading starts
	 */
	public void onLoadingStart() {
		session.getUiElements().setLogText("Loading external sources started.");
		events.onLoadingStart();
	}

	/**
	 * Called, when operation finishes successfully.
	 */
	public void onFinished(JavaScriptObject jso) {
		setList(JsonUtils.<ExtSource>jsoAsList(jso));
		sortTable();
		session.getUiElements().setLogText("Loading external sources finished: "+ list.size());
		events.onFinished(jso);
		loaderImage.loadingFinished();
	}

	public void insertToTable(int index, ExtSource object) {
		list.add(index, object);
		oracle.add(object.getName());
		oracle.add(renameContent(object.getType()));
		dataProvider.flush();
		dataProvider.refresh();
	}

	public void setEditable(boolean editable) {
		// TODO Auto-generated method stub
	}

	public void setCheckable(boolean checkable) {
		this.checkable = checkable;
	}

	public void setList(ArrayList<ExtSource> list) {
		clearTable();
		this.list.addAll(list);
		for (ExtSource object : list) {
			oracle.add(object.getName());
			oracle.add(renameContent(object.getType()));
		}
		dataProvider.flush();
		dataProvider.refresh();
	}

	public ArrayList<ExtSource> getList() {
		return this.list;
	}

	/**
	 * Return substring on position 40 and uppercase - used for ExtSourceType value
	 *
	 * @param oldString original string value
	 * @return new string starting on position 40 and uppercase
	 */
	private String renameContent(String oldString) {
		String newString = "";
		newString = oldString.substring(40);
		newString = newString.toUpperCase();

		return newString;
	}

	@Override
	public void filterTable(String filter) {

		// store list only for first time
		if (fullBackup.isEmpty() || fullBackup == null) {
			fullBackup.addAll(getList());
		}

		// always clear selected items
		selectionModel.clear();
		list.clear();

		if (filter.equalsIgnoreCase("")) {
			list.addAll(fullBackup);
		} else {
			for (ExtSource src : fullBackup){
				// store ext source if name or type matches
				if ((src.getName().toLowerCase().contains(filter.toLowerCase())) ||
						renameContent(src.getType()).toLowerCase().contains(filter.toLowerCase())) {
					list.add(src);
						}
			}
		}

		if (list.isEmpty() && !filter.isEmpty()) {
			loaderImage.setEmptyResultMessage("No external source matching '"+filter+"' found.");
		} else {
			loaderImage.setEmptyResultMessage("VO has no external source of members.");
		}

		dataProvider.flush();
		dataProvider.refresh();
		loaderImage.loadingFinished();

	}

	@Override
	public UnaccentMultiWordSuggestOracle getOracle() {
		return this.oracle;
	}

	@Override
	public void setOracle(UnaccentMultiWordSuggestOracle oracle) {
		this.oracle = oracle;
	}

	public void setEvents(JsonCallbackEvents events) {
		this.events = events;
	}

	public MultiSelectionModel<ExtSource> getSelectionModel() {
		return this.selectionModel;
	}

}


text:
'use strict';
var Kind = (function () {
    function Kind() {
    }
    Kind.unknown = '';
    Kind.keyword = 'keyword';
    Kind.script = 'script';
    Kind.module = 'module';
    Kind.class = 'class';
    Kind.interface = 'interface';
    Kind.type = 'type';
    Kind.enum = 'enum';
    Kind.variable = 'var';
    Kind.localVariable = 'local var';
    Kind.function = 'function';
    Kind.localFunction = 'local function';
    Kind.memberFunction = 'method';
    Kind.memberGetAccessor = 'getter';
    Kind.memberSetAccessor = 'setter';
    Kind.memberVariable = 'property';
    Kind.constructorImplementation = 'constructor';
    Kind.callSignature = 'call';
    Kind.indexSignature = 'index';
    Kind.constructSignature = 'construct';
    Kind.parameter = 'parameter';
    Kind.typeParameter = 'type parameter';
    Kind.primitiveType = 'primitive type';
    Kind.label = 'label';
    Kind.alias = 'alias';
    Kind.const = 'const';
    Kind.let = 'let';
    Kind.warning = 'warning';
    return Kind;
}());
exports.Kind = Kind;
var KindModifier = (function () {
    function KindModifier() {
    }
    KindModifier.none = '';
    KindModifier.staticMember = 'public static';
    KindModifier.privateMember = 'private';
    KindModifier.protectedMember = 'protected';
    KindModifier.exported = 'export';
    KindModifier.ambient = 'declare';
    KindModifier.static = 'static';
    return KindModifier;
}());
exports.KindModifier = KindModifier;
//# sourceMappingURL=protocol.const.js.map


text:
export function load() {
    QUnit.module("DataTemplate");

    test("Basic Load", () => {
        var xaml = "<DataTemplate xmlns=\"http://schemas.wsick.com/fayde\" xmlns:x=\"http://schemas.wsick.com/fayde/x\">"
            + "<Grid></Grid>"
            + "</DataTemplate>";

        var dt: Fayde.DataTemplate;
        try {
            dt = Fayde.Markup.LoadXaml<Fayde.DataTemplate>(null, xaml);
        } catch (err) {
            ok(false, "Loading a DataTemplate should not error. " + err.toString());
        }
        strictEqual((<any>dt).constructor, Fayde.DataTemplate, "Resulting object should be a DataTemplate.");

        var visual = dt.GetVisualTree(null);
        strictEqual((<any>visual).constructor, Fayde.Controls.Grid, "Root visual from created visual tree should be a Grid.");
    });

    test("Implicit DataTemplate", () => {
        var xaml = "<Grid xmlns=\"http://schemas.wsick.com/fayde\" xmlns:x=\"http://schemas.wsick.com/fayde/x\">"
            + "<Grid.Resources>"
            + "<DataTemplate DataType=\"Color\">"
            + "<TextBlock Text=\"{Binding R}\" />"
            + "</DataTemplate>"
            + "</Grid.Resources>"
            + "<ContentControl Content=\"{x:Static new Color()}\">"
            + "</ContentControl>"
            + "</Grid>";
        var grid: Fayde.Controls.Grid;
        try {
            grid = Fayde.Markup.LoadXaml<Fayde.Controls.Grid>(null, xaml);
        } catch (err) {
            ok(false, "Loading a DataTemplate should not error. " + err.toString());
        }
        ok(grid.Resources.Contains(Color));
        var dt = <Fayde.DataTemplate>grid.Resources.Get(Color);
        ok(dt instanceof Fayde.DataTemplate);
        strictEqual(dt.DataType, Color, "DataType for DataTemplate should be Color.");

        strictEqual(grid.Children.Count, 1);
        var cc = <Fayde.Controls.ContentControl>grid.Children.GetValueAt(0);
        ok(cc instanceof Fayde.Controls.ContentControl, "Grid should have a ContentControl.");
        cc.Measure(new minerva.Size());

        var cp = <Fayde.Controls.ContentPresenter>Fayde.VisualTreeHelper.GetChild(cc, 0);
        ok(cp instanceof Fayde.Controls.ContentPresenter, "ContentControl should have a ContentPresenter.");

        var tb = <Fayde.Controls.TextBlock>Fayde.VisualTreeHelper.GetChild(cp, 0);
        ok(tb instanceof Fayde.Controls.TextBlock, "ContentPresenter should have a TextBlock.");
        strictEqual(tb.Text, "0");
    });

    test("Key/TargetType not specified", () => {
        var xaml = "<Grid xmlns=\"http://schemas.wsick.com/fayde\" xmlns:x=\"http://schemas.wsick.com/fayde/x\">"
            + "<Grid.Resources>"
            + "<DataTemplate>"
            + "<Grid></Grid>"
            + "</DataTemplate>"
            + "</Grid.Resources>"
            + "</Grid>";
        var grid: Fayde.Controls.Grid;
        try {
            grid = Fayde.Markup.LoadXaml<Fayde.Controls.Grid>(null, xaml);
            ok(false, "Expected parse error in xaml load.");
        } catch (err) {
            ok(err instanceof XamlParseException, err);
        }
    });
}


text:
package com.neusoft.knowledge.sys.service.impl;

import com.neusoft.knowledge.common.constant.BaseConstant;
import com.neusoft.knowledge.common.constant.CommonConstant;
import com.neusoft.knowledge.common.utils.DateUtils;
import com.neusoft.knowledge.common.utils.IdGenUtils;
import com.neusoft.knowledge.sys.dao.MenuDao;
import com.neusoft.knowledge.sys.entity.MenuEntity;
import com.neusoft.knowledge.sys.entity.UserEntity;
import com.neusoft.knowledge.sys.service.MenuService;
import com.neusoft.knowledge.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Title:MenuServiceImpl.
 * @Content:com.neusoft.knowledge.service.modules.sys.service.impl.MenuServiceImpl
 * @Description:
 * @Author:Marklin
 * @Create-DateTime:2017-10-27 21:56
 * @Update-DateTime:2017-10-27 21:56
 * @Version:1.0version
 */
@Service("menuService")
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuDao menuDao;
    private final SimpleDateFormat dateFormat = new SimpleDateFormat(CommonConstant.FORMAT_PATTERN_DATE_TIME);

    @Override
    public MenuEntity queryObject(String id) {
        return menuDao.queryObject(id);
    }

    @Override
    public List<MenuEntity> queryList(Map<String, Object> map) {
        return menuDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return menuDao.queryTotal(map);
    }

    @Override
    public String save(MenuEntity menu) {
        UserEntity currentUser = UserUtils.getCurrentUser();
        menu.setId(IdGenUtils.generateUuid());
        menu.setCreateId(currentUser.getCreateId());
        menu.setStatus(BaseConstant.IS_FLAG_NO.getValue());
        menu.setOfficeId(currentUser.getOfficeId());
        menu.setTeamId(currentUser.getTeamId());
        String createTime = dateFormat.format(new Date());
        menu.setCreateTime(DateUtils.getDateTime(createTime));
        menuDao.save(menu);
        return menu.getId();
    }

    @Override
    public void update(MenuEntity menu) {
        UserEntity currentUser = UserUtils.getCurrentUser();
        String createTime = dateFormat.format(new Date());
        menu.setCreateTime(DateUtils.getDateTime(createTime));
        menu.setUpdateId(currentUser.getId());
        menuDao.update(menu);
    }

    @Override
    public void delete(String id) {
        menuDao.delete(id);
    }

    @Override
    public void deleteBatch(String[] ids) {
        menuDao.deleteBatch(ids);
    }

    /**
     * 根据登陆用户Id,查询出所有授权菜单 按钮 登陆授权
     *
     * @param userId
     * @return
     */
    @Override
    public List<MenuEntity> queryByUserId(String userId) {
        return menuDao.queryByUserId(userId);
    }

    /**
     * 根据父菜单Id查询菜单
     *
     * @param parenId
     * @return
     */
    @Override
    public List<MenuEntity> queryListParentId(String parenId) {
        return menuDao.queryListParentId(parenId);
    }

    public List<MenuEntity> queryMenuByParentId(String parentId, List<String> menuIds) {
        //根据父Id,查询所有下级资源
        List<MenuEntity> menuEntities = menuDao.queryListParentId(parentId);
        List<MenuEntity> reMenus = new ArrayList<>();
        for (MenuEntity menu : menuEntities) {
            //如果下级资源在用户授权资源中,则添加
            if (menuIds.contains(menu.getId())) {
                reMenus.add(menu);
            }
        }
        return reMenus;
    }

    /**
     * 递归查询出所有菜单的子菜单,子菜单的所有子菜单 只包括用户授权的资源
     *
     * @param resouces 源菜单
     * @param menuIds  用户所有授权资源
     * @return
     */
    public List<MenuEntity> getTreeMenus(List<MenuEntity> resouces, List<String> menuIds) {
        List<MenuEntity> treeMenus = new ArrayList<>();
        for (MenuEntity menu : resouces) {
            if (BaseConstant.OFFICE_TYPE_CATALOG.getValue().equals(menu.getMenuType())) {
                List<MenuEntity> childMenus = queryMenuByParentId(menu.getId(), menuIds);
                menu.setChildList(getTreeMenus(childMenus, menuIds));
            }
            treeMenus.add(menu);
        }
        return treeMenus;
    }

    /**
     * 获取用户菜单列表 主页查询用户菜单用
     *
     * @param userId
     * @return
     */
    @Override
    public List<MenuEntity> queryListUser(String userId) {
        List<MenuEntity> menuList = null;
        if (userId.equals(CommonConstant.DEFAULT_USER)) {
            menuList = menuDao.queryList(new HashMap<>());
        } else {
            menuList = menuDao.queryByUserId(userId);
        }
        List<String> menuIds = new ArrayList<>();
        for (MenuEntity menu : menuList) {
            menuIds.add(menu.getId());
        }
        //查询出根菜单
        List<MenuEntity> rootMenus = queryMenuByParentId("0", menuIds);
        //递归查询所有所有子资源的子资源
        List<MenuEntity> treeMenus = getTreeMenus(rootMenus, menuIds);
        return treeMenus;
    }

    /**
     * 查询所有不包括按钮 的菜单
     *
     * @return
     */
    @Override
    public List<MenuEntity> queryNotButtonnList() {
        List<MenuEntity> menuList = menuDao.queryNotButtonnList(
                new String[]{BaseConstant.OFFICE_TYPE_CATALOG.getValue(), BaseConstant.MENU_TYPE_MENU.getValue()});
        return menuList;
    }
}


text:
local Table = require'Table'

local setmetatable, next, select = setmetatable, next, select

local Generator = {}

local GeneratorMt = {__index = Generator}

function Generator:apply( f, arg )
	self[#self+1] = f
	self[#self+1] = arg
	return self
end

local function domap( g, ... )
	return true, g( ... )
end

function Generator:map( f )
	return self:apply( domap, f )
end

local function dofilter( pred, ... )
	if pred( ... ) then
		return true, ...
	else
		return false
	end
end

function Generator:filter( p )
	return self:apply( dofilter, p )
end

local function dozip( frm, k, v, ... )
	if frm <= 1 then return true, {k, v, ...}
	elseif frm <= 2 then return true, k, {v, ...}
	elseif frm <= 3 then return true, k, v, {...}
	else
		local allargs = {...}
		allargs[frm+1] = {select( frm, ... )}
		allargs[frm+2] = nil
		return true, unpack( allargs )
	end
end

function Generator:zip( from )
	return self:apply( dozip, from or 1 )
end

local function doswap( _, x, y, ... )
	return true, y, x, ...
end

function Generator:swap()
	return self:apply( doswap, false )
end

local function dodup( _, x, ... )
	return true, x, x, ...
end

function Generator:dup()
	return self:apply( dodup, false )
end

local function dounique( cache, k, ... )
	if not cache[k] then
		cache[k] = true
		return true, k, ...
	else
		return false
	end
end

function Generator:unique()
	return self:apply( dounique, {} )
end

local function dowithindex( i, ... )
	local index = i[1]
	i[1] = index + i[2]
	return true, index, ...
end

function Generator:withindex( init, step )
	return self:apply( dowithindex, {init or 1, step or 1} )
end

local function dotake( m, ... )
	if m[1] < m[2] then
		m[1] = m[1] + 1
		return true, ...
	end
end

function Generator:take( n )
	return self:apply( dotake, {0, n} )
end

local function dotakewhile( pred, ... )
	if pred( ... ) then
		return true, ...
	end
end

function Generator:takewhile( p )
	return self:apply( dotakewhile, p )
end

local function dodrop( m, ... )
	if m[1] < m[2] then
		m[1] = m[1] + 1
		return false
	else
		return true, ...
	end
end

function Generator:drop( n )
	return self:apply( dodrop, {0,n} )
end

local function dodropwhile( pred, ... )
	if pred[2] and pred[1]( ... ) then
		return false
	else
		pred[2] = false
		return true, ...
	end
end

function Generator:dropwhile( p )
	return self:apply( dodropwhile, {p,true} )
end

local function doupdate( tbl, k, v, ... )
	if tbl[k] then
		return true, k, tbl[k], ...
	else
		return true, k, v, ...
	end
end

function Generator:update( self, utable )
	return self:apply( doupdate, utable )
end

local function dodelete( tbl, k, ... )
	if not tbl[k] then
		return true, k, ...
	else
		return false
	end
end

function Generator:delete( dtable )
	return self:apply( dodelete, dtable )
end

local function doeach( status, ... )
	if status then
		f( ... )
		return doeach( self:next())
	elseif status == false then
		return doeach( self:next())
	end
end

function Generator:each( f )
	return doeach( self:next())
end

local function doreduce( self, f, accum, status, ... )
	if status then
		return doreduce( self, f, f(accum, ...), self:next())
	elseif status == false then
		return doreduce( self, f, accum, self:next())
	else
		return accum
	end
end

function Generator:reduce( f, acc )
	return doreduce( self, f, acc, self:next())
end

local function tablefold( acc, k, v )
	acc[k] = v
	return acc
end

function Generator:table()
	return Table( self:reduce( tablefold, {} ))
end

local function arrayfold( acc, v )
	acc[#acc+1] = v
	return acc
end

function Generator:array()
	return Table( self:reduce( arrayfold, {} ))
end

local function dosum( accum, status, ... )
	if status then
		return dosum( accum + ..., self:next())
	elseif status == false then
		return dosum( accum, self:next())
	else
		return accum
	end
end

function Generator:sum( acc )
	return dosum( acc or 0, self:next())
end

local function docount( acc, status, ... )
	if status == nil then
		return acc
	elseif status and (p == nil or p(...)) then
		return docount( acc + 1, self:next())
	else
		return docount( acc, self:next())
	end
end

function Generator:count( p )
	return docount( 0, self:next())
end

function Generator:next()
	return self[1]( self )
end

local function reccall( self, i, status, ... )
	if status then
		if self[i] then
			return reccall( self, i+2, self[i]( self[i+1], ... ))
		else
			return status, ...
		end
	else
		return status
	end
end

local Stream = {}

local function evalrangeargs( init, limit, step )
	if not limit then init, limit = init > 0 and 1 or -1, init end
	if not step then step = init < limit and 1 or -1 end
	if (init <= limit and step > 0) or (init >= limit and step < 0) then
		return init, limit, step
	else
		error('bad initial variables for range')
	end
end

local function rangenext( self )
	local index = self[2]
	if index <= self[3] then
		self[2] = index + self[4]
		return reccall( self, 5, true, index )
	end
end

local function rrangenext( self )
	local index = self[2]
	if index >= self[3] then
		self[2] = index + self[4]
		return reccall( self, 5, true, index )
	end
end

function Stream.range( init, limit, step )
	init, limit, step = evalrangeargs( init, limit, step )
	return setmetatable( {step > 0 and rangenext or rrangenext, init, limit, step}, GeneratorMt )
end

local function evalsubargs( tbl, init, limit, step )
	local len = #tbl
	init, limit = init or 1, limit or len
	if init < 0 then init = len + init + 1 end
	if limit < 0 then limit = len + init + 1 end
	if not step then step = init < limit and 1 or -1 end
	if (init <= limit and step > 0) or (init >= limit and step < 0) then
		return init, limit, step
	else
		error('bad initial variables for generator')
	end
end

local function iternext( self )
	local index = self[3]
	local value = self[2][index]
	if value ~= nil and index <= self[4] then
		self[3] = index + self[5]
		return reccall( self, 6, true, value )
	end
end

local function riternext( self )
	local index = self[3]
	local value = self[2][index]
	if value ~= nil and index >= self[4] then
		self[3] = index + self[5]
		return reccall( self, 6, true, value )
	end
end

function Stream.iter( tbl, init, limit, step )
	init, limit, step = evalsubargs( tbl, init, limit, step )
	return setmetatable( {step > 0 and iternext or riternext, tbl, init, limit, step}, GeneratorMt )
end

local function ipairsnext( self )
	local index = self[3]
	local value = self[2][index]
	if value ~= nil and index <= self[4] then
		self[3] = index + self[5]
		return reccall( self, 6, true, index, value )
	end
end

local function ripairsnext( self )
	local index = self[3]
	local value = self[2][index]
	if value ~= nil and index >= self[4] then
		self[3] = index + self[5]
		return reccall( self, 6, true, index, value )
	end
end

function Stream.ipairs( tbl, init, limit, step )
	init, limit, step = evalsubargs( tbl, init, limit, step )
	return setmetatable( {step > 0 and ipairsnext or ripairsnext, tbl, init, limit, step}, GeneratorMt )
end

local function pairsnext( self )
	local key, value = next( self[2], self.k )
	if key ~= nil then
		self.k = key
		return reccall( self, 3, true, key, value )
	end
end

function Stream.pairs( tbl )
	return setmetatable( {pairsnext, tbl}, GeneratorMt )
end

local function keysnext( self )
	local key, _ = next( self[2], self.k )
	if key ~= nil then
		self.k = key
		return reccall( self, 3, true, key )
	end
end

function Stream.keys( tbl )
	return setmetatable( {keysnext, tbl}, GeneratorMt )
end

local function valuesnext( self )
	local key, value = next( self[2], self.k )
	if key ~= nil then
		self.k = key
		return reccall( self, 3, true, value )
	end
end

function Stream.values( tbl )
	return setmetatable( {valuesnext, tbl}, GeneratorMt )
end

return Stream


text:
title: Python Week 7
layout: post
author: henry.barnard
permalink: /python-week-7/
source-id: 1sOetfpp_uAduWzlYJlztsVMeYnAwODmho6N7q08uqO0
published: true
---

    Title
    Python Week 7
    Date
    7/3/17

    Starting point:
    Python 38%

    Target for this lesson?
    To get to 40%

    Did I reach my target?
(add details to "Lesson Review")
    Yes I did I got to 42%

    Lesson Review

    How did I learn? What strategies were effective?

    I learnt by typing up the solutions which was what the answer was correct. This allowed me to advance and make me go further in my work. This allowed me to reach my target and therefore felt good leaving the lesson.

    What limited my learning? Which habits do I need to

    I got a little bit distracted and I talked for the about 10 minutes, this took out a fair portion of the lesson and that made me not make as much progress as I would of wanted to. So I probably need to work on doing more work and not get distracted.

    What will I change for next time? How will I improve my learning?

    I will try to not get distracted as much. That will mean that I will be able to get more work done in the lesson. If I concentrated more than I feel like I could be on a higher percentage than what I am on now.


text:
using System;
using LessonsSamples.Lesson7.GoodClasses.Procedural;

namespace LessonsSamples.Lesson7.GoodClasses.Geometry
{
    class SquareGeometry : GeometryCalculator<Square>
    {
        public override double GetArea(Square s)
        {
            return s.Side * s.Side;
        }
    }

    class RectangleGeometry : GeometryCalculator<Rectangle>
    {
        public override double GetArea(Rectangle r)
        {
            return r.Height*r.Width;
        }
    }

    class CircleGeometry : GeometryCalculator<Circle>
    {
        public override double GetArea(Circle c)
        {
            return Math.PI * c.Radius * c.Radius;
        }
    }
}