text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
                 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<chapter id="blueprint">
    <title>OSGi 4.2 Blueprint Container</title>

	<para>Based on the Gemini Blueprint programming model, the OSGi Alliance introduced in OSGi 4.2 Release
	the Blueprint Container specification (part of the Compendium Service). Gemini Blueprint 1.0 serves as
	the Blueprint Reference <ulink url="http://en.wikipedia.org/wiki/Reference_implementation">Implementation</ulink>
	- the official, complete implementation of the spec.
	</para>
	<para>Existing and new users have the freedom to mix and match the programming model they want, since Eclipse Gemini Blueprint supports
	both the Spring DM 1.x declarations and the Blueprint one, inside the same application, provided the default namespace is Blueprint
  and the Blueprint files are stored in the folder <literal>META-INF/spring</literal>.
	</para>

	<para>Please note that this documentation will focus on Gemini Blueprint specific configurations and options; for Blueprint specific
	behaviour please refer to the OSGi 4.2 Compendium spec, section 121.</para>

		<title>Blueprint Requirements</title>
		<para>The Blueprint Container spec is part of the OSGi 4.2 release and relies on it, in its API. Thus,
		in order to use Blueprint, one must use an OSGi 4.2 compatible platform as a runtime environment. Gemini Blueprint itself
		requires only an OSGi 4.0 framework so if 4.2 is not an option, one can safely downgrade at the loss of the Blueprint
		model which can be built on top of Spring/Gemini Blueprint.
		</para>
		<note>On environments prior to OSGi 4.2, Gemini Blueprint will disable the Blueprint functionality automatically - users will be notified
		through a log message similar to the following:

	    <screen><![CDATA[Pre-4.2 OSGi platform detected; disabling Blueprint Container functionality]]></screen>

		</note>

		<title>Blueprint/Gemini Blueprint Differences</title>
		<para>There are a lot of similarities in terms of functionality and configuration between Gemini Blueprint 1.x and Blueprint which should be
		no surprise considering that Spring DM was the basis of the Blueprint spec. In addition to fully supporting the Blueprint configuration schema,
		DM 2.x enhanced its declarations by providing option that allow for Blueprint specific behaviour. The table below aggregates the most
		important user facing differences between Spring/Gemini Blueprint configurations and Blueprint. Additional comparison information is available
		throughout the documentation (such as <xref linkend="app-deploy:headers:blueprint"/> or <xref linkend="service-registry:export:blueprint"/>).
		Again, one can simply switch between the two definition styles, if need be.</para>

		<title>XML Declarations</title>

		<para>Most of the XML declarations are similar between Spring and Blueprint. Using the Spring
		<ulink url="http://static.springsource.org/spring/docs/2.5.x/reference/new-in-2.html#new-in-2-ioc-configuration">namespace</ulink> mechanism,
		the same configuration can contain both Spring, Gemini Blueprint, Blueprint and other namespaces. Moreover, custom elements can be used for virtually
		all elements of a Spring configuration (namespace, bean declaration, decoration, etc...). The table below focuses <emphasis>only</emphasis>
		on the usual, standard Spring namespaces and their Blueprint equivalent.</para>

          <title>XML Configuration Differences</title>
          <tgroup cols="3">

              <row>
                <entry>Element/Attribute</entry>
                <entry>Gemini Blueprint</entry>
                <entry>Blueprint</entry>
              </row>

              <row>
                <entry>Namespace Declaration</entry>
                <entry><para><literal>http://www.springframework.org/schema/beans</literal></para>
                <para>or <literal>http://www.springframework.org/schema/osgi</literal></para></entry>
                <entry><literal>http://www.osgi.org/xmlns/blueprint/v1.0.0</literal></entry>
              </row>
              <row>
                <entry>Root Element</entry>
                <entry><literal><![CDATA[<beans>]]></literal></entry>
                <entry><literal><![CDATA[<blueprint>]]></literal></entry>
              </row>
              <row>
                <entry>Default Lazy</entry>
                <entry><literal><![CDATA[default-lazy]]></literal></entry>
                <entry><literal><![CDATA[default-activation]]></literal></entry>
              </row>
              <row>
                <entry>Default Init Method</entry>
                <entry><literal><![CDATA[default-init-method]]></literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Default Destroy Method</entry>
                <entry><literal><![CDATA[default-destroy-method]]></literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Default Autowire Strategy</entry>
                <entry><literal><![CDATA[default-autowire]]></literal>, <literal><![CDATA[default-autowire-candidates]]></literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Root Element</entry>
                <entry><literal><![CDATA[<beans>]]></literal></entry>
                <entry><literal><![CDATA[<blueprint>]]></literal></entry>
              </row>
              <row>
                <entry>Bean ID</entry>
                <entry><literal>id</literal></entry>
                <entry><literal>id</literal></entry>
              </row>
              <row>
                <entry>Bean Name/Alias</entry>
                <entry><literal>name</literal>/<literal><![CDATA[<alias>]]></literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Bean Class</entry>
                <entry><literal>class</literal></entry>
                <entry><literal>class</literal></entry>
              </row>
              <row>
                <entry>Bean Scope Name</entry>
                <entry><literal>scope</literal></entry>
                <entry><literal>scope</literal></entry>
              </row>
              <row>
                <entry>Built-in Scopes</entry>
                <entry><literal>singleton</literal>, <literal>prototype</literal>, <literal>request</literal>, <literal>session</literal>, <literal>bundle</literal></entry>
                <entry><literal>singleton</literal>, <literal>prototype</literal></entry>
              </row>
              <row>
                <entry>Lazy Initialization Name/Values</entry>
                <entry><literal>lazy-init</literal>=<literal>true/false</literal></entry>
                <entry><literal>activation</literal>=<literal>lazy/eager</literal></entry>
              </row>
              <row>
                <entry>Depends</entry>
                <entry><literal>depends-on</literal></entry>
                <entry><literal>depends-on</literal></entry>
              </row>
              <row>
                <entry>Init Method</entry>
                <entry><literal>init-method</literal></entry>
                <entry><literal>init-method</literal></entry>
              </row>
              <row>
                <entry>Destroy Method</entry>
                <entry><literal>destroy-method</literal></entry>
                <entry><literal>destroy-method</literal></entry>
              </row>
              <row>
                <entry>Factory Method</entry>
                <entry><literal>factory-method</literal></entry>
                <entry><literal>factory-method</literal></entry>
              </row>
              <row>
                <entry>Factory Bean</entry>
                <entry><literal>factory-bean</literal></entry>
                <entry><literal>factory-ref</literal></entry>
              </row>
              <row>
                <entry>Bean Inheritance</entry>
                <entry><literal>parent</literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Autowire Strategy</entry>
                <entry><literal>autowire</literal>, <literal>autowire-candidate</literal></entry>
                <entry><literal>-</literal></entry>
              </row>
              <row>
                <entry>Constructor</entry>
                <entry><literal><![CDATA[<constructor-arg>]]></literal></entry>
                <entry><literal><![CDATA[<argument>]]></literal></entry>
              </row>
              <row>
                <entry>Property</entry>
                <entry><literal><![CDATA[<property>]]></literal></entry>
                <entry><literal><![CDATA[<property>]]></literal></entry>
              </row>
              <row>
                <entry>Value</entry>
                <entry><literal><![CDATA[<value>]]></literal></entry>
                <entry><literal><![CDATA[<value>]]></literal></entry>
              </row>
              <row>
                <entry>Service Exporter</entry>
                <entry><literal><![CDATA[<service>]]></literal></entry>
                <entry><literal><![CDATA[<service>]]></literal></entry>
              </row>
              <row>
                <entry>Service Importer</entry>
                <entry><literal><![CDATA[<reference>/<list>/<set>]]></literal></entry>
                <entry><literal><![CDATA[<reference>/<list>]]></literal></entry>
              </row>

          </tgroup>

        <para>The configurations below are equivalent in terms of functionality:</para>

        <programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
    <bean id="object" class="java.lang.Object"/>

    <bean id="length" class="java.lang.Integer">
        <argument value="4"/>
    </bean>

    <bean id="buffer" class="java.lang.StringBuffer" depends-on="simple">
    	<property name="length" ref="length"/>
    </bean>

    <bean id="current-time" class="java.lang.System" factory-method="currentTimeMillis" scope="prototype"/>

    <bean id="list" class="java.util.ArrayList" destroy-method="clear" activation="eager">
    	<argument ref="length"/>
    </bean>
</blueprint>]]></programlisting>
        <programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
    default-lazy-init="true">

    <bean id="object" class="java.lang.Object"/>

    <bean id="length" class="java.lang.Integer">
        <constructor-arg value="4"/>
    </bean>

    <bean id="buffer" class="java.lang.StringBuffer" depends-on="simple">
    	<property name="length" ref="length"/>
    </bean>

    <bean id="current-time" class="java.lang.System" factory-method="currentTimeMillis" scope="prototype"/>

    <bean id="list" class="java.util.ArrayList" destroy-method="clear" lazy-init="false">
    	<constructor-arg ref="length"/>
    </bean>
</beans>]]></programlisting>

		<para>As mentioned before, in Gemini Blueprint one can mix and match the namespaces provided the default namespace is Blueprint
  and the Blueprint files are stored in the folder <literal>META-INF/spring</literal>:</para>

		<programlisting language="xml"><![CDATA[<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
    http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <beans:bean id="anInteger" class="java.lang.Integer">
      <beans:constructor-arg value="10"/>
    </beans:bean>

    <service ref="anInteger" interface="java.lang.Comparable" />
</blueprint>]]></programlisting>

		<para>The example above uses the Gemini Blueprint and Spring <literal>beans</literal> namespaces.</para>

		<title>Container Capabilities</title>

		<para>From a container perspective, the Blueprint spec standardizes the a subset of the Spring container. A high-level view comparison, by no
		means comprehensive, is summarized in the table below:</para>

          <title>Container Capabilities Differences</title>
          <tgroup cols="3">
			<colspec colname='c1'/>
			<colspec colname='c2'/>
			<colspec colname='c3'/>
			<spanspec spanname="wide" namest="c1" nameend="c3" align="center"/>

              <row>
                <entry>Feature</entry>
                <entry>Gemini Blueprint</entry>
                <entry>Blueprint</entry>
              </row>

              <row rowsep="1">
              	<entry spanname="wide"><emphasis>Object Instantiation</emphasis></entry>
              </row>
              <row>
                <entry>Constructor Instantiation</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Static Factory Instantiation</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Instance Factory Instantiation</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row rowsep="1">
              	<entry spanname="wide"><emphasis>Dependency Injection</emphasis></entry>
              </row>
              <row>
                <entry>Constructor Injection</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Setter Injection</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Field Injection</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row>
                <entry>Method Injection</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row>
                <entry>Arbitrary Method Injection</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row>
                <entry>Autowiring</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row rowsep="1">
              	<entry spanname="wide"><emphasis>Component Lifecycle</emphasis></entry>
              </row>
              <row>
                <entry>Lazy Initialization</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Bean Scopes</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Custom Bean Scopes</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row>
                <entry>Built-in Callbacks</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>
              <row>
                <entry>Custom Callbacks</entry>
                <entry>Y</entry>
                <entry>Y</entry>
              </row>
              <row>
                <entry>Initialization Processing</entry>
                <entry>Y</entry>
                <entry>N</entry>
              </row>

          </tgroup>

		<para>As with the XML configuration, since Gemini Blueprint translates the Blueprint configuration into Spring metadata, one can rely on Spring for features
		beyond the Blueprint container. For example, one can configure a bean using Blueprint and use annotation on the same instance, for field injection.
		The same object can implement Spring's <literal>Aware</literal> interfaces or rely on other post processors for certain behaviour.</para>

		<para>Note that additional information on Blueprint is available through out the documentation.	These being said, it is highly recommended to read
		and use the Blueprint specification as guidance, if the Blueprint Container becomes	the programming model of choice.</para>

		<title>Using Blueprint</title>
		<para>There are no extra jars or steps that need to be executed to <emphasis>enable</emphasis> the Blueprint functionality in Gemini Blueprint.
		This is built directly into the core, in fact the Blueprint APIs are exported by the Gemini Blueprint core. Please see the next section for
		information on how to install Gemini Blueprint and the OSGi compendium spec (section 121) for Blueprint related information such as bootstrapping
		and configuration locations. For those in a hurry, simply install and start the Gemini Blueprint jars (io, core, extender) and their dependencies
		(namely Spring and slf4j) and you should be all set: Gemini Blueprint will automatically detect the running environment and the types of bundles started.
		</para>

</chapter>


text:
var cg = require('../codeGenerator');

exports.codeGenerator = function () {
  var codegen = {};

  var term = require('../terms/terms')(codegen);

  var importTerm = function (name) {
    importModule('../terms/' + name);
  };

  var importModule = function (path) {
    var name = /[^/]*$/.exec(path)[0];
    codegen[name] = require(path)(codegen);
  };

  codegen.term = term.term;
  codegen.termPrototype = term.termPrototype;
  codegen.moduleConstants = new (require('../moduleConstants')(codegen));
  importTerm('generatedVariable');
  importTerm('definition');
  importTerm('javascript');
  codegen.basicExpression = require('./basicExpression');
  importTerm('splatArguments');
  importTerm('variable');
  importTerm('selfExpression');
  importTerm('statements');
  importTerm('asyncStatements');
  importTerm('subStatements');
  importTerm('closure');
  importTerm('normalParameters');
  importTerm('splatParameters');
  codegen.block = codegen.closure;
  importTerm('parameters');
  importTerm('identifier');
  importTerm('integer');
  importTerm('float');
  codegen.normaliseString = cg.normaliseString;
  codegen.unindent = cg.unindent;
  codegen.normaliseInterpolatedString = cg.normaliseInterpolatedString;
  importTerm('string');
  importTerm('interpolatedString');
  codegen.normaliseRegExp = cg.normaliseRegExp;
  importTerm('regExp');
  codegen.parseRegExp = cg.parseRegExp;
  importTerm('module');
  codegen.interpolation = cg.interpolation;
  importTerm('list');
  codegen.normaliseArguments = cg.normaliseArguments;
  importTerm('argumentList');
  importTerm('subExpression');
  importTerm('fieldReference');
  importTerm('hash');
  importTerm('asyncArgument');
  importTerm('futureArgument');
  codegen.complexExpression = require('./complexExpression');
  codegen.operatorExpression = require('../parser/operatorExpression')(codegen);
  codegen.unaryOperatorExpression = require('../parser/unaryOperatorExpression')(codegen);
  importTerm('operator');
  importTerm('splat');
  importTerm('hashEntry');
  codegen.concatName = cg.concatName;
  codegen.parseSplatParameters = cg.parseSplatParameters;
  codegen.collapse = cg.collapse;
  importTerm('functionCall');
  importTerm('scope');
  codegen.SymbolScope = require('../symbolScope').SymbolScope;
  importModule('../macroDirectory');
  importTerm('boolean');
  importTerm('increment');
  importTerm('typeof');
  importTerm('tryExpression');
  importTerm('ifExpression');
  importTerm('nil');
  importTerm('continueStatement');
  importTerm('breakStatement');
  importTerm('throwStatement');
  importTerm('returnStatement');
  importTerm('methodCall');
  importTerm('asyncResult');
  importTerm('indexer');
  importTerm('whileExpression');
  codegen.whileStatement = codegen.whileExpression;
  importTerm('withExpression');
  codegen.withStatement = codegen.withExpression;
  importTerm('forExpression');
  codegen.forStatement = codegen.forExpression;
  importTerm('forIn');
  importTerm('forEach');
  importTerm('newOperator');
  codegen.loc = loc;
  importTerm('asyncCallback');
  importTerm('continuationOrDefault');
  codegen.callbackFunction = codegen.variable(['continuation'], {couldBeMacro: false});
  codegen.callbackFunction.isContinuation = true;
  codegen.optional = cg.optional;
  codegen.postIncrement = cg.postIncrement;
  codegen.oldTerm = cg.oldTerm;
  importTerm('semanticError');
  codegen.errors = require('./errors').errors(codegen);
  codegen.macros = require('./macros').macros(codegen);
  codegen.listMacros = require('./listMacros')(codegen);
  importTerm('argumentUtils');
  importTerm('closureParameterStrategies');

  return codegen;
};

var loc = function (term, location) {
  var loc = {
    firstLine: location.first_line,
    lastLine: location.last_line,
    firstColumn: location.first_column,
    lastColumn: location.last_column
  };

  term.location = function () {
    return loc;
  };

  return term;
};

redpajama_set_name: RedPajamaGithub


text:
package com.demimojo.majorsystem.quiz.activity;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.demimojo.majorsystem.quiz.R;
import com.demimojo.majorsystem.quiz.utils.Logger;

import java.util.Random;

public class LearnImages extends ActionBarActivity {

    private int max = 99;
    private int min = 1;
    private final String LogComponent = "LearnImages";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_learn_numbers);

        final Random rand = new Random();

        int randomNum = rand.nextInt((max - min) + 1) + min;
        String randomStr = String.format("%02d", randomNum);

        int imgId = getResources().getIdentifier("drawable/img_"+randomStr, "drawable", getPackageName());
        ImageView imgView = (ImageView)findViewById(R.id.img_activity_learn_numbers);
        imgView.setBackgroundResource(imgId);
        imgView.setVisibility(View.VISIBLE);

        TextView numberView = (TextView)findViewById(R.id.learn_number_text);
        numberView.setText(randomStr);
        numberView.setVisibility(View.INVISIBLE);

        final RelativeLayout layout = (RelativeLayout)findViewById(R.id.learn_numbers_layout);
        layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                TextView numberView = (TextView)findViewById(R.id.learn_number_text);
                if (numberView.getVisibility() == View.INVISIBLE) {
                    // We need to make the text visible.
                    numberView.setVisibility(View.VISIBLE);
                } else {
                    // We need to make the number invisible, and generate a new image.
                    numberView.setVisibility(View.INVISIBLE);

                    int randomNum = rand.nextInt((max - min) + 1) + min;
                    String randomStr = String.format("%02d", randomNum);

                    numberView.setText(randomStr);
                    numberView.setVisibility(View.INVISIBLE);

                    int imgId = getResources().getIdentifier("drawable/img_"+randomStr, "drawable", getPackageName());
                    ImageView imgView = (ImageView)findViewById(R.id.img_activity_learn_numbers);
                    imgView.setBackgroundResource(imgId);
                    imgView.setVisibility(View.VISIBLE);
                }
            }
        });

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.learn_images, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}


text:
import { Component, ViewChild, NgModule } from '@angular/core';
import { IonicApp, IonicModule, Slides } from '../../../../../ionic-angular';

@Component({
  templateUrl: 'main.html'
})
export class MyPage {
  @ViewChild('mySlider') slider: Slides;

  onSlideChanged() {
    let previousIndex = this.slider.getPreviousIndex();
    let currentIndex = this.slider.getActiveIndex();
    console.log('Previous index is', previousIndex, 'Current index is', currentIndex);
  }

  onSlideMove(ev: any) {
    console.log('Slide moving', ev);
  }

  goToPrevSlide() {
    this.slider.slidePrev();
  }

  goToNextSlide() {
    this.slider.slideNext();
  }

  goToSlide(index: number) {
    this.slider.slideTo(index);
  }

  getIndex() {
    let index = this.slider.getActiveIndex();
    console.log('Current Index is', index);
  }

  getLength() {
    let length = this.slider.length();
    console.log('Current Length is', length);
  }
}

@Component({
  template: `<ion-nav [root]="root"></ion-nav>`
})
export class E2EApp {
  root: any = MyPage;
}

@NgModule({
  declarations: [
    E2EApp,
    MyPage
  ],
  imports: [
    IonicModule.forRoot(E2EApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    E2EApp,
    MyPage
  ]
})
export class AppModule {}


text:
.PHONY: output-cpp output-java

cpp: math_demo.bidl address.bidl output-cpp
	../../bidl2sl/bidl2sl *.bidl
	$(MAKE) -C cpp

java: math_demo.bidl address.bidl output-java
	../../bidl2sl/bidl2sl *.bidl -g java
	cd java && ant && cd -

clean:
	rm -rf output-cpp/* output-java/*
	$(MAKE) -C cpp clean
	cd java && ant clean && cd -


text:
manufacturer=`cat /sys/devices/virtual/dmi/id/sys_vendor`;
model_name=`cat /sys/devices/virtual/dmi/id/product_version`;
script_version=`cat version.txt`;

if [ "$manufacturer" == "LENOVO" ] && [ "$model_name" == "ThinkPad X1 Carbon" ]; then
	export manufacturer;
	export model_name;
	export script_version;
	export device_match="true";
fi


text:
package com.intellij.testFramework.common;

import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.TestOnly;

import java.util.Hashtable;
import java.util.Map;

@TestOnly
@Internal
public final class Cleanup {

  private Cleanup() { }

  @SuppressWarnings("ConstantConditions")
  public static void cleanupSwingDataStructures() throws Exception {
    Object manager = ReflectionUtil.getDeclaredMethod(Class.forName("javax.swing.KeyboardManager"), "getCurrentManager").invoke(null);
    Map<?, ?> componentKeyStrokeMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "componentKeyStrokeMap");
    componentKeyStrokeMap.clear();
    Map<?, ?> containerMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "containerMap");
    containerMap.clear();
  }
}


text:
require "eventmachine"

module Invoker
  module Power
    class Setup
      attr_accessor :port_finder, :tld

      def self.install(tld)
        selected_installer_klass = installer_klass
        selected_installer_klass.new(tld).install
      end

      def self.uninstall
        if Invoker::Power::Config.has_config?
          power_config = Invoker::Power::Config.load_config
          selected_installer_klass = installer_klass
          selected_installer_klass.new(power_config.tld).uninstall_invoker
        end
      end

      def self.installer_klass
        if Invoker.darwin?
          Invoker::Power::OsxSetup
        else
          Invoker::Power::LinuxSetup
        end
      end

      def initialize(tld)
        if tld !~ /^[a-z]+$/
          Invoker::Logger.puts("Please specify valid tld".colorize(:red))
          exit(1)
        end
        self.tld = tld
      end

      def install
        if check_if_setup_can_run?
          setup_invoker
        else
          Invoker::Logger.puts("The setup has been already run.".colorize(:red))
        end
        self
      end

      def drop_to_normal_user
        EventMachine.set_effective_user(ENV["SUDO_USER"])
      end

      def find_open_ports
        port_finder.find_ports()
      end

      def port_finder
        @port_finder ||= Invoker::Power::PortFinder.new()
      end

      def check_if_setup_can_run?
        !File.exists?(Invoker::Power::Config.config_file)
      end

      def create_config_file
        Invoker.setup_config_location
        config = build_power_config
        Invoker::Power::Config.create(config)
      end

      # Builds and returns power config hash. Override this method in subclasses if necessary.
      def build_power_config
        config = {
          http_port: port_finder.http_port,
          https_port: port_finder.https_port,
          tld: tld
        }
        config
      end

      def remove_resolver_file
        return if resolver_file.nil?
        begin
          safe_remove_file(resolver_file)
        rescue Errno::EACCES
          Invoker::Logger.puts("Running uninstall requires root access, please rerun it with sudo".colorize(:red))
          raise
        end
      end

      def safe_remove_file(file)
        File.delete(file) if File.exists?(file)
      end
    end
  end
end


text:
 #import "FBSDKViewHierarchy.h"

 #import <QuartzCore/QuartzCore.h>

 #import <objc/runtime.h>

 #import "FBSDKCodelessPathComponent.h"
 #import "FBSDKCoreKit+Internal.h"
 #import "FBSDKViewHierarchyMacros.h"

 #define MAX_VIEW_HIERARCHY_LEVEL 35

NS_ASSUME_NONNULL_BEGIN

_Nullable id getVariableFromInstance(NSObject *instance, NSString *variableName);

@implementation FBSDKViewHierarchy

+ (nullable NSArray *)getChildren:(NSObject *)obj
{
  if ([obj isKindOfClass:[UIControl class]]) {
    return nil;
  }

  NSMutableArray *children = [NSMutableArray array];

  // children of window should be viewcontroller
  if ([obj isKindOfClass:[UIWindow class]]) {
    UIViewController *rootVC = ((UIWindow *)obj).rootViewController;
    NSArray<UIView *> *subviews = ((UIWindow *)obj).subviews;
    for (UIView *child in subviews) {
      if (child != rootVC.view) {
        UIViewController *vc = [FBSDKViewHierarchy getParentViewController:child];
        if (vc != nil && vc.view == child) {
          [FBSDKTypeUtility array:children addObject:vc];
        } else {
          [FBSDKTypeUtility array:children addObject:child];
        }
      } else {
        if (rootVC) {
          [FBSDKTypeUtility array:children addObject:rootVC];
        }
      }
    }
  } else if ([obj isKindOfClass:[UIView class]]) {
    NSArray<UIView *> *subviews = [((UIView *)obj).subviews copy];
    for (UIView *child in subviews) {
      UIViewController *vc = [FBSDKViewHierarchy getParentViewController:child];
      if (vc && vc.view == child) {
        [FBSDKTypeUtility array:children addObject:vc];
      } else {
        [FBSDKTypeUtility array:children addObject:child];
      }
    }
  } else if ([obj isKindOfClass:[UINavigationController class]]) {
    UIViewController *vc = ((UINavigationController *)obj).visibleViewController;
    UIViewController *tc = ((UINavigationController *)obj).topViewController;
    NSArray *nextChildren = [FBSDKViewHierarchy getChildren:((UIViewController *)obj).view];
    for (NSObject *child in nextChildren) {
      if (tc && [self isView:child superViewOfView:tc.view]) {
        [FBSDKTypeUtility array:children addObject:tc];
      } else if (vc && [self isView:child superViewOfView:vc.view]) {
        [FBSDKTypeUtility array:children addObject:vc];
      } else {
        if (child != vc.view && child != tc.view) {
          [FBSDKTypeUtility array:children addObject:child];
        } else {
          if (vc && child == vc.view) {
            [FBSDKTypeUtility array:children addObject:vc];
          } else if (tc && child == tc.view) {
            [FBSDKTypeUtility array:children addObject:tc];
          }
        }
      }
    }

    if (vc && ![children containsObject:vc]) {
      [FBSDKTypeUtility array:children addObject:vc];
    }
  } else if ([obj isKindOfClass:[UITabBarController class]]) {
    UIViewController *vc = ((UITabBarController *)obj).selectedViewController;
    NSArray *nextChildren = [FBSDKViewHierarchy getChildren:((UIViewController *)obj).view];
    for (NSObject *child in nextChildren) {
      if (vc && [self isView:child superViewOfView:vc.view]) {
        [FBSDKTypeUtility array:children addObject:vc];
      } else {
        if (vc && child == vc.view) {
          [FBSDKTypeUtility array:children addObject:vc];
        } else {
          [FBSDKTypeUtility array:children addObject:child];
        }
      }
    }

    if (vc && ![children containsObject:vc]) {
      [FBSDKTypeUtility array:children addObject:vc];
    }
  } else if ([obj isKindOfClass:[UIViewController class]]) {
    UIViewController *vc = (UIViewController *)obj;
    if (vc.isViewLoaded) {
      NSArray *nextChildren = [FBSDKViewHierarchy getChildren:vc.view];
      if (nextChildren.count > 0) {
        [children addObjectsFromArray:nextChildren];
      }
    }
    for (NSObject *child in vc.childViewControllers) {
      [FBSDKTypeUtility array:children addObject:child];
    }
    UIViewController *presentedVC = vc.presentedViewController;
    if (presentedVC) {
      [FBSDKTypeUtility array:children addObject:presentedVC];
    }
  }
  return children;
}

+ (nullable NSObject *)getParent:(nullable NSObject *)obj
{
  if ([obj isKindOfClass:[UIView class]]) {
    UIView *superview = ((UIView *)obj).superview;
    UIViewController *superviewViewController = [FBSDKViewHierarchy
                                                 getParentViewController:superview];
    if (superviewViewController && superviewViewController.view == superview) {
      return superviewViewController;
    }
    if (superview && superview != obj) {
      return superview;
    }
  } else if ([obj isKindOfClass:[UIViewController class]]) {
    UIViewController *vc = (UIViewController *)obj;
    UIViewController *parentVC = vc.parentViewController;
    UIViewController *presentingVC = vc.presentingViewController;
    UINavigationController *nav = vc.navigationController;
    UITabBarController *tab = vc.tabBarController;

    if (nav) {
      return nav;
    }

    if (tab) {
      return tab;
    }

    if (parentVC) {
      return parentVC;
    }

    if (presentingVC && presentingVC.presentedViewController == vc) {
      return presentingVC;
    }

    // Return parent of view of UIViewController
    NSObject *viewParent = [FBSDKViewHierarchy getParent:vc.view];
    if (viewParent) {
      return viewParent;
    }
  }
  return nil;
}

+ (nullable NSArray *)getPath:(NSObject *)obj
{
  return [FBSDKViewHierarchy getPath:obj limit:MAX_VIEW_HIERARCHY_LEVEL];
}

+ (nullable NSArray *)getPath:(NSObject *)obj limit:(int)limit
{
  if (!obj || limit <= 0) {
    return nil;
  }

  NSMutableArray *path;

  NSObject *parent = [FBSDKViewHierarchy getParent:obj];
  if (parent) {
    NSArray *parentPath = [FBSDKViewHierarchy getPath:parent limit:limit - 1];
    path = [NSMutableArray arrayWithArray:parentPath];
  } else {
    path = [NSMutableArray array];
  }

  NSDictionary *componentInfo = [FBSDKViewHierarchy getAttributesOf:obj parent:parent];

  FBSDKCodelessPathComponent *pathComponent = [[FBSDKCodelessPathComponent alloc]
                                               initWithJSON:componentInfo];
  [FBSDKTypeUtility array:path addObject:pathComponent];

  return [NSArray arrayWithArray:path];
}

+ (NSDictionary<NSString *, id> *)getAttributesOf:(NSObject *)obj parent:(NSObject *_Nullable)parent
{
  NSMutableDictionary *componentInfo = [NSMutableDictionary dictionary];
  [FBSDKTypeUtility dictionary:componentInfo setObject:NSStringFromClass([obj class]) forKey:CODELESS_MAPPING_CLASS_NAME_KEY];

  if (![FBSDKViewHierarchy isUserInputView:obj]) {
    NSString *text = [FBSDKViewHierarchy getText:obj];
    if (text.length > 0) {
      [FBSDKTypeUtility dictionary:componentInfo setObject:text forKey:CODELESS_MAPPING_TEXT_KEY];
    }
  } else {
    [FBSDKTypeUtility dictionary:componentInfo setObject:@"" forKey:CODELESS_MAPPING_TEXT_KEY];
    componentInfo[CODELESS_MAPPING_IS_USER_INPUT_KEY] = @YES;
  }

  NSString *hint = [FBSDKViewHierarchy getHint:obj];
  if (hint.length > 0) {
    [FBSDKTypeUtility dictionary:componentInfo setObject:hint forKey:CODELESS_MAPPING_HINT_KEY];
  }

  NSIndexPath *indexPath = [FBSDKViewHierarchy getIndexPath:obj];
  if (indexPath) {
    [FBSDKTypeUtility dictionary:componentInfo setObject:@(indexPath.section) forKey:CODELESS_MAPPING_SECTION_KEY];
    [FBSDKTypeUtility dictionary:componentInfo setObject:@(indexPath.row) forKey:CODELESS_MAPPING_ROW_KEY];
  }

  if (parent != nil) {
    NSArray *children = [FBSDKViewHierarchy getChildren:parent];
    NSUInteger index = [children indexOfObject:obj];
    if (index != NSNotFound) {
      [FBSDKTypeUtility dictionary:componentInfo setObject:@(index) forKey:CODELESS_MAPPING_INDEX_KEY];
    }
  } else {
    [FBSDKTypeUtility dictionary:componentInfo setObject:@0 forKey:CODELESS_MAPPING_INDEX_KEY];
  }

  [FBSDKTypeUtility dictionary:componentInfo setObject:@([FBSDKViewHierarchy getTag:obj]) forKey:CODELESS_VIEW_TREE_TAG_KEY];

  return [componentInfo copy];
}

+ (nullable NSMutableDictionary<NSString *, id> *)getDetailAttributesOf:(NSObject *)obj
{
  return [self getDetailAttributesOf:obj withHash:YES];
}

+ (nullable NSMutableDictionary<NSString *, id> *)getDetailAttributesOf:(NSObject *)obj withHash:(BOOL)hash
{
  if (!obj) {
    return nil;
  }

  NSObject *parent = [FBSDKViewHierarchy getParent:obj];

  NSDictionary *simpleAttributes = [FBSDKViewHierarchy getAttributesOf:obj parent:parent];

  NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:simpleAttributes];

  NSString *className = NSStringFromClass([obj class]);
  [FBSDKTypeUtility dictionary:result setObject:className forKey:VIEW_HIERARCHY_CLASS_NAME_KEY];

  NSUInteger classBitmask = [FBSDKViewHierarchy getClassBitmask:obj];
  [FBSDKTypeUtility dictionary:result setObject:[NSString stringWithFormat:@"%lu", (unsigned long)classBitmask] forKey:VIEW_HIERARCHY_CLASS_TYPE_BITMASK_KEY];

  if ([obj isKindOfClass:[UIControl class]]) {
    // Get actions of UIControl
    UIControl *control = (UIControl *)obj;
    NSMutableSet *actions = [NSMutableSet set];
    NSSet *targets = control.allTargets;
    for (NSObject *target in targets) {
      NSArray *ary = [control actionsForTarget:target forControlEvent:0];
      if (ary.count > 0) {
        [actions addObjectsFromArray:ary];
      }
    }
    if (targets.count > 0) {
      [FBSDKTypeUtility dictionary:result setObject:actions.allObjects forKey:CODELESS_VIEW_TREE_ACTIONS_KEY];
    }
  }

  [FBSDKTypeUtility dictionary:result setObject:[FBSDKViewHierarchy getDimensionOf:obj] forKey:CODELESS_VIEW_TREE_DIMENSION_KEY];

  NSDictionary<NSString *, id> *textStyle = [FBSDKViewHierarchy getTextStyle:obj];
  if (textStyle) {
    [FBSDKTypeUtility dictionary:result setObject:textStyle forKey:CODELESS_VIEW_TREE_TEXT_STYLE_KEY];
  }

  if (hash) {
    // hash text and hint
    [FBSDKTypeUtility dictionary:result setObject:[FBSDKUtility SHA256Hash:result[VIEW_HIERARCHY_TEXT_KEY]] forKey:VIEW_HIERARCHY_TEXT_KEY];
    [FBSDKTypeUtility dictionary:result setObject:[FBSDKUtility SHA256Hash:result[VIEW_HIERARCHY_HINT_KEY]] forKey:VIEW_HIERARCHY_HINT_KEY];
  }

  return result;
}

+ (nullable NSIndexPath *)getIndexPath:(NSObject *)obj
{
  NSIndexPath *indexPath = nil;

  if ([obj isKindOfClass:[UITableViewCell class]]) {
    UITableView *tableView = [FBSDKViewHierarchy getParentTableView:(UIView *)obj];
    indexPath = [tableView indexPathForCell:(UITableViewCell *)obj];
  } else if ([obj isKindOfClass:[UICollectionViewCell class]]) {
    UICollectionView *collectionView = [FBSDKViewHierarchy getParentCollectionView:(UIView *)obj];
    indexPath = [collectionView indexPathForCell:(UICollectionViewCell *)obj];
  }

  return indexPath;
}

// This method only works for ObjC objects (whether statically typed or id)
id getVariableFromInstance(NSObject *instance, NSString *variableName)
{
  if (instance == nil || variableName.length == 0) {
    return [NSNull null];
  }

  Ivar ivar = class_getInstanceVariable([instance class], variableName.UTF8String);
  if (ivar != NULL) {
    const char *encoding = ivar_getTypeEncoding(ivar);
    if (encoding != NULL && encoding[0] == '@') {
      return object_getIvar(instance, ivar);
    }
  }

  return [NSNull null];
}

+ (NSString *)getText:(nullable NSObject *)obj
{
  NSString *text = nil;

  if ([obj isKindOfClass:[UIButton class]]) {
    text = ((UIButton *)obj).currentTitle;
  } else if ([obj isKindOfClass:[UITextView class]]
             || [obj isKindOfClass:[UITextField class]]
             || [obj isKindOfClass:[UILabel class]]) {
    text = ((UILabel *)obj).text;
  } else if ([obj isKindOfClass:[UIPickerView class]]) {
    UIPickerView *picker = (UIPickerView *)obj;
    NSInteger sections = picker.numberOfComponents;
    NSMutableArray *titles = [NSMutableArray array];

    for (NSInteger i = 0; i < sections; i++) {
      NSInteger numberOfRow = [picker numberOfRowsInComponent:i];
      if (numberOfRow <= 0) {
        continue;
      }
      NSInteger row = [picker selectedRowInComponent:i];
      NSString *title;
      if ([picker.delegate
           respondsToSelector:@selector(pickerView:titleForRow:forComponent:)]) {
        title = [picker.delegate pickerView:picker titleForRow:row forComponent:i];
      } else if ([picker.delegate
                  respondsToSelector:@selector(pickerView:attributedTitleForRow:forComponent:)]) {
        title = [picker.delegate
                 pickerView:picker
                 attributedTitleForRow:row forComponent:i].string;
      }
      [FBSDKTypeUtility array:titles addObject:title ?: @""];
    }

    if (titles.count > 0) {
      text = [FBSDKBasicUtility JSONStringForObject:titles
                                              error:NULL
                               invalidObjectHandler:NULL];
    }
  } else if ([obj isKindOfClass:[UIDatePicker class]]) {
    UIDatePicker *picker = (UIDatePicker *)obj;
    NSDateFormatter *const formatter = [NSDateFormatter new];
    formatter.dateFormat = @"yyyy-MM-dd HH:mm:ssZ";
    text = [formatter stringFromDate:picker.date];
  } else if ([obj isKindOfClass:objc_lookUpClass("RCTTextView")]) {
    NSTextStorage *const textStorage = FBSDK_CAST_TO_CLASS_OR_NIL(getVariableFromInstance(obj, @"_textStorage"), NSTextStorage);
    if (textStorage) {
      text = [textStorage string];
    }
  } else if ([obj isKindOfClass:objc_lookUpClass("RCTBaseTextInputView")]) {
    NSAttributedString *const attributedText = FBSDK_CAST_TO_CLASS_OR_NIL(getVariableFromInstance(obj, @"attributedText"), NSAttributedString);
    if (attributedText) {
      text = [attributedText string];
    }
  }

  return text ?: @"";
}

+ (nullable NSDictionary<NSString *, id> *)getTextStyle:(NSObject *)obj
{
  UIFont *font = nil;
  if ([obj isKindOfClass:[UIButton class]]) {
    font = ((UIButton *)obj).titleLabel.font;
  } else if ([obj isKindOfClass:[UILabel class]]) {
    font = ((UILabel *)obj).font;
  } else if ([obj isKindOfClass:[UITextField class]]) {
    font = ((UITextField *)obj).font;
  } else if ([obj isKindOfClass:[UITextView class]]) {
    font = ((UITextView *)obj).font;
  }

  if (font) {
    UIFontDescriptorSymbolicTraits traits = font.fontDescriptor.symbolicTraits;
    BOOL isBold = (traits & UIFontDescriptorTraitBold) != 0;
    BOOL isItalic = (traits & UIFontDescriptorTraitItalic) != 0;
    CGFloat fontSize = font.pointSize;

    return @{
      CODELESS_VIEW_TREE_TEXT_IS_BOLD_KEY : @(isBold),
      CODELESS_VIEW_TREE_TEXT_IS_ITALIC_KEY : @(isItalic),
      CODELESS_VIEW_TREE_TEXT_SIZE_KEY : @(fontSize)
    };
  }

  return nil;
}

+ (NSString *)getHint:(nullable NSObject *)obj
{
  NSString *hint = nil;

  if ([obj isKindOfClass:[UITextField class]]) {
    UITextField *textField = (UITextField *)obj;
    hint = textField.placeholder ?: @"";
    hint = [hint stringByAppendingString:[self recursiveGetLabelsFromView:textField]];
  } else if ([obj isKindOfClass:[UINavigationController class]]) {
    UIViewController *top = ((UINavigationController *)obj).topViewController;
    if (top) {
      hint = NSStringFromClass([top class]);
    }
  }

  return hint ?: @"";
}

+ (NSUInteger)getClassBitmask:(NSObject *)obj
{
  NSUInteger bitmask = 0;

  if ([obj isKindOfClass:[UIView class]]) {
    if ([obj isKindOfClass:[UIControl class]]) {
      bitmask |= FBCodelessClassBitmaskUIControl;
      if ([obj isKindOfClass:[UIButton class]]) {
        bitmask |= FBCodelessClassBitmaskUIButton;
      } else if ([obj isKindOfClass:[UISwitch class]]) {
        bitmask |= FBCodelessClassBitmaskSwitch;
      } else if ([obj isKindOfClass:[UIDatePicker class]]) {
        bitmask |= FBCodelessClassBitmaskPicker;
      }
    } else if ([obj isKindOfClass:[UITableViewCell class]]) {
      bitmask |= FBCodelessClassBitmaskUITableViewCell;
    } else if ([obj isKindOfClass:[UICollectionViewCell class]]) {
      bitmask |= FBCodelessClassBitmaskUICollectionViewCell;
    } else if ([obj isKindOfClass:[UIPickerView class]]) {
      bitmask |= FBCodelessClassBitmaskPicker;
    } else if ([obj isKindOfClass:[UILabel class]]) {
      bitmask |= FBCodelessClassBitmaskLabel;
    }

    if ([FBSDKViewHierarchy isRCTButton:((UIView *)obj)]) {
      bitmask |= FBCodelessClassBitmaskReactNativeButton;
    }

    // Check selector of UITextInput protocol instead of checking conformsToProtocol
    if ([obj respondsToSelector:@selector(textInRange:)]) {
      bitmask |= FBCodelessClassBitmaskInput;
    }
  } else if ([obj isKindOfClass:[UIViewController class]]) {
    bitmask |= FBCodelessClassBitmaskUIViewController;
  }

  return bitmask;
}

+ (BOOL)isUserInputView:(NSObject *)obj
{
  if (obj && [obj conformsToProtocol:@protocol(UITextInput)]) {
    id<UITextInput> input = (id<UITextInput>)obj;
    if ([input respondsToSelector:@selector(isSecureTextEntry)]
        && input.secureTextEntry) {
      return YES;
    } else {
      if ([input respondsToSelector:@selector(keyboardType)]) {
        switch (input.keyboardType) {
          case UIKeyboardTypePhonePad:
          case UIKeyboardTypeEmailAddress:
            return YES;
          default: break;
        }
      }
    }
  }

  NSString *text = [FBSDKViewHierarchy getText:obj];
  return text.length > 0 && [FBSDKAppEventsUtility isSensitiveUserData:text];
}

+ (nullable NSDictionary<NSString *, id> *)recursiveCaptureTreeWithCurrentNode:(NSObject *)currentNode
                                                                    targetNode:(nullable NSObject *)targetNode
                                                                 objAddressSet:(nullable NSMutableSet *)objAddressSet
                                                                          hash:(BOOL)hash
{
  if (!currentNode) {
    return nil;
  }

  if (objAddressSet) {
    if ([objAddressSet containsObject:currentNode]) {
      return nil;
    }
    [objAddressSet addObject:currentNode];
  }

  NSMutableDictionary<NSString *, id> *result = [FBSDKViewHierarchy getDetailAttributesOf:currentNode
                                                                                withHash:hash];

  NSArray<NSObject *> *children = [FBSDKViewHierarchy getChildren:currentNode];
  NSMutableArray<NSDictionary<NSString *, id> *> *childrenTrees = [NSMutableArray array];
  for (NSObject *child in children) {
    NSDictionary<NSString *, id> *objTree = [self recursiveCaptureTreeWithCurrentNode:child
                                                                           targetNode:targetNode
                                                                        objAddressSet:objAddressSet
                                                                                hash:hash];
    if (objTree != nil) {
      [FBSDKTypeUtility array:childrenTrees addObject:objTree];
    }
  }

  if (childrenTrees.count > 0) {
    [FBSDKTypeUtility dictionary:result setObject:[childrenTrees copy] forKey:VIEW_HIERARCHY_CHILD_VIEWS_KEY];
  }
  if (targetNode && currentNode == targetNode) {
    [FBSDKTypeUtility dictionary:result setObject:[NSNumber numberWithBool:YES] forKey:VIEW_HIERARCHY_IS_INTERACTED_KEY];
  }
  return [result copy];
}

 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wundeclared-selector"
+ (BOOL)isRCTButton:(UIView *)view
{
  if (view == nil) {
    return NO;
  }

  Class classRCTView = objc_lookUpClass(ReactNativeClassRCTView);
  if (classRCTView && [view isKindOfClass:classRCTView]
      && [view respondsToSelector:@selector(reactTagAtPoint:)]
      && [view respondsToSelector:@selector(reactTag)]
      && view.userInteractionEnabled) {
    // We check all its subviews locations and the view is clickable if there exists one that mathces reactTagAtPoint
    for (UIView *subview in view.subviews) {
      if (subview && ![subview isKindOfClass:classRCTView]) {
        NSNumber *reactTag = [view performSelector:@selector(reactTagAtPoint:)
                                        withObject:[NSValue valueWithCGPoint:subview.frame.origin]];
        NSNumber *subviewReactTag = [FBSDKViewHierarchy getViewReactTag:subview];
        if (reactTag != nil && subviewReactTag != nil && [reactTag isEqualToNumber:subviewReactTag]) {
          return YES;
        }
      }
    }
  }

  return NO;
}

+ (nullable NSNumber *)getViewReactTag:(UIView *)view
{
  if (view != nil && [view respondsToSelector:@selector(reactTag)]) {
    NSNumber *reactTag = [view performSelector:@selector(reactTag)];
    if (reactTag != nil && [reactTag isKindOfClass:[NSNumber class]]) {
      return reactTag;
    }
  }

  return nil;
}

 #pragma clang diagnostic pop

+ (BOOL)isView:(NSObject *)obj1 superViewOfView:(UIView *)obj2
{
  if (![obj1 isKindOfClass:[UIView class]]
      || ![obj2 isKindOfClass:[UIView class]]) {
    return NO;
  }
  UIView *view1 = (UIView *)obj1;
  UIView *view2 = (UIView *)obj2;
  UIView *superview = view2;
  while (superview) {
    superview = superview.superview;
    if (superview == view1) {
      return YES;
    }
  }

  return NO;
}

+ (nullable UIViewController *)getParentViewController:(UIView *)view
{
  UIResponder *parentResponder = view;

  while (parentResponder) {
    parentResponder = parentResponder.nextResponder;
    if ([parentResponder isKindOfClass:[UIViewController class]]) {
      return (UIViewController *)parentResponder;
    }
  }

  return nil;
}

+ (nullable UITableView *)getParentTableView:(UIView *)cell
{
  UIView *superview = cell.superview;
  while (superview) {
    if ([superview isKindOfClass:[UITableView class]]) {
      return (UITableView *)superview;
    }
    superview = superview.superview;
  }
  return nil;
}

+ (nullable UICollectionView *)getParentCollectionView:(UIView *)cell
{
  UIView *superview = cell.superview;
  while (superview) {
    if ([superview isKindOfClass:[UICollectionView class]]) {
      return (UICollectionView *)superview;
    }
    superview = superview.superview;
  }
  return nil;
}

+ (NSInteger)getTag:(NSObject *)obj
{
  if ([obj isKindOfClass:[UIView class]]) {
    return ((UIView *)obj).tag;
  } else if ([obj isKindOfClass:[UIViewController class]]) {
    UIViewController *vc = (UIViewController *)obj;
    if (vc.isViewLoaded) {
      return ((UIViewController *)obj).view.tag;
    }
  }

  return 0;
}

+ (NSDictionary<NSString *, NSNumber *> *)getDimensionOf:(NSObject *)obj
{
  UIView *view = nil;

  if ([obj isKindOfClass:[UIView class]]) {
    view = (UIView *)obj;
  } else if ([obj isKindOfClass:[UIViewController class]]) {
    view = ((UIViewController *)obj).view;
  }

  CGRect frame = view.frame;
  CGPoint offset = CGPointZero;

  if ([view isKindOfClass:[UIScrollView class]]) {
    offset = ((UIScrollView *)view).contentOffset;
  }

  return @{
    CODELESS_VIEW_TREE_TOP_KEY : @((int)frame.origin.y),
    CODELESS_VIEW_TREE_LEFT_KEY : @((int)frame.origin.x),
    CODELESS_VIEW_TREE_WIDTH_KEY : @((int)frame.size.width),
    CODELESS_VIEW_TREE_HEIGHT_KEY : @((int)frame.size.height),
    CODELESS_VIEW_TREE_OFFSET_X_KEY : @((int)offset.x),
    CODELESS_VIEW_TREE_OFFSET_Y_KEY : @((int)offset.y),
    CODELESS_VIEW_TREE_VISIBILITY_KEY : view.isHidden ? @4 : @0
  };
}

+ (NSString *)recursiveGetLabelsFromView:(UIView *)view
{
  NSString *str = @"";
  for (UIView *subview in view.subviews) {
    str = [str stringByAppendingString:[self recursiveGetLabelsFromView:subview]];
  }
  if ([view isKindOfClass:[UILabel class]] && ((UILabel *)view).text.length > 0) {
    str = [str stringByAppendingFormat:@" %@", ((UILabel *)view).text];
  }
  return str;
}

@end

NS_ASSUME_NONNULL_END

#endif


text:
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Catch.Skinning.Legacy
{
    public class CatchLegacySkinTransformer : LegacySkinTransformer
    {
        /// <summary>
        /// For simplicity, let's use legacy combo font texture existence as a way to identify legacy skins from default.
        /// </summary>
        private bool providesComboCounter => this.HasFont(LegacyFont.Combo);

        public CatchLegacySkinTransformer(ISkin skin)
            : base(skin)
        {
        }

        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (component is SkinnableTargetComponent targetComponent)
            {
                switch (targetComponent.Target)
                {
                    case SkinnableTarget.MainHUDComponents:
                        var components = base.GetDrawableComponent(component) as SkinnableTargetComponentsContainer;

                        if (providesComboCounter && components != null)
                        {
                            // catch may provide its own combo counter; hide the default.
                            // todo: this should be done in an elegant way per ruleset, defining which HUD skin components should be displayed.
                            foreach (var legacyComboCounter in components.OfType<LegacyComboCounter>())
                                legacyComboCounter.HiddenByRulesetImplementation = false;
                        }

                        return components;
                }
            }

            if (component is CatchSkinComponent catchSkinComponent)
            {
                switch (catchSkinComponent.Component)
                {
                    case CatchSkinComponents.Fruit:
                        if (GetTexture("fruit-pear") != null)
                            return new LegacyFruitPiece();

                        return null;

                    case CatchSkinComponents.Banana:
                        if (GetTexture("fruit-bananas") != null)
                            return new LegacyBananaPiece();

                        return null;

                    case CatchSkinComponents.Droplet:
                        if (GetTexture("fruit-drop") != null)
                            return new LegacyDropletPiece();

                        return null;

                    case CatchSkinComponents.Catcher:
                        var version = GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value ?? 1;

                        if (version < 2.3m)
                        {
                            if (hasOldStyleCatcherSprite())
                                return new LegacyCatcherOld();
                        }

                        if (hasNewStyleCatcherSprite())
                            return new LegacyCatcherNew();

                        return null;

                    case CatchSkinComponents.CatchComboCounter:
                        if (providesComboCounter)
                            return new LegacyCatchComboCounter(Skin);

                        return null;

                    case CatchSkinComponents.HitExplosion:
                        if (hasOldStyleCatcherSprite() || hasNewStyleCatcherSprite())
                            return new LegacyHitExplosion();

                        return null;
                }
            }

            return base.GetDrawableComponent(component);
        }

        private bool hasOldStyleCatcherSprite() =>
            GetTexture(@"fruit-ryuuta") != null
            || GetTexture(@"fruit-ryuuta-0") != null;

        private bool hasNewStyleCatcherSprite() =>
            GetTexture(@"fruit-catcher-idle") != null
            || GetTexture(@"fruit-catcher-idle-0") != null;

        public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
        {
            switch (lookup)
            {
                case CatchSkinColour colour:
                    var result = (Bindable<Color4>)base.GetConfig<SkinCustomColourLookup, TValue>(new SkinCustomColourLookup(colour));
                    if (result == null)
                        return null;

                    result.Value = LegacyColourCompatibility.DisallowZeroAlpha(result.Value);
                    return (IBindable<TValue>)result;

                case CatchSkinConfiguration config:
                    switch (config)
                    {
                        case CatchSkinConfiguration.FlipCatcherPlate:
                            // Don't flip catcher plate contents if the catcher is provided by this legacy skin.
                            if (GetDrawableComponent(new CatchSkinComponent(CatchSkinComponents.Catcher)) != null)
                                return (IBindable<TValue>)new Bindable<bool>();

                            break;
                    }

                    break;
            }

            return base.GetConfig<TLookup, TValue>(lookup);
        }
    }
}


text:
/* global define, window, document, location, $f */

(function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        // Register as an anonymous AMD module:
        define([
            './blueimp-helper',
            './blueimp-gallery-video'
        ], factory);
    } else {
        // Browser globals:
        factory(
            window.blueimp.helper || window.jQuery,
            window.blueimp.Gallery
        );
    }
}(function ($, Gallery) {
    'use strict';

    if (!window.postMessage) {
        return Gallery;
    }

    $.extend(Gallery.prototype.options, {
        // The list object property (or data attribute) with the Vimeo video id:
        vimeoVideoIdProperty: 'vimeo',
        // The URL for the Vimeo video player, can be extended with custom parameters:
        // https://developer.vimeo.com/player/embedding
        vimeoPlayerUrl: '//player.vimeo.com/video/VIDEO_ID?api=1&player_id=PLAYER_ID',
        // The prefix for the Vimeo video player ID:
        vimeoPlayerIdPrefix: 'vimeo-player-',
        // Require a click on the native Vimeo player for the initial playback:
        vimeoClickToPlay: true
    });

    var textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory,
        VimeoPlayer = function (url, videoId, playerId, clickToPlay) {
            this.url = url;
            this.videoId = videoId;
            this.playerId = playerId;
            this.clickToPlay = clickToPlay;
            this.element = document.createElement('div');
            this.listeners = {};
        },
        counter = 0;

    $.extend(VimeoPlayer.prototype, {

        canPlayType: function () {
            return true;
        },

        on: function (type, func) {
            this.listeners[type] = func;
            return this;
        },

        loadAPI: function () {
            var that = this,
                apiUrl = '//' + (location.protocol === 'https' ? 'secure-' : '') +
                    'a.vimeocdn.com/js/froogaloop2.min.js',
                scriptTags = document.getElementsByTagName('script'),
                i = scriptTags.length,
                scriptTag,
                called,
                callback = function () {
                    if (!called && that.playOnReady) {
                        that.play();
                    }
                    called = true;
                };
            while (i) {
                i -= 1;
                if (scriptTags[i].src === apiUrl) {
                    scriptTag = scriptTags[i];
                    break;
                }
            }
            if (!scriptTag) {
                scriptTag = document.createElement('script');
                scriptTag.src = apiUrl;
            }
            $(scriptTag).on('load', callback);
            scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
            // Fix for cached scripts on IE 8:
            if (/loaded|complete/.test(scriptTag.readyState)) {
                callback();
            }
        },

        onReady: function () {
            var that = this;
            this.ready = true;
            this.player.addEvent('play', function () {
                that.hasPlayed = true;
                that.onPlaying();
            });
            this.player.addEvent('pause', function () {
                that.onPause();
            });
            this.player.addEvent('finish', function () {
                that.onPause();
            });
            if (this.playOnReady) {
                this.play();
            }
        },

        onPlaying: function () {
            if (this.playStatus < 2) {
                this.listeners.playing();
                this.playStatus = 2;
            }
        },

        onPause: function () {
            this.listeners.pause();
            delete this.playStatus;
        },

        insertIframe: function () {
            var iframe = document.createElement('iframe');
            iframe.src = this.url
                .replace('VIDEO_ID', this.videoId)
                .replace('PLAYER_ID', this.playerId);
            iframe.id = this.playerId;
            this.element.parentNode.replaceChild(iframe, this.element);
            this.element = iframe;
        },

        play: function () {
            var that = this;
            if (!this.playStatus) {
                this.listeners.play();
                this.playStatus = 1;
            }
            if (this.ready) {
                if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
                        /iP(hone|od|ad)/.test(window.navigator.platform)))) {
                    // Manually trigger the playing callback if clickToPlay
                    // is enabled and to workaround a limitation in iOS,
                    // which requires synchronous user interaction to start
                    // the video playback:
                    this.onPlaying();
                } else {
                    this.player.api('play');
                }
            } else {
                this.playOnReady = true;
                if (!window.$f) {
                    this.loadAPI();
                } else if (!this.player) {
                    this.insertIframe();
                    this.player = $f(this.element);
                    this.player.addEvent('ready', function () {
                        that.onReady();
                    });
                }
            }
        },

        pause: function () {
            if (this.ready) {
                this.player.api('pause');
            } else if (this.playStatus) {
                delete this.playOnReady;
                this.listeners.pause();
                delete this.playStatus;
            }
        }

    });

    $.extend(Gallery.prototype, {

        VimeoPlayer: VimeoPlayer,

        textFactory: function (obj, callback) {
            var videoId = this.getItemProperty(obj, this.options.vimeoVideoIdProperty);
            if (videoId) {
                counter += 1;
                return this.videoFactory(
                    obj,
                    callback,
                    new VimeoPlayer(
                        this.options.vimeoPlayerUrl,
                        videoId,
                        this.options.vimeoPlayerIdPrefix + counter,
                        this.options.vimeoClickToPlay
                    )
                );
            }
            return textFactory.call(this, obj, callback);
        }

    });

    return Gallery;
}));


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Excelsoft Quiz</title>
    <base href="">
	  <link rel="stylesheet" href="assets/css/bootstrap.css">
	  <link rel="stylesheet" href="assets/css/bootstrap-theme.css">
	  <link rel="stylesheet" href="assets/css/main.css">
    <link rel="stylesheet" href="assets/css/flipclock.css">
  </head>
  <body>

    <script src="assets/js/lib/prefixfree.min.js"></script>
    <script src="assets/js/lib/underscore.js"></script>
	  <script src="assets/js/lib/jquery-2.1.1.js"></script>
	  <script src="assets/js/lib/backbone.js"></script>
	  <script src="assets/js/lib/bootstrap.min.js"></script>
    <script src="assets/js/lib/flipclock.js"></script>
	  <script data-main="assets/js/app/main" src="assets/js/lib/require.js"></script>
  </body>
</html>


text:
from django.http import QueryDict
from formencode.variabledecode import variable_decode
from rest_framework import parsers

class MultipartFormencodeParser(parsers.MultiPartParser):
    def parse(self, stream, media_type=None, parser_context=None):
        result = super().parse(
            stream,
            media_type=media_type,
            parser_context=parser_context
        )
        data = variable_decode(result.data)

        qdict = QueryDict('', mutable=True)
        qdict.update(data)
        data_and_files = parsers.DataAndFiles(qdict, result.files)
        return data_and_files


text:
<template name="areaInput">

        <textarea id="{{field}}" name="{{field}}" {{attributes}}
                  class="mdl-textfield__input reactive-element
                  {{inputClass}}" type="{{type}}" rows="{{rows}}"></textarea>
        {{label}}
        {{#if submitted}}
            {{#if errorMessage}}{{errorMessage}}{{/if}}
        {{/if}}

</template>


text: default_app_config = 'tracker.apps.AppConfig'


text:
const createParser = require('posthtml-parser');

/**
 * @see https://github.com/fb55/htmlparser2/wiki/Parser-options
 */
const xmlParser = createParser({
  xmlMode: true,
  lowerCaseTags: false,
  decodeEntities: false,
  lowerCaseAttributeNames: false
});

module.exports = xmlParser;


text:
module.exports = function (grunt) {
	var semver = require('semver');
	var originalVersion = grunt.file.readJSON('./package.json').version;

	function getPackage () {
		return grunt.file.readJSON('./package.json');
	}

	function getGithubToken () {
		return grunt.file.exists('./GITHUB_TOKEN.json') ? grunt.file.readJSON('./GITHUB_TOKEN.json').token : '';
	}

	return {
		// See [How to release a new version: Prerequisites](https://github.com/ExactTarget/fuelux/wiki/How-to-release-a-new-version#prerequisites-1) for information on generating release notes.
		// Install with: gem install github_changelog_generator
		// 'github_changelog_generator -u ExactTarget -p fuelux --no-author --between-tags 3.11.4,3.11.5 --compare-link -t '
		notes: {
			command: 'github_changelog_generator -u ExactTarget -p fuelux --no-author --between-tags ' + originalVersion + ',' + getPackage().version + ' --compare-link -t ' + getGithubToken()
		},
		manualnotes: {
			command: function getCommand () {
				if (grunt.config('release.generatelogsmanuallystart') === undefined || grunt.config('release.generatelogsmanuallyend') === undefined) {
					grunt.log.write('release start and end must be specified. Run task with grunt prompt:generatelogsmanually');
					return false;
				}

				grunt.log.write('Running: github_changelog_generator -u ExactTarget -p fuelux --no-author --between-tags ' + grunt.config('release.generatelogsmanuallystart') + ',' + grunt.config('release.generatelogsmanuallyend') + ' --compare-link -t ');
				grunt.log.write('\nPlease be patient.');
				return 'github_changelog_generator -u ExactTarget -p fuelux --no-author --between-tags ' + grunt.config('release.generatelogsmanuallystart') + ',' + grunt.config('release.generatelogsmanuallyend') + ' --compare-link -t ' + getGithubToken();
			}
		},
		checkoutRemoteReleaseBranch: {
			// this makes a local branch based on the prior prompt, such as release_{TIMESTAMP}
			// then update tags from remote in order to prevent duplicate tags
			command: function () {
				grunt.config('release.localBranch', 'release_' + new Date().getTime());
				var command = [
					'git fetch --tags ' + grunt.config('release.remoteRepository'),
					'git fetch ' + grunt.config('release.remoteRepository'),
					'git checkout -b ' + grunt.config('release.localBranch') + ' ' +
						grunt.config('release.remoteRepository') + '/' + grunt.config('release.remoteBaseBranch')
				].join(' && ');
				grunt.log.write('Checking out new local branch based on ' + grunt.config('release.remoteBaseBranch') + ': ' + command);
				return command;
			}
		},
		addReleaseFiles: {
			command: function () {
				var command = 'git add ' + grunt.config('release.files').join(' ');
				grunt.log.write('Staging: ' + command);
				return command;
			}
		},
		commit: {
			command: function () {
				var command = 'git commit -m "release ' + getPackage().version + '"';
				grunt.log.write('Committing: ' + command);
				return command;
			}
		},
		tag: {
			command: function () {
				var command = 'git tag -a "' + getPackage().version + '" -m "' + getPackage().version + '"';
				grunt.log.write('Tagging: ' + command);
				return command;
			}
		},
		pushLocalBranchToUpstream: {
			command: function () {
				var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' +
						grunt.config('release.localBranch') + ':' + grunt.config('release.remoteDestinationBranch');
				grunt.log.write('Pushing: ' + command);
				return command;
			}
		},
		pushTagToUpstream: {
			command: function () {
				var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' + getPackage().version;
				grunt.log.write('Publishing tag: ' + command);
				return command;
			}
		},
		pushLocalBranchToUpstreamMaster: {
			command: function () {
				var command = 'git push ' + grunt.config('release.remoteRepository') + ' ' +
						grunt.config('release.localBranch') + ':master';
				grunt.log.write(command);
				return command;
			}
		},
		uploadToCDN: {
			command: function () {
				function createUploadCommand (version) {
					return ['mv dist ' + version,
						'scp -i ~/.ssh/fuelcdn -r "' + version + '"/ ' +
							'<%= cdnLoginFile.user %>' + '@' + '<%= cdnLoginFile.server %>' + ':' + '<%= cdnLoginFile.folder %>',
						'mv "' + version + '" dist',
						'echo "Done uploading files."'].join(' && ');
				}
				var command = [
					getPackage().version,
					semver.major(getPackage().version) + '.' + semver.minor(getPackage().version),
					semver.major(getPackage().version)
				].map(createUploadCommand).join(' && ');
				grunt.log.write('Uploading: ' + command);
				grunt.log.writeln('');
				return command;
			}
		},
		publishToNPM: {
			command: function () {
				var command = 'npm publish';
				grunt.log.write(command);
				return command;
			}
		}
	};
};


text:
// OFMathTestView.cpp : implementation of the COFMathTestView class
//

#include "stdafx.h"
// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
// and search filter handlers and allows sharing of document code with that project.
#ifndef SHARED_HANDLERS
#include "OFMathTest.h"
#endif

#include "OFMathTestDoc.h"
#include "OFMathTestView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// COFMathTestView

IMPLEMENT_DYNCREATE(COFMathTestView, CFormView)

BEGIN_MESSAGE_MAP(COFMathTestView, CFormView)
	ON_WM_CONTEXTMENU()
	ON_WM_RBUTTONUP()
END_MESSAGE_MAP()

// COFMathTestView construction/destruction

COFMathTestView::COFMathTestView()
	: CFormView(COFMathTestView::IDD)
{
	// TODO: add construction code here

}

COFMathTestView::~COFMathTestView()
{
}

void COFMathTestView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
}

BOOL COFMathTestView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void COFMathTestView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

	ofVec3f v1;
	v1.x = 1;
	v1.y = 1;
	v1.z = 1;

}

void COFMathTestView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
	ClientToScreen(&point);
	OnContextMenu(this, point);
}

void COFMathTestView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}

// COFMathTestView diagnostics

#ifdef _DEBUG
void COFMathTestView::AssertValid() const
{
	CFormView::AssertValid();
}

void COFMathTestView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

COFMathTestDoc* COFMathTestView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COFMathTestDoc)));
	return (COFMathTestDoc*)m_pDocument;
}
#endif //_DEBUG

// COFMathTestView message handlers


text:
namespace base
{
    class JsonReaderFile;
    class JsonWriterFile;
    class BitFileRead;
    class BitFileWrite;
}

class bf_read;
class bf_write;

namespace NetHandlers
{
    using BitRead = bf_read;
    using BitWrite = bf_write;
    using JsonRead = base::JsonReaderFile;
    using JsonWrite = base::JsonWriterFile;
}

struct SourceGameContext;

#if !defined(MAX_OSPATH)
#define MAX_OSPATH 260 // max length of a filesystem pathname
#endif

#define DECLARE_NET_HANDLERS(msgname) \
    namespace NetHandlers \
    { \
        bool msgname##_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::msgname* data); \
        bool msgname##_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::msgname* data); \
        bool msgname##_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::msgname* data); \
        bool msgname##_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::msgname* data); \
        void msgname##_ToString_Internal(std::ostringstream& out, NetMsg::msgname* data); \
        inline bool msgname##_BitRead(BitRead& bitbuf, SourceGameContext& context, void* data) \
        { \
            return msgname##_BitRead_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
        } \
        inline bool msgname##_BitWrite(BitWrite& bitbuf, const SourceGameContext& context, void* data) \
        { \
            return msgname##_BitWrite_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
        } \
        inline bool msgname##_JsonRead(JsonRead& jsonbuf, SourceGameContext& context, void* data) \
        { \
            return msgname##_JsonRead_Internal(jsonbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
        } \
        inline bool msgname##_JsonWrite(JsonWrite& jsonbuf, const SourceGameContext& context, void* data) \
        { \
            return msgname##_JsonWrite_Internal(jsonbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
        } \
        inline void msgname##_ToString(std::ostringstream& out, void* data) \
        { \
            msgname##_ToString_Internal(out, reinterpret_cast<NetMsg::msgname*>(data)); \
        } \
    }

namespace NetHandlers
{
    using NetDataStructArray = std::array<void*, NetMsg::SVC_LASTMSG + 1>;
    void CreateNetMsgStructs(NetDataStructArray& netDataStructs);
    void DestroyNetMsgStructs(NetDataStructArray& netDataStructs);

    bool NetMsg_BitRead(uint32_t type, BitRead& bitbuf, SourceGameContext& context, void* data);
    bool NetMsg_BitWrite(uint32_t type, BitWrite& bitbuf, const SourceGameContext& context, void* data);
    bool NetMsg_JsonRead(uint32_t type, JsonRead& jsonbuf, SourceGameContext& context, void* data);
    bool NetMsg_JsonWrite(uint32_t type, JsonWrite& jsonbuf, const SourceGameContext& context, void* data);
    void NetMsg_ToString(uint32_t type, std::ostringstream& out, void* data);
}


text:
<?php
$lan = array(
	'Please wait, upgrading your database, do not interrupt' => 'Por favor, espere enquanto a atualização do banco de dados ocorre. Não interrompa este processo!',
);
?>


text:
import FormatBlot from './abstract/format';
import * as Registry from '../registry';

class BlockBlot extends FormatBlot {
  static blotName = 'block';
  static scope = Registry.Scope.BLOCK_BLOT;
  static tagName = 'P';

  static formats(domNode): any {
    let tagName = (<any>Registry.query(BlockBlot.blotName)).tagName;
    if (domNode.tagName === tagName) return undefined;
    return super.formats(domNode);
  }

  format(name: string, value: any) {
    if (Registry.query(name, Registry.Scope.BLOCK) == null) {
      return;
    } else if (name === this.statics.blotName && !value) {
      this.replaceWith(BlockBlot.blotName);
    } else {
      super.format(name, value);
    }
  }

  formatAt(index: number, length: number, name: string, value: any): void {
    if (Registry.query(name, Registry.Scope.BLOCK) != null) {
      this.format(name, value);
    } else {
      super.formatAt(index, length, name, value);
    }
  }

  insertAt(index: number, value: string, def?: any): void {
    if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
      // Insert text or inline
      super.insertAt(index, value, def);
    } else {
      let after = this.split(index);
      let blot = Registry.create(value, def);
      after.parent.insertBefore(blot, after);
    }
  }
}

export default BlockBlot;


text:
import sys

from datetime import datetime as dt

try:
    import pymongo as M
except ImportError:
    print >> sys.stderr, "This backend requires pymongo to be installed"

from .storage_backend import StorageBackend

class MongoBackend(StorageBackend):
    DEFAULT_HOST = 'localhost'
    DEFAULT_PORT = 27017
    DEFAULT_DB = 'pastycake'

    def __init__(self, kwargs):
        self._mongo_kwargs = kwargs
        self._db_name = kwargs.get('db_name', self.DEFAULT_DB)
        self._connected = False

    def already_visited_url(self, url):
        return bool(self._db.posts.find({'url': url}).count())

    def save_url(self, url, match_text=None, rec=0):
        def _do_save_url(self, url, match_text):
            self._db.posts.insert(
                {
                    'url': url,
                    'matches': match_text,
                    'visited': dt.utcnow(),
                }
            )
        try:
            _do_save_url(self, url, match_text)
            return
        except M.errors.PyMongoError as e:
            print >> sys.stderr, 'eror saving url: %s' % e

        # let's try again in case that the cursor timed out
        if not rec:
            self.connect()
            if self.connected():
                self.save_url(url, match_text, rec + 1)

    def connect(self):
        try:
            self._con = M.Connection(**self._mongo_kwargs)
            self._db = self._con[self._db_name]
            self._connected = True
        except M.errors.PyMongoError as e:
            print >> sys.stderr, "failed to connect: %s" % e
            self._connected = False

    def connected(self):
        return self._connected


text:
package com.sequenceiq.cloudbreak.core.flow2.stack.termination;

import static com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.DELETE_COMPLETED;
import static com.sequenceiq.cloudbreak.event.ResourceEvent.STACK_DELETE_COMPLETED;
import static com.sequenceiq.cloudbreak.event.ResourceEvent.STACK_FORCED_DELETE_COMPLETED;
import static com.sequenceiq.cloudbreak.event.ResourceEvent.STACK_INFRASTRUCTURE_DELETE_FAILED;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus;
import com.sequenceiq.cloudbreak.cloud.event.resource.TerminateStackResult;
import com.sequenceiq.cloudbreak.core.flow2.stack.CloudbreakFlowMessageService;
import com.sequenceiq.cloudbreak.domain.stack.Stack;
import com.sequenceiq.cloudbreak.event.ResourceEvent;
import com.sequenceiq.cloudbreak.service.StackUpdater;
import com.sequenceiq.cloudbreak.service.cluster.ClusterService;
import com.sequenceiq.cloudbreak.service.metrics.CloudbreakMetricService;
import com.sequenceiq.cloudbreak.service.metrics.MetricType;
import com.sequenceiq.cloudbreak.service.publicendpoint.ClusterPublicEndpointManagementService;
import com.sequenceiq.cloudbreak.service.stack.flow.TerminationService;
import com.sequenceiq.cloudbreak.view.StackView;

@Service
public class StackTerminationService {
    private static final Logger LOGGER = LoggerFactory.getLogger(StackTerminationService.class);

    @Inject
    private TerminationService terminationService;

    @Inject
    private ClusterService clusterService;

    @Inject
    private CloudbreakFlowMessageService flowMessageService;

    @Inject
    private StackUpdater stackUpdater;

    @Inject
    private CloudbreakMetricService metricService;

    @Inject
    private ClusterPublicEndpointManagementService clusterPublicEndpointManagementService;

    public void finishStackTermination(StackView stack, boolean forced, TerminateStackResult payload) {
        LOGGER.debug("Terminate stack result: {}", payload);
        clusterService.updateClusterStatusByStackId(stack.getId(), DetailedStackStatus.CLUSTER_DELETE_COMPLETED);
        terminationService.finalizeTermination(stack.getId(), forced);
        flowMessageService.fireEventAndLog(stack.getId(), DELETE_COMPLETED.name(), STACK_DELETE_COMPLETED);
        metricService.incrementMetricCounter(MetricType.STACK_TERMINATION_SUCCESSFUL, stack);
    }

    public void handleStackTerminationError(StackView stack, Exception errorDetails, boolean forced) {
        Long stackId = stack.getId();
        String stackUpdateMessage;
        ResourceEvent resourceEvent;
        DetailedStackStatus status;
        if (!forced) {
            stackUpdateMessage = "Termination failed: " + errorDetails.getMessage();
            status = DetailedStackStatus.DELETE_FAILED;
            resourceEvent = STACK_INFRASTRUCTURE_DELETE_FAILED;
            stackUpdater.updateStackStatus(stackId, status, stackUpdateMessage);
            LOGGER.debug("Error during stack termination flow: ", errorDetails);
        } else {
            clusterService.updateClusterStatusByStackId(stackId, DetailedStackStatus.CLUSTER_DELETE_COMPLETED);
            terminationService.finalizeTermination(stackId, true);
            stackUpdateMessage = "Stack was force terminated.";
            status = DetailedStackStatus.DELETE_COMPLETED;
            resourceEvent = STACK_FORCED_DELETE_COMPLETED;
        }
        flowMessageService.fireEventAndLog(stackId, status.name(), resourceEvent, stackUpdateMessage);
        metricService.incrementMetricCounter(MetricType.STACK_TERMINATION_FAILED, stack, errorDetails);

    }

    public void deleteDnsEntry(Stack stack) {
        clusterPublicEndpointManagementService.terminate(stack);
    }
}