text:
package com.fsck.k9.mail.internet;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertEquals;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 21)
public class CharsetSupportTest {

    @Test
    public void testFixupCharset() throws Exception {
        String charsetOnMail;
        String expect;

        charsetOnMail = "CP932";
        expect = "shift_jis";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, new MimeMessage()));

//        charsetOnMail = "koi8-u";
//        expect = "koi8-r";
//        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, new MimeMessage()));

        MimeMessage message;

        message = new MimeMessage();
        message.setHeader("From", "aaa@docomo.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@dwmail.jp");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@pdx.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@willcom.com");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@emnet.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@emobile.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-docomo-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@softbank.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-softbank-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@vodafone.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-softbank-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@disney.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-softbank-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@vertuclub.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-softbank-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@ezweb.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-kddi-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));

        message = new MimeMessage();
        message.setHeader("From", "aaa@ido.ne.jp");
        charsetOnMail = "shift_jis";
        expect = "x-kddi-shift_jis-2007";
        assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, message));
    }
}


text:
function clamp(elem, max) {
    if (max <= elem.val()) {
        elem.val(max);
    }
}

Date.prototype.toDateInputValue = (function () {
    var local = new Date(this);
    local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
    return local.toJSON().slice(0, 10);
});

$(document).ready(function () {
    $("#date-input").val(new Date().toDateInputValue());
    $(".select2").select2({
        ajax: {
            cache: true,
            headers: {
                "X-CSRFToken": csrftoken
            },
            data: function (params) {
                return {
                    "query": params.term
                };
            },
            type: "POST",
            dataType: "json"
        },
        minimumInputLength: 2
    });
    $("#round-select").on("select2:select", function(event) {
        var round = event.params.data;

        clamp($("#score-hits").attr({
            "max": round.max_hits
        }), round.max_hits);
        clamp($("#score-golds").attr({
            "max": round.max_hits
        }), round.max_hits);
        clamp($("#score-score").attr({
            "max": round.max_score
        }), round.max_score);
        if (round.type.indexOf("Indoors") > -1 || round.type === "Imperial" || round.type === "Clout") {
            $("#score-xs").prop("disabled", true);
        } else {
            $("#score-xs").prop("disabled", false);
        }
    });
});

redpajama_set_name: RedPajamaGithub


text:
sap.ui.define([
		"sap/ui/documentation/sdk/controller/BaseController"
	], function (BaseController) {
		"use strict";

		return BaseController.extend("sap.ui.documentation.sdk.controller.Downloads", {

			/**
			 * Called when the controller is instantiated.
			 * @public
			 */
			onInit : function () {
				this.getRouter().getRoute("downloads").attachPatternMatched(this._onMatched, this);
			},

			/**
			 * Handles "downloads" routing
			 * @function
			 * @private
			 */
			_onMatched: function () {
				this.hideMasterSide();
			}
		});
	}
);


text:
package net.malisis.core.renderer.model;

import net.malisis.core.block.IComponent;

/**
 * @author Ordinastie
 *
 */
public interface IModelComponent extends IComponent
{
	@Override
	public default boolean isClientComponent()
	{
		return true;
	}

	//	public Pair<IRenderable, RenderParameters> getRenderable(IRenderContext context);
}


text:
(function(global) {

var define, requireModule;

(function() {
  var registry = {}, seen = {};

  define = function(name, deps, callback) {
    registry[name] = { deps: deps, callback: callback };
  };

  requireModule = function(name) {
    if (seen.hasOwnProperty(name)) { return seen[name]; }
    seen[name] = {};

    if (!registry[name]) {
      throw new Error("Could not find module " + name);
    }

    var mod = registry[name],
        deps = mod.deps,
        callback = mod.callback,
        reified = [],
        exports;

    for (var i=0, l=deps.length; i<l; i++) {
      if (deps[i] === 'exports') {
        reified.push(exports = {});
      } else {
        reified.push(requireModule(resolve(deps[i])));
      }
    }

    var value = callback.apply(this, reified);
    return seen[name] = exports || value;

    function resolve(child) {
      if (child.charAt(0) !== '.') { return child; }
      var parts = child.split("/");
      var parentBase = name.split("/").slice(0, -1);

      for (var i=0, l=parts.length; i<l; i++) {
        var part = parts[i];

        if (part === '..') { parentBase.pop(); }
        else if (part === '.') { continue; }
        else { parentBase.push(part); }
      }

      return parentBase.join("/");
    }
  };

  requireModule.registry = registry;
})();

define("ember-simple-auth-devise",
  ["./ember-simple-auth-devise/authenticators/devise","./ember-simple-auth-devise/authorizers/devise","exports"],
  function(__dependency1__, __dependency2__, __exports__) {
    "use strict";
    var Authenticator = __dependency1__.Devise;
    var Authorizer = __dependency2__.Devise;

    __exports__.Authenticator = Authenticator;
    __exports__.Authorizer = Authorizer;
  });
define("ember-simple-auth-devise/authenticators/devise",
  ["exports"],
  function(__exports__) {
    "use strict";
    var global = (typeof window !== 'undefined') ? window : {},
        Ember = global.Ember;

    /**
      Authenticator that works with the Ruby gem
      [Devise](https://github.com/plataformatec/devise).

      __As token authentication is not actually part of devise anymore, the server
      needs to implement some customizations__ to work with this authenticator -
      see the README and
      [discussion here](https://gist.github.com/josevalim/fb706b1e933ef01e4fb6).

      _The factory for this authenticator is registered as
      `'ember-simple-auth-authenticator:devise'` in Ember's container._

      @class Devise
      @namespace Authenticators
      @extends Base
    */
    var Devise = Ember.SimpleAuth.Authenticators.Base.extend({
      /**
        The endpoint on the server the authenticator acquires the auth token
        and email from.

        @property serverTokenEndpoint
        @type String
        @default '/users/sign_in'
      */
      serverTokenEndpoint: '/users/sign_in',

      /**
        The devise resource name

        @property resourceName
        @type String
        @default 'user'
      */
      resourceName: 'user',

      /**
        Restores the session from a set of session properties; __will return a
        resolving promise when there's a non-empty `user_token` and a non-empty
        `user_email` in the `properties`__ and a rejecting promise otherwise.

        @method restore
        @param {Object} properties The properties to restore the session from
        @return {Ember.RSVP.Promise} A promise that when it resolves results in the session being authenticated
      */
      restore: function(properties) {
        return new Ember.RSVP.Promise(function(resolve, reject) {
          if (!Ember.isEmpty(properties.user_token) && !Ember.isEmpty(properties.user_email)) {
            resolve(properties);
          } else {
            reject();
          }
        });
      },

      /**
        Authenticates the session with the specified `credentials`; the credentials
        are `POST`ed to the `serverTokenEndpoint` and if they are valid the server
        returns an auth token and email in response . __If the credentials are
        valid and authentication succeeds, a promise that resolves with the
        server's response is returned__, otherwise a promise that rejects with the
        error is returned.

        @method authenticate
        @param {Object} options The credentials to authenticate the session with
        @return {Ember.RSVP.Promise} A promise that resolves when an auth token and email is successfully acquired from the server and rejects otherwise
      */
      authenticate: function(credentials) {
        var _this = this;
        return new Ember.RSVP.Promise(function(resolve, reject) {
          var data                 = {};
          data[_this.resourceName] = {
            email:    credentials.identification,
            password: credentials.password
          };
          _this.makeRequest(data).then(function(response) {
            Ember.run(function() {
              resolve(response);
            });
          }, function(xhr, status, error) {
            Ember.run(function() {
              reject(xhr.responseJSON || xhr.responseText);
            });
          });
        });
      },

      /**
        Does nothing

        @method invalidate
        @return {Ember.RSVP.Promise} A resolving promise
      */
      invalidate: function() {
        return Ember.RSVP.resolve();
      },

      /**
        @method makeRequest
        @private
      */
      makeRequest: function(data, resolve, reject) {
        if (!Ember.SimpleAuth.Utils.isSecureUrl(this.serverTokenEndpoint)) {
          Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.');
        }
        return Ember.$.ajax({
          url:        this.serverTokenEndpoint,
          type:       'POST',
          data:       data,
          dataType:   'json',
          beforeSend: function(xhr, settings) {
            xhr.setRequestHeader('Accept', settings.accepts.json);
          }
        });
      }
    });

    __exports__.Devise = Devise;
  });
define("ember-simple-auth-devise/authorizers/devise",
  ["exports"],
  function(__exports__) {
    "use strict";
    var global = (typeof window !== 'undefined') ? window : {},
        Ember = global.Ember;

    /**
      Authenticator that works with the Ruby gem
      [Devise](https://github.com/plataformatec/devise) by sending the `user_token`
      and `user_email` properties from the session in the `Authorization` header.

      __As token authentication is not actually part of devise anymore, the server
      needs to implement some customizations__ to work with this authenticator -
      see the README for more information.

      _The factory for this authorizer is registered as
      `'ember-simple-auth-authorizer:devise'` in Ember's container._

      @class Devise
      @namespace Authorizers
      @extends Base
    */
    var Devise = Ember.SimpleAuth.Authorizers.Base.extend({
      /**
        Authorizes an XHR request by sending the `user_token` and `user_email`
        properties from the session in the `Authorization` header:

        ```
        Authorization: Token token="<user_token>", user_email="<user_email>"
        ```

        @method authorize
        @param {jqXHR} jqXHR The XHR request to authorize (see http://api.jquery.com/jQuery.ajax/#jqXHR)
        @param {Object} requestOptions The options as provided to the `$.ajax` method (see http://api.jquery.com/jQuery.ajaxPrefilter/)
      */

      authorize: function(jqXHR, requestOptions) {
        var userToken = this.get('session.user_token');
        var userEmail = this.get('session.user_email');
        if (this.get('session.isAuthenticated') && !Ember.isEmpty(userToken) && !Ember.isEmpty(userEmail)) {
          if (!Ember.SimpleAuth.Utils.isSecureUrl(requestOptions.url)) {
            Ember.Logger.warn('Credentials are transmitted via an insecure connection - use HTTPS to keep them secure.');
          }
          var authData = 'token="' + userToken + '", user_email="' + userEmail + '"';
          jqXHR.setRequestHeader('Authorization', 'Token ' + authData);
        }
      }
    });

    __exports__.Devise = Devise;
  });
var devise = requireModule('ember-simple-auth-devise');

global.Ember.SimpleAuth.Authenticators.Devise = devise.Authenticator;
global.Ember.SimpleAuth.Authorizers.Devise    = devise.Authorizer;

global.Ember.SimpleAuth.initializeExtension(function(container, application, options) {
  container.register('ember-simple-auth-authorizer:devise', global.Ember.SimpleAuth.Authorizers.Devise);
  container.register('ember-simple-auth-authenticator:devise', global.Ember.SimpleAuth.Authenticators.Devise);
});
})((typeof global !== 'undefined') ? global : window);


text:
namespace ash::diagnostics {

EventWatcherFactory::~EventWatcherFactory() = default;

std::unique_ptr<InputDataEventWatcher>
EventWatcherFactoryImpl::MakeKeyboardEventWatcher(
    uint32_t evdev_id,
    base::WeakPtr<KeyboardInputDataEventWatcher::Dispatcher> dispatcher) {
  return this->MakeWatcher<KeyboardInputDataEventWatcher,
                           KeyboardInputDataEventWatcher::Dispatcher>(
      evdev_id, dispatcher);
}

}  // namespace ash::diagnostics


text:
<?php

function wp_rp_update_tags($post_id) {
	global $wpdb;

	$post = get_post($post_id);
	if ($post->post_parent) {	// Handling revisions
		$post = get_post($post->post_parent);
	}

	$options = wp_rp_get_options();

	delete_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_expiration');
	delete_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_'.$options['max_related_posts']);

	$wpdb->query(
		$wpdb->prepare('DELETE from ' . $wpdb->prefix . 'wp_rp_tags WHERE post_id=%d', $post->ID)
	);

	if ($post->post_type !== 'post' ||  $post->post_status !== 'publish') {
		return;
	}

	wp_rp_generate_tags($post);
}
add_action('save_post', 'wp_rp_update_tags');

function wp_rp_get_exclude_ids_list_string($exclude_ids = array()) {
	global $post;

	array_push($exclude_ids, $post->ID);
	$exclude_ids = array_map('intval', $exclude_ids);
	$exclude_ids_str = implode(', ', $exclude_ids);

	return $exclude_ids_str;
}

global $wp_rp_unigrams;
function wp_rp_get_unigrams() {
	global $wp_rp_unigrams;
	if ($wp_rp_unigrams) {
		return $wp_rp_unigrams;
	}

	$wp_rp_unigrams = array();

	$unigrams_file = dirname(__FILE__) . '/lib/unigrams.csv';
	$handle = fopen($unigrams_file, 'r');
	while (($data = fgets($handle, 50)) !== FALSE) {
		$un = explode("\t", $data);
		if (count($un) == 5) {
			$wp_rp_unigrams[$un[0]] = floatval($un[4]);
		}
	}
	fclose($handle);

	return $wp_rp_unigrams;
}

function wp_rp_generate_auto_tags($post) {
	$suitable_words = wp_rp_get_unigrams();

	$words = array_slice(array_merge(explode(' ', $post->post_title), explode(' ', $post->post_content)), 0, WP_RP_RECOMMENDATIONS_AUTO_TAGS_MAX_WORDS);

	$bag_of_words = array();
	foreach ($words as $word) {
		$word = strtolower($word);
		$word = preg_replace('/[\W_]+/', '', $word);
		$stem = PorterStemmer::Stem($word);
		if ($stem) {
			if (!isset($bag_of_words[$stem])) {
				$bag_of_words[$stem] = 1;
			} else {
				$bag_of_words[$stem] += 1;
			}
		}
	}

	$selected_words = array();
	foreach ($bag_of_words as $word => $freq) {
		if (isset($suitable_words[$word])) {
			$selected_words[$word] = $suitable_words[$word] * sqrt($freq);
		}
	}

	asort($selected_words);
	$selected_words = array_reverse($selected_words, true);

	$auto_tags = array_slice($selected_words, 0, WP_RP_RECOMMENDATIONS_AUTO_TAGS_MAX_TAGS, true);

	return array_keys($auto_tags);
}

function wp_rp_get_post_term_tags($post, $term, $skip=array()) {
	$tags = wp_get_post_terms($post->ID, $term);

	$skip = array_flip($skip);

	$selected_tags = array();
	foreach ($tags as $tag) {
		if (!isset($skip[$tag->name])) {
			array_push($selected_tags, $tag->name);
		}
	}
	return $selected_tags;
}

function wp_rp_generate_tags($post) {
	global $wpdb;

	$tag_groups = array(
		'tags' => array(
			'labels' => wp_rp_get_post_term_tags($post, 'post_tag'),
			'weight' => WP_RP_RECOMMENDATIONS_TAGS_SCORE,
			'prefix' => 'P_',
		),
		'categories' => array(
			'labels' => wp_rp_get_post_term_tags($post, 'category', array('Uncategorized')),
			'weight' => WP_RP_RECOMMENDATIONS_CATEGORIES_SCORE,
			'prefix' => 'C_',
		),
		'auto_tags' => array(
			'labels' => wp_rp_generate_auto_tags($post),
			'weight' => WP_RP_RECOMMENDATIONS_AUTO_TAGS_SCORE,
			'prefix' => 'A_',
		)
	);

	$all_tags = array();
	$sql_tag_values = array();
	foreach ($tag_groups as $type => $tag_obj) {
		$weight = $tag_obj['weight'];

		foreach ($tag_obj['labels'] as $label) {
			$label = $tag_obj['prefix'] . strtolower($label);
			$label = substr($label, 0, WP_RP_MAX_LABEL_LENGTH);

			array_push($all_tags, $label);

			array_push($sql_tag_values, $post->ID);
			array_push($sql_tag_values, $post->post_date);
			array_push($sql_tag_values, $label);
			array_push($sql_tag_values, $weight);
		}
	}

	if (count($all_tags) > 0 && $post->post_status == 'publish') {
		$sql_tag_format_line = '(%d, %s, %s, %f)';
		$tags_insert_query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . 'wp_rp_tags (post_id, post_date, label, weight)
				VALUES ' . implode(', ', array_fill(0, count($all_tags), $sql_tag_format_line)) . ';',
			$sql_tag_values);

		$wpdb->query($tags_insert_query);
	}

	return $all_tags;
}

function wp_rp_fetch_related_posts_v2($limit = 10, $exclude_ids = array()) {
	global $wpdb, $post;
	$options = wp_rp_get_options();

	$timestamp = time();
	$related_posts_query_result_cache_expiration = (int) get_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_expiration', true);
	$related_posts_query_result_cache = get_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_'.$options['max_related_posts'], true);

	if (!$related_posts_query_result_cache || !$related_posts_query_result_cache_expiration || $related_posts_query_result_cache_expiration < $timestamp) { // Cache empty or never cached or cache expired
		$related_post_ids = null;
		$exclude_ids_str = wp_rp_get_exclude_ids_list_string($exclude_ids);

		$tags_query = "SELECT label FROM " . $wpdb->prefix . "wp_rp_tags WHERE post_id=$post->ID;";
		$tags = $wpdb->get_col($tags_query, 0);
		if (empty($tags)) {
			$tags = wp_rp_generate_tags($post);
			if (empty($tags)) {
				return array();
			}
		}

		if($options['exclude_categories']) {
			$exclude_categories = get_categories(array('include' => $options['exclude_categories']));
			$exclude_categories_labels = array_map(create_function('$c', 'return "C_" . $c->name;'), $exclude_categories);
		} else {
			$exclude_categories_labels = array();
		}

		$total_number_of_posts = $wpdb->get_col("SELECT count(post_id) from (SELECT post_id FROM " . $wpdb->prefix . "wp_rp_tags group by post_id) t;", 0);
		if (empty($total_number_of_posts)) {
			return array();
		}
		$total_number_of_posts = $total_number_of_posts[0];

		$post_id_query = $wpdb->prepare("
			SELECT
				target.post_id, sum(target.weight * log(%d / least(%d, freqs.freq))) as score
			FROM
				" . $wpdb->prefix . "wp_rp_tags as target,
				(SELECT label, count(1) as freq FROM " . $wpdb->prefix . "wp_rp_tags
					WHERE label IN (" . implode(', ', array_fill(0, count($tags), "%s"))  . ")
					GROUP BY label
				) as freqs
			WHERE
				target.post_id NOT IN (%s) AND
				" . ($options['max_related_post_age_in_days'] > 0 ? "target.post_date > DATE_SUB(CURDATE(), INTERVAL %s DAY) AND" : "") . "
				target.label=freqs.label AND
				target.label IN (" . implode(', ', array_fill(0, count($tags), "%s"))  . ")" .
				(empty($exclude_categories_labels) ? "" : " AND
					target.post_id NOT IN (
						SELECT post_id FROM " . $wpdb->prefix . "wp_rp_tags
						WHERE label IN (" . implode(', ', array_fill(0, count($exclude_categories_labels), "%s")) . ")
					)") . "
			GROUP BY target.post_id
			ORDER BY score desc, target.post_id desc
			LIMIT %d;",
			array_merge(
				array($total_number_of_posts, $total_number_of_posts),
				$tags,
				array($exclude_ids_str),
				$options['max_related_post_age_in_days'] > 0 ? array($options['max_related_post_age_in_days']) : array(),
				$tags,
				$exclude_categories_labels,
				array($limit * 2)
			)
		);	// limit * 2 just in case

		$related_posts_query_result_cache = $wpdb->get_results($post_id_query, 0);
		if (empty($related_posts_query_result_cache)) {
			return array();
		}

		// Update the cache
		if ($timestamp - strtotime($post->post_date) > 30 * 24 * 60 * 60) { // Post is older than one month
			update_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_expiration', $timestamp + 30 * 24 * 60 * 60); // Cache for one month
		} else {
			update_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_expiration', $timestamp + 24 * 60 * 60); // Cache for one day
		}

		update_post_meta($post->ID, '_wp_rp_related_posts_query_result_cache_'.$options['max_related_posts'], $related_posts_query_result_cache);
	}

	$related_posts_with_score_map = array();
	foreach ($related_posts_query_result_cache as $rp) {
		$related_posts_with_score_map[$rp->post_id] = $rp->score;
	}

	$related_post_ids = array_keys($related_posts_with_score_map);

	$now = current_time('mysql', 1);
	$post_query = $wpdb->prepare("
		SELECT post.ID, post.post_title, post.post_excerpt, post.post_content, post.post_date, post.comment_count
		FROM $wpdb->posts as post
		WHERE post.ID IN (" . implode(', ', array_fill(0, count($related_post_ids), '%d')) . ")
			AND post.post_type = 'post'
			AND post.post_status = 'publish'
			AND post.post_date_gmt < %s",
		array_merge($related_post_ids, array($now)));

	$related_posts = $wpdb->get_results($post_query);

	foreach ($related_posts as $rp) {
		$rp->wp_rp_score = $related_posts_with_score_map[$rp->ID];
	}

	usort($related_posts, create_function('$a,$b', 'return $b->wp_rp_score < $a->wp_rp_score ? -1 : 1;'));

	$related_posts = array_slice($related_posts, 0, $limit);

	return $related_posts;
}

function wp_rp_fetch_related_posts($limit = 10, $exclude_ids = array()) {
	global $wpdb, $post;
	$options = wp_rp_get_options();

	$exclude_ids_str = wp_rp_get_exclude_ids_list_string($exclude_ids);

	if(!$post->ID){return;}
	$now = current_time('mysql', 1);
	$tags = wp_get_post_tags($post->ID);

	$tagcount = count($tags);
	$taglist = false;
	if ($tagcount > 0) {
		$taglist = "'" . $tags[0]->term_id. "'";
		for ($i = 1; $i < $tagcount; $i++) {
			$taglist = $taglist . ", '" . $tags[$i]->term_id . "'";
		}
	}

	$related_posts = false;
	if ($taglist) {
		$q = "SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, p.comment_count, count(t_r.object_id) as cnt
				FROM $wpdb->term_taxonomy t_t, $wpdb->term_relationships t_r, $wpdb->posts p
				WHERE t_t.taxonomy ='post_tag'
					AND t_t.term_taxonomy_id = t_r.term_taxonomy_id
					AND t_r.object_id = p.ID
					AND (t_t.term_id IN ($taglist))
					AND p.ID NOT IN ($exclude_ids_str)
					AND " . (!$options['exclude_categories'] ? "" : "p.ID NOT IN (
						SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr
							WHERE tt.taxonomy = 'category'
							AND tt.term_taxonomy_id = tr.term_taxonomy_id
							AND tt.term_id IN (" . $options['exclude_categories'] . "))
							AND "
						) .
						"p.post_status = 'publish'
					AND p.post_type = 'post'
					AND " . ($options['max_related_post_age_in_days'] == 0 ? ""
						: "p.post_date > DATE_SUB(CURDATE(), INTERVAL " . $options['max_related_post_age_in_days'] . " DAY) AND ") .
					    "p.post_date_gmt < '$now' GROUP BY t_r.object_id
				ORDER BY cnt DESC, p.post_date_gmt DESC LIMIT $limit;";

		$related_posts = $wpdb->get_results($q);
	}

	return $related_posts;
}

function wp_rp_fetch_random_posts($limit = 10, $exclude_ids = array()) {
	global $wpdb, $post;
	$options = wp_rp_get_options();

	$exclude_ids_str = wp_rp_get_exclude_ids_list_string($exclude_ids);

	$q1 = "SELECT ID FROM $wpdb->posts posts WHERE post_status = 'publish' AND post_type = 'post' AND ID NOT IN ($exclude_ids_str)";
	if($options['exclude_categories']) {
		$q1 .= " AND ID NOT IN (SELECT tr.object_id FROM $wpdb->term_taxonomy tt, $wpdb->term_relationships tr WHERE tt.taxonomy = 'category' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.term_id IN (" . $options['exclude_categories'] . "))";
	}
	if($options['max_related_post_age_in_days'] > 0) {
		$q1 .= " AND post_date > DATE_SUB(CURDATE(), INTERVAL " . $options['max_related_post_age_in_days'] . " DAY)";
	}
	$ids = $wpdb->get_col($q1, 0);
	$count = count($ids);
	if($count === 0) {
		return false;
	/*} else if($count === 1) {
		$rnd = $ids;*/
	} else if($count > 1) {
		$display_number = min($limit, $count);

		$next_seed = rand();
		$t = time();
		$seed = $t - $t % 300 + $post->ID << 4;		// We keep the same seed for 5 minutes, so MySQL can cache the `q2` query.
		srand($seed);

		shuffle($ids);

		$ids = array_slice($ids, 0, $display_number);

		srand($next_seed);
	}
	$q2 = "SELECT ID, post_title, post_content, post_excerpt, post_date, comment_count FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND ID IN (" . implode(',', $ids) . ")";
	$results = $wpdb->get_results($q2);
	asort($ids);
	$ids_keys = array_keys($ids);
	array_multisort($ids_keys, $results);
	return $results;
}

function wp_rp_get_post_categories() {
	global $wpdb;

	$post_query = "SELECT p.ID as pid, te.name as cat_name, te.term_id as cat_id
		FROM $wpdb->posts p, $wpdb->terms te, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr
		WHERE p.post_status = 'publish' AND p.post_type = 'post'
			AND tt.taxonomy='category' AND tt.term_id = te.term_id
			AND tr.object_id = p.ID AND tt.term_taxonomy_id = tr.term_taxonomy_id";
	$posts = $wpdb->get_results($post_query);

	$result = array();
	foreach($posts as $row) {
		if (!isset($result[$row->pid])) {
			$result[$row->pid] = array();
		}
		$result[$row->pid][$row->cat_id] = $row->cat_name;
	}
	return $result;
}


text:
namespace mojo {

Id MakeTransportId(ConnectionSpecificId connection_id,
                   ConnectionSpecificId local_id) {
  return (connection_id << 16) | local_id;
}

// Helper called to construct a local view object from transport data.
View* AddViewToViewManager(ViewManagerClientImpl* client,
                           View* parent,
                           const ViewDataPtr& view_data) {
  // We don't use the ctor that takes a ViewManager here, since it will call
  // back to the service and attempt to create a new view.
  View* view = ViewPrivate::LocalCreate();
  ViewPrivate private_view(view);
  private_view.set_view_manager(client);
  private_view.set_id(view_data->view_id);
  private_view.set_visible(view_data->visible);
  private_view.set_drawn(view_data->drawn);
  private_view.LocalSetViewportMetrics(ViewportMetrics(),
                                       *view_data->viewport_metrics);
  private_view.set_properties(
      view_data->properties.To<std::map<std::string, std::vector<uint8_t>>>());
  client->AddView(view);
  private_view.LocalSetBounds(Rect(), *view_data->bounds);
  if (parent)
    ViewPrivate(parent).LocalAddChild(view);
  return view;
}

View* BuildViewTree(ViewManagerClientImpl* client,
                    const Array<ViewDataPtr>& views,
                    View* initial_parent) {
  std::vector<View*> parents;
  View* root = NULL;
  View* last_view = NULL;
  if (initial_parent)
    parents.push_back(initial_parent);
  for (size_t i = 0; i < views.size(); ++i) {
    if (last_view && views[i]->parent_id == last_view->id()) {
      parents.push_back(last_view);
    } else if (!parents.empty()) {
      while (parents.back()->id() != views[i]->parent_id)
        parents.pop_back();
    }
    View* view = AddViewToViewManager(
        client, !parents.empty() ? parents.back() : NULL, views[i]);
    if (!last_view)
      root = view;
    last_view = view;
  }
  return root;
}

// Responsible for removing a root from the ViewManager when that view is
// destroyed.
class RootObserver : public ViewObserver {
 public:
  explicit RootObserver(View* root) : root_(root) {}
  ~RootObserver() override {}

 private:
  // Overridden from ViewObserver:
  void OnViewDestroyed(View* view) override {
    DCHECK_EQ(view, root_);
    static_cast<ViewManagerClientImpl*>(root_->view_manager())
        ->RootDestroyed(root_);
    view->RemoveObserver(this);
    delete this;
  }

  View* root_;

  MOJO_DISALLOW_COPY_AND_ASSIGN(RootObserver);
};

ViewManagerClientImpl::ViewManagerClientImpl(
    ViewManagerDelegate* delegate,
    Shell* shell,
    InterfaceRequest<ViewManagerClient> request,
    bool delete_on_error)
    : connection_id_(0),
      next_id_(1),
      delegate_(delegate),
      root_(nullptr),
      capture_view_(nullptr),
      focused_view_(nullptr),
      activated_view_(nullptr),
      binding_(this, request.Pass()),
      delete_on_error_(delete_on_error) {
}

ViewManagerClientImpl::~ViewManagerClientImpl() {
  std::vector<View*> non_owned;
  while (!views_.empty()) {
    IdToViewMap::iterator it = views_.begin();
    if (OwnsView(it->second->id())) {
      it->second->Destroy();
    } else {
      non_owned.push_back(it->second);
      views_.erase(it);
    }
  }
  // Delete the non-owned views last. In the typical case these are roots. The
  // exception is the window manager, which may know aboutother random views
  // that it doesn't own.
  // NOTE: we manually delete as we're a friend.
  for (size_t i = 0; i < non_owned.size(); ++i)
    delete non_owned[i];

  delegate_->OnViewManagerDisconnected(this);
}

void ViewManagerClientImpl::DestroyView(Id view_id) {
  DCHECK(service_);
  service_->DeleteView(view_id, ActionCompletedCallback());
}

void ViewManagerClientImpl::AddChild(Id child_id, Id parent_id) {
  DCHECK(service_);
  service_->AddView(parent_id, child_id, ActionCompletedCallback());
}

void ViewManagerClientImpl::RemoveChild(Id child_id, Id parent_id) {
  DCHECK(service_);
  service_->RemoveViewFromParent(child_id, ActionCompletedCallback());
}

void ViewManagerClientImpl::Reorder(
    Id view_id,
    Id relative_view_id,
    OrderDirection direction) {
  DCHECK(service_);
  service_->ReorderView(view_id, relative_view_id, direction,
                        ActionCompletedCallback());
}

bool ViewManagerClientImpl::OwnsView(Id id) const {
  return HiWord(id) == connection_id_;
}

void ViewManagerClientImpl::SetBounds(Id view_id, const Rect& bounds) {
  DCHECK(service_);
  service_->SetViewBounds(view_id, bounds.Clone(), ActionCompletedCallback());
}

void ViewManagerClientImpl::SetSurfaceId(Id view_id, SurfaceIdPtr surface_id) {
  DCHECK(service_);
  if (surface_id.is_null())
    return;
  service_->SetViewSurfaceId(
      view_id, surface_id.Pass(), ActionCompletedCallback());
}

void ViewManagerClientImpl::SetFocus(Id view_id) {
  // In order for us to get here we had to have exposed a view, which implies we
  // got a connection.
  DCHECK(service_);
  service_->SetFocus(view_id, ActionCompletedCallback());
}

void ViewManagerClientImpl::SetVisible(Id view_id, bool visible) {
  DCHECK(service_);
  service_->SetViewVisibility(view_id, visible, ActionCompletedCallback());
}

void ViewManagerClientImpl::SetProperty(
    Id view_id,
    const std::string& name,
    const std::vector<uint8_t>& data) {
  DCHECK(service_);
  service_->SetViewProperty(view_id,
                            String(name),
                            Array<uint8_t>::From(data),
                            ActionCompletedCallback());
}

void ViewManagerClientImpl::Embed(const String& url, Id view_id) {
  Embed(url, view_id, nullptr, nullptr);
}

void ViewManagerClientImpl::Embed(const String& url,
                                  Id view_id,
                                  InterfaceRequest<ServiceProvider> services,
                                  ServiceProviderPtr exposed_services) {
  DCHECK(service_);
  service_->EmbedUrl(url, view_id, services.Pass(), exposed_services.Pass(),
                     ActionCompletedCallback());
}

void ViewManagerClientImpl::Embed(Id view_id, ViewManagerClientPtr client) {
  DCHECK(service_);
  service_->Embed(view_id, client.Pass(), ActionCompletedCallback());
}

void ViewManagerClientImpl::AddView(View* view) {
  DCHECK(views_.find(view->id()) == views_.end());
  views_[view->id()] = view;
}

void ViewManagerClientImpl::RemoveView(Id view_id) {
  if (focused_view_ && focused_view_->id() == view_id)
    OnViewFocused(0);

  IdToViewMap::iterator it = views_.find(view_id);
  if (it != views_.end())
    views_.erase(it);
}

void ViewManagerClientImpl::SetViewManagerService(
    ViewManagerServicePtr service) {
  DCHECK(!service_);
  DCHECK(service);
  service_ = service.Pass();
}
////////////////////////////////////////////////////////////////////////////////
// ViewManagerClientImpl, ViewManager implementation:

Id ViewManagerClientImpl::CreateViewOnServer() {
  DCHECK(service_);
  const Id view_id = MakeTransportId(connection_id_, ++next_id_);
  service_->CreateView(view_id, [this](ErrorCode code) {
    OnActionCompleted(code == ERROR_CODE_NONE);
  });
  return view_id;
}

const std::string& ViewManagerClientImpl::GetEmbedderURL() const {
  return creator_url_;
}

View* ViewManagerClientImpl::GetRoot() {
  return root_;
}

View* ViewManagerClientImpl::GetViewById(Id id) {
  IdToViewMap::const_iterator it = views_.find(id);
  return it != views_.end() ? it->second : NULL;
}

View* ViewManagerClientImpl::GetFocusedView() {
  return focused_view_;
}

View* ViewManagerClientImpl::CreateView() {
  View* view = new View(this, CreateViewOnServer());
  AddView(view);
  return view;
}

////////////////////////////////////////////////////////////////////////////////
// ViewManagerClientImpl, ViewManagerClient implementation:

void ViewManagerClientImpl::OnEmbed(ConnectionSpecificId connection_id,
                                    const String& creator_url,
                                    ViewDataPtr root_data,
                                    ViewManagerServicePtr view_manager_service,
                                    InterfaceRequest<ServiceProvider> services,
                                    ServiceProviderPtr exposed_services,
                                    Id focused_view_id) {
  if (view_manager_service) {
    DCHECK(!service_);
    service_ = view_manager_service.Pass();
  }
  connection_id_ = connection_id;
  creator_url_ = String::From(creator_url);

  DCHECK(!root_);
  root_ = AddViewToViewManager(this, nullptr, root_data);
  root_->AddObserver(new RootObserver(root_));

  focused_view_ = GetViewById(focused_view_id);

  delegate_->OnEmbed(root_, services.Pass(), exposed_services.Pass());
}

void ViewManagerClientImpl::OnEmbeddedAppDisconnected(Id view_id) {
  View* view = GetViewById(view_id);
  if (view) {
    FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view).observers(),
                      OnViewEmbeddedAppDisconnected(view));
  }
}

void ViewManagerClientImpl::OnViewBoundsChanged(Id view_id,
                                                RectPtr old_bounds,
                                                RectPtr new_bounds) {
  View* view = GetViewById(view_id);
  ViewPrivate(view).LocalSetBounds(*old_bounds, *new_bounds);
}

namespace {

void SetViewportMetricsOnDecendants(View* root,
                                    const ViewportMetrics& old_metrics,
                                    const ViewportMetrics& new_metrics) {
  ViewPrivate(root).LocalSetViewportMetrics(old_metrics, new_metrics);
  const View::Children& children = root->children();
  for (size_t i = 0; i < children.size(); ++i)
    SetViewportMetricsOnDecendants(children[i], old_metrics, new_metrics);
}
}

void ViewManagerClientImpl::OnViewViewportMetricsChanged(
    ViewportMetricsPtr old_metrics,
    ViewportMetricsPtr new_metrics) {
  View* view = GetRoot();
  if (view)
    SetViewportMetricsOnDecendants(view, *old_metrics, *new_metrics);
}

void ViewManagerClientImpl::OnViewHierarchyChanged(
    Id view_id,
    Id new_parent_id,
    Id old_parent_id,
    mojo::Array<ViewDataPtr> views) {
  View* initial_parent = views.size() ?
      GetViewById(views[0]->parent_id) : NULL;

  BuildViewTree(this, views, initial_parent);

  View* new_parent = GetViewById(new_parent_id);
  View* old_parent = GetViewById(old_parent_id);
  View* view = GetViewById(view_id);
  if (new_parent)
    ViewPrivate(new_parent).LocalAddChild(view);
  else
    ViewPrivate(old_parent).LocalRemoveChild(view);
}

void ViewManagerClientImpl::OnViewReordered(Id view_id,
                                            Id relative_view_id,
                                            OrderDirection direction) {
  View* view = GetViewById(view_id);
  View* relative_view = GetViewById(relative_view_id);
  if (view && relative_view)
    ViewPrivate(view).LocalReorder(relative_view, direction);
}

void ViewManagerClientImpl::OnViewDeleted(Id view_id) {
  View* view = GetViewById(view_id);
  if (view)
    ViewPrivate(view).LocalDestroy();
}

void ViewManagerClientImpl::OnViewVisibilityChanged(Id view_id, bool visible) {
  // TODO(sky): there is a race condition here. If this client and another
  // client change the visibility at the same time the wrong value may be set.
  // Deal with this some how.
  View* view = GetViewById(view_id);
  if (view)
    ViewPrivate(view).LocalSetVisible(visible);
}

void ViewManagerClientImpl::OnViewDrawnStateChanged(Id view_id, bool drawn) {
  View* view = GetViewById(view_id);
  if (view)
    ViewPrivate(view).LocalSetDrawn(drawn);
}

void ViewManagerClientImpl::OnViewSharedPropertyChanged(
    Id view_id,
    const String& name,
    Array<uint8_t> new_data) {
  View* view = GetViewById(view_id);
  if (view) {
    std::vector<uint8_t> data;
    std::vector<uint8_t>* data_ptr = NULL;
    if (!new_data.is_null()) {
      data = new_data.To<std::vector<uint8_t>>();
      data_ptr = &data;
    }

    view->SetSharedProperty(name, data_ptr);
  }
}

void ViewManagerClientImpl::OnViewInputEvent(
    Id view_id,
    EventPtr event,
    const Callback<void()>& ack_callback) {
  View* view = GetViewById(view_id);
  if (view) {
    FOR_EACH_OBSERVER(ViewObserver,
                      *ViewPrivate(view).observers(),
                      OnViewInputEvent(view, event));
  }
  ack_callback.Run();
}

void ViewManagerClientImpl::OnViewFocused(Id focused_view_id) {
  View* focused = GetViewById(focused_view_id);
  View* blurred = focused_view_;
  if (blurred) {
    FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(blurred).observers(),
                      OnViewFocusChanged(focused, blurred));
  }
  focused_view_ = focused;
  if (focused) {
    FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(focused).observers(),
                      OnViewFocusChanged(focused, blurred));
  }
}

////////////////////////////////////////////////////////////////////////////////
// OnConnectionError, private:
void ViewManagerClientImpl::OnConnectionError() {
  if (delete_on_error_)
    delete this;
}

////////////////////////////////////////////////////////////////////////////////
// ViewManagerClientImpl, private:

void ViewManagerClientImpl::RootDestroyed(View* root) {
  DCHECK_EQ(root, root_);
  root_ = nullptr;
}

void ViewManagerClientImpl::OnActionCompleted(bool success) {
  if (!change_acked_callback_.is_null())
    change_acked_callback_.Run();
}

Callback<void(bool)> ViewManagerClientImpl::ActionCompletedCallback() {
  return [this](bool success) { OnActionCompleted(success); };
}

}  // namespace mojo


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");

class BooleanAttributeTypeController extends AttributeTypeController  {

	// Field definition in the ADODB Format. We omit the first column (name) though, since it's
	// automatically generated

	protected $searchIndexFieldDefinition = 'I1 DEFAULT 0 NULL';

	public function searchForm($list) {
		$list->filterByAttribute($this->attributeKey->getAttributeKeyHandle(), 1);
		return $list;
	}

	public function getValue() {
		$db = Loader::db();
		$value = $db->GetOne("select value from atBoolean where avID = ?", array($this->getAttributeValueID()));
		return $value;
	}

	public function getDisplayValue() {
		$v = $this->getValue();
		return ($v == 1) ? t('Yes') : t('No');
	}

	protected function load() {
		$ak = $this->getAttributeKey();
		if (!is_object($ak)) {
			return false;
		}

		$db = Loader::db();
		$row = $db->GetRow('select akCheckedByDefault from atBooleanSettings where akID = ?', $ak->getAttributeKeyID());
		$this->akCheckedByDefault = $row['akCheckedByDefault'];
		$this->set('akCheckedByDefault', $this->akCheckedByDefault);
	}

	public function form() {

		if (is_object($this->attributeValue)) {
			$value = $this->getAttributeValue()->getValue();
			$checked = $value == 1 ? true : false;
		} else {
			$this->load();
			if ($this->akCheckedByDefault) {
				$checked = true;
			}
		}

		$cb = Loader::helper('form')->checkbox($this->field('value'), 1, $checked);
		print $cb . ' ' . t('Yes');
	}

	public function search() {
		print Loader::helper('form')->checkbox($this->field('value'), 1, $this->request('value') == 1) . ' ' . t('Yes');
	}

	public function type_form() {
		$this->set('form', Loader::helper('form'));
		$this->load();
	}

	// run when we call setAttribute(), instead of saving through the UI
	public function saveValue($value) {
		$db = Loader::db();
		$value = ($value == false || $value == '0') ? 0 : 1;
		$db->Replace('atBoolean', array('avID' => $this->getAttributeValueID(), 'value' => $value), 'avID', true);
	}

	public function deleteKey() {
		$db = Loader::db();
		$db->Execute('delete from atBooleanSettings where akID = ?', array($this->getAttributeKey()->getAttributeKeyID()));

		$arr = $this->attributeKey->getAttributeValueIDList();
		foreach($arr as $id) {
			$db->Execute('delete from atBoolean where avID = ?', array($id));
		}
	}

	public function duplicateKey($newAK) {
		$this->load();
		$db = Loader::db();
		$db->Execute('insert into atBooleanSettings (akID, akCheckedByDefault) values (?, ?)', array($newAK->getAttributeKeyID(), $this->akCheckedByDefault));
	}

	public function saveKey($data) {
		$ak = $this->getAttributeKey();
		$db = Loader::db();
		$akCheckedByDefault = $data['akCheckedByDefault'];

		if ($data['akCheckedByDefault'] != 1) {
			$akCheckedByDefault = 0;
		}

		$db->Replace('atBooleanSettings', array(
			'akID' => $ak->getAttributeKeyID(),
			'akCheckedByDefault' => $akCheckedByDefault
		), array('akID'), true);
	}

	public function saveForm($data) {
		$db = Loader::db();
		$this->saveValue($data['value']);
	}

	// if this gets run we assume we need it to be validated/checked
	public function validateForm($data) {
		return $data['value'] == 1;
	}

	public function deleteValue() {
		$db = Loader::db();
		$db->Execute('delete from atBoolean where avID = ?', array($this->getAttributeValueID()));
	}

}


text:
package oci

import (
	"context"
	"io"
	"time"

	"github.com/lastbackend/lastbackend/internal/pkg/models"
)

type Runc struct {
}

func NewRunc(cfg ConfigRunc) (*Runc, error) {
	r := new(Runc)
	return r, nil
}

func (Runc) List(ctx context.Context, all bool) ([]*models.Container, error) {
	return nil, nil
}

func (Runc) Create(ctx context.Context, spec *models.ContainerManifest) (string, error) {
	return "", nil
}

func (Runc) Start(ctx context.Context, ID string) error {
	return nil
}

func (Runc) Restart(ctx context.Context, ID string, timeout *time.Duration) error {
	return nil
}

func (Runc) Stop(ctx context.Context, ID string, timeout *time.Duration) error {
	return nil
}

func (Runc) Pause(ctx context.Context, ID string) error {
	return nil
}

func (Runc) Resume(ctx context.Context, ID string) error {
	return nil
}

func (Runc) Remove(ctx context.Context, ID string, clean bool, force bool) error {
	return nil
}

func (Runc) Inspect(ctx context.Context, ID string) (*models.Container, error) {
	return nil, nil
}

func (Runc) Logs(ctx context.Context, ID string, stdout, stderr, follow bool) (io.ReadCloser, error) {
	return nil, nil
}

func (Runc) Copy(ctx context.Context, ID, path string, content io.Reader) error {
	return nil
}

func (Runc) Wait(ctx context.Context, ID string) error {
	return nil
}

func (Runc) Subscribe(ctx context.Context, container chan *models.Container) error {
	return nil
}

func (Runc) Close() error {
	return nil
}


text:
'use strict';

google.load('visualization', '1', {
    packages: ['corechart']
});

google.setOnLoadCallback(function () {
    angular.bootstrap(document.body, ['tcrApp']);
});

var tcrApp = angular.module("tcrApp", ["highcharts-ng"])
    .config(function ($routeProvider, $locationProvider) {
        $routeProvider.when('/Home/menu',
        {
            templateUrl: '/Scripts/app/views/menu.html',
            controller: 'MenuController'
        });
        $routeProvider.when('/Home/lengthDiv',
        {
            templateUrl: '/Scripts/app/views/lengthDiv.html',
            controller: 'LengthDivController'
        });
        $routeProvider.when('/Home/vsegDiv',
        {
            templateUrl: '/Scripts/app/views/vSegDiv.html',
            controller: 'VsegDivController'
        });
        $routeProvider.when('/Home/dsegDiv',
        {
            templateUrl: '/Scripts/app/views/dSegDiv.html',
            controller: 'DsegDivController'
        });
        $routeProvider.when('/Home/jsegDiv',
        {
            templateUrl: '/Scripts/app/views/jSegDiv.html',
            controller: 'JsegDivController'
        });
        $routeProvider.when('/Home/repertoireClones',
        {
            templateUrl: '/Scripts/app/views/repertoireClones.html',
            controller: 'RepertoireClonesController'
        });
        $routeProvider.when('/Home/repertoireCountClones',
        {
            templateUrl: '/Scripts/app/views/repertoireCountClones.html',
            controller: 'RepertoireCountClonesController'
        });
        $routeProvider.when('/Home/About',
        {
            templateUrl: '/Scripts/app/views/About.html',
            controller: 'AboutController'
        });
        $routeProvider.when('/Home/Contact',
        {
            templateUrl: '/Scripts/app/views/Contact.html',
            controller: 'ContactController'
        });
        $routeProvider.otherwise({ redirectTo: '/Home/menu' });
        $locationProvider.html5Mode(true);
    });


text:
using System;
using MonoTouch.Dialog;

#if __UNIFIED__
using Foundation;
using CoreGraphics;
using UIKit;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using CGRect = System.Drawing.RectangleF;
#endif

using ZXing;
using ZXing.Mobile;

namespace Sample.iOS
{
	public class HomeViewController : DialogViewController
	{
        public HomeViewController () : base (UITableViewStyle.Grouped, new RootElement ("ZXing.Net.Mobile"), false)
		{
		}

		MobileBarcodeScanner scanner;
		CustomOverlayView customOverlay;

		public override void ViewDidLoad ()
		{
			//Create a new instance of our scanner
			scanner = new MobileBarcodeScanner(this.NavigationController);

            Root = new RootElement ("ZXing.Net.Mobile") {
                new Section {

                    new StyledStringElement ("Scan with Default View", async () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;
                        //We can customize the top and bottom text of the default overlay
                        scanner.TopText = "Hold camera up to barcode to scan";
                        scanner.BottomText = "Barcode will automatically scan";

                        //Start scanning
                        var result = await scanner.Scan ();

                        HandleScanResult(result);
                    }),

                    new StyledStringElement ("Scan Continuously", () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;

                        //Tell our scanner to use our custom overlay
                        scanner.UseCustomOverlay = true;
                        scanner.CustomOverlay = customOverlay;

                        var opt = new MobileBarcodeScanningOptions ();
                        opt.DelayBetweenContinuousScans = 3000;

                        //Start scanning
                        scanner.ScanContinuously (opt, true, HandleScanResult);
                    }),

                    new StyledStringElement ("Scan with Custom View", async () => {
                        //Create an instance of our custom overlay
                        customOverlay = new CustomOverlayView();
                        //Wireup the buttons from our custom overlay
                        customOverlay.ButtonTorch.TouchUpInside += delegate {
                            scanner.ToggleTorch();
                        };
                        customOverlay.ButtonCancel.TouchUpInside += delegate {
                            scanner.Cancel();
                        };

                        //Tell our scanner to use our custom overlay
                        scanner.UseCustomOverlay = true;
                        scanner.CustomOverlay = customOverlay;

                        var result = await scanner.Scan ();

                        HandleScanResult(result);
                    }),

                    new StyledStringElement ("Scan with AVCapture Engine", async () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;
                        //We can customize the top and bottom text of the default overlay
                        scanner.TopText = "Hold camera up to barcode to scan";
                        scanner.BottomText = "Barcode will automatically scan";

                        //Start scanning
                        var result = await scanner.Scan (true);

                        HandleScanResult (result);
                    }),

                    new StyledStringElement ("Generate Barcode", () => {
                        NavigationController.PushViewController (new ImageViewController (), true);
                    })
                }
            };
		}

		void HandleScanResult(ZXing.Result result)
		{
			string msg = "";

			if (result != null && !string.IsNullOrEmpty(result.Text))
				msg = "Found Barcode: " + result.Text;
			else
				msg = "Scanning Canceled!";

			this.InvokeOnMainThread(() => {
				var av = new UIAlertView("Barcode Result", msg, null, "OK", null);
				av.Show();
			});
		}
	}
}


text:
class Foo {
  static getSelf() {
    return this;
  }

  static test() {
    const o = {
      Foo: Foo
    };
    const deep = {
      very: {
        o
      }
    };

    function fn() {
      return o;
    }

    function fnDeep() {
      return deep;
    }

    function f(o, r = (() => {
      var _o$Foo;

      return o === null || o === void 0 ? void 0 : babelHelpers.classStaticPrivateFieldSpecGet(_o$Foo = o.Foo, Foo, _m).call(_o$Foo);
    })()) {
      return r;
    }

    function g(o, r = (() => {
      var _ref;

      return (_ref = (() => o === null || o === void 0 ? void 0 : babelHelpers.classStaticPrivateFieldSpecGet(babelHelpers.classStaticPrivateFieldSpecGet(o.Foo, Foo, _self).getSelf(), Foo, _m))()) === null || _ref === void 0 ? void 0 : _ref();
    })()) {
      return r;
    }

    function h(fnDeep, r = (() => {
      var _fnDeep$very$o$Foo, _fnDeep$very$o;

      return (_fnDeep$very$o$Foo = fnDeep === null || fnDeep === void 0 ? void 0 : (_fnDeep$very$o = fnDeep().very.o) === null || _fnDeep$very$o === void 0 ? void 0 : _fnDeep$very$o.Foo) === null || _fnDeep$very$o$Foo === void 0 ? void 0 : babelHelpers.classStaticPrivateFieldSpecGet(_fnDeep$very$o$Foo, Foo, _m).call(_fnDeep$very$o$Foo);
    })()) {
      return r;
    }

    function i(fn, r = (() => {
      var _getSelf, _getSelf$self, _ref2;

      return (_getSelf = (_ref2 = (() => fn === null || fn === void 0 ? void 0 : babelHelpers.classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self))()) === null || _ref2 === void 0 ? void 0 : _ref2.getSelf()) === null || _getSelf === void 0 ? void 0 : babelHelpers.classStaticPrivateFieldSpecGet(_getSelf$self = _getSelf.self, Foo, _m).call(_getSelf$self);
    })()) {
      return r;
    }

    function j(fn, r = (() => {
      var _babelHelpers$classSt, _babelHelpers$classSt2;

      return (_babelHelpers$classSt2 = babelHelpers.classStaticPrivateFieldSpecGet(_babelHelpers$classSt = babelHelpers.classStaticPrivateFieldSpecGet(fn().Foo, Foo, _self).getSelf().self, Foo, _m)) === null || _babelHelpers$classSt2 === void 0 ? void 0 : _babelHelpers$classSt2.call(_babelHelpers$classSt);
    })()) {
      return r;
    }

    f(o);
    g(o);
    h(fnDeep);
    i(fn);
    j(fn);
  }

}

var _x = {
  writable: true,
  value: 1
};
var _m = {
  writable: true,
  value: function () {
    return babelHelpers.classStaticPrivateFieldSpecGet(this, Foo, _x);
  }
};
var _self = {
  writable: true,
  value: Foo
};
babelHelpers.defineProperty(Foo, "self", Foo);
Foo.test();


text:
<?php

class OmniwebShowtimes_AdminPageFramework_Form_taxonomy_field extends OmniwebShowtimes_AdminPageFramework_Form {
    public $sStructureType = 'taxonomy_field';
    public function get() {
        $this->sCapability = $this->callback($this->aCallbacks['capability'], '');
        if (!$this->canUserView($this->sCapability)) {
            return '';
        }
        $this->_formatElementDefinitions($this->aSavedData);
        $_oFieldsets = new OmniwebShowtimes_AdminPageFramework_Form_View___FieldsetRows($this->getElementAsArray($this->aFieldsets, '_default'), null, $this->aSavedData, $this->getFieldErrors(), $this->aFieldTypeDefinitions, $this->aCallbacks, $this->oMsg);
        return $_oFieldsets->get();
    }
}


text:
<?php
header( 'Location: public' ) ;


text:
import { NativeScriptEffects } from "./effects.common";
import { View, AnimationDefinition } from "@nativescript/core";

export * from "./effects.common";

View.prototype.spring = function (duration?: number, animation?: any) {
  if (duration === void 0) {
    duration = NativeScriptEffects.defaultDuration;
  }

  const msDuration = NativeScriptEffects.getMsValue(duration);
  if (!animation) {
    animation = {
      translate: {
        x: 0,
        y: -100,
      },
      scale: {
        x: 2,
        y: 2,
      },
      duration: msDuration,
      delay: 0,
      dampingRatio: 0.3,
      velocity: 2.0,
      options: null,
    };
  } else {
    animation.duration = msDuration;
  }

  let def: AnimationDefinition = {
    scale: { x: animation.scale.x, y: animation.scale.y },
    translate: { x: animation.translate.x, y: animation.translate.y },
    delay: animation.delay,
    duration: animation.duration,
    curve: "spring",
  };
  return this.animate(def);
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 28(1/2): 215 (1930)

#### Original name
Cercospora melanotes Syd.

### Remarks
null


text:
jasmine.HtmlReporter = function(_doc) {
  var self = this;
  var doc = _doc || window.document;

  var reporterView;

  var dom = {};

  // Jasmine Reporter Public Interface
  self.logRunningSpecs = false;

  self.reportRunnerStarting = function(runner) {
    var specs = runner.specs() || [];

    if (specs.length == 0) {
      return;
    }

    createReporterDom(runner.env.versionString());
    doc.body.appendChild(dom.reporter);

    reporterView = new jasmine.HtmlReporter.ReporterView(dom);
    reporterView.addSpecs(specs, self.specFilter);
  };

  self.reportRunnerResults = function(runner) {
    reporterView && reporterView.complete();
  };

  self.reportSuiteResults = function(suite) {
    reporterView.suiteComplete(suite);
  };

  self.reportSpecStarting = function(spec) {
    if (self.logRunningSpecs) {
      self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
    }
  };

  self.reportSpecResults = function(spec) {
    reporterView.specComplete(spec);
  };

  self.log = function() {
    var console = jasmine.getGlobal().console;
    if (console && console.log) {
      if (console.log.apply) {
        console.log.apply(console, arguments);
      } else {
        console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
      }
    }
  };

  self.specFilter = function(spec) {
    if (!focusedSpecName()) {
      return true;
    }

    return spec.getFullName().indexOf(focusedSpecName()) === 0;
  };

  return self;

  function focusedSpecName() {
    var specName;

    (function memoizeFocusedSpec() {
      if (specName) {
        return;
      }

      var paramMap = [];
      var params = doc.location.search.substring(1).split('&');

      for (var i = 0; i < params.length; i++) {
        var p = params[i].split('=');
        paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
      }

      specName = paramMap.spec;
    })();

    return specName;
  }

  function createReporterDom(version) {
    dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
      dom.banner = self.createDom('div', { className: 'banner' },
        self.createDom('span', { className: 'title' }, "Jasmine "),
        self.createDom('span', { className: 'version' }, version)),

      dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
      dom.alert = self.createDom('div', {className: 'alert'}),
      dom.results = self.createDom('div', {className: 'results'},
        dom.summary = self.createDom('div', { className: 'summary' }),
        dom.details = self.createDom('div', { id: 'details' }))
    );
  }
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);


text:
// +build windows

package winstats

import (
	"fmt"
	"unsafe"

	"golang.org/x/sys/windows"
)

// getCurrentVersionVal gets value of specified key from registry.
func getCurrentVersionVal(key string) (string, error) {
	var h windows.Handle
	if err := windows.RegOpenKeyEx(windows.HKEY_LOCAL_MACHINE,
		windows.StringToUTF16Ptr(`SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\`),
		0,
		windows.KEY_READ,
		&h); err != nil {
		return "", err
	}
	defer windows.RegCloseKey(h)

	var buf [128]uint16
	var typ uint32
	n := uint32(len(buf) * int(unsafe.Sizeof(buf[0]))) // api expects array of bytes, not uint16
	if err := windows.RegQueryValueEx(h,
		windows.StringToUTF16Ptr(key),
		nil,
		&typ,
		(*byte)(unsafe.Pointer(&buf[0])),
		&n); err != nil {
		return "", err
	}

	return windows.UTF16ToString(buf[:]), nil
}

// getVersionRevision gets revision from UBR registry.
func getVersionRevision() (uint16, error) {
	revisionString, err := getCurrentVersionVal("UBR")
	if err != nil {
		return 0, err
	}

	revision, err := windows.UTF16FromString(revisionString)
	if err != nil {
		return 0, err
	}

	return revision[0], nil
}

// getKernelVersion gets the version of windows kernel.
func getKernelVersion() (string, error) {
	// Get CurrentBuildNumber.
	buildNumber, err := getCurrentVersionVal("CurrentBuildNumber")
	if err != nil {
		return "", err
	}

	// Get CurrentMajorVersionNumber.
	majorVersionNumberString, err := getCurrentVersionVal("CurrentMajorVersionNumber")
	if err != nil {
		return "", err
	}
	majorVersionNumber, err := windows.UTF16FromString(majorVersionNumberString)
	if err != nil {
		return "", err
	}

	// Get CurrentMinorVersionNumber.
	minorVersionNumberString, err := getCurrentVersionVal("CurrentMinorVersionNumber")
	if err != nil {
		return "", err
	}
	minorVersionNumber, err := windows.UTF16FromString(minorVersionNumberString)
	if err != nil {
		return "", err
	}

	// Get UBR.
	revision, err := getVersionRevision()
	if err != nil {
		return "", err
	}

	return fmt.Sprintf("%d.%d.%s.%d", majorVersionNumber[0], minorVersionNumber[0], buildNumber, revision), nil
}

// getOSImageVersion gets the osImage name and version.
func getOSImageVersion() (string, error) {
	productName, err := getCurrentVersionVal("ProductName")
	if err != nil {
		return "", nil
	}

	return productName, nil
}


text:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<ns1:getAvailableGroupsResponse
			xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
			<DirectionalDNSAvailableGroups
				xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
				<item>EU-foo.jclouds.org.</item>
				<item>non-foo.jclouds.org.</item>
			</DirectionalDNSAvailableGroups>
		</ns1:getAvailableGroupsResponse>
	</soap:Body>
</soap:Envelope>


text:
#cluster-information .cluster-name label {
  font-weight: normal;
}

#cluster-information .dev-blueprint {
  line-height: 35px;
}

#cluster-information .dev-blueprint span {
  vertical-align: text-top;
}
#cluster-information .cluster-name .cluster-input-block{
  float: left;
  width: 75%;
}

#cluster-information .cluster-name button {
  float: right;
}

#cluster-information .cluster-name input.edited {
  background-color: #fdfbdd;
}

#cluster-information .welcome-header {
  margin: -15px;
  padding: 15px 15px 40px 15px;
  background-color: #f0f0f0;
  text-align: center;
}

#cluster-information .create-cluster-section {
  text-align: center;
  padding: 30px;
}

#cluster-information .install-button {
  height: 40px;
}

#cluster-information .install-button a {
  height: 100%;
  padding: 0;
  width: 225px;
  font-size: 16px;
  line-height: 40px;
}

@keyframes INSTALL-BOX-ROTATE {
  0% {transform: rotate(0deg)}
  12.5% {transform: rotate(-30deg)}
  37.5% {transform: rotate(30deg)}
  62.5% {transform: rotate(-30deg)}
  87.5% {transform: rotate(30deg)}
  100% {transform: rotate(0deg)}
}

#cluster-information #install-box {
  animation: INSTALL-BOX-ROTATE 2s;
  width: 116px;
  margin-bottom: 20px;
  margin-top: 40px;
}


text:
package github

import "fmt"

// Blob represents a blob object.
type Blob struct {
	Content  *string `json:"content,omitempty"`
	Encoding *string `json:"encoding,omitempty"`
	SHA      *string `json:"sha,omitempty"`
	Size     *int    `json:"size,omitempty"`
	URL      *string `json:"url,omitempty"`
}

// GetBlob fetchs a blob from a repo given a SHA.
//
// GitHub API docs: http://developer.github.com/v3/git/blobs/#get-a-blob
func (s *GitService) GetBlob(owner string, repo string, sha string) (*Blob, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	blob := new(Blob)
	resp, err := s.client.Do(req, blob)
	return blob, resp, err
}

// CreateBlob creates a blob object.
//
// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
func (s *GitService) CreateBlob(owner string, repo string, blob *Blob) (*Blob, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
	req, err := s.client.NewRequest("POST", u, blob)
	if err != nil {
		return nil, nil, err
	}

	t := new(Blob)
	resp, err := s.client.Do(req, t)
	return t, resp, err
}


text:
"use strict";

module.exports.Mixin = function (browserify) {
    return browserify.transform("babelify", { presets: ["react"] });
};


text:
namespace MBox
{
	namespace DeviceFlt
	{
		struct ContextCleanupCallbackParameter
		{
			void*		m_Context{};
			ContextType	m_ContextType{};

			void*		m_RegisterContext{};
		};

		using ContextCleanupCallbackFunctor$Type = ktl::function<void(ContextCleanupCallbackParameter*)>;

		struct ContextCleanupCallbackPacket
		{
			UINT32  m_IsEnableCleanupCallback : 1;

			ContextCleanupCallbackFunctor$Type m_ContextCleanupCallback{};

			PVOID   m_RegisterContext{};

			ContextCleanupCallbackPacket()
			{
				m_IsEnableCleanupCallback = FALSE;
			}
		};

		//
		// Callback
		//

		DeviceFlt$Function$TraverseCallbackPacketMember$Macro(ContextCleanupCallbackPacket, m_ContextCleanupCallbackPacket)

#define DeviceFlt$Function$TraverseContextCleanupCallbackPacketCallbackName$Macro \
DeviceFlt$Function$TraverseCallbackPacketMemberName$Macro(ContextCleanupCallbackPacket)

			template <typename F>
		static void TraverseContextCleanupCallback(F aFunctor)
		{
			auto vCallback = [&aFunctor](ContextCleanupCallbackPacket* aInstanceCallbackFunction, UINT32 aIndex) -> BOOLEAN
			{
				if (aInstanceCallbackFunction->m_IsEnableCleanupCallback)
				{
					return aFunctor(aInstanceCallbackFunction, aIndex);
				}

				return FALSE;
			};
			DeviceFlt$Function$TraverseContextCleanupCallbackPacketCallbackName$Macro(vCallback);
		}

		void __stdcall ContextCleanupCallback(
			void* aContext,
			ContextType aContextType);
	}
}


text:
A docker image for building nodejs packages, with dependencies, for deployment on Ubuntu.

## What's in the box

`ubuntu-node-build-machine` is intended as a build machine. Its purpose is to build [nodejs](https://nodejs.org/en/) packages within an environment that matches the environment in which the package will be executed.

We've been running node applications on docker containers in production for over a year now and have encountered a few issues along the way by performing an `npm install` on a build server and then packaging the resulting application into a docker image. Some subtle inconsistencies can occur when our applications reference packages that have build steps that involve native resources. These occur during `npm install` and often detect the available libraries (linux headers, openssl, etc.) and step down in some way when those headers/libraries are not available. Anyone who has watched the mongodb driver fail back to a pure JS bson implementation knows what we're talking about here.

This docker image helps us do it more right.

This build machine image is for targeting `ubuntu:14.04`, we also have `leisurelink/alpine-node-build-machine` for targeting `alpeine:3.2` and `leisurelink/centos-node-build-machine` for targeting `centos:7.1`. They are all very similar.

This image is for building our node based applications. Once built, we package the application into another docker image via a seperate `Dockerfile`. This two step process enables us to build and run leaner docker images for use as the runtime.

## Building Your Package

All you need to use this image is docker and some nodejs source code.

From the directory where your source resides:

```bash
docker run --rm --volume `pwd`:/source/ leisurelink/abuntu-node-machine
```

**WARNING:** By mounting your local directory, the build will take place in the current folder. To ensure a clean build, the build script removes the `node_modules` folder so that all packages get built with the assets present inside the container. For the duration of the build its probably best if you leave the files alone on the host filesystem.

### Private Repositories

If your `package.json` file refers to private git repositories, you will need to provide authority to the builder when it is run. We mount an SSH key for this purpose:

**Mount an SSH identity**

```bash
docker run --rm --volume `pwd`:/source/ --volume /path-to-key/id_rsa:/tmp/id_rsa leisurelink/ubuntu-node-build-machine
```

### Private NPMs

If your `package.json` file refers to private NPM repositories, you will need to provide authority to the builder when it is run:

**Specify an NPM Authentication Token**

```bash
docker run --rm --volume `pwd`:/source/ -env NPM_AUTH_TOKEN=0000000-0000-0000-0000-00000000000 leisurelink/ubuntu-node-build-machine
```

### Keep it Simple

The script that performs the _build_ is `perform-build.sh`. We're open to suggestions and pull request but want to keep it simple; since we're building a node app, we rely on `npm install`.

If your project has _special needs_, follow [Keith Cirkel's How to Use npm as a Build Tool](http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/). Your goal should be to ensure that everything that needs to happen in order for your build to succeed occurs as part of `npm install`. Notably, this means adding `preinstall` and/or `postinstall` scripts to your `package.json`.

If your build process has _very special needs_, then you'll need your own, specialized docker image that sets up the enviornement appropriately for those special needs.

## Tags (Asset Versions)

Clone this repository and build the `Dockerfile` to see concrete version information related to the ubuntu packages present on the image; there are many.

* **latest, 1.0.0** (Ubuntu:14.04, nodejs 4.2.4)
* **node-0.12.7** (Ubuntu:14.04, nodejs 0.12.7)

## License

[MIT](https://github.com/LeisureLink/ubuntu-node-build-machine/blob/master/LICENSE)


text:
#pragma once

#include <cstddef>
#include <vector>
#include <string>

#include <string.h>
#ifndef _WIN32
#  include <inttypes.h>
#endif

#ifdef _MSC_VER
#   define TAG_DLL_EXPORT __declspec(dllexport)
#   define TAG_DLL_IMPORT __declspec(dllimport )
#   ifdef OPENDDLPARSER_BUILD
#       define DLL_ODDLPARSER_EXPORT TAG_DLL_EXPORT
#   else
#       define DLL_ODDLPARSER_EXPORT TAG_DLL_IMPORT
#   endif // OPENDDLPARSER_BUILD
#   pragma warning( disable : 4251 )
#else
#   define DLL_ODDLPARSER_EXPORT
#endif // _WIN32

// Namespace declarations, override this to avoid any conflicts
#define BEGIN_ODDLPARSER_NS namespace ODDLParser {
#define END_ODDLPARSER_NS   } // namespace ODDLParser
#define USE_ODDLPARSER_NS   using namespace ODDLParser;

BEGIN_ODDLPARSER_NS

// We will use C++11 optional
#ifndef OPENDDL_NO_USE_CPP11
    // All C++11 constructs
#   define ddl_nullptr nullptr
#else
    // Fallback for older compilers
#   define ddl_nullptr NULL
#endif // OPENDDL_NO_USE_CPP11

class DDLNode;
class Value;

struct Name;
struct Identifier;
struct Reference;
struct Property;
struct DataArrayList;

#ifdef _WIN32
typedef signed __int64    int64_impl;
typedef unsigned __int64  uint64_impl;
#else
typedef int64_t           int64_impl;
typedef uint64_t          uint64_impl;
#endif

// OpenDDL-specific data typedefs
typedef signed char       int8;    ///< Signed integer, 1 byte
typedef signed short      int16;   ///< Signed integer, 2 byte
typedef signed int        int32;   ///< Signed integer, 4 byte
typedef int64_impl        int64;   ///< Signed integer, 8 byte
typedef unsigned char     uint8;   ///< Unsigned integer, 1 byte
typedef unsigned short    uint16;  ///< Unsigned integer, 2 byte
typedef unsigned int      uint32;  ///< Unsigned integer, 4 byte
typedef uint64_impl       uint64;  ///< Unsigned integer, 8 byte

///	@brief  Description of the type of a name.
enum NameType {
    GlobalName, ///< Name is global.
    LocalName   ///< Name is local.
};

///	@brief  Stores a text
struct Text {
    size_t m_capacity;
    size_t m_len;
    char *m_buffer;

    Text( const char *buffer, size_t numChars )
    : m_capacity( 0 )
    , m_len( 0 )
    , m_buffer( ddl_nullptr ) {
        set( buffer, numChars );
    }

    ~Text() {
        clear();
    }

    void clear() {
        delete[] m_buffer;
        m_buffer = ddl_nullptr;
        m_capacity = 0;
        m_len = 0;
    }

    void set( const char *buffer, size_t numChars ) {
        clear();
        if( numChars > 0 ) {
            m_len = numChars;
            m_capacity = m_len + 1;
            m_buffer = new char[ m_capacity ];
            strncpy( m_buffer, buffer, numChars );
            m_buffer[ numChars ] = '\0';
        }
    }

    bool operator == ( const std::string &name ) const {
        if( m_len != name.size() ) {
            return false;
        }
        const int res( strncmp( m_buffer, name.c_str(), name.size() ) );

        return ( 0 == res );
    }

    bool operator == ( const Text &rhs ) const {
        if( m_len != rhs.m_len ) {
            return false;
        }

        const int res( strncmp( m_buffer, rhs.m_buffer, m_len ) );

        return ( 0 == res );
    }

private:
    Text( const Text & );
    Text &operator = ( const Text & );
};

///	@brief  Stores an OpenDDL-specific identifier type.
struct Identifier {
    Text m_text;

    Identifier( char buffer[], size_t len )
        : m_text( buffer, len ) {
        // empty
    }

    Identifier( char buffer[] )
    : m_text( buffer, strlen( buffer ) ) {
        // empty
    }

    bool operator == ( const Identifier &rhs ) const {
        return m_text == rhs.m_text;
    }

private:
    Identifier( const Identifier & );
    Identifier &operator = ( const Identifier & );
};

///	@brief  Stores an OpenDDL-specific name
struct Name {
    NameType    m_type;
    Identifier *m_id;

    Name( NameType type, Identifier *id )
        : m_type( type )
        , m_id( id ) {
        // empty
    }

private:
    Name( const Name & );
    Name &operator = ( const Name& );
};

///	@brief  Stores a bundle of references.
struct Reference {
    size_t   m_numRefs;
    Name   **m_referencedName;

    Reference()
    : m_numRefs( 0 )
    , m_referencedName( ddl_nullptr ) {
        // empty
    }

    Reference( size_t numrefs, Name **names )
    : m_numRefs( numrefs )
    , m_referencedName( ddl_nullptr ) {
        m_referencedName = new Name *[ numrefs ];
        for( size_t i = 0; i < numrefs; i++ ) {
            Name *name = new Name( names[ i ]->m_type, names[ i ]->m_id );
            m_referencedName[ i ] = name;
        }
    }

    ~Reference() {
        for( size_t i = 0; i < m_numRefs; i++ ) {
            delete m_referencedName[ i ];
        }
        m_numRefs = 0;
        m_referencedName = ddl_nullptr;
    }

private:
    Reference( const Reference & );
    Reference &operator = ( const Reference & );
};

///	@brief  Stores a property list.
struct Property {
    Identifier *m_key;
    Value *m_value;
    Reference *m_ref;
    Property *m_next;

    Property( Identifier *id )
    : m_key( id )
    , m_value( ddl_nullptr )
    , m_ref( ddl_nullptr )
    , m_next( ddl_nullptr ) {
        // empty
    }

    ~Property() {
        m_key = ddl_nullptr;
        m_value = ddl_nullptr;
        m_ref = ddl_nullptr;;
        m_next = ddl_nullptr;;
    }

private:
    Property( const Property & );
    Property &operator = ( const Property & );
};

///	@brief  Stores a data array list.
struct DataArrayList {
    size_t m_numItems;
    Value *m_dataList;
    DataArrayList *m_next;

    DataArrayList()
        : m_numItems( 0 )
        , m_dataList( ddl_nullptr )
        , m_next( ddl_nullptr ) {
        // empty
    }

private:
    DataArrayList( const DataArrayList & );
    DataArrayList &operator = ( const DataArrayList & );
};

///	@brief  Stores the context of a parsed OpenDDL declaration.
struct Context {
    DDLNode *m_root;

    Context()
        : m_root( ddl_nullptr ) {
        // empty
    }

    ~Context() {
        m_root = ddl_nullptr;
    }

private:
    Context( const Context & );
    Context &operator = ( const Context & );
};

END_ODDLPARSER_NS


text:
typedef enum {
  PBExtensionTypeBool,
  PBExtensionTypeFixed32,
  PBExtensionTypeSFixed32,
  PBExtensionTypeFloat,
  PBExtensionTypeFixed64,
  PBExtensionTypeSFixed64,
  PBExtensionTypeDouble,
  PBExtensionTypeInt32,
  PBExtensionTypeInt64,
  PBExtensionTypeSInt32,
  PBExtensionTypeSInt64,
  PBExtensionTypeUInt32,
  PBExtensionTypeUInt64,
  PBExtensionTypeBytes,
  PBExtensionTypeString,
  PBExtensionTypeMessage,
  PBExtensionTypeGroup,
  PBExtensionTypeEnum
} PBExtensionType;

@interface PBConcreteExtensionField : NSObject<PBExtensionField> {
@private
  PBExtensionType type;

  Class extendedClass;
  int32_t fieldNumber;
  id defaultValue;

  Class messageOrGroupClass;

  BOOL isRepeated;
  BOOL isPacked;
  BOOL isMessageSetWireFormat;
}

+ (PBConcreteExtensionField*) extensionWithType:(PBExtensionType) type
                                extendedClass:(Class) extendedClass
                                  fieldNumber:(int32_t) fieldNumber
                                 defaultValue:(id) defaultValue
                            messageOrGroupClass:(Class) messageOrGroupClass
                                   isRepeated:(BOOL) isRepeated
                                     isPacked:(BOOL) isPacked
                       isMessageSetWireFormat:(BOOL) isMessageSetWireFormat;

@end


text:
import java.util;
import org.metasyntactic.id3.v2.frame;

public class streaming-audio
{
   public static void main(String[] args)
   {
      //TODO pull APIC Frame picture information
      public static final byte[] COVER_FRONT
      {
      }
   }
}


text:
module Doorkeeper
  module OAuth
    module PreAuthorizationMixin
      extend ActiveSupport::Concern

      include Validations

      included do
        validate :client, error: :invalid_client
        validate :scopes, error: :invalid_scope

        attr_accessor :server, :client
        attr_writer   :scope
      end

      def authorizable?
        valid?
      end

      def scopes
        Scopes.from_string scope
      end

      def scope
        @scope.presence || server.default_scopes.to_s
      end

      def error_response
        OAuth::ErrorResponse.from_request(self)
      end

      private

      def validate_client
        client.present?
      end

      def validate_scopes
        return true unless scope.present?
        Helpers::ScopeChecker.valid?(
          scope,
          server.scopes,
          client.application.scopes
        )
      end
    end
  end
end