text:
#pragma once
#include <sstream>
#include <tuple>
#include <functional>
#include <iostream>

/* Arguments parser: use in main
 "
 int main(int argc, char * argv[])
 {
   using namespace std;
   using namespace parse_arguments;
   auto param1 = <init_value>;
   auto param2 = <init_value>;
   ...
   auto paramN = <init_value>;

   auto params = pack(argc, argv,
       //       decription          value        -opt                  --option
       param("param1 description", param1, "param1_short_opt", "param1_long_opt"),
       param("param2 description", param2, "param2_short_opt", "param2_long_opt"),
       ...
       param("paramN description", paramN, "paramN_short_opt", "paramN_long_opt")
       );

   cerr << params.parse_all();
   ...
   <ensure that params are withing range>
   if (within_range)
   {
      params.usage();
      exit(-1);
    }
  }
  "
*/

namespace parse_arguments
{
  // -----------------------------
  //  Converts from string to type
  //    Should be specialized for user-defined types
  // -----------------------------
  template<typename T>
    T string_to_type(std::string s) { return static_cast<T>(std::stod(s)); }
  template<> std::string string_to_type<std::string>(std::string s) { return s; };
  template<> bool string_to_type<bool>(std::string s)  { return true; };

  // ----------------
  //  Pretty printer
  //    Should be specialized for user-defined types
  // ----------------
  template<typename T>
    std::string pretty_print(T t) { return std::to_string(t); }
  template<> std::string pretty_print<bool>(bool t) { return t ? "true" : "false"; }
  template<> std::string pretty_print<std::string>(std::string t) { return "'"+t+"'"; }

  /********************************
   *  -= parser specific code =-  *
   ********************************/

  // ----------------
  //  Parameter name
  // ----------------
  class ParamName
  {
    private:
      std::string const description_;
      std::string const short_name_;
      std::string const long_name_;
      std::string arg_string_;
    public:
      ParamName(std::string desc, std::string nshort, std::string nlong) :
        description_(std::move(desc)),
        short_name_(std::move(nshort)),
        long_name_(std::move(nlong)) {}

      enum NameType {DESCRIPTION, SHORT_NAME, LONG_NAME, ARG_STRING};
      std::string get(NameType name) const
      {
        switch (name)
        {
          case DESCRIPTION: return description_;
          case SHORT_NAME:  return short_name_;
          case LONG_NAME:   return long_name_;
          case ARG_STRING:  return arg_string_;
        }
        return std::string{};
      }
      std::string& getArgString()
      {
        return arg_string_;
      }
  };

  // --------------
  //  Parser class
  // --------------
  template<typename... Ts>
  class Parser
  {
    private:
      using ParamPack = std::tuple<Ts...>;
      static constexpr auto ParamSize = sizeof...(Ts);

      int argc_;
      char ** argv_;
      ParamPack param_pack_;

      // -----------------------------
      //  Actual argument parser code
      // -----------------------------
      template<typename T>
        static bool getParam(std::string arg, std::string what, T& value, std::string& parm)
        {
          if (arg.find(what) == std::string::npos)
            return false;
          value = string_to_type<T>(arg.substr(what.size()));
          parm = what;
          parm.erase(what.size()-1);
          return true;
        }

      template<size_t I>
        auto parseImpl(std::string arg, bool flag) ->
        typename std::enable_if<(I == ParamSize),bool>::type
        {
          return flag;
        }
      template<size_t I=0>
        auto parseImpl(std::string arg, bool flag = false) ->
        typename std::enable_if<(I < ParamSize),bool>::type
        {
          using namespace std;
          auto& t = get<I>(param_pack_);
          auto const & shortParam = t.get(ParamName::SHORT_NAME);
          auto const & longParam = t.get(ParamName::LONG_NAME);

          using value_type = typename tuple_element<I,ParamPack>::type::value_type;
          string ss_eq="=", arg1=arg;
          if (is_same<value_type,bool>::value)
          {
            arg1 += "\\";
            ss_eq = "\\";
          }
          if (!shortParam.empty())
            flag |= getParam(arg1,
                string("-")+shortParam+ss_eq,
                t.value(), t.getArgString());
          if (!longParam.empty())
            flag |= getParam(arg1,
                string("--")+longParam+ss_eq,
                t.value(), t.getArgString());
          return parseImpl<I+1>(arg, flag);
        }

      // ------------------------------
      //  Find max argument name width
      // ------------------------------
      template<size_t I>
        auto maxWidthNameImpl(ParamName::NameType name, size_t count) ->
        typename std::enable_if<(I == ParamSize),size_t>::type
        {
          return count;
        }
      template<size_t I=0>
        auto maxWidthNameImpl(ParamName::NameType name, size_t count = 0) ->
        typename std::enable_if<(I < ParamSize),size_t>::type
        {
          count = std::max(count, std::get<I>(param_pack_).get(name).size());
          return maxWidthNameImpl<I+1>(name, count);
        }
      size_t maxWidthName(ParamName::NameType name)
      {
        return maxWidthNameImpl(name);
      }

      // ---------------
      //  Usage printer
      // ---------------
      template<size_t I, typename SS>
        auto printUsageImpl(SS&& ss, size_t maxWidthLong, size_t maxWidthShort) ->
        typename std::enable_if<(I == ParamSize)>::type
        {}
      template<size_t I=0, typename SS>
        auto printUsageImpl(SS&& ss, size_t maxWidthLong, size_t maxWidthShort) ->
        typename std::enable_if<(I < ParamSize)>::type
        {
          using namespace std;
          auto const & t = get<I>(param_pack_);
          using value_type = typename tuple_element<I,ParamPack>::type::value_type;

          string ss_value;
          if (!is_same<value_type,bool>::value)
            ss_value = "=";
          else
            ss_value = " ";

          ss << "  ";
          if (!t.get(ParamName::SHORT_NAME).empty())
            ss << "-" << t.get(ParamName::SHORT_NAME) << ss_value;
          else
            ss << "  ";
          {
            auto width = t.get(ParamName::SHORT_NAME).size();
            while(width++ < maxWidthShort)
              ss << " ";
          }
          if (!t.get(ParamName::LONG_NAME).empty())
            ss << "  --" << t.get(ParamName::LONG_NAME) << ss_value;
          else
            ss << "     ";

          {
            auto width = t.get(ParamName::LONG_NAME).size();
            while(width++ < maxWidthLong+4)
              ss << " ";
          }

          ss << t.get(ParamName::DESCRIPTION)
            << " [";
          ss << pretty_print(t.default_value());
          ss << "]\n";
          return printUsageImpl<I+1>(ss, maxWidthLong,maxWidthShort);
        }
      // -------------------
      //  Parameter printer
      // -------------------
      template<size_t I, typename SS>
        auto printParamsImpl(SS&& ss, size_t wD, size_t wA) ->
        typename std::enable_if<(I == ParamSize)>::type
        {}
      template<size_t I=0, typename SS>
        auto printParamsImpl(SS&& ss, size_t wD, size_t wA) ->
        typename std::enable_if<(I < ParamSize)>::type
        {
          using namespace std;
          auto const & t = get<I>(param_pack_);

          ss << "\t";
          ss << t.get(ParamName::DESCRIPTION) << ":";
          auto width = t.get(ParamName::DESCRIPTION).size();
          while(width++ < wD+2)
            ss << " ";

          using value_type = typename tuple_element<I,ParamPack>::type::value_type;
          string ss_value = "", ss_space=" ";

          if (!is_same<value_type,bool>::value && !t.get(ParamName::ARG_STRING).empty())
          {
            ss_value = "=";
            ss_space = "";
          }

          {
            auto width = t.get(ParamName::ARG_STRING).size();
            while(width++ < wA)
              ss << " ";
          }
          ss << ss_space << t.get(ParamName::ARG_STRING) << ss_value;
          ss << "  ";

          ss << pretty_print(t.value());
          if (t.default_value() == t.value())
            ss << " [=default]";

          ss << endl;

          printParamsImpl<I+1>(ss, wD, wA);
        }

    public:

      Parser(int argc, char** argv, Ts&&... ts) :
        argc_{argc}, argv_{argv},
        param_pack_{std::make_tuple(std::forward<Ts>(ts)...)}
      {}

      bool parse()
      {
        using namespace std;
        for (int i = 1; i < argc_; ++i)
          if (!parseImpl(argv_[i]))
            return false;
        return true;
      };

      std::string usage()
      {
        using namespace std;
        stringstream ss;
        ss << endl;
        ss << "Usage: " ;
        for (int i = 0; i < argc_; ++i)
          ss << argv_[i] << " ";
        ss << endl;
        ss << endl;
        ss << "Available arguments: \n";
        auto const maxWidthLongName  = maxWidthName(ParamName::LONG_NAME);
        auto const maxWidthShortName = maxWidthName(ParamName::SHORT_NAME);
        printUsageImpl(ss,maxWidthLongName,maxWidthShortName);
        ss << endl;
        return ss.str();
      }

      template<typename F>
        std::string parse_all(F f)
        {
          if (!parse())
          {
            f(usage());
            return std::string{};
          }
          return params();
        }

      std::string parse_all()
      {
        return parse_all([](std::string s) { std::cerr << s; exit(-1); });
      }

      std::string params()
      {
        using namespace std;
        auto const maxWidthArgString   = maxWidthName(ParamName::ARG_STRING);
        auto const maxWidthDescription = maxWidthName(ParamName::DESCRIPTION);
        stringstream ss;
        ss << endl;
        ss << "Exec line: ";
        for (int i = 0; i < argc_; ++i)
          ss << argv_[i] << " ";
        ss << endl << endl;
        ss << "Parameters: \n";
        printParamsImpl(ss, maxWidthDescription, maxWidthArgString);
        ss << endl;
        return ss.str();
      }
  };

  // ------------------
  //  Parameter packer
  // ------------------
  template<typename T>
    class Param : public ParamName
    {
      private:
        T &value_;
        T const default_value_;

      public:
        using value_type = T;
        Param(std::string description, T& val,
            std::string short_name, std::string long_name) :
          ParamName(std::move(description), std::move(short_name), std::move(long_name)),
          value_(val), default_value_(val)
        {}

        T& value() {return value_;}
        T const & value() const {return value_;}
        T const & default_value() const {return default_value_;}
    };

  template<typename T>
  static Param<T> param(char const *description, T& value, char const *short_name, char const *long_name)
  {
    return Param<T>(description,value,short_name,long_name);
  }
  template<typename... Ts>
    Parser<Ts...>
    static pack(int argc, char **argv, Ts&&... ts)
    {
      return Parser<Ts...>(argc, argv, std::forward<Ts>(ts)...);
    }
}


text:
class ListsController < ApplicationController

  before_action :admin_required, :except => %w(index show subscribe unsubscribe available)
  before_action :find_list, :only => %w(edit send_test update destroy subscribe unsubscribe)

  respond_to :html, :js

  def index
    @lists = admin? ? List.includes(:subscriptions).order(:name) : current_user.lists.order(:name)
  end

  def available
    @lists = List.is_public.order(:name)
  end

  def show
    @list = List.find(params[:id])
    @subscriptions = @list.subscriptions.includes(:subscriber).order('subscribers.name')
    @subscription = Subscription.new
    @available_subscribers = Subscriber.find_subscribers_not_in_list(@list.id)
  end

  def new
    @list = List.new
  end

  def edit
  end

  def create
    @list = List.create(list_params)
    respond_with @list
  end

  def update
    @list.update_attributes(list_params)
    respond_with @list
  end

  def destroy
    @list.destroy
    respond_with @list
  end

  def send_test
    Mailman.deliver_list_test_dispatch(@list) unless @list.subscriptions.blank?
    redirect_to @list
  end

  def subscribe
   @list.subscribers << current_user
   flash[:notice] = "You're now subscribed to #{@list.name}"
   redirect_to lists_url
  end

  def unsubscribe
    @list.subscribers.delete(current_user)
    flash[:notice] = "You're no longer subscribed to #{@list.name}"
    redirect_to lists_url
  end

  private

  def find_list
    @list = List.find(params[:id])
  end

  def list_params
    params.require(:list).permit(
      :name, :description, :mailbox, :subscriber_ids, :private,
      :subject_prefix, :send_replies_to, :message_footer,
      :permitted_to_post, :archive_disabled, :disabled
    )
  end
end

redpajama_set_name: RedPajamaGithub


text:
from __future__ import unicode_literals, division, absolute_import
import os
import sys

class TestExec(object):

    __tmp__ = True
    config = """
        templates:
          global:
            set:
              temp_dir: '__tmp__'
            accept_all: yes
        tasks:
          replace_from_entry:
            mock:
              - {title: 'replace'}
              - {title: 'replace with spaces'}
            exec: """ + sys.executable + """ exec.py "{{temp_dir}}" "{{title}}"
          test_adv_format:
            mock:
              - {title: entry1, location: '/path/with spaces', quotefield: "with'quote"}
            exec:
              on_output:
                for_entries: """ + sys.executable + """ exec.py "{{temp_dir}}" "{{title}}" "{{location}}" "/the/final destinaton/" "a {{quotefield}}" "/a hybrid{{location}}"
          test_auto_escape:
            mock:
              - {title: entry2, quotes: single ' double", otherchars: '% a $a! ` *'}
            exec:
              auto_escape: yes
              on_output:
                for_entries: """ + sys.executable + """ exec.py "{{temp_dir}}" "{{title}}" "{{quotes}}" "/start/{{quotes}}" "{{otherchars}}"
    """

    def test_replace_from_entry(self, execute_task, tmpdir):
        task = execute_task('replace_from_entry')
        assert len(task.accepted) == 2, "not all entries were accepted"
        for entry in task.accepted:
            assert tmpdir.join(entry['title']).exists(), "exec.py did not create a file for %s" % entry['title']

    def test_adv_format(self, execute_task, tmpdir):
        task = execute_task('test_adv_format')
        for entry in task.accepted:
            with tmpdir.join(entry['title']).open('r') as infile:
                line = infile.readline().rstrip('\n')
                assert line == '/path/with spaces', '%s != /path/with spaces' % line
                line = infile.readline().rstrip('\n')
                assert line == '/the/final destinaton/', '%s != /the/final destinaton/' % line
                line = infile.readline().rstrip('\n')
                assert line == 'a with\'quote', '%s != a with\'quote' % line
                line = infile.readline().rstrip('\n')
                assert line == '/a hybrid/path/with spaces', '%s != /a hybrid/path/with spaces' % line

    # TODO: This doesn't work on linux.
    """
    def test_auto_escape(self, execute_task):
        task = execute_task('test_auto_escape')
        for entry in task.accepted:
            with open(os.path.join(self.__tmp__, entry['title']), 'r') as infile:
                line = infile.readline().rstrip('\n')
                assert line == 'single \' double\"', '%s != single \' double\"' % line
                line = infile.readline().rstrip('\n')
                assert line == '/start/single \' double\"', '%s != /start/single \' double\"' % line
                line = infile.readline().rstrip('\n')
                assert line == '% a $a! ` *', '%s != % a $a! ` *' % line
    """


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:background="@color/white"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:paddingTop="20dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="1">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.1">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/measure_select_help"
                android:textSize="18dp"
                android:textColor="@color/colorPrimary"
                android:layout_gravity="center"
                android:paddingBottom="5dp"/>

            <TextView
                android:text="@string/part_string"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/textView5"
                android:paddingTop="5dp"
                android:textSize="18sp" />

            <Spinner
                android:id="@+id/view_select_part"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                />

            <TextView
                android:text="@string/partserial_string"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/textView6"
                android:paddingTop="5dp"
                android:textSize="18sp" />
            <Spinner
                android:id="@+id/view_select_work"
                android:layout_width="match_parent"
                android:layout_height="40dp"/>

            <TextView
                android:text="@string/work_string"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/textView7"
                android:paddingTop="5dp"
                android:textSize="18sp" />
            <Spinner
                android:id="@+id/view_select_process"
                android:layout_width="match_parent"
                android:layout_height="40dp"/>

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dp"
                android:background="@color/bg" />
        </LinearLayout>
    </LinearLayout>

    <FrameLayout

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="15dp"
        android:layout_weight="0.6">

        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="1" >

                <TextView
                    android:text="@string/show_workId"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_measID"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_value"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_normalSize"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_toleranceU"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_toleranceL"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_finalMeas"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />
                <TextView
                    android:text="@string/show_isKeyMeas"
                    android:layout_width="70dp"
                    android:layout_height="match_parent" />

            </LinearLayout>
            <ListView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/view_data"
                android:layout_weight="0.1" />
        </LinearLayout>
        </HorizontalScrollView>

    </FrameLayout>

</LinearLayout>


text:
namespace ReleaseStats.Tests.Reports
{
    using System;
    using System.Linq;
    using NUnit.Framework;
    using ReleaseStats.ReleaseProperties;

    [TestFixture, Explicit("Long running")]
    public class Recent_releases : ReportFixture
    {

        [Test]
        public void DisplayReport()
        {

            var result = releaseStatsRunner.GenerateMultiple("NServiceBus*","Service*");

            var reportData = result.SelectMany(p=>p.AllReleasesForHierarchy).ToList();

            Console.Out.WriteLine("---------------------- Releases last 7 days --------------------------------");

            foreach (var release in reportData.Where(r => r.HasProperty<ReleaseDate>() && r.HasProperty<LinkToReleaseNotes>()).OrderByDescending(r => r.Property<ReleaseDate>().ReleasedAt))
            {
                var releaseDate = release.Property<ReleaseDate>().ReleasedAt;

                if ((DateTime.Now - releaseDate) < TimeSpan.FromDays(7))
                {

                    var releaseNotes = "not found";

                    if (release.HasProperty<LinkToReleaseNotes>())
                    {
                        releaseNotes = release.Property<LinkToReleaseNotes>().Url;
                    }

                    Console.Out.WriteLine("* [{0} - {1}]({2})",release.Property<BelongsToProject>().Project.Name,release.Version,releaseNotes);
                }

            }

        }

    }
}


text: My Docker Stuff


text:
import React from 'react'
import styled from 'styled-components'
import { Box, Flex } from 'blockstack-ui'
const CodeWapper = styled(Box)`
  /* BASICS */

  .CodeMirror {
    /* Set height, width, borders, and global font properties here */
    .cm-invalidchar {
      display: none;
    }
    font-family: monospace;
    background: transparent !important;
    \direction: ltr;
    line-height: 1.8;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
  }

  /* PADDING */

  .CodeMirror-lines {
    padding: 4px 0; /* Vertical padding around content */
  }
  .CodeMirror pre {
    padding: 0 4px; /* Horizontal padding of content */
  }

  .CodeMirror-scrollbar-filler,
  .CodeMirror-gutter-filler {
    background-color: white; /* The little square between H and V scrollbars */
  }

  /* GUTTER */

  .CodeMirror-gutters {
    border-right: 1px solid #ddd;
    background-color: #f7f7f7;
    white-space: nowrap;
  }
  .CodeMirror-linenumbers {
  }
  .CodeMirror-linenumber {
    padding: 0 3px 0 5px;
    min-width: 20px;
    text-align: right;
    color: #999;
    white-space: nowrap;
  }

  .CodeMirror-guttermarker {
    color: black;
  }
  .CodeMirror-guttermarker-subtle {
    color: #999;
  }

  /* CURSOR */

  .CodeMirror-cursor {
    border-left: 1px solid black;
    border-right: none;
    width: 0;
  }
  /* Shown when moving in bi-directional text */
  .CodeMirror div.CodeMirror-secondarycursor {
    border-left: 1px solid silver;
  }
  .cm-fat-cursor .CodeMirror-cursor {
    width: auto;
    border: 0 !important;
    background: #7e7;
  }
  .cm-fat-cursor div.CodeMirror-cursors {
    z-index: 1;
  }
  .cm-fat-cursor-mark {
    background-color: rgba(20, 255, 20, 0.5);
    -webkit-animation: blink 1.06s steps(1) infinite;
    -moz-animation: blink 1.06s steps(1) infinite;
    animation: blink 1.06s steps(1) infinite;
  }
  .cm-animate-fat-cursor {
    width: auto;
    border: 0;
    -webkit-animation: blink 1.06s steps(1) infinite;
    -moz-animation: blink 1.06s steps(1) infinite;
    animation: blink 1.06s steps(1) infinite;
    background-color: #7e7;
  }
  @-moz-keyframes blink {
    0% {
    }
    50% {
      background-color: transparent;
    }
    100% {
    }
  }
  @-webkit-keyframes blink {
    0% {
    }
    50% {
      background-color: transparent;
    }
    100% {
    }
  }
  @keyframes blink {
    0% {
    }
    50% {
      background-color: transparent;
    }
    100% {
    }
  }

  /* Can style cursor different in overwrite (non-insert) mode */
  .CodeMirror-overwrite .CodeMirror-cursor {
  }

  .cm-tab {
    display: inline-block;
    text-decoration: inherit;
  }

  .CodeMirror-rulers {
    position: absolute;
    left: 0;
    right: 0;
    top: -50px;
    bottom: -20px;
    overflow: hidden;
  }
  .CodeMirror-ruler {
    border-left: 1px solid #ccc;
    top: 0;
    bottom: 0;
    position: absolute;
  }

  /* DEFAULT THEME */

  .cm-s-default .cm-header {
    color: blue;
  }
  .cm-s-default .cm-quote {
    color: #090;
  }
  .cm-negative {
    color: #d44;
  }
  .cm-positive {
    color: #292;
  }
  .cm-header,
  .cm-strong {
    font-weight: bold;
  }
  .cm-em {
    font-style: italic;
  }
  .cm-link {
    text-decoration: underline;
  }
  .cm-strikethrough {
    text-decoration: line-through;
  }

  .cm-s-default .cm-keyword {
    color: #708;
  }
  .cm-s-default .cm-atom {
    color: #219;
  }
  .cm-s-default .cm-number {
    color: #164;
  }
  .cm-s-default .cm-def {
    color: #00f;
  }
  .cm-s-default .cm-variable,
  .cm-s-default .cm-punctuation,
  .cm-s-default .cm-property,
  .cm-s-default .cm-operator {
  }
  .cm-s-default .cm-variable-2 {
    color: #05a;
  }
  .cm-s-default .cm-variable-3,
  .cm-s-default .cm-type {
    color: #085;
  }
  .cm-s-default .cm-comment {
    color: #a50;
  }
  .cm-s-default .cm-string {
    color: #a11;
  }
  .cm-s-default .cm-string-2 {
    color: #f50;
  }
  .cm-s-default .cm-meta {
    color: #555;
  }
  .cm-s-default .cm-qualifier {
    color: #555;
  }
  .cm-s-default .cm-builtin {
    color: #30a;
  }
  .cm-s-default .cm-bracket {
    color: #997;
  }
  .cm-s-default .cm-tag {
    color: #170;
  }
  .cm-s-default .cm-attribute {
    color: #00c;
  }
  .cm-s-default .cm-hr {
    color: #999;
  }
  .cm-s-default .cm-link {
    color: #00c;
  }

  .cm-s-default .cm-error {
    color: #f00;
  }
  .cm-invalidchar {
    color: #f00;
  }

  .CodeMirror-composing {
    border-bottom: 2px solid;
  }

  /* Default styles for common addons */

  div.CodeMirror span.CodeMirror-matchingbracket {
    color: #0b0;
  }
  div.CodeMirror span.CodeMirror-nonmatchingbracket {
    color: #a22;
  }
  .CodeMirror-matchingtag {
    background: rgba(255, 150, 0, 0.3);
  }
  .CodeMirror-activeline-background {
    background: #e8f2ff;
  }

  /* STOP */

  /* The rest of this file contains styles related to the mechanics of
   the editor. You probably shouldn't touch them. */

  .CodeMirror {
    position: relative;
    overflow: hidden;
    background: white;
    padding-right: 30px;
  }

  .CodeMirror-scroll {
    overflow: hidden !important; /* Things will break if this is overridden */
    /* 30px is the magic margin used to hide the element's real scrollbars */
    /* See overflow: hidden in .CodeMirror */
    margin-bottom: -30px;
    margin-right: -30px;
    padding-bottom: 30px;
    height: 100%;
    width: 100%;
    outline: none; /* Prevent dragging from highlighting the element */
    position: relative;
  }
  .CodeMirror-sizer {
    position: relative;
    border-right: 30px solid transparent;
  }

  /* The fake, visible scrollbars. Used to force redraw during scrolling
   before actual scrolling happens, thus preventing shaking and
   flickering artifacts. */
  .CodeMirror-vscrollbar,
  .CodeMirror-hscrollbar,
  .CodeMirror-scrollbar-filler,
  .CodeMirror-gutter-filler {
    position: absolute;
    z-index: 6;
    display: none;
  }
  .CodeMirror-vscrollbar {
    right: 0;
    top: 0;
    overflow-x: hidden;
    overflow-y: scroll;
  }
  .CodeMirror-hscrollbar {
    bottom: 0;
    left: 0;
    overflow-y: hidden;
    overflow-x: hidden;
  }
  .CodeMirror-scrollbar-filler {
    right: 0;
    bottom: 0;
  }
  .CodeMirror-gutter-filler {
    left: 0;
    bottom: 0;
  }

  .CodeMirror-gutters {
    position: absolute;
    left: 0;
    top: 0;
    min-height: 100%;
    z-index: 3;
  }
  .CodeMirror-gutter {
    white-space: normal;
    height: 100%;
    display: inline-block;
    vertical-align: top;
    margin-bottom: -30px;
  }
  .CodeMirror-gutter-wrapper {
    position: absolute;
    z-index: 4;
    background: none !important;
    border: none !important;
  }
  .CodeMirror-gutter-background {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 4;
  }
  .CodeMirror-gutter-elt {
    position: absolute;
    cursor: default;
    z-index: 4;
  }
  .CodeMirror-gutter-wrapper ::selection {
    background-color: transparent;
  }
  .CodeMirror-gutter-wrapper ::-moz-selection {
    background-color: transparent;
  }

  .CodeMirror-lines {
    cursor: text;
    min-height: 1px; /* prevents collapsing before first draw */
  }
  .CodeMirror pre {
    /* Reset some styles that the rest of the page might have set */
    -moz-border-radius: 0;
    -webkit-border-radius: 0;
    border-radius: 0;
    border-width: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    margin: 0;
    white-space: pre;
    word-wrap: normal;
    line-height: inherit;
    color: inherit;
    z-index: 2;
    position: relative;
    overflow: visible;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-variant-ligatures: contextual;
    font-variant-ligatures: contextual;
  }
  .CodeMirror-wrap pre {
    word-wrap: break-word;
    white-space: pre-wrap;
    word-break: normal;
  }

  .CodeMirror-linebackground {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
  }

  .CodeMirror-linewidget {
    position: relative;
    z-index: 2;
    padding: 0.1px; /* Force widget margins to stay inside of the container */
  }

  .CodeMirror-widget {
  }

  .CodeMirror-rtl pre {
    direction: rtl;
  }

  .CodeMirror-code {
    outline: none;
  }

  /* Force content-box sizing for the elements where we expect it */
  .CodeMirror-scroll,
  .CodeMirror-sizer,
  .CodeMirror-gutter,
  .CodeMirror-gutters,
  .CodeMirror-linenumber {
    -moz-box-sizing: content-box;
    box-sizing: content-box;
  }

  .CodeMirror-measure {
    position: absolute;
    width: 100%;
    height: 0;
    overflow: hidden;
    visibility: hidden;
  }

  .CodeMirror-cursor {
    position: absolute;
    pointer-events: none;
  }
  .CodeMirror-measure pre {
    position: static;
  }

  div.CodeMirror-cursors {
    visibility: hidden;
    position: relative;
    z-index: 3;
  }
  div.CodeMirror-dragcursors {
    visibility: visible;
  }

  .CodeMirror-focused div.CodeMirror-cursors {
    visibility: visible;
  }

  .CodeMirror-selected {
    background: #d9d9d9;
  }
  .CodeMirror-focused .CodeMirror-selected {
    background: #d7d4f0;
  }
  .CodeMirror-crosshair {
    cursor: crosshair;
  }
  .CodeMirror-line::selection,
  .CodeMirror-line > span::selection,
  .CodeMirror-line > span > span::selection {
    background: #d7d4f0;
  }
  .CodeMirror-line::-moz-selection,
  .CodeMirror-line > span::-moz-selection,
  .CodeMirror-line > span > span::-moz-selection {
    background: #d7d4f0;
  }

  .cm-searching {
    background-color: #ffa;
    background-color: rgba(255, 255, 0, 0.4);
  }

  /* Used to force a border model for a node */
  .cm-force-border {
    padding-right: 0.1px;
  }

  @media print {
    /* Hide the cursor when printing */
    .CodeMirror div.CodeMirror-cursors {
      visibility: hidden;
    }
  }

  /* See issue #2901 */
  .cm-tab-wrap-hack:after {
    content: '';
  }

  /* Help users use markselection to safely style text background */
  span.CodeMirror-selectedtext {
    background: none;
  }

  /*

    Name:       material
    Author:     Michael Kaminsky (http://github.com/mkaminsky11)

    Original material color scheme by Mattia Astorino (https://github.com/equinusocio/material-theme)

*/

  .cm-s-material.CodeMirror {
    background-color: #263238;
    color: rgba(233, 237, 237, 1);
  }
  .cm-s-material .CodeMirror-gutters {
    background: #263238;
    color: rgb(83, 127, 126);
    border: none;
  }
  .cm-s-material .CodeMirror-guttermarker,
  .cm-s-material .CodeMirror-guttermarker-subtle,
  .cm-s-material .CodeMirror-linenumber {
    color: rgb(83, 127, 126);
  }
  .cm-s-material .CodeMirror-cursor {
    border-left: 1px solid #f8f8f0;
  }
  .cm-s-material div.CodeMirror-selected {
    background: rgba(255, 255, 255, 0.15);
  }
  .cm-s-material.CodeMirror-focused div.CodeMirror-selected {
    background: rgba(255, 255, 255, 0.1);
  }
  .cm-s-material .CodeMirror-line::selection,
  .cm-s-material .CodeMirror-line > span::selection,
  .cm-s-material .CodeMirror-line > span > span::selection {
    background: rgba(255, 255, 255, 0.1);
  }
  .cm-s-material .CodeMirror-line::-moz-selection,
  .cm-s-material .CodeMirror-line > span::-moz-selection,
  .cm-s-material .CodeMirror-line > span > span::-moz-selection {
    background: rgba(255, 255, 255, 0.1);
  }

  .cm-s-material .CodeMirror-activeline-background {
    background: rgba(0, 0, 0, 0);
  }
  .cm-s-material .cm-keyword {
    color: rgba(199, 146, 234, 1);
  }
  .cm-s-material .cm-operator {
    color: rgba(233, 237, 237, 1);
  }
  .cm-s-material .cm-variable-2 {
    color: #80cbc4;
  }
  .cm-s-material .cm-variable-3,
  .cm-s-material .cm-type {
    color: #82b1ff;
  }
  .cm-s-material .cm-builtin {
    color: #decb6b;
  }
  .cm-s-material .cm-atom {
    color: #f77669;
  }
  .cm-s-material .cm-number {
    color: #f77669;
  }
  .cm-s-material .cm-def {
    color: rgba(233, 237, 237, 1);
  }
  .cm-s-material .cm-string {
    color: #c3e88d;
  }
  .cm-s-material .cm-string-2 {
    color: #80cbc4;
  }
  .cm-s-material .cm-comment {
    color: #546e7a;
  }
  .cm-s-material .cm-variable {
    color: #82b1ff;
  }
  .cm-s-material .cm-tag {
    color: #80cbc4;
  }
  .cm-s-material .cm-meta {
    color: #80cbc4;
  }
  .cm-s-material .cm-attribute {
    color: #ffcb6b;
  }
  .cm-s-material .cm-property {
    color: #80cbae;
  }
  .cm-s-material .cm-qualifier {
    color: #decb6b;
  }
  .cm-s-material .cm-variable-3,
  .cm-s-material .cm-type {
    color: #decb6b;
  }
  .cm-s-material .cm-tag {
    color: rgba(255, 83, 112, 1);
  }
  .cm-s-material .cm-error {
    color: rgba(255, 255, 255, 1);
    background-color: #ec5f67;
  }
  .cm-s-material .CodeMirror-matchingbracket {
    text-decoration: underline;
    color: white !important;
  }
`

const CodeMirrorStyled = styled(Box).attrs({ is: 'code' })``

export { CodeMirrorStyled, CodeWapper }


text:
from __future__ import unicode_literals
from __future__ import division

from builtins import str, bytes, dict, int
from builtins import map, zip, filter
from builtins import object, range

import os
import sys

try:
    MODULE = os.path.dirname(os.path.realpath(__file__))
except:
    MODULE = ""

sys.path.insert(0, os.path.join(MODULE, "..", "..", "..", ".."))

# Import parser base classes.
from pattern.text import (
    Lexicon, Model, Morphology, Context, Parser as _Parser, ngrams, pprint, commandline,
    PUNCTUATION
)
# Import parser universal tagset.
from pattern.text import (
    penntreebank2universal,
    PTB, PENN, UNIVERSAL,
    NOUN, VERB, ADJ, ADV, PRON, DET, PREP, ADP, NUM, CONJ, INTJ, PRT, PUNC, X
)
# Import parse tree base classes.
from pattern.text.tree import (
    Tree, Text, Sentence, Slice, Chunk, PNPChunk, Chink, Word, table,
    SLASH, WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA, AND, OR
)
# Import sentiment analysis base classes.
from pattern.text import (
    Sentiment, NOUN, VERB, ADJECTIVE, ADVERB
)
# Import spelling base class.
from pattern.text import (
    Spelling
)
# Import verb tenses.
from pattern.text import (
    INFINITIVE, PRESENT, PAST, FUTURE,
    FIRST, SECOND, THIRD,
    SINGULAR, PLURAL, SG, PL,
    INDICATIVE, IMPERATIVE, SUBJUNCTIVE,
    PROGRESSIVE,
    PARTICIPLE, GERUND
)
# Import inflection functions.
from pattern.text.de.inflect import (
    article, referenced, DEFINITE, INDEFINITE,
    pluralize, singularize, NOUN, VERB, ADJECTIVE,
    grade, comparative, superlative, COMPARATIVE, SUPERLATIVE,
    verbs, conjugate, lemma, lexeme, tenses,
    predicative, attributive,
    gender, MASCULINE, MALE, FEMININE, FEMALE, NEUTER, NEUTRAL, PLURAL, M, F, N, PL,
            NOMINATIVE, ACCUSATIVE, DATIVE, GENITIVE, SUBJECT, OBJECT, INDIRECT, PROPERTY
)
# Import all submodules.
from pattern.text.de import inflect

sys.path.pop(0)

#--- GERMAN PARSER ---------------------------------------------------------------------------------
# The German parser (accuracy 96% for known words) is based on Schneider & Volk's language model:
# Schneider, G. & Volk, M. (1998).
# Adding Manual Constraints and Lexical Look-up to a Brill-Tagger for German.
# Proceedings of the ESSLLI workshop on recent advances in corpus annotation. Saarbrucken, Germany.
# http://www.zora.uzh.ch/28579/

# The lexicon uses the Stuttgart/Tubinger Tagset (STTS):
# https://files.ifi.uzh.ch/cl/tagger/UIS-STTS-Diffs.html
STTS = "stts"
stts = tagset = {
      "ADJ": "JJ",
     "ADJA": "JJ",   # das große Haus
     "ADJD": "JJ",   # er ist schnell
      "ADV": "RB",   # schon
     "APPR": "IN",   # in der Stadt
  "APPRART": "IN",   # im Haus
     "APPO": "IN",   # der Sache wegen
     "APZR": "IN",   # von jetzt an
      "ART": "DT",   # der, die, eine
   "ARTDEF": "DT",   # der, die
   "ARTIND": "DT",   # eine
     "CARD": "CD",   # zwei
  "CARDNUM": "CD",   # 3
     "KOUI": "IN",   # [um] zu leben
     "KOUS": "IN",   # weil, damit, ob
      "KON": "CC",   # und, oder, aber
    "KOKOM": "IN",   # als, wie
     "KONS": "IN",   # usw.
       "NN": "NN",   # Tisch, Herr
      "NNS": "NNS",  # Tischen, Herren
       "NE": "NNP",  # Hans, Hamburg
      "PDS": "DT",   # dieser, jener
     "PDAT": "DT",   # jener Mensch
      "PIS": "DT",   # keiner, viele, niemand
     "PIAT": "DT",   # kein Mensch
    "PIDAT": "DT",   # die beiden Brüder
     "PPER": "PRP",  # ich, er, ihm, mich, dir
     "PPOS": "PRP$", # meins, deiner
   "PPOSAT": "PRP$", # mein Buch, deine Mutter
    "PRELS": "WDT",  # der Hund, [der] bellt
   "PRELAT": "WDT",  # der Mann, [dessen] Hund bellt
      "PRF": "PRP",  # erinnere [dich]
      "PWS": "WP",   # wer
     "PWAT": "WP",   # wessen, welche
     "PWAV": "WRB",  # warum, wo, wann
      "PAV": "RB",   # dafur, dabei, deswegen, trotzdem
    "PTKZU": "TO",   # zu gehen, zu sein
   "PTKNEG": "RB",   # nicht
    "PTKVZ": "RP",   # pass [auf]!
   "PTKANT": "UH",   # ja, nein, danke, bitte
     "PTKA": "RB",   # am schönsten, zu schnell
    "VVFIN": "VB",   # du [gehst], wir [kommen] an
    "VAFIN": "VB",   # du [bist], wir [werden]
    "VVINF": "VB",   # gehen, ankommen
    "VAINF": "VB",   # werden, sein
    "VVIZU": "VB",   # anzukommen
    "VVIMP": "VB",   # [komm]!
    "VAIMP": "VB",   # [sei] ruhig!
     "VVPP": "VBN",  # gegangen, angekommen
     "VAPP": "VBN",  # gewesen
    "VMFIN": "MD",   # dürfen
    "VMINF": "MD",   # wollen
     "VMPP": "MD",   # gekonnt
     "SGML": "SYM",  #
       "FM": "FW",   #
      "ITJ": "UH",   # ach, tja
       "XY": "NN",   #
       "XX": "NN",   #
    "LINUM": "LS",   # 1.
        "C": ",",    # ,
       "Co": ":",    # :
       "Ex": ".",    # !
       "Pc": ")",    # )
       "Po": "(",    # (
        "Q": ".",    # ?
      "QMc": "\"",   # "
      "QMo": "\"",   # "
        "S": ".",    # .
       "Se": ":",    # ;
}

def stts2penntreebank(token, tag):
    """ Converts an STTS tag to a Penn Treebank II tag.
        For example: ohne/APPR => ohne/IN
    """
    return (token, stts.get(tag, tag))

def stts2universal(token, tag):
    """ Converts an STTS tag to a universal tag.
        For example: ohne/APPR => ohne/PREP
    """
    if tag in ("KON", "KOUI", "KOUS", "KOKOM"):
        return (token, CONJ)
    if tag in ("PTKZU", "PTKNEG", "PTKVZ", "PTKANT"):
        return (token, PRT)
    if tag in ("PDF", "PDAT", "PIS", "PIAT", "PIDAT", "PPER", "PPOS", "PPOSAT"):
        return (token, PRON)
    if tag in ("PRELS", "PRELAT", "PRF", "PWS", "PWAT", "PWAV", "PAV"):
        return (token, PRON)
    return penntreebank2universal(*stts2penntreebank(token, tag))

ABBREVIATIONS = set((
    "Abs.", "Abt.", "Ass.", "Br.", "Ch.", "Chr.", "Cie.", "Co.", "Dept.", "Diff.",
    "Dr.", "Eidg.", "Exp.", "Fam.", "Fr.", "Hrsg.", "Inc.", "Inv.", "Jh.", "Jt.", "Kt.",
    "Mio.", "Mrd.", "Mt.", "Mte.", "Nr.", "Nrn.", "Ord.", "Ph.", "Phil.", "Pkt.",
    "Prof.", "Pt.", " S.", "St.", "Stv.", "Tit.", "VII.", "al.", "begr.", "bzw.",
    "chem.", "dent.", "dipl.", "e.g.", "ehem.", "etc.", "excl.", "exkl.", "hum.",
    "i.e.", "incl.", "ing.", "inkl.", "int.", "iur.", "lic.", "med.", "no.", "oec.",
    "phil.", "phys.", "pp.", "psych.", "publ.", "rer.", "sc.", "soz.", "spez.", "stud.",
    "theol.", "usw.", "vet.", "vgl.", "vol.", "wiss.",
    "d.h.", "h.c.", "o.ä.", "u.a.", "z.B.", "z.T.", "z.Zt."
))

def find_lemmata(tokens):
    """ Annotates the tokens with lemmata for plural nouns and conjugated verbs,
        where each token is a [word, part-of-speech] list.
    """
    for token in tokens:
        word, pos, lemma = token[0], token[1], token[0]
        if pos.startswith(("DT", "JJ")):
            lemma = predicative(word)
        if pos == "NNS":
            lemma = singularize(word)
        if pos.startswith(("VB", "MD")):
            lemma = conjugate(word, INFINITIVE) or word
        token.append(lemma.lower())
    return tokens

class Parser(_Parser):

    def find_tokens(self, tokens, **kwargs):
        kwargs.setdefault("abbreviations", ABBREVIATIONS)
        kwargs.setdefault("replace", {})
        return _Parser.find_tokens(self, tokens, **kwargs)

    def find_lemmata(self, tokens, **kwargs):
        return find_lemmata(tokens)

    def find_tags(self, tokens, **kwargs):
        if kwargs.get("tagset") in (PENN, None):
            kwargs.setdefault("map", lambda token, tag: stts2penntreebank(token, tag))
        if kwargs.get("tagset") == UNIVERSAL:
            kwargs.setdefault("map", lambda token, tag: stts2universal(token, tag))
        if kwargs.get("tagset") is STTS:
            kwargs.setdefault("map", lambda token, tag: (token, tag))
        # The lexicon uses Swiss spelling: "ss" instead of "ß".
        # We restore the "ß" after parsing.
        tokens_ss = [t.replace("ß", "ss") for t in tokens]
        tokens_ss = _Parser.find_tags(self, tokens_ss, **kwargs)
        return [[w] + tokens_ss[i][1:] for i, w in enumerate(tokens)]

parser = Parser(
     lexicon = os.path.join(MODULE, "de-lexicon.txt"),
   frequency = os.path.join(MODULE, "de-frequency.txt"),
  morphology = os.path.join(MODULE, "de-morphology.txt"),
     context = os.path.join(MODULE, "de-context.txt"),
     default = ("NN", "NE", "CARDNUM"),
    language = "de"
)

lexicon = parser.lexicon # Expose lexicon.

spelling = Spelling(
        path = os.path.join(MODULE, "de-spelling.txt")
)

def tokenize(s, *args, **kwargs):
    """ Returns a list of sentences, where punctuation marks have been split from words.
    """
    return parser.find_tokens(s, *args, **kwargs)

def parse(s, *args, **kwargs):
    """ Returns a tagged Unicode string.
    """
    return parser.parse(s, *args, **kwargs)

def parsetree(s, *args, **kwargs):
    """ Returns a parsed Text from the given string.
    """
    return Text(parse(s, *args, **kwargs))

def tree(s, token=[WORD, POS, CHUNK, PNP, REL, LEMMA]):
    """ Returns a parsed Text from the given parsed string.
    """
    return Text(s, token)

def tag(s, tokenize=True, encoding="utf-8", **kwargs):
    """ Returns a list of (token, tag)-tuples from the given string.
    """
    tags = []
    for sentence in parse(s, tokenize, True, False, False, False, encoding, **kwargs).split():
        for token in sentence:
            tags.append((token[0], token[1]))
    return tags

def keywords(s, top=10, **kwargs):
    """ Returns a sorted list of keywords in the given string.
    """
    return parser.find_keywords(s, **dict({
        "frequency": parser.frequency,
              "top": top,
              "pos": ("NN",),
           "ignore": ("rt",)}, **kwargs))

def suggest(w):
    """ Returns a list of (word, confidence)-tuples of spelling corrections.
    """
    return spelling.suggest(w)

split = tree # Backwards compatibility.

#---------------------------------------------------------------------------------------------------
# python -m pattern.de xml -s "Ein Unglück kommt selten allein." -OTCL

if __name__ == "__main__":
    commandline(parse)


text:
Inline all of your styles. Why would you do such a horrible thing? Probably only for developing email templates.

This takes some of the pain out of developing templates by allowing you to centralize your CSS, and not worrying about writing style attributes for every element.

This uses the [inline-style][0] gem from Macario Ortega to do all the work

## Installation

Add this line to your application's Gemfile:

    gem 'middleman-inline-style'

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install middleman-inline-style

## Usage

Add this to your config.rb:

    require "middleman-inline-style"
    activate :inline_style

## Contributing

1. Fork it ( https://github.com/trenton42/middleman-inline-style/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## License

MIT

[0]: https://github.com/maca/inline-style


text:
import { Injectable } from "@angular/core";
import { BehaviorSubject } from "rxjs";
import { convertToParamMap, ParamMap } from "@angular/router";

@Injectable()
export class ActivatedRouteStub {
  // ActivatedRoute.paramMap is Observable
  private paramMapSubject = new BehaviorSubject(
    convertToParamMap(this.testParamMap)
  );
  private queryParamMapSubject = new BehaviorSubject(
    convertToParamMap(this.testQueryParamMap)
  );
  paramMap = this.paramMapSubject.asObservable();
  queryParamMap = this.queryParamMapSubject.asObservable();

  // Test parameters
  private _testParamMap: ParamMap;
  get testParamMap() {
    return this._testParamMap;
  }
  set testParamMap(params: {}) {
    this._testParamMap = convertToParamMap(params);
    this.paramMapSubject.next(this._testParamMap);
  }

  private _testQueryParamMap: ParamMap;
  get testQueryParamMap() {
    return this._testQueryParamMap;
  }
  set testQueryParamMap(params: {}) {
    this._testQueryParamMap = convertToParamMap(params);
    this.queryParamMapSubject.next(this._testQueryParamMap);
  }

  // ActivatedRoute.snapshot.paramMap
  get snapshot() {
    return { paramMap: this.testParamMap };
  }
}


text:
var ws = (function () {
  const ADDFONT = 0
  const DELFONT = 1
  const GETFONT = 2
  const HEARTBEAT = 3
  const UNKNOWN = 4

  const STATUSOK = 0
  const STATUSWAIT = 1
  const STATUSFAILED = 2

  const typeVals = [[ADDFONT,"ADDFONT"],[DELFONT,"DELFONT"],[GETFONT,"GETFONT"],[HEARTBEAT,"HEARTBEAT"],[UNKNOWN,"UNKNOWN"]]
  const typeMap = new Map(typeVals)

  const statusVals = [[STATUSOK,"STATUS_OK"],[STATUSWAIT,"STATUS_WAIT"],[STATUSFAILED,"STATUS_FAILED"]]
  const statusMap = new Map(statusVals)

  const bootstrapAlertVals = [[STATUSOK,"success"],[STATUSWAIT,"warning"],[STATUSFAILED,"danger"]]
  const bootstrapMap = new Map(bootstrapAlertVals)

  let lws
  function _connect(openCallback, closeCallback, messageCallback) {
    // lws = new WebSocket("ws://192.168.1.121:42135/ws")
    lws = new WebSocket("ws://localhost:42135/ws")
    lws.onopen = function(ev) {
      openCallback(ev)
    }

    lws.onmessage = function(ev) { messageCallback(ev) }
    lws.onclose = function(ev) { closeCallback(ev) }
  }

  function _send(data) {
    lws.send(data)
  }

  function _status(nbr) {
    return statusMap.get(nbr)
  }

  function _type(nbr) {
    return typeMap.get(nbr)
  }

  function _bootstrap(nbr) {
    return bootstrapMap.get(nbr)
  }

  return {
    connect: _connect,
    send: _send,
    status: _status,
    type: _type,
    bootstrap: _bootstrap,
    ADDFONT: ADDFONT,
    DELFONT: DELFONT,
    GETFONT: GETFONT,
    HEARBEAT: HEARTBEAT,
    UNKNOWN: UNKNOWN,
    STATUSOK: STATUSOK,
    STATUSWAIT: STATUSWAIT,
    STATUSFAILED: STATUSFAILED
  }
})();
module.exports = ws


text:
<?php
namespace Craft;

class CommerceStockNotifierPlugin extends BasePlugin
{
	protected $originalStocks;
	protected $lowStockVariants;

	public function init()
	{
		// Register event listeners
		craft()->on('commerce_orders.beforeOrderComplete', [$this, 'onBeforeOrderComplete']);
		craft()->on('commerce_variants.onOrderVariant', [$this, 'onOrderVariant']);
	}

	public function onBeforeOrderComplete(Event $event)
	{
		/** @var Commerce_OrderModel $order */
		$order = $event->params['order'];

		// Loop through each of the line items and record the original variant stocks,
		// for any variants that are currently above our notification threshold
		$this->originalStocks = [];

		foreach ($order->getLineItems() as $lineItem)
		{
			$variant = $lineItem->getPurchasable();

			if (!$variant)
			{
				continue;
			}

			if (
				$variant instanceof Commerce_VariantModel &&
				!$variant->unlimitedStock &&
				$variant->stock > $this->getSettings()->threshold
			)
			{
				$this->originalStocks[$variant->id] = $variant->stock;
			}
		}
	}

	public function onOrderVariant(Event $event)
	{
		/** @var Commerce_OrderModel $order */
		$variant = $event->params['variant'];

		if (!$variant->id)
		{
			return;
		}

		$this->lowStockVariants = [];
		$threshold = $this->getSettings()->threshold;

		if (isset($this->originalStocks[$variant->id]))
		{
			// see if the original stock has moved from being above the threshold to
			// below the threshold, and send an email.
			if ($this->originalStocks[$variant->id] > $threshold && $variant->stock <= $threshold)
			{
				$this->lowStockVariants[$variant->id] = $variant;
			}
		}

		if (count($this->lowStockVariants) > 0)
		{
			$this->_sendEmail();
		}
	}

	/**
	 * Returns the plugin's version number.
	 *
	 * @return string The plugin's version number.
	 */
	public function getVersion()
	{
		return '1.0.0';
	}

	/**
	 * @return string The plugin's schema version number.
	 */
	public function getSchemaVersion()
	{
		return '1.0.0';
	}

	/**
	 * @return string
	 */
	public function getDeveloper()
	{
		return 'Pixel & Tonic';
	}

	/**
	 * @return string
	 */
	public function getDeveloperUrl()
	{
		return 'http://pixelandtonic.com';
	}

	/**
	 * @inheritDoc IComponentType::getName()
	 *
	 * @return string
	 */
	public function getName()
	{
		return "Commerce Stock Notifier";
	}

	/**
	 * @return string
	 */
	public function getPluginUrl()
	{
		return 'https://github.com/pixelandtonic/CommerceStockNotifier';
	}

	/**
	 * @return string
	 */
	public function getDocumentationUrl()
	{
		return $this->getPluginUrl().'/blob/master/README.md';
	}

	/**
	 * @return string
	 */
	public function getReleaseFeedUrl()
	{
		return 'https://raw.githubusercontent.com/pixelandtonic/CommerceStockNotifier/master/releases.json';
	}

	/**
	 * @inheritDoc IPlugin::getDescription()
	 *
	 * @return string|null
	 */
	public function getDescription()
	{
		return "Notify people when the stock of a Craft Commerce product is below a certain threshold.";
	}

	/**
	 * @inheritDoc IPlugin::hasSettings()
	 *
	 * @return bool Whether the plugin has settings
	 */
	public function hasSettings()
	{
		return true;
	}

	/**
	 * @return mixed
	 */
	public function getSettingsHtml()
	{
		return craft()->templates->render('commercestocknotifier/_settings', [
			'settings' => $this->getSettings()
		]);
	}

	/**
	 * Define Commerce Settings.
	 *
	 * @return array
	 */
	protected function defineSettings()
	{
		return [
			'toEmail'   => AttributeType::String,
			'threshold' => AttributeType::Number
		];
	}

	/**
	 * @inheritDoc IPlugin::hasCpSection()
	 *
	 * @return bool
	 */
	public function hasCpSection()
	{
		return false;
	}

	private function _sendEmail()
	{
		$variants = $this->lowStockVariants;

		if (empty($this->getSettings()->toEmail))
		{
			return;
		}

		// make to emails into array
		$notify = explode(',',str_replace(';', ',', $this->getSettings()->toEmail));
		$to = $notify[0];
		unset($notify[0]);
		$ccEmails = [];
		foreach ($notify as $email)
		{
			$ccEmails[] = ['email' => $email];
		}

		$body = "Hi, this is a notification that the following items stock has fallen below the threshold set to ".$this->getSettings()->threshold.":

";

		/** @var Commerce_VariantModel $variant */
		foreach ($variants as $variant)
		{
			$body .= "SKU: ".$variant->sku."
";
			$body .= "Description: ".$variant->getDescription()."
";
			$body .= "Stock Remaining: ".$variant->stock."
";
			$body .= "Edit Link: ".$variant->getCpEditUrl()."
";
		}

		$body .= "
";

		$email = new EmailModel();
		$email->toEmail = $to;
		$email->body = $email->htmlBody = $body;
		$email->cc = $ccEmails;
		$email->subject = count($variants)." commerce products have dropped below the stock threshold.";

		if (!craft()->email->sendEmail($email))
		{
			$error = Craft::t('Commerce Stock threshold notification could not be sent to {email}. Email Body: {body}',
				['email' => $to, 'body' => $$body]);

			CommerceStockNotifierPlugin::log($error, LogLevel::Error, true);
		}
	}
}


text:
#include "../../AC/Language/PR_text.h"

void load_PR_game_text()
{
    //ERRORS
    game.error_text.title="Erro";
    game.error_text.header_file="File Not Found";
    game.error_text.header_internal="Erro Interno";
    game.error_text.message_interface_options_internal_error="Uma vari\u00E1vel foi corrompido"\
                                                             " em tempo de execu\u00E7\u00E3o.";
    //COMMON
    game.load="Carregando...";
    #ifdef GAME_DEMO
    //DEMO
    game.demo_text.middle_text="Pressione a tecla ENTER para voltar ao jogo";
    #endif // GAME_DEMO
    //TITLE MENU
    game.title_menu.start_game="Pressione a tecla ENTER para iniciar o jogo";
    //MAIN MENU
    game.main_menu.init_game="Iniciar o Jogo";
    game.main_menu.options_game="Op\u00E7\u00F5es de interface";
    game.main_menu.exit_game="Jogo Exit";
    game.main_menu.controls="\u21C5 : Navegar -"\
                            " ESC : Sair -"\
                            " ENTER : Selecionar";
        //INTERFACE OPTIONS MENU
        game.interface_options_menu.title="Op\u00E7\u00F5es de interface";
        game.interface_options_menu.select_display_size="Tamanho da Tela";
            game.interface_options_menu.display_size_1="Tamanho M\u00E1ximo";
        game.interface_options_menu.select_display_type="Tipo da Tela";
            game.interface_options_menu.display_type_1="Full Screen";
            game.interface_options_menu.display_type_2="Janela";
        game.interface_options_menu.set_audio_volume="Volume";
        game.interface_options_menu.select_language="L\u00EDngua";
            game.interface_options_menu.language_EN="Ingl\u00EAs";
            game.interface_options_menu.language_ES="Espanhol";
            game.interface_options_menu.language_PR="Portugu\u00EAs";
        game.interface_options_menu.controls="\u21C5 : Navegar -"\
                                             " \u21C4 : Selecionar -"\
                                             " ESC : Cancelar -"\
                                             " ENTER : Aplicar e em Salvar altera\u00E7\u00F5es";
    load_PR_AC_text();
}

#endif // INCLUDED_PR_GAME_TEXT_H


text:
package org.knowm.xchange.livecoin.service;

import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.junit.Rule;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.livecoin.LivecoinExchange;

/** @author walec51 */
public class BaseMockedIntegrationTest {

  @Rule public WireMockRule wireMockRule = new WireMockRule();

  public Exchange createExchange() {
    Exchange exchange =
        ExchangeFactory.INSTANCE.createExchangeWithoutSpecification(
            LivecoinExchange.class.getName());
    ExchangeSpecification specification = exchange.getDefaultExchangeSpecification();
    specification.setHost("localhost");
    specification.setSslUri("http://localhost:" + wireMockRule.port());
    specification.setPort(wireMockRule.port());
    specification.setShouldLoadRemoteMetaData(false);
    exchange.applySpecification(specification);
    return exchange;
  }
}


text:
@interface ContinousPickerVC ()

@end

@implementation ContinousPickerVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    SCDatePickerView *datePickerView = [[SCDatePickerView alloc] initWithFrame:self.view.bounds style:SCDatePickerViewStyleContinous];
    datePickerView.delegate = self;
    datePickerView.endDate = [NSDate dateWithTimeInterval:((24 * 60 * 60) * 365) sinceDate:[NSDate date]];

    // -- Pre selected date range
    datePickerView.selectedDate = [NSDate date];
    NSDateComponents *comp = [NSDateComponents new];
    comp.month = 1;
    NSDate *preSelectedDate = [[NSCalendar currentCalendar]  dateByAddingComponents:comp toDate:[NSDate date] options:0];
    datePickerView.selectedEndDate = preSelectedDate;
    [[[self.view subviews] objectAtIndex:0] addSubview:datePickerView];
}

- (void)datePickerView:(SCDatePickerView *)datePickerView didSelectDateRangeFrom:(NSDate *)fromDate to:(NSDate *)toDate {
    datePickerView.style = SCDatePickerViewStyleContinous;
}

- (void)datePickerView:(SCDatePickerView *)datePickerView didSelectDate:(NSDate *)date {
    datePickerView.style = SCDatePickerViewStyleContinousWithRangeSelection;
}

@end


text:
  <title>Samling</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="public/css/bootstrap.css" rel="stylesheet">
  <link href="public/css/samling.css" rel="stylesheet">

  <link rel="icon" type="image/png" href="public/images/logos-scorpion-48.png">

      SAMLING Serverless SAML IDP

        SAML Response Properties

        SAML
          Response

        User Details

        IdP Metadata

        What is this?

            <form id="samlProps">

                  <button id="createResponse" type="button" class="btn btn-lg pull-right">Next >
                  </button>

                Name Identifier *
                <input type="text" class="form-control" id="nameIdentifier">

                Assertion Consumer URL (Recipient) *
                <input type="text" class="form-control" id="callbackUrl">

                Name Identifier Format
                <input type="text" class="form-control" id="nameIdentifierFormat"
                       value="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">

                Authentication Context Class Ref
                <input type="text" class="form-control" id="authnContextClassRef"
                       value="urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified">

                In Reponse To
                <input type="text" class="form-control" id="inResponseTo" value="">

                Audience
                <input type="text" class="form-control" id="audience" value="">

                Issuer
                <input type="text" class="form-control" id="issuer" value="https://capriza.github.io/samling/samling.html">

                SAML Status Code
                <input type="text" class="form-control" id="samlStatusCode"
                       value="urn:oasis:names:tc:SAML:2.0:status:Success">

                Assertion Lifetime (seconds)
                <input type="text" class="form-control" id="lifetimeInSeconds" value="600">

                SAML Status Message
                <input type="text" class="form-control" id="samlStatusMessage">

                  SAML Attributes
                  place each attribute on a separate line
                  <textarea class="form-control" rows="3" id="samlAttributes" placeholder="attr1=value1
attr2=value2"></textarea>

                      <input type="checkbox" class="form-check-input" id="signResponse">
                      Sign Response (in addition to the assertion)

                    Signature Private Key *

                  <button id="saveKeyAndCert" type="button" class="btn btn-default btn-xs pull-right">
                    Save
                  </button>
                  <button id="generateKeyAndCert" type="button" class="btn btn-default btn-xs pull-right">
                    New Pair
                  </button>
                  <textarea class="form-control" rows="14" id="signatureKey"
                            style="font-size: 8px; font-family: monospace; resize: none"></textarea>

                  Signature Certificate *
                    <textarea class="form-control" rows="14" id="signatureCert"
                              style="font-size: 8px; font-family: monospace; resize: none"></textarea>

            </form>

Name Identifier

The user name that will appear in the assertion as logged-in.

Assertion Consumer URL

The assertion consumer URL where the SAML Response will be posted back to.

Sign Response

If checked, the SAML response will be signed in addition to the assertion.

Signature Private Key

The private key that will be used to sign the SAML assertion.

Signature Certificate

The Signature certificate to embed into the SAML response to be used by the Service Provider
                  for verifying the signature.

New Pair

Generate a new random private/public key pair.

Save

Save the private key and certificate to the local storage.

Next

Create the SAML Response based on the provided properties.
                  You will be transferred to the SAML Response section.

            <form method="POST" id="samlResponseForm">

                  <button class="btn btn-lg pull-right" type="submit" id="postSAMLResponse">Post Response!
                  </button>

                        Session Duration *
                        <input type="text" class="form-control" id="sessionDuration" value="10">

                        Assertion Consumer URL
                        <input type="text" class="form-control" id="callbackUrlReadOnly">

                        RelayState
                        <input type="text" class="form-control" name="RelayState" id="relayState">

                    SAML Response *

                  <button id="copyResponseToClipboard" type="button" class="btn btn-default btn-xs pull-right"
                          data-toggle="tooltip" title="Copied" data-trigger="manual" data-placement="top">
                    Copy to Clipboard
                  </button>
                  <textarea class="form-control" rows="28" name="SAMLResponse" id="samlResponse"
                            style="font-size: 12px; font-family: monospace; resize: none;overflow: auto"></textarea>

            </form>

SAML Response

This is the saml response the will be posted to the Assertion Consumer URL.

Copy to Clipboard

Copy the SAML response XML to the clipboard.

Session Duration

The session duration in minutes. Specify "0" to create a session based cookie which means
                  that
                  the cookie will expire after closing the browser tab.

Assertion Consumer URL

(readonly) The consumer URL where the SAML Response will be posted.

RelayState

The RelayState parameter that will posted back to the Assertion Consumer URL along with the SAML response.

You have signed in at: You have not signed in yet.

                Logout

The currently logged in user details. A user is considered logged-in if there is a
                cookie present that was previously created in the SAML Response section by clicking on
                Post Response.

Logout

Log the user out, erasing the cookie.

SAMLING IdP Metadata

              Copy Metadata

What is SAMLING

SAMLING is a Serverless (as-in client side only) SAML IdP for the purpose of testing SAML integrations.

It provides complete control over the SAML response properties that will be sent back to the Service Provider, including simulating errors and the session cookie
              duration that tracks the logged-in user.

If there is a SAMLRequest query parameter present, SAMLING will auto populate some of the SAML Response Properties.

Generating a SAML Response requires the use of a private key and certificate for signing the SAML Assertion.
                SAMLING enables to generate a random private/public key and to save them in the local storage so they are used in subsequent SAML responses.

How to Use

Go to the SAML Response Properties section.

Fill in the required properties fields. Required fields are marked with an asterisks (*).

Click on Create Response. You will be be taken the SAML Response section.

Review the SAML Response then click on Post Response.


text:
\input{gnuplot-single}

\begin{document}
\begin{gnuplot}
latex_font=''
@init_options

load 'example.gnuplot'
\end{gnuplot}
\end{document}


text:
using System;
using System.Linq.Expressions;

namespace SimpleLinq
{
    internal sealed class SimpleExecutor
    {
        internal static object Execute(Expression expression, bool isEnumerable)
        {
            throw new NotSupportedException("Can't actually execute!");
        }
    }
}


text:
using System.Threading.Tasks;

namespace Collectively.Services.Remarks.Services
{
    public interface IUserService
    {
        Task CreateIfNotFoundAsync(string userId, string name, string role);
        Task UpdateNameAsync(string userId, string name);
        Task DeleteAsync(string userId);
    }
}


text:
title: IT Lesson 3
layout: post
author: thomas.ellis
permalink: /it-lesson-3/
source-id: 1N1VzkZXnDWVid-yY66J584v1VLudOettCwWmnIWYFMs
published: true
---
**_IT Lesson 3-Virtual Shop Continuation_**

In today's lesson, our normal teacher was absent so he put some work on Google Classroom to get on with. Before I got on trying the new work; there was a few things I had to fix and complete to make sure I was up to date with the work we had already done. The new work was to do with adding discounts but in a quick and easier way by trying to use words. For example, EVERYTHING 20, would be everything at a 20% discount and Twix 30 would be just the twix at a 30% discount! I found this challenging as I couldn't work out to do it! I won't be posting for a few weeks as it is now christmas holidays.

<iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vTDeIs9nYEShC_7KN_UMrJJlwwTnTWEmU6rV7g81CJIXE-rgZzCkH69Tc92uOLxW-I2PmT_vM8qWYoo/pubhtml?widget=true&headers=false"></iframe>


text:
[//]: # (title: Kotlin 1.7.20 的兼容性指南)

_[Keeping the Language Modern](kotlin-evolution.md)_ and _[Comfortable Updates](kotlin-evolution.md)_ are among the fundamental principles in
Kotlin Language Design. The former says that constructs which obstruct language evolution should be removed, and the
latter says that this removal should be well-communicated beforehand to make code migration as smooth as possible.

Usually incompatible changes happen only in feature releases, but this time we have to introduce two such changes
in an incremental release to limit spread of the problems introduced by changes in Kotlin 1.7.

This document summarizes them, providing a reference for migration from Kotlin 1.7.0 and 1.7.10 to Kotlin 1.7.20.

## Basic terms

In this document we introduce several kinds of compatibility:

- _source_: source-incompatible change stops code that used to compile fine (without errors or warnings) from compiling
  anymore
- _binary_: two binary artifacts are said to be binary-compatible if interchanging them doesn't lead to loading or
  linkage errors
- _behavioral_: a change is said to be behavioral-incompatible if the same program demonstrates different behavior
  before and after applying the change

Remember that those definitions are given only for pure Kotlin. Compatibility of Kotlin code from the other languages
perspective
(for example, from Java) is out of the scope of this document.

## Language

<!--
### Title

> **Issue**: [KT-NNNNN](https://youtrack.jetbrains.com/issue/KT-NNNNN)
>
> **Component**: Core language
>
> **Incompatible change type**: source
>
> **Short summary**:
>
> **Deprecation cycle**:
>
> - 1.5.20: warning
> - 1.7.0: report an error
-->

### Rollback attempt to fix proper constraints processing

> **Issue**: [KT-53813](https://youtrack.jetbrains.com/issue/KT-53813)
>
> **Component**: Core language
>
> **Incompatible change type**: source
>
> **Short summary**: Rollback an attempt of fixing issues in type inference constraints processing appeared in 1.7.0
> after implementing the change described in [KT-52668](https://youtrack.jetbrains.com/issue/KT-52668).
> The attempt was made in 1.7.10, but it in turn introduced new problems.
>
> **Deprecation cycle**:
>
> - 1.7.20: Rollback to 1.7.0 behavior

### Forbid some builder inference cases to avoid problematic interaction with multiple lambdas and resolution

> **Issue**: [KT-53797](https://youtrack.jetbrains.com/issue/KT-53797)
>
> **Component**: Core language
>
> **Incompatible change type**: source
>
> **Short summary**: Kotlin 1.7 introduced a feature called unrestricted builder inference, so that even the lambdas passed
> to parameters not annotated with `@BuilderInference` could benefit from the builder inference.
> However, that could cause several problems if more than one such lambda occurred in a function invocation.
>
> Kotlin 1.7.20 will report an error if more than one lambda function having
> the corresponding parameter not annotated with `@BuilderInference` requires using builder inference
> to complete inferring the types in the lambda.
>
> **Deprecation cycle**:
>
> - 1.7.20: report an error on such lambda functions,
> `-XXLanguage:+NoBuilderInferenceWithoutAnnotationRestriction` can be used to temporarily revert to the pre-1.7.20 behavior


text:
package io.hekate.network.netty;

interface NettySpy {
    void onBeforeFlush(Object msg) throws Exception;
}


text:
@implementation IFBKCFModel

+ (NSDictionary *)apiMappingHash {
    return @{};
}

+ (instancetype)modelWithDictionary:(NSDictionary *)dictionary {
    return [[self alloc] initWithDictionary:dictionary];
}

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
    self = [super init];
    if (!self) return nil;

    for (NSString *key in [dictionary allKeys]) {
        if ([[self class] apiMappingHash][key]) {
            id value = dictionary[key];// == (id)[NSNull null] ? nil : dictionary[key];
            [self setValue:value forKeyPath:[[self class] apiMappingHash][key]];
        }
    }
    return self;
}

@end


text:
<?php
namespace org\bovigo\vfs\examples\part01;
use PHPUnit\Framework\TestCase;

class FileSystemCacheWithoutVfsStreamTest extends TestCase
{
    /**
     * ensure that the directory and file are not present from previous run
     */
    private function clean() {
        if (file_exists(__DIR__ . '/cache/example')) {
            unlink(__DIR__ . '/cache/example');
        }

        if (file_exists(__DIR__ . '/cache')) {
            rmdir(__DIR__ . '/cache');
        }
    }

    public function setUp(): void {
        $this->clean();
    }

    public function tearDown(): void {
        $this->clean();
    }

    /**
     * @test
     */
    public function createsDirectoryIfNotExists() {
        $cache = new FileSystemCache(__DIR__ . '/cache');
        $cache->store('example', ['bar' => 303]);
        $this->assertFileExists(__DIR__ . '/cache');
    }

    /**
     * @test
     */
    public function storesDataInFile() {
        $cache = new FileSystemCache(__DIR__ . '/cache');
        $cache->store('example', ['bar' => 303]);
        $this->assertEquals(
                ['bar' => 303],
                unserialize(file_get_contents(__DIR__ . '/cache/example'))
        );
    }
}


text:
if (+$('#banner-text').outerHeight(true) < 100) {
    var jumpScrollActivated = 0;
} else {
    var jumpScrollActivated = 1;
}

$(document).ready(function () {
    $('.parallax').parallax();
});

$(document).ready(function () {
    // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
    $('.modal-trigger').leanModal();
});

// Header image
$(document).ready(function () {
    function setHeight() {
        windowHeight = $(window).innerHeight();
        $('#index-banner').css('min-height', windowHeight);
    }
    setHeight();

    $(window).resize(function () {
        setHeight();
    });
});

function scrollGo(id) {
    // Remove "link" from the ID
    id = id.replace("link", "");
    // Scroll
    $('html,body').animate({
        scrollTop: $("#" + id).offset().top
    }, 'slow');
}

//Fade in header on scroll
$(window).scroll(function () {
    var scrollPos = $(window).scrollTop();
    var windowHeight = $(window).innerHeight();
    var backgroundAlpha;

    if (backgroundAlpha !== 1) {
        var percentage = scrollPos / $(window).height();
        //Increase alpha of bg
        percentage = scrollPos / ($(window).height() - $("#desktop-nav-about").height());
        $("#desktop-nav-about").css('background', 'rgba(255, 255, 255,' + percentage + ')');

        if (percentage >= 1) {
            $("#desktop-nav-about").addClass("z-depth-1");
        } else {
            $("#desktop-nav-about").removeClass("z-depth-1");
        }
        if (scrollPos < 101) {
            $("#desktop-nav-about").css('background', 'rgba(255, 255, 255,0)');
        }
    }

    //Find the bottom of header banner div
    var bannerBottom = $('#index-banner').position().top + $('#index-banner').outerHeight(true);

    //Set position at which to fade out scroll down button
    bannerBottom = 0.75 * bannerBottom;
    //Fade out banner scroll button upon being passed
    if (scrollPos > bannerBottom) {
        $("#download-button").fadeOut(200);
    } else {
        $("#download-button").fadeIn(200);
    }

    //Find the bottom of header banner div and take away 20%
    var whoAmIBottom = $('#who-am-i-container').position().top + $('#who-am-i-container').outerHeight(true);
    whoAmIBottom = 0.75 * whoAmIBottom;
    //Fade out banner scroll button upon being passed
    if (scrollPos > whoAmIBottom) {
        $("#programming-jumper").fadeOut(300);
    } else {
        $("#programming-jumper").fadeIn("fast");
    }

});


text:
from server_process_base import BaseXmlRpcProcess
import subprocess

SERVICE_NAME = 'xml_rpc_server'

def service_installed():
    exit_code = subprocess.call(['supervisorctl',SERVICE_NAME,'status' ])
    return exit_code == 0

class XmlRpcProcess(BaseXmlRpcProcess):

    def is_running(self):
        running = False
        cmd = 'supervisorctl status {}'.format(SERVICE_NAME)
        output = subprocess.check_output(cmd.split())
        for line in output.splitlines():
            line = line.strip()
            tmp = line.split()
            if tmp:
                if tmp[0] == 'STATE':
                     running = True if tmp[-1] == 'RUNNING' else False
        return running

    def start(self):
        if self.is_running():
            self.logger.warning('service already running')
            return False

        cmd = 'supervisorctl start {}'.format(SERVICE_NAME)
        exit_code = subprocess.call(cmd.split())
        if exit_code == 0:
            self.logger.info('server is running')
        else:
            self.logger.error('unable to run server')
        return exit_code == 0

    def stop(self):
        if not self.is_running():
            self.logger.warning('service already stopped')
            return False

        cmd = 'supervisorctl start {}'.format(SERVICE_NAME)
        exit_code = subprocess.call(cmd.split())
        if exit_code == 0:
            self.logger.info('server was stopped')
        else:
            self.logger.warning('unable stop server')
        return exit_code == 0

    def restart(self):
        cmd = 'supervisorctl restart {}'.format(SERVICE_NAME)
        exit_code = subprocess.call(cmd.split())
        if exit_code == 0:
            self.logger.info('server was stopped')
        else:
            self.logger.warning('unable stop server')
        return exit_code == 0


text:
//
//  SettingsViewController.m
//  CycleTracker
//
//  Created by Phillip Sime on 11/7/14.
//  Copyright (c) 2014 Phil Sime. All rights reserved.
//

#import "SettingsViewController.h"

@interface SettingsViewController ()

@property (strong, nonatomic) IBOutlet UITextField *nameTextField;
@property (strong, nonatomic) IBOutlet UITextField *weightTextField;
@property (strong, nonatomic) IBOutlet UISwitch *workoutSaveToggle;

@end

@implementation SettingsViewController

- (IBAction)nameModified:(id)sender {
    [_appDictionary setObject:_nameTextField.text forKey:@"NameOfUser"];
}

- (IBAction)weightModified:(id)sender {
    NSNumberFormatter *f = [[NSNumberFormatter alloc] init];
    [f setNumberStyle:NSNumberFormatterDecimalStyle];
    NSNumber *weight = [f numberFromString:_weightTextField.text];
    [_appDictionary setObject:weight forKey:@"WeightOfUser"];
}

- (IBAction)saveWorkoutModified:(id)sender {
    NSNumber *n = [NSNumber numberWithBool:_workoutSaveToggle.on];
    [_appDictionary setObject:n forKey:@"WorkoutToggleStatus"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"hill.png"]]];

    // Set values if already set in app dictionary
    if ([_appDictionary objectForKey:@"NameOfUser"]) {
        _nameTextField.text = [_appDictionary objectForKey:@"NameOfUser"];
    }

    if ([_appDictionary objectForKey:@"WeightOfUser"]) {
        NSNumber *weight = [_appDictionary objectForKey:@"WeightOfUser"];
        _weightTextField.text = [NSString stringWithFormat:@"%@", weight];
    }

    if ([_appDictionary objectForKey:@"WorkoutToggleStatus"]) {
        NSNumber *n = [_appDictionary objectForKey:@"WorkoutToggleStatus"];
        [_workoutSaveToggle setOn:[n boolValue]];
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
module Cryptoexchange::Exchanges
  module Chainex
    module Services
      class Trades < Cryptoexchange::Services::Market
        def fetch(market_pair)
          output = super(ticker_url(market_pair))
          adapt(output, market_pair)
        end

        def ticker_url(market_pair)
          "#{Cryptoexchange::Exchanges::Chainex::Market::API_URL}/market/trades/#{market_pair.base}/#{market_pair.target}/200"
        end

        def adapt(output, market_pair)
          output['data'].collect do |trade|
            tr = Cryptoexchange::Models::Trade.new
            tr.trade_id  = nil
            tr.base      = market_pair.base
            tr.target    = market_pair.target
            tr.market    = Chainex::Market::NAME
            tr.type      = trade['type'].downcase
            tr.price     = trade['price']
            tr.amount    = trade['amount']
            tr.timestamp = trade['time'].to_i.floor
            tr.payload   = trade
            tr
          end
        end
      end
    end
  end
end


text:
package com.addhen.android.raiburari.sample.app.data.repository.datasource;

import com.addhen.android.raiburari.sample.app.data.entity.UserEntity;
import io.reactivex.Observable;
import java.util.List;

/**
 * @author Henry Addo
 */
public interface UserDataSource {

  /**
   * Get an {@link Observable} which will emit a List of {@link UserEntity}.
   */
  Observable<List<UserEntity>> getUserEntityList();

  /**
   * Get an {@link Observable} which will emit a {@link UserEntity} by its id.
   *
   * @param userId The id to retrieve user data.
   */
  Observable<UserEntity> getUserEntityDetails(Long userId);
}


text:
package noo.promise;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * @author Tal Shani
 */
class ImmediateCorePostMessageIframeImpl extends ImmediateCorePostMessageBase {

    private static native JavaScriptObject getWindow() /*-{
        var iframe = $doc.createElement('iframe');
        iframe.src = "javascript:void 0;";
        $doc.body.appendChild(iframe)
        return iframe.contentWindow;
    }-*/;

    ImmediateCorePostMessageIframeImpl() {
        super(getWindow());
    }

    @Override
    String getImplementationName() {
        return super.getImplementationName() + ":iframe";
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.com-->
<!--
  ~ Copyright 2013-2015 The GDG Frisbee Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ 	http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<resources>
  <string name="news">Novinky</string>
  <string name="drawer_open">Otvoriť zásuvku</string>
  <string name="drawer_close">Zatvoriť zásuvku</string>
  <string name="info">Info</string>
  <string name="events">Udalosti</string>
  <string name="add_to_calendar">Pridať do kalendára</string>
  <string name="share_with_googleplus">Zdieľať na Google+</string>
  <string name="no_scheduled_events">Žiadne udalosti\najbližších 30 dní</string>
  <string name="organizers">Organizátori</string>
  <string name="resources">Odkazy</string>
  <string name="fetch_events_failed">Nebolo možné načítať nadchádzajúce eventy</string>
  <string name="fetch_chapters_failed">Nebolo možné načítať zoznam skupín</string>
  <string name="bogus_organizer">Nebolo možné načítať organizátora Id: %1$s</string>
  <string name="cached_content">Ste offline, zobrazuje sa nacachovaný obsah.</string>
  <string name="offline_alert">Ste offline.</string>
  <string name="welcome">Vitajte.</string>
  <string name="choose_home_gdg">Vyberte svoje domáce GDG</string>
  <string name="signin_with_google">Prihláste sa na Google účet</string>
  <string name="confirm">Potvrdiť</string>
  <string name="signin_description">GDG aplikácia využíva Google+ a iné služby Google. Pre ich používanie sa musíte prihlásiť do svojho účtu.</string>
  <string name="or">alebo</string>
  <string name="skip">Preskočiť prihlásenie</string>
  <string name="youtube_init_failed">YouTube Player nemohol byť načítaný.</string>
  <string name="achievements">Achievementy</string>
  <string name="settings">Nastavenia</string>
  <string name="about">O nás</string>
  <plurals name="seconds_ago">
    <item quantity="one">nedávno</item>
    <item quantity="few">pred %d sekundami</item>
    <item quantity="other">%d seconds ago</item>
  </plurals>
  <plurals name="minutes_ago">
    <item quantity="one">pred 1 minútou</item>
    <item quantity="few">pred %d minútami</item>
    <item quantity="other">%d minutes ago</item>
  </plurals>
  <plurals name="hours_ago">
    <item quantity="one">pred 1 hodinou</item>
    <item quantity="few">pred %d hodinami</item>
    <item quantity="other">%d hours ago</item>
  </plurals>
  <plurals name="days_ago">
    <item quantity="one">pred 1 dňom</item>
    <item quantity="few">pred %d dňami</item>
    <item quantity="other">%d days ago</item>
  </plurals>
  <string name="contributors">GDG aplikácia je komunitný projekt a je open source. Tímto ľudom vďačíme za jej funkčnosť:</string>
  <string name="get_involved">Zapoj sa!</string>
  <string name="get_involved_text">GDG aplikácia je komunitný projekt a je open source. Každý môže prispieť do jej vývoja. \n\nChoď na GitHub a sťahuj kód. \n\nhttps://github.com/gdg-x</string>
  <string name="about_license">© 2013 The GDG Frisbee Project\nAll Rights reserved.\n\nLicencované pod\n Apache 2.0 License</string>
  <string name="past_event">UPLYNULÝ</string>
  <string name="upcoming_widget">GDG - nadchadzajúce udalosti</string>
  <string name="global">Globálne</string>
  <string name="pulse">GDG Pulse</string>
  <string name="pulse_events">Udalosti</string>
  <string name="pulse_attendees">Účastníci</string>
  <string name="pulse_circlers">Circlers</string>
  <string name="home_gdg">Domáca GDG</string>
  <string name="home_gdg_summary">Vyberte svoju domácu GDG</string>
  <string name="analytics">Analytics</string>
  <string name="analytics_summary_on">Aplikácia posiela anonymné dáta pre zlepšenie jej vývoja</string>
  <string name="analytics_summary_off">Aplikácia neposiela žiadne anonymné dáta.</string>
  <string name="gcm">Cloudové notifikácie</string>
  <string name="gcm_summary_on">Aplikácia prijíma GDG Cloudové notifikácie</string>
  <string name="gcm_summary_off">Aplikácia neprijíma GDG Cloudové notifikácie</string>
  <string name="google_signed_in">Prihlásený cez Google+ účet</string>
  <string name="google_signed_in_on">Aktuálne ste prihlásený cez Google+ účet</string>
  <string name="google_signed_in_off">Nieste prihlásený</string>
  <string name="achievements_need_signin">Musíte sa prihlásiť na používanie achievmentov.</string>
  <string name="done">Hotovo</string>
  <string name="allow_analytics">Povoľe aplikácii zasielať anonýmmne dáta používania pre zlepšienie aplikácie</string>
  <string name="enable_gcm">Zapnite GDG cloudové notifikácie (dostávajte notifikácie o nových udalostiach)</string>
  <string name="step3_text">Jedna vec pred tým než začneme…</string>
  <string name="share_on_gplus">Pozvite priateľov</string>
  <string name="join_me">Pridajte sa na tento event</string>
  <string name="name_not_known">Meno neznáme</string>
  <string name="originally_shared">originálne zdieľané:</string>
  <string name="server_error">An error occurred. Try again.</string>
  <string name="search_hint">Search GDG Chapter</string>
  <string name="dashclock_description">Display information about the next upcoming event at your Home GDG</string>
  <string name="order_by_date">Sort by date</string>
  <string name="order_by_distance">Sort by distance</string>
  <string name="gcm_event_ticker">A new event at your home GDG has been scheduled.</string>
  <string name="ioextended_description">Google I/O Extended is about joining the Google conference at your local group.</string>
  <string name="devfest_description">GDG DevFests are large, community-run events that can offer speaker sessions across multiple product areas, all-day hack-a-thons, code labs, and more.\n\nEach GDG DevFest will be inspired by and uniquely tailored to the needs of the developer community that hosts it. While no two events will be exactly alike, each GDG DevFest will, at its core, be powered by a shared belief that when developers come together to exchange ideas, amazing things can happen.</string>
  <string name="studyjams_description">Google Developers Study Jams is a free series of global, community–run, in–person study groups. The first Study Jams series is presented in partnership with Udacity and will follow their Android Fundamentals curriculum. Google Developer Group facilitators certified in the course will lead the Study Jams that meet once weekly for 8 – 9 weeks.</string>
  <string name="wtm_description">Women Techmakers is Google\'s global program and brand for women in technology. Kicked off in 2012 by then VP of Google[x] Megan Smith, Women Techmakers is now led by Women in Technology Advocate Natalie Villalobos and a global team of Googlers who are passionate about empowering women in technology through increased visibility, community, and resources.\n\nEach of our summits and meetups will be catered to local communities of women in technology. Summits and meetups around the world may feature hands-on coding workshops, inspiring speakers, and networking opportunities.\n\nAll events will occur within the month of March.</string>
  <string name="media_route_menu_title">Cast session</string>
  <string name="navigate_to">Navigate to event</string>
  <string name="gde">Google Developer Experts</string>
  <string name="fetch_gde_failed">Could not fetch GDE Directory…</string>
  <string name="gde_who_title">Who are Google Developer Experts?</string>
  <string name="gde_who_desc">Google Developer Experts (GDEs) are experts in one or more Google developer technologies. The GDE program recognizes the exemplary work done by these rock stars for the Google Developers worldwide by inviting them to be part of the growing GDE community. GDEs are gurus, mentors and friends; they are developers just like you.\n\nGoogle Developers Experts speak in local and global events, have a strong online presence and an excellent technical background in their field. These independent developers bring their real-world experience and knowledge working with Google technologies to developer communities worldwide.</string>
  <string name="gde_what_title">What kind of activities do GDEs do?</string>
  <string name="gde_what_desc">GDEs write code and launch apps; they open source as much as possible of the code they write to benefit other developers. They have written and continue to write blog posts, articles, documentation, books, etc. about development on the Google platform.\n\nThey also translate existing documentation into other languages to benefit local developers. GDEs have high reps on forums like Stack Overflow and are top contributors on product mailing lists.\n\nThey speak at developer conferences, organize and lead GDGs, and conduct hackathons. GDEs can be nominated for the program for doing one or more types of activities for a product. Once they are accepted as a GDE, they are expected to continue contributing in any of the ways listed above.</string>
  <string name="arrow_oops">Uh oh, something went wrong. Please try again.</string>
  <string name="arrow_stale">Uh oh, that code has expired. Try again.</string>
  <string name="arrow_scan">Ready to Scan!\nGo find a GDG Organizer\nand ask nicely if you may \"tag\" him/her</string>
  <string name="arrow_organizer">Hey, it seems you are a GDG Organizer. Switch to Send Mode here if you want to allow someone to \"tag\" you.</string>
  <string name="arrow_send_mode">Send Mode</string>
  <string name="arrow_tag_here">Touch NFC phones and tap to fire off the arrow!</string>
  <string name="arrow_back_receive">Back to Tag Mode</string>
  <string name="arrow_already_tagged">Shoot! You already tagged this Organizer!</string>
  <string name="arrow">Arrow</string>
  <string name="arrow_need_games">You need to be logged in to play GDG Arrow</string>
  <string name="arrow_selfie">You really can not tag yourself. Sorry ;)</string>
  <string name="arrow_leaderboard">Best of Arrow</string>
  <string name="no_nfc_use_qr_scanner">No NFC detected, use QR scanner!</string>
  <string name="event_description">Description</string>
  <string name="event">Event</string>
  <string name="no_description_available"><![CDATA[<i>No description available.</i>]]></string>
  <string name="starting_at">Starting at %1$s</string>
  <string name="loading_data_failed">Couldn\'t load event list..</string>
  <string name="share">Share</string>
  <string name="open_event_site">View event page</string>
  <string name="arrow_tagged">Your tagged Organizers</string>
  <string name="get_involved_translation_text">If you like to contribute to the localization of the app, i.e. translate to a new language or improve existing ones, please goto the crowdin page at\n\nhttps://crowdin.com/project/gdgx-frisbee</string>
  <string name="about_about">O nás</string>
  <string name="about_contributors">Contributors</string>
  <string name="about_translators">Translators</string>
  <string name="about_changelog">Changelog</string>
  <string name="about_get_involved">Get Involved</string>
  <string name="about_third_party_libraries">3rd Party Libraries</string>
  <string name="event_info">Info</string>
  <string name="event_agenda">Agenda</string>
  <string name="event_more">More</string>
  <string name="help">Help</string>
  <string name="feedback">Feedback</string>
  <string name="feedback_cancel">Cancel</string>
  <string name="feedback_email_hint">Your email address</string>
  <string name="feedback_message_hint">What\'s on your mind?</string>
  <string name="feedback_send">Send</string>
  <string name="feedback_sending">Sending…</string>
  <string name="for_leads">For Leads</string>
  <string name="leads_welcome_title">Welcome</string>
  <string name="leads_welcome">As a GDG lead, you have access to these organizer-only resources!</string>
  <string name="leads_resources_title">GDG Resources</string>
  <string name="leads_resources">You can find important GDG Resources in this Google Drive folder. Tap to browse slide decks, guides, graphics, code labs, and more.</string>
  <string name="leads_wisdom_title">GDG Wisdom GitBook</string>
  <string name="leads_wisdom">This GitBook contains a wealth of general information about running a GDG chapter. Please edit pages and contribute to this global effort. Tap to open this GitBook.</string>
  <string name="leads_gplus_community_title">GDG Organizer Creative Sandbox</string>
  <string name="leads_gplus_community">This global G+ community is about sharing experiences and knowledge related to running a GDG chapter. Tap to join the conversation!</string>
  <string name="message">Message</string>
  <string name="resource">Resource</string>
  <string name="cd_navdrawer_image">Navigation Drawer Chapter Image</string>
  <string name="cd_navdrawer_user_picture">User Profile Image</string>
  <string name="title_signing_needed">Sign-in Needed</string>
  <string name="signin">Sign-in</string>
  <string name="feedback_message_required">Message required</string>
  <string name="feedback_invalid_email">Input valid email address</string>
  <string name="drawer_subheader_games">Games</string>
  <string name="fork_me">Fork me</string>
  <string name="cd_arrowTagImage">Arrow Tagging Game</string>
  <string name="cd_qrCode">QR Code</string>
</resources>


text:
require 'pp'
require 'json'
require 'rest_client'
require 'capybara'

class Request
  def self.get(url)
    request(RestClient.method(:get), url, :accept => :json)
  end

  def self.post(url, params, ctype = :json)
    request(RestClient.method(:post), url, params, :content_type => ctype, :accept => :json)
  end

  def self.put(url, params, ctype = :json)
    request(RestClient.method(:put), url, params, :content_type => ctype, :accept => :json)
  end

  def self.delete(url)
    request(RestClient.method(:delete), url)
  end

  def self.request(mthd, url, *args)
    res = {}

    begin
      mthd.call(url, *args) do |response, request, result|
        if not response.empty?
          res[:response] = JSON.parse(response)
        else
          res[:response] = nil
        end
        res[:result] = result
        res[:code] = result.code
        res[:headers] = response.headers
      end
    rescue
      puts "ERROR?!?"
      pp $!
    end

    res
  end
end

def path2id(url)
  url.split('/').last.to_i
end

def res2id(res)
  path2id(res[:headers][:location])
end

def random_postfix(txt)
  txt + rand(10000).to_s
end

class Capybara::Node::Element
  def drag_by(x, y)
    wait_until {
      session.driver.browser.action.drag_and_drop_by(native, x, y).perform
    }
  end
end

class Filter
  attr_accessor :slider, :handle

  def initialize(slider)
    @slider = slider
    @handle = @slider.find('.ui-slider-handle')
    @step = 20
    @width = @slider.native.style('width').slice(0...-2).to_i
  end

  def handle_position
    @handle.native.style('left').slice(0...-2).to_i
  end

  def reset
    while handle_position > 0
      pos = handle_position
      step = @step

      if pos - step < 0
        step = pos
      end

      @handle.drag_by(-step, 0)
    end
  end

  def set_to(str)
    browser = @handle.session.driver.browser
    browser.action.click_and_hold(@handle.native).perform
    begin
      using_wait_time(0.1) do
        until @slider.has_content? str
          original_pos = handle_position
          offset = 2
          while original_pos == handle_position
            browser.action.move_by(offset, 0).perform
            offset += 1
          end
        end
      end
    ensure
      browser.action.release.perform
    end
  end
end

class Filters
  def initialize(session)
    @session = session
  end

  def reset_all
    @session.all('.sla-providers-filters .slider').each do |slider|
      Filter.new(slider).reset
    end
  end

  def filter(name)
    selector = ".sla-providers-filters .slider:contains(\"#{name}\")"
    el = @session.find(selector)
    Filter.new(el)
  end
end


text:
import bottle

#this is the handler for the root address on the web browser
@bottle.route('/')
def home_page():
  mythings = ['apple', 'orange', 'banana', 'peach']
 #return bottle.template('hello_world2', username='Andrew', things=mythings)
  return bottle.template('hello_world2', {'username':'Richard',
                                         'things':mythings})
@bottle.post('/favorite_fruit')
def favorite_fruit():
  fruit = bottle.request.forms.get('fruit')
  if fruit == None or fruit == '':
    fruit = 'No Fruit Selected'
  return bottle.template('fruit_selection', {'fruit':fruit})

bottle.debug(True)
bottle.run(host='localhost', port = 8080)