text:
require 'gh'
require 'faraday'

module GH
  # Public: This class deals with HTTP requests to Github. It is the base Wrapper you always want to use.
  # Note that it is usually used implicitely by other wrapper classes if not specified.
  class Remote < Wrapper
    attr_reader :api_host, :connection, :headers, :prefix

    # Public: Generates a new Rempte instance.
    #
    # api_host - HTTP host to send requests to, has to include schema (https or http)
    # options  - Hash with configuration options:
    #            :token    - OAuth token to use (optional).
    #            :username - Github user used for login (optional).
    #            :password - Github password used for login (optional).
    #            :origin   - Value of the origin request header (optional).
    #            :headers  - HTTP headers to be send on every request (optional).
    #            :adapter  - HTTP library to use for making requests (optional, default: :net_http)
    #
    # It is highly recommended to set origin, but not to set headers.
    # If you set the username, you should also set the password.
    def setup(api_host, options)
      token, username, password = options.values_at :token, :username, :password

      api_host  = api_host.api_host if api_host.respond_to? :api_host
      @api_host = Addressable::URI.parse(api_host)
      @headers  = {
        "User-Agent"      => options[:user_agent] || "GH/#{GH::VERSION}",
        "Accept"          => options[:accept] || "application/vnd.github.v3+json",
        "Accept-Charset"  => "utf-8",
      }

      @headers.merge! options[:headers] if options[:headers]
      @headers['Origin'] = options[:origin] if options[:origin]

      @prefix = ""
      @prefix << "#{token}@" if token
      @prefix << "#{username}:#{password}@" if username and password
      @prefix << @api_host.host

      faraday_options = {:url => api_host}
      faraday_options[:ssl] = options[:ssl] if options[:ssl]
      faraday_options.merge! options[:faraday_options] if options[:faraday_options]

      @connection = Faraday.new(faraday_options) do |builder|
        builder.request(:authorization, :token, token) if token
        builder.request(:basic_auth, username, password)  if username and password
        builder.request(:retry)
        builder.response(:raise_error)
        #builder.use(options[:adapter] || GH::FaradayAdapter)
        builder.adapter(:net_http)
      end
    end

    # Public: ...
    def inspect
      "#<#{self.class}: #{api_host}>"
    end

    # Internal: ...
    def fetch_resource(key)
      frontend.http(:get, frontend.path_for(key), headers)
    end

    # Internal: ...
    def generate_response(key, response)
      body, headers = response.body, response.headers
      url = response.env[:url]     if response.respond_to? :env and response.env
      url = response.url           if response.respond_to?(:url)
      url = frontend.full_url(key) if url.to_s.empty?
      modify(body, headers, url)
    end

    # Internal: ...
    def http(verb, url, headers = {}, &block)
      connection.run_request(verb, url, nil, headers, &block)
    rescue Exception => error
      raise Error.new(error, nil, :verb => verb, :url => url, :headers => headers)
    end

    # Internal: ...
    def request(verb, key, body = nil)
      response = frontend.http(verb, path_for(key), headers) do |req|
        req.body = Response.new(body).to_s if body
      end
      frontend.generate_response(key, response)
    rescue GH::Error => error
      error.info[:payload] = Response.new(body).to_s if body
      raise error
    end

    # Public: ...
    def post(key, body)
      frontend.request(:post, key, body)
    end

    # Public: ...
    def delete(key)
      frontend.request(:delete, key)
    end

    # Public: ...
    def head(key)
      frontend.request(:head, key)
    end

    # Public: ...
    def patch(key, body)
      frontend.request(:patch, key, body)
    end

    # Public: ...
    def put(key, body)
      frontend.request(:put, key, body)
    end

    # Public: ...
    def reset
    end

    # Public: ...
    def load(data)
      modify(data)
    end

    # Public: ...
    def in_parallel
      raise RuntimeError, "use GH::Parallel middleware for #in_parallel support"
    end

    def full_url(key)
      uri      = Addressable::URI.parse(key)
      uri.path = File.join(api_host.path, uri.path) unless uri.absolute? or uri.path.start_with?(api_host.path)
      uri      = api_host + uri
      raise ArgumentError, "URI out of scope: #{key}" if uri.host != api_host.host
      uri
    end

    def path_for(key)
      frontend.full_url(key).request_uri
    end

    private

    def identifier(key)
      path_for(key)
    end

    def modify(body, headers = {}, url = nil)
      return body if body.is_a? Response
      Response.new(body, headers, url)
    end
  end
end


text:
/*
 * File:   file_source_test.cpp
 * Author: alex
 *
 * Created on February 6, 2017, 3:11 PM
 */

#include "staticlib/tinydir/file_source.hpp"

#include <cstring>
#include <iostream>

#include "staticlib/config.hpp"

#include "staticlib/config/assert.hpp"

void test_desc() {
    sl::tinydir::file_source desc{"CMakeCache.txt"};
}

void test_desc_fail() {
    bool catched = false;
    try {
        sl::tinydir::file_source desc{"aaa"};
    } catch (const sl::tinydir::tinydir_exception&) {
        catched = true;
    }
    slassert(catched);
}

void test_read() {
    sl::tinydir::file_source desc{"CMakeCache.txt"};
    desc.seek(16);
    std::array<char, 12> buf;
    desc.read(buf);
    std::string res{buf.data(), buf.size()};
    slassert(res == "akeCache fil");
}

void test_accessors() {
    sl::tinydir::file_source file{"CMakeCache.txt"};
    (void) file;
    slassert("CMakeCache.txt" == file.path());
}

int main() {
    try {
        test_desc();
        test_desc_fail();
        test_read();
        test_accessors();
    } catch (const std::exception& e) {
        std::cout << e.what() << std::endl;
        return 1;
    }
    return 0;
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema">
  <!-- XSchema deffinition for Percent -->
  <element name="Percent" />
</schema>


text:
namespace renderer
{

} // namespace renderer


text:
Change Log
==========

All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning`_ starting with version 0.2.0.

[Unreleased] - `master`_
^^^^^^^^^^^^^^^^^^^^^^^^

.. note:: This version is not yet released and is under active development.

Added
-----

Changed
-------

Removed
-------

Fixed
-----

[0.7.1] - 2017-10-06
^^^^^^^^^^^^^^^^^^^^

Fixed
-----
- issues with restart events. They created wrong a messed up history leading to
  wrong predictions

[0.7.0] - 2017-10-04
^^^^^^^^^^^^^^^^^^^^

Added
-----
- support for Rasa Core usage as a server with remote action execution

Changed
-------
- switched to max code line length 80
- removed action id - use ``action.name()`` instead. if an action implementation overrides the name, it should include the ``action_`` prefix (as it is not automatically added anymore)
- renamed ``rasa_dm.util`` to ``rasa_dm.utils``
- renamed the whole package to ``rasa_core`` (so ``rasa_dm`` is gone!)
- renamed ``Reminder`` attribute ``id`` to ``name``
- a lot of documentation improvements. docs are now at https://core.rasa.ai
- use hashing when writing memorized turns into persistence - requires retraining of all models that are trained with a version prior to this
- changed ``agent.handle_message(...)`` interface for easier usage

[0.6.0] - 2017-08-27
^^^^^^^^^^^^^^^^^^^^

Added
-----
- support for multiple policies (e.g. one memoization and a Keras policy at the same time)
- loading domains from yaml files instead of defining them with python code
- added an api layer (called ``Agent``) for you to use for 95% of the things you want to do (training, persistence, loading models)
- support for reminders

Changed
-------
- large refactoring of code base

[0.5.0] - 2017-06-18
^^^^^^^^^^^^^^^^^^^^

Added
-----
- ``ScoringPolicy`` added to policy implementations (less strict than standard default policy)
- ``RasaNLUInterpreter`` to run a nlu instance within dm (instead of using the http interface)
- more tests

Changed
-------
- ``UserUtterance`` now holds the complete parse data from nlu (e.g. to access attributes other than entities or intent)
- ``Turn`` has a reference to a ``UserUtterance`` instead of directly storing intent & entities (allows access to other data)
- Simplified interface of output channels
- order of actions in the DefaultPolicy in ``possible_actions`` (``ActionListen`` now always has index 0)

Fixed
-----
- ``RedisTrackerStore`` checks if tracker is stored before accessing it (otherwise a ``None`` access exception is thrown)
- ``RegexInterpreter`` checks if the regex actually matches the message instead of assuming it always does
- ``str`` implementation for all events
- ``Controller`` can be started without an input channel (e.g. messages need to be fed into the queue manually)

[0.2.0] - 2017-05-18
^^^^^^^^^^^^^^^^^^^^
First released version.

.. _`master`: https://github.com/RasaHQ/rasa_core/

.. _`Semantic Versioning`: http://semver.org/


text:
require 'benchmark'

module ActiveSupport
  module Cache
    def self.lookup_store(*store_option)
      store, *parameters = *([ store_option ].flatten)

      case store
      when Symbol
        store_class_name = (store == :drb_store ? "DRbStore" : store.to_s.camelize)
        store_class = ActiveSupport::Cache.const_get(store_class_name)
        store_class.new(*parameters)
      when nil
        ActiveSupport::Cache::MemoryStore.new
      else
        store
      end
    end

    def self.expand_cache_key(key, namespace = nil)
      expanded_cache_key = namespace ? "#{namespace}/" : ""

      if ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]
        expanded_cache_key << "#{ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"]}/"
      end

      expanded_cache_key << case
      when key.respond_to?(:cache_key)
        key.cache_key
      when key.is_a?(Array)
        key.collect { |element| expand_cache_key(element) }.to_param
      when key.respond_to?(:to_param)
        key.to_param
      end

      expanded_cache_key
    end

    class Store
      cattr_accessor :logger

      def initialize
      end

      def threadsafe!
        @mutex = Mutex.new
        self.class.send :include, ThreadSafety
        self
      end

      # Pass <tt>:force => true</tt> to force a cache miss.
      def fetch(key, options = {})
        @logger_off = true
        if !options[:force] && value = read(key, options)
          @logger_off = false
          log("hit", key, options)
          value
        elsif block_given?
          @logger_off = false
          log("miss", key, options)

          value = nil
          seconds = Benchmark.realtime { value = yield }

          @logger_off = true
          write(key, value, options)
          @logger_off = false

          log("write (will save #{'%.5f' % seconds})", key, nil)

          value
        end
      end

      def read(key, options = nil)
        log("read", key, options)
      end

      def write(key, value, options = nil)
        log("write", key, options)
      end

      def delete(key, options = nil)
        log("delete", key, options)
      end

      def delete_matched(matcher, options = nil)
        log("delete matched", matcher.inspect, options)
      end

      def exist?(key, options = nil)
        log("exist?", key, options)
      end

      def increment(key, amount = 1)
        log("incrementing", key, amount)
        if num = read(key)
          write(key, num + amount)
        else
          nil
        end
      end

      def decrement(key, amount = 1)
        log("decrementing", key, amount)
        if num = read(key)
          write(key, num - amount)
        else
          nil
        end
      end

      private
        def log(operation, key, options)
          logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}") if logger && !@logger_off
        end
    end

    module ThreadSafety #:nodoc:
      def read(key, options = nil) #:nodoc:
        @mutex.synchronize { super }
      end

      def write(key, value, options = nil) #:nodoc:
        @mutex.synchronize { super }
      end

      def delete(key, options = nil) #:nodoc:
        @mutex.synchronize { super }
      end

      def delete_matched(matcher, options = nil) #:nodoc:
        @mutex.synchronize { super }
      end
    end
  end
end

require 'active_support/cache/file_store'
require 'active_support/cache/memory_store'
require 'active_support/cache/drb_store'
require 'active_support/cache/mem_cache_store'
require 'active_support/cache/compressed_mem_cache_store'


text:
layout: post
title: "SimWeek 03"
categories: [Simulation Week]
tags: [FEA, CFD, LBM, engineering]
comments: true
image:
  feature: simweek03.png
  teaser: simweek03-teaser.png
  credit:
  creditlink:
---

# Finite Element Analysis

- Hail can be very dangerous for car owner. The results show how easily tiny particles destroy our vehicles [GIF]

Modeling vehicle hail damage using finite element methods #SimulationFriday #haildamage pic.twitter.com/p7HaW7UBc4
— PEC (@pec_tx) 28 April 2017

- OpenFOAM allows for avalanche modelling. Quite cool feature, I am wondering when it is needed to perform this kind of simulation [VID]

- When someone asks me what is the difference between Euler and Lagrange mesh, I am always struggling to rembember which is which. This article explains it very well [ART]

- A good book for all Abaqus users and Python maniacs [PDF]

# Computational Fluid Dynamics

- Great model of pedalling cyclist in STAR-CCM+. "Cycling is probably only one of two sports (the other being sailing) where aerodynamic performance directly impacts the athlete. So much so that at 50km/h 90% of the energy loss is related to aerodynamic drag." - from Siemens blog. I knew that aerodynamics has huge impact on cycling, but I didn't think it is so huge! [VID]

- Nicely looking fluid-structure interaction example. Although, for sure it is not numericaly simple! [ART]

You can easily solve complex FSI models with version 5.3a of COMSOL Multiphysics

See how with this example: https://t.co/6oYRzSWwdj pic.twitter.com/KtXHj4BMzu
— COMSOL (@COMSOL_Inc) 17 January 2018

# Other types of simulation

- Agricultural application of Discrete Element Method. Here, coupled with Multi-Body Dynamics [VID]

This #SimulationFriday, we're sharing #tractor pulling plough using DEM-MBD coupling. More agri applications: https://t.co/i6rY75RvxG pic.twitter.com/I9bXRSCwdI
— EDEM Simulation (@edemsimulation) 12 January 2018

- Another code, still DEM. This time DEM is used to model grass mowing. The analysis is great, but I wouldn't buy this mover - too much grass going everywhere [GIF]

It's #SimulationFriday and time to start the lawn mower with DEM #Simulation and #ThreeParticle pic.twitter.com/2ixUZ7Rm93
— BECKER 3D GmbH (@BECKER_3D_GmbH) 7 April 2017

- The last DEM usage - coupled with CFD code to model pneumatic systems [VID]

- Anyone thought about modelling birds using ballons with water? Some smart people did think [PIC]

Bird substitute impacts can be modelled using SPH meshfree technique #lsdyna . #happysimulationfriday pic.twitter.com/vSpsK77UQa
— Dynamics UC3M (@Dynamics_uc3m) 17 February 2017

# Engineering

- I am more like a Marvel fan, but this Flash mask created in SolidWorks is really good. [VID]

- Keep on rollin' baby! [GIF]

Thermal image of F1 car doing donuts pic.twitter.com/C1D6Wr9rtD
— AutoSports Art (@AutoSportsArt) 11 May 2017

- The article explains what caused the rapid sinking of the Titanic [ART]


text:
cljs.core.cst$sym$form = new cljs.core.Symbol(null,"form","form",16469056,null);
cljs.core.cst$sym$tag = new cljs.core.Symbol(null,"tag","tag",350170304,null);
cljs.core.cst$kw$on_DASH_press = new cljs.core.Keyword(null,"on-press","on-press",-1763585856);
cljs.core.cst$kw$initial_DASH_route = new cljs.core.Keyword(null,"initial-route","initial-route",-622635808);
cljs.core.cst$sym$_AMPERSAND_ = new cljs.core.Symbol(null,"&","&",-2144855648,null);
cljs.core.cst$sym$stepper = new cljs.core.Symbol(null,"stepper","stepper",1159163296,null);
cljs.core.cst$sym$uuid = new cljs.core.Symbol(null,"uuid","uuid",-504564192,null);
cljs.core.cst$sym$after_DASH_render = new cljs.core.Symbol(null,"after-render","after-render",-656902336,null);
cljs.core.cst$sym$valid_DASH_tag_QMARK_ = new cljs.core.Symbol(null,"valid-tag?","valid-tag?",1243064160,null);
cljs.core.cst$sym$end = new cljs.core.Symbol(null,"end","end",1372345569,null);
cljs.core.cst$sym$defrecord_STAR_ = new cljs.core.Symbol(null,"defrecord*","defrecord*",-1936366207,null);
cljs.core.cst$sym$base = new cljs.core.Symbol(null,"base","base",1825810849,null);
cljs.core.cst$sym$obj = new cljs.core.Symbol(null,"obj","obj",-1672671807,null);
cljs.core.cst$sym$fqn = new cljs.core.Symbol(null,"fqn","fqn",-1749334463,null);
cljs.core.cst$sym$satisfies_QMARK_ = new cljs.core.Symbol(null,"satisfies?","satisfies?",-433227199,null);
cljs.core.cst$sym$first = new cljs.core.Symbol(null,"first","first",996428481,null);
cljs.core.cst$sym$try = new cljs.core.Symbol(null,"try","try",-1273693247,null);
cljs.core.cst$sym$has_DASH_nil_QMARK_ = new cljs.core.Symbol(null,"has-nil?","has-nil?",825886722,null);
cljs.core.cst$kw$on_DASH_set = new cljs.core.Keyword(null,"on-set","on-set",-140953470);
cljs.core.cst$sym$body = new cljs.core.Symbol(null,"body","body",-408674142,null);
cljs.core.cst$sym$rear = new cljs.core.Symbol(null,"rear","rear",-900164830,null);
cljs.core.cst$sym$render_DASH_fun = new cljs.core.Symbol(null,"render-fun","render-fun",-1209513086,null);
cljs.core.cst$sym$hierarchy = new cljs.core.Symbol(null,"hierarchy","hierarchy",587061186,null);
cljs.core.cst$sym$iter = new cljs.core.Symbol(null,"iter","iter",-1346195486,null);
cljs.core.cst$sym$namespace = new cljs.core.Symbol(null,"namespace","namespace",1263021155,null);
cljs.core.cst$kw$duck = new cljs.core.Keyword(null,"duck","duck",-542480189);
cljs.core.cst$sym$watching = new cljs.core.Symbol(null,"watching","watching",1947648227,null);
cljs.core.cst$sym$step = new cljs.core.Symbol(null,"step","step",-1365547645,null);
cljs.core.cst$sym$vector_QMARK_ = new cljs.core.Symbol(null,"vector?","vector?",-61367869,null);
cljs.core.cst$sym$boolean = new cljs.core.Symbol(null,"boolean","boolean",-278886877,null);
cljs.core.cst$sym$update_DASH_count = new cljs.core.Symbol(null,"update-count","update-count",-411982269,null);
cljs.core.cst$sym$reaction = new cljs.core.Symbol(null,"reaction","reaction",2131401315,null);
cljs.core.cst$sym$method_DASH_table = new cljs.core.Symbol(null,"method-table","method-table",-1878263165,null);
cljs.core.cst$kw$buttons = new cljs.core.Keyword(null,"buttons","buttons",-1953831197);
cljs.core.cst$sym$chunk = new cljs.core.Symbol(null,"chunk","chunk",449371907,null);
cljs.core.cst$sym$callback = new cljs.core.Symbol(null,"callback","callback",935395299,null);
cljs.core.cst$sym$i = new cljs.core.Symbol(null,"i","i",253690212,null);
cljs.core.cst$sym$rest = new cljs.core.Symbol(null,"rest","rest",398835108,null);
cljs.core.cst$kw$meta = new cljs.core.Keyword(null,"meta","meta",1499536964);
cljs.core.cst$sym$p = new cljs.core.Symbol(null,"p","p",1791580836,null);
cljs.core.cst$kw$dup = new cljs.core.Keyword(null,"dup","dup",556298533);
cljs.core.cst$kw$text_DASH_align = new cljs.core.Keyword(null,"text-align","text-align",1786091845);
cljs.core.cst$kw$key = new cljs.core.Keyword(null,"key","key",-1516042587);
cljs.core.cst$sym$comp = new cljs.core.Symbol(null,"comp","comp",-1462482139,null);
cljs.core.cst$sym$dispatch_DASH_fn = new cljs.core.Symbol(null,"dispatch-fn","dispatch-fn",-1401088155,null);
cljs.core.cst$sym$IReactiveAtom = new cljs.core.Symbol(null,"IReactiveAtom","IReactiveAtom",-991158427,null);
cljs.core.cst$kw$bottom = new cljs.core.Keyword(null,"bottom","bottom",-1550509018);
cljs.core.cst$kw$else = new cljs.core.Keyword(null,"else","else",-1508377146);
cljs.core.cst$sym$props = new cljs.core.Symbol(null,"props","props",2093813254,null);
cljs.core.cst$kw$font_DASH_size = new cljs.core.Keyword(null,"font-size","font-size",-1847940346);
cljs.core.cst$sym$pos_QMARK_ = new cljs.core.Symbol(null,"pos?","pos?",-244377722,null);
cljs.core.cst$sym$left = new cljs.core.Symbol(null,"left","left",1241415590,null);
cljs.core.cst$sym$path = new cljs.core.Symbol(null,"path","path",1452340359,null);
cljs.core.cst$kw$cljs$core_SLASH_none = new cljs.core.Keyword("cljs.core","none","cljs.core/none",926646439);
cljs.core.cst$sym$shift = new cljs.core.Symbol(null,"shift","shift",-1657295705,null);
cljs.core.cst$sym$iters = new cljs.core.Symbol(null,"iters","iters",719353031,null);
cljs.core.cst$kw$top = new cljs.core.Keyword(null,"top","top",-1856271961);
cljs.core.cst$kw$derefed = new cljs.core.Keyword(null,"derefed","derefed",590684583);
cljs.core.cst$sym$new_DASH_value = new cljs.core.Symbol(null,"new-value","new-value",-1567397401,null);
cljs.core.cst$kw$displayName = new cljs.core.Keyword(null,"displayName","displayName",-809144601);
cljs.core.cst$sym$args = new cljs.core.Symbol(null,"args","args",-1338879193,null);
cljs.core.cst$sym$active_QMARK_ = new cljs.core.Symbol(null,"active?","active?",2100031303,null);
cljs.core.cst$sym$xform = new cljs.core.Symbol(null,"xform","xform",-85179481,null);
cljs.core.cst$kw$validator = new cljs.core.Keyword(null,"validator","validator",-1966190681);
cljs.core.cst$kw$default = new cljs.core.Keyword(null,"default","default",-1987822328);
cljs.core.cst$kw$cljsRender = new cljs.core.Keyword(null,"cljsRender","cljsRender",247449928);
cljs.core.cst$sym$prefer_DASH_table = new cljs.core.Symbol(null,"prefer-table","prefer-table",462168584,null);
cljs.core.cst$sym$loop_STAR_ = new cljs.core.Symbol(null,"loop*","loop*",615029416,null);
cljs.core.cst$sym$watches = new cljs.core.Symbol(null,"watches","watches",1367433992,null);
cljs.core.cst$kw$ns = new cljs.core.Keyword(null,"ns","ns",441598760);
cljs.core.cst$kw$name = new cljs.core.Keyword(null,"name","name",1843675177);
cljs.core.cst$sym$bitmap = new cljs.core.Symbol(null,"bitmap","bitmap",501334601,null);
cljs.core.cst$sym$meta6253 = new cljs.core.Symbol(null,"meta6253","meta6253",2112989865,null);
cljs.core.cst$sym$_seq = new cljs.core.Symbol(null,"_seq","_seq",-449557847,null);
cljs.core.cst$sym$on_DASH_set = new cljs.core.Symbol(null,"on-set","on-set",1499578057,null);
cljs.core.cst$sym$reset_DASH_fn = new cljs.core.Symbol(null,"reset-fn","reset-fn",949643977,null);
cljs.core.cst$sym$nil_DASH_val = new cljs.core.Symbol(null,"nil-val","nil-val",-513933559,null);
cljs.core.cst$kw$background_DASH_color = new cljs.core.Keyword(null,"background-color","background-color",570434026);
cljs.core.cst$sym$v = new cljs.core.Symbol(null,"v","v",1661996586,null);
cljs.core.cst$sym$map_QMARK_ = new cljs.core.Symbol(null,"map?","map?",-1780568534,null);
cljs.core.cst$sym$riter = new cljs.core.Symbol(null,"riter","riter",-237834262,null);
cljs.core.cst$sym$__hash = new cljs.core.Symbol(null,"__hash","__hash",-1328796629,null);
cljs.core.cst$sym$meta = new cljs.core.Symbol(null,"meta","meta",-1154898805,null);
cljs.core.cst$sym$_meta = new cljs.core.Symbol(null,"_meta","_meta",-1716892533,null);
cljs.core.cst$kw$width = new cljs.core.Keyword(null,"width","width",-384071477);
cljs.core.cst$sym$afn = new cljs.core.Symbol(null,"afn","afn",216963467,null);
cljs.core.cst$sym$tree = new cljs.core.Symbol(null,"tree","tree",1444219499,null);
cljs.core.cst$sym$fn = new cljs.core.Symbol(null,"fn","fn",465265323,null);
cljs.core.cst$sym$front = new cljs.core.Symbol(null,"front","front",117022539,null);
cljs.core.cst$sym$buf = new cljs.core.Symbol(null,"buf","buf",1426618187,null);
cljs.core.cst$sym$new_DASH_state = new cljs.core.Symbol(null,"new-state","new-state",1150182315,null);
cljs.core.cst$kw$component_DASH_did_DASH_update = new cljs.core.Keyword(null,"component-did-update","component-did-update",-1468549173);
cljs.core.cst$sym$next_DASH_entry = new cljs.core.Symbol(null,"next-entry","next-entry",1091342476,null);
cljs.core.cst$kw$val = new cljs.core.Keyword(null,"val","val",128701612);
cljs.core.cst$sym$key = new cljs.core.Symbol(null,"key","key",124488940,null);
cljs.core.cst$sym$not_EQ_ = new cljs.core.Symbol(null,"not=","not=",1466536204,null);
cljs.core.cst$sym$_next = new cljs.core.Symbol(null,"_next","_next",101877036,null);
cljs.core.cst$sym$parent = new cljs.core.Symbol(null,"parent","parent",761652748,null);
cljs.core.cst$sym$root_DASH_iter = new cljs.core.Symbol(null,"root-iter","root-iter",1974672108,null);
cljs.core.cst$sym$validate = new cljs.core.Symbol(null,"validate","validate",1439230700,null);
cljs.core.cst$sym$do = new cljs.core.Symbol(null,"do","do",1686842252,null);
cljs.core.cst$sym$vec = new cljs.core.Symbol(null,"vec","vec",982683596,null);
cljs.core.cst$sym$util_SLASH_reagent_DASH_component_QMARK_ = new cljs.core.Symbol("util","reagent-component?","util/reagent-component?",1508385933,null);
cljs.core.cst$kw$fallback_DASH_impl = new cljs.core.Keyword(null,"fallback-impl","fallback-impl",-1501286995);
cljs.core.cst$kw$source = new cljs.core.Keyword(null,"source","source",-433931539);
cljs.core.cst$kw$flush_DASH_on_DASH_newline = new cljs.core.Keyword(null,"flush-on-newline","flush-on-newline",-151457939);
cljs.core.cst$sym$default_DASH_dispatch_DASH_val = new cljs.core.Symbol(null,"default-dispatch-val","default-dispatch-val",-1231201266,null);
cljs.core.cst$sym$this = new cljs.core.Symbol(null,"this","this",1028897902,null);
cljs.core.cst$kw$componentWillUnmount = new cljs.core.Keyword(null,"componentWillUnmount","componentWillUnmount",1573788814);
cljs.core.cst$kw$no_DASH_test = new cljs.core.Keyword(null,"no-test","no-test",-1679482642);
cljs.core.cst$sym$queue = new cljs.core.Symbol(null,"queue","queue",-1198599890,null);
cljs.core.cst$sym$validator = new cljs.core.Symbol(null,"validator","validator",-325659154,null);
cljs.core.cst$kw$component = new cljs.core.Keyword(null,"component","component",1555936782);
cljs.core.cst$sym$letfn_STAR_ = new cljs.core.Symbol(null,"letfn*","letfn*",-110097810,null);
cljs.core.cst$sym$if = new cljs.core.Symbol(null,"if","if",1181717262,null);
cljs.core.cst$sym$arr = new cljs.core.Symbol(null,"arr","arr",2115492975,null);
cljs.core.cst$sym$new = new cljs.core.Symbol(null,"new","new",-444906321,null);
cljs.core.cst$kw$descendants = new cljs.core.Keyword(null,"descendants","descendants",1824886031);
cljs.core.cst$sym$ns = new cljs.core.Symbol(null,"ns","ns",2082130287,null);
cljs.core.cst$kw$title = new cljs.core.Keyword(null,"title","title",636505583);
cljs.core.cst$kw$shouldComponentUpdate = new cljs.core.Keyword(null,"shouldComponentUpdate","shouldComponentUpdate",1795750960);
cljs.core.cst$kw$ancestors = new cljs.core.Keyword(null,"ancestors","ancestors",-776045424);
cljs.core.cst$kw$style = new cljs.core.Keyword(null,"style","style",-496642736);
cljs.core.cst$sym$value = new cljs.core.Symbol(null,"value","value",1946509744,null);
cljs.core.cst$sym$or = new cljs.core.Symbol(null,"or","or",1876275696,null);
cljs.core.cst$sym$name = new cljs.core.Symbol(null,"name","name",-810760592,null);
cljs.core.cst$sym$n = new cljs.core.Symbol(null,"n","n",-2092305744,null);
cljs.core.cst$kw$readably = new cljs.core.Keyword(null,"readably","readably",1129599760);
cljs.core.cst$kw$more_DASH_marker = new cljs.core.Keyword(null,"more-marker","more-marker",-14717935);
cljs.core.cst$sym$fields = new cljs.core.Symbol(null,"fields","fields",-291534703,null);
cljs.core.cst$sym$scheduled_QMARK_ = new cljs.core.Symbol(null,"scheduled?","scheduled?",579986609,null);
cljs.core.cst$sym$method_DASH_cache = new cljs.core.Symbol(null,"method-cache","method-cache",1230193905,null);
cljs.core.cst$sym$dirty_QMARK_ = new cljs.core.Symbol(null,"dirty?","dirty?",-419314319,null);
cljs.core.cst$kw$reagentRender = new cljs.core.Keyword(null,"reagentRender","reagentRender",-358306383);
cljs.core.cst$sym$nexts = new cljs.core.Symbol(null,"nexts","nexts",-1683579407,null);
cljs.core.cst$sym$edit = new cljs.core.Symbol(null,"edit","edit",-1302639,null);
cljs.core.cst$sym$editable_QMARK_ = new cljs.core.Symbol(null,"editable?","editable?",-164945806,null);
cljs.core.cst$sym$base_DASH_count = new cljs.core.Symbol(null,"base-count","base-count",-1180647182,null);
cljs.core.cst$kw$border_DASH_width = new cljs.core.Keyword(null,"border-width","border-width",-1512605390);
cljs.core.cst$kw$render = new cljs.core.Keyword(null,"render","render",-1408033454);
cljs.core.cst$kw$fullscreen = new cljs.core.Keyword(null,"fullscreen","fullscreen",-4371054);
cljs.core.cst$sym$collision_DASH_hash = new cljs.core.Symbol(null,"collision-hash","collision-hash",-35831342,null);
cljs.core.cst$sym$deftype_STAR_ = new cljs.core.Symbol(null,"deftype*","deftype*",962659890,null);
cljs.core.cst$sym$let_STAR_ = new cljs.core.Symbol(null,"let*","let*",1920721458,null);
cljs.core.cst$sym$nil_QMARK_ = new cljs.core.Symbol(null,"nil?","nil?",1612038930,null);
cljs.core.cst$sym$start = new cljs.core.Symbol(null,"start","start",1285322546,null);
cljs.core.cst$sym$coll = new cljs.core.Symbol(null,"coll","coll",-1006698606,null);
cljs.core.cst$sym$not_DASH_native = new cljs.core.Symbol(null,"not-native","not-native",-236392494,null);
cljs.core.cst$sym$js_STAR_ = new cljs.core.Symbol(null,"js*","js*",-1134233646,null);
cljs.core.cst$kw$reagent_DASH_render = new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853);
cljs.core.cst$sym$strobj = new cljs.core.Symbol(null,"strobj","strobj",1088091283,null);
cljs.core.cst$sym$_rest = new cljs.core.Symbol(null,"_rest","_rest",-2100466189,null);
cljs.core.cst$sym$fn_STAR_ = new cljs.core.Symbol(null,"fn*","fn*",-752876845,null);
cljs.core.cst$sym$val = new cljs.core.Symbol(null,"val","val",1769233139,null);
cljs.core.cst$sym$ascending_QMARK_ = new cljs.core.Symbol(null,"ascending?","ascending?",-1938452653,null);
cljs.core.cst$sym$not = new cljs.core.Symbol(null,"not","not",1044554643,null);
cljs.core.cst$sym$recur = new cljs.core.Symbol(null,"recur","recur",1202958259,null);
cljs.core.cst$sym$ci = new cljs.core.Symbol(null,"ci","ci",2049808339,null);
cljs.core.cst$kw$print_DASH_length = new cljs.core.Keyword(null,"print-length","print-length",1931866356);
cljs.core.cst$sym$src = new cljs.core.Symbol(null,"src","src",-10544524,null);
cljs.core.cst$sym$ratom = new cljs.core.Symbol(null,"ratom","ratom",1514010260,null);
cljs.core.cst$kw$class = new cljs.core.Keyword(null,"class","class",-2030961996);
cljs.core.cst$sym$state = new cljs.core.Symbol(null,"state","state",-348086572,null);
cljs.core.cst$kw$ok = new cljs.core.Keyword(null,"ok","ok",967785236);
cljs.core.cst$sym$cached_DASH_hierarchy = new cljs.core.Symbol(null,"cached-hierarchy","cached-hierarchy",-1085460203,null);
cljs.core.cst$kw$padding = new cljs.core.Keyword(null,"padding","padding",1660304693);
cljs.core.cst$kw$auto_DASH_run = new cljs.core.Keyword(null,"auto-run","auto-run",1958400437);
cljs.core.cst$sym$s = new cljs.core.Symbol(null,"s","s",-948495851,null);
cljs.core.cst$kw$cljsName = new cljs.core.Keyword(null,"cljsName","cljsName",999824949);
cljs.core.cst$kw$parents = new cljs.core.Keyword(null,"parents","parents",-2027538891);
cljs.core.cst$sym$cnt = new cljs.core.Symbol(null,"cnt","cnt",1924510325,null);
cljs.core.cst$sym$node = new cljs.core.Symbol(null,"node","node",-2073234571,null);
cljs.core.cst$sym$p1 = new cljs.core.Symbol(null,"p1","p1",703771573,null);
cljs.core.cst$kw$component_DASH_will_DASH_unmount = new cljs.core.Keyword(null,"component-will-unmount","component-will-unmount",-2058314698);
cljs.core.cst$sym$sym = new cljs.core.Symbol(null,"sym","sym",195671222,null);
cljs.core.cst$sym$sb = new cljs.core.Symbol(null,"sb","sb",-1249746442,null);
cljs.core.cst$sym$meta6256 = new cljs.core.Symbol(null,"meta6256","meta6256",-1516867882,null);
cljs.core.cst$kw$_DASH_elem_DASH_count = new cljs.core.Keyword(null,"-elem-count","-elem-count",663797079);
cljs.core.cst$kw$display_DASH_name = new cljs.core.Keyword(null,"display-name","display-name",694513143);
cljs.core.cst$kw$right = new cljs.core.Keyword(null,"right","right",-452581833);
cljs.core.cst$kw$border_DASH_color = new cljs.core.Keyword(null,"border-color","border-color",-2059162761);
cljs.core.cst$kw$position = new cljs.core.Keyword(null,"position","position",-2011731912);
cljs.core.cst$sym$ifn_QMARK_ = new cljs.core.Symbol(null,"ifn?","ifn?",-2106461064,null);
cljs.core.cst$sym$_hash = new cljs.core.Symbol(null,"_hash","_hash",-2130838312,null);
cljs.core.cst$kw$on_DASH_dispose = new cljs.core.Keyword(null,"on-dispose","on-dispose",2105306360);
cljs.core.cst$sym$c = new cljs.core.Symbol(null,"c","c",-122660552,null);
cljs.core.cst$kw$componentFunction = new cljs.core.Keyword(null,"componentFunction","componentFunction",825866104);
cljs.core.cst$sym$keys = new cljs.core.Symbol(null,"keys","keys",-1586012071,null);
cljs.core.cst$kw$top_DASH_view = new cljs.core.Keyword(null,"top-view","top-view",-1952554663);
cljs.core.cst$sym$set_BANG_ = new cljs.core.Symbol(null,"set!","set!",250714521,null);
cljs.core.cst$kw$uri = new cljs.core.Keyword(null,"uri","uri",-774711847);
cljs.core.cst$kw$bath = new cljs.core.Keyword(null,"bath","bath",-780871207);
cljs.core.cst$kw$tag = new cljs.core.Keyword(null,"tag","tag",-1290361223);
cljs.core.cst$sym$tree_DASH_map = new cljs.core.Symbol(null,"tree-map","tree-map",1373073049,null);
cljs.core.cst$sym$_DOT_ = new cljs.core.Symbol(null,".",".",1975675962,null);
cljs.core.cst$kw$mutable = new cljs.core.Keyword(null,"mutable","mutable",875778266);
cljs.core.cst$sym$quote = new cljs.core.Symbol(null,"quote","quote",1377916282,null);
cljs.core.cst$kw$align_DASH_self = new cljs.core.Keyword(null,"align-self","align-self",1475936794);
cljs.core.cst$sym$root = new cljs.core.Symbol(null,"root","root",1191874074,null);
cljs.core.cst$sym$str = new cljs.core.Symbol(null,"str","str",-1564826950,null);
cljs.core.cst$sym$nodes = new cljs.core.Symbol(null,"nodes","nodes",-459054278,null);
cljs.core.cst$sym$seen = new cljs.core.Symbol(null,"seen","seen",1121531738,null);
cljs.core.cst$sym$hash_DASH_map = new cljs.core.Symbol(null,"hash-map","hash-map",-439030950,null);
cljs.core.cst$kw$arglists = new cljs.core.Keyword(null,"arglists","arglists",1661989754);
cljs.core.cst$sym$nil_DASH_iter = new cljs.core.Symbol(null,"nil-iter","nil-iter",1101030523,null);
cljs.core.cst$sym$is_DASH_reagent_DASH_component = new cljs.core.Symbol(null,"is-reagent-component","is-reagent-component",-1856228005,null);
cljs.core.cst$kw$alt_DASH_impl = new cljs.core.Keyword(null,"alt-impl","alt-impl",670969595);
cljs.core.cst$kw$border_DASH_radius = new cljs.core.Keyword(null,"border-radius","border-radius",419594011);
cljs.core.cst$sym$ext_DASH_map_DASH_iter = new cljs.core.Symbol(null,"ext-map-iter","ext-map-iter",-1215982757,null);
cljs.core.cst$sym$tail = new cljs.core.Symbol(null,"tail","tail",494507963,null);
cljs.core.cst$sym$record = new cljs.core.Symbol(null,"record","record",861424668,null);
cljs.core.cst$sym$changed = new cljs.core.Symbol(null,"changed","changed",-2083710852,null);
cljs.core.cst$sym$mseq = new cljs.core.Symbol(null,"mseq","mseq",1602647196,null);
cljs.core.cst$sym$count = new cljs.core.Symbol(null,"count","count",-514511684,null);
cljs.core.cst$kw$keywordize_DASH_keys = new cljs.core.Keyword(null,"keywordize-keys","keywordize-keys",1310784252);
cljs.core.cst$sym$off = new cljs.core.Symbol(null,"off","off",-2047994980,null);
cljs.core.cst$sym$auto_DASH_run = new cljs.core.Symbol(null,"auto-run","auto-run",-696035332,null);
cljs.core.cst$sym$stack = new cljs.core.Symbol(null,"stack","stack",847125597,null);
cljs.core.cst$sym$transient_DASH_map = new cljs.core.Symbol(null,"transient-map","transient-map",351764893,null);
cljs.core.cst$sym$len = new cljs.core.Symbol(null,"len","len",-1230778691,null);
cljs.core.cst$kw$componentWillMount = new cljs.core.Keyword(null,"componentWillMount","componentWillMount",-285327619);
cljs.core.cst$sym$right = new cljs.core.Symbol(null,"right","right",1187949694,null);
cljs.core.cst$sym$throw = new cljs.core.Symbol(null,"throw","throw",595905694,null);
cljs.core.cst$kw$resize_DASH_mode = new cljs.core.Keyword(null,"resize-mode","resize-mode",-962168418);
cljs.core.cst$sym$fseq = new cljs.core.Symbol(null,"fseq","fseq",-1466412450,null);
cljs.core.cst$sym$and = new cljs.core.Symbol(null,"and","and",668631710,null);
cljs.core.cst$sym$number_QMARK_ = new cljs.core.Symbol(null,"number?","number?",-1747282210,null);
cljs.core.cst$kw$height = new cljs.core.Keyword(null,"height","height",1025178622);
cljs.core.cst$sym$symbol_QMARK_ = new cljs.core.Symbol(null,"symbol?","symbol?",1820680511,null);
cljs.core.cst$kw$left = new cljs.core.Keyword(null,"left","left",-399115937);
cljs.core.cst$kw$cljs$core_SLASH_not_DASH_found = new cljs.core.Keyword("cljs.core","not-found","cljs.core/not-found",-1572889185);
cljs.core.cst$sym$more = new cljs.core.Symbol(null,"more","more",-418290273,null);
cljs.core.cst$sym$def = new cljs.core.Symbol(null,"def","def",597100991,null);
cljs.core.cst$kw$margin = new cljs.core.Keyword(null,"margin","margin",-995903681);
cljs.core.cst$kw$data = new cljs.core.Keyword(null,"data","data",-232669377);
cljs.core.cst$sym$on_DASH_dispose = new cljs.core.Symbol(null,"on-dispose","on-dispose",-549129409,null);
cljs.core.cst$sym$f = new cljs.core.Symbol(null,"f","f",43394975,null);
cljs.core.cst$sym$next_DASH_iter = new cljs.core.Symbol(null,"next-iter","next-iter",1526626239,null);


text:
from dal.test import case

from dal_select2.test import Select2Story

from .models import TModel

class AdminForeignKeyTestCase(Select2Story, case.AdminMixin, case.OptionMixin,
                              case.AutocompleteTestCase):

    field_name = 'test'
    inline_related_name = 'inline_test_models'
    model = TModel

    def setUp(self):
        super(AdminForeignKeyTestCase, self).setUp()
        self.get(url=self.get_modeladmin_url('add'))
        self.fill_name()


text:
<?php

namespace ConsoleTVs\Links\Models;

use Illuminate\Database\Eloquent\Model;
use Unicodeveloper\Identify\Facades\IdentityFacade as Identify;

class Link extends Model
{
    protected $table = 'links';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'url', 'slug',
    ];

    /**
     * Returns the shortered link.
     */
    public function shortered()
    {
        return route('links::redirect', ['slug' => $this->slug]);
    }

    /**
     * Returns the link views.
     */
    public function views()
    {
        return $this->hasMany('ConsoleTVs\Links\Models\View');
    }

    /**
     * Returns the link unique views.
     */
    public function uniqueViews()
    {
        return $this->views->unique('ip');
    }

    /**
     * Returns the link total views number.
     */
    public function totalViews()
    {
        return count($this->views);
    }

    /**
     * Returns the link total unique views number.
     */
    public function totalUniqueViews()
    {
        return count($this->uniqueViews());
    }

    /**
     * Returns the link browsers.
     */
    public function usedBrowsers()
    {
        $results = [];

        foreach ($this->views as $view) {
            array_key_exists($view->browser, $results) ? $results[$view->browser]++ : $results[$view->browser] = 1;
        }

        return $results;
    }

    /**
     * Returns the link most used browser.
     */
    public function mostUsedBrowser()
    {
        $max = 0;
        $max_browser = null;

        foreach ($this->usedBrowsers() as $browser => $count) {
            if ($count >= $max) {
                $max = $count;
                $max_browser = $browser;
            }
        }

        return $max_browser;
    }

    /**
     * Returns the link OSs (Operating Systems).
     */
    public function usedOSs()
    {
        $results = [];

        foreach ($this->views as $view) {
            array_key_exists($view->os, $results) ? $results[$view->os]++ : $results[$view->os] = 1;
        }

        return $results;
    }

    /**
     * Returns the link most used OS (Operating System).
     */
    public function mostUsedOS()
    {
        $max = 0;
        $max_os = null;

        foreach ($this->usedOSs() as $os => $count) {
            if ($count >= $max) {
                $max = $count;
                $max_os = $os;
            }
        }

        return $max_os;
    }

    /**
     * Returns the link OSs (Operating Systems).
     *
     * @param bool $fancy
     */
    public function usedLanguages($fancy = false)
    {
        $collection = collect($this->views->toArray())->groupBy('language')->map(function ($item, $key) {
            return count($item);
        });

        if ($fancy) {
            $collection = $collection->groupBy(function ($item, $key) {
                $countries = json_decode(file_get_contents(__DIR__.'/../countries.json'), true);
                foreach ($countries as $country) {
                    if ($country['code'] == $key) {
                        return explode(' ', str_replace(';', '', $country['name']))[0];
                    }
                }

                return $key;
            })->map(function ($item, $key) {
                return count($item);
            });
        }

        return $collection->toArray();
    }

    /**
     * Returns the link most used OS (Operating System).
     *
     * @param bool $fancy
     */
    public function mostUsedLanguage($fancy = false)
    {
        $max = collect($languages = $this->usedLanguages())->max();

        foreach ($languages as $lang => $views) {
            if ($views == $max) {
                if ($fancy) {
                    $countries = json_decode(file_get_contents(__DIR__.'/../countries.json'), true);
                    foreach ($countries as $country) {
                        if ($country['code'] == $lang) {
                            return explode(' ', str_replace(';', '', $country['name']))[0];
                        }
                    }
                }

                return $lang;
            }
        }
    }

    /**
     * Adds a new view to the link.
     */
    public function addView()
    {
        $view = View::create([
            'link_id'           => $this->id,
            'language'          => Identify::lang()->getLanguage(),
            'browser'           => Identify::browser()->getName(),
            'browser_version'   => Identify::browser()->getVersion(),
            'os'                => Identify::os()->getName(),
            'os_version'        => Identify::os()->getVersion(),
            'ip'                => $this->getIP(),
        ]);
    }

    /**
     * Gets the real client IP.
     */
    public function getIP()
    {
        if (! empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {   //check ip from cloudflare
            $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
        } elseif (! empty($_SERVER['HTTP_CLIENT_IP'])) {   //check ip from share internet
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        } elseif (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {   //to check ip is pass from proxy
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }

        return $ip;
    }
}


text:
angular.module('ngTableExport', [])
.config(['$compileProvider', function($compileProvider) {
    // allow data links
    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|data):/);
}])
.directive('exportCsv', ['$parse', function ($parse) {
    return {
        restrict: 'A',
        scope: false,
        link: function(scope, element, attrs) {

            /********************************************************************************************
             * Public stuff:
             *
             * csv will be exposed within the PARENT scope.
             * This will make it available to siblings of the <table> tag.
             */
            var csv = {
                stringify: function (str) {
                    return '"' + str.replace(/^\s\s*/, '').replace(/\s*\s$/, '') // trim spaces
                        .replace(/"/g, '""') + // replace quotes with double quotes
                        '"';
                },
                extractData: function () {
                    data = '';
                    var rows = element.find('tr');
                    angular.forEach(rows, function (row, i) {
                        var tr = angular.element(row), tds = tr.find('th'), rowData = '';
                        if (tr.hasClass('ng-table-filters')) {
                            return;
                        }
                        if (tds.length == 0) {
                            tds = tr.find('td');
                        }
                        if (i != 1) {
                            angular.forEach(tds, function (td, i) {
                                if (td.hasAttribute('data-fulltext')) {
                                    rowData += csv.stringify(td.getAttribute('data-fulltext')) + ';';
                                } else {
                                    rowData += csv.stringify(angular.element(td).text()) + ';';
                                }
                            });
                            rowData = rowData.slice(0, rowData.length - 1); //remove last semicolon
                        }
                        data += rowData + "\n";
                    });
                },
                /**
                 * @param $event Handing over the $event is necessary to properly cancel event propagation in IE
                 * @param encoding If you supply this parameter, it will override the csv-export-encoding attribute
                 *                 you could alternatively have supplied together with csv-export on the table element.
                 *                 This alternative helps you in reducing code-changes in case you have the download-button
                 *                 put into a template which you re-use everywhere where you're using ng-table
                 */
                generate: function ($event, encoding) {
                    encodingOverwrite = encoding;

                    /** all browsers need to have the data prepared ...*/
                    csv.extractData();

                    /* ... but only IE will start the download here, that's why we pass $event so the normal behaviour
                     of following the href can be preventDefaulted. All other browsers will have the download triggered
                     through this normal behaviour of visiting the href ... that's where the link() function takes over */
                    csv.generateIE($event);
                },
                generateIE: function ($event) {
                    if (window.navigator.msSaveOrOpenBlob) {
                        var encoding = _getRequestedEncoding(),
                            blobObject,
                            filename;

                        /**
                         * The following logic depends on the "data" string to be UTF-8. This should usually be the case.
                         */
                        if (encoding === 'UTF-8') {
                            blobObject = _getUtf8Blob();

                        } else if (encoding === 'ISO-8859-1') {
                            blobObject = _transformUtf8ToLatin1AndGetBlob();

                        } else {
                            _logErrorEncodingNotSupported();
                        }

                        /** we need $event also to collect the filename from the "download" attribute */
                        if ($event && $event.preventDefault) {

                            filename = $event.target.attributes['download'].value;
                            window.navigator.msSaveOrOpenBlob(blobObject, filename);
                            $event.preventDefault(); // href must not be followed

                        } else {
                            console.warn('ng table export: you should pass over the $event in your expression for proper IE support, ' +
                                'e.g. via ng-click="csv.generate($event)" --- otherwise the href will be followed');
                        }
                    }
                },
                link: function () {
                    var encoding = _getRequestedEncoding();
                    if (encoding === 'UTF-8') {
                        return 'data:text/csv;charset=UTF-8,' + encodeURIComponent(data);

                    } else if (encoding === 'ISO-8859-1') {
                        return 'data:text/csv;charset=ISO-8859-1,' + escape(data);

                    } else {
                        _logErrorEncodingNotSupported();
                    }
                }
            };
            $parse(attrs.exportCsv).assign(scope.$parent, csv);

            /********************************************************************************************
             * Private stuff here
             */
            var data = '',
                encodingOverwrite = '';

            function _logErrorEncodingNotSupported() {
                console.error("ng table export: invalid encoding requested. only 'UTF-8' and 'ISO-8859-1' are supported");
            }

            /**
             * Returns the requested encoding.
             *
             * To change the encoding from the default value (UTF-8) to latin1,
             * do it like so: <table ... ng-table ... export-csv="..." export-csv-encoding="latin1">
             *
             * Actually at the moment, it does not matter what you insert into export-csv-encoding. It will always be
             * interpreted as latin1 (i.e. ISO-8859-1) as long as the value does not match to "utf".
             */
            function _getRequestedEncoding() {
                var enc = encodingOverwrite ? encodingOverwrite : attrs.exportCsvEncoding;
                if (!enc) {
                    return 'UTF-8';
                } else {
                    if (enc.match(/utf/)) {
                        return 'UTF-8';
                    } else {
                        return 'ISO-8859-1';
                    }
                }
            }

            function _transformUtf8ToLatin1AndGetBlob() {
                var utf8Text = data,
                    buffer = new ArrayBuffer(utf8Text.length),
                    uint8Array = new Uint8Array(buffer);

                for (var i = 0; i < uint8Array.length; i++) {
                    var charCode = utf8Text[i].charCodeAt(0);
                    if (charCode > 256) { // latin1 goes only from charCode 1 to 256
                        // that's why we set it to a predefined latin1 char which is easily recognizable as "this char has no representation in latin1"
                        // we "use" the paragraph sign at position %B6 (or 182 in decimal notation): ¶
                        charCode = 182; // ¶
                    }
                    uint8Array[i] = charCode; // will be transformed to correct latin1 binary representation
                }
                var blobObject = new Blob([uint8Array]);
                return blobObject;
            }

            function _getUtf8Blob() {
                return new Blob([data]);
            }
        }
    };
}]);


text:
"use strict";
/* jshint maxlen: false */
const apirequest_1 = require("../../lib/apirequest");
/**
 * Google Analytics Reporting API
 *
 * Accesses Analytics report data.
 *
 * @example
 * const google = require('googleapis');
 * const analyticsreporting = google.analyticsreporting('v4');
 *
 * @namespace analyticsreporting
 * @type {Function}
 * @version v4
 * @variation v4
 * @param {object=} options Options for Analyticsreporting
 */
function Analyticsreporting(options) {
    const self = this;
    self._options = options || {};
    self.reports = {
        /**
         * analyticsreporting.reports.batchGet
         *
         * @desc Returns the Analytics data.
         *
         * @alias analyticsreporting.reports.batchGet
         * @memberOf! analyticsreporting(v4)
         *
         * @param {object} params Parameters for request
         * @param {analyticsreporting(v4).GetReportsRequest} params.resource Request body data
         * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
         * @param {callback} callback The callback that handles the response.
         * @return {object} Request object
         */
        batchGet: function (params, options, callback) {
            if (typeof options === 'function') {
                callback = options;
                options = {};
            }
            options || (options = {});
            const rootUrl = options.rootUrl || 'https://analyticsreporting.googleapis.com/';
            const parameters = {
                options: Object.assign({
                    url: (rootUrl + '/v4/reports:batchGet').replace(/([^:]\/)\/+/g, '$1'),
                    method: 'POST'
                }, options),
                params: params,
                requiredParams: [],
                pathParams: [],
                context: self
            };
            return apirequest_1.default(parameters, callback);
        }
    };
}
module.exports = Analyticsreporting;
//# sourceMappingURL=v4.js.map


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Collections.Generic;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script.Extensions;
using Microsoft.Azure.WebJobs.Script.WebHost.Authentication;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Azure.WebJobs.Script.WebHost.Security.Authorization.Policies
{
    public static class AuthorizationOptionsExtensions
    {
        public static void AddScriptPolicies(this AuthorizationOptions options)
        {
            options.AddPolicy(PolicyNames.AdminAuthLevel, p =>
            {
                p.AddScriptAuthenticationSchemes();
                p.AddRequirements(new AuthLevelRequirement(AuthorizationLevel.Admin));
            });

            options.AddPolicy(PolicyNames.SystemAuthLevel, p =>
            {
                p.AddScriptAuthenticationSchemes();
                p.AddRequirements(new AuthLevelRequirement(AuthorizationLevel.System));
            });

            options.AddPolicy(PolicyNames.AdminAuthLevelOrInternal, p =>
            {
                p.AddScriptAuthenticationSchemes();
                p.RequireAssertion(async c =>
                {
                    if (c.Resource is AuthorizationFilterContext filterContext)
                    {
                        if (filterContext.HttpContext.Request.IsAppServiceInternalRequest())
                        {
                            return true;
                        }

                        var authorizationService = filterContext.HttpContext.RequestServices.GetRequiredService<IAuthorizationService>();
                        AuthorizationResult result = await authorizationService.AuthorizeAsync(c.User, PolicyNames.AdminAuthLevel);

                        return result.Succeeded;
                    }

                    return false;
                });
            });
        }

        private static void AddScriptAuthenticationSchemes(this AuthorizationPolicyBuilder builder)
        {
            builder.AuthenticationSchemes.Add(ArmAuthenticationDefaults.AuthenticationScheme);
            builder.AuthenticationSchemes.Add(AuthLevelAuthenticationDefaults.AuthenticationScheme);
            builder.AuthenticationSchemes.Add(JwtBearerDefaults.AuthenticationScheme);
        }
    }
}


text:
#include <stm32f10x_rcc.h>
#include <stm32f10x_gpio.h>
#include <stm32f10x_flash.h>
#include <stm32f10x_adc.h>
#include <stm32f10x_tim.h>
#include <stm32f10x_spi.h>
#include <stm32f10x_dma.h>
#include <misc.h>

uint16_t ADCBuffer[1];
//===============================================
void RCC_Configuration(void);
void GPIO_Configuration(void);
void TIM_Configuration(void);
void SPI_Configuration(void);
void ADC_Configuration(void);
void DMA_Configuration(void);
//===============================================
void RCC_Configuration(void)
{
	FLASH_PrefetchBufferCmd(ENABLE);
	FLASH_SetLatency(FLASH_ACR_LATENCY_1);
    RCC_DeInit();
    RCC_HSEConfig(RCC_HSE_ON);
    if (RCC_WaitForHSEStartUp()==SUCCESS)
    {
    	RCC_HCLKConfig(RCC_SYSCLK_Div1);
    	RCC_PCLK1Config(RCC_HCLK_Div1);
    	RCC_PCLK2Config(RCC_HCLK_Div1);
    	RCC_ADCCLKConfig(RCC_PCLK2_Div4);
    	RCC_PLLConfig(RCC_PLLSource_PREDIV1, RCC_PLLMul_6);
    	RCC_PLLCmd(ENABLE);
    	/* Wait till PLL is ready */
    	while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {}
    	/* Select PLL as system clock source */
    	RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
    	/* Wait till PLL is used as system clock source */
    	while (RCC_GetSYSCLKSource() != 0x08) {}
    	RCC_HSICmd(DISABLE);
    }
};

void TIM_Configuration(void)
{
	TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
	TIM_OCInitTypeDef TIM_OCInitStructure;
	NVIC_InitTypeDef NVIC_InitStructure;
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7, ENABLE);
	/* Enable the TIM6 global Interrupt */
	NVIC_InitStructure.NVIC_IRQChannel = TIM7_IRQn;
	NVIC_InitStructure.NVIC_IRQChannelSubPriority =0;
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Init(&NVIC_InitStructure);
	NVIC_InitStructure.NVIC_IRQChannel = TIM6_DAC_IRQn;
	NVIC_InitStructure.NVIC_IRQChannelSubPriority =1;
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Init(&NVIC_InitStructure);

//==============================================================================

	TIM_DeInit(TIM3);
	/* Time base configuration */
	TIM_TimeBaseStructure.TIM_Period = 200;
	TIM_TimeBaseStructure.TIM_Prescaler = 4800;
	TIM_TimeBaseStructure.TIM_ClockDivision = 0x00;
	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
	TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);

	/* Channel 1, 2, 3 Configuration in PWM mode */
	TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
	TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
	TIM_OCInitStructure.TIM_Pulse = 10;
	TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
	TIM_OC2Init(TIM3, &TIM_OCInitStructure);

	/* TIM3 Enable */
	TIM_Cmd(TIM3, ENABLE);
	TIM_CtrlPWMOutputs(TIM3, ENABLE);

//==============================================================================

	/* Time base configuration */
	TIM_TimeBaseStructure.TIM_Period = 1;
	TIM_TimeBaseStructure.TIM_Prescaler = 48000;
	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
	TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure);
	/* Clear TIM2 update pending flags */
	TIM_ClearFlag(TIM6, TIM_FLAG_Update);
	/* TIM Interrupts enable */
	TIM_ITConfig(TIM6, TIM_IT_Update, ENABLE);
	/* TIM6 enable counter */
    TIM_Cmd(TIM6, ENABLE);

//==============================================================================

	/* Time base configuration */
	TIM_TimeBaseStructure.TIM_Period = 1;
	TIM_TimeBaseStructure.TIM_Prescaler = 243;
	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
	TIM_TimeBaseInit(TIM7, &TIM_TimeBaseStructure);
	/* Clear TIM2 update pending flags */
	TIM_ClearFlag(TIM7, TIM_FLAG_Update);
	/* TIM Interrupts enable */
	TIM_ITConfig(TIM7, TIM_IT_Update, ENABLE);
	/* TIM6 enable counter */
	//TIM_Cmd(TIM7, ENABLE);

//==============================================================================
};

void ADC_Configuration(void)
{
	ADC_InitTypeDef ADC_InitStructure;
	ADC_DeInit(ADC1);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
	ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
	ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
	ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
	ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
	ADC_InitStructure.ADC_NbrOfChannel = 1;
	ADC_InitStructure.ADC_ScanConvMode = ENABLE;
	ADC_Init(ADC1, &ADC_InitStructure);
	/* Convert the ADC1 Channel 10 with 239.5 Cycles as sampling time */
	ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_239Cycles5);
	/* Enable ADCperipheral */
	ADC_Cmd(ADC1, ENABLE);
	ADC_DMACmd(ADC1, ENABLE);
	ADC_ResetCalibration(ADC1);
	//while(ADC_GetResetCalibrationStatus(ADC1));
	ADC_StartCalibration(ADC1);
	//while(ADC_GetCalibrationStatus(ADC1));
	ADC_SoftwareStartConvCmd(ADC1,ENABLE);
};

void DMA_Configuration(void)
{
	DMA_InitTypeDef DMA_InitStructure;
	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1 , ENABLE) ;
	DMA_InitStructure.DMA_BufferSize= 1;
	DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
	DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
	DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)ADCBuffer;
	DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
	DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
	DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
	DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR;
	DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
	DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
	DMA_InitStructure.DMA_Priority = DMA_Priority_High;
	DMA_Init(DMA1_Channel1, &DMA_InitStructure);
	DMA_Cmd(DMA1_Channel1, ENABLE);
}

void GPIO_Configuration(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO,ENABLE);
	GPIO_PinRemapConfig (GPIO_Remap_SWJ_JTAGDisable, ENABLE);
	GPIO_PinRemapConfig (GPIO_FullRemap_TIM3, ENABLE);

	GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_0;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
	GPIO_Init(GPIOC, &GPIO_InitStructure);

	GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_8;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_Init(GPIOC, &GPIO_InitStructure);

	GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_7;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
	GPIO_Init(GPIOC, &GPIO_InitStructure);
};

void SPI_Configuration(void)
{
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);
	SPI_InitTypeDef SPI_InitStructure;
	SPI_InitStructure.SPI_BaudRatePrescaler=SPI_BaudRatePrescaler_2;
	SPI_InitStructure.SPI_CPHA=SPI_CPHA_2Edge;
	SPI_InitStructure.SPI_CPOL=SPI_CPOL_High;
	SPI_InitStructure.SPI_DataSize=SPI_DataSize_8b;
	SPI_InitStructure.SPI_Direction=SPI_Direction_2Lines_FullDuplex;
	SPI_InitStructure.SPI_FirstBit=SPI_FirstBit_MSB;
	SPI_InitStructure.SPI_Mode=SPI_Mode_Master;
	SPI_InitStructure.SPI_NSS=SPI_NSS_Soft;
	SPI_Init(SPI1,&SPI_InitStructure);
	SPI_Cmd(SPI1, ENABLE);
}


text:
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Reusable.Data;
using Reusable.OmniLog.Abstractions;

namespace Reusable.Flexo
{
    public class Matches : ValueExtension<bool>
    {
        public Matches(ILogger<Matches> logger) : base(logger, nameof(Matches)) { }

        public bool IgnoreCase { get; set; } = true;

        [JsonProperty("Value")]
        public override IExpression This { get; set; }

        public IExpression Pattern { get; set; }

        protected override Constant<bool> InvokeCore(IExpression @this)
        {
            var pattern = Pattern.Invoke().Value<string>();
            var options = IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None;
            return (Name, Regex.IsMatch(@this.Invoke().Value<string>(), pattern, options));
        }
    }
}


text:
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"

/** @addtogroup STM32F4xx_HAL_Driver
  * @{
  */

/** @defgroup FMPSMBUSEx FMPSMBUSEx
  * @brief FMPSMBUS Extended HAL module driver
  * @{
  */

#ifdef HAL_FMPSMBUS_MODULE_ENABLED
#if defined(FMPI2C_CR1_PE)

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/** @defgroup FMPSMBUSEx_Exported_Functions FMPSMBUS Extended Exported Functions
  * @{
  */

/** @defgroup FMPSMBUSEx_Exported_Functions_Group1 Extended features functions
  * @brief    Extended features functions
 *
@verbatim
 ===============================================================================
                      ##### Extended features functions #####
 ===============================================================================
    [..] This section provides functions allowing to:

      (+) Configure Fast Mode Plus

@endverbatim
  * @{
  */

/**
  * @brief Enable the FMPSMBUS fast mode plus driving capability.
  * @param ConfigFastModePlus Selects the pin.
  *   This parameter can be one of the @ref FMPSMBUSEx_FastModePlus values
  * @note  For FMPI2C1, fast mode plus driving capability can be enabled on all selected
  *        FMPI2C1 pins using FMPI2C_FASTMODEPLUS_FMPI2C1 parameter or independently
  *        on each one of the following pins PB6, PB7, PB8 and PB9.
  * @note  For remaining FMPI2C1 pins (PA14, PA15...) fast mode plus driving capability
  *        can be enabled only by using FMPI2C_FASTMODEPLUS_FMPI2C1 parameter.
  * @retval None
  */
void HAL_FMPSMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus)
{
  /* Check the parameter */
  assert_param(IS_FMPSMBUS_FASTMODEPLUS(ConfigFastModePlus));

  /* Enable SYSCFG clock */
  __HAL_RCC_SYSCFG_CLK_ENABLE();

  /* Enable fast mode plus driving capability for selected pin */
  SET_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
}

/**
  * @brief Disable the FMPSMBUS fast mode plus driving capability.
  * @param ConfigFastModePlus Selects the pin.
  *   This parameter can be one of the @ref FMPSMBUSEx_FastModePlus values
  * @note  For FMPI2C1, fast mode plus driving capability can be disabled on all selected
  *        FMPI2C1 pins using FMPI2C_FASTMODEPLUS_FMPI2C1 parameter or independently
  *        on each one of the following pins PB6, PB7, PB8 and PB9.
  * @note  For remaining FMPI2C1 pins (PA14, PA15...) fast mode plus driving capability
  *        can be disabled only by using FMPI2C_FASTMODEPLUS_FMPI2C1 parameter.
  * @retval None
  */
void HAL_FMPSMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus)
{
  /* Check the parameter */
  assert_param(IS_FMPSMBUS_FASTMODEPLUS(ConfigFastModePlus));

  /* Enable SYSCFG clock */
  __HAL_RCC_SYSCFG_CLK_ENABLE();

  /* Disable fast mode plus driving capability for selected pin */
  CLEAR_BIT(SYSCFG->CFGR, (uint32_t)ConfigFastModePlus);
}

/**
  * @}
  */

/**
  * @}
  */

#endif /* FMPI2C_CR1_PE */
#endif /* HAL_FMPSMBUS_MODULE_ENABLED */
/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
<?php

namespace WPametu\API\Rest;

use WPametu\API\Controller;
use WPametu\API\RewriteParser;
use WPametu\Exception\AuthException;

/**
 * Rest Controller base
 *
 * @package WPametu
 * @property-read \WP_User $user
 */
class RestBase extends RewriteParser {

	/**
	 * Rewrite rules array
	 *
	 * @var string
	 */
	public static $prefix = '';

	/**
	 * Is always public page
	 *
	 * @var string
	 */
	protected $screen = 'public';

	/**
	 * WP_Query instance
	 *
	 * @var \WP_Query
	 */
	protected $wp_query = null;

	/**
	 * RestBase constructor.
	 *
	 * @param array $setting Setting value.
	 */
	protected function __construct( array $setting ) {
		parent::__construct( $setting );
		// If REST API is supported, call it.
		if ( defined( 'REST_API_VERSION' ) ) {
			add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
		}
	}

	/**
	 * Override this if you need rest API
	 */
	public function rest_api_init() {}

	/**
	 * Handle request
	 *
	 * @param string $method Method name.
	 * @param string $request_method GET, POST, PUT, DELETE.
	 * @param array  $arguments Arguments as array.
	 */
	protected function handle_request( $method, $request_method, array $arguments = array() ) {
		if ( empty( $method ) || 'page' === $method ) {
			$page = max( ( isset( $arguments[0] ) ? intval( $arguments[0] ) : 1 ), 1 );
			$this->pager( $page );
			exit;
		} else {
			// Call method if exists.
			if ( $this->invoke( $method, $request_method, $arguments ) ) {
				exit;
			} else {
				$this->method_not_found();
			}
		}
	}

	/**
	 * Pager
	 *
	 * @param int $page Page number.
	 */
	protected function pager( $page = 1 ) {
		$this->method_not_found();
	}

	/**
	 * Check auth and redirect if not logged in
	 */
	protected function auth_redirect() {
		if ( ! is_user_logged_in() ) {
			auth_redirect();
			exit;
		}
	}

	/**
	 * Return url
	 *
	 * @param string $uri Get URI.
	 * @param bool   $ssl If SSL, set true.
	 *
	 * @return string
	 */
	public function url( $uri = '', $ssl = false ) {
		$class_name = get_called_class();
		$seg        = explode( '\\', $class_name );
		$base       = $seg[ count( $seg ) - 1 ];
		$prefix     = trim( $class_name::$prefix ?: $this->str->camel_to_hyphen( $base ), '/' );
		$uri        = ltrim( $uri, '/' );

		return home_url( $prefix . '/' . $uri, $ssl ? 'https' : 'http' );
	}

	/**
	 * Getter
	 *
	 * @param string $name key name.
	 *
	 * @return mixed|null|\WP_User
	 */
	public function __get( $name ) {
		switch ( $name ) {
			case 'user':
				$user = wp_get_current_user();
				return $user->ID ? $user : null;
				break;
			default:
				return parent::__get( $name );
				break;
		}
	}
}


text:
package io.getlime.security.powerauth.lib.webflow.authentication.exception;

/**
 * Exception during an authentication step.
 *
 * @author Petr Dvorak, petr@wultra.com
 */
public class AuthStepException extends Exception {

    private Integer remainingAttempts;
    private String messageId;

    /**
     * Constructor with message and message ID.
     *
     * @param message Error message.
     * @param messageId Error message localization key.
     */
    public AuthStepException(String message, String messageId) {
        super(message);
        this.messageId = messageId;
    }

    /**
     * Constructor with message and cause.
     *
     * @param message Error message.
     * @param cause   Error cause (original exception, if any).
     */
    public AuthStepException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * Constructor with message, cause and message ID.
     *
     * @param message Error message.
     * @param cause   Error cause (original exception, if any).
     * @param messageId Error message localization key.
     */
    public AuthStepException(String message, Throwable cause, String messageId) {
        super(message, cause);
        this.messageId = messageId;
    }

    /**
     * Get number of remaining authentication attempts.
     * @return Number of remaining attempts.
     */
    public Integer getRemainingAttempts() {
        return remainingAttempts;
    }

    /**
     * Set number of remaining authentication attempts.
     * @param remainingAttempts Number of remaining attempts.
     */
    public void setRemainingAttempts(Integer remainingAttempts) {
        this.remainingAttempts = remainingAttempts;
    }

    /**
     * Get error message localization key.
     * @return Error message localization key.
     */
    public String getMessageId() {
        return messageId;
    }
}


text:
//
//  ROKOComponentCustomizer.h
//  ROKOComponents
//
//  Created by Alexey Golovenkov on 17.04.15.
//  Copyright (c) 2015 ROKOLabs. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ROKOComponentScheme.h"
#import "ROKOComponent.h"

@class ROKOImageCache;

/**
 *  Block to be called when scheme loading is finished
 *
 *  @param scheme Loaded data to be parsed to sceme or nil in case of error
 *  @param error      Error description. Nil if loading finished successfully
 */
typedef void (^CustomizerCompletionBlock)(ROKOComponentScheme *scheme, NSError *error);

/**
 *  Manages schemes for different ROKO components
 */
@interface ROKOComponentCustomizer : ROKOComponent

/**
 *  Folder name for store cached scheme. Caching is not activated if this property is nil or empty string.
 */
@property (nonatomic, copy) NSString *cacheFolder;

@property (nonatomic, strong, readonly) ROKOImageCache *imagesCache;

/**
 *  Set initial data for customizer. May be overriden in inheritors.
 */
- (void)initCustomizer;

/**
 *  Loads scheme from specified URL. Returns cached scheme if exists. Response is not sending if previous request was sent less than 15 minutes ago
 *
 *  @param urlPath         URL path to scheme
 *  @param completionBlock Block that should be called
 */
- (void)loadSchemeIfNeededFromURLPath:(NSString *)urlPath withCompletionBlock:(CustomizerCompletionBlock)completionBlock;

/**
 *  Loads scheme from specified URL
 *
 *  @param urlPath         URL path to scheme
 *  @param completionBlock Block that should be called
 *
 *  @note Please do not call this method without strong reasons. Use loadSchemeIfNeededFromURLPath:withCompletionBlock: instead.
 */
- (void)loadSchemeFromURLPath:(NSString *)urlPath withCompletionBlock:(CustomizerCompletionBlock)completionBlock;

/**
 *  Saves scheme to local file
 *
 *  @param scheme       Scheme to be saved
 *  @param schemeName	Name of the scheme
 *
 *  @return YES if the scheme is written successfully, otherwise NO.
 */
- (BOOL)saveScheme:(ROKOComponentScheme *)scheme withName:(NSString *)schemeName;

/**
 *  Loads saved scheme from local storage
 *
 *  @param schemeName Name of the scheme to be loaded
 *
 *  @return Loaded scheme or nil
 */
- (ROKOComponentScheme *)savedSchemeWithName:(NSString *)schemeName;

/**
 *  Loads saved scheme from URL
 *
 *  @param schemeURL URL of the scheme to be loaded
 *
 *  @return Loadede scheme or nil
 */
- (ROKOComponentScheme *)savedSchemeWithURL:(NSURL *)schemeURL;

/**
 *  Loads image for given data object
 *
 *  @param imageObject Image data object to be loaded
 */
- (void)loadImageForObject:(ROKOImageDataObject *)imageObject;

- (ROKOComponentScheme *)parseSchemeData:(NSDictionary *)rawData;

- (NSArray *)allImageObjectsInScheme:(ROKOComponentScheme *)scheme;

- (void)addImageObjectToArray:(ROKOImageDataObject *)object toArray:(NSMutableArray *)array;

- (void)dropCacheTimer;

@end


text:
/*
 * Description:
 *     What is this file about?
 *
 * Revision history:
 *     xxxx-xx-xx, author, first version
 *     xxxx-xx-xx, author, fix bug about xxx
 */

# include <dsn/internal/task_queue.h>
# include "task_engine.h"
# include <dsn/internal/perf_counters.h>
# include <dsn/internal/network.h>
# include <cstdio>

# ifdef __TITLE__
# undef __TITLE__
# endif
# define __TITLE__ "task_queue"

namespace dsn {

task_queue::task_queue(task_worker_pool* pool, int index, task_queue* inner_provider) : _pool(pool), _controller(nullptr)
{
    char num[30];
    sprintf(num, "%u", index);
    _index = index;
    _name = pool->spec().name + '.';
    _name.append(num);
    _owner_worker = nullptr;
    _worker_count = _pool->spec().partitioned ? 1 : _pool->spec().worker_count;
    _queue_length = 0;
    _virtual_queue_length = 0;
    _enable_virtual_queue_throttling = pool->spec().enable_virtual_queue_throttling;
    if (pool->spec().throttling_delay_vector_milliseconds.size() > 0)
    {
        _delayer.initialize(
            pool->spec().throttling_delay_vector_milliseconds,
            pool->spec().queue_length_throttling_threshold
            );
    }
    else
    {
        _delayer.initialize(
            pool->spec().queue_length_throttling_threshold
            );
    }
}

void task_queue::enqueue_internal(task* task)
{
    if (task->spec().rpc_allow_throttling)
    {
        int ac_value = 0;
        if (_enable_virtual_queue_throttling)
        {
            ac_value = _virtual_queue_length;
        }
        else
        {
            ac_value = count();
        }

        int dms = _delayer.delay(ac_value);
        if (dms > 0)
        {
            rpc_request_task* rc = dynamic_cast<rpc_request_task*>(task);
            rpc_session* s = rc->get_request()->io_session.get();
            if (s != nullptr)
            {
                // delay session recv
                s->delay_rpc_request_rate(dms);
            }
        }
    }

    increase_count();
    enqueue(task);
}

}


text:
require 'spec_helper'

###
# Tests Baron::Article class
#
# This class represents an individual article

describe "Baron::Article" do
  before :all do
    @config = load_config()
    @article_parts = {:filename_and_path => "#{SAMPLE_DATA_PATH}articles/favorites/1916-01-01-the-road-not-taken.txt",
                      :date => '1916-01-01',
                      :filename => 'the-road-not-taken',
                      :category => 'poems'}
    @article = Baron::Article.new(@article_parts, @config)
  end

  describe "Provides access to properties" do
    it "should return input parameters" do
      expect(@article[:filename_and_path]).to eq(@article_parts[:filename_and_path])
      expect(@article[:date]).to be_instance_of(Date)
      expect(@article[:category]).to eq(@article_parts[:category])
    end

    it "should return article data correctly" do
      expect(@article[:title]).to eq('The Road Not Taken')
      expect(@article.title).to eq('The Road Not Taken')
      expect(@article.date).to eq('01/01/1916')
      expect(@article.date_iso8601).to eq('1916-01-01T00:00:00+00:00')
      expect(@article[:author]).to eq('Robert Frost')
      expect(@article.author).to eq('Robert Frost')
      expect(@article[:body].length).to be > 0
      expect(@article[:category]).to eq('poems')
      expect(@article.category).to eq('poems')
      expect(@article[:slug]).to eq('the-road-not-taken')
      expect(@article.slug).to eq('the-road-not-taken')
    end

    it "should handle different path configuations" do
      expect(@article.path('', :no_date)).to eq('/poems/the-road-not-taken/')
      expect(@article.path('', :year_month_day_date)).to eq('/poems/1916/01/01/the-road-not-taken/')
      expect(@article.path('', :year_month_date)).to eq('/poems/1916/01/the-road-not-taken/')
      expect(@article.path('', :year_date)).to eq('/poems/1916/the-road-not-taken/')
      expect(@article.path('posts', :no_date)).to eq('/posts/poems/the-road-not-taken/')
      expect(@article.path('posts', :year_month_day_date)).to eq('/posts/poems/1916/01/01/the-road-not-taken/')
      expect(@article.path('posts', :year_month_date)).to eq('/posts/poems/1916/01/the-road-not-taken/')
      expect(@article.path('posts', :year_date)).to eq('/posts/poems/1916/the-road-not-taken/')
      expect(@article.path('/foo/bar/', :no_date)).to eq('/foo/bar/poems/the-road-not-taken/')
      expect(@article.path('/foo/bar/', :year_month_day_date)).to eq('/foo/bar/poems/1916/01/01/the-road-not-taken/')
      expect(@article.path('/foo/bar/', :year_month_date)).to eq('/foo/bar/poems/1916/01/the-road-not-taken/')
      expect(@article.path('/foo/bar/', :year_date)).to eq('/foo/bar/poems/1916/the-road-not-taken/')
    end

    it "should create values correctly" do
      expect(Baron::Article.create_filename_without_extension "B's Cookies & Cream 2,3,4", Date.new(2016,6,15)).to eq("2016-06-15-b-s-cookies---cream-2-3-4")
    end

  end
end


text:
class LeftPanelController {
  constructor($scope, $stateParams, rVersion, GLOBALS, LeftPanelStore, LeftPanelActionsFactory, PluginActionsFactory, ConfigStore, ConfigActionsFactory, MyDAGFactory, NodesActionsFactory, NonStorePipelineErrorFactory, HydratorService) {
    this.$scope = $scope;
    this.$stateParams = $stateParams;
    this.LeftPanelStore = LeftPanelStore;
    this.LeftPanelActionsFactory = LeftPanelActionsFactory;
    this.PluginActionsFactory = PluginActionsFactory;
    this.ConfigActionsFactory = ConfigActionsFactory;
    this.GLOBALS = GLOBALS;
    this.ConfigStore = ConfigStore;
    this.MyDAGFactory = MyDAGFactory;
    this.NodesActionsFactory = NodesActionsFactory;
    this.NonStorePipelineErrorFactory = NonStorePipelineErrorFactory;
    this.HydratorService = HydratorService;

    this.pluginTypes = [
      {
        name: 'source',
        expanded: false,
        plugins: []
      },
      {
        name: 'transform',
        expanded: false,
        plugins: []
      },
      {
        name: 'sink',
        expanded: false,
        plugins: []
      }
    ];
    this.sourcesToVersionMap = {};
    this.transformsToVersionMap = {};
    this.sinksToVersionMap = {};

    this.LeftPanelStore.registerOnChangeListener(() => {
      this.pluginTypes[0].plugins = this.LeftPanelStore.getSources();
      this.pluginTypes[1].plugins = this.LeftPanelStore.getTransforms();
      this.pluginTypes[2].plugins = this.LeftPanelStore.getSinks();
    });

    let params = {
      namespace: this.$stateParams.namespace,
      pipelineType: ConfigStore.getArtifact().name,
      version: rVersion.version,
      scope: this.$scope
    };
    this.PluginActionsFactory.fetchSources(params);
    this.PluginActionsFactory.fetchTransforms(params);
    this.PluginActionsFactory.fetchSinks(params);
    this.PluginActionsFactory.fetchTemplates(params);

  }

  onLeftSidePanelItemClicked(event, node) {
    event.stopPropagation();
    var item = this.LeftPanelStore.getSpecificPluginVersion(node);
    this.NodesActionsFactory.resetSelectedNode();
    this.LeftPanelStore.updatePluginDefaultVersion(item);

    let name = item.name || item.pluginTemplate;

    let filteredNodes = this.ConfigStore
                    .getNodes()
                    .filter( node => (node.plugin.label ? node.plugin.label.includes(name) : false) );
    let config;
    if (item.pluginTemplate) {
      config = {
        plugin: {
          label: (filteredNodes.length > 0 ? item.pluginTemplate + (filteredNodes.length+1): item.pluginTemplate),
          name: item.pluginName,
          artifact: item.artifact,
          properties: item.properties,
        },
        icon: this.MyDAGFactory.getIcon(item.pluginName),
        type: item.pluginType,
        outputSchema: item.outputSchema,
        inputSchema: item.inputSchema,
        pluginTemplate: item.pluginTemplate,
        lock: item.lock
      };
    } else {
      config = {
        plugin: {
          label: (filteredNodes.length > 0 ? item.name + (filteredNodes.length+1): item.name),
          artifact: item.artifact,
          name: item.name,
          properties: {}
        },
        icon: item.icon,
        description: item.description,
        type: item.type,
        warning: true
      };
    }
    this.NodesActionsFactory.addNode(config);
  }
}

LeftPanelController.$inject = ['$scope', '$stateParams', 'rVersion', 'GLOBALS', 'LeftPanelStore', 'LeftPanelActionsFactory', 'PluginActionsFactory', 'ConfigStore', 'ConfigActionsFactory', 'MyDAGFactory', 'NodesActionsFactory', 'NonStorePipelineErrorFactory', 'HydratorService'];
angular.module(PKG.name + '.feature.hydrator')
  .controller('LeftPanelController', LeftPanelController);


text:
#import <XCTest/XCTest.h>
#import "IPTransportInfo.h"
#import "KeyUtils.h"
#import "TransportProtocolIdHolder.h"
#import "TestsHelper.h"

@interface IPTransportInfoTest : XCTestCase

@end

@implementation IPTransportInfoTest

- (void)testInit {
    [KeyUtils generateKeyPair];
    NSData *publicKey = [KeyUtils getPublicKey];
    TransportProtocolId *TPid = [TransportProtocolIdHolder TCPTransportID];
    uint32_t port = 80;

    IPTransportInfo *info = [[IPTransportInfo alloc] initWithTransportInfo:[self createTestServerInfoWithServerType:SERVER_OPERATIONS transportProtocolId:TPid host:@"localhost" port:port publicKey:publicKey]];

    XCTAssertEqual(SERVER_OPERATIONS, [info serverType]);
    XCTAssertEqualObjects(TPid, [info transportId]);
    XCTAssertEqualObjects(@"localhost", [info getHost]);
    XCTAssertEqual(port, [info getPort]);
}

- (id<TransportConnectionInfo>)createTestServerInfoWithServerType:(ServerType)serverType
                                              transportProtocolId:(TransportProtocolId *)TPid
                                                             host:(NSString *)host
                                                             port:(uint32_t)port
                                                        publicKey:(NSData *)publicKey {
    ProtocolMetaData *md = [TestsHelper buildMetaDataWithTransportProtocolId:TPid host:host port:port publicKey:publicKey];
    return  [[GenericTransportInfo alloc] initWithServerType:serverType meta:md];
}

@end