text:
define(["require", "exports", 'davinci-blade/Rational'], function (require, exports, Rational) {
    var Dimensions = (function () {
        /**
         * The Dimensions class captures the physical dimensions associated with a unit of measure.
         *
         * @class Dimensions
         * @constructor
         * @param {Rational} mass The mass component of the dimensions object.
         * @param {Rational} length The length component of the dimensions object.
         * @param {Rational} time The time component of the dimensions object.
         * @param {Rational} charge The charge component of the dimensions object.
         * @param {Rational} temperature The temperature component of the dimensions object.
         * @param {Rational} amount The amount component of the dimensions object.
         * @param {Rational} intensity The intensity component of the dimensions object.
         */
        function Dimensions(theMass, L, T, Q, temperature, amount, intensity) {
            this.L = L;
            this.T = T;
            this.Q = Q;
            this.temperature = temperature;
            this.amount = amount;
            this.intensity = intensity;
            var length = L;
            var time = T;
            var charge = Q;
            if (arguments.length !== 7) {
                throw {
                    name: "DimensionError",
                    message: "Expecting 7 arguments"
                };
            }
            if (typeof theMass === 'number') {
                this._mass = new Rational(theMass, 1);
            }
            else if (theMass instanceof Rational) {
                this._mass = theMass;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "mass must be a Rational or number"
                };
            }
            if (typeof length === 'number') {
                this.L = new Rational(length, 1);
            }
            else if (length instanceof Rational) {
                this.L = length;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "length must be a Rational or number"
                };
            }
            if (typeof time === 'number') {
                this.T = new Rational(time, 1);
            }
            else if (time instanceof Rational) {
                this.T = time;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "time must be a Rational or number"
                };
            }
            if (typeof charge === 'number') {
                this.Q = new Rational(charge, 1);
            }
            else if (charge instanceof Rational) {
                this.Q = charge;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "charge must be a Rational or number"
                };
            }
            if (typeof temperature === 'number') {
                this.temperature = new Rational(temperature, 1);
            }
            else if (temperature instanceof Rational) {
                this.temperature = temperature;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "(thermodynamic) temperature must be a Rational or number"
                };
            }
            if (typeof amount === 'number') {
                this.amount = new Rational(amount, 1);
            }
            else if (amount instanceof Rational) {
                this.amount = amount;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "amount (of substance) must be a Rational or number"
                };
            }
            if (typeof intensity === 'number') {
                this.intensity = new Rational(intensity, 1);
            }
            else if (intensity instanceof Rational) {
                this.intensity = intensity;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "(luminous) intensity must be a Rational or number"
                };
            }
        }
        Object.defineProperty(Dimensions.prototype, "M", {
            /**
            * The mass component of this dimensions instance.
            *
            * @property M
            * @type {Rational}
            */
            get: function () {
                return this._mass;
            },
            enumerable: true,
            configurable: true
        });
        Dimensions.prototype.compatible = function (rhs) {
            if (this._mass.equals(rhs._mass) && this.L.equals(rhs.L) && this.T.equals(rhs.T) && this.Q.equals(rhs.Q) && this.temperature.equals(rhs.temperature) && this.amount.equals(rhs.amount) && this.intensity.equals(rhs.intensity)) {
                return this;
            }
            else {
                throw {
                    name: "DimensionError",
                    message: "Dimensions must be equal (" + this + ", " + rhs + ")"
                };
            }
        };
        Dimensions.prototype.mul = function (rhs) {
            return new Dimensions(this._mass.add(rhs._mass), this.L.add(rhs.L), this.T.add(rhs.T), this.Q.add(rhs.Q), this.temperature.add(rhs.temperature), this.amount.add(rhs.amount), this.intensity.add(rhs.intensity));
        };
        Dimensions.prototype.div = function (rhs) {
            return new Dimensions(this._mass.sub(rhs._mass), this.L.sub(rhs.L), this.T.sub(rhs.T), this.Q.sub(rhs.Q), this.temperature.sub(rhs.temperature), this.amount.sub(rhs.amount), this.intensity.sub(rhs.intensity));
        };
        Dimensions.prototype.pow = function (exponent) {
            return new Dimensions(this._mass.mul(exponent), this.L.mul(exponent), this.T.mul(exponent), this.Q.mul(exponent), this.temperature.mul(exponent), this.amount.mul(exponent), this.intensity.mul(exponent));
        };
        Dimensions.prototype.dimensionless = function () {
            return this._mass.isZero() && this.L.isZero() && this.T.isZero() && this.Q.isZero() && this.temperature.isZero() && this.amount.isZero() && this.intensity.isZero();
        };
        /**
        * Determines whether all the components of the Dimensions instance are zero.
        *
        * @method isZero
        * @return {boolean} true if all the components are zero, otherwise false.
        */
        Dimensions.prototype.isZero = function () {
            return this._mass.isZero() && this.L.isZero() && this.T.isZero() && this.Q.isZero() && this.temperature.isZero() && this.amount.isZero() && this.intensity.isZero();
        };
        Dimensions.prototype.negative = function () {
            return new Dimensions(this._mass.negative(), this.L.negative(), this.T.negative(), this.Q.negative(), this.temperature.negative(), this.amount.negative(), this.intensity.negative());
        };
        Dimensions.prototype.toString = function () {
            var stringify = function (rational, label) {
                if (rational.numer === 0) {
                    return null;
                }
                else if (rational.denom === 1) {
                    if (rational.numer === 1) {
                        return "" + label;
                    }
                    else {
                        return "" + label + " ** " + rational.numer;
                    }
                }
                return "" + label + " ** " + rational;
            };
            return [stringify(this._mass, 'mass'), stringify(this.L, 'length'), stringify(this.T, 'time'), stringify(this.Q, 'charge'), stringify(this.temperature, 'thermodynamic temperature'), stringify(this.amount, 'amount of substance'), stringify(this.intensity, 'luminous intensity')].filter(function (x) {
                return typeof x === 'string';
            }).join(" * ");
        };
        return Dimensions;
    })();
    return Dimensions;
});


text:
<?php

require '/home/d1ma/.composer/vendor/autoload.php';
require './src/Interfaces/PaginationInfoInterface.php';
require './src/PaginationInfo.php';

use EZ\Pagination\PaginationInfo;

class PaginationInfoTest extends PHPUnit_Framework_TestCase
{
    /**
     * limit test -----------------------------------------------------------------------------------------------------
     */

    /**
     * @test
     */
    public function givenLimitIsTooLow()
    {
        $limit_max   = 5;
        $limit_given = -999;

        $pagination = new PaginationInfo($hits = 11, $limit_max, $limit_given, $current_page = 1);
        $expected   = $limit_max;
        $result     = $pagination->getLimit();

        $this->assertEquals($expected, $result);
    }

    /**
     * @test
     */
    public function givenLimitIsTooHigh()
    {
        $limit_max   = 5;
        $limit_given = 999;

        $pagination = new PaginationInfo($hits = 11, $limit_max, $limit_given, $current_page = 1);
        $expected   = $limit_max;
        $result     = $pagination->getLimit();

        $this->assertEquals($expected, $result);
    }

    /**
     * @test
     */
    public function givenLimitIsOk()
    {
        $limit_max   = 5;
        $limit_given = 3;

        $pagination = new PaginationInfo($hits = 11, $limit_max, $limit_given, $current_page = 1);
        $expected   = $limit_given;
        $result     = $pagination->getLimit();

        $this->assertEquals($expected, $result);
    }

    /**
     * total pages test ------------------------------------------------------------------------------------------------
     */

    /**
     * @test
     */
    public function numberOfTotalPages()
    {
        $hits        = 11;
        $limit_max   = 5;
        $limit_given = 5;

        $pagination = new PaginationInfo($hits, $limit_max, $limit_given, $current_page = 1);
        $expected   = 3;
        $result     = $pagination->getTotalPages();

        $this->assertEquals($expected, $result);
    }

    /**
     * redirect page test ---------------------------------------------------------------------------------------------
     */

    /**
     * @test
     */
    public function firstRedirectPage()
    {
        $current_page = -999;

        $pagination = new PaginationInfo($hits = 11, $limit_max = 5, $limit_given = 5, $current_page);
        $expected   = 1;
        $result     = $pagination->getRedirectPage();

        $this->assertEquals($expected, $result);

    }

    /**
     * @test
     */
    public function lastRedirectPage()
    {
        $current_page = 999;

        $pagination = new PaginationInfo($hits = 11, $limit_max = 5, $limit_given = 5, $current_page);
        $expected   = 3;
        $result     = $pagination->getRedirectPage();

        $this->assertEquals($expected, $result);

    }

    /**
     * first result offset test ----------------------------------------------------------------------------------------
     */

    /**
     * @test
     */
    public function firstResultOffset()
    {
        $current_page = 2;

        $pagination = new PaginationInfo($hits = 11, $limit_max = 5, $limit_given = 5, $current_page);
        $expected   = 5;
        $result     = $pagination->getFirstResult();

        $this->assertEquals($expected, $result);
    }

    /**
     * full info test --------------------------------------------------------------------------------------------------
     */

    /**
     * @test
     */
    public function getFullInfo()
    {
        $hits         = 11;
        $limit_max    = 5;
        $limit_given  = 5;
        $current_page = 2;

        $pagination = new PaginationInfo($hits, $limit_max, $limit_given, $current_page);
        $expected   = array(
            'total_pages'   => 3,
            'redirect_page' => 2,
            'visible_first' => 5,
            'limit'         => 5
        );
        $result     = $pagination->getFullInfo();

        $this->assertEquals($expected, $result);
    }
}

/**
 * @todo remove require ... in the top of the file
 * @todo add namespace like:    EZ\Pagination\Test
 */

redpajama_set_name: RedPajamaGithub


text:
using namespace mopiqy::mopidy;

TEST_CASE("PlaylistController", "[mopidy]")
{
    ASSERT_CONNECTEDCLIENT

    PlaylistsController controller;
    controller.setJsonRpcHandler(client.jsonrpcHandler());

    SECTION("AsList")
    {
        QSignalSpy spy(&controller, &PlaylistsController::listReceived);
        controller.asList();
        CHECK(spy.wait());
    }

    SECTION("Create")
    {
        QSignalSpy spy(&controller, &PlaylistsController::created);
        controller.create("tst_create_playlist");
        REQUIRE(spy.wait());

        QList<QVariant> parameters = spy.takeFirst();
        Playlist mplaylist         = qvariant_cast<Playlist>(parameters.at(0));
        CHECK(mplaylist.name == QString("tst_create_playlist"));
    }

    SECTION("GetItems")
    {
        QSignalSpy spy(&controller, &PlaylistsController::itemsReceived);
        controller.getItems("m3u:tst_create_playlist");
        CHECK(spy.wait());
    }

    SECTION("Lookup")
    {
        QSignalSpy spy(&controller, &PlaylistsController::lookedup);

        controller.lookup("m3u:tst_create_playlist.m3u");
        REQUIRE(spy.wait());

        QList<QVariant> parameters = spy.takeFirst();
        Playlist mplaylist         = qvariant_cast<Playlist>(parameters.at(0));
        CHECK(mplaylist.name == QString("tst_create_playlist"));
    }

    SECTION("Refresh")
    {
        controller.refresh();
    }

    SECTION("Save")
    {
        QSignalSpy spy(&controller, &PlaylistsController::saved);

        Playlist pl;
        pl.name = "tst_create_playlist";
        pl.uri  = "m3u:tst_create_playlist.m3u";

        controller.save(pl);
        REQUIRE(spy.wait());

        QList<QVariant> parameters = spy.takeFirst();
        Playlist mplaylist         = qvariant_cast<Playlist>(parameters.at(0));
        CHECK(mplaylist.name == pl.name);
        CHECK(mplaylist.uri == pl.uri);
    }

    SECTION("Delete")
    {
        controller.deletePlaylist("m3u:tst_create_playlist.m3u");
    }
}


text:
using rclcpp::exceptions::throw_from_rcl_error;

std::string
rclcpp::expand_topic_or_service_name(
  const std::string & name,
  const std::string & node_name,
  const std::string & namespace_,
  bool is_service)
{
  char * expanded_topic = nullptr;
  rcl_allocator_t allocator = rcl_get_default_allocator();
  rcutils_allocator_t rcutils_allocator = rcutils_get_default_allocator();
  rcutils_string_map_t substitutions_map = rcutils_get_zero_initialized_string_map();

  rcutils_ret_t rcutils_ret = rcutils_string_map_init(&substitutions_map, 0, rcutils_allocator);
  if (rcutils_ret != RCUTILS_RET_OK) {
    if (rcutils_ret == RCUTILS_RET_BAD_ALLOC) {
      throw_from_rcl_error(RCL_RET_BAD_ALLOC, "", rcutils_get_error_state(), rcutils_reset_error);
    } else {
      throw_from_rcl_error(RCL_RET_ERROR, "", rcutils_get_error_state(), rcutils_reset_error);
    }
  }
  rcl_ret_t ret = rcl_get_default_topic_name_substitutions(&substitutions_map);
  if (ret != RCL_RET_OK) {
    const rcutils_error_state_t * error_state = rcl_get_error_state();
    // finalize the string map before throwing
    rcutils_ret = rcutils_string_map_fini(&substitutions_map);
    if (rcutils_ret != RCUTILS_RET_OK) {
      RCUTILS_LOG_ERROR_NAMED(
        "rclcpp",
        "failed to fini string_map (%d) during error handling: %s",
        rcutils_ret,
        rcutils_get_error_string().str);
      rcutils_reset_error();
    }
    throw_from_rcl_error(ret, "", error_state);
  }

  ret = rcl_expand_topic_name(
    name.c_str(),
    node_name.c_str(),
    namespace_.c_str(),
    &substitutions_map,
    allocator,
    &expanded_topic);

  std::string result;
  if (ret == RCL_RET_OK) {
    result = expanded_topic;
    allocator.deallocate(expanded_topic, allocator.state);
  }

  rcutils_ret = rcutils_string_map_fini(&substitutions_map);
  if (rcutils_ret != RCUTILS_RET_OK) {
    throw_from_rcl_error(RCL_RET_ERROR, "", rcutils_get_error_state(), rcutils_reset_error);
  }

  // expansion failed
  if (ret != RCL_RET_OK) {
    // if invalid topic or unknown substitution
    if (ret == RCL_RET_TOPIC_NAME_INVALID || ret == RCL_RET_UNKNOWN_SUBSTITUTION) {
      rcl_reset_error();  // explicitly discard error from rcl_expand_topic_name()
      int validation_result;
      size_t invalid_index;
      rcl_ret_t ret = rcl_validate_topic_name(name.c_str(), &validation_result, &invalid_index);
      if (ret != RCL_RET_OK) {
        throw_from_rcl_error(ret);
      }

      if (validation_result != RCL_TOPIC_NAME_VALID) {
        const char * validation_message =
          rcl_topic_name_validation_result_string(validation_result);
        if (is_service) {
          using rclcpp::exceptions::InvalidServiceNameError;
          throw InvalidServiceNameError(name.c_str(), validation_message, invalid_index);
        } else {
          using rclcpp::exceptions::InvalidTopicNameError;
          throw InvalidTopicNameError(name.c_str(), validation_message, invalid_index);
        }
      } else {
        throw std::runtime_error("topic name unexpectedly valid");
      }

      // if invalid node name
    } else if (ret == RCL_RET_NODE_INVALID_NAME) {
      rcl_reset_error();  // explicitly discard error from rcl_expand_topic_name()
      int validation_result;
      size_t invalid_index;
      rmw_ret_t rmw_ret =
        rmw_validate_node_name(node_name.c_str(), &validation_result, &invalid_index);
      if (rmw_ret != RMW_RET_OK) {
        if (rmw_ret == RMW_RET_INVALID_ARGUMENT) {
          throw_from_rcl_error(
            RCL_RET_INVALID_ARGUMENT, "failed to validate node name",
            rmw_get_error_state(), rmw_reset_error);
        }
        throw_from_rcl_error(
          RCL_RET_ERROR, "failed to validate node name",
          rmw_get_error_state(), rmw_reset_error);
      }

      if (validation_result != RMW_NODE_NAME_VALID) {
        throw rclcpp::exceptions::InvalidNodeNameError(
                node_name.c_str(),
                rmw_node_name_validation_result_string(validation_result),
                invalid_index);
      } else {
        throw std::runtime_error("invalid rcl node name but valid rmw node name");
      }

      // if invalid namespace
    } else if (ret == RCL_RET_NODE_INVALID_NAMESPACE) {
      rcl_reset_error();  // explicitly discard error from rcl_expand_topic_name()
      int validation_result;
      size_t invalid_index;
      rmw_ret_t rmw_ret =
        rmw_validate_namespace(namespace_.c_str(), &validation_result, &invalid_index);
      if (rmw_ret != RMW_RET_OK) {
        if (rmw_ret == RMW_RET_INVALID_ARGUMENT) {
          throw_from_rcl_error(
            RCL_RET_INVALID_ARGUMENT, "failed to validate namespace",
            rmw_get_error_state(), rmw_reset_error);
        }
        throw_from_rcl_error(
          RCL_RET_ERROR, "failed to validate namespace",
          rmw_get_error_state(), rmw_reset_error);
      }

      if (validation_result != RMW_NAMESPACE_VALID) {
        throw rclcpp::exceptions::InvalidNamespaceError(
                namespace_.c_str(),
                rmw_namespace_validation_result_string(validation_result),
                invalid_index);
      } else {
        throw std::runtime_error("invalid rcl namespace but valid rmw namespace");
      }
      // something else happened
    } else {
      throw_from_rcl_error(ret);
    }
  }

  // expand succeeded, but full name validation may fail still
  int validation_result;
  size_t invalid_index;
  rmw_ret_t rmw_ret =
    rmw_validate_full_topic_name(result.c_str(), &validation_result, &invalid_index);
  if (rmw_ret != RMW_RET_OK) {
    if (rmw_ret == RMW_RET_INVALID_ARGUMENT) {
      throw_from_rcl_error(
        RCL_RET_INVALID_ARGUMENT, "failed to validate full topic name",
        rmw_get_error_state(), rmw_reset_error);
    }
    throw_from_rcl_error(
      RCL_RET_ERROR, "failed to validate full topic name",
      rmw_get_error_state(), rmw_reset_error);
  }

  if (validation_result != RMW_TOPIC_VALID) {
    if (is_service) {
      throw rclcpp::exceptions::InvalidServiceNameError(
              result.c_str(),
              rmw_full_topic_name_validation_result_string(validation_result),
              invalid_index);
    } else {
      throw rclcpp::exceptions::InvalidTopicNameError(
              result.c_str(),
              rmw_full_topic_name_validation_result_string(validation_result),
              invalid_index);
    }
  }

  return result;
}


text:
var dsConfig = require('../datasources.json');

module.exports = function(app, done) {
  var yourEmailAddress = dsConfig.emailDs.transports[0].auth.user;

  app.models.Email.send({
    to: yourEmailAddress,
    from: yourEmailAddress,
    subject: 'The email subject',
    text: 'HTML tags are not converted'
    //html: 'HTML tags are converted'
  }, function(err) {
    if (err) throw err;
    console.log('> email sent successfully');
    done();
  });
};


text:
require 'haml/attribute_builder'
require 'haml/attribute_parser'
require 'haml/ruby_expression'

module Haml
  class AttributeCompiler
    def initialize(identity, options)
      @identity = identity
      @quote  = options[:attr_quote]
      @format = options[:format]
      @escape_attrs = options[:escape_attrs]
    end

    def compile(node)
      hashes = []
      if node.value[:object_ref] != :nil || !AttributeParser.available?
        return runtime_compile(node)
      end
      [node.value[:dynamic_attributes].new, node.value[:dynamic_attributes].old].compact.each do |attribute_str|
        hash = AttributeParser.parse(attribute_str)
        return runtime_compile(node) unless hash
        hashes << hash
      end
      static_compile(node.value[:attributes], hashes)
    end

    private

    def runtime_compile(node)
      attrs = []
      attrs.unshift(node.value[:attributes].inspect) if node.value[:attributes] != {}

      args = [
        @escape_attrs.inspect, "#{@quote.inspect}.freeze", @format.inspect,
        '::Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES', node.value[:object_ref],
      ] + attrs
      [:html, :attrs, [:dynamic, "::Haml::AttributeBuilder.build(#{args.join(', ')}, #{node.value[:dynamic_attributes].to_literal})"]]
    end

    def static_compile(static_hash, dynamic_hashes)
      temple = [:html, :attrs]
      keys = [*static_hash.keys, *dynamic_hashes.map(&:keys).flatten].uniq.sort
      keys.each do |key|
        values = [[:static, static_hash[key]], *dynamic_hashes.map { |h| [:dynamic, h[key]] }]
        values.select! { |_, exp| exp != nil }

        case key
        when 'id'
          compile_id!(temple, key, values)
        when 'class'
          compile_class!(temple, key, values)
        when 'data', 'aria'
          compile_data!(temple, key, values)
        when *AttributeBuilder::BOOLEAN_ATTRIBUTES, /\Adata-/, /\Aaria-/
          compile_boolean!(temple, key, values)
        else
          compile_common!(temple, key, values)
        end
      end
      temple
    end

    def compile_id!(temple, key, values)
      build_code = attribute_builder(:id, values)
      if values.all? { |type, exp| type == :static || Temple::StaticAnalyzer.static?(exp) }
        temple << [:html, :attr, key, [:static, eval(build_code).to_s]]
      else
        temple << [:html, :attr, key, [:dynamic, build_code]]
      end
    end

    def compile_class!(temple, key, values)
      build_code = attribute_builder(:class, values)
      if values.all? { |type, exp| type == :static || Temple::StaticAnalyzer.static?(exp) }
        temple << [:html, :attr, key, [:static, eval(build_code).to_s]]
      else
        temple << [:html, :attr, key, [:dynamic, build_code]]
      end
    end

    def compile_data!(temple, key, values)
      args = [@escape_attrs.inspect, "#{@quote.inspect}.freeze", values.map { |v| literal_for(v) }]
      build_code = "::Haml::AttributeBuilder.build_#{key}(#{args.join(', ')})"

      if values.all? { |type, exp| type == :static || Temple::StaticAnalyzer.static?(exp) }
        temple << [:static, eval(build_code).to_s]
      else
        temple << [:dynamic, build_code]
      end
    end

    def compile_boolean!(temple, key, values)
      exp = literal_for(values.last)

      if Temple::StaticAnalyzer.static?(exp)
        value = eval(exp)
        case value
        when true then temple << [:html, :attr, key, @format == :xhtml ? [:static, key] : [:multi]]
        when false, nil
        else temple << [:html, :attr, key, [:fescape, @escape_attrs, [:static, value.to_s]]]
        end
      else
        var = @identity.generate
        temple << [
          :case, "(#{var} = (#{exp}))",
          ['true', [:html, :attr, key, @format == :xhtml ? [:static, key] : [:multi]]],
          ['false, nil', [:multi]],
          [:else, [:multi, [:static, " #{key}=#{@quote}"], [:fescape, @escape_attrs, [:dynamic, var]], [:static, @quote]]],
        ]
      end
    end

    def compile_common!(temple, key, values)
      temple << [:html, :attr, key, [:fescape, @escape_attrs, values.last]]
    end

    def attribute_builder(type, values)
      args = [@escape_attrs.inspect, *values.map { |v| literal_for(v) }]
      "::Haml::AttributeBuilder.build_#{type}(#{args.join(', ')})"
    end

    def literal_for(value)
      type, exp = value
      type == :static ? "#{exp.inspect}.freeze" : exp
    end
  end
end


text:
// ***********************************************************************
// <copyright file="ParseUtils.cs" company="ServiceStack, Inc.">
//     Copyright (c) ServiceStack, Inc. All Rights Reserved.
// </copyright>
// <summary>Fork for YetAnotherForum.NET, Licensed under the Apache License, Version 2.0</summary>
// ***********************************************************************

namespace ServiceStack.Text.Common;

using System;

/// <summary>
/// Class ParseUtils.
/// </summary>
internal static class ParseUtils
{
    /// <summary>
    /// Gets the special parse method.
    /// </summary>
    /// <param name="type">The type.</param>
    /// <returns>ParseStringDelegate.</returns>
    public static ParseStringDelegate GetSpecialParseMethod(Type type)
    {
        if (type == typeof(Uri))
            return x => new Uri(x.FromCsvField());

        //Warning: typeof(object).IsInstanceOfType(typeof(Type)) == True??
        if (type.IsInstanceOfType(typeof(Type)))
            return ParseType;

        if (type == typeof(Exception))
            return x => new Exception(x);

        return type.IsInstanceOf(typeof(Exception)) ? DeserializeTypeUtils.GetParseMethod(type) : null;
    }

    /// <summary>
    /// Parses the type.
    /// </summary>
    /// <param name="assemblyQualifiedName">Name of the assembly qualified.</param>
    /// <returns>Type.</returns>
    public static Type ParseType(string assemblyQualifiedName)
    {
        return AssemblyUtils.FindType(assemblyQualifiedName.FromCsvField());
    }

    /// <summary>
    /// Tries the parse enum.
    /// </summary>
    /// <param name="enumType">Type of the enum.</param>
    /// <param name="str">The string.</param>
    /// <returns>System.Object.</returns>
    public static object TryParseEnum(Type enumType, string str)
    {
        if (str == null)
            return null;

        if (JsConfig.TextCase == TextCase.SnakeCase)
        {
            string[] names = Enum.GetNames(enumType);
            if (Array.IndexOf(names, str) == -1)    // case sensitive ... could use Linq Contains() extension with StringComparer.InvariantCultureIgnoreCase instead for a slight penalty
                str = str.Replace("_", "");
        }

        var enumInfo = CachedTypeInfo.Get(enumType).EnumInfo;
        return enumInfo.Parse(str);
    }
}


text:
@implementation TDBatcher

- (id) initWithCapacity: (NSUInteger)capacity
                  delay: (NSTimeInterval)delay
              processor: (void (^)(NSArray*))block {
    self = [super init];
    if (self) {
        _capacity = capacity;
        _delay = delay;
        _processor = [block copy];
    }
    return self;
}

- (void) unschedule {
    _scheduled = false;
    [NSObject cancelPreviousPerformRequestsWithTarget: self
                                             selector: @selector(processNow) object:nil];
}

- (void) scheduleWithDelay: (NSTimeInterval)delay {
    if (_scheduled && delay < _scheduledDelay)
        [self unschedule];
    if (!_scheduled) {
        _scheduled = true;
        _scheduledDelay = delay;
        [self performSelector: @selector(processNow) withObject: nil afterDelay: delay];
    }
}

- (void) processNow {
    _scheduled = false;
    NSArray* toProcess;
    NSUInteger count = _inbox.count;
    if (count == 0) {
        return;
    } else if (count <= _capacity) {
        toProcess = _inbox;
        _inbox = nil;
    } else {
        toProcess = [_inbox subarrayWithRange: NSMakeRange(0, _capacity)];
        [_inbox removeObjectsInRange: NSMakeRange(0, _capacity)];
        // There are more objects left, so schedule them Real Soon:
        [self scheduleWithDelay: 0.0];
    }
    _processor(toProcess);
}

- (void) queueObjects: (NSArray*)objects {
    if (objects.count == 0)
        return;
    if (!_inbox)
        _inbox = [[NSMutableArray alloc] init];
    [_inbox addObjectsFromArray: objects];

    if (_inbox.count < _capacity)
        [self scheduleWithDelay: _delay];
    else {
        [self unschedule];
        [self processNow];
    }
}

- (void) queueObject: (id)object {
    [self queueObjects: @[object]];
}

- (void) flush {
    [self unschedule];
    [self processNow];
}

- (void) flushAll {
    if (_inbox.count > 0) {
        [self unschedule];
        NSArray* toProcess = _inbox;
        _inbox = nil;
        _processor(toProcess);
    }
}

- (NSUInteger) count {
    return _inbox.count;
}

@end


text:
description: An overview of the SAML configuration process
topics:
  - saml
  - saml-configuration
contentType:
  - index
useCase:
  - add-idp
---

# SAML Configuration

<dfn data-key="security-assertion-markup-language">SAML</dfn>-based federation involves two parties:

1. An **identity provider** (IdP): authenticates users and provides to Service Providers an Authentication Assertion if successful;
2. A **service provider** (SP): relies on the Identity Provider to authenticate users.

Auth0 supports the SAML protocol and can serve as the identity provider, the service provider, or both.

## SAML Identity Providers

Some applications (such as Salesforce, Box, and Workday) allow users to authenticate against an external IdP using the SAML protocol. You can then integrate the application with Auth0, which serves as the application's SAML IdP.

Application users will be redirected to Auth0 to log in, and Auth0 can authenticate them using any backend authentication connection, such as an LDAP directory, a database, or another SAML IdP or Social Provider.

Once the user is authenticated, Auth0 returns a SAML assertion to the application that indicates such.

![](/media/articles/saml/saml-configuration/saml-case2.png)

## SAML Service Providers

Applications, especially custom ones, can authenticate users against an external IdP using protocols such as <dfn data-key="openid">OpenID Connect (OIDC)</dfn> or OAuth 2.0. However, you might want to leverage an enterprise SAML provider for authentication, even if you wrote your application to utilize either protocol.

![](/media/articles/saml/saml-configuration/saml-case1.png)

## Auth0 as the SAML Service and Identity Providers

You may opt to use Auth0 as both the SAML Service Provider **and** SAML Identity Provider.

![](/media/articles/saml/saml-configuration/saml-case3.png)

## Configuration

The following documentation cover the different aspects of SAML configuration:

* [Configure Auth0 as a Service Provider](/protocols/saml/saml-configuration/auth0-as-service-provider)
* [Configure Auth0 as an Identity Provider](/protocols/saml/saml-configuration/auth0-as-identity-provider)
* [Configure Auth0 as Both Service and Identity Provider](/protocols/saml/saml-configuration/auth0-as-identity-and-service-provider)
* [SAML Design Considerations](/protocols/saml/saml-configuration/design-considerations)
* [Supported SAML Options and Bindings](/protocols/saml/saml-configuration/supported-options-and-bindings)
* [Special Configuration Scenarios](/protocols/saml/saml-configuration/special-configuration-scenarios)
* [Customize SAML Assertions](/protocols/saml/saml-configuration/saml-assertions)
* [Select Between Multiple Identity Providers](/hrd)
* [Logout](/protocols/saml/saml-configuration/logout)
* [Deprovision Users](/protocols/saml/saml-configuration/deprovision-users)
* [Troubleshoot](/protocols/saml/saml-configuration/troubleshoot)


text:
package latinx

import (
	"bytes"
	"fmt"
	"unicode/utf8"
)

// Constants used to fetch *Converter
const (
	ISO_8859_1 = iota
	ISO_8859_2
	ISO_8859_3
	ISO_8859_4
	ISO_8859_5
	ISO_8859_6
	ISO_8859_7
	ISO_8859_8
	ISO_8859_9
	ISO_8859_10
	ISO_8859_11
	ISO_8859_13
	ISO_8859_14
	ISO_8859_15
	ISO_8859_16
	// Extended Latin-1 (Windows only, not a standard)
	Windows1252
	// Common aliases for the standards
	Latin1   = ISO_8859_1
	Latin2   = ISO_8859_2
	Latin3   = ISO_8859_3
	Latin4   = ISO_8859_4
	Cyrillic = ISO_8859_5
	Arabic   = ISO_8859_6
	Greek    = ISO_8859_7
	Hebrew   = ISO_8859_8
	Latin5   = ISO_8859_9
	Latin6   = ISO_8859_10
	Thai     = ISO_8859_11
	Latin7   = ISO_8859_13
	Latin8   = ISO_8859_14
	Latin9   = ISO_8859_15
	Latin10  = ISO_8859_16
	// The numbers (1,2) are just meant to
	// distinguish PARTIAL from ILLEGAL
	PARTIAL = UnicodeError(1)
	ILLEGAL = UnicodeError(2)
)

var converters map[int]*Converter

// A Converter holds mappings from ISO 8859 => UTF-8, and vice verca.
type Converter struct {
	id          string
	latinToUtf8 map[byte][]byte
	utf8ToLatin map[int]byte
}

func (c *Converter) String() string {
	return c.id
}

// Error type for Partial UTF-8 sequences
type UnicodeError int

func (e UnicodeError) Error() string {
	if int(e) == 1 {
		return "Partial UTF-8 sequence"
	}
	return "Illegal UTF-8 sequence"
}

// Error type for unknown ISO 8859 byte
type UnknownByteError string

func (e UnknownByteError) Error() string {
	return string(e)
}

// Error type for unknown UTF-8 runes
type UnknownRuneError string

func (e UnknownRuneError) Error() string {
	return string(e)
}

func init() {

	converters = make(map[int]*Converter)

	converters[ISO_8859_1] = newISO_8859_1Converter()
	converters[ISO_8859_2] = newISO_8859_2Converter()
	converters[ISO_8859_3] = newISO_8859_3Converter()
	converters[ISO_8859_4] = newISO_8859_4Converter()
	converters[ISO_8859_5] = newISO_8859_5Converter()
	converters[ISO_8859_6] = newISO_8859_6Converter()
	converters[ISO_8859_7] = newISO_8859_7Converter()
	converters[ISO_8859_8] = newISO_8859_8Converter()
	converters[ISO_8859_9] = newISO_8859_9Converter()
	converters[ISO_8859_10] = newISO_8859_10Converter()
	converters[ISO_8859_11] = newISO_8859_11Converter()
	converters[ISO_8859_13] = newISO_8859_13Converter()
	converters[ISO_8859_14] = newISO_8859_14Converter()
	converters[ISO_8859_15] = newISO_8859_15Converter()
	converters[ISO_8859_16] = newISO_8859_16Converter()
	converters[Windows1252] = newWindows1252Converter()

}

// Return *Converter || nil for unknown charset
func Get(charset int) *Converter {
	conv, ok := converters[charset]
	if !ok {
		return nil
	}
	return conv
}

// Return the String representation of all available encodings
func Available() (all []string) {
	for _, v := range converters {
		all = append(all, v.String())
	}
	return
}

// Convert a UTF-8 byte sequence into a ISO 8859 byte sequence. The errors returned
// by this function are either UnicodeError, which means that a partial UTF-8 symbol
// or an illegal UTF-8 sequence was found, i.e. either latinx.ILLEGAL, or latinx.PARTIAL.
// When a UnicodeError is returned, success < len(utf_8), and success indicates how
// many bytes that was successfully converted into UTF-8 bytes.
// If this function returns an UnknownRuneError, it means that the charset of the
// Converter has no mapping for a rune (UTF-8 letter) found in the utf_8 array.
func (c *Converter) Encode(utf_8 []byte) (latin []byte, success int, err error) {

	var ok bool
	var latinByte byte
	var offset, size int
	var rne rune
	var errmsg string
	var buf *bytes.Buffer

	buf = bytes.NewBuffer(make([]byte, len(utf_8)))
	buf.Reset()

	for offset < len(utf_8) {

		rne, size = utf8.DecodeRune(utf_8[offset:])

		if rne == utf8.RuneError {
			if utf8.RuneStart(utf_8[offset]) && len(utf_8)-offset < utf8.UTFMax {
				return buf.Bytes(), offset, PARTIAL // UnicodeError
			} else {
				return buf.Bytes(), offset, ILLEGAL // UnicodeError
			}
		} else if rne < utf8.RuneSelf {
			buf.WriteByte(utf_8[offset])
			offset++
		} else {
			latinByte, ok = c.utf8ToLatin[int(rne)]
			if !ok {
				errmsg = fmt.Sprintf("undefined: 0x%X in %s", rne, c.id)
				err = UnknownRuneError(errmsg)
				return buf.Bytes(), offset, err
			}
			buf.WriteByte(latinByte)
			offset += size
		}
	}
	return buf.Bytes(), offset, err
}

// Convert a ISO 8859 byte sequence into a UTF-8 byte sequence.
// If this function returns a UnknownByteError, the charset of the
// Converter does not have a unicode mapping for a byte found in latin.
func (c *Converter) Decode(latin []byte) (utf_8 []byte, err error) {

	var offset, i int
	var ok bool
	var utf8symbol []byte
	var errmsg string
	var buf *bytes.Buffer

	buf = bytes.NewBuffer(make([]byte, len(latin)*2))
	buf.Reset()

	for offset < len(latin) {

		if latin[offset] < utf8.RuneSelf {
			buf.WriteByte(latin[offset])
			offset++
		} else {
			utf8symbol, ok = c.latinToUtf8[latin[offset]]
			if !ok {
				errmsg = fmt.Sprintf("0x%X not valid in: %s", latin[offset], c.id)
				err = UnknownByteError(errmsg)
				return buf.Bytes(), err
			}
			for i = 0; i < len(utf8symbol); i++ {
				buf.WriteByte(utf8symbol[i])
			}
			offset++
		}
	}
	return buf.Bytes(), err
}

// Wrappers to avoid fetching a *Converter to do a single encode/decode

// Convert a UTF-8 encoded slice to a ISO-8859 encoded slice
func Encode(charset int, utf_8 []byte) (latin []byte, success int, err error) {
	return converters[charset].Encode(utf_8)
}

// Convert a ISO-8859 encoded slice to a UTF-8 encoded slice
func Decode(charset int, latin []byte) (utf_8 []byte, err error) {
	return converters[charset].Decode(latin)
}


text:
package io.flow.reference.data

import io.flow.reference.v0.models.{Currency, CurrencySymbols}

object Currencies {

  val All: Currency = Currency(iso42173 = "ALL", name = "Albanian Lek", numberDecimals = 2, defaultLocale = Some("sq-AL"), symbols = Some(CurrencySymbols(primary = "ALL", narrow = None)))
  val Dzd: Currency = Currency(iso42173 = "DZD", name = "Algerian Dinar", numberDecimals = 2, defaultLocale = Some("ar-DZ"), symbols = Some(CurrencySymbols(primary = "DZD", narrow = None)))
  val Ang: Currency = Currency(iso42173 = "ANG", name = "Antillian Guilder", numberDecimals = 2, defaultLocale = Some("nl-CW"), symbols = Some(CurrencySymbols(primary = "ANG", narrow = None)))
  val Ars: Currency = Currency(iso42173 = "ARS", name = "Argentine Peso", numberDecimals = 2, defaultLocale = Some("es-AR"), symbols = Some(CurrencySymbols(primary = "ARS", narrow = Some("$"))))
  val Amd: Currency = Currency(iso42173 = "AMD", name = "Armenian Dram", numberDecimals = 2, defaultLocale = Some("hy-AM"), symbols = Some(CurrencySymbols(primary = "AMD", narrow = None)))
  val Awg: Currency = Currency(iso42173 = "AWG", name = "Aruban Guilder", numberDecimals = 2, defaultLocale = Some("nl-AW"), symbols = Some(CurrencySymbols(primary = "AWG", narrow = None)))
  val Aud: Currency = Currency(iso42173 = "AUD", name = "Australian Dollar", numberDecimals = 2, defaultLocale = Some("en-AU"), symbols = Some(CurrencySymbols(primary = "A$", narrow = Some("$"))))
  val Azn: Currency = Currency(iso42173 = "AZN", name = "Azerbaijani manat", numberDecimals = 2, defaultLocale = Some("az"), symbols = Some(CurrencySymbols(primary = "AZN", narrow = None)))
  val Bsd: Currency = Currency(iso42173 = "BSD", name = "Bahamian Dollar", numberDecimals = 2, defaultLocale = Some("en-BS"), symbols = Some(CurrencySymbols(primary = "BSD", narrow = Some("$"))))
  val Bhd: Currency = Currency(iso42173 = "BHD", name = "Bahraini Dinar", numberDecimals = 3, defaultLocale = Some("ar-BH"), symbols = Some(CurrencySymbols(primary = "BHD", narrow = None)))
  val Bdt: Currency = Currency(iso42173 = "BDT", name = "Bangladesh Taka", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "BDT", narrow = Some("৳"))))
  val Bbd: Currency = Currency(iso42173 = "BBD", name = "Barbados Dollar", numberDecimals = 2, defaultLocale = Some("en-BB"), symbols = Some(CurrencySymbols(primary = "BBD", narrow = Some("$"))))
  val Bzd: Currency = Currency(iso42173 = "BZD", name = "Belize Dollar", numberDecimals = 2, defaultLocale = Some("en-BZ"), symbols = Some(CurrencySymbols(primary = "BZD", narrow = Some("$"))))
  val Bmd: Currency = Currency(iso42173 = "BMD", name = "Bermudian Dollar", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "BMD", narrow = Some("$"))))
  val Bob: Currency = Currency(iso42173 = "BOB", name = "Bolivia Boliviano", numberDecimals = 2, defaultLocale = Some("qu-BO"), symbols = Some(CurrencySymbols(primary = "BOB", narrow = Some("Bs"))))
  val Bam: Currency = Currency(iso42173 = "BAM", name = "Bosnia and Herzegovina Convertible Marks", numberDecimals = 2, defaultLocale = Some("hr-BA"), symbols = Some(CurrencySymbols(primary = "BAM", narrow = Some("KM"))))
  val Bwp: Currency = Currency(iso42173 = "BWP", name = "Botswana Pula", numberDecimals = 2, defaultLocale = Some("en-BW"), symbols = Some(CurrencySymbols(primary = "BWP", narrow = Some("P"))))
  val Brl: Currency = Currency(iso42173 = "BRL", name = "Brazilian Real", numberDecimals = 2, defaultLocale = Some("pt-BR"), symbols = Some(CurrencySymbols(primary = "R$", narrow = Some("R$"))))
  val Bnd: Currency = Currency(iso42173 = "BND", name = "Brunei Dollar", numberDecimals = 2, defaultLocale = Some("ms-BN"), symbols = Some(CurrencySymbols(primary = "BND", narrow = Some("$"))))
  val Mmk: Currency = Currency(iso42173 = "MMK", name = "Burmese Kyat", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "MMK", narrow = Some("K"))))
  val Khr: Currency = Currency(iso42173 = "KHR", name = "Cambodia Riel", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "KHR", narrow = Some("៛"))))
  val Cad: Currency = Currency(iso42173 = "CAD", name = "Canadian Dollar", numberDecimals = 2, defaultLocale = Some("en-CA"), symbols = Some(CurrencySymbols(primary = "CA$", narrow = Some("$"))))
  val Cve: Currency = Currency(iso42173 = "CVE", name = "Cape Verdi Escudo", numberDecimals = 0, defaultLocale = Some("pt-CV"), symbols = Some(CurrencySymbols(primary = "CVE", narrow = None)))
  val Kyd: Currency = Currency(iso42173 = "KYD", name = "Cayman Islands Dollar", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "KYD", narrow = Some("$"))))
  val Xof: Currency = Currency(iso42173 = "XOF", name = "CFA Franc BCEAO", numberDecimals = 0, defaultLocale = Some("ee-TG"), symbols = Some(CurrencySymbols(primary = "CFA", narrow = None)))
  val Xaf: Currency = Currency(iso42173 = "XAF", name = "CFA Franc BEAC", numberDecimals = 0, defaultLocale = Some("ar-TD"), symbols = Some(CurrencySymbols(primary = "FCFA", narrow = None)))
  val Xpf: Currency = Currency(iso42173 = "XPF", name = "CFP Franc", numberDecimals = 0, defaultLocale = Some("fr-PF"), symbols = Some(CurrencySymbols(primary = "CFPF", narrow = None)))
  val Clp: Currency = Currency(iso42173 = "CLP", name = "Chilean Peso", numberDecimals = 0, defaultLocale = Some("es-CL"), symbols = Some(CurrencySymbols(primary = "CLP", narrow = Some("$"))))
  val Cop: Currency = Currency(iso42173 = "COP", name = "Colombian Peso", numberDecimals = 2, defaultLocale = Some("es-CO"), symbols = Some(CurrencySymbols(primary = "COP", narrow = Some("$"))))
  val Kmf: Currency = Currency(iso42173 = "KMF", name = "Comoro Franc", numberDecimals = 0, defaultLocale = Some("ar-KM"), symbols = Some(CurrencySymbols(primary = "KMF", narrow = Some("CF"))))
  val Crc: Currency = Currency(iso42173 = "CRC", name = "Costa Rican Colon", numberDecimals = 2, defaultLocale = Some("es-CR"), symbols = Some(CurrencySymbols(primary = "CRC", narrow = Some("₡"))))
  val Hrk: Currency = Currency(iso42173 = "HRK", name = "Croatia Kuna", numberDecimals = 2, defaultLocale = Some("hr"), symbols = Some(CurrencySymbols(primary = "HRK", narrow = Some("kn"))))
  val Czk: Currency = Currency(iso42173 = "CZK", name = "Czech Koruna", numberDecimals = 2, defaultLocale = Some("cs-CZ"), symbols = Some(CurrencySymbols(primary = "CZK", narrow = Some("Kč"))))
  val Dkk: Currency = Currency(iso42173 = "DKK", name = "Danish Krone", numberDecimals = 2, defaultLocale = Some("da-DK"), symbols = Some(CurrencySymbols(primary = "DKK", narrow = Some("kr"))))
  val Djf: Currency = Currency(iso42173 = "DJF", name = "Djibouti Franc", numberDecimals = 0, defaultLocale = Some("ar-DJ"), symbols = Some(CurrencySymbols(primary = "DJF", narrow = None)))
  val Dop: Currency = Currency(iso42173 = "DOP", name = "Dominican Republic Peso", numberDecimals = 2, defaultLocale = Some("es-DO"), symbols = Some(CurrencySymbols(primary = "DOP", narrow = Some("$"))))
  val Xcd: Currency = Currency(iso42173 = "XCD", name = "East Carribean Dollar", numberDecimals = 2, defaultLocale = Some("en-AI"), symbols = Some(CurrencySymbols(primary = "EC$", narrow = Some("$"))))
  val Egp: Currency = Currency(iso42173 = "EGP", name = "Egyptian Pound", numberDecimals = 2, defaultLocale = Some("ar-EG"), symbols = Some(CurrencySymbols(primary = "EGP", narrow = Some("E£"))))
  val Svc: Currency = Currency(iso42173 = "SVC", name = "El Salvador Colón", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "SVC", narrow = None)))
  val Eek: Currency = Currency(iso42173 = "EEK", name = "Estonian Krone", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "EEK", narrow = None)))
  val Etb: Currency = Currency(iso42173 = "ETB", name = "Ethiopian Birr", numberDecimals = 2, defaultLocale = Some("am-ET"), symbols = Some(CurrencySymbols(primary = "ETB", narrow = None)))
  val Eur: Currency = Currency(iso42173 = "EUR", name = "Euro", numberDecimals = 2, defaultLocale = Some("de"), symbols = Some(CurrencySymbols(primary = "€", narrow = Some("€"))))
  val Fkp: Currency = Currency(iso42173 = "FKP", name = "Falkland Islands Pound", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "FKP", narrow = Some("£"))))
  val Fjd: Currency = Currency(iso42173 = "FJD", name = "Fiji Dollar", numberDecimals = 2, defaultLocale = Some("en-FJ"), symbols = Some(CurrencySymbols(primary = "FJD", narrow = Some("$"))))
  val Gmd: Currency = Currency(iso42173 = "GMD", name = "Gambia Delasi", numberDecimals = 2, defaultLocale = Some("en-GM"), symbols = Some(CurrencySymbols(primary = "GMD", narrow = None)))
  val Gel: Currency = Currency(iso42173 = "GEL", name = "Georgian Lari", numberDecimals = 2, defaultLocale = Some("ka-GE"), symbols = Some(CurrencySymbols(primary = "GEL", narrow = Some("₾"))))
  val Ghs: Currency = Currency(iso42173 = "GHS", name = "Ghanaian Cedi (3rd)", numberDecimals = 2, defaultLocale = Some("ak-GH"), symbols = Some(CurrencySymbols(primary = "GHS", narrow = None)))
  val Gip: Currency = Currency(iso42173 = "GIP", name = "Gibraltar Pound", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "GIP", narrow = Some("£"))))
  val Gtq: Currency = Currency(iso42173 = "GTQ", name = "Guatemala Quetzal", numberDecimals = 2, defaultLocale = Some("es-GT"), symbols = Some(CurrencySymbols(primary = "GTQ", narrow = Some("Q"))))
  val Gnf: Currency = Currency(iso42173 = "GNF", name = "Guinea Franc", numberDecimals = 0, defaultLocale = Some("fr-GN"), symbols = Some(CurrencySymbols(primary = "GNF", narrow = Some("FG"))))
  val Gyd: Currency = Currency(iso42173 = "GYD", name = "Guyanese Dollar", numberDecimals = 2, defaultLocale = Some("en-GY"), symbols = Some(CurrencySymbols(primary = "GYD", narrow = Some("$"))))
  val Htg: Currency = Currency(iso42173 = "HTG", name = "Haitian Gourde", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "HTG", narrow = None)))
  val Hnl: Currency = Currency(iso42173 = "HNL", name = "Honduras Lempira", numberDecimals = 2, defaultLocale = Some("es-HN"), symbols = Some(CurrencySymbols(primary = "HNL", narrow = Some("L"))))
  val Hkd: Currency = Currency(iso42173 = "HKD", name = "Hong Kong Dollar", numberDecimals = 2, defaultLocale = Some("zh-HK"), symbols = Some(CurrencySymbols(primary = "HK$", narrow = Some("$"))))
  val Huf: Currency = Currency(iso42173 = "HUF", name = "Hungarian Forint", numberDecimals = 0, defaultLocale = Some("hu"), symbols = Some(CurrencySymbols(primary = "HUF", narrow = Some("Ft"))))
  val Isk: Currency = Currency(iso42173 = "ISK", name = "Iceland Krona", numberDecimals = 2, defaultLocale = Some("is"), symbols = Some(CurrencySymbols(primary = "ISK", narrow = Some("kr"))))
  val Inr: Currency = Currency(iso42173 = "INR", name = "Indian Rupee", numberDecimals = 2, defaultLocale = Some("bn-IN"), symbols = Some(CurrencySymbols(primary = "₹", narrow = Some("₹"))))
  val Idr: Currency = Currency(iso42173 = "IDR", name = "Indonesian Rupiah", numberDecimals = 0, defaultLocale = Some("id"), symbols = Some(CurrencySymbols(primary = "IDR", narrow = Some("Rp"))))
  val Jmd: Currency = Currency(iso42173 = "JMD", name = "Jamaican Dollar", numberDecimals = 2, defaultLocale = Some("en-JM"), symbols = Some(CurrencySymbols(primary = "JMD", narrow = Some("$"))))
  val Jpy: Currency = Currency(iso42173 = "JPY", name = "Japanese Yen", numberDecimals = 0, defaultLocale = Some("ja-JP"), symbols = Some(CurrencySymbols(primary = "¥", narrow = Some("¥"))))
  val Jod: Currency = Currency(iso42173 = "JOD", name = "Jordanian Dinar", numberDecimals = 3, defaultLocale = Some("ar-JO"), symbols = Some(CurrencySymbols(primary = "JOD", narrow = None)))
  val Kzt: Currency = Currency(iso42173 = "KZT", name = "Kazakhstani Tenge", numberDecimals = 2, defaultLocale = Some("kk-KZ"), symbols = Some(CurrencySymbols(primary = "KZT", narrow = Some("₸"))))
  val Kes: Currency = Currency(iso42173 = "KES", name = "Kenyan Shilling", numberDecimals = 2, defaultLocale = Some("en-KE"), symbols = Some(CurrencySymbols(primary = "KES", narrow = None)))
  val Kwd: Currency = Currency(iso42173 = "KWD", name = "Kuwaiti Dinar", numberDecimals = 3, defaultLocale = Some("ar-KW"), symbols = Some(CurrencySymbols(primary = "KWD", narrow = None)))
  val Aoa: Currency = Currency(iso42173 = "AOA", name = "Kwanza", numberDecimals = 2, defaultLocale = Some("pt-AO"), symbols = Some(CurrencySymbols(primary = "AOA", narrow = Some("Kz"))))
  val Kgs: Currency = Currency(iso42173 = "KGS", name = "Kyrgyzstan Som", numberDecimals = 2, defaultLocale = Some("ru-KG"), symbols = Some(CurrencySymbols(primary = "KGS", narrow = None)))
  val Lak: Currency = Currency(iso42173 = "LAK", name = "Laos Kip", numberDecimals = 2, defaultLocale = Some("lo-LA"), symbols = Some(CurrencySymbols(primary = "LAK", narrow = Some("₭"))))
  val Lvl: Currency = Currency(iso42173 = "LVL", name = "Latvian Lats", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "LVL", narrow = Some("Ls"))))
  val Lbp: Currency = Currency(iso42173 = "LBP", name = "Lebanese Pound", numberDecimals = 2, defaultLocale = Some("ar-LB"), symbols = Some(CurrencySymbols(primary = "LBP", narrow = Some("L£"))))
  val Lyd: Currency = Currency(iso42173 = "LYD", name = "Libyan Dinar", numberDecimals = 3, defaultLocale = Some("ar-LY"), symbols = Some(CurrencySymbols(primary = "LYD", narrow = None)))
  val Ltl: Currency = Currency(iso42173 = "LTL", name = "Lithuanian Litas", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "LTL", narrow = Some("Lt"))))
  val Mop: Currency = Currency(iso42173 = "MOP", name = "Macau Pataca", numberDecimals = 2, defaultLocale = Some("zh-MO"), symbols = Some(CurrencySymbols(primary = "MOP", narrow = None)))
  val Mga: Currency = Currency(iso42173 = "MGA", name = "Malagasy Ariary", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "MGA", narrow = Some("Ar"))))
  val Mwk: Currency = Currency(iso42173 = "MWK", name = "Malawi Kwacha", numberDecimals = 2, defaultLocale = Some("en-MW"), symbols = Some(CurrencySymbols(primary = "MWK", narrow = None)))
  val Myr: Currency = Currency(iso42173 = "MYR", name = "Malaysian Ringgit", numberDecimals = 2, defaultLocale = Some("en-MY"), symbols = Some(CurrencySymbols(primary = "MYR", narrow = Some("RM"))))
  val Mvr: Currency = Currency(iso42173 = "MVR", name = "Maldives Rufiyaa", numberDecimals = 2, defaultLocale = Some("dv-MV"), symbols = Some(CurrencySymbols(primary = "MVR", narrow = None)))
  val Mro: Currency = Currency(iso42173 = "MRO", name = "Mauritania Ouguiya", numberDecimals = 1, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "MRO", narrow = None)))
  val Mur: Currency = Currency(iso42173 = "MUR", name = "Mauritius Rupee", numberDecimals = 2, defaultLocale = Some("en-MU"), symbols = Some(CurrencySymbols(primary = "MUR", narrow = Some("Rs"))))
  val Mxn: Currency = Currency(iso42173 = "MXN", name = "Mexican Peso", numberDecimals = 2, defaultLocale = Some("es-MX"), symbols = Some(CurrencySymbols(primary = "MX$", narrow = Some("$"))))
  val Mdl: Currency = Currency(iso42173 = "MDL", name = "Moldovia Leu", numberDecimals = 2, defaultLocale = Some("ro-MD"), symbols = Some(CurrencySymbols(primary = "MDL", narrow = None)))
  val Mnt: Currency = Currency(iso42173 = "MNT", name = "Mongolia Tugrik", numberDecimals = 2, defaultLocale = Some("mn"), symbols = Some(CurrencySymbols(primary = "MNT", narrow = Some("₮"))))
  val Mad: Currency = Currency(iso42173 = "MAD", name = "Moroccan Dirham", numberDecimals = 2, defaultLocale = Some("ar-MA"), symbols = Some(CurrencySymbols(primary = "MAD", narrow = None)))
  val Mzn: Currency = Currency(iso42173 = "MZN", name = "Mozambique Metical", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "MZN", narrow = None)))
  val Nad: Currency = Currency(iso42173 = "NAD", name = "Namibian Dollar", numberDecimals = 2, defaultLocale = Some("en-NA"), symbols = Some(CurrencySymbols(primary = "NAD", narrow = Some("$"))))
  val Npr: Currency = Currency(iso42173 = "NPR", name = "Nepalese Rupee", numberDecimals = 2, defaultLocale = Some("ne-NP"), symbols = Some(CurrencySymbols(primary = "NPR", narrow = Some("Rs"))))
  val Byn: Currency = Currency(iso42173 = "BYN", name = "New Belarusian Ruble", numberDecimals = 2, defaultLocale = Some("ru-BY"), symbols = Some(CurrencySymbols(primary = "BYN", narrow = Some("р."))))
  val Bgn: Currency = Currency(iso42173 = "BGN", name = "New Bulgarian Lev", numberDecimals = 2, defaultLocale = Some("bg"), symbols = Some(CurrencySymbols(primary = "BGN", narrow = None)))
  val Pgk: Currency = Currency(iso42173 = "PGK", name = "New Guinea Kina", numberDecimals = 2, defaultLocale = Some("en-PG"), symbols = Some(CurrencySymbols(primary = "PGK", narrow = None)))
  val Ils: Currency = Currency(iso42173 = "ILS", name = "New Israeli Scheqel", numberDecimals = 2, defaultLocale = Some("ar-IL"), symbols = Some(CurrencySymbols(primary = "₪", narrow = Some("₪"))))
  val Pln: Currency = Currency(iso42173 = "PLN", name = "New Polish Zloty", numberDecimals = 2, defaultLocale = Some("pl"), symbols = Some(CurrencySymbols(primary = "PLN", narrow = Some("zł"))))
  val Ron: Currency = Currency(iso42173 = "RON", name = "New Romanian Lei", numberDecimals = 2, defaultLocale = Some("ro"), symbols = Some(CurrencySymbols(primary = "RON", narrow = Some("lei"))))
  val Twd: Currency = Currency(iso42173 = "TWD", name = "New Taiwan Dollar", numberDecimals = 0, defaultLocale = Some("zh-TW"), symbols = Some(CurrencySymbols(primary = "NT$", narrow = Some("$"))))
  val Try: Currency = Currency(iso42173 = "TRY", name = "New Turkish Lira", numberDecimals = 2, defaultLocale = Some("tr"), symbols = Some(CurrencySymbols(primary = "TRY", narrow = Some("₺"))))
  val Nzd: Currency = Currency(iso42173 = "NZD", name = "New Zealand Dollar", numberDecimals = 2, defaultLocale = Some("en-CK"), symbols = Some(CurrencySymbols(primary = "NZ$", narrow = Some("$"))))
  val Nio: Currency = Currency(iso42173 = "NIO", name = "Nicaragua Cordoba Oro", numberDecimals = 2, defaultLocale = Some("es-NI"), symbols = Some(CurrencySymbols(primary = "NIO", narrow = Some("C$"))))
  val Ngn: Currency = Currency(iso42173 = "NGN", name = "Nigerian Naira", numberDecimals = 2, defaultLocale = Some("en-NG"), symbols = Some(CurrencySymbols(primary = "NGN", narrow = Some("₦"))))
  val Nok: Currency = Currency(iso42173 = "NOK", name = "Norwegian Krone", numberDecimals = 2, defaultLocale = Some("nb-NO"), symbols = Some(CurrencySymbols(primary = "NOK", narrow = Some("kr"))))
  val Pkr: Currency = Currency(iso42173 = "PKR", name = "Pakistan Rupee", numberDecimals = 2, defaultLocale = Some("en-PK"), symbols = Some(CurrencySymbols(primary = "PKR", narrow = Some("Rs"))))
  val Pab: Currency = Currency(iso42173 = "PAB", name = "Panamanian Balboa", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "PAB", narrow = None)))
  val Pyg: Currency = Currency(iso42173 = "PYG", name = "Paraguay Guarani", numberDecimals = 0, defaultLocale = Some("es-PY"), symbols = Some(CurrencySymbols(primary = "PYG", narrow = Some("₲"))))
  val Pen: Currency = Currency(iso42173 = "PEN", name = "Peruvian Nuevo Sol", numberDecimals = 2, defaultLocale = Some("es-PE"), symbols = Some(CurrencySymbols(primary = "PEN", narrow = None)))
  val Uyu: Currency = Currency(iso42173 = "UYU", name = "Peso Uruguayo", numberDecimals = 2, defaultLocale = Some("es-UY"), symbols = Some(CurrencySymbols(primary = "UYU", narrow = Some("$"))))
  val Php: Currency = Currency(iso42173 = "PHP", name = "Philippine Peso", numberDecimals = 2, defaultLocale = Some("en-PH"), symbols = Some(CurrencySymbols(primary = "PHP", narrow = Some("₱"))))
  val Gbp: Currency = Currency(iso42173 = "GBP", name = "Pound Sterling", numberDecimals = 2, defaultLocale = Some("en-GB"), symbols = Some(CurrencySymbols(primary = "£", narrow = Some("£"))))
  val Qar: Currency = Currency(iso42173 = "QAR", name = "Qatari Rial", numberDecimals = 2, defaultLocale = Some("ar-QA"), symbols = Some(CurrencySymbols(primary = "QAR", narrow = None)))
  val Omr: Currency = Currency(iso42173 = "OMR", name = "Rial Omani", numberDecimals = 3, defaultLocale = Some("ar-OM"), symbols = Some(CurrencySymbols(primary = "OMR", narrow = None)))
  val Rub: Currency = Currency(iso42173 = "RUB", name = "Russian Ruble", numberDecimals = 0, defaultLocale = Some("ru"), symbols = Some(CurrencySymbols(primary = "RUB", narrow = Some("₽"))))
  val Rwf: Currency = Currency(iso42173 = "RWF", name = "Rwanda Franc", numberDecimals = 0, defaultLocale = Some("en-RW"), symbols = Some(CurrencySymbols(primary = "RWF", narrow = Some("RF"))))
  val Wst: Currency = Currency(iso42173 = "WST", name = "Samoan Tala", numberDecimals = 2, defaultLocale = Some("en-WS"), symbols = Some(CurrencySymbols(primary = "WST", narrow = None)))
  val Std: Currency = Currency(iso42173 = "STD", name = "Sao Tome & Principe Dobra", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "STD", narrow = None)))
  val Sar: Currency = Currency(iso42173 = "SAR", name = "Saudi Riyal", numberDecimals = 2, defaultLocale = Some("ar-SA"), symbols = Some(CurrencySymbols(primary = "SAR", narrow = None)))
  val Rsd: Currency = Currency(iso42173 = "RSD", name = "Serbian Dinar", numberDecimals = 2, defaultLocale = Some("sr-RS"), symbols = Some(CurrencySymbols(primary = "RSD", narrow = None)))
  val Scr: Currency = Currency(iso42173 = "SCR", name = "Seychelles Rupee", numberDecimals = 2, defaultLocale = Some("en-SC"), symbols = Some(CurrencySymbols(primary = "SCR", narrow = None)))
  val Sll: Currency = Currency(iso42173 = "SLL", name = "Sierra Leone", numberDecimals = 2, defaultLocale = Some("en-SL"), symbols = Some(CurrencySymbols(primary = "SLL", narrow = None)))
  val Sgd: Currency = Currency(iso42173 = "SGD", name = "Singapore Dollar", numberDecimals = 2, defaultLocale = Some("zh-SG"), symbols = Some(CurrencySymbols(primary = "SGD", narrow = Some("$"))))
  val Sbd: Currency = Currency(iso42173 = "SBD", name = "Solomon Island Dollar", numberDecimals = 2, defaultLocale = Some("en-SB"), symbols = Some(CurrencySymbols(primary = "SBD", narrow = Some("$"))))
  val Sos: Currency = Currency(iso42173 = "SOS", name = "Somalia Shilling", numberDecimals = 2, defaultLocale = Some("ar-SO"), symbols = Some(CurrencySymbols(primary = "SOS", narrow = None)))
  val Tjs: Currency = Currency(iso42173 = "TJS", name = "Somoni", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "TJS", narrow = None)))
  val Zar: Currency = Currency(iso42173 = "ZAR", name = "South African Rand", numberDecimals = 2, defaultLocale = Some("en-LS"), symbols = Some(CurrencySymbols(primary = "ZAR", narrow = Some("R"))))
  val Krw: Currency = Currency(iso42173 = "KRW", name = "South-Korean Won", numberDecimals = 0, defaultLocale = Some("ko-KR"), symbols = Some(CurrencySymbols(primary = "₩", narrow = Some("₩"))))
  val Lkr: Currency = Currency(iso42173 = "LKR", name = "Sri Lanka Rupee", numberDecimals = 2, defaultLocale = Some("ta-LK"), symbols = Some(CurrencySymbols(primary = "LKR", narrow = Some("Rs"))))
  val Shp: Currency = Currency(iso42173 = "SHP", name = "St. Helena Pound", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "SHP", narrow = Some("£"))))
  val Srd: Currency = Currency(iso42173 = "SRD", name = "Surinam Dollar", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "SRD", narrow = Some("$"))))
  val Szl: Currency = Currency(iso42173 = "SZL", name = "Swaziland Lilangeni", numberDecimals = 2, defaultLocale = Some("en-SZ"), symbols = Some(CurrencySymbols(primary = "SZL", narrow = None)))
  val Sek: Currency = Currency(iso42173 = "SEK", name = "Swedish Krone", numberDecimals = 2, defaultLocale = Some("sv-SE"), symbols = Some(CurrencySymbols(primary = "SEK", narrow = Some("kr"))))
  val Chf: Currency = Currency(iso42173 = "CHF", name = "Swiss Franc", numberDecimals = 2, defaultLocale = Some("fr-CH"), symbols = Some(CurrencySymbols(primary = "CHF", narrow = None)))
  val Tzs: Currency = Currency(iso42173 = "TZS", name = "Tanzanian Shilling", numberDecimals = 2, defaultLocale = Some("en-TZ"), symbols = Some(CurrencySymbols(primary = "TZS", narrow = None)))
  val Thb: Currency = Currency(iso42173 = "THB", name = "Thai Baht", numberDecimals = 2, defaultLocale = Some("th"), symbols = Some(CurrencySymbols(primary = "THB", narrow = Some("฿"))))
  val Top: Currency = Currency(iso42173 = "TOP", name = "Tonga Pa'anga", numberDecimals = 2, defaultLocale = Some("en-TO"), symbols = Some(CurrencySymbols(primary = "TOP", narrow = Some("T$"))))
  val Ttd: Currency = Currency(iso42173 = "TTD", name = "Trinidad & Tobago Dollar", numberDecimals = 2, defaultLocale = Some("en-TT"), symbols = Some(CurrencySymbols(primary = "TTD", narrow = Some("$"))))
  val Tnd: Currency = Currency(iso42173 = "TND", name = "Tunisian Dinar", numberDecimals = 3, defaultLocale = Some("ar-TN"), symbols = Some(CurrencySymbols(primary = "TND", narrow = None)))
  val Tmt: Currency = Currency(iso42173 = "TMT", name = "Turkmenistan New Manat", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "TMT", narrow = None)))
  val Aed: Currency = Currency(iso42173 = "AED", name = "UAE Dirham", numberDecimals = 2, defaultLocale = Some("ar-AE"), symbols = Some(CurrencySymbols(primary = "AED", narrow = None)))
  val Ugx: Currency = Currency(iso42173 = "UGX", name = "Uganda Shilling", numberDecimals = 0, defaultLocale = Some("en-UG"), symbols = Some(CurrencySymbols(primary = "UGX", narrow = None)))
  val Uah: Currency = Currency(iso42173 = "UAH", name = "Ukraine Hryvnia", numberDecimals = 2, defaultLocale = Some("uk-UA"), symbols = Some(CurrencySymbols(primary = "UAH", narrow = Some("₴"))))
  val Usd: Currency = Currency(iso42173 = "USD", name = "US Dollars", numberDecimals = 2, defaultLocale = Some("en-US"), symbols = Some(CurrencySymbols(primary = "US$", narrow = Some("$"))))
  val Uzs: Currency = Currency(iso42173 = "UZS", name = "Uzbekistani Som", numberDecimals = 2, defaultLocale = Some("uz"), symbols = Some(CurrencySymbols(primary = "UZS", narrow = None)))
  val Vuv: Currency = Currency(iso42173 = "VUV", name = "Vanuatu Vatu", numberDecimals = 0, defaultLocale = Some("en-VU"), symbols = Some(CurrencySymbols(primary = "VUV", narrow = None)))
  val Vef: Currency = Currency(iso42173 = "VEF", name = "Venezuelan Bolívar Fuerte", numberDecimals = 2, defaultLocale = None, symbols = Some(CurrencySymbols(primary = "VEF", narrow = Some("Bs"))))
  val Vnd: Currency = Currency(iso42173 = "VND", name = "Vietnamese New Dong", numberDecimals = 0, defaultLocale = Some("vi-VN"), symbols = Some(CurrencySymbols(primary = "₫", narrow = Some("₫"))))
  val Yer: Currency = Currency(iso42173 = "YER", name = "Yemeni Rial", numberDecimals = 2, defaultLocale = Some("ar-YE"), symbols = Some(CurrencySymbols(primary = "YER", narrow = None)))
  val Cny: Currency = Currency(iso42173 = "CNY", name = "Yuan Renminbi", numberDecimals = 2, defaultLocale = Some("zh-CN"), symbols = Some(CurrencySymbols(primary = "CN¥", narrow = Some("¥"))))
  val Zmw: Currency = Currency(iso42173 = "ZMW", name = "Zambia Kwacha", numberDecimals = 2, defaultLocale = Some("en-ZM"), symbols = Some(CurrencySymbols(primary = "ZMW", narrow = Some("ZK"))))

  val all: Seq[Currency] = Seq(
    All,
    Dzd,
    Ang,
    Ars,
    Amd,
    Awg,
    Aud,
    Azn,
    Bsd,
    Bhd,
    Bdt,
    Bbd,
    Bzd,
    Bmd,
    Bob,
    Bam,
    Bwp,
    Brl,
    Bnd,
    Mmk,
    Khr,
    Cad,
    Cve,
    Kyd,
    Xof,
    Xaf,
    Xpf,
    Clp,
    Cop,
    Kmf,
    Crc,
    Hrk,
    Czk,
    Dkk,
    Djf,
    Dop,
    Xcd,
    Egp,
    Svc,
    Eek,
    Etb,
    Eur,
    Fkp,
    Fjd,
    Gmd,
    Gel,
    Ghs,
    Gip,
    Gtq,
    Gnf,
    Gyd,
    Htg,
    Hnl,
    Hkd,
    Huf,
    Isk,
    Inr,
    Idr,
    Jmd,
    Jpy,
    Jod,
    Kzt,
    Kes,
    Kwd,
    Aoa,
    Kgs,
    Lak,
    Lvl,
    Lbp,
    Lyd,
    Ltl,
    Mop,
    Mga,
    Mwk,
    Myr,
    Mvr,
    Mro,
    Mur,
    Mxn,
    Mdl,
    Mnt,
    Mad,
    Mzn,
    Nad,
    Npr,
    Byn,
    Bgn,
    Pgk,
    Ils,
    Pln,
    Ron,
    Twd,
    Try,
    Nzd,
    Nio,
    Ngn,
    Nok,
    Pkr,
    Pab,
    Pyg,
    Pen,
    Uyu,
    Php,
    Gbp,
    Qar,
    Omr,
    Rub,
    Rwf,
    Wst,
    Std,
    Sar,
    Rsd,
    Scr,
    Sll,
    Sgd,
    Sbd,
    Sos,
    Tjs,
    Zar,
    Krw,
    Lkr,
    Shp,
    Srd,
    Szl,
    Sek,
    Chf,
    Tzs,
    Thb,
    Top,
    Ttd,
    Tnd,
    Tmt,
    Aed,
    Ugx,
    Uah,
    Usd,
    Uzs,
    Vuv,
    Vef,
    Vnd,
    Yer,
    Cny,
    Zmw
  )

  val unsupported: Set[Currency] = Set(Ltl, Lvl, Eek)
  val supported: Seq[Currency] = all.filterNot(unsupported.contains)

}


text:
<?php

/**
 * This action will delete or undelete a profile.
 *
 * @author Lester Lievens <lester@netlash.com>
 */
class BackendProfilesDelete extends BackendBaseActionDelete
{
	/**
	 * Execute the action.
	 */
	public function execute()
	{
		// get parameters
		$this->id = $this->getParameter('id', 'int');

		// does the item exist
		if($this->id !== null && BackendProfilesModel::exists($this->id))
		{
			// call parent, this will probably add some general CSS/JS or other required files
			parent::execute();

			// get profile
			$profile = BackendProfilesModel::get($this->id);

			// already deleted? Prolly want to undo then
			if($profile['status'] === 'deleted')
			{
				// set profile status to active
				BackendProfilesModel::update($this->id, array('status' => 'active'));

				// trigger event
				BackendModel::triggerEvent($this->getModule(), 'after_reactivate', array('id' => $this->id));

				// redirect
				$this->redirect(BackendModel::createURLForAction('index') . '&report=profile-undeleted&var=' . urlencode($profile['email']) . '&highlight=row-' . $profile['id']);
			}

			// profile is active
			else
			{
				// delete profile
				BackendProfilesModel::delete($this->id);

				// trigger event
				BackendModel::triggerEvent($this->getModule(), 'after_delete_profile', array('id' => $this->id));

				// redirect
				$this->redirect(BackendModel::createURLForAction('index') . '&report=profile-deleted&var=' . urlencode($profile['email']) . '&highlight=row-' . $profile['id']);
			}
		}

		// profile does not exists
		else $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
	}
}


text:
cd "$(dirname "${BASH_SOURCE}")";

# git pull origin master;

function doIt() {
	rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" \
		--exclude "README.md" --exclude "LICENSE-MIT.txt" -avh --no-perms . ~;
	source ~/.bash_profile;
}

if [ "$1" == "--force" -o "$1" == "-f" ]; then
	doIt;
else
	read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1;
	echo "";
	if [[ $REPLY =~ ^[Yy]$ ]]; then
		doIt;
	fi;
fi;
unset doIt;

# install Vundle for vim plugins
# Bootstrap additional apps
# source apps.sh;
# do brewfile and caskfile?


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using DigitalPlatform.Text;

namespace dp2Circulation
{
    public partial class GetWordFontsDialog : Form
    {
        public GetWordFontsDialog()
        {
            InitializeComponent();
        }

        // https://social.msdn.microsoft.com/Forums/en-US/9beda373-b616-43e7-8eca-f2cc876385db/how-can-i-get-the-language-of-the-fontfamily?forum=csharpgeneral
        static List<string> GetAllFonts()
        {
            /*
             * using System.Windows.Media;
             * using FontFamily = System.Windows.Media.FontFamily;

            List<string> results = new List<string>();

            foreach (var font in Fonts.SystemFontFamilies)
            {
                var names = font.FamilyMaps;

                var first = font.FamilyNames.FirstOrDefault();
                results.Add(first.Key + " " + first.Value);
            }
            return results;
            */

            List<string> results = new List<string>();
            InstalledFontCollection fonts = new InstalledFontCollection();
            foreach (FontFamily font in fonts.Families)
            {
                results.Add(font.Name);
            }

            return results;
        }

        private void GetWordFontsDialog_Load(object sender, EventArgs e)
        {
            var results = GetAllFonts();
            this.comboBox_ascii.Items.AddRange(results.ToArray());
            this.comboBox_hAnsi.Items.AddRange(results.ToArray());
            this.comboBox_eastAsia.Items.AddRange(results.ToArray());
            this.comboBox_cs.Items.AddRange(results.ToArray());
        }

        private void button_OK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void button_Cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        public string FontName
        {
            get
            {
                List<string> results = new List<string>();
                var ascii = this.comboBox_ascii.Text;
                if (string.IsNullOrEmpty(ascii) == false)
                    results.Add($"ascii:{ascii}");
                var hAnsi = this.comboBox_hAnsi.Text;
                if (string.IsNullOrEmpty(hAnsi) == false)
                    results.Add($"hAnsi:{hAnsi}");
                var eastAsia = this.comboBox_eastAsia.Text;
                if (string.IsNullOrEmpty(eastAsia) == false)
                    results.Add($"eastAsia:{eastAsia}");
                var cs = this.comboBox_cs.Text;
                if (string.IsNullOrEmpty(cs) == false)
                    results.Add($"cs:{cs}");
                return StringUtil.MakePathList(results);
            }
            set
            {
                var ascii = StringUtil.GetParameterByPrefix(value, "ascii");
                this.comboBox_ascii.Text = ascii;

                var hAnsi = StringUtil.GetParameterByPrefix(value, "hAnsi");
                this.comboBox_hAnsi.Text = hAnsi;

                var eastAsia = StringUtil.GetParameterByPrefix(value, "eastAsia");
                this.comboBox_eastAsia.Text = eastAsia;

                var cs = StringUtil.GetParameterByPrefix(value, "cs");
                this.comboBox_cs.Text = cs;
            }
        }
    }
}


text:
package io.gatling.core.stats.writer

import java.util.GregorianCalendar

import scala.collection.mutable

import io.gatling.BaseSpec
import io.gatling.core.config.GatlingConfiguration

class ConsoleDataWriterSpec extends BaseSpec {

  val configuration = GatlingConfiguration.loadForTest()

  val time = new GregorianCalendar(2012, 8, 24, 13, 37).getTime

  def lines(summary: ConsoleSummary) = summary.text.toString.split("\r?\n")

  def progressBar(summary: ConsoleSummary) = lines(summary)(8)

  def requestsInfo(summary: ConsoleSummary) = lines(summary).slice(3, 6).mkString(sys.props("line.separator"))

  def errorsInfo(summary: ConsoleSummary) = lines(summary).slice(6, 9).mkString(sys.props("line.separator"))

  "console summary progress bar" should "handle it correctly when all the users are waiting" in {

    val counters = new UserCounters(11)

    val summary = ConsoleSummary(10000, mutable.Map("request1" -> counters), new RequestCounters, mutable.Map.empty, mutable.Map.empty, configuration, time)
    summary.complete shouldBe false
    progressBar(summary) shouldBe "[                                                                          ]  0%"
  }

  it should "handle it correctly when all the users are active" in {

    val counters = new UserCounters(11)
    for (i <- 1 to 11) counters.userStart()

    val summary = ConsoleSummary(10000, mutable.Map("request1" -> counters), new RequestCounters, mutable.Map.empty, mutable.Map.empty, configuration, time)
    summary.complete shouldBe false
    progressBar(summary) shouldBe "[--------------------------------------------------------------------------]  0%"
  }

  it should "handle it correctly when all the users are done" in {

    val counters = new UserCounters(11)
    for (i <- 1 to 11) counters.userStart()
    for (i <- 1 to 11) counters.userDone()

    val summary = ConsoleSummary(10000, mutable.Map("request1" -> counters), new RequestCounters, mutable.Map.empty, mutable.Map.empty, configuration, time)
    summary.complete shouldBe true
    progressBar(summary) shouldBe "[##########################################################################]100%"
  }

  it should "handle it correctly when there are active and done users" in {

    val counters = new UserCounters(11)
    for (i <- 1 to 11) counters.userStart()
    for (i <- 1 to 10) counters.userDone()

    val summary = ConsoleSummary(10000, mutable.Map("request1" -> counters), new RequestCounters, mutable.Map.empty, mutable.Map.empty, configuration, time)
    summary.complete shouldBe false
    progressBar(summary) shouldBe "[###################################################################-------] 90%"
  }

  "console summary" should "display requests without errors" in {
    val requestCounters = mutable.Map("request1" -> new RequestCounters(20, 0))

    val summary = ConsoleSummary(10000, mutable.Map("request1" -> new UserCounters(11)), new RequestCounters(20, 0), requestCounters, mutable.Map.empty, configuration, time)

    val actual = requestsInfo(summary)
    actual shouldBe """---- Requests ------------------------------------------------------------------
                      |> Global                                                   (OK=20     KO=0     )
                      |> request1                                                 (OK=20     KO=0     )""".stripMargin
  }

  it should "display requests with multiple errors" in {
    val requestCounters = mutable.Map("request1" -> new RequestCounters(0, 20))

    val errorsCounters1 = mutable.Map("error1" -> 19, "error2" -> 1)
    val summary1 = ConsoleSummary(10000, mutable.Map("request1" -> new UserCounters(11)), new RequestCounters(0, 20),
      requestCounters, errorsCounters1, configuration, time)

    val output = errorsInfo(summary1)

    output shouldBe s"""|---- Errors --------------------------------------------------------------------
          |> error1                                                             19 (${ConsoleErrorsWriter.formatPercent(95.0)}%)
          |> error2                                                              1 ( ${ConsoleErrorsWriter.formatPercent(5.0)}%)""".stripMargin
    all(output.lines.map(_.length).toSet) shouldBe <=(80)
  }

  it should "display requests with high number of errors" in {
    val requestCounters = mutable.Map("request1" -> new RequestCounters(0, 123456))
    val loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
    val errorsCounters = mutable.Map(loremIpsum -> 123456)
    val summary = ConsoleSummary(10000, mutable.Map("request1" -> new UserCounters(11)), new RequestCounters(0, 123456),
      requestCounters, errorsCounters, configuration, time)

    val output = errorsInfo(summary)

    output shouldBe s"""|---- Errors --------------------------------------------------------------------
          |> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed  123456 (${ConsoleErrorsWriter.OneHundredPercent}%)
          |do eiusmod tempor incididunt ut labore et dolore magna aliqua....""".stripMargin
    all(output.lines.map(_.length).toSet) shouldBe <=(80)
  }
}


text:
meego-handset-camera
====================


text:
<?php

use yii\db\Schema;
use yii\db\Migration;

class m151231_055004_alter_table_game extends Migration
{

	public function up()
	{
		$this->addColumn('{{%game}}', 'sort', $this->integer()->defaultValue(0));
		$this->alterColumn('{{%game}}', 'is_recommend', $this->smallInteger()->defaultValue(0));
		$this->dropColumn('{{%game}}', 'is_hot');
		$this->dropColumn('{{%game}}', 'is_new');

	}

	public function down()
	{
		$this->addColumn('{{%game}}', 'is_new', $this->smallInteger()->notNull());
		$this->addColumn('{{%game}}', 'is_hot', $this->smallInteger()->notNull());
		$this->alterColumn('{{%game}}', 'is_recommend', $this->smallInteger()->notNull());
		$this->dropColumn('{{%game}}', 'sort');
	}
}


text:
package org.apache.commons.javaflow;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.lang.instrument.Instrumentation;
import java.util.List;

import static java.util.stream.Collectors.toList;

/**
 * Continuation instrumentation agent
 *
 * @author kostas.kougios
 * Date: 11/11/15
 */
public class Agent {
	public static void premain(String agentArgs, Instrumentation inst) throws ClassNotFoundException, IllegalAccessException, InstantiationException, IOException {

		File workDir = new File("continuations-conf");
		System.out.println("Continuations, instrumenting. Work dir is " + workDir.getAbsolutePath());

		File instr = new File(workDir, "instrument.prefixes");
		List<String> prefixes = ((List<String>) FileUtils.readLines(instr)).stream()
				.map(String::trim)
				.filter(s -> !s.startsWith("#"))
				.filter(s -> !s.isEmpty())
				.collect(toList());
		System.out.println("Instrumenting prefixes : " + prefixes);
		// registers the transformer
		inst.addTransformer(ContinuationClassFileTransformer.asmTransformer(prefixes), true);
	}
}


text:
package uk.co.cbray.msc.nhsdsp.controller;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.*;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.verify;

import java.math.BigDecimal;

import javax.servlet.http.HttpSession;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;

import uk.co.cbray.msc.nhsdsp.dao.DataAccessObject;
import uk.co.cbray.msc.nhsdsp.dao.DiagnosisRepository;
import uk.co.cbray.msc.nhsdsp.dao.IllnessRepository;
import uk.co.cbray.msc.nhsdsp.dao.UserRepository;
import uk.co.cbray.msc.nhsdsp.entity.Diagnosis;
import uk.co.cbray.msc.nhsdsp.forms.DiagnosisForm;
import uk.co.cbray.msc.nhsdsp.forms.SearchForm;
import uk.co.cbray.msc.nhsdsp.forms.ViewUserForm;
import uk.co.cbray.msc.nhsdsp.test.utils.TestFactory;

public class DiagnosisControllerTest {

	@Mock
	private IllnessRepository illnessRepo;
	@Mock
	private UserRepository userRepo;
	@Mock
	private DiagnosisRepository diagnosisRepo;
	@Mock
	private DataAccessObject dao;
	@Mock
	private HttpSession session;

	private Model model;
	private DiagnosisController controller;

	private Integer userId = 1;

	@Before
	public void SetUp() {

		MockitoAnnotations.initMocks(this);

		Mockito.when(userRepo.findById((BigDecimal)anyObject())).thenReturn(TestFactory.getUserInstance());
		Mockito.when(illnessRepo.findAll()).thenReturn(TestFactory.getIllnessListInstance());
		Mockito.when(illnessRepo.findByName(anyString())).thenReturn(TestFactory.getIllnessListInstance());
		Mockito.when(illnessRepo.findById((BigDecimal)anyObject())).thenReturn(TestFactory.getIllnessInstance());
		Mockito.when(diagnosisRepo.findByUserId((BigDecimal)anyObject())).thenReturn(TestFactory.getDiagnosisList(5));
		Mockito.when(session.getAttribute(anyString())).thenReturn(userId);

		model = new ExtendedModelMap();
		controller = new DiagnosisController();

		controller.setDao(dao);
		controller.setDiagnosisRepo(diagnosisRepo);
		controller.setIllnessRepo(illnessRepo);
		controller.setUserRepo(userRepo);

	}

	@Test
	public void testSuccessScenarioForDiagnosisControllerChooseUserMethod(){

		ViewUserForm form = new ViewUserForm();
		form.setUserId(new BigDecimal(1));

		String result = controller.chooseUser(form, model);

		boolean containsChosenUser = model.containsAttribute("chosenUser");
		boolean containsIllnesses = model.containsAttribute("illnesses");

		assertEquals("diagnosis", result);

		assertEquals(true, containsChosenUser);
		assertEquals(true, containsIllnesses);
	}

	@Test
	public void testPersistDiagnosisMethodCallsDiagnosisRepoCreateMethod() {

		DiagnosisForm form = TestFactory.getDiagnosisFormInstance();

		controller.persistDiagnosis(form, model);

		boolean containsSuccess = model.containsAttribute("success");

		verify(diagnosisRepo).create((Diagnosis)anyObject());
		assertTrue(containsSuccess);

	}

	@Test
	public void testViewDiagnosisMethodRetrievesDiagnosisForLoggedInUserAndPopulatesModel() {

		controller.viewDiagnosis(model, session);

		boolean containsItems = model.containsAttribute("items");

		verify(diagnosisRepo).findByUserId(eq(new BigDecimal(userId)));
		assertTrue(containsItems);
	}

	@Test
	public void testGetSearchFormReturnsCorrectObjectType() {
		Object form = controller.getSearchForm();

		if (form instanceof SearchForm) {
			assertTrue(true);
		} else {
			fail();
		}
	}

	@Test
	public void testGetDiagnosisFormReturnsCorrectObjectType() {
		Object form = controller.getDiagnosisForm();

		if (form instanceof DiagnosisForm) {
			assertTrue(true);
		} else {
			fail();
		}
	}

	@Test
	public void testGetViewUserFormReturnsCorrectObjectType() {
		Object form = controller.getViewUserForm();

		if (form instanceof ViewUserForm) {
			assertTrue(true);
		} else {
			fail();
		}
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/VanillaJSTask.iml" filepath="$PROJECT_DIR$/.idea/VanillaJSTask.iml" />
    </modules>
  </component>
</project>


text:
require 'spec_helper'

RSpec.describe FlickrbCollage::FlickrConfig do
  describe "#call" do
    it "returns a FlickRaw::Flickr instance" do
      config = FlickrbCollage::FlickrConfig.new
      expect(config.call).to be_an_instance_of(FlickRaw::Flickr)
    end
  end

  describe "#self.call" do
    it "returns a FlickRaw::Flickr instance" do
      expect(FlickrbCollage::FlickrConfig.call).to be_an_instance_of(FlickRaw::Flickr)
    end
  end
end


text:
FROM bd2kbdds/base_image

COPY fastx_toolkit/ /usr/local/cshl_fastx_barcode_splitter/fastx_toolkit/0.0.13/

ENV PATH /usr/local/cshl_fastx_barcode_splitter/fastx_toolkit/0.0.13/bin:$PATH"


text:
class DependencyResolution::LinkReference
  def valid_link_node?(node)
    return true if node.link_types_path.length == 1
    return true if node.links.present?

    rules.dependency_resolution.valid_link_types_path?(node.link_types_path)
  end

  def root_links_by_link_type(content_id:, locale:, with_drafts: false)
    direct = linked_to(content_id)
    reverse = own_links(content_id, rules.reverse_links)
    edition = edition_links(content_id, locale, with_drafts)

    reverse.merge(direct).merge(edition) do |_key, link1, link2|
      link1 + link2
    end
  end

  def child_links_by_link_type(
    content_id:,
    link_types_path:,
    parent_content_ids: [],
    might_have_own_links: true,
    might_be_linked_to: true
  )
    links = {}

    if might_have_own_links
      own_links = child_own_links(content_id, link_types_path, parent_content_ids)
      links.merge!(own_links)
    end

    if might_be_linked_to
      linked_to = child_linked_to(content_id, link_types_path, parent_content_ids)
      links.merge!(linked_to)
    end

    links
  end

private

  def child_own_links(content_id, link_types_path = [], parent_content_ids = [])
    allowed_link_types = rules.dependency_resolution
      .allowed_reverse_link_types(link_types_path)

    return {} if allowed_link_types.empty?

    own_links(content_id, allowed_link_types, link_types_path, parent_content_ids)
  end

  def own_links(content_id, allowed_link_types = nil, link_types_path = [], parent_content_ids = [])
    next_allowed_link_types_from = rules.dependency_resolution
      .next_allowed_reverse_link_types(allowed_link_types, link_types_path, reverse_to_direct: true)
    next_allowed_link_types_to = rules.dependency_resolution
      .next_allowed_direct_link_types(allowed_link_types, link_types_path, reverse_to_direct: true)

    links = Queries::Links.from(
      content_id,
      allowed_link_types: rules.reverse_to_direct_link_types(allowed_link_types),
      parent_content_ids:,
      next_allowed_link_types_from:,
      next_allowed_link_types_to:,
    )

    rules.reverse_link_types_hash(links)
  end

  def child_linked_to(content_id, link_types_path = [], parent_content_ids = [])
    allowed_link_types = rules.dependency_resolution
      .allowed_direct_link_types(link_types_path)

    return {} if allowed_link_types.empty?

    linked_to(content_id, allowed_link_types, link_types_path, parent_content_ids)
  end

  def linked_to(content_id, allowed_link_types = nil, link_types_path = [], parent_content_ids = [])
    next_allowed_link_types_from = rules.dependency_resolution
      .next_allowed_reverse_link_types(allowed_link_types, link_types_path, reverse_to_direct: true)
    next_allowed_link_types_to = rules.dependency_resolution
      .next_allowed_direct_link_types(allowed_link_types, link_types_path, reverse_to_direct: true)

    Queries::Links.to(
      content_id,
      allowed_link_types:,
      parent_content_ids:,
      next_allowed_link_types_from:,
      next_allowed_link_types_to:,
    )
  end

  def edition_links(content_id, locale, with_drafts)
    to_links = Queries::EditionLinks.to(
      content_id,
      locale:,
      with_drafts:,
      allowed_link_types: nil,
    )

    from_links = Queries::EditionLinks.from(
      content_id,
      locale:,
      with_drafts:,
      allowed_link_types: rules.reverse_to_direct_link_types(rules.reverse_links),
    )

    from_links = rules.reverse_link_types_hash(from_links)

    from_links.merge(to_links)
  end

  def rules
    ExpansionRules
  end
end


text:
import os
import re

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = "DUMMY_SECRET_KEY"

INTERNAL_IPS = []

# Application definition

PROJECT_APPS = ["easy_maps.tests", "easy_maps"]

INSTALLED_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.staticfiles",
] + PROJECT_APPS

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.contrib.auth.context_processors.auth",
                "django.template.context_processors.debug",
                "django.template.context_processors.i18n",
                "django.template.context_processors.media",
                "django.template.context_processors.request",
                "django.template.context_processors.static",
                "django.template.context_processors.tz",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}

EASY_MAPS_GOOGLE_KEY = "AIzaSyATg_isuGSCHIlJamrxAXfkFDTYhIz7ytM"


text:
<!DOCTYPE html>

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

  <title>El Calafate</title>
  <meta name="description" content="">
  <meta name="author" content="Richard Hessler">
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <meta name="card" content="summary">
  <meta name="title" content="hi, i'm richard">
  <meta name="description" content="">
  <meta name="keywords" content="">

  <meta property="og:type" content="article">
  <meta property="og:title" content="El Calafate">
  <meta property="og:description" content="">

  <link rel="apple-touch-icon" sizes="57x57" href="/images/favicons/apple-touch-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="/images/favicons/apple-touch-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/images/favicons/apple-touch-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="/images/favicons/apple-touch-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/images/favicons/apple-touch-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="/images/favicons/apple-touch-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/images/favicons/apple-touch-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="/images/favicons/apple-touch-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicons/apple-touch-icon-180x180.png">
  <link rel="icon" type="image/png" href="/images/favicons/favicon-32x32.png" sizes="32x32">
  <link rel="icon" type="image/png" href="/images/favicons/favicon-194x194.png" sizes="194x194">
  <link rel="icon" type="image/png" href="/images/favicons/favicon-96x96.png" sizes="96x96">
  <link rel="icon" type="image/png" href="/images/favicons/android-chrome-192x192.png" sizes="192x192">
  <link rel="icon" type="image/png" href="/images/favicons/favicon-16x16.png" sizes="16x16">
  <link rel="manifest" href="/images/favicons/manifest.json">
  <link rel="shortcut icon" href="/images/favicons/favicon.ico">
  <meta name="msapplication-TileColor" content="#ffc40d">
  <meta name="msapplication-TileImage" content="/images/favicons/mstile-144x144.png">
  <meta name="theme-color" content="#ffffff">

  <link rel="stylesheet" href="/css/main.css">
  <link rel="canonical" href="http://www.richardhessler.com//photos/El%20Calafate/">
  <link rel="alternate" type="application/rss+xml" title="hi, i'm richard" href="/feed.xml">

hi, i'm richard

traveler-wannabe.
dc general assembly web development immersive graduate.
patron software toddler. wino. corgi-enthusiast.

blog

gallery

contact

                  Resume

                  Twitter

                  LinkedIn

                  GitHub

                  Instagram

El Calafate

  © 2016 Richard Hessler. All rights reserved.


text:
layout: page
title: "Jupyter Interpreter for Apache Zeppelin"
description: "Project Jupyter exists to develop open-source software, open-standards, and services for interactive computing across dozens of programming languages."
group: interpreter
---

{% include JB/setup %}

# Jupyter Interpreter for Apache Zeppelin

## Overview

Project [Jupyter](https://jupyter.org/) exists to develop open-source software, open-standards, and services for interactive computing across dozens of programming languages.
Zeppelin's Jupyter interpreter is a bridge/adapter between Zeppelin interpreter and Jupyter kernel. You can use any of jupyter kernel as long as you installed the necessary dependencies.

## Configuration

To run any Jupyter kernel in Zeppelin you first need to install the following prerequisite:

* pip install jupyter-client
* pip install grpcio
* pip install protobuf

Then you need install the jupyter kernel you want to use. In the following sections, we will talk about how to use the following 3 jupyter kernels in Zeppelin:

* ipython
* ir
* julia

## Jupyter Python kernel

In order to use Jupyter Python kernel in Zeppelin, you need to install `ipykernel` first.

```bash

pip install ipykernel
```

Then you can run python code in Jupyter interpreter like following.

```python

%jupyter(kernel=python)

%matplotlib inline
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
```

## Jupyter R kernel

In order to use [IRKernel](https://github.com/IRkernel/IRkernel), you need to first install `IRkernel` package in R.

```r
install.packages('IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation
```

Then you can run r code in Jupyter interpreter like following.

```r
%jupyter(kernel=ir)

library(ggplot2)
ggplot(mpg, aes(x = displ, y = hwy)) +
  geom_point()
```

## Jupyter Julia kernel

In order to use Julia in Zeppelin, you first need to install [IJulia](https://github.com/JuliaLang/IJulia.jl) first

```julia
using Pkg
Pkg.add("IJulia")

```

Then you can run julia code in Jupyter interpreter like following.

```julia

%jupyter(kernel=julia-1.3)

using Pkg
Pkg.add("Plots")
using Plots
plotly() # Choose the Plotly.jl backend for web interactivity
plot(rand(5,5),linewidth=2,title="My Plot")
Pkg.add("PyPlot") # Install a different backend
pyplot() # Switch to using the PyPlot.jl backend
plot(rand(5,5),linewidth=2,title="My Plot")
```

## Use any other kernel

For any other jupyter kernel, you can follow the below steps to use it in Zeppelin.

1. Install the specified jupyter kernel. you can find all the available jupyter kernels [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels)
2. Find its kernel name by run the following command
   ```bash
   jupyter kernelspec list
   ```
3. Run the kernel as following

```python

%jupyter(kernel=kernel_name)

code
```