text:
require 'fileutils'

module ActionController #:nodoc:
  # Caching is a cheap way of speeding up slow applications by keeping the result of calculations, renderings, and database calls
  # around for subsequent requests. Action Controller affords you three approaches in varying levels of granularity: Page, Action, Fragment.
  #
  # You can read more about each approach and the sweeping assistance by clicking the modules below.
  #
  # Note: To turn off all caching and sweeping, set Base.perform_caching = false.
  module Caching
    def self.included(base) #:nodoc:
      base.send(:include, Pages, Actions, Fragments, Sweeping)

      base.class_eval do
        @@perform_caching = true
        cattr_accessor :perform_caching
      end
    end

    # Page caching is an approach to caching where the entire action output of is stored as a HTML file that the web server
    # can serve without going through the Action Pack. This can be as much as 100 times faster than going through the process of dynamically
    # generating the content. Unfortunately, this incredible speed-up is only available to stateless pages where all visitors
    # are treated the same. Content management systems -- including weblogs and wikis -- have many pages that are a great fit
    # for this approach, but account-based systems where people log in and manipulate their own data are often less likely candidates.
    #
    # Specifying which actions to cache is done through the <tt>caches</tt> class method:
    #
    #   class WeblogController < ActionController::Base
    #     caches_page :show, :new
    #   end
    #
    # This will generate cache files such as weblog/show/5 and weblog/new, which match the URLs used to trigger the dynamic
    # generation. This is how the web server is able pick up a cache file when it exists and otherwise let the request pass on to
    # the Action Pack to generate it.
    #
    # Expiration of the cache is handled by deleting the cached file, which results in a lazy regeneration approach where the cache
    # is not restored before another hit is made against it. The API for doing so mimics the options from url_for and friends:
    #
    #   class WeblogController < ActionController::Base
    #     def update
    #       List.update(params[:list][:id], params[:list])
    #       expire_page :action => "show", :id => params[:list][:id]
    #       redirect_to :action => "show", :id => params[:list][:id]
    #     end
    #   end
    #
    # Additionally, you can expire caches using Sweepers that act on changes in the model to determine when a cache is supposed to be
    # expired.
    #
    # == Setting the cache directory
    #
    # The cache directory should be the document root for the web server and is set using Base.page_cache_directory = "/document/root".
    # For Rails, this directory has already been set to RAILS_ROOT + "/public".
    #
    # == Setting the cache extension
    #
    # By default, the cache extension is .html, which makes it easy for the cached files to be picked up by the web server. If you want
    # something else, like .php or .shtml, just set Base.page_cache_extension.
    module Pages
      def self.included(base) #:nodoc:
        base.extend(ClassMethods)
        base.class_eval do
          @@page_cache_directory = defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/public" : ""
          cattr_accessor :page_cache_directory

          @@page_cache_extension = '.html'
          cattr_accessor :page_cache_extension
        end
      end

      module ClassMethods
        # Expires the page that was cached with the +path+ as a key. Example:
        #   expire_page "/lists/show"
        def expire_page(path)
          return unless perform_caching

          benchmark "Expired page: #{page_cache_file(path)}" do
            File.delete(page_cache_path(path)) if File.exists?(page_cache_path(path))
          end
        end

        # Manually cache the +content+ in the key determined by +path+. Example:
        #   cache_page "I'm the cached content", "/lists/show"
        def cache_page(content, path)
          return unless perform_caching

          benchmark "Cached page: #{page_cache_file(path)}" do
            FileUtils.makedirs(File.dirname(page_cache_path(path)))
            File.open(page_cache_path(path), "wb+") { |f| f.write(content) }
          end
        end

        # Caches the +actions+ using the page-caching approach that'll store the cache in a path within the page_cache_directory that
        # matches the triggering url.
        def caches_page(*actions)
          return unless perform_caching
          actions.each do |action|
            class_eval "after_filter { |c| c.cache_page if c.action_name == '#{action}' }"
          end
        end

        private
          def page_cache_file(path)
            name = ((path.empty? || path == "/") ? "/index" : URI.unescape(path))
            name << page_cache_extension unless (name.split('/').last || name).include? '.'
            return name
          end

          def page_cache_path(path)
            page_cache_directory + page_cache_file(path)
          end
      end

      # Expires the page that was cached with the +options+ as a key. Example:
      #   expire_page :controller => "lists", :action => "show"
      def expire_page(options = {})
        return unless perform_caching
        if options[:action].is_a?(Array)
          options[:action].dup.each do |action|
            self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true, :action => action })))
          end
        else
          self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
        end
      end

      # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of @response.body is used
      # If no options are provided, the current +options+ for this action is used. Example:
      #   cache_page "I'm the cached content", :controller => "lists", :action => "show"
      def cache_page(content = nil, options = {})
        return unless perform_caching && caching_allowed
        self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
      end

      private
        def caching_allowed
          !@request.post? && @response.headers['Status'] && @response.headers['Status'].to_i < 400
        end
    end

    # Action caching is similar to page caching by the fact that the entire output of the response is cached, but unlike page caching,
    # every request still goes through the Action Pack. The key benefit of this is that filters are run before the cache is served, which
    # allows for authentication and other restrictions on whether someone is allowed to see the cache. Example:
    #
    #   class ListsController < ApplicationController
    #     before_filter :authenticate, :except => :public
    #     caches_page   :public
    #     caches_action :show, :feed
    #   end
    #
    # In this example, the public action doesn't require authentication, so it's possible to use the faster page caching method. But both the
    # show and feed action are to be shielded behind the authenticate filter, so we need to implement those as action caches.
    #
    # Action caching internally uses the fragment caching and an around filter to do the job. The fragment cache is named according to both
    # the current host and the path. So a page that is accessed at http://david.somewhere.com/lists/show/1 will result in a fragment named
    # "david.somewhere.com/lists/show/1". This allows the cacher to differentiate between "david.somewhere.com/lists/" and
    # "jamis.somewhere.com/lists/" -- which is a helpful way of assisting the subdomain-as-account-key pattern.
    module Actions
      def self.append_features(base) #:nodoc:
        super
        base.extend(ClassMethods)
        base.send(:attr_accessor, :rendered_action_cache)
      end

      module ClassMethods #:nodoc:
        def caches_action(*actions)
          return unless perform_caching
          around_filter(ActionCacheFilter.new(*actions))
        end
      end

      def expire_action(options = {})
        return unless perform_caching
        if options[:action].is_a?(Array)
          options[:action].dup.each do |action|
            expire_fragment(url_for(options.merge({ :action => action })).split("://").last)
          end
        else
          expire_fragment(url_for(options).split("://").last)
        end
      end

      class ActionCacheFilter #:nodoc:
        def initialize(*actions)
          @actions = actions
        end

        def before(controller)
          return unless @actions.include?(controller.action_name.intern)
          if cache = controller.read_fragment(controller.url_for.split("://").last)
            controller.rendered_action_cache = true
            controller.send(:render_text, cache)
            false
          end
        end

        def after(controller)
          return if !@actions.include?(controller.action_name.intern) || controller.rendered_action_cache
          controller.write_fragment(controller.url_for.split("://").last, controller.response.body)
        end
      end
    end

    # Fragment caching is used for caching various blocks within templates without caching the entire action as a whole. This is useful when
    # certain elements of an action change frequently or depend on complicated state while other parts rarely change or can be shared amongst multiple
    # parties. The caching is doing using the cache helper available in the Action View. A template with caching might look something like:
    #
    #   <b>Hello <%= @name %></b>
    #   <% cache do %>
    #     All the topics in the system:
    #     <%= render_collection_of_partials "topic", Topic.find_all %>
    #   <% end %>
    #
    # This cache will bind to the name of action that called it. So you would be able to invalidate it using
    # <tt>expire_fragment(:controller => "topics", :action => "list")</tt> -- if that was the controller/action used. This is not too helpful
    # if you need to cache multiple fragments per action or if the action itself is cached using <tt>caches_action</tt>. So instead we should
    # qualify the name of the action used with something like:
    #
    #   <% cache(:action => "list", :action_suffix => "all_topics") do %>
    #
    # That would result in a name such as "/topics/list/all_topics", which wouldn't conflict with any action cache and neither with another
    # fragment using a different suffix. Note that the URL doesn't have to really exist or be callable. We're just using the url_for system
    # to generate unique cache names that we can refer to later for expirations. The expiration call for this example would be
    # <tt>expire_fragment(:controller => "topics", :action => "list", :action_suffix => "all_topics")</tt>.
    #
    # == Fragment stores
    #
    # In order to use the fragment caching, you need to designate where the caches should be stored. This is done by assigning a fragment store
    # of which there are four different kinds:
    #
    # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and shares the fragments for
    #   all the web server processes running off the same application directory.
    # * MemoryStore: Keeps the fragments in memory, which is fine for WEBrick and for FCGI (if you don't care that each FCGI process holds its
    #   own fragment store). It's not suitable for CGI as the process is thrown away at the end of each request. It can potentially also take
    #   up a lot of memory since each process keeps all the caches in memory.
    # * DRbStore: Keeps the fragments in the memory of a separate, shared DRb process. This works for all environments and only keeps one cache
    #   around for all processes, but requires that you run and manage a separate DRb process.
    # * MemCacheStore: Works like DRbStore, but uses Danga's MemCache instead.
    #   Requires the ruby-memcache library:  gem install ruby-memcache.
    #
    # Configuration examples (MemoryStore is the default):
    #
    #   ActionController::Base.fragment_cache_store = :memory_store
    #   ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
    #   ActionController::Base.fragment_cache_store = :drb_store, "druby://localhost:9192"
    #   ActionController::Base.fragment_cache_store = :mem_cache_store, "localhost"
    #   ActionController::Base.fragment_cache_store = MyOwnStore.new("parameter")
    module Fragments
      def self.append_features(base) #:nodoc:
        super
        base.class_eval do
          @@fragment_cache_store = MemoryStore.new
          cattr_reader :fragment_cache_store

          def self.fragment_cache_store=(store_option)
            store, *parameters = *([ store_option ].flatten)
            @@fragment_cache_store = if store.is_a?(Symbol)
              store_class_name = (store == :drb_store ? "DRbStore" : store.to_s.camelize)
              store_class = ActionController::Caching::Fragments.const_get(store_class_name)
              store_class.new(*parameters)
            else
              store
            end
          end
        end
      end

      def fragment_cache_key(name)
        name.is_a?(Hash) ? url_for(name).split("://").last : name
      end

      # Called by CacheHelper#cache
      def cache_erb_fragment(block, name = {}, options = nil)
        unless perform_caching then block.call; return end

        buffer = eval("_erbout", block.binding)

        if cache = read_fragment(name, options)
          buffer.concat(cache)
        else
          pos = buffer.length
          block.call
          write_fragment(name, buffer[pos..-1], options)
        end
      end

      def write_fragment(name, content, options = nil)
        return unless perform_caching

        key = fragment_cache_key(name)
        self.class.benchmark "Cached fragment: #{key}" do
          fragment_cache_store.write(key, content, options)
        end
        content
      end

      def read_fragment(name, options = nil)
        return unless perform_caching

        key = fragment_cache_key(name)
        self.class.benchmark "Fragment read: #{key}" do
          fragment_cache_store.read(key, options)
        end
      end

      # Name can take one of three forms:
      # * String: This would normally take the form of a path like "pages/45/notes"
      # * Hash: Is treated as an implicit call to url_for, like { :controller => "pages", :action => "notes", :id => 45 }
      # * Regexp: Will destroy all the matched fragments, example: %r{pages/\d*/notes} Ensure you do not specify start and finish in the regex (^$) because the actual filename matched looks like ./cache/filename/path.cache
      def expire_fragment(name, options = nil)
        return unless perform_caching

        key = fragment_cache_key(name)

        if key.is_a?(Regexp)
          self.class.benchmark "Expired fragments matching: #{key.source}" do
            fragment_cache_store.delete_matched(key, options)
          end
        else
          self.class.benchmark "Expired fragment: #{key}" do
            fragment_cache_store.delete(key, options)
          end
        end
      end

      # Deprecated -- just call expire_fragment with a regular expression
      def expire_matched_fragments(matcher = /.*/, options = nil) #:nodoc:
        expire_fragment(matcher, options)
      end

      class UnthreadedMemoryStore #:nodoc:
        def initialize #:nodoc:
          @data = {}
        end

        def read(name, options=nil) #:nodoc:
          @data[name]
        end

        def write(name, value, options=nil) #:nodoc:
          @data[name] = value
        end

        def delete(name, options=nil) #:nodoc:
          @data.delete(name)
        end

        def delete_matched(matcher, options=nil) #:nodoc:
          @data.delete_if { |k,v| k =~ matcher }
        end
      end

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

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

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

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

      class MemoryStore < UnthreadedMemoryStore #:nodoc:
        def initialize #:nodoc:
          super
          if ActionController::Base.allow_concurrency
            @mutex = Mutex.new
            MemoryStore.send(:include, ThreadSafety)
          end
        end
      end

      class DRbStore < MemoryStore #:nodoc:
        attr_reader :address

        def initialize(address = 'druby://localhost:9192')
          super()
          @address = address
          @data = DRbObject.new(nil, address)
        end
      end

      class MemCacheStore < MemoryStore #:nodoc:
        attr_reader :addresses

        def initialize(*addresses)
          super()
          addresses = addresses.flatten
          addresses = ["localhost"] if addresses.empty?
          @addresses = addresses
          @data = MemCache.new(*addresses)
        end
      end

      class UnthreadedFileStore #:nodoc:
        attr_reader :cache_path

        def initialize(cache_path)
          @cache_path = cache_path
        end

        def write(name, value, options = nil) #:nodoc:
          ensure_cache_path(File.dirname(real_file_path(name)))
          File.open(real_file_path(name), "wb+") { |f| f.write(value) }
        rescue => e
          Base.logger.error "Couldn't create cache directory: #{name} (#{e.message})" if Base.logger
        end

        def read(name, options = nil) #:nodoc:
          File.open(real_file_path(name), 'rb') { |f| f.read } rescue nil
        end

        def delete(name, options) #:nodoc:
          File.delete(real_file_path(name))
        rescue SystemCallError => e
          # If there's no cache, then there's nothing to complain about
        end

        def delete_matched(matcher, options) #:nodoc:
          search_dir(@cache_path) do |f|
            if f =~ matcher
              begin
                File.delete(f)
              rescue Object => e
                # If there's no cache, then there's nothing to complain about
              end
            end
          end
        end

        private
          def real_file_path(name)
            '%s/%s.cache' % [@cache_path, name.gsub('?', '.').gsub(':', '.')]
          end

          def ensure_cache_path(path)
            FileUtils.makedirs(path) unless File.exists?(path)
          end

          def search_dir(dir, &callback)
            Dir.foreach(dir) do |d|
              next if d == "." || d == ".."
              name = File.join(dir, d)
              if File.directory?(name)
                search_dir(name, &callback)
              else
                callback.call name
              end
            end
          end
        end

        class FileStore < UnthreadedFileStore #:nodoc:
          def initialize(cache_path)
            super(cache_path)
            if ActionController::Base.allow_concurrency
              @mutex = Mutex.new
              FileStore.send(:include, ThreadSafety)
            end
          end
        end
    end

    # Sweepers are the terminators of the caching world and responsible for expiring caches when model objects change.
    # They do this by being half-observers, half-filters and implementing callbacks for both roles. A Sweeper example:
    #
    #   class ListSweeper < ActionController::Caching::Sweeper
    #     observe List, Item
    #
    #     def after_save(record)
    #       list = record.is_a?(List) ? record : record.list
    #       expire_page(:controller => "lists", :action => %w( show public feed ), :id => list.id)
    #       expire_action(:controller => "lists", :action => "all")
    #       list.shares.each { |share| expire_page(:controller => "lists", :action => "show", :id => share.url_key) }
    #     end
    #   end
    #
    # The sweeper is assigned in the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method:
    #
    #   class ListsController < ApplicationController
    #     caches_action :index, :show, :public, :feed
    #     cache_sweeper :list_sweeper, :only => [ :edit, :destroy, :share ]
    #   end
    #
    # In the example above, four actions are cached and three actions are responsible for expiring those caches.
    module Sweeping
      def self.append_features(base) #:nodoc:
        super
        base.extend(ClassMethods)
      end

      module ClassMethods #:nodoc:
        def cache_sweeper(*sweepers)
          return unless perform_caching
          configuration = sweepers.last.is_a?(Hash) ? sweepers.pop : {}
          sweepers.each do |sweeper|
            observer(sweeper)

            sweeper_instance = Object.const_get(Inflector.classify(sweeper)).instance

            if sweeper_instance.is_a?(Sweeper)
              around_filter(sweeper_instance, :only => configuration[:only])
            else
              after_filter(sweeper_instance, :only => configuration[:only])
            end
          end
        end
      end
    end

    if defined?(ActiveRecord) and defined?(ActiveRecord::Observer)
      class Sweeper < ActiveRecord::Observer #:nodoc:
        attr_accessor :controller

        # ActiveRecord::Observer will mark this class as reloadable even though it should not be.
        # However, subclasses of ActionController::Caching::Sweeper should be Reloadable
        include Reloadable::Subclasses

        def before(controller)
          self.controller = controller
          callback(:before)
        end

        def after(controller)
          callback(:after)
          # Clean up, so that the controller can be collected after this request
          self.controller = nil
        end

        private
          def callback(timing)
            controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"
            action_callback_method_name     = "#{controller_callback_method_name}_#{controller.action_name}"

            send(controller_callback_method_name) if respond_to?(controller_callback_method_name)
            send(action_callback_method_name)     if respond_to?(action_callback_method_name)
          end

          def method_missing(method, *arguments)
            return if @controller.nil?
            @controller.send(method, *arguments)
          end
      end
    end
  end
end


text:
<?php

namespace Monolog\Handler;

use Monolog\Logger;

/**
 * Buffers all records until closing the handler and then pass them as batch.
 *
 * This is useful for a MailHandler to send only one mail per request instead of
 * sending one per log message.
 *
 * @author Christophe Coevoet <stof@notk.org>
 */
class BufferHandler extends AbstractHandler
{
    protected $handler;
    protected $bufferSize;
    protected $buffer = array();

    /**
     * @param HandlerInterface $handler    Handler.
     * @param integer          $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
     * @param integer          $level      The minimum logging level at which this handler will be triggered
     * @param Boolean          $bubble     Whether the messages that are handled can bubble up the stack or not
     */
    public function __construct(HandlerInterface $handler, $bufferSize = 0, $level = Logger::DEBUG, $bubble = true)
    {
        parent::__construct($level, $bubble);
        $this->handler = $handler;
        $this->bufferSize = $bufferSize;

        // __destructor() doesn't get called on Fatal errors
        register_shutdown_function(array($this, 'close'));
    }

    /**
     * {@inheritdoc}
     */
    public function handle(array $record)
    {
        if ($record['level'] < $this->level) {
            return false;
        }

        $this->buffer[] = $record;
        if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
            array_shift($this->buffer);
        }

        return false === $this->bubble;
    }

    /**
     * {@inheritdoc}
     */
    public function close()
    {
        if ($this->buffer) {
            $this->handler->handleBatch($this->buffer);
            $this->buffer = array();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
"use strict";
var system = require('system');

system.stdout.write('Hello, system.stdout.write!');
system.stdout.writeLine('\nHello, system.stdout.writeLine!');

system.stderr.write('Hello, system.stderr.write!');
system.stderr.writeLine('\nHello, system.stderr.writeLine!');

system.stdout.writeLine('system.stdin.readLine(): ');
var line = system.stdin.readLine();
system.stdout.writeLine(JSON.stringify(line));

// This is essentially a `readAll`
system.stdout.writeLine('system.stdin.read(5): (ctrl+D to end)');
var input = system.stdin.read(5);
system.stdout.writeLine(JSON.stringify(input));

phantom.exit(0);


text:
/*
* @Author: Sebastien Soudan
* @Date:   2015-10-14 16:21:19
* @Last Modified by:   Sebastien Soudan
* @Last Modified time: 2015-10-14 18:53:56
*/

'use strict';

var keyMirror = require('keymirror');

module.exports = keyMirror({
    CONTROL_UPDATE_AUTOPILOT_DATA: null,
    CONTROL_UPDATE_DASHBOARD_DATA: null,
    CONTROL_QUERY_AUTOPILOT: null,
    CONTROL_QUERY_DASHBOARD: null,
});


text:
<?php
/**
 * Elgg owner block
 * Displays page ownership information
 *
 * @package Elgg
 * @subpackage Core
 *
 */

elgg_push_context('owner_block');

// groups and other users get owner block
$owner = elgg_get_page_owner_entity();
if ($owner instanceof ElggGroup || $owner instanceof ElggUser) {

	$header = elgg_view_entity($owner, array('full_view' => false));

	$body = elgg_view_menu('owner_block', array('entity' => $owner));

	$body .= elgg_view('page/elements/owner_block/extend', $vars);

	echo elgg_view('page/components/module', array(
		'header' => $header,
		'body' => $body,
		'class' => 'elgg-owner-block',
	));
}

elgg_pop_context();


text:
@class NSArray, NSDictionary, NSNumber, NSString, NSValue, UIAXElement;

@protocol UIAXElement
+ (NSString *)stringForTraits:(unsigned long long)arg1;
+ (NSString *)stringForAXNotification:(int)arg1;
+ (NSString *)stringForAXError:(int)arg1;
+ (id)uiaxAccessibilityUIServerElement;
+ (id)uiaxFocusedApplicationElement;
+ (id)uiaxSpringBoardElement;
+ (id)uiaxSystemApplicationElement;
+ (id)uiaxSystemWideElement;
+ (id)uiaxElementAtPosition:(struct CGPoint)arg1;
+ (id)uiaxApplicationAtPosition:(struct CGPoint)arg1;
+ (id)uiaxElementWithAXUIElementRef:(struct __AXUIElement *)arg1;
+ (_Bool)unregisterObserver:(struct __AXObserver *)arg1 forAXNotification:(int)arg2;
+ (_Bool)registerObserver:(struct __AXObserver *)arg1 forAXNotification:(int)arg2;
+ (_Bool)registerObserver:(struct __AXObserver *)arg1 forAXNotifications:(_Bool)arg2;
- (NSArray *)ancestry;
- (NSArray *)descendantsWithAttributes:(NSDictionary *)arg1 traits:(unsigned long long)arg2;
- (UIAXElement *)descendantWithTestingTrait:(NSString *)arg1;
- (NSArray *)descendants;
- (UIAXElement *)childWithTestingTrait:(NSString *)arg1;
- (NSArray *)children;
- (UIAXElement *)responder;
- (UIAXElement *)parent;
- (UIAXElement *)firstElementOfAttribute:(int)arg1 withValue:(id)arg2 forAttribute:(int)arg3;
- (NSString *)description;
- (NSValue *)centerPoint;
- (NSValue *)rect;
- (NSValue *)hitpoint;
- (unsigned long long)traits;
- (NSNumber *)traitsNumber;
- (NSString *)stringForAllKnownAttributes;
- (NSString *)stringForAttributes:(NSArray *)arg1;
- (NSDictionary *)valuesForAllKnownAttributes;
- (_Bool)checkIsValid;
- (_Bool)isValid;
- (int)axError;
- (int)pid;
- (_Bool)performAXAction:(int)arg1 withValue:(id)arg2;
- (_Bool)performAXAction:(int)arg1;
- (id)valueForAttribute:(int)arg1 parameter:(id)arg2;
- (NSDictionary *)valuesForAttributes:(NSArray *)arg1;
- (_Bool)setValue:(id)arg1 forAttribute:(int)arg2;
- (id)valueForAttribute:(int)arg1;
- (struct __AXUIElement *)axuiElementRef;
@end


text: <img src="/assets/img/ztylekitchen/fpo_square.png" alt="Square Thumbnail">


text:
<?php

/**
 * @category   Zend
 * @package    Zend_Mail
 * @subpackage Storage
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

interface Zend_Mail_Message_Interface
{
    /**
     * return toplines as found after headers
     *
     * @return string toplines
     */
    public function getTopLines();

    /**
     * check if flag is set
     *
     * @param mixed $flag a flag name, use constants defined in Zend_Mail_Storage
     * @return bool true if set, otherwise false
     */
    public function hasFlag($flag);

    /**
     * get all set flags
     *
     * @return array array with flags, key and value are the same for easy lookup
     */
    public function getFlags();
}


text:
def static_var(varName, value):
    def decorate(function):
        setattr(function, varName, value)
        return function
    return decorate


text:
//==================================================================================
// BSD 2-Clause License
//
// Copyright (c) 2014-2022, NJIT, Duality Technologies Inc. and other contributors
//
// All rights reserved.
//
// Author TPOC: contact@openfhe.org
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

/*
  This code exercises the block allocator utility of the OpenFHE lattice encryption library
 */

// #define PROFILE  //uncomment to print out elapsed time

#include <assert.h>
#include <stdio.h>

#include <iostream>
#include <new>

#include "gtest/gtest.h"

#include "math/hal.h"
#include "utils/debug.h"
#include "utils/inttypes.h"
#include "utils/utilities.h"

#include "utils/blockAllocator/xlist.h"
#include "utils/blockAllocator/xmap.h"
#include "utils/blockAllocator/xqueue.h"
#include "utils/blockAllocator/xset.h"
#include "utils/blockAllocator/xsstream.h"
#include "utils/blockAllocator/xstring.h"
#include "utils/blockAllocator/xvector.h"

using namespace lbcrypto;

class UnitTestBinInt : public ::testing::Test {
protected:
    virtual void SetUp() {}

    virtual void TearDown() {
        // Code here will be called immediately after each test
        // (right before the destructor).
    }
};

/************************************************/
/*  TESTING METHODS OF Allocator CLASS    */
/************************************************/

// On VisualStudio, to disable the debug heap for faster performance when using
// the debugger use this option:
// Debugging > Environment _NO_DEBUG_HEAP=1

// static int MAX_BENCHMARK = 10000;
static int MAX_BENCHMARK = 1024;

typedef void (*TestFunc)();
void ListGlobalHeapTest();
void MapGlobalHeapTest();
void StringGlobalHeapTest();
void ListFixedBlockTest();
void MapFixedBlockTest();
void StringFixedBlockTest();
void Benchmark(const char* name, TestFunc testFunc);

static void out_of_memory() {
    // new-handler function called by Allocator when pool is out of memory
    xalloc_stats();
#if 0
  std::bad_alloc exception;
  throw(exception);
#else
    assert(0);
#endif
}

//------------------------------------------------------------------------------
// MapGlobalHeapTest
//------------------------------------------------------------------------------
void MapGlobalHeapTest() {
    std::map<int, char> myMap;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myMap[i] = 'a';
    myMap.clear();
}

//------------------------------------------------------------------------------
// MapFixedBlockTest
//------------------------------------------------------------------------------
void MapFixedBlockTest() {
    xmap<int, char> myMap;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myMap[i] = 'a';
    myMap.clear();
}

//------------------------------------------------------------------------------
// ListGlobalHeapTest
//------------------------------------------------------------------------------
void ListGlobalHeapTest() {
    std::list<int> myList;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myList.push_back(123);
    myList.clear();
}

//------------------------------------------------------------------------------
// ListFixedBlockTest
//------------------------------------------------------------------------------
void ListFixedBlockTest() {
    xlist<int> myList;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myList.push_back(123);
    myList.clear();
}

//------------------------------------------------------------------------------
// VectorGlobalHeapTest
//------------------------------------------------------------------------------
void VectorGlobalHeapTest() {
    std::vector<int> myVector;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myVector.push_back(123);
    myVector.clear();
}

//------------------------------------------------------------------------------
// VectorFixedBlockTest
//------------------------------------------------------------------------------
void VectorFixedBlockTest() {
    xvector<int> myVector;
    for (int i = 0; i < MAX_BENCHMARK; i++)
        myVector.push_back(123);
    myVector.clear();
}

//------------------------------------------------------------------------------
// StringGlobalHeapTest
//------------------------------------------------------------------------------
void StringGlobalHeapTest() {
    std::list<std::string> myList;
    for (int i = 0; i < MAX_BENCHMARK; i++) {
        std::string myString("benchmark");
        myString +=
            "benchmark test benchmark test benchmark test benchmark test benchmark "
            "test benchmark test benchmark test "
            "benchmark test benchmark test benchmark test benchmark test benchmark "
            "test benchmark test benchmark test";
        myList.push_back(myString);
    }
    myList.clear();
}

//------------------------------------------------------------------------------
// StringFixedBlockTest
//------------------------------------------------------------------------------
void StringFixedBlockTest() {
    xlist<xstring> myList;
    for (int i = 0; i < MAX_BENCHMARK; i++) {
        xstring myString("benchmark");
        myString +=
            "benchmark test benchmark test benchmark test benchmark test benchmark "
            "test benchmark test benchmark test "
            "benchmark test benchmark test benchmark test benchmark test benchmark "
            "test benchmark test benchmark test";
        myList.push_back(myString);
    }
    myList.clear();
}

//------------------------------------------------------------------------------
// Benchmark
//------------------------------------------------------------------------------
void Benchmark(const char* name, TestFunc testFunc) {
    TimeVar t1;

    // float ElapsedMicroseconds = {0};
    // Allocate MAX_BLOCKS blocks MAX_BLOCK_SIZE / 2 sized blocks

    TIC(t1);
    // Call test function
    testFunc();
    // ElapsedMicroseconds = TOC_US(t1);

    // PROFILELOG( name << " Elapsed time: " << ElapsedMicroseconds);
    PROFILELOG(name << " Elapsed time: " << TOC_US(t1));
}

TEST(UTBlockAllocate, stl_test) {
    std::set_new_handler(out_of_memory);

    xlist<int> myList;
    myList.push_back(123);

    xmap<char, int> myMap;
    myMap['a'] = 10;

    xqueue<int> myQueue;
    myQueue.push(123);

    xset<xstring> mySet;
    mySet.insert("hello");
    mySet.insert("world");

    xstringstream myStringStream;
    myStringStream << "hello world " << 2016 << std::ends;

    xwstringstream myWStringStream;
    myWStringStream << L"hello world " << 2016 << std::ends;

    xstring myString("hello world");

    Benchmark("std::list Global Heap (Run 1)", ListGlobalHeapTest);
    Benchmark("std::list Global Heap (Run 2)", ListGlobalHeapTest);
    Benchmark("std::list Global Heap (Run 3)", ListGlobalHeapTest);

    Benchmark("xlist Fixed Block (Run 1)", ListFixedBlockTest);
    Benchmark("xlist Fixed Block (Run 2)", ListFixedBlockTest);
    Benchmark("xlist Fixed Block (Run 3)", ListFixedBlockTest);

    Benchmark("std::map Global Heap (Run 1)", MapGlobalHeapTest);
    Benchmark("std::map Global Heap (Run 2)", MapGlobalHeapTest);
    Benchmark("std::map Global Heap (Run 3)", MapGlobalHeapTest);

    Benchmark("xmap Fixed Block (Run 1)", MapFixedBlockTest);
    Benchmark("xmap Fixed Block (Run 2)", MapFixedBlockTest);
    Benchmark("xmap Fixed Block (Run 3)", MapFixedBlockTest);

    Benchmark("std::vector Global Heap (Run 1)", VectorGlobalHeapTest);
    Benchmark("std::vector Global Heap (Run 2)", VectorGlobalHeapTest);
    Benchmark("std::vector Global Heap (Run 3)", VectorGlobalHeapTest);

    Benchmark("xvector Fixed Block (Run 1)", VectorFixedBlockTest);
    Benchmark("xvector Fixed Block (Run 2)", VectorFixedBlockTest);
    Benchmark("xvector Fixed Block (Run 3)", VectorFixedBlockTest);

    Benchmark("std::string Global Heap (Run 1)", StringGlobalHeapTest);
    Benchmark("std::string Global Heap (Run 2)", StringGlobalHeapTest);
    Benchmark("std::string Global Heap (Run 3)", StringGlobalHeapTest);

    Benchmark("xstring Fixed Block (Run 1)", StringFixedBlockTest);
    Benchmark("xstring Fixed Block (Run 2)", StringFixedBlockTest);
    Benchmark("xstring Fixed Block (Run 3)", StringFixedBlockTest);

#ifdef PROFILE
    xalloc_stats();
#endif
    return;
}


text:
import * as React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import { unstable_composeClasses as composeClasses, useButton } from '@mui/base';
import { useSlotProps } from '@mui/base/utils';
import { OverridableComponent } from '@mui/types';
import { unstable_capitalize as capitalize, unstable_useId as useId } from '@mui/utils';
import { useThemeProps } from '../styles';
import styled from '../styles/styled';
import chipClasses, { getChipUtilityClass } from './chipClasses';
import { ChipProps, ChipOwnerState, ChipTypeMap } from './ChipProps';
import ChipContext from './ChipContext';

const useUtilityClasses = (ownerState: ChipOwnerState) => {
  const { disabled, size, color, clickable, variant, focusVisible } = ownerState;

  const slots = {
    root: [
      'root',
      disabled && 'disabled',
      color && `color${capitalize(color)}`,
      size && `size${capitalize(size)}`,
      variant && `variant${capitalize(variant)}`,
      clickable && 'clickable',
    ],
    action: ['action', disabled && 'disabled', focusVisible && 'focusVisible'],
    label: ['label', size && `label${capitalize(size)}`],
    startDecorator: ['startDecorator'],
    endDecorator: ['endDecorator'],
  };

  return composeClasses(slots, getChipUtilityClass, {});
};

const ChipRoot = styled('div', {
  name: 'JoyChip',
  slot: 'Root',
  overridesResolver: (props, styles) => styles.root,
})<{ ownerState: ChipOwnerState }>(({ theme, ownerState }) => {
  return [
    {
      // for controlling chip delete margin offset
      '--Chip-decorator-childOffset':
        'min(calc(var(--Chip-paddingInline) - (var(--_Chip-minHeight) - 2 * var(--variant-borderWidth) - var(--Chip-decorator-childHeight)) / 2), var(--Chip-paddingInline))',
      '--Chip-decorator-childRadius':
        'max(var(--_Chip-radius) - var(--_Chip-paddingBlock), min(var(--_Chip-paddingBlock) / 2, var(--_Chip-radius) / 2))',
      '--Chip-delete-radius': 'var(--Chip-decorator-childRadius)',
      '--Chip-delete-size': 'var(--Chip-decorator-childHeight)',
      '--Avatar-radius': 'var(--Chip-decorator-childRadius)',
      '--Avatar-size': 'var(--Chip-decorator-childHeight)',
      '--Icon-margin': 'initial', // reset the icon's margin.
      '--internal-action-radius': 'var(--_Chip-radius)', // to be used with Radio or Checkbox
      ...(ownerState.size === 'sm' && {
        '--Chip-gap': '0.25rem',
        '--Chip-paddingInline': '0.5rem',
        '--Chip-decorator-childHeight':
          'calc(min(1.125rem, var(--_Chip-minHeight)) - 2 * var(--variant-borderWidth))',
        '--Icon-fontSize': 'calc(var(--_Chip-minHeight) / 1.714)', // 0.875rem by default
        '--_Chip-minHeight': 'var(--Chip-minHeight, 1.5rem)',
        fontSize: theme.vars.fontSize.xs,
      }),
      ...(ownerState.size === 'md' && {
        '--Chip-gap': '0.375rem',
        '--Chip-paddingInline': '0.75rem',
        '--Chip-decorator-childHeight': 'min(1.375rem, var(--_Chip-minHeight))',
        '--Icon-fontSize': 'calc(var(--_Chip-minHeight) / 1.778)', // 1.125rem by default
        '--_Chip-minHeight': 'var(--Chip-minHeight, 2rem)',
        fontSize: theme.vars.fontSize.sm,
      }),
      ...(ownerState.size === 'lg' && {
        '--Chip-gap': '0.5rem',
        '--Chip-paddingInline': '1rem',
        '--Chip-decorator-childHeight': 'min(1.75rem, var(--_Chip-minHeight))',
        '--Icon-fontSize': 'calc(var(--_Chip-minHeight) / 2)', // 1.25rem by default
        '--_Chip-minHeight': 'var(--Chip-minHeight, 2.5rem)',
        fontSize: theme.vars.fontSize.md,
      }),
      '--_Chip-radius': 'var(--Chip-radius, 1.5rem)',
      '--_Chip-paddingBlock':
        'max((var(--_Chip-minHeight) - 2 * var(--variant-borderWidth) - var(--Chip-decorator-childHeight)) / 2, 0px)',
      minHeight: 'var(--_Chip-minHeight)',
      paddingInline: 'var(--Chip-paddingInline)',
      borderRadius: 'var(--_Chip-radius)',
      position: 'relative',
      fontWeight: theme.vars.fontWeight.md,
      fontFamily: theme.vars.fontFamily.body,
      display: 'inline-flex',
      alignItems: 'center',
      justifyContent: 'center',
      whiteSpace: 'nowrap',
      transition:
        'background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
      textDecoration: 'none',
      verticalAlign: 'middle',
      boxSizing: 'border-box',
      [`&.${chipClasses.disabled}`]: {
        color: theme.vars.palette[ownerState.color!]?.[`${ownerState.variant!}DisabledColor`],
      },
    },
    ...(!ownerState.clickable
      ? [
          theme.variants[ownerState.variant!]?.[ownerState.color!],
          {
            [`&.${chipClasses.disabled}`]:
              theme.variants[`${ownerState.variant!}Disabled`]?.[ownerState.color!],
          },
        ]
      : [
          {
            '--variant-borderWidth': '0px',
            color: theme.vars.palette[ownerState.color!]?.[`${ownerState.variant!}Color`],
          },
        ]),
  ];
});

const ChipLabel = styled('span', {
  name: 'JoyChip',
  slot: 'Label',
  overridesResolver: (props, styles) => styles.label,
})<{ ownerState: ChipOwnerState }>(({ ownerState }) => ({
  display: 'inline-block',
  overflow: 'hidden',
  textOverflow: 'ellipsis',
  order: 1,
  minInlineSize: 0,
  flexGrow: 1,
  ...(ownerState.clickable && {
    zIndex: 1,
    pointerEvents: 'none',
  }),
}));

const ChipAction = styled('button', {
  name: 'JoyChip',
  slot: 'Action',
  overridesResolver: (props, styles) => styles.action,
})<{ ownerState: ChipOwnerState }>(({ theme, ownerState }) => [
  {
    position: 'absolute',
    zIndex: 0,
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
    border: 'none',
    padding: 'initial',
    margin: 'initial',
    backgroundColor: 'initial',
    textDecoration: 'none',
    borderRadius: 'inherit',
    transition:
      'background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
    [theme.focus.selector]: theme.focus.default,
  },
  theme.variants[ownerState.variant!]?.[ownerState.color!],
  { '&:hover': theme.variants[`${ownerState.variant!}Hover`]?.[ownerState.color!] },
  { '&:active': theme.variants[`${ownerState.variant!}Active`]?.[ownerState.color!] },
  {
    [`&.${chipClasses.disabled}`]:
      theme.variants[`${ownerState.variant!}Disabled`]?.[ownerState.color!],
  },
]);

const ChipStartDecorator = styled('span', {
  name: 'JoyChip',
  slot: 'StartDecorator',
  overridesResolver: (props, styles) => styles.startDecorator,
})<{ ownerState: ChipOwnerState }>({
  '--Avatar-marginInlineStart': 'calc(var(--Chip-decorator-childOffset) * -1)',
  '--Chip-delete-margin': '0 0 0 calc(var(--Chip-decorator-childOffset) * -1)',
  '--Icon-margin': '0 0 0 calc(var(--Chip-paddingInline) / -4)',
  display: 'inherit',
  marginInlineEnd: 'var(--Chip-gap)',
  // set zIndex to 1 with order to stay on top of other controls, eg. Checkbox, Radio
  order: 0,
  zIndex: 1,
  pointerEvents: 'none',
});

const ChipEndDecorator = styled('span', {
  name: 'JoyChip',
  slot: 'EndDecorator',
  overridesResolver: (props, styles) => styles.endDecorator,
})<{ ownerState: ChipOwnerState }>({
  '--Chip-delete-margin': '0 calc(var(--Chip-decorator-childOffset) * -1) 0 0',
  '--Icon-margin': '0 calc(var(--Chip-paddingInline) / -4) 0 0',
  display: 'inherit',
  marginInlineStart: 'var(--Chip-gap)',
  // set zIndex to 1 with order to stay on top of other controls, eg. Checkbox, Radio
  order: 2,
  zIndex: 1,
  pointerEvents: 'none',
});

/**
 * Chips represent complex entities in small blocks, such as a contact.
 */
const Chip = React.forwardRef(function Chip(inProps, ref) {
  const props = useThemeProps<typeof inProps & ChipProps>({ props: inProps, name: 'JoyChip' });
  const {
    children,
    className,
    componentsProps = {},
    color = 'primary',
    component,
    onClick,
    disabled = false,
    size = 'md',
    variant = 'solid',
    startDecorator,
    endDecorator,
    ...other
  } = props;

  const clickable = !!onClick || !!componentsProps.action;
  const ownerState: ChipOwnerState = {
    ...props,
    component,
    disabled,
    size,
    color,
    variant,
    clickable,
    focusVisible: false,
  };

  const resolvedActionProps =
    typeof componentsProps.action === 'function'
      ? componentsProps.action(ownerState)
      : componentsProps.action;
  const actionRef = React.useRef<HTMLElement | null>(null);
  const { focusVisible, getRootProps } = useButton({
    ...resolvedActionProps,
    disabled,
    ref: actionRef,
  });

  ownerState.focusVisible = focusVisible;

  const classes = useUtilityClasses(ownerState);

  const labelProps = useSlotProps({
    elementType: ChipLabel,
    externalSlotProps: componentsProps.label,
    ownerState,
    className: classes.label,
  });

  // @ts-ignore internal logic.
  const id = useId(labelProps.id);

  const actionProps = useSlotProps({
    elementType: ChipAction,
    getSlotProps: getRootProps,
    externalSlotProps: componentsProps.action,
    additionalProps: {
      'aria-labelledby': id,
      as: resolvedActionProps?.component,
      onClick,
    },
    ownerState,
    className: classes.action,
  });

  const startDecoratorProps = useSlotProps({
    elementType: ChipStartDecorator,
    externalSlotProps: componentsProps.startDecorator,
    ownerState,
    className: classes.startDecorator,
  });

  const endDecoratorProps = useSlotProps({
    elementType: ChipEndDecorator,
    externalSlotProps: componentsProps.endDecorator,
    ownerState,
    className: classes.endDecorator,
  });

  const chipContextValue = React.useMemo(
    () => ({ disabled, variant, color }),
    [color, disabled, variant],
  );

  return (
    <ChipContext.Provider value={chipContextValue}>
      <ChipRoot
        as={component}
        className={clsx(classes.root, className)}
        ref={ref}
        ownerState={ownerState}
        {...other}
      >
        {clickable && <ChipAction {...actionProps} />}

        {/* label is always the first element for integrating with other controls, eg. Checkbox, Radio. Use CSS order to rearrange position */}
        <ChipLabel {...labelProps} id={id}>
          {children}
        </ChipLabel>
        {startDecorator && (
          <ChipStartDecorator {...startDecoratorProps}>{startDecorator}</ChipStartDecorator>
        )}

        {endDecorator && <ChipEndDecorator {...endDecoratorProps}>{endDecorator}</ChipEndDecorator>}
      </ChipRoot>
    </ChipContext.Provider>
  );
}) as OverridableComponent<ChipTypeMap>;

Chip.propTypes /* remove-proptypes */ = {
  // ----------------------------- Warning --------------------------------
  // | These PropTypes are generated from the TypeScript type definitions |
  // |     To update them edit TypeScript types and run "yarn proptypes"  |
  // ----------------------------------------------------------------------
  /**
   * The content of the component.
   */
  children: PropTypes.node,
  /**
   * @ignore
   */
  className: PropTypes.string,
  /**
   * The color of the component. It supports those theme colors that make sense for this component.
   * @default 'primary'
   */
  color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
    PropTypes.oneOf(['danger', 'info', 'neutral', 'primary', 'success', 'warning']),
    PropTypes.string,
  ]),
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: PropTypes.elementType,
  /**
   * The props used for each slot inside the component.
   * @default {}
   */
  componentsProps: PropTypes.shape({
    action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
    endDecorator: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
    label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
    root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
    startDecorator: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
  }),
  /**
   * If `true`, the component is disabled.
   * @default false
   */
  disabled: PropTypes.bool,
  /**
   * Element placed after the children.
   */
  endDecorator: PropTypes.node,
  /**
   * Element action click handler.
   */
  onClick: PropTypes.func,
  /**
   * The size of the component.
   * It accepts theme values between 'sm' and 'lg'.
   * @default 'md'
   */
  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
    PropTypes.oneOf(['lg', 'md', 'sm']),
    PropTypes.string,
  ]),
  /**
   * Element placed before the children.
   */
  startDecorator: PropTypes.node,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])),
    PropTypes.func,
    PropTypes.object,
  ]),
  /**
   * The variant to use.
   * @default 'solid'
   */
  variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
    PropTypes.oneOf(['outlined', 'plain', 'soft', 'solid']),
    PropTypes.string,
  ]),
} as any;

export default Chip;


text:
set -x
set -o errexit
set -o pipefail
set -o nounset

mkdir -p /etc/systemd/system/docker.service.d/
cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf
[Service]
MountFlags=shared
EOF
cat <<EOF > /etc/systemd/system/docker.service.d/overlay.conf
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay
EOF

# start hacky workaround (https://github.com/docker/docker/issues/23793)
  curl -sSL https://get.docker.com/ > /tmp/install-docker
  chmod +x /tmp/install-docker
  /tmp/install-docker || true
  systemctl start docker || true
# end hacky workaround

apt-get install -y jq

ROLE="node"
if [[ $(hostname) = *master* ]]; then
  ROLE="master"
fi

azure_file="/etc/kubernetes/azure.json"
config_file="/etc/kubernetes/k8s_config.json"

mkdir -p /etc/kubernetes
mkdir -p /srv/kubernetes

# the following values are populated by terraform
echo -n "${azure_json}" | base64 -d > "$azure_file"
echo -n "${k8s_config}" | base64 -d > "$config_file"
echo -n "${root_ca_public_pem}" | base64 -d > "/srv/kubernetes/ca.pem"
echo -n "${apiserver_cert_pem}" | base64 -d > "/srv/kubernetes/apiserver.pem"
echo -n "${apiserver_key_pem}" | base64 -d > "/srv/kubernetes/apiserver-key.pem"
cat << EOF > "/srv/kubernetes/kubeconfig.json"
${node_kubeconfig}
EOF

MASTER_IP="$(cat "$config_file" | jq -r '.phase1.azure.master_private_ip')"

jq ". + {\"role\": \"$ROLE\", \"master_ip\": \"$MASTER_IP\"}" "$config_file" > /etc/kubernetes/k8s_config.new; cp /etc/kubernetes/k8s_config.new "$config_file"

installer_container="$(jq -r '.phase2.installer_container' "$config_file")"

docker pull "$installer_container"

docker run \
  --net=host \
  -v /:/mnt/root \
  -v /run:/run \
  -v /etc/kubernetes:/etc/kubernetes \
  -v /var/lib/ignition:/usr/share/oem \
  "$installer_container"

systemctl enable kubelet
systemctl start kubelet


text:
export interface IPlatforms {
    WEB: string;
    MOBILE_NATIVE: string;
}

export class Config {

    // supported platforms
    public static PLATFORMS: IPlatforms = {
        WEB: 'web',
        MOBILE_NATIVE: 'mobile_native'
    };

    // current target (defaults to web)
    public static PLATFORM_TARGET: string = Config.PLATFORMS.WEB;

    public static get IS_WEB(): boolean {
        return Config.PLATFORM_TARGET === Config.PLATFORMS.WEB;
    }

    public static get IS_MOBILE_NATIVE(): boolean {
        return Config.PLATFORM_TARGET === Config.PLATFORMS.MOBILE_NATIVE;
    }

    public static get APP_VERSION():string {
        return '1.19.08.02a';
    }

}


text:
function [BCMatrix, BCRHS] = boundaryCondition1D(BC)
% It creates the matrix of coefficient based on the BC structure provided
% by the user. It also generates the right hand side vector of the linear
% system of equations
%
% SYNOPSIS:
%   [BCMatrix, BCRHS] = boundaryCondition1D(BC)
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%

%{
Copyright (c) 2012, 2013, Ali Akbar Eftekhari
All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:

    *   Redistributions of source code must retain the above copyright notice,
        this list of conditions and the following disclaimer.
    *   Redistributions in binary form must reproduce the above
        copyright notice, this list of conditions and the following
        disclaimer in the documentation and/or other materials provided
        with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%}

% extract data from the mesh structure
Nx = BC.domain.dims(1);
dx_1 = BC.domain.cellsize.x(1);
dx_end= BC.domain.cellsize.x(end);
G = [1:Nx+2];

% number of boundary nodes:
nb = 8;

% define the vectors to be used for the creation of the sparse matrix
ii = zeros(nb,1);
jj = zeros(nb,1);
s = zeros(nb,1);

% define the RHS column vector
BCRHS = zeros(Nx+2, 1);
q = 0;
% Assign values to the boundary condition matrix and the RHS vector based
% on the BC structure
if (BC.right.periodic == 0) || (BC.left.periodic == 0) % non-periodic boundary condition
    % Right boundary
    i = Nx+2;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i);  s(q) = BC.right.b/2 + BC.right.a/dx_end;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i-1); s(q) = BC.right.b/2 - BC.right.a/dx_end;
    BCRHS(G(i)) = BC.right.c;

    % Left boundary
    i = 1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i+1);  s(q) = -(BC.left.b/2 + BC.left.a/dx_1);
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i); s(q) = -(BC.left.b/2 - BC.left.a/dx_1);
    BCRHS(G(i)) = -(BC.left.c);
elseif (BC.right.periodic == 1) || (BC.left.periodic == 1) % periodic boundary condition
    % Right boundary
    i = Nx+2;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i);  s(q) = 1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i-1);  s(q) = -1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(1); s(q) = dx_end/dx_1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(2); s(q) = -dx_end/dx_1;
    BCRHS(G(i)) = 0;
    % Left boundary
    i = 1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(i);  s(q) = 1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(2);  s(q) = 1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(Nx+1); s(q) = -1;
    q=q+1;
    ii(q) = G(i);  jj(q) = G(Nx+2); s(q) = -1;
    BCRHS(G(i)) = 0;
end

% Build the sparse matrix of the boundary conditions
BCMatrix = sparse(ii(1:q), jj(1:q), s(1:q), Nx+2, Nx+2);


text:
"use strict";

const PowerShell = require("../lib");

// Start the process
let ps = new PowerShell("echo 'powershell is awesome'");

// Handle process errors (e.g. powershell not found)
ps.on("error", err => {
    console.error(err);
});

// Stdout
ps.on("output", data => {
    console.log(data);
});

// Stderr
ps.on("error-output", data => {
    console.error(data);
});

// End
ps.on("end", code => {
    // Do Something on end
});


text:
package dfa.analyses;

import dfa.framework.DFADirection;
import dfa.framework.DFAFactory;
import dfa.framework.DataFlowAnalysis;
import dfa.framework.SimpleBlockGraph;

/**
 * A {@code TaintFactory} creates {@code TaintAnalysis}-Instances from {@code SimpleBlockGraph}.
 *
 * @author Sebastian Rauch
 */
public class TaintFactory extends DFAFactory<TaintElement> {

    @Override
    public String getName() {
        return "Taint-Analysis";
    }

    @Override
    public DFADirection getDirection() {
        return DFADirection.FORWARD;
    }

    @Override
    public DataFlowAnalysis<TaintElement> getAnalysis(SimpleBlockGraph blockGraph) {
        return new TaintAnalysis(blockGraph);
    }

}


text:
#include <pthread.h>

#include "irt_syscalls.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/ppp.h"

struct PP_StartFunctions {
  int32_t (*PPP_InitializeModule)(PP_Module module_id,
                                  PPB_GetInterface get_browser_interface);
  void (*PPP_ShutdownModule)();
  const void* (*PPP_GetInterface)(const char* interface_name);
};

struct PP_ThreadFunctions {
  /*
   * This is a cut-down version of pthread_create()/pthread_join().
   * We omit thread creation attributes and the thread's return value.
   *
   * We use uintptr_t as the thread ID type because pthread_t is not
   * part of the stable ABI; a user thread library might choose an
   * arbitrary size for its own pthread_t.
   */
  int (*thread_create)(uintptr_t* tid,
                       void (*func)(void* thread_argument),
                       void* thread_argument);
  int (*thread_join)(uintptr_t tid);
};

#define NACL_IRT_PPAPIHOOK_v0_1 "nacl-irt-ppapihook-0.1"
struct nacl_irt_ppapihook {
  int (*ppapi_start)(const struct PP_StartFunctions*);
  void (*ppapi_register_thread_creator)(const struct PP_ThreadFunctions*);
};

static int thread_create(uintptr_t *tid,
                         void (*func)(void *thread_argument),
                         void *thread_argument) {
  /*
   * We know that newlib and glibc use a small pthread_t type, so we
   * do not need to wrap pthread_t values.
   */
  return pthread_create((pthread_t *) tid, NULL,
                        (void *(*)(void *thread_argument)) func,
                        thread_argument);
}

static int thread_join(uintptr_t tid) {
  return pthread_join((pthread_t) tid, NULL);
}

/*
 * These are dangling references to functions that the application must define.
 */
static const struct PP_StartFunctions ppapi_app_start_callbacks = {
  PPP_InitializeModule,
  PPP_ShutdownModule,
  PPP_GetInterface
};

const static struct PP_ThreadFunctions thread_funcs = {
  thread_create,
  thread_join
};

static void fatal_error(const char *message) {
  write(2, message, strlen(message));
  _exit(127);
}

/*
 * We cannot tell at link time whether the application uses PPB_Audio,
 * because of the way that PPAPI is defined via runtime interface
 * query rather than a set of static functions.  This means that we
 * register the audio thread functions unconditionally.  This adds the
 * small overhead of pulling in pthread_create() even if the
 * application does not use PPB_Audio or libpthread.
 *
 * If an application developer wants to avoid that cost, they can
 * override this function with an empty definition.
 */
void __nacl_register_thread_creator(const struct nacl_irt_ppapihook *hooks) {
  hooks->ppapi_register_thread_creator(&thread_funcs);
}

int PpapiPluginStart(const struct PP_StartFunctions *funcs) {
  struct nacl_irt_ppapihook hooks;
  if (sizeof(hooks) != __nacl_irt_query(NACL_IRT_PPAPIHOOK_v0_1,
                                        &hooks, sizeof(hooks))) {
    fatal_error("PpapiPluginStart: PPAPI hooks not found\n");
  }

  __nacl_register_thread_creator(&hooks);
  return hooks.ppapi_start(funcs);
}

/*
 * The application's main (or the one supplied in this library) calls this
 * to start the PPAPI world.
 */
int PpapiPluginMain(void) {
  return PpapiPluginStart(&ppapi_app_start_callbacks);
}


text:
var TestEnv = require('testenv');
var Authorizer = require('core/auth/pusher_authorizer').default;
var Logger = require('core/logger');
var Mocks = require('mocks');
var Util = require('core/util').default;
var Factory = require('core/utils/factory').default;
var Logger = require('core/logger').default;
var Runtime = require('runtime').default;

describe("Authorizer", function() {

  describe("initialization", function(){
    it("should throw an error if the specified transport is unrecognized", function(){
      expect(function(){
        new Authorizer({name: "chan"}, {
          authTransport: "yolo"
        })
      }).toThrow("'yolo' is not a recognized auth transport");
    });
  });

  describe("#composeQuery", function() {
    it("should return str with just socket id and channel name if no auth query options", function() {
      var authorizer = new Authorizer({ name: "chan" }, {authTransport: "ajax"});

      expect(authorizer.composeQuery("1.1"))
        .toEqual("socket_id=1.1&channel_name=chan");
    });

    it("should add query params specified in options object", function() {
      var authorizer = new Authorizer(
        { name: "chan" },
        { auth: {
            params: { a: 1, b: 2 }
          },
          authTransport: "ajax"
        }
      );

      expect(authorizer.composeQuery("1.1"))
        .toEqual("socket_id=1.1&channel_name=chan&a=1&b=2");
    });
  });

});

if (TestEnv !== "worker") {
  describe("AJAX Authorizer", function() {
    var xhr;

    beforeEach(function() {
      xhr = new Mocks.getXHR();

      if (TestEnv === "web" && !window.XMLHttpRequest) {
        spyOn(Runtime, "createMicrosoftXHR").andReturn(xhr);
      } else {
        spyOn(Runtime, "createXHR").andReturn(xhr);
      }
    });

    it("should pass headers in the request", function() {
      var headers = { "foo": "bar", "n": 42 };
      var authorizer = new Authorizer(
        { name: "chan" },
        { authTransport: "ajax",
          auth: {
            headers: headers
          }
        }
      );
      authorizer.authorize("1.23", function() {});

      expect(xhr.setRequestHeader.calls.length).toEqual(3);
      expect(xhr.setRequestHeader).toHaveBeenCalledWith(
        "Content-Type", "application/x-www-form-urlencoded"
      );
      expect(xhr.setRequestHeader).toHaveBeenCalledWith("foo", "bar");
      expect(xhr.setRequestHeader).toHaveBeenCalledWith("n", 42);
    });

    it("should pass params in the query string", function() {
      var params = { "a": 1, "b": 2 };
      var authorizer = new Authorizer(
        { name: "chan" },
        { authTransport: "ajax",
          auth: {
            params: params
          }
        }
      );
      authorizer.authorize("1.23", function() {});

      expect(xhr.send.calls.length).toEqual(1);
      expect(xhr.send).toHaveBeenCalledWith(
        "socket_id=1.23&channel_name=chan&a=1&b=2"
      );
    });

    it("should call back with auth result on success", function() {
      var authorizer = new Authorizer(
        { name: "chan" },
        { authTransport: "ajax" }
      );

      var data = { foo: "bar", number: 1};
      var dataJSON = JSON.stringify(data);

      var callback = jasmine.createSpy("callback");
      authorizer.authorize("1.23", callback);

      if (TestEnv === "web" && !window.XMLHttpRequest) {
        expect(Runtime.createMicrosoftXHR.calls.length).toEqual(1);
      } else {
        expect(Runtime.createXHR.calls.length).toEqual(1);
      }

      xhr.readyState = 4;
      xhr.status = 200;
      xhr.responseText = dataJSON;
      xhr.onreadystatechange();

      expect(callback.calls.length).toEqual(1);
      expect(callback).toHaveBeenCalledWith(false, data);
    });

    it("should call back with an error if JSON in xhr.responseText is invalid", function() {
      var authorizer = new Authorizer(
        { name: "chan" },
        { authTransport: "ajax" }
      );
      var invalidJSON = 'INVALID { "something": "something"}';
      var callback = jasmine.createSpy("callback");
      authorizer.authorize("1.23", callback);

      if (TestEnv === "web" && !window.XMLHttpRequest) {
        expect(Runtime.createMicrosoftXHR.calls.length).toEqual(1);
      } else {
        expect(Runtime.createXHR.calls.length).toEqual(1);
      }

      xhr.readyState = 4;
      xhr.status = 200;
      xhr.responseText = invalidJSON;
      xhr.onreadystatechange();

      expect(callback.calls.length).toEqual(1);
      expect(callback).toHaveBeenCalledWith(
        true,
        "JSON returned from webapp was invalid, yet status code was 200. " +
          "Data was: " +
          invalidJSON
      );
    });
  });
}


text:
#include "common.h"
#include <memory.h>

extern void sbgemm_scal_operation(BLASLONG M, BLASLONG N, float beta, float *C, BLASLONG ldc);
extern void sbgemm_zero_operation(BLASLONG M, BLASLONG N, float *C, BLASLONG ldc);

extern void sbgemm_blocking_kernel_nn_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nn_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nt_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nt_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tn_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tn_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tt_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tt_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);

#if defined(TRANS_NN)
#define SBGEMM_BLOCKING_KERNEL_ONE	sbgemm_blocking_kernel_nn_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA	sbgemm_blocking_kernel_nn_alpha
#elif defined(TRANS_NT)
#define SBGEMM_BLOCKING_KERNEL_ONE	sbgemm_blocking_kernel_nt_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA	sbgemm_blocking_kernel_nt_alpha
#elif defined(TRANS_TN)
#define SBGEMM_BLOCKING_KERNEL_ONE	sbgemm_blocking_kernel_tn_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA	sbgemm_blocking_kernel_tn_alpha
#elif defined(TRANS_TT)
#define SBGEMM_BLOCKING_KERNEL_ONE	sbgemm_blocking_kernel_tt_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA	sbgemm_blocking_kernel_tt_alpha
#endif

#define BF16_BLOCK_THRES_K 1024
// If we want to adjust this to be bigger, need to change COL_MAJOR_INCOPY_KERNEL_Kx32 kernel to be bigger also
#define BF16_BLOCK_THRES_M 32
#define BF16_BLOCK_THRES_N 1024

#define MALLOC_ALIGN64(ptr, size, raw_ptr) \
	raw_ptr = malloc((size) + 63); \
	ptr = (bfloat16 *)(((uintptr_t) raw_ptr + 63) & ~(uintptr_t)63)

#if defined(B0)
int CNAME(BLASLONG M, BLASLONG N, BLASLONG K, IFLOAT * A, BLASLONG lda, FLOAT alpha, IFLOAT * B, BLASLONG ldb, FLOAT * C, BLASLONG ldc)
#else
int CNAME(BLASLONG M, BLASLONG N, BLASLONG K, IFLOAT * A, BLASLONG lda, FLOAT alpha, IFLOAT * B, BLASLONG ldb, FLOAT beta, FLOAT * C, BLASLONG ldc)
#endif
{
	bfloat16 * block_A;
	bfloat16 * block_B;
	void* raw_ptrA;
	void* raw_ptrB;

	MALLOC_ALIGN64(block_A, sizeof(bfloat16) * BF16_BLOCK_THRES_K * BF16_BLOCK_THRES_M, raw_ptrA);
	MALLOC_ALIGN64(block_B, sizeof(bfloat16) * BF16_BLOCK_THRES_N * BF16_BLOCK_THRES_K, raw_ptrB);

#if defined(B0)
	sbgemm_zero_operation(M, N, C, ldc);
#else
	sbgemm_scal_operation(M, N, beta, C, ldc);
#endif

	if (alpha == ONE) {
		SBGEMM_BLOCKING_KERNEL_ONE(M, N, K, alpha, A, lda, B, ldb, C, ldc, block_A, block_B);
	} else {
		SBGEMM_BLOCKING_KERNEL_ALPHA(M, N, K, alpha, A, lda, B, ldb, C, ldc, block_A, block_B);
	}

	free(raw_ptrA);
	free(raw_ptrB);
	return 0;
}


text:
namespace PP {
	struct PostProcessHDR: public PostProcess
	{
		protected:
			HRESULT initPermanentResources(IDirect3DDevice9* pDevice, UINT width, UINT height);
			HRESULT setupTexture(IDirect3DDevice9* pDevice, UINT width, UINT height);
			HRESULT releaseTemporaryResources();
		public:
			PostProcessHDR();
			~PostProcessHDR();

			//
			// Standard Procedure Functions
			//
			HRESULT Render(IDirect3DTexture9* pSrcColorTexture, IDirect3DSurface9* pDstSurface);
			void onCreateDevice(IDirect3DDevice9* pd3dDevice, UINT width, UINT height);
			void onLostDevice();
			void onResetDevice(IDirect3DDevice9* pd3dDevice, UINT width, UINT height);
			void onDestroy(IDirect3DDevice9* pd3dDevice);
	};
}


text:
require "digi_moji/version"
require "digi_moji/char"
require "digi_moji/cli"

require "colcolor"

module DigiMoji
  class String
    attr_accessor :string
    attr_reader :raw_string
    def initialize(str, space:1, **opts)
      @raw_string = str.to_s
      @space = space
      @opts = opts
      @bg = opts[:bg]
      # @string holds a sequence of Char objects.
      @string = str2chars(str, opts)
    end

    def to_s
      head, *rest = @string
      joint = (" " * @space).colco(@bg, regexp:/./)
      head.zip(*rest).map { |e| e.join(joint) }.join("\n")
    end

    def +(other, **opts)
      opts = @opts.merge(opts)
      other =
        case other
        when ::String, ::Symbol
          str2chars(other, opts)
        when DigiMoji::String
          other.string
        else
          raise "'other' should be a string, symbol or DigiString object."
        end
      self.dup.tap { |s| s.string += other }
    end
    alias :join :+

    def <<(other, **opts)
      @string = (self + other).string
      @raw_string += other.respond_to?(:raw_string) ? other.raw_string : other.to_s
      self
    end

    private
    def str2chars(str, opts)
      str.to_s.each_char.map { |chr| Char[chr.intern, opts] }
    end
  end
end

class String
  def to_digimoji(**opts)
    DigiMoji::String.new(self, **opts)
  end
end


text:
FROM scratch

MAINTAINER "Stève Sfartz" <steve.sfartz@gmail.com>

COPY smart-proxy /

EXPOSE 9090

ENTRYPOINT ["/smart-proxy"]