text:
from __future__ import print_function
from float16_transpiler import Float16Transpiler

import argparse
import paddle
import paddle.fluid as fluid
import contextlib
import math
import sys
import numpy as np
import os

parser = argparse.ArgumentParser(
    'Float16 inference accuracy test and benchmark.')
parser.add_argument(
    '--train_batch_size', type=int, default=16, help="Batch size for training.")
parser.add_argument(
    '--inf_batch_size', type=int, default=32, help="Batch size for inference.")
parser.add_argument(
    '--repeat', type=int, default=1, help="How many times to run the test.")
parser.add_argument(
    '--data_set',
    type=str,
    default='cifar10',
    choices=['cifar10', 'imagenet'],
    help="Optional dataset for benchmark.")
parser.add_argument(
    '--model',
    type=str,
    default='vgg',
    choices=['vgg', 'resnet'],
    help="Optional model for benchmark.")
parser.add_argument(
    '--threshold',
    type=float,
    default=0.005,
    help='Save inference model when test accuracy reach this threshold.')
parser.add_argument('--learning_rate', type=float, default=0.001)
args = parser.parse_args()

def conv_bn_layer(input, ch_out, filter_size, stride, padding, act='relu'):
    conv1 = fluid.layers.conv2d(
        input=input,
        filter_size=filter_size,
        num_filters=ch_out,
        stride=stride,
        padding=padding,
        act=None,
        bias_attr=False)
    return fluid.layers.batch_norm(input=conv1, act=act)

def shortcut(input, ch_out, stride):
    ch_in = input.shape[1]
    if ch_in != ch_out:
        return conv_bn_layer(input, ch_out, 1, stride, 0, None)
    else:
        return input

def basicblock(input, ch_out, stride):
    short = shortcut(input, ch_out, stride)
    conv1 = conv_bn_layer(input, ch_out, 3, stride, 1)
    conv2 = conv_bn_layer(conv1, ch_out, 3, 1, 1, act=None)
    return fluid.layers.elementwise_add(x=short, y=conv2, act='relu')

def bottleneck(input, ch_out, stride):
    short = shortcut(input, ch_out * 4, stride)
    conv1 = conv_bn_layer(input, ch_out, 1, stride, 0)
    conv2 = conv_bn_layer(conv1, ch_out, 3, 1, 1)
    conv3 = conv_bn_layer(conv2, ch_out * 4, 1, 1, 0, act=None)
    return fluid.layers.elementwise_add(x=short, y=conv3, act='relu')

def layer_warp(block_func, input, ch_out, count, stride):
    res_out = block_func(input, ch_out, stride)
    for i in range(1, count):
        res_out = block_func(res_out, ch_out, 1)
    return res_out

def resnet_imagenet(input, depth=50):
    cfg = {
        18: ([2, 2, 2, 1], basicblock),
        34: ([3, 4, 6, 3], basicblock),
        50: ([3, 4, 6, 3], bottleneck),
        101: ([3, 4, 23, 3], bottleneck),
        152: ([3, 8, 36, 3], bottleneck)
    }
    stages, block_func = cfg[depth]
    conv1 = conv_bn_layer(input, ch_out=64, filter_size=7, stride=2, padding=3)
    pool1 = fluid.layers.pool2d(
        input=conv1, pool_type='avg', pool_size=3, pool_stride=2)
    res1 = layer_warp(block_func, pool1, 64, stages[0], 1)
    res2 = layer_warp(block_func, res1, 128, stages[1], 2)
    res3 = layer_warp(block_func, res2, 256, stages[2], 2)
    res4 = layer_warp(block_func, res3, 512, stages[3], 2)
    pool2 = fluid.layers.pool2d(
        input=res4,
        pool_size=7,
        pool_type='avg',
        pool_stride=1,
        global_pooling=True)
    return pool2

def resnet_cifar10(input, depth=32):
    assert (depth - 2) % 6 == 0

    n = (depth - 2) // 6

    conv1 = conv_bn_layer(
        input=input, ch_out=16, filter_size=3, stride=1, padding=1)
    res1 = layer_warp(basicblock, conv1, 16, n, 1)
    res2 = layer_warp(basicblock, res1, 32, n, 2)
    res3 = layer_warp(basicblock, res2, 64, n, 2)
    pool = fluid.layers.pool2d(
        input=res3, pool_size=8, pool_type='avg', pool_stride=1)
    return pool

def vgg16(input):
    def conv_block(input, num_filter, groups, dropouts):
        return fluid.nets.img_conv_group(
            input=input,
            pool_size=2,
            pool_stride=2,
            conv_num_filter=[num_filter] * groups,
            conv_filter_size=3,
            conv_act='relu',
            conv_with_batchnorm=True,
            conv_batchnorm_drop_rate=dropouts,
            pool_type='max')

    conv1 = conv_block(input, 64, 2, [0.3, 0])
    conv2 = conv_block(conv1, 128, 2, [0.4, 0])
    conv3 = conv_block(conv2, 256, 3, [0.4, 0.4, 0])
    conv4 = conv_block(conv3, 512, 3, [0.4, 0.4, 0])
    conv5 = conv_block(conv4, 512, 3, [0.4, 0.4, 0])

    drop = fluid.layers.dropout(x=conv5, dropout_prob=0.5)
    fc1 = fluid.layers.fc(input=drop, size=4096, act=None)
    bn = fluid.layers.batch_norm(input=fc1, act='relu')
    drop2 = fluid.layers.dropout(x=bn, dropout_prob=0.5)
    fc2 = fluid.layers.fc(input=drop2, size=4096, act=None)
    return fc2

def train(place, save_dirname):
    if args.data_set == "cifar10":
        class_dim = 10
        data_shape = [3, 32, 32]
    elif args.data_set == "imagenet":
        class_dim = 102
        data_shape = [3, 224, 224]
    else:
        raise ValueError("%s dataset is not supported" % data_set)

    images = fluid.layers.data(name='pixel', shape=data_shape, dtype='float32')
    label = fluid.layers.data(name='label', shape=[1], dtype='int64')

    if args.model == "vgg":
        print("train vgg")
        net = vgg16(images)
    elif args.model == "resnet":
        print("train resnet")
        if args.data_set == "cifar10":
            net = resnet_cifar10(images)
        elif args.data_set == "imagenet":
            net = resnet_imagenet(images)
        else:
            raise ValueError("%s dataset is not supported" % args.data_set)
    else:
        raise ValueError("%s network is not supported" % args.model)

    predict = fluid.layers.fc(input=net, size=class_dim, act='softmax')
    cost = fluid.layers.cross_entropy(input=predict, label=label)
    avg_cost = fluid.layers.mean(x=cost)
    acc = fluid.layers.accuracy(input=predict, label=label)

    #Test program
    test_program = fluid.default_main_program().clone(for_test=True)
    optimizer = fluid.optimizer.Adam(learning_rate=args.learning_rate)
    optimizer.minimize(avg_cost)

    BATCH_SIZE = args.train_batch_size
    PASS_NUM = 100

    train_reader = paddle.batch(
        paddle.reader.shuffle(
            paddle.dataset.flowers.train()
            if args.data_set == 'imagenet' else paddle.dataset.cifar.train10(),
            buf_size=128 * 10),
        batch_size=args.train_batch_size)

    test_reader = paddle.batch(
        paddle.dataset.flowers.test()
        if args.data_set == 'imagenet' else paddle.dataset.cifar.test10(),
        batch_size=args.inf_batch_size)

    exe = fluid.Executor(place)
    feeder = fluid.DataFeeder(place=place, feed_list=[images, label])

    exe.run(fluid.default_startup_program())
    main_program = fluid.default_main_program()

    for pass_id in range(PASS_NUM):
        for batch_id, data in enumerate(train_reader()):
            train_image = np.array(
                map(lambda x: x[0].reshape(data_shape), data)).astype("float32")
            train_label = np.array(map(lambda x: x[1], data)).astype("int64")
            train_label = train_label.reshape([-1, 1])

            exe.run(main_program,
                    feed={'pixel': train_image,
                          'label': train_label})

            if (batch_id % 100) == 0:
                acc_list = []
                avg_loss_list = []
                for tid, test_data in enumerate(test_reader()):
                    test_image = np.array(
                        map(lambda x: x[0].reshape(data_shape),
                            test_data)).astype("float32")
                    test_label = np.array(map(lambda x: x[1],
                                              test_data)).astype("int64")
                    test_label = test_label.reshape([-1, 1])

                    loss_t, acc_t = exe.run(
                        program=test_program,
                        feed={"pixel": test_image,
                              "label": test_label},
                        fetch_list=[avg_cost, acc])
                    if math.isnan(float(loss_t)):
                        sys.exit("got NaN loss, training failed.")
                    acc_list.append(float(acc_t))
                    avg_loss_list.append(float(loss_t))

                acc_value = np.array(acc_list).mean()
                avg_loss_value = np.array(avg_loss_list).mean()

                print(
                    'PassID {0:1}, BatchID {1:04}, Test Loss {2:2.2}, Accuracy {3:2.2}'.
                    format(pass_id, batch_id + 1,
                           float(avg_loss_value), float(acc_value)))

                if acc_value > args.threshold:
                    print(
                        'Save inference model with test accuracy of {0} at {1}'.
                        format(float(acc_value), save_dirname))
                    fluid.io.save_inference_model(save_dirname, ["pixel"],
                                                  [predict], exe)
                    return

def test_accuracy(executor, inference_program, feed_target_names,
                  fetch_targets):
    if args.data_set == "cifar10":
        data_shape = [3, 32, 32]
    elif args.data_set == "imagenet":
        data_shape = [3, 224, 224]
    else:
        raise ValueError("%s dataset is not supported" % data_set)

    test_reader = paddle.batch(
        paddle.dataset.cifar.test10()
        if args.data_set == "cifar10" else paddle.dataset.flowers.test(),
        batch_size=args.inf_batch_size)

    test_num = 0
    correct_num = 0

    for test_data in test_reader():
        test_image = np.array(
            map(lambda x: x[0].reshape(data_shape), test_data)).astype(
                "float32")
        test_label = np.array(map(lambda x: x[1], test_data)).astype("int64")
        test_label = test_label.reshape([-1, 1])

        results = executor.run(program=inference_program,
                               feed={feed_target_names[0]: test_image},
                               fetch_list=fetch_targets)

        prediction = np.argmax(results[0], axis=1).reshape([-1, 1])
        correct_num += np.sum(prediction == test_label)
        test_num += test_label.size

    print("{0} out of {1} predictions are correct.".format(correct_num,
                                                           test_num))
    print("Test accuray is {0}.".format(float(correct_num) / float(test_num)))

def infer(place, save_dirname):
    exe = fluid.Executor(place)
    inference_scope = fluid.core.Scope()

    with fluid.scope_guard(inference_scope):
        # Use fluid.io.load_inference_model to obtain the inference program desc,
        # the feed_target_names (the names of variables that will be feeded
        # data using feed operators), and the fetch_targets (variables that
        # we want to obtain data from using fetch operators).
        print("Load inference model from {0}".format(save_dirname))
        [inference_program, feed_target_names,
         fetch_targets] = fluid.io.load_inference_model(save_dirname, exe)

        print("The test set accuracy of inference in float mode is:")
        test_accuracy(exe, inference_program, feed_target_names, fetch_targets)

        float16_inference_program = inference_program.clone()
        t = Float16Transpiler()
        t.transpile(float16_inference_program, place)

        print("The test set accuracy of inference in float16 mode is:")
        test_accuracy(exe, float16_inference_program, feed_target_names,
                      fetch_targets)

        fp16_save_dirname = "float16_" + save_dirname
        fluid.io.save_inference_model(fp16_save_dirname, feed_target_names,
                                      fetch_targets, exe,
                                      float16_inference_program)

@contextlib.contextmanager
def scope_prog_guard():
    prog = fluid.Program()
    startup_prog = fluid.Program()
    scope = fluid.core.Scope()
    with fluid.scope_guard(scope):
        with fluid.program_guard(prog, startup_prog):
            yield

if __name__ == "__main__":
    if not fluid.core.is_compiled_with_cuda():
        raise Exception("This test requires CUDA GPUs!")

    place = fluid.CUDAPlace(0)
    if not fluid.core.is_float16_supported(place):
        raise Exception(
            "This test requires compute capability of CUDA GPU >= 5.3!")

    for i in range(args.repeat):
        with scope_prog_guard():
            save_dirname = "image_classification_" + args.data_set + "_" + args.model + ".inference.model"
            train(place, save_dirname)
            infer(place, save_dirname)


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<!-- Copyright © 1991-2014 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
For terms of use, see http://www.unicode.org/copyright.html
-->
<ldml>
	<identity>
		<version number="$Revision: 13159 $"/>
		<language type="gej"/>
	</identity>
	<characters>
		<exemplarCharacters draft="unconfirmed">[a b c d ɖ e ɛ f g {gb} ɣ h i j k {kp} l m n {ny} ŋ o ɔ p s t u v w x y z]</exemplarCharacters>
		<exemplarCharacters type="auxiliary" draft="unconfirmed">[q r]</exemplarCharacters>
		<exemplarCharacters type="index" draft="unconfirmed">[A B C D Ɖ E Ɛ F G {Gb} Ɣ H I J K {Kp} L M N {Ny} Ŋ O Ɔ P S T U V W X Y Z]</exemplarCharacters>
	</characters>
</ldml>

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Pinq\Expressions;

use Pinq\PinqException;

/**
 * Implementation of the evaluation context.
 *
 * @author Elliot Levin <elliotlevin@hotmail.com>
 */
class EvaluationContext implements IEvaluationContext
{
    /**
     * @var string|null
     */
    protected $scopeType;

    /**
     * @var string|null
     */
    protected $namespace;

    /**
     * @var object|null
     */
    protected $thisObject;

    /**
     * @var array<string, mixed>
     */
    protected $variableTable;

    public function __construct($namespace, $scopeType, $thisObject = null, array $variableTable = [])
    {
        $this->namespace     = $namespace;
        $this->scopeType     = $scopeType;
        $this->thisObject    = $thisObject;
        $this->variableTable = $variableTable;
        if (array_key_exists('this', $this->variableTable)) {
            throw new PinqException(
                    'Cannot create %s: invalid variable table, \'this\' variable is disallowed (use $thisObject constructor argument instead).',
                    get_class($this));
        }
    }

    /**
     * @param object|null $thisObject
     * @param array       $variableTable
     *
     * @return IEvaluationContext
     */
    public static function globalScope($thisObject = null, $variableTable = [])
    {
        return new self(null, null, $thisObject, $variableTable);
    }

    /**
     * @param string|null $namespace
     * @param string|null $scopeType
     *
     * @return IEvaluationContext
     */
    public static function staticContext($namespace, $scopeType)
    {
        return new self($namespace, $scopeType);
    }

    public function hasNamespace()
    {
        return $this->namespace !== null;
    }

    public function getNamespace()
    {
        return $this->namespace;
    }

    public function hasScopeType()
    {
        return $this->scopeType !== null;
    }

    public function getScopeType()
    {
        return $this->scopeType;
    }

    public function getVariableTable()
    {
        return $this->variableTable;
    }

    public function hasThis()
    {
        return $this->thisObject !== null;
    }

    public function getThis()
    {
        return $this->thisObject;
    }

    public function withVariableTable(array $variableTable)
    {
        if ($this->variableTable === $variableTable) {
            return $this;
        }

        return new self($this->namespace, $this->scopeType, $this->thisObject, $variableTable);
    }
}


text:
module Esortcode
  class Client
    include HTTParty

    base_uri 'https://ws.esortcode.com/bankdetails.asmx'
    default_params :sIPAddress => ''
    format :xml

    # Creates an instance of the client.
    #
    # +account_name+::
    #   The name of your account with esortcode.com. This
    #   is sent to you via email and is listed as
    #   AccountName and is uppercase.
    # +license_id+::
    #   The license ID of your account. This is a string
    #   of letters and numbers intersperced with hyphens.
    def initialize(account_name, license_id)
      self.class.default_params :sUserName => account_name,
                                :sGUID => license_id
    end

    # This function is used to Validate a UK Bank Sortcode and Account Number.
    #
    # :call-seq: validate_account(sort_code, account_number) -> (true|false)
    #
    # *Raises*
    # * InvalidSortcode if +sort_code+ is not valid
    # * InvalidAccountNumber if +account_number+ is not valid
    # * ResponseError with the error message if there was an eSortCode.com error
    #
    #--
    # Currently no way to access the reason why the details are invalid.
    #++
    def validate_account(sort_code, account_number)
      validate_sort_code(sort_code)
      validate_account_number(account_number)

      @resp = get_response('/ValidateAccount',
              { :sSortcode => sort_code,
                :sAccountNumber => account_number})
      @resp.valid?
    rescue ResponseError => ex
      if ex.message =~ /sortcode cannot found/
        raise InvalidSortcode.new(ex.message, sort_code)
      else
        raise
      end
    end

    # This function is used to return the Branch Details for a Sort Code.
    #
    # *Raises*
    # * InvalidSortcode if +sort_code+ is not valid
    def branch_details(sort_code)
      validate_sort_code(sort_code)

      @resp = get_response('/BranchDetails', {:sSortcode => sort_code})
    end

    # This function is used to transpose Non-standard
    # (i.e. 6, 7, 9 & 10 digit) Account Numbers into
    # Standard (i.e. 8 digit) Account Numbers.
    #
    # *Raises*
    # * InvalidSortcode if +sort_code+ is not valid
    # * InvalidAccountNumber if +account_number+ is not valid
    #
    #--
    # Uses the +validate_account_number_flex method which checks
    # to see if the account number is between 6 and 10 digits long.
    #++
    def standardise_account(sort_code, account_number)
      validate_sort_code(sort_code)
      validate_account_number_flex(account_number)

      @resp = get_response('/StandardiseAccount',
        { :sSortcode => sort_code,
          :sAccountNumber => account_number})
    end

    # This function incorporates the StandardiseAccount, ValidateAccount
    # and BranchDetails web services into one web service.
    #
    # *Raises*
    # * InvalidSortcode if +sort_code+ is not valid
    # * InvalidAccountNumber if +account_number+ is not valid
    #
    #--
    # Uses the +validate_account_number_flex method which checks
    # to see if the account number is between 6 and 10 digits long.
    #++
    def validate_account_get_branch_details(sort_code, account_number)
      validate_sort_code(sort_code)
      validate_account_number_flex(account_number)

      @resp = get_response('/ValidateAccountGetBranchDetails',
        { :sSortcode => sort_code,
          :sAccountNumber => account_number})
    end

    # This function is used to Validate a Credit Card Number.
    #
    # :call-seq: validate_credit_card(credit_card_number) -> (String|false)
    #
    # The string returned is the card type which matches this number, it
    # might also be UNKNOWN in which case the modulus check has passed,
    # but the card type cannot be determined.
    #
    # *Raises*
    # * InvalidCreditCardNumber if +credit_card_number+ is not valid.
    # * ResponseError with the error message if there was an error.
    def validate_credit_card(credit_card_number)
      validate_credit_card(credit_card_number)

      @resp = get_response('/ValidateCreditCard',
                {:sCreditCardNumber => credit_card_number})

      if @resp.valid?
        return @resp.reason  # In this case it is the CardType in caps
      else
        return false
      end
    end

    private
      def get_response(path, options = {})
        resp = Response.new(self.class.get(path, {:query => options}))
        raise ResponseError.new(resp.error_message, resp) if resp.error?
        resp
      end
      def validate_sort_code(sc)
        unless sc.match(/^[0-9]{6}$/)
          raise InvalidSortcode.new("#{sc} is not valid", sc)
        end
      end
      def validate_account_number(an)
        unless an.match(/^[0-9]{8}$/)
          raise InvalidAccountNumber.new("#{an} is not valid", an)
        end
      end
      def validate_account_number_flex(an)
        unless an.match(/^[0-9]{6,10}$/)
          raise InvalidAccountNumber.new("#{an} is not valid", an)
        end
      end
      def validate_credit_card(cc)
        unless cc.match(/[0-9]+/)
          raise InvalidCreditCardNumber.new("#{cc} is not valid", cc)
        end
      end
  end
end


text:
<?php

namespace Sustain\AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Category
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Sustain\AppBundle\Entity\CategoryRepository")
 */
class Category
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * @ORM\OneToMany(targetEntity="Tag", mappedBy="category")
     */
    protected $tags;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Category
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add tags
     *
     * @param \Sustain\AppBundle\Entity\Tag $tags
     * @return Category
     */
    public function addTag(\Sustain\AppBundle\Entity\Tag $tags)
    {
        $this->tags[] = $tags;

        return $this;
    }

    /**
     * Remove tags
     *
     * @param \Sustain\AppBundle\Entity\Tag $tags
     */
    public function removeTag(\Sustain\AppBundle\Entity\Tag $tags)
    {
        $this->tags->removeElement($tags);
    }

    /**
     * Get tags
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTags()
    {
        return $this->tags;
    }
}


text:
use exonum::crypto::Hash;
use exonum::runtime::{
    migrations::{
        InitMigrationError, LinearMigrations, MigrateData, MigrationContext, MigrationError,
        MigrationScript,
    },
    versioning::Version,
    CallerAddress,
};
use exonum_rust_runtime::ServiceFactory;

use crate::{wallet::Wallet, CryptocurrencyService, SchemaImpl};
use old_cryptocurrency::schema::{CurrencySchema as OldSchema, Wallet as OldWallet};

#[cfg(test)]
mod tests;

fn convert_wallet(old_wallet: OldWallet) -> Wallet {
    Wallet {
        owner: CallerAddress::from_key(old_wallet.pub_key),
        name: old_wallet.name,
        balance: old_wallet.balance,
        history_len: 0,
        history_hash: Hash::zero(),
    }
}

/// Migration script which takes wallets from the old storage, transforms them an save to
/// (a now Merkelized) `wallets` index.
pub fn migrate_wallets(context: &mut MigrationContext) -> Result<(), MigrationError> {
    /// Number of wallets to process between persisting intermediate migration results.
    const CHUNK_SIZE: usize = 100;

    context.helper.iter_loop(|helper, iters| {
        let old_schema = OldSchema::new(helper.old_data());
        let mut new_schema = SchemaImpl::new(helper.new_data());

        let wallets = iters.create("wallets", &old_schema.wallets);
        for (_, old_wallet) in wallets.take(CHUNK_SIZE) {
            let new_wallet = convert_wallet(old_wallet);
            let addr = new_wallet.owner;
            new_schema.public.wallets.put(&addr, new_wallet);
        }
    })?;
    Ok(())
}

impl MigrateData for CryptocurrencyService {
    fn migration_scripts(
        &self,
        start_version: &Version,
    ) -> Result<Vec<MigrationScript>, InitMigrationError> {
        // Declare an exhaustive list of scripts that transform the service data
        // to the corresponding version. Here, we have just one script.
        let latest_version = self.artifact_id().version;
        LinearMigrations::new(latest_version)
            .add_script(Version::new(0, 2, 0), migrate_wallets)
            .select(start_version)
    }
}


text:
#import <UIKit/UIKit.h>
#import "WhirlyVector.h"
#import "GlobeView.h"

/// This is the notification you get for a tap on the globe
#define WhirlyGlobeTapMsg @"WhirlyGlobeTap"
/// This is the notification you get for a tap outside the globe
#define WhirlyGlobeTapOutsideMsg @"WhirlyGlobeTapOutside"
/// This is the notification you get from a long press on the globe
#define WhirlyGlobeLongPressMsg @"WhirlyGlobeLongPress"

/** Tap Message is an
	indication that the user tapped on the globe.
	It's passed as the object in a notification.
    Note: Split this up a bit for globe vs. map
 */
@interface WhirlyGlobeTapMessage : NSObject

/// View that was touched
@property (nonatomic,retain) UIView *view;
//// Touch location on view in 2D
@property (nonatomic,assign) CGPoint touchLoc;
/// Lon/Lat
@property (nonatomic,assign) WhirlyKit::GeoCoord whereGeo;
/// 3D coordinates in the view
@property (nonatomic,assign) WhirlyKit::Point3f worldLoc;
/// Where the eye was.  0 is sea level.
@property (nonatomic,assign) float heightAboveSurface;

/// This version of set takes a set of doubles
- (void)setWorldLocD:(WhirlyKit::Point3d)newLoc;

@end


text:
/*
 * Modernizr tests which native CSS3 and HTML5 features are available in
 * the current UA and makes the results available to you in two ways:
 * as properties on a global Modernizr object, and as classes on the
 * <html> element. This information allows you to progressively enhance
 * your pages with a granular level of control over the experience.
 *
 * Modernizr has an optional (not included) conditional resource loader
 * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
 * To get a build that includes Modernizr.load(), as well as choosing
 * which tests to include, go to www.modernizr.com/download/
 *
 * Authors        Faruk Ates, Paul Irish, Alex Sexton
 * Contributors   Ryan Seddon, Ben Alman
 */

window.Modernizr = (function( window, document, undefined ) {

    var version = '2.6.2',

    Modernizr = {},

    /*>>cssclasses*/
    // option for enabling the HTML classes to be added
    enableClasses = true,
    /*>>cssclasses*/

    docElement = document.documentElement,

    /**
     * Create our "modernizr" element that we do most feature tests on.
     */
    mod = 'modernizr',
    modElem = document.createElement(mod),
    mStyle = modElem.style,

    /**
     * Create the input element for various Web Forms feature tests.
     */
    inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,

    /*>>smile*/
    smile = ':)',
    /*>>smile*/

    toString = {}.toString,

    // TODO :: make the prefixes more granular
    /*>>prefixes*/
    // List of property values to set for css tests. See ticket #21
    prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
    /*>>prefixes*/

    /*>>domprefixes*/
    // Following spec is to expose vendor-specific style properties as:
    //   elem.style.WebkitBorderRadius
    // and the following would be incorrect:
    //   elem.style.webkitBorderRadius

    // Webkit ghosts their properties in lowercase but Opera & Moz do not.
    // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
    //   erik.eae.net/archives/2008/03/10/21.48.10/

    // More here: github.com/Modernizr/Modernizr/issues/issue/21
    omPrefixes = 'Webkit Moz O ms',

    cssomPrefixes = omPrefixes.split(' '),

    domPrefixes = omPrefixes.toLowerCase().split(' '),
    /*>>domprefixes*/

    /*>>ns*/
    ns = {'svg': 'http://www.w3.org/2000/svg'},
    /*>>ns*/

    tests = {},
    inputs = {},
    attrs = {},

    classes = [],

    slice = classes.slice,

    featureName, // used in testing loop

    /*>>teststyles*/
    // Inject element with style element and some CSS rules
    injectElementWithStyles = function( rule, callback, nodes, testnames ) {

      var style, ret, node, docOverflow,
          div = document.createElement('div'),
          // After page load injecting a fake body doesn't work so check if body exists
          body = document.body,
          // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.
          fakeBody = body || document.createElement('body');

      if ( parseInt(nodes, 10) ) {
          // In order not to give false positives we create a node for each test
          // This also allows the method to scale for unspecified uses
          while ( nodes-- ) {
              node = document.createElement('div');
              node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
              div.appendChild(node);
          }
      }

      // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
      // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
      // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
      // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
      // Documents served as xml will throw if using  so use xml friendly encoded version. See issue #277
      style = ['','<style id="s', mod, '">', rule, '</style>'].join('');
      div.id = mod;
      // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
      // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
      (body ? div : fakeBody).innerHTML += style;
      fakeBody.appendChild(div);
      if ( !body ) {
          //avoid crashing IE8, if background image is used
          fakeBody.style.background = '';
          //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
          fakeBody.style.overflow = 'hidden';
          docOverflow = docElement.style.overflow;
          docElement.style.overflow = 'hidden';
          docElement.appendChild(fakeBody);
      }

      ret = callback(div, rule);
      // If this is done after page load we don't want to remove the body so check if body exists
      if ( !body ) {
          fakeBody.parentNode.removeChild(fakeBody);
          docElement.style.overflow = docOverflow;
      } else {
          div.parentNode.removeChild(div);
      }

      return !!ret;

    },
    /*>>teststyles*/

    /*>>mq*/
    // adapted from matchMedia polyfill
    // by Scott Jehl and Paul Irish
    // gist.github.com/786768
    testMediaQuery = function( mq ) {

      var matchMedia = window.matchMedia || window.msMatchMedia;
      if ( matchMedia ) {
        return matchMedia(mq).matches;
      }

      var bool;

      injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
        bool = (window.getComputedStyle ?
                  getComputedStyle(node, null) :
                  node.currentStyle)['position'] == 'absolute';
      });

      return bool;

     },
     /*>>mq*/

    /*>>hasevent*/
    //
    // isEventSupported determines if a given element supports the given event
    // kangax.github.com/iseventsupported/
    //
    // The following results are known incorrects:
    //   Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative
    //   Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333
    //   ...
    isEventSupported = (function() {

      var TAGNAMES = {
        'select': 'input', 'change': 'input',
        'submit': 'form', 'reset': 'form',
        'error': 'img', 'load': 'img', 'abort': 'img'
      };

      function isEventSupported( eventName, element ) {

        element = element || document.createElement(TAGNAMES[eventName] || 'div');
        eventName = 'on' + eventName;

        // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
        var isSupported = eventName in element;

        if ( !isSupported ) {
          // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
          if ( !element.setAttribute ) {
            element = document.createElement('div');
          }
          if ( element.setAttribute && element.removeAttribute ) {
            element.setAttribute(eventName, '');
            isSupported = is(element[eventName], 'function');

            // If property was created, "remove it" (by setting value to `undefined`)
            if ( !is(element[eventName], 'undefined') ) {
              element[eventName] = undefined;
            }
            element.removeAttribute(eventName);
          }
        }

        element = null;
        return isSupported;
      }
      return isEventSupported;
    })(),
    /*>>hasevent*/

    // TODO :: Add flag for hasownprop ? didn't last time

    // hasOwnProperty shim by kangax needed for Safari 2.0 support
    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;

    if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
      hasOwnProp = function (object, property) {
        return _hasOwnProperty.call(object, property);
      };
    }
    else {
      hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
        return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
      };
    }

    // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
    // es5.github.com/#x15.3.4.5

    if (!Function.prototype.bind) {
      Function.prototype.bind = function bind(that) {

        var target = this;

        if (typeof target != "function") {
            throw new TypeError();
        }

        var args = slice.call(arguments, 1),
            bound = function () {

            if (this instanceof bound) {

              var F = function(){};
              F.prototype = target.prototype;
              var self = new F();

              var result = target.apply(
                  self,
                  args.concat(slice.call(arguments))
              );
              if (Object(result) === result) {
                  return result;
              }
              return self;

            } else {

              return target.apply(
                  that,
                  args.concat(slice.call(arguments))
              );

            }

        };

        return bound;
      };
    }

    /**
     * setCss applies given styles to the Modernizr DOM node.
     */
    function setCss( str ) {
        mStyle.cssText = str;
    }

    /**
     * setCssAll extrapolates all vendor-specific css strings.
     */
    function setCssAll( str1, str2 ) {
        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
    }

    /**
     * is returns a boolean for if typeof obj is exactly type.
     */
    function is( obj, type ) {
        return typeof obj === type;
    }

    /**
     * contains returns a boolean for if substr is found within str.
     */
    function contains( str, substr ) {
        return !!~('' + str).indexOf(substr);
    }

    /*>>testprop*/

    // testProps is a generic CSS / DOM property test.

    // In testing support for a given CSS property, it's legit to test:
    //    `elem.style[styleName] !== undefined`
    // If the property is supported it will return an empty string,
    // if unsupported it will return undefined.

    // We'll take advantage of this quick test and skip setting a style
    // on our modernizr element, but instead just testing undefined vs
    // empty string.

    // Because the testing of the CSS property names (with "-", as
    // opposed to the camelCase DOM properties) is non-portable and
    // non-standard but works in WebKit and IE (but not Gecko or Opera),
    // we explicitly reject properties with dashes so that authors
    // developing in WebKit or IE first don't end up with
    // browser-specific content by accident.

    function testProps( props, prefixed ) {
        for ( var i in props ) {
            var prop = props[i];
            if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
                return prefixed == 'pfx' ? prop : true;
            }
        }
        return false;
    }
    /*>>testprop*/

    // TODO :: add testDOMProps
    /**
     * testDOMProps is a generic DOM property test; if a browser supports
     *   a certain property, it won't return undefined for it.
     */
    function testDOMProps( props, obj, elem ) {
        for ( var i in props ) {
            var item = obj[props[i]];
            if ( item !== undefined) {

                // return the property name as a string
                if (elem === false) return props[i];

                // let's bind a function
                if (is(item, 'function')){
                  // default to autobind unless override
                  return item.bind(elem || obj);
                }

                // return the unbound function or obj or value
                return item;
            }
        }
        return false;
    }

    /*>>testallprops*/
    /**
     * testPropsAll tests a list of DOM properties we want to check against.
     *   We specify literally ALL possible (known and/or likely) properties on
     *   the element including the non-vendor prefixed one, for forward-
     *   compatibility.
     */
    function testPropsAll( prop, prefixed, elem ) {

        var ucProp  = prop.charAt(0).toUpperCase() + prop.slice(1),
            props   = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');

        // did they call .prefixed('boxSizing') or are we just testing a prop?
        if(is(prefixed, "string") || is(prefixed, "undefined")) {
          return testProps(props, prefixed);

        // otherwise, they called .prefixed('requestAnimationFrame', window[, elem])
        } else {
          props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
          return testDOMProps(props, prefixed, elem);
        }
    }
    /*>>testallprops*/

    /**
     * Tests
     * -----
     */

    // The *new* flexbox
    // dev.w3.org/csswg/css3-flexbox

    tests['flexbox'] = function() {
      return testPropsAll('flexWrap');
    };

    // The *old* flexbox
    // www.w3.org/TR/2009/WD-css3-flexbox-20090723/

    tests['flexboxlegacy'] = function() {
        return testPropsAll('boxDirection');
    };

    // On the S60 and BB Storm, getContext exists, but always returns undefined
    // so we actually have to call getContext() to verify
    // github.com/Modernizr/Modernizr/issues/issue/97/

    tests['canvas'] = function() {
        var elem = document.createElement('canvas');
        return !!(elem.getContext && elem.getContext('2d'));
    };

    tests['canvastext'] = function() {
        return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
    };

    // webk.it/70117 is tracking a legit WebGL feature detect proposal

    // We do a soft detect which may false positive in order to avoid
    // an expensive context creation: bugzil.la/732441

    tests['webgl'] = function() {
        return !!window.WebGLRenderingContext;
    };

    /*
     * The Modernizr.touch test only indicates if the browser supports
     *    touch events, which does not necessarily reflect a touchscreen
     *    device, as evidenced by tablets running Windows 7 or, alas,
     *    the Palm Pre / WebOS (touch) phones.
     *
     * Additionally, Chrome (desktop) used to lie about its support on this,
     *    but that has since been rectified: crbug.com/36415
     *
     * We also test for Firefox 4 Multitouch Support.
     *
     * For more info, see: modernizr.github.com/Modernizr/touch.html
     */

    tests['touch'] = function() {
        var bool;

        if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
          bool = true;
        } else {
          injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
            bool = node.offsetTop === 9;
          });
        }

        return bool;
    };

    tests['draganddrop'] = function() {
        var div = document.createElement('div');
        return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
    };

    // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10
    // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.
    // FF10 still uses prefixes, so check for it until then.
    // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/
    tests['websockets'] = function() {
        return 'WebSocket' in window || 'MozWebSocket' in window;
    };

    // css-tricks.com/rgba-browser-support/
    tests['rgba'] = function() {
        // Set an rgba() color and check the returned value

        setCss('background-color:rgba(150,255,150,.5)');

        return contains(mStyle.backgroundColor, 'rgba');
    };

    tests['hsla'] = function() {
        // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
        //   except IE9 who retains it as hsla

        setCss('background-color:hsla(120,40%,100%,.5)');

        return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
    };

    tests['multiplebgs'] = function() {
        // Setting multiple images AND a color on the background shorthand property
        //  and then querying the style.background property value for the number of
        //  occurrences of "url(" is a reliable method for detecting ACTUAL support for this!

        setCss('background:url(https://),url(https://),red url(https://)');

        // If the UA supports multiple backgrounds, there should be three occurrences
        //   of the string "url(" in the return value for elemStyle.background

        return (/(url\s*\(.*?){3}/).test(mStyle.background);
    };

    // this will false positive in Opera Mini
    //   github.com/Modernizr/Modernizr/issues/396

    tests['backgroundsize'] = function() {
        return testPropsAll('backgroundSize');
    };

    tests['borderimage'] = function() {
        return testPropsAll('borderImage');
    };

    // Super comprehensive table about all the unique implementations of
    // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance

    tests['borderradius'] = function() {
        return testPropsAll('borderRadius');
    };

    // WebOS unfortunately false positives on this test.
    tests['boxshadow'] = function() {
        return testPropsAll('boxShadow');
    };

    // FF3.0 will false positive on this test
    tests['textshadow'] = function() {
        return document.createElement('div').style.textShadow === '';
    };

    tests['opacity'] = function() {
        // Browsers that actually have CSS Opacity implemented have done so
        //  according to spec, which means their return values are within the
        //  range of [0.0,1.0] - including the leading zero.

        setCssAll('opacity:.55');

        // The non-literal . in this regex is intentional:
        //   German Chrome returns this value as 0,55
        // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
        return (/^0.55$/).test(mStyle.opacity);
    };

    // Note, Android < 4 will pass this test, but can only animate
    //   a single property at a time
    //   daneden.me/2011/12/putting-up-with-androids-bullshit/
    tests['cssanimations'] = function() {
        return testPropsAll('animationName');
    };

    tests['csscolumns'] = function() {
        return testPropsAll('columnCount');
    };

    tests['cssgradients'] = function() {
        /**
         * For CSS Gradients syntax, please see:
         * webkit.org/blog/175/introducing-css-gradients/
         * developer.mozilla.org/en/CSS/-moz-linear-gradient
         * developer.mozilla.org/en/CSS/-moz-radial-gradient
         * dev.w3.org/csswg/css3-images/#gradients-
         */

        var str1 = 'background-image:',
            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
            str3 = 'linear-gradient(left top,#9f9, white);';

        setCss(
             // legacy webkit syntax (FIXME: remove when syntax not in use anymore)
              (str1 + '-webkit- '.split(' ').join(str2 + str1) +
             // standard syntax             // trailing 'background-image:'
              prefixes.join(str3 + str1)).slice(0, -str1.length)
        );

        return contains(mStyle.backgroundImage, 'gradient');
    };

    tests['cssreflections'] = function() {
        return testPropsAll('boxReflect');
    };

    tests['csstransforms'] = function() {
        return !!testPropsAll('transform');
    };

    tests['csstransforms3d'] = function() {

        var ret = !!testPropsAll('perspective');

        // Webkit's 3D transforms are passed off to the browser's own graphics renderer.
        //   It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
        //   some conditions. As a result, Webkit typically recognizes the syntax but
        //   will sometimes throw a false positive, thus we must do a more thorough check:
        if ( ret && 'webkitPerspective' in docElement.style ) {

          // Webkit allows this media query to succeed only if the feature is enabled.
          // `@media (transform-3d),(-webkit-transform-3d){ ... }`
          injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
            ret = node.offsetLeft === 9 && node.offsetHeight === 3;
          });
        }
        return ret;
    };

    tests['csstransitions'] = function() {
        return testPropsAll('transition');
    };

    /*>>fontface*/
    // @font-face detection routine by Diego Perini
    // javascript.nwbox.com/CSSSupport/

    // false positives:
    //   WebOS github.com/Modernizr/Modernizr/issues/342
    //   WP7   github.com/Modernizr/Modernizr/issues/538
    tests['fontface'] = function() {
        var bool;

        injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
          var style = document.getElementById('smodernizr'),
              sheet = style.sheet || style.styleSheet,
              cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';

          bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
        });

        return bool;
    };
    /*>>fontface*/

    // CSS generated content detection
    tests['generatedcontent'] = function() {
        var bool;

        injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
          bool = node.offsetHeight >= 3;
        });

        return bool;
    };

    // End of test definitions
    // -----------------------

    // Run through all tests and detect their support in the current UA.
    // todo: hypothetically we could be doing an array of tests and use a basic loop here.
    for ( var feature in tests ) {
        if ( hasOwnProp(tests, feature) ) {
            // run the test, throw the return value into the Modernizr,
            //   then based on that boolean, define an appropriate className
            //   and push it into an array of classes we'll join later.
            featureName  = feature.toLowerCase();
            Modernizr[featureName] = tests[feature]();

            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
        }
    }

    /**
     * addTest allows the user to define their own feature tests
     * the result will be added onto the Modernizr object,
     * as well as an appropriate className set on the html element
     *
     * @param feature - String naming the feature
     * @param test - Function returning true if feature is supported, false if not
     */
     Modernizr.addTest = function ( feature, test ) {
       if ( typeof feature == 'object' ) {
         for ( var key in feature ) {
           if ( hasOwnProp( feature, key ) ) {
             Modernizr.addTest( key, feature[ key ] );
           }
         }
       } else {

         feature = feature.toLowerCase();

         if ( Modernizr[feature] !== undefined ) {
           // we're going to quit if you're trying to overwrite an existing test
           // if we were to allow it, we'd do this:
           //   var re = new RegExp("\\b(no-)?" + feature + "\\b");
           //   docElement.className = docElement.className.replace( re, '' );
           // but, no rly, stuff 'em.
           return Modernizr;
         }

         test = typeof test == 'function' ? test() : test;

         if (typeof enableClasses !== "undefined" && enableClasses) {
           docElement.className += ' ' + (test ? '' : 'no-') + feature;
         }
         Modernizr[feature] = test;

       }

       return Modernizr; // allow chaining.
     };

    // Reset modElem.cssText to nothing to reduce memory footprint.
    setCss('');
    modElem = inputElem = null;

    // Assign private properties to the return object with prefix
    Modernizr._version      = version;

    // expose these for the plugin API. Look in the source for how to join() them against your input
    /*>>prefixes*/
    Modernizr._prefixes     = prefixes;
    /*>>prefixes*/
    /*>>domprefixes*/
    Modernizr._domPrefixes  = domPrefixes;
    Modernizr._cssomPrefixes  = cssomPrefixes;
    /*>>domprefixes*/

    /*>>mq*/
    // Modernizr.mq tests a given media query, live against the current state of the window
    // A few important notes:
    //   * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
    //   * A max-width or orientation query will be evaluated against the current state, which may change later.
    //   * You must specify values. Eg. If you are testing support for the min-width media query use:
    //       Modernizr.mq('(min-width:0)')
    // usage:
    // Modernizr.mq('only screen and (max-width:768)')
    Modernizr.mq            = testMediaQuery;
    /*>>mq*/

    /*>>hasevent*/
    // Modernizr.hasEvent() detects support for a given event, with an optional element to test on
    // Modernizr.hasEvent('gesturestart', elem)
    Modernizr.hasEvent      = isEventSupported;
    /*>>hasevent*/

    /*>>testprop*/
    // Modernizr.testProp() investigates whether a given style property is recognized
    // Note that the property names must be provided in the camelCase variant.
    // Modernizr.testProp('pointerEvents')
    Modernizr.testProp      = function(prop){
        return testProps([prop]);
    };
    /*>>testprop*/

    /*>>testallprops*/
    // Modernizr.testAllProps() investigates whether a given style property,
    //   or any of its vendor-prefixed variants, is recognized
    // Note that the property names must be provided in the camelCase variant.
    // Modernizr.testAllProps('boxSizing')
    Modernizr.testAllProps  = testPropsAll;
    /*>>testallprops*/

    /*>>teststyles*/
    // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
    // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
    Modernizr.testStyles    = injectElementWithStyles;
    /*>>teststyles*/

    /*>>prefixed*/
    // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
    // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'

    // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
    // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
    //
    //     str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');

    // If you're trying to ascertain which transition end event to bind to, you might do something like...
    //
    //     var transEndEventNames = {
    //       'WebkitTransition' : 'webkitTransitionEnd',
    //       'MozTransition'    : 'transitionend',
    //       'OTransition'      : 'oTransitionEnd',
    //       'msTransition'     : 'MSTransitionEnd',
    //       'transition'       : 'transitionend'
    //     },
    //     transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];

    Modernizr.prefixed      = function(prop, obj, elem){
      if(!obj) {
        return testPropsAll(prop, 'pfx');
      } else {
        // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'
        return testPropsAll(prop, obj, elem);
      }
    };
    /*>>prefixed*/

    /*>>cssclasses*/
    // Remove "no-js" class from <html> element, if it exists:
    docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +

                            // Add the new classes to the <html> element.
                            (enableClasses ? ' js ' + classes.join(' ') : '');
    /*>>cssclasses*/

    return Modernizr;

})(this, this.document);

// selectorSupported lovingly lifted from the mad italian genius, diego perini
// http://javascript.nwbox.com/CSSSupport/
Modernizr.selectorSupported = function(selector) {
    var support, result, link, sheet, doc = document,
        root = doc.documentElement,
        head = root.getElementsByTagName('head')[0],

        impl = doc.implementation || {
            hasFeature: function() {
                return false;
            }
        },

        link = doc.createElement("style");
        link.type = 'text/css';

        (head || root).insertBefore(link, (head || root).firstChild);

        sheet = link.sheet || link.styleSheet;

        if (!(sheet && selector)) return false;

        support = impl.hasFeature('CSS2', '') ?

            function(selector) {
              try {
                  sheet.insertRule(selector + '{ }', 0);
                  sheet.deleteRule(sheet.cssRules.length - 1);
              } catch (e) {
                  return false;
              }
              return true;

          } : function(selector) {

              sheet.cssText = selector + ' { }';
              return sheet.cssText.length !== 0 && !(/unknown/i).test(sheet.cssText) && sheet.cssText.indexOf(selector) === 0;
          };

      result = support(selector);
      link.parentNode.removeChild(link);
      link = sheet = undefined;
      return result;
};

(function() {
    var i, selector, selectors = ':first-child :last-child :nth-child(n) *:nth-of-type(n) :nth-last-child(n)'.split(' ');
    for (i = 0; i < selectors.length; i++) {
        selector = selectors[i];
        Modernizr.addTest('css-' + selectors[i].replace(/[*:-]|\([^)]\)/g, ''), function() {
            return Modernizr.selectorSupported(selector);
        });
    }
})();

//developer.mozilla.org/en/CSS/box-sizing
//github.com/Modernizr/Modernizr/issues/248

Modernizr.addTest("boxsizing",function(){
 return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
});

// testing for placeholder attribute in inputs and textareas
// re-using Modernizr.input if available

Modernizr.addTest('placeholder', function(){

  return !!( 'placeholder' in ( Modernizr.input || document.createElement('input') ) &&
             'placeholder' in ( Modernizr.textarea || document.createElement('textarea') )
           );

});

Modernizr.addTest('mediaqueries', Modernizr.mq('only all'));


text:
package honeyspoon.driver;

import java.sql.ResultSetMetaData;
import java.sql.SQLException;

public class HSResultSetMetaData implements ResultSetMetaData {
    private ResultSetMetaData metadata;

    public HSResultSetMetaData(ResultSetMetaData metadata) {
        this.metadata = metadata;
    }

    public int getColumnCount() throws SQLException {
        return metadata.getColumnCount();
    }

    public boolean isAutoIncrement(int column) throws SQLException {
        return metadata.isAutoIncrement(column);
    }

    public boolean isCaseSensitive(int column) throws SQLException {
        return metadata.isCaseSensitive(column);
    }

    public boolean isSearchable(int column) throws SQLException {
        return metadata.isSearchable(column);
    }

    public boolean isCurrency(int column) throws SQLException {
        return metadata.isCurrency(column);
    }

    public int isNullable(int column) throws SQLException {
        return metadata.isNullable(column);
    }

    public boolean isSigned(int column) throws SQLException {
        return true; //metadata.isSigned(column);
    }

    public int getColumnDisplaySize(int column) throws SQLException {
        return metadata.getColumnDisplaySize(column);
    }

    public String getColumnLabel(int column) throws SQLException {
        return metadata.getColumnLabel(column);
    }

    public String getColumnName(int column) throws SQLException {
        return metadata.getColumnName(column);
    }

    public String getSchemaName(int column) throws SQLException {
        return metadata.getSchemaName(column);
    }

    public int getPrecision(int column) throws SQLException {
        return metadata.getPrecision(column);
    }

    public int getScale(int column) throws SQLException {
        return metadata.getScale(column);
    }

    public String getTableName(int column) throws SQLException {
        return metadata.getTableName(column);
    }

    public String getCatalogName(int column) throws SQLException {
        return metadata.getCatalogName(column);
    }

    public int getColumnType(int column) throws SQLException {
        return metadata.getColumnType(column);
    }

    public String getColumnTypeName(int column) throws SQLException {
        return metadata.getColumnTypeName(column);
    }

    public boolean isReadOnly(int column) throws SQLException {
        return metadata.isReadOnly(column);
    }

    public boolean isWritable(int column) throws SQLException {
        return metadata.isWritable(column);
    }

    public boolean isDefinitelyWritable(int column) throws SQLException {
        return metadata.isDefinitelyWritable(column);
    }

    public String getColumnClassName(int column) throws SQLException {
        return metadata.getColumnClassName(column);
    }

    public <T> T unwrap(Class<T> iface) throws SQLException {
        return metadata.unwrap(iface);
    }

    public boolean isWrapperFor(Class<?> iface) throws SQLException {
        return metadata.isWrapperFor(iface);
    }
}


text:
require 'fog/core/collection'
require 'fog/aws/models/beanstalk/version'

module Fog
  module AWS
    class ElasticBeanstalk
      class Versions < Fog::Collection
        model Fog::AWS::ElasticBeanstalk::Version

        def all(options={})
          data = service.describe_application_versions(options).body['DescribeApplicationVersionsResult']['ApplicationVersions']
          load(data) # data is an array of attribute hashes
        end

        def get(application_name, version_label)
          if data = service.describe_application_versions({
                                                                 'ApplicationName' => application_name,
                                                                 'VersionLabels' => [version_label]
                                                             }).body['DescribeApplicationVersionsResult']['ApplicationVersions']
            if data.length == 1
              new(data.first)
            end

          end
        end
      end
    end
  end
end


text:
//
//  MoipHttpRequester.h
//  MoipSDK
//
//  Created by Fernando Nazario Sousa on 06/03/14.
//  Copyright (c) 2014 Moip Pagamentos. All rights reserved.
//

#ifndef MoipHttpRequester_h
#define MoipHttpRequester_h

#import <Foundation/Foundation.h>

@class MoipHttpResponse;

@interface MoipHttpRequester : NSObject <NSURLConnectionDelegate>
{
    /**
     * Upload delegate
     */
    id delegate;
}

+ (MoipHttpRequester *) requesterWithToken:(NSString *)token key:(NSString *)key;

/*!
 * Set the default headers. (Accept, User-Agent, Content-Type);
 */
- (void) setDefaultHeaders;

/*!
 * Add additional headers
 */
- (void) addHeaders:(NSDictionary *)additionalHeaders;

/*!
 * Make a GET request with default Cache policy. (NSURLRequestReloadRevalidatingCacheData)
 * \param url - URL to request.
 * \param params - Additional params.
 * \returns MoipHttpResponse.
 */
- (MoipHttpResponse *) get:(NSString *)url params:(NSDictionary * )params;

/*!
 * Make a POST request.
 * \param url - URL to request.
 * \param payload - Payload.
 * \param params - Additional params.
 * \param delegate (Optional) -  Upload delegate, used by didFailWithError, didSendBodyData and connectionDidFinishLoading.
 * \returns MoipHttpResponse.
 */
- (MoipHttpResponse *) post:(NSString *)url payload:(id)payload params:(NSDictionary * )params delegate:(id)delegate;

/*!
 * Make a PUT request.
 * \param url - URL to request.
 * \param payload - Payload.
 * \param params - Additional params.
 * \returns MoipHttpResponse.
 */
- (MoipHttpResponse *) put:(NSString *)url payload:(id)payload params:(NSDictionary * )params;

/*!
 * Make a DELETE request.
 * \param url - URL to request.
 * \returns MoipHttpResponse.
 */
- (MoipHttpResponse *) delete:(NSString *)url;

@end
#endif


text:
var showdown  = require('showdown'),
    converter = new showdown.Converter();
converter.setFlavor('github');
var jsdom = require("jsdom");
var serializeDocument = require("jsdom").serializeDocument;
var fs = require("fs");
var documentationContent = fs.readFileSync("../docs_src/documentation.md", "utf-8");
var documentationTemplate = fs.readFileSync("../docs_src/documentation.html", "utf-8");
var demoTemplate = fs.readFileSync("../docs_src/demo.html", "utf-8");
var indexContent = fs.readFileSync("../docs_src/index.md", "utf-8");
var indexHeader = fs.readFileSync("../docs_src/index_header.md", "utf-8");
var ReadMeHeader = fs.readFileSync("../docs_src/README_header.md", "utf-8");
var indexTemplate = fs.readFileSync("../docs_src/index.html", "utf-8");
var barbiche = fs.readFileSync("../barbiche.min.js", "utf-8");
var examples = require("../docs_src/examples.json");

jsdom.env({
	html: documentationTemplate,
	src: [barbiche],
	done: function (err, window) {
		var document = window.document;
		var Barbiche = window.Barbiche;
		var target = document.querySelector('#target');
		target.innerHTML =	 converter.makeHtml(documentationContent);
		var barbiche = Barbiche();
		Array.prototype.slice.call(target.querySelectorAll('ul, ol')).forEach(function(list) {
			list.classList.add('ui', 'list');
		});
		var obj = {
			h2: []
		};
		var h3;
		Array.prototype.slice.call(target.querySelectorAll('h2[id], h3[id]')).forEach(function(h) {
			if (h.nodeName == 'H2') {
				var header = window.document.createElement('h4');
				header.classList.add('ui', 'horizontal', 'header', 'divider');
				h.parentNode.insertBefore(header, h);
				h3 = [];
				obj.h2.push({
					id: h.getAttribute('id'),
					text: h.textContent,
					h3: h3
				});
			} else {
				h3.push({
					id: h.getAttribute('id'),
					text: h.textContent
				})
			}
		});
		Array.prototype.slice.call(target.querySelectorAll('pre code')).forEach(function(code) {
			var classes = code.getAttribute('class');
			var div = document.createElement('div');
			div.classList.add('ui', 'code', 'raised', 'segment', 'hide');
			div.innerHTML = '<textarea class="' + classes + '">' +
				code.textContent.replace(/\n$/, "") + '</textarea>';
			code.parentNode.parentNode.replaceChild(div, code.parentNode);
		});
		document.querySelector('#toc-menu').appendChild(barbiche('toc-template').merge(obj));
		fs.writeFileSync("../docs/documentation.html", serializeDocument(window.document));
  }
});
jsdom.env({
	html: indexTemplate,
	done: function (err, window) {
		var document = window.document;
		var target = document.querySelector('#target');
		target.innerHTML = converter.makeHtml(indexHeader + indexContent);
		Array.prototype.slice.call(target.querySelectorAll('ul, ol')).forEach(function(list) {
			list.classList.add('ui', 'list');
		});

		Array.prototype.slice.call(target.querySelectorAll('h2')).forEach(function(h) {
			var header = document.createElement('h4');
			header.classList.add('ui', 'horizontal', 'header', 'divider');
			h.parentNode.insertBefore(header, h);
		});

		Array.prototype.slice.call(target.querySelectorAll('pre code')).forEach(function(code) {
			var classes = code.getAttribute('class');
			var div = document.createElement('div');
			div.classList.add('ui', 'code', 'raised', 'segment', 'hide');
			div.innerHTML = '<textarea class="' + classes + '">' +
				code.textContent.replace(/\n$/, "") + '</textarea>';
			code.parentNode.parentNode.replaceChild(div, code.parentNode);
		});
		Array.prototype.slice.call(target.querySelectorAll('table')).forEach(function(table) {
			table.classList.add('ui', 'celled', 'table');
		});
		fs.writeFileSync("../docs/index.html", serializeDocument(window.document));
  }
});

jsdom.env({
	html: demoTemplate,
	done: function (err, window) {
		var document = window.document;
		var obj = {};
		var buttons = document.querySelector('#buttons');
		examples.forEach(function(example) {
			var button = document.createElement('button');
			button.setAttribute("name", example.name);
			button.setAttribute("class", "ui button");
			var text = document.createTextNode(example.name);
			button.appendChild(text);
			buttons.appendChild(button);
			obj[example.name] = {
				template: example.template,
				js: example.js
			};
			document.querySelector('#target').textContent = "var examples = " + JSON.stringify(obj);
		});
		fs.writeFileSync("../docs/demo.html", serializeDocument(window.document));
  }
});

fs.writeFileSync("../README.md", ReadMeHeader + indexContent);


text:
$packageName = 'nem'
$installerType = 'exe'
$silentArgs = '--mode unattended --unattendedmodeui none --debuglevel 0'
$url = 'http://bob.nem.ninja/installer/nemwallet-0.6.72-windows-installer.exe'
$checksum = '6269b879745d64d4028e9e6b9decd546649bad58'
$checksumType = 'sha1'
$validExitCodes = @(0)
Install-ChocolateyPackage -PackageName "$packageName" `
                          -FileType "$installerType" `
                          -SilentArgs "$silentArgs" `
                          -Url "$url" `
                          -ValidExitCodes $validExitCodes `
                          -Checksum "$checksum" `
                          -ChecksumType "$checksumType"