text:
package com.microsoft.azure.management.notificationhubs.v2016_03_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.management.notificationhubs.v2016_03_01.implementation.NotificationHubResourceInner;
import com.microsoft.azure.arm.model.Indexable;
import com.microsoft.azure.arm.model.Refreshable;
import com.microsoft.azure.arm.model.Updatable;
import com.microsoft.azure.arm.model.Appliable;
import com.microsoft.azure.arm.model.Creatable;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.notificationhubs.v2016_03_01.implementation.NotificationHubsManager;
import java.util.Map;
import java.util.List;

/**
 * Type representing NotificationHubResource.
 */
public interface NotificationHubResource extends HasInner<NotificationHubResourceInner>, Indexable, Refreshable<NotificationHubResource>, Updatable<NotificationHubResource.Update>, HasManager<NotificationHubsManager> {
    /**
     * @return the admCredential value.
     */
    AdmCredential admCredential();

    /**
     * @return the apnsCredential value.
     */
    ApnsCredential apnsCredential();

    /**
     * @return the authorizationRules value.
     */
    List<SharedAccessAuthorizationRuleProperties> authorizationRules();

    /**
     * @return the baiduCredential value.
     */
    BaiduCredential baiduCredential();

    /**
     * @return the gcmCredential value.
     */
    GcmCredential gcmCredential();

    /**
     * @return the id value.
     */
    String id();

    /**
     * @return the location value.
     */
    String location();

    /**
     * @return the mpnsCredential value.
     */
    MpnsCredential mpnsCredential();

    /**
     * @return the name value.
     */
    String name();

    /**
     * @return the notificationHubResourceName value.
     */
    String notificationHubResourceName();

    /**
     * @return the registrationTtl value.
     */
    String registrationTtl();

    /**
     * @return the sku value.
     */
    Sku sku();

    /**
     * @return the tags value.
     */
    Map<String, String> tags();

    /**
     * @return the type value.
     */
    String type();

    /**
     * @return the wnsCredential value.
     */
    WnsCredential wnsCredential();

    /**
     * The entirety of the NotificationHubResource definition.
     */
    interface Definition extends DefinitionStages.Blank, DefinitionStages.WithNamespace, DefinitionStages.WithLocation, DefinitionStages.WithCreate {
    }

    /**
     * Grouping of NotificationHubResource definition stages.
     */
    interface DefinitionStages {
        /**
         * The first stage of a NotificationHubResource definition.
         */
        interface Blank extends WithNamespace {
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify Namespace.
         */
        interface WithNamespace {
           /**
            * Specifies resourceGroupName, namespaceName.
            * @param resourceGroupName The name of the resource group
            * @param namespaceName The namespace name
            * @return the next definition stage
            */
            WithLocation withExistingNamespace(String resourceGroupName, String namespaceName);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify Location.
         */
        interface WithLocation {
           /**
            * Specifies location.
            * @param location Resource location
            * @return the next definition stage
            */
            WithCreate withLocation(String location);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify AdmCredential.
         */
        interface WithAdmCredential {
            /**
             * Specifies admCredential.
             * @param admCredential The AdmCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withAdmCredential(AdmCredential admCredential);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify ApnsCredential.
         */
        interface WithApnsCredential {
            /**
             * Specifies apnsCredential.
             * @param apnsCredential The ApnsCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withApnsCredential(ApnsCredential apnsCredential);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify AuthorizationRules.
         */
        interface WithAuthorizationRules {
            /**
             * Specifies authorizationRules.
             * @param authorizationRules The AuthorizationRules of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withAuthorizationRules(List<SharedAccessAuthorizationRuleProperties> authorizationRules);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify BaiduCredential.
         */
        interface WithBaiduCredential {
            /**
             * Specifies baiduCredential.
             * @param baiduCredential The BaiduCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withBaiduCredential(BaiduCredential baiduCredential);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify GcmCredential.
         */
        interface WithGcmCredential {
            /**
             * Specifies gcmCredential.
             * @param gcmCredential The GcmCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withGcmCredential(GcmCredential gcmCredential);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify MpnsCredential.
         */
        interface WithMpnsCredential {
            /**
             * Specifies mpnsCredential.
             * @param mpnsCredential The MpnsCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withMpnsCredential(MpnsCredential mpnsCredential);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify NotificationHubCreateOrUpdateParametersName.
         */
        interface WithNotificationHubCreateOrUpdateParametersName {
            /**
             * Specifies notificationHubCreateOrUpdateParametersName.
             * @param notificationHubCreateOrUpdateParametersName The NotificationHub name
             * @return the next definition stage
             */
            WithCreate withNotificationHubCreateOrUpdateParametersName(String notificationHubCreateOrUpdateParametersName);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify RegistrationTtl.
         */
        interface WithRegistrationTtl {
            /**
             * Specifies registrationTtl.
             * @param registrationTtl The RegistrationTtl of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withRegistrationTtl(String registrationTtl);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify Sku.
         */
        interface WithSku {
            /**
             * Specifies sku.
             * @param sku The sku of the created namespace
             * @return the next definition stage
             */
            WithCreate withSku(Sku sku);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify Tags.
         */
        interface WithTags {
            /**
             * Specifies tags.
             * @param tags Resource tags
             * @return the next definition stage
             */
            WithCreate withTags(Map<String, String> tags);
        }

        /**
         * The stage of the notificationhubresource definition allowing to specify WnsCredential.
         */
        interface WithWnsCredential {
            /**
             * Specifies wnsCredential.
             * @param wnsCredential The WnsCredential of the created NotificationHub
             * @return the next definition stage
             */
            WithCreate withWnsCredential(WnsCredential wnsCredential);
        }

        /**
         * The stage of the definition which contains all the minimum required inputs for
         * the resource to be created (via {@link WithCreate#create()}), but also allows
         * for any other optional settings to be specified.
         */
        interface WithCreate extends Creatable<NotificationHubResource>, DefinitionStages.WithAdmCredential, DefinitionStages.WithApnsCredential, DefinitionStages.WithAuthorizationRules, DefinitionStages.WithBaiduCredential, DefinitionStages.WithGcmCredential, DefinitionStages.WithMpnsCredential, DefinitionStages.WithNotificationHubCreateOrUpdateParametersName, DefinitionStages.WithRegistrationTtl, DefinitionStages.WithSku, DefinitionStages.WithTags, DefinitionStages.WithWnsCredential {
        }
    }
    /**
     * The template for a NotificationHubResource update operation, containing all the settings that can be modified.
     */
    interface Update extends Appliable<NotificationHubResource>, UpdateStages.WithAdmCredential, UpdateStages.WithApnsCredential, UpdateStages.WithAuthorizationRules, UpdateStages.WithBaiduCredential, UpdateStages.WithGcmCredential, UpdateStages.WithMpnsCredential, UpdateStages.WithNotificationHubCreateOrUpdateParametersName, UpdateStages.WithRegistrationTtl, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithWnsCredential {
    }

    /**
     * Grouping of NotificationHubResource update stages.
     */
    interface UpdateStages {
        /**
         * The stage of the notificationhubresource update allowing to specify AdmCredential.
         */
        interface WithAdmCredential {
            /**
             * Specifies admCredential.
             * @param admCredential The AdmCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withAdmCredential(AdmCredential admCredential);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify ApnsCredential.
         */
        interface WithApnsCredential {
            /**
             * Specifies apnsCredential.
             * @param apnsCredential The ApnsCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withApnsCredential(ApnsCredential apnsCredential);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify AuthorizationRules.
         */
        interface WithAuthorizationRules {
            /**
             * Specifies authorizationRules.
             * @param authorizationRules The AuthorizationRules of the created NotificationHub
             * @return the next update stage
             */
            Update withAuthorizationRules(List<SharedAccessAuthorizationRuleProperties> authorizationRules);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify BaiduCredential.
         */
        interface WithBaiduCredential {
            /**
             * Specifies baiduCredential.
             * @param baiduCredential The BaiduCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withBaiduCredential(BaiduCredential baiduCredential);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify GcmCredential.
         */
        interface WithGcmCredential {
            /**
             * Specifies gcmCredential.
             * @param gcmCredential The GcmCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withGcmCredential(GcmCredential gcmCredential);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify MpnsCredential.
         */
        interface WithMpnsCredential {
            /**
             * Specifies mpnsCredential.
             * @param mpnsCredential The MpnsCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withMpnsCredential(MpnsCredential mpnsCredential);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify NotificationHubCreateOrUpdateParametersName.
         */
        interface WithNotificationHubCreateOrUpdateParametersName {
            /**
             * Specifies notificationHubCreateOrUpdateParametersName.
             * @param notificationHubCreateOrUpdateParametersName The NotificationHub name
             * @return the next update stage
             */
            Update withNotificationHubCreateOrUpdateParametersName(String notificationHubCreateOrUpdateParametersName);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify RegistrationTtl.
         */
        interface WithRegistrationTtl {
            /**
             * Specifies registrationTtl.
             * @param registrationTtl The RegistrationTtl of the created NotificationHub
             * @return the next update stage
             */
            Update withRegistrationTtl(String registrationTtl);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify Sku.
         */
        interface WithSku {
            /**
             * Specifies sku.
             * @param sku The sku of the created namespace
             * @return the next update stage
             */
            Update withSku(Sku sku);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify Tags.
         */
        interface WithTags {
            /**
             * Specifies tags.
             * @param tags Resource tags
             * @return the next update stage
             */
            Update withTags(Map<String, String> tags);
        }

        /**
         * The stage of the notificationhubresource update allowing to specify WnsCredential.
         */
        interface WithWnsCredential {
            /**
             * Specifies wnsCredential.
             * @param wnsCredential The WnsCredential of the created NotificationHub
             * @return the next update stage
             */
            Update withWnsCredential(WnsCredential wnsCredential);
        }

    }
}


text:
package org.nbone.monitor.annotation;

import org.springframework.cache.annotation.CachingConfigurationSelector;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;

/**
 * @author thinking
 * @version 1.0
 * @since 2019-10-14
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(MonitorConfiguration.class)
public @interface EnableMonitor {

    /**
     * Global ignores exception
     *
     * @return
     */
    Class<? extends Throwable>[] ignores() default {};
}

redpajama_set_name: RedPajamaGithub


text:
set -o nounset
set -o errexit

STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )"

export DEBIAN_FRONTEND=noninteractive

sudo apt-get install -y python-pip make python-dev libmysqlclient-dev mysql-client-core-5.6
sudo pip install unicodecsv
sudo pip install MySQL-python
sudo pip install kazoo


text:
module Primes (primes, primfaktoren, divisors) where

import Data.List (subsequences, nub)

-- checks if x is a prime number
isPrime x = undefined

-- all prime numbers
primes = 2:3:[x | x <- [5,7..], primeTest x (isqrt x) (tail primes)]

primeTest n sqrt_n (d:ds) = if d > sqrt_n then True
                            else if (mod n d)==0 then False
                                 else primeTest n sqrt_n ds

isqrt = floor . sqrt . fromIntegral

---------------------------------------------------
-- list all prime factors of x
primfaktoren x = primfaktoren' x (takePrimes x)

takePrimes n = takeWhile (<=(div n 2)) $ primes

primfaktoren' _ [] = []
primfaktoren' x (y:ys)
    | mod x y == 0 = y:primfaktoren' (div x y) (y:ys)
    | otherwise = primfaktoren' x ys

-- list all divisors of x
-- maybe not very fast, better use allDivisors from Divisors module
divisors x = nub $ map product $ subsequences $ primfaktoren x

-- get all circular primes of a given prime (eu 35)
--circularPrimes :: Int -> [Int]
--circularPrimes p = map (\x -> read x::Int) $ concat $ [ [x] | x <- show p ]


text:
//
//  GTLCalendarEventDateTime.h
//

// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
//   Calendar API (calendar/v3)
// Description:
//   Lets you manipulate events and other calendar data.
// Documentation:
//   https://developers.google.com/google-apps/calendar/firstapp
// Classes:
//   GTLCalendarEventDateTime (0 custom class methods, 3 custom properties)

#if GTL_BUILT_AS_FRAMEWORK
  #import "GTL/GTLObject.h"
#else
  #import "GTLObject.h"
#endif

// ----------------------------------------------------------------------------
//
//   GTLCalendarEventDateTime
//

@interface GTLCalendarEventDateTime : GTLObject

// The date, in the format "yyyy-mm-dd", if this is an all-day event.
@property (nonatomic, retain) GTLDateTime *date;  // Date only (yyyy-mm-dd)

// The time, as a combined date-time value (formatted according to RFC 3339). A
// time zone offset is required unless a time zone is explicitly specified in
// timeZone.
@property (nonatomic, retain) GTLDateTime *dateTime;

// The time zone in which the time is specified. (Formatted as an IANA Time Zone
// Database name, e.g. "Europe/Zurich".) For recurring events this field is
// required and specifies the time zone in which the recurrence is expanded. For
// single events this field is optional and indicates a custom time zone for the
// event start/end.
@property (nonatomic, copy) NSString *timeZone;

@end


text:
var mockery = require('mockery')

var core = require('@carbon-io/carbon-core')
var __ = core.fibers.__(module)
var _o = core.bond._o(module)
var o = core.atom.o(module)
var testtube = core.testtube

carbonioMock = {
  fibers: core.fibers,
  atom: core.atom,
  bond: core.bond,
  testtube: core.testtube,
  ejson: core.ejson,
  HttpErrors: core.HttpErrors,
  carbond: require('../../..')
}

/**************************************************************************
 * Code fragments tests
 */
__(function() {
  module.exports = o.main({

    /**********************************************************************
     * _type
     */
    _type: testtube.Test,

    /**********************************************************************
     * name
     */
    name: "CarbondCodeFragsTestSuite",

    /**********************************************************************
     * tests
     */
    tests: {
      $property: {
        get: function() {
          try {
            mockery.registerMock('carbon-io', carbonioMock)
            mockery.enable({
              warnOnUnregistered: false,
              warnOnReplace: false
            })
            return [
              _o('./limiter'),
              _o('./service'),
              _o('../hello-world/test')
            ]
          } finally {
            mockery.disable()
            mockery.deregisterMock('carbon-io')
          }
        }
      }
    }
  })
})


text: Any code libraries written to process the data go here


text:
import re
import traceback
from threading import Lock
from types import MethodType
from telnetlib import Telnet
from distutils.version import StrictVersion
from elasticachepy import ec_logger
from elasticachepy.timer import Timer

class ElasticacheInvalidTelentReplyError(Exception):
    """
    receive configuration from endpoint is invalide
    """
    def __init__(self, msg):
        self.msg = msg

    def __str__(self):
        return self.msg

class Cluster(object):
    """
    Get the cluster configuration, store version and server list.
    Please refer to:
        http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/
            AutoDiscovery.AddingToYourClientLibrary.html
    How to get the Cluster info:
    * Input format:
        * version >= 1.4.14: config get cluster
        * version < 1.4.14: get AmazonElastiCache:cluster
    * Output format:
        CONFIG cluster 0 147\r\n
        12\r\n
        myCluster.pc4ldq.0001.use1.cache.amazonaws.com|10.82.235.120|11211
        myCluster.pc4ldq.0002.use1.cache.amazonaws.com|10.80.249.27|11211
        \n\r\n
        END\r\n
    """
    def __init__(self, endpoint, timeout=None):
        self.version = -1
        self.servers = []
        try:
            host, port = endpoint.split(':')
            telnet = Telnet(host, port, timeout)

            telnet.write('version\n')
            ret = telnet.read_until('\r\n', timeout)
            ec_logger.debug('version: %s', ret)
            version_info = ret.split(' ')
            if len(version_info) != 2 or version_info[0] != 'VERSION':
                raise ElasticacheInvalidTelentReplyError(ret)
            version = version_info[1][0:-2]
            if StrictVersion(version) >= StrictVersion('1.4.14'):
                cmd = 'config get cluster\n'
            else:
                cmd = 'get AmazonElastiCache:cluster\n'

            telnet.write(cmd)
            ret = telnet.read_until('END\r\n', timeout)
            telnet.close()
            ec_logger.debug('config: %s', ret)
            splitter = re.compile(r'\r?\n')
            cluster = splitter.split(ret)
            if len(cluster) != 6 or cluster[4][0:3] != 'END':
                raise ElasticacheInvalidTelentReplyError(ret)

            self.version = cluster[1]
            nodes = cluster[2].split(' ')
            for node in nodes:
                info = node.split('|')
                if len(info) != 3:
                    raise ElasticacheInvalidTelentReplyError(ret)
                self.servers.append(info[1] + ':' + info[2])
        except:
            self.servers.append(endpoint)
            ec_logger.exception(traceback.format_exc())

class Client(object):
    """
    Do autodiscovery for ElastiCache memcache cluster.
    """
    def __init__(self, client_cls, endpoint, autodiscovery=True,
                 autodiscovery_timeout=10, autodiscovery_interval=60,
                 *args, **kwargs):
        self.client_cls = client_cls
        self.endpoint = endpoint
        self.autodiscovery = autodiscovery
        self.autodiscovery_timeout = autodiscovery_timeout
        self.args = args
        self.kwargs = kwargs
        self.cluster = Cluster(self.endpoint, self.autodiscovery_timeout)
        if self.cluster.servers:
            self.client = self.client_cls(self.cluster.servers, *self.args,
                                          **self.kwargs)
            ec_logger.info('Cluster nodes are %s', self.cluster.servers)
        else:
            self.client = None
            ec_logger.warn('Cluster nodes are empty, :(')
        self.need_update = False
        self.update_lock = Lock()
        if self.autodiscovery:
            self.timer = Timer('AutoDiscovery', autodiscovery_interval,
                               self.detect_cluster)
            self.timer.start()
        else:
            self.timer = None

    def __del__(self):
        pass

    def __getattr__(self, key):
        if not hasattr(self.client, key):
            msg = "'%s' obj has no attribute '%s'" % (type(self).__name__, key)
            raise AttributeError(msg)
        client_func = getattr(self.client, key)

        def exec_func(self, *args, **kwargs):
            if self.need_update:
                ec_logger.info('Cluster nodes are: %s', self.cluster.servers)
                self.client = self.client_cls(self.cluster.servers,
                                              *self.args, **self.kwargs)
                self.need_update = False
            return client_func(*args, **kwargs)

        exec_func.__name__ = key
        return MethodType(exec_func, self)

    def detect_cluster(self):
        try:
            cluster = Cluster(self.endpoint, self.autodiscovery_timeout)
        except Exception, e:
            ec_logger.exception(traceback.format_exc())
            return
        if self.cluster.version != cluster.version:
            self.cluster = cluster
            self.need_update = True

    def stop_timer(self, wait=False):
        if self.timer:
            self.timer.stop()
            wait and self.timer.join()


text:
package main

import "os"
import "bufio"
import "io"
import "github.com/SumoLogic/sumoshell/util"
import "strings"

func main() {
	if len(os.Args[1:]) > 0 {
		read(os.Args[1])
	} else {
		read("")
	}
}

func read(filterString string) {
	r, w := io.Pipe()
	handler := util.NewRawInputHandler(w)
	go util.ConnectToReader(SumoFilter{filterString, util.NewJsonWriter()}, r)
	bio := bufio.NewReader(os.Stdin)
	var line, hasMoreInLine, err = bio.ReadLine()
	for err != io.EOF || hasMoreInLine {
		handler.Process(line)
		line, hasMoreInLine, err = bio.ReadLine()
	}
	handler.Flush()
}

type SumoFilter struct {
	param  string
	output *util.JsonWriter
}

func (filt SumoFilter) Process(inp map[string]interface{}) {
	if strings.Contains(util.ExtractRaw(inp), filt.param) {
		filt.output.Write(inp)
	}
}


text:
(function() {

  if (!/(iPad|iPhone|iPod)/i.test(navigator.userAgent)) return;

  var doc = document;
  var html = doc.documentElement;
  var touchPoints = {};
  var maxMovement = 10;

  HTMLElement.prototype.dispatchEvent = (function(dispev) {

    return function(ev) {

      // mark the click event so we can determine this event was generated by us
      if (ev.type === 'click') {
        Object.defineProperty(ev, 'fastclick_marker', { value: true, enumerable: false })
      }

      dispev.call(this, ev);

    };

  })(HTMLElement.prototype.dispatchEvent);

  HTMLElement.prototype.click = function() {
    var evt = this.ownerDocument.createEvent('MouseEvents');
    evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
    this.dispatchEvent(evt);
  }

  // we want to cancel native click events, we catch them as they start to tunnel from the document.
  doc.addEventListener('click', function(e) {

    if (e.fastclick_marker) return;

    e.preventDefault();
    e.stopImmediatePropagation();

  }, true);

  doc.addEventListener('touchstart', function(e) {

    for(var i = 0;i<e.changedTouches.length;i++) {

      var touch = e.changedTouches[i];
      touchPoints[touch.identifier] = {
        pageX: touch.pageX,
        pageY: touch.pageY
      };

    }

  }, false);

  doc.addEventListener('touchend', function(e) {

    for(var i = 0;i<e.changedTouches.length;i++) {

      var touch = e.changedTouches[i];
      var start = touchPoints[touch.identifier];

      delete touchPoints[touch.identifier];

      if (Math.abs(touch.pageX - start.pageX) > maxMovement || Math.abs(touch.pageY - start.pageY) > maxMovement) return;

      var el = touch.target.ownerDocument.elementFromPoint(touch.clientX, touch.clientY);

      var ev = el.ownerDocument.createEvent('MouseEvents');
      ev.initMouseEvent('click', true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);

      el.dispatchEvent(ev);

    }

    // var touch = e.changedTouches[0];

    // if (!tapAbort) {

    //   var el = doc.elementFromPoint(touch.clientX, touch.clientY);

    //   var ev = doc.createEvent('MouseEvents');
    //   ev.initMouseEvent('click', true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);

    //   el.dispatchEvent(ev);

    // }

    // tapAbort = false;

  }, false);

  doc.addEventListener('touchcancel', function(e) {

    for(var i = 0;i<e.changedTouches.length;i++) {
      var touch = e.changedTouches[i];
      delete touchPoints[touch.identifier];
    }

  }, false);

})();


text:
'use strict';
/*global console*/

var Thunk = require('../thunks.js')();
var fs = require('fs');
var fsStat = Thunk.thunkify(fs.stat);

fsStat('thunks.js')(function (error, result) {
  console.log('thunks.js: ', result);
});
fsStat('.gitignore')(function (error, result) {
  console.log('.gitignore: ', result);
});

var obj = {a: 8};

function run(x, callback) {
	//...
	callback(null, this.a * x);
}

var run = Thunk.thunkify.call(obj, run);

run(1)(function (error, result) {
  console.log('run 1: ', result);
});
run(2)(function (error, result) {
  console.log('run 2: ', result);
});


text:
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
	license agreements. See the NOTICE file distributed with this work for additional
	information regarding copyright ownership. The ASF licenses this file to
	you under the Apache License, Version 2.0 (the "License"); you may not use
	this file except in compliance with the License. You may obtain a copy of
	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
	by applicable law or agreed to in writing, software distributed under the
	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
	OF ANY KIND, either express or implied. See the License for the specific
	language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>com.sap.hana.cloud.samples</groupId>
	<artifactId>basecamp</artifactId>
	<version>1.0.0</version>
	<packaging>war</packaging>
	<name>SAP HANA Cloud Platform - Samples - basecamp</name>
	<description>A simple Maven skeleton project of web archetype</description>

	<organization>
		<name>SAP AG</name>
		<url>http://www.sap.com</url>
	</organization>

	<developers>
		<developer>
			<name>SAP HANA Cloud Platform</name>
			<url>http://hana.ondemand.com</url>
			<organization>SAP AG</organization>
			<organizationUrl>http://www.sap.com/</organizationUrl>
		</developer>
	</developers>

	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<properties>
		<jdk.version>1.6</jdk.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<sap.hcp.sdk.version>1.43.20.3</sap.hcp.sdk.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.7</version>
			<scope>test</scope>
		</dependency>

		<!-- SAP HANA Cloud Platform  -->
        	<dependency>
	        	<groupId>com.sap.cloud</groupId>
			<artifactId>neo-java-web-api</artifactId>
			<version>${sap.hcp.sdk.version}</version>
        	</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5.1</version>
				<configuration>
					<source>${jdk.version}</source>
					<target>${jdk.version}</target>
					<showDeprecation>true</showDeprecation>
					<showWarnings>true</showWarnings>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>compiler-warnings</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<jdk>${jdk.version}</jdk>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-compiler-plugin</artifactId>
						<version>2.5.1</version>
						<configuration>
							<compilerArguments>
								<Werror />
							</compilerArguments>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<url>https://github.com/SAP/cloud-basecamp</url>
</project>


text:
setVerboseShell(mongo_hacker_config.verbose_shell);

DBQuery.prototype._prettyShell = true

DB.prototype._getExtraInfo = function(action) {
    if ( typeof _verboseShell === 'undefined' || !_verboseShell ) {
        __callLastError = true;
        return;
    }

    // explicit w:1 so that replset getLastErrorDefaults aren't used here which would be bad.
    var startTime = new Date().getTime();
    var res = this.getLastErrorCmd(1);
    if (res) {
        if (res.err !== undefined && res.err !== null) {
            // error occurred, display it
            print(res.err);
            return;
        }

        var info = action + " ";
        // hack for inserted because res.n is 0
        info += action != "Inserted" ? res.n : 1;
        if (res.n > 0 && res.updatedExisting !== undefined) info += " " + (res.updatedExisting ? "existing" : "new");
        info += " record(s) in ";
        var time = new Date().getTime() - startTime;
        var slowms = getSlowms();
        if (time > slowms) {
            info += colorize(time + "ms", { color: 'red', bright: true });
        } else {
            info += colorize(time + "ms", { color: 'green', bright: true });
        }
        print(info);
    }
};


text:
namespace tensorflow {

REGISTER_OP("OctreeAlign")
    .Input("in_data: float")
    .Input("src_octree: int8")
    .Input("des_octree: int8")
    .Attr("depth: int")
    .Output("out_data: float")
    .Output("key_index: int32")
    .SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
      auto shape = c->input(0);
      TF_RETURN_IF_ERROR(c->ReplaceDim(shape, 2, c->UnknownDim(), &shape));
      c->set_output(0, shape);
      c->set_output(1, c->MakeShape({c->UnknownDim()}));
      return Status::OK();
    })
    .Doc(R"doc(Octree align operator.)doc");

REGISTER_OP("OctreeAlignGrad")
    .Input("in_data: float")
    .Input("key_index: int32")
    .Output("out_data: float")
    .SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
      auto shape = c->input(0);
      TF_RETURN_IF_ERROR(c->ReplaceDim(shape, 2, c->UnknownDim(), &shape));
      c->set_output(0, shape);
      return Status::OK();
    })
    .Doc(R"doc(Octree align grad operator.)doc");

class OctreeAlignOp : public OpKernel {
 public:
  explicit OctreeAlignOp(OpKernelConstruction* context) : OpKernel(context) {
    OP_REQUIRES_OK(context, context->GetAttr("depth", &curr_depth_));
  }

  void Compute(OpKernelContext* context) override {
    // in data
    const Tensor& src_data = context->input(0);
    auto src_ptr = src_data.flat<float>().data();
    int src_h = src_data.dim_size(2);
    int channel = src_data.dim_size(1);

    // octrees
    OctreeParser src_octree, des_octree;
    src_octree.set_gpu(context->input(1).flat<int8>().data());
    des_octree.set_gpu(context->input(2).flat<int8>().data());
    int des_h = des_octree.info().node_num(curr_depth_);
    CHECK_EQ(src_octree.info().node_num(curr_depth_), src_h);

    // get key
    const uintk* src_key = src_octree.key_gpu(curr_depth_);
    Tensor src_key_tensor;
    if (src_octree.info().is_key2xyz()) {
      xyz2key_gpu_op(context, &src_key_tensor, src_key, src_h, curr_depth_);
      src_key = src_key_tensor.flat<uintk>().data();
    }
    const uintk* des_key = des_octree.key_gpu(curr_depth_);
    Tensor des_key_tensor;
    if (des_octree.info().is_key2xyz()) {
      xyz2key_gpu_op(context, &des_key_tensor, des_key, des_h, curr_depth_);
      des_key = des_key_tensor.flat<uintk>().data();
    }

    // binary search
    Tensor* idx_tensor = nullptr;
    TensorShape idx_shape({src_h});
    OP_REQUIRES_OK(context, context->allocate_output(1, idx_shape, &idx_tensor));
    auto idx_ptr = idx_tensor->flat<int>().data();
    search_key_gpu(idx_ptr, des_key, des_h, src_key, src_h);

    // out data
    Tensor* des_tensor = nullptr;
    TensorShape des_shape({1, channel, des_h, 1});
    OP_REQUIRES_OK(context, context->allocate_output(0, des_shape, &des_tensor));
    auto des_ptr = des_tensor->flat<float>().data();

    // exec
    align_forward_gpu(des_ptr, des_h, channel, src_ptr, src_h, idx_ptr);
  }

 protected:
  void xyz2key_gpu_op(OpKernelContext* context, Tensor* key_tensor,
                      const uintk* xyz, const int num, const int depth) {
    auto dtype = std::is_same<uintk, uint32>::value ? DT_UINT32 : DT_UINT64;
    OP_REQUIRES_OK(
        context, context->allocate_temp(dtype, TensorShape({num}), key_tensor));
    auto ptr = key_tensor->flat<uintk>().data();
    xyz2key_gpu(ptr, xyz, num, depth);
  }

 private:
  int curr_depth_;
};

class OctreeAlignGradOp : public OpKernel {
 public:
  explicit OctreeAlignGradOp(OpKernelConstruction* context)
      : OpKernel(context) {}

  void Compute(OpKernelContext* context) override {
    // gradients
    const Tensor& des_data = context->input(0);
    auto des_ptr = des_data.flat<float>().data();
    int channel = des_data.dim_size(1);
    int des_h = des_data.dim_size(2);

    // index
    const Tensor& idx_tensor = context->input(1);
    int src_h = idx_tensor.dim_size(0);
    auto idx_ptr = idx_tensor.flat<int>().data();

    // grad out
    Tensor* src_tensor = nullptr;
    TensorShape src_shape({1, channel, src_h, 1});
    OP_REQUIRES_OK(context, context->allocate_output(0, src_shape, &src_tensor));
    auto src_ptr = src_tensor->flat<float>().data();

    // exec
    align_backward_gpu(des_ptr, des_h, channel, src_ptr, src_h, idx_ptr);
  }
};

REGISTER_KERNEL_BUILDER(Name("OctreeAlign").Device(DEVICE_GPU), OctreeAlignOp);
REGISTER_KERNEL_BUILDER(Name("OctreeAlignGrad").Device(DEVICE_GPU), OctreeAlignGradOp);

}  // namespace tensorflow


text:
import base64
import datetime
import shlex
import re
import os

try:
    import simplejson as json
except Exception:
    import json

from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import b

from libcloud.common.base import JsonResponse, ConnectionUserAndKey
from libcloud.common.base import KeyCertificateConnection
from libcloud.common.types import InvalidCredsError

from libcloud.container.base import Container, ContainerDriver, ContainerImage

from libcloud.container.providers import Provider
from libcloud.container.types import ContainerState

VALID_RESPONSE_CODES = [
    httplib.OK,
    httplib.ACCEPTED,
    httplib.CREATED,
    httplib.NO_CONTENT,
]

class DockerResponse(JsonResponse):

    valid_response_codes = [
        httplib.OK,
        httplib.ACCEPTED,
        httplib.CREATED,
        httplib.NO_CONTENT,
    ]

    def parse_body(self):
        if len(self.body) == 0 and not self.parse_zero_length_body:
            return self.body

        try:
            # error responses are tricky in Docker. Eg response could be
            # an error, but response status could still be 200
            content_type = self.headers.get("content-type", "application/json")
            if content_type == "application/json" or content_type == "":
                if (
                    self.headers.get("transfer-encoding") == "chunked"
                    and "fromImage" in self.request.url
                ):
                    body = [
                        json.loads(chunk)
                        for chunk in self.body.strip().replace("\r", "").split("\n")
                    ]
                else:
                    body = json.loads(self.body)
            else:
                body = self.body
        except ValueError:
            m = re.search('Error: (.+?)"', self.body)
            if m:
                error_msg = m.group(1)
                raise Exception(error_msg)
            else:
                raise Exception("ConnectionError: Failed to parse JSON response")
        return body

    def parse_error(self):
        if self.status == 401:
            raise InvalidCredsError("Invalid credentials")
        return self.body

    def success(self):
        return self.status in self.valid_response_codes

class DockerException(Exception):
    def __init__(self, code, message):
        self.code = code
        self.message = message
        self.args = (code, message)

    def __str__(self):
        return "%s %s" % (self.code, self.message)

    def __repr__(self):
        return "DockerException %s %s" % (self.code, self.message)

class DockerConnection(ConnectionUserAndKey):

    responseCls = DockerResponse
    timeout = 60

    def add_default_headers(self, headers):
        """
        Add parameters that are necessary for every request
        If user and password are specified, include a base http auth
        header
        """
        headers["Content-Type"] = "application/json"
        if self.user_id and self.key:
            user_b64 = base64.b64encode(b("%s:%s" % (self.user_id, self.key)))
            headers["Authorization"] = "Basic %s" % (user_b64.decode("utf-8"))
        return headers

class DockertlsConnection(KeyCertificateConnection):

    responseCls = DockerResponse

    def __init__(
        self,
        key,
        secret,
        secure=True,
        host="localhost",
        port=4243,
        key_file="",
        cert_file="",
        **kwargs,
    ):

        super(DockertlsConnection, self).__init__(
            key_file=key_file,
            cert_file=cert_file,
            secure=secure,
            host=host,
            port=port,
            url=None,
            proxy_url=None,
            timeout=None,
            backoff=None,
            retry_delay=None,
        )
        if key_file:
            keypath = os.path.expanduser(key_file)
            is_file_path = os.path.exists(keypath) and os.path.isfile(keypath)
            if not is_file_path:
                raise InvalidCredsError(
                    "You need an key PEM file to authenticate with "
                    "Docker tls. This can be found in the server."
                )
            self.key_file = key_file

            certpath = os.path.expanduser(cert_file)
            is_file_path = os.path.exists(certpath) and os.path.isfile(certpath)
            if not is_file_path:
                raise InvalidCredsError(
                    "You need an certificate PEM file to authenticate with "
                    "Docker tls. This can be found in the server."
                )
            self.cert_file = cert_file

    def add_default_headers(self, headers):

        headers["Content-Type"] = "application/json"
        return headers

class DockerContainerDriver(ContainerDriver):
    """
    Docker container driver class.

    >>> from libcloud.container.providers import get_driver
    >>> driver = get_driver('docker')
    >>> conn = driver(host='198.61.239.128', port=4243)
    >>> conn.list_containers()
    or connecting to http basic auth protected https host:
    >>> conn = driver('user', 'pass', host='https://198.61.239.128', port=443)

    connect with tls authentication, by providing a hostname, port, a private
    key file (.pem) and certificate (.pem) file
    >>> conn = driver(host='https://198.61.239.128',
    >>> port=4243, key_file='key.pem', cert_file='cert.pem')
    """

    type = Provider.DOCKER
    name = "Docker"
    website = "http://docker.io"
    connectionCls = DockerConnection
    supports_clusters = False
    version = "1.24"

    def __init__(
        self,
        key="",
        secret="",
        secure=False,
        host="localhost",
        port=4243,
        key_file=None,
        cert_file=None,
    ):
        """
        :param    key: API key or username to used (required)
        :type     key: ``str``

        :param    secret: Secret password to be used (required)
        :type     secret: ``str``

        :param    secure: Whether to use HTTPS or HTTP. Note: Some providers
                only support HTTPS, and it is on by default.
        :type     secure: ``bool``

        :param    host: Override hostname used for connections.
        :type     host: ``str``

        :param    port: Override port used for connections.
        :type     port: ``int``

        :param    key_file: Path to private key for TLS connection (optional)
        :type     key_file: ``str``

        :param    cert_file: Path to public key for TLS connection (optional)
        :type     cert_file: ``str``

        :return: ``None``
        """
        if key_file:
            self.connectionCls = DockertlsConnection
            self.key_file = key_file
            self.cert_file = cert_file
            secure = True

        if host.startswith("https://"):
            secure = True

        # strip the prefix
        prefixes = ["http://", "https://"]
        for prefix in prefixes:
            if host.startswith(prefix):
                host = host.strip(prefix)

        super(DockerContainerDriver, self).__init__(
            key=key,
            secret=secret,
            secure=secure,
            host=host,
            port=port,
            key_file=key_file,
            cert_file=cert_file,
        )

        if key_file or cert_file:
            # docker tls authentication-
            # https://docs.docker.com/articles/https/
            # We pass two files, a key_file with the
            # private key and cert_file with the certificate
            # libcloud will handle them through LibcloudHTTPSConnection
            if not (key_file and cert_file):
                raise Exception(
                    "Needs both private key file and "
                    "certificate file for tls authentication"
                )

        self.connection.secure = secure
        self.connection.host = host
        self.connection.port = port
        # set API version
        self.version = self._get_api_version()

    def _ex_connection_class_kwargs(self):
        kwargs = {}
        if hasattr(self, "key_file"):
            kwargs["key_file"] = self.key_file
        if hasattr(self, "cert_file"):
            kwargs["cert_file"] = self.cert_file
        return kwargs

    def install_image(self, path):
        """
        Install a container image from a remote path.

        :param path: Path to the container image
        :type  path: ``str``

        :rtype: :class:`libcloud.container.base.ContainerImage`
        """
        payload = {}
        data = json.dumps(payload)

        result = self.connection.request(
            "/v%s/images/create?fromImage=%s" % (self.version, path),
            data=data,
            method="POST",
        )
        if "errorDetail" in result.body:
            raise DockerException(None, result.body)
        image_id = None

        # the response is slightly different if the image is already present
        # and it's not downloaded. both messages below indicate that the image
        # is available for use to the daemon
        if re.search(r"Downloaded newer image", result.body) or re.search(
            r'"Status: Image is up to date', result.body
        ):
            if re.search(r"sha256:(?P<id>[a-z0-9]{64})", result.body):
                image_id = re.findall(r"sha256:(?P<id>[a-z0-9]{64})", result.body)[-1]

        # if there is a failure message or if there is not an image id in the
        # response then throw an exception.
        if image_id is None:
            raise DockerException(None, "failed to install image")

        image = ContainerImage(
            id=image_id,
            name=path,
            path=path,
            version=None,
            driver=self.connection.driver,
            extra={},
        )
        return image

    def list_images(self):
        """
        List the installed container images

        :rtype: ``list`` of :class:`libcloud.container.base.ContainerImage`
        """
        result = self.connection.request("/v%s/images/json" % (self.version)).object
        images = []
        for image in result:
            try:
                name = image.get("RepoTags")[0]
            except Exception:
                name = image.get("Id")
            images.append(
                ContainerImage(
                    id=image.get("Id"),
                    name=name,
                    path=name,
                    version=None,
                    driver=self.connection.driver,
                    extra={
                        "created": image.get("Created"),
                        "size": image.get("Size"),
                        "virtual_size": image.get("VirtualSize"),
                    },
                )
            )

        return images

    def list_containers(self, image=None, all=True):
        """
        List the deployed container images

        :param image: Filter to containers with a certain image
        :type  image: :class:`libcloud.container.base.ContainerImage`

        :param all: Show all container (including stopped ones)
        :type  all: ``bool``

        :rtype: ``list`` of :class:`libcloud.container.base.Container`
        """
        if all:
            ex = "?all=1"
        else:
            ex = ""
        try:
            result = self.connection.request(
                "/v%s/containers/json%s" % (self.version, ex)
            ).object
        except Exception as exc:
            errno = getattr(exc, "errno", None)
            if errno == 111:
                raise DockerException(
                    errno,
                    "Make sure docker host is accessible" "and the API port is correct",
                )
            raise

        containers = [self._to_container(value) for value in result]
        return containers

    def deploy_container(
        self,
        name,
        image,
        parameters=None,
        start=True,
        command=None,
        hostname=None,
        user="",
        stdin_open=True,
        tty=True,
        mem_limit=0,
        ports=None,
        environment=None,
        dns=None,
        volumes=None,
        volumes_from=None,
        network_disabled=False,
        entrypoint=None,
        cpu_shares=None,
        working_dir="",
        domainname=None,
        memswap_limit=0,
        port_bindings=None,
        network_mode="bridge",
        labels=None,
    ):
        """
        Deploy an installed container image

        For details on the additional parameters see : http://bit.ly/1PjMVKV

        :param name: The name of the new container
        :type  name: ``str``

        :param image: The container image to deploy
        :type  image: :class:`libcloud.container.base.ContainerImage`

        :param parameters: Container Image parameters
        :type  parameters: ``str``

        :param start: Start the container on deployment
        :type  start: ``bool``

        :rtype: :class:`Container`
        """
        command = shlex.split(str(command))
        if port_bindings is None:
            port_bindings = {}
        params = {"name": name}

        payload = {
            "Hostname": hostname,
            "Domainname": domainname,
            "ExposedPorts": ports,
            "User": user,
            "Tty": tty,
            "OpenStdin": stdin_open,
            "StdinOnce": False,
            "Memory": mem_limit,
            "AttachStdin": True,
            "AttachStdout": True,
            "AttachStderr": True,
            "Env": environment,
            "Cmd": command,
            "Dns": dns,
            "Image": image.name,
            "Volumes": volumes,
            "VolumesFrom": volumes_from,
            "NetworkDisabled": network_disabled,
            "Entrypoint": entrypoint,
            "CpuShares": cpu_shares,
            "WorkingDir": working_dir,
            "MemorySwap": memswap_limit,
            "PublishAllPorts": True,
            "PortBindings": port_bindings,
            "NetworkMode": network_mode,
            "Labels": labels,
        }

        data = json.dumps(payload)
        try:
            result = self.connection.request(
                "/v%s/containers/create" % (self.version),
                data=data,
                params=params,
                method="POST",
            )
        except Exception as e:
            message = e.message or str(e)  # pylint: disable=no-member
            if message.startswith("No such image:"):
                raise DockerException(None, "No such image: %s" % image.name)
            else:
                raise DockerException(None, e)

        id_ = result.object["Id"]

        payload = {
            "Binds": [],
            "PublishAllPorts": True,
            "PortBindings": port_bindings,
        }

        data = json.dumps(payload)
        if start:
            if float(self._get_api_version()) > 1.22:
                result = self.connection.request(
                    "/v%s/containers/%s/start" % (self.version, id_), method="POST"
                )
            else:
                result = self.connection.request(
                    "/v%s/containers/%s/start" % (self.version, id_),
                    data=data,
                    method="POST",
                )

        return self.get_container(id_)

    def get_container(self, id):
        """
        Get a container by ID

        :param id: The ID of the container to get
        :type  id: ``str``

        :rtype: :class:`libcloud.container.base.Container`
        """
        result = self.connection.request(
            "/v%s/containers/%s/json" % (self.version, id)
        ).object

        return self._to_container(result)

    def start_container(self, container):
        """
        Start a container

        :param container: The container to be started
        :type  container: :class:`libcloud.container.base.Container`

        :return: The container refreshed with current data
        :rtype: :class:`libcloud.container.base.Container`
        """
        if float(self._get_api_version()) > 1.22:
            result = self.connection.request(
                "/v%s/containers/%s/start" % (self.version, container.id), method="POST"
            )
        else:
            payload = {
                "Binds": [],
                "PublishAllPorts": True,
            }
            data = json.dumps(payload)
            result = self.connection.request(
                "/v%s/containers/%s/start" % (self.version, container.id),
                method="POST",
                data=data,
            )

        if result.status in VALID_RESPONSE_CODES:
            return self.get_container(container.id)
        else:
            raise DockerException(result.status, "failed to start container")

    def stop_container(self, container):
        """
        Stop a container

        :param container: The container to be stopped
        :type  container: :class:`libcloud.container.base.Container`

        :return: The container refreshed with current data
        :rtype: :class:`libcloud.container.base.Container`
        """
        result = self.connection.request(
            "/v%s/containers/%s/stop" % (self.version, container.id), method="POST"
        )
        if result.status in VALID_RESPONSE_CODES:
            return self.get_container(container.id)
        else:
            raise DockerException(result.status, "failed to stop container")

    def restart_container(self, container):
        """
        Restart a container

        :param container: The container to be stopped
        :type  container: :class:`libcloud.container.base.Container`

        :return: The container refreshed with current data
        :rtype: :class:`libcloud.container.base.Container`
        """
        data = json.dumps({"t": 10})
        # number of seconds to wait before killing the container
        result = self.connection.request(
            "/v%s/containers/%s/restart" % (self.version, container.id),
            data=data,
            method="POST",
        )
        if result.status in VALID_RESPONSE_CODES:
            return self.get_container(container.id)
        else:
            raise DockerException(result.status, "failed to restart container")

    def destroy_container(self, container):
        """
        Remove a container

        :param container: The container to be destroyed
        :type  container: :class:`libcloud.container.base.Container`

        :return: True if the destroy was successful, False otherwise.
        :rtype: ``bool``
        """
        result = self.connection.request(
            "/v%s/containers/%s" % (self.version, container.id), method="DELETE"
        )
        return result.status in VALID_RESPONSE_CODES

    def ex_list_processes(self, container):
        """
        List processes running inside a container

        :param container: The container to list processes for.
        :type  container: :class:`libcloud.container.base.Container`

        :rtype: ``str``
        """
        result = self.connection.request(
            "/v%s/containers/%s/top" % (self.version, container.id)
        ).object

        return result

    def ex_rename_container(self, container, name):
        """
        Rename a container

        :param container: The container to be renamed
        :type  container: :class:`libcloud.container.base.Container`

        :param name: The new name
        :type  name: ``str``

        :rtype: :class:`libcloud.container.base.Container`
        """
        result = self.connection.request(
            "/v%s/containers/%s/rename?name=%s" % (self.version, container.id, name),
            method="POST",
        )
        if result.status in VALID_RESPONSE_CODES:
            return self.get_container(container.id)

    def ex_get_logs(self, container, stream=False):
        """
        Get container logs

        If stream == True, logs will be yielded as a stream
        From Api Version 1.11 and above we need a GET request to get the logs
        Logs are in different format of those of Version 1.10 and below

        :param container: The container to list logs for
        :type  container: :class:`libcloud.container.base.Container`

        :param stream: Stream the output
        :type  stream: ``bool``

        :rtype: ``bool``
        """
        payload = {}
        data = json.dumps(payload)

        if float(self._get_api_version()) > 1.10:
            result = self.connection.request(
                "/v%s/containers/%s/logs?follow=%s&stdout=1&stderr=1"
                % (self.version, container.id, str(stream))
            ).object
            logs = result
        else:
            result = self.connection.request(
                "/v%s/containers/%s/attach?logs=1&stream=%s&stdout=1&stderr=1"
                % (self.version, container.id, str(stream)),
                method="POST",
                data=data,
            )
            logs = result.body

        return logs

    def ex_search_images(self, term):
        """Search for an image on Docker.io.
        Returns a list of ContainerImage objects

        >>> images = conn.ex_search_images(term='mistio')
        >>> images
        [<ContainerImage: id=rolikeusch/docker-mistio...>,
         <ContainerImage: id=mist/mistio, name=mist/mistio,
             driver=Docker  ...>]

         :param term: The search term
         :type  term: ``str``

         :rtype: ``list`` of :class:`libcloud.container.base.ContainerImage`
        """

        term = term.replace(" ", "+")
        result = self.connection.request(
            "/v%s/images/search?term=%s" % (self.version, term)
        ).object
        images = []
        for image in result:
            name = image.get("name")
            images.append(
                ContainerImage(
                    id=name,
                    path=name,
                    version=None,
                    name=name,
                    driver=self.connection.driver,
                    extra={
                        "description": image.get("description"),
                        "is_official": image.get("is_official"),
                        "is_trusted": image.get("is_trusted"),
                        "star_count": image.get("star_count"),
                    },
                )
            )

        return images

    def ex_delete_image(self, image):
        """
        Remove image from the filesystem

        :param  image: The image to remove
        :type   image: :class:`libcloud.container.base.ContainerImage`

        :rtype: ``bool``
        """
        result = self.connection.request(
            "/v%s/images/%s" % (self.version, image.name), method="DELETE"
        )
        return result.status in VALID_RESPONSE_CODES

    def _to_container(self, data):
        """
        Convert container in Container instances
        """
        try:
            name = data.get("Name").strip("/")
        except Exception:
            try:
                name = data.get("Names")[0].strip("/")
            except Exception:
                name = data.get("Id")
        state = data.get("State")
        if isinstance(state, dict):
            status = data.get(
                "Status", state.get("Status") if state is not None else None
            )
        else:
            status = data.get("Status")
        if "Exited" in status:
            state = ContainerState.STOPPED
        elif status.startswith("Up "):
            state = ContainerState.RUNNING
        elif "running" in status:
            state = ContainerState.RUNNING
        else:
            state = ContainerState.STOPPED
        image = data.get("Image")
        ports = data.get("Ports", [])
        created = data.get("Created")
        if isinstance(created, float):
            created = ts_to_str(created)
        extra = {
            "id": data.get("Id"),
            "status": data.get("Status"),
            "created": created,
            "image": image,
            "ports": ports,
            "command": data.get("Command"),
            "sizerw": data.get("SizeRw"),
            "sizerootfs": data.get("SizeRootFs"),
        }
        ips = []
        if ports is not None:
            for port in ports:
                if port.get("IP") is not None:
                    ips.append(port.get("IP"))
        return Container(
            id=data["Id"],
            name=name,
            image=ContainerImage(
                id=data.get("ImageID", None),
                path=image,
                name=image,
                version=None,
                driver=self.connection.driver,
            ),
            ip_addresses=ips,
            state=state,
            driver=self.connection.driver,
            extra=extra,
        )

    def _get_api_version(self):
        """
        Get the docker API version information
        """
        result = self.connection.request("/version").object
        result = result or {}
        api_version = result.get("ApiVersion")

        return api_version

def ts_to_str(timestamp):
    """
    Return a timestamp as a nicely formated datetime string.
    """
    date = datetime.datetime.fromtimestamp(timestamp)
    date_string = date.strftime("%d/%m/%Y %H:%M %Z")
    return date_string


text:
import eyes from 'eyes.it';
import {iconWithOptionsTestkitFactory, getStoryUrl, waitForVisibilityOf} from '../../testkit/protractor';

describe('IconWithOptions', () => {
  const storyUrl = getStoryUrl('4. Selection', '4.5 IconWithOptions');
  const dataHook = 'story-iconWithOptions';

  eyes.it('should hide dropdown when selecting an option which is not already selected', () => {
    browser.get(storyUrl);
    const driver = iconWithOptionsTestkitFactory({dataHook});

    waitForVisibilityOf(driver.element(), 'Cannot find iconWithOptions')
    .then(() => {
      driver.mouseEnter();
      driver.getDropdownItem(1).click();

      driver.mouseLeave();
      driver.mouseEnter();
      driver.getDropdownItem(1).click();
      expect(driver.getDropdown().isDisplayed()).toBe(true);
    });
  });
});


text:
package com.stratio.crossdata.connector.postgresql

import com.stratio.crossdata.test.BaseXDTest
import org.apache.spark.sql.execution.datasources.jdbc.PostgresqlRDD
import org.apache.spark.sql.sources._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class PostgresqlRDDFilterSpec extends BaseXDTest {

  val att1 = "att1"
  val att2 = "att2"
  val att3 = "att3"

  val val1 = "val1"
  val val2 = "val2"
  val val3 = "val3"

  val equal1 = EqualTo(att1, val1)
  val equal2 = EqualTo(att2, val2)
  val lessThan = LessThan(att1, val1)
  val greaterThan = GreaterThan(att1, val1)
  val lessThanOrEqual = LessThanOrEqual(att1, val1)
  val greaterThanOrEqual = GreaterThanOrEqual(att1, val1)
  val isNull = IsNull(att1)
  val isNotNull = IsNotNull(att1)
  val startsLike = StringStartsWith(att1, val1)
  val endsLike = StringEndsWith(att1, val1)
  val containsLike = StringContains(att1, val1)
  val inValues: Array[Any] = Array(val1, val2)
  val in = In(att1, inValues)
  val notFilter = Not(equal1)
  val orFilter = Or(equal1, equal2)
  val andFilter = And(equal1, equal2)
  val orAndAndFilter = And(orFilter, andFilter)
  val orAndAndOrFilter = Or(orAndAndFilter, equal1)
  val orAndOrOrFilter = Or(And(orFilter, orFilter), equal1)

  "PostgresqlRDD " should "translate Equal filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(equal1).get
    stringOrFilter should be ("att1 = 'val1'")
  }

  "PostgresqlRDD " should "translate LessThan filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(lessThan).get
    stringOrFilter should be ("att1 < 'val1'")
  }

  "PostgresqlRDD " should "translate GreaterThan filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(greaterThan).get
    stringOrFilter should be ("att1 > 'val1'")
  }

  "PostgresqlRDD " should "translate LessThanOrEqual filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(lessThanOrEqual).get
    stringOrFilter should be ("att1 <= 'val1'")
  }

  "PostgresqlRDD " should "translate GreaterThanOrEqual filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(greaterThanOrEqual).get
    stringOrFilter should be ("att1 >= 'val1'")
  }

  "PostgresqlRDD " should "translate IsNull filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(isNull).get
    stringOrFilter should be ("att1 IS NULL")
  }

  "PostgresqlRDD " should "translate IsNotNull filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(isNotNull).get
    stringOrFilter should be ("att1 IS NOT NULL")
  }

  "PostgresqlRDD " should "translate StringStartsWith filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(startsLike).get
    stringOrFilter should be ("att1 LIKE 'val1%'")
  }

  "PostgresqlRDD " should "translate StringEndsWith filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(endsLike).get
    stringOrFilter should be ("att1 LIKE '%val1'")
  }

  "PostgresqlRDD " should "translate StringContains filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(containsLike).get
    stringOrFilter should be ("att1 LIKE '%val1%'")
  }

  "PostgresqlRDD " should "translate In filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(in).get
    stringOrFilter should be ("att1 IN ('val1', 'val2')")
  }

  "PostgresqlRDD " should "translate Not filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(notFilter).get
    stringOrFilter should be ("(NOT (att1 = 'val1'))")
  }

  "PostgresqlRDD " should "translate OR filter" in {
    val stringOrFilter: String = PostgresqlRDD.compileFilter(orFilter).get
    stringOrFilter should be ("((att1 = 'val1') OR (att2 = 'val2'))")
  }

  "PostgresqlRDD " should "translate AND filter" in {
    val stringAndFilter: String = PostgresqlRDD.compileFilter(andFilter).get
    stringAndFilter should be ("((att1 = 'val1') AND (att2 = 'val2'))")
  }

  "PostgresqlRDD " should "translate AND(OR, AND) filter" in {
    val stringOrAndAndFilter: String = PostgresqlRDD.compileFilter(orAndAndFilter).get
    stringOrAndAndFilter should be ("((((att1 = 'val1') OR (att2 = 'val2'))) AND (((att1 = 'val1') AND (att2 = 'val2'))))")
  }

  "PostgresqlRDD " should "translate OR(AND(OR, AND),equal) filter" in {
    val stringOrAndAndOrFilter: String = PostgresqlRDD.compileFilter(orAndAndOrFilter).get
    stringOrAndAndOrFilter should be ("((((((att1 = 'val1') OR (att2 = 'val2'))) AND (((att1 = 'val1') AND (att2 = 'val2'))))) OR (att1 = 'val1'))")
  }

  "PostgresqlRDD " should "translate OR(AND(OR, OR),equal) filter" in {
    val stringOrAndOrOrFilterFilter: String = PostgresqlRDD.compileFilter(orAndOrOrFilter).get
    stringOrAndOrOrFilterFilter should be ("((((((att1 = 'val1') OR (att2 = 'val2'))) AND (((att1 = 'val1') OR (att2 = 'val2'))))) OR (att1 = 'val1'))")
  }

}


text:
<?php

namespace app\modules\admin\controllers;

use Yii;
use app\components\Controller;
use app\models\Users;

class UsersController extends Controller
{

    public function actionIndex()
    {
        $users = Users::find()->all();
        return $this->render('index', ['users' => $users]);
    }

}


text:
extern const struct OTRManagedBuddyAttributes {
	__unsafe_unretained NSString *accountName;
	__unsafe_unretained NSString *chatState;
	__unsafe_unretained NSString *composingMessageString;
	__unsafe_unretained NSString *currentStatus;
	__unsafe_unretained NSString *displayName;
	__unsafe_unretained NSString *lastMessageDate;
	__unsafe_unretained NSString *lastMessageDisconnected;
	__unsafe_unretained NSString *lastSentChatState;
	__unsafe_unretained NSString *photo;
} OTRManagedBuddyAttributes;

extern const struct OTRManagedBuddyRelationships {
	__unsafe_unretained NSString *account;
	__unsafe_unretained NSString *encryptionStatusMessages;
	__unsafe_unretained NSString *groups;
	__unsafe_unretained NSString *messages;
	__unsafe_unretained NSString *messagesandstatuses;
	__unsafe_unretained NSString *statuses;
} OTRManagedBuddyRelationships;

@class OTRManagedAccount;
@class OTRManagedEncryptionStatusMessage;
@class OTRManagedGroup;
@class OTRManagedMessage;
@class OTRManagedMessageAndStatus;
@class OTRManagedStatus;

@class NSObject;

@interface OTRManagedBuddyID : NSManagedObjectID {}
@end

@interface _OTRManagedBuddy : NSManagedObject {}
+ (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_;
+ (NSString*)entityName;
+ (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_;
@property (nonatomic, readonly, strong) OTRManagedBuddyID* objectID;

@property (nonatomic, strong) NSString* accountName;

//- (BOOL)validateAccountName:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSNumber* chatState;

@property (atomic) int16_t chatStateValue;
- (int16_t)chatStateValue;
- (void)setChatStateValue:(int16_t)value_;

//- (BOOL)validateChatState:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSString* composingMessageString;

//- (BOOL)validateComposingMessageString:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSNumber* currentStatus;

@property (atomic) int16_t currentStatusValue;
- (int16_t)currentStatusValue;
- (void)setCurrentStatusValue:(int16_t)value_;

//- (BOOL)validateCurrentStatus:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSString* displayName;

//- (BOOL)validateDisplayName:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSDate* lastMessageDate;

//- (BOOL)validateLastMessageDate:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSNumber* lastMessageDisconnected;

@property (atomic) BOOL lastMessageDisconnectedValue;
- (BOOL)lastMessageDisconnectedValue;
- (void)setLastMessageDisconnectedValue:(BOOL)value_;

//- (BOOL)validateLastMessageDisconnected:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSNumber* lastSentChatState;

@property (atomic) int16_t lastSentChatStateValue;
- (int16_t)lastSentChatStateValue;
- (void)setLastSentChatStateValue:(int16_t)value_;

//- (BOOL)validateLastSentChatState:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) id photo;

//- (BOOL)validatePhoto:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) OTRManagedAccount *account;

//- (BOOL)validateAccount:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSSet *encryptionStatusMessages;

- (NSMutableSet*)encryptionStatusMessagesSet;

@property (nonatomic, strong) NSSet *groups;

- (NSMutableSet*)groupsSet;

@property (nonatomic, strong) NSSet *messages;

- (NSMutableSet*)messagesSet;

@property (nonatomic, strong) NSSet *messagesandstatuses;

- (NSMutableSet*)messagesandstatusesSet;

@property (nonatomic, strong) NSSet *statuses;

- (NSMutableSet*)statusesSet;

@end

@interface _OTRManagedBuddy (EncryptionStatusMessagesCoreDataGeneratedAccessors)
- (void)addEncryptionStatusMessages:(NSSet*)value_;
- (void)removeEncryptionStatusMessages:(NSSet*)value_;
- (void)addEncryptionStatusMessagesObject:(OTRManagedEncryptionStatusMessage*)value_;
- (void)removeEncryptionStatusMessagesObject:(OTRManagedEncryptionStatusMessage*)value_;

@end

@interface _OTRManagedBuddy (GroupsCoreDataGeneratedAccessors)
- (void)addGroups:(NSSet*)value_;
- (void)removeGroups:(NSSet*)value_;
- (void)addGroupsObject:(OTRManagedGroup*)value_;
- (void)removeGroupsObject:(OTRManagedGroup*)value_;

@end

@interface _OTRManagedBuddy (MessagesCoreDataGeneratedAccessors)
- (void)addMessages:(NSSet*)value_;
- (void)removeMessages:(NSSet*)value_;
- (void)addMessagesObject:(OTRManagedMessage*)value_;
- (void)removeMessagesObject:(OTRManagedMessage*)value_;

@end

@interface _OTRManagedBuddy (MessagesandstatusesCoreDataGeneratedAccessors)
- (void)addMessagesandstatuses:(NSSet*)value_;
- (void)removeMessagesandstatuses:(NSSet*)value_;
- (void)addMessagesandstatusesObject:(OTRManagedMessageAndStatus*)value_;
- (void)removeMessagesandstatusesObject:(OTRManagedMessageAndStatus*)value_;

@end

@interface _OTRManagedBuddy (StatusesCoreDataGeneratedAccessors)
- (void)addStatuses:(NSSet*)value_;
- (void)removeStatuses:(NSSet*)value_;
- (void)addStatusesObject:(OTRManagedStatus*)value_;
- (void)removeStatusesObject:(OTRManagedStatus*)value_;

@end

@interface _OTRManagedBuddy (CoreDataGeneratedPrimitiveAccessors)

- (NSString*)primitiveAccountName;
- (void)setPrimitiveAccountName:(NSString*)value;

- (NSNumber*)primitiveChatState;
- (void)setPrimitiveChatState:(NSNumber*)value;

- (int16_t)primitiveChatStateValue;
- (void)setPrimitiveChatStateValue:(int16_t)value_;

- (NSString*)primitiveComposingMessageString;
- (void)setPrimitiveComposingMessageString:(NSString*)value;

- (NSNumber*)primitiveCurrentStatus;
- (void)setPrimitiveCurrentStatus:(NSNumber*)value;

- (int16_t)primitiveCurrentStatusValue;
- (void)setPrimitiveCurrentStatusValue:(int16_t)value_;

- (NSString*)primitiveDisplayName;
- (void)setPrimitiveDisplayName:(NSString*)value;

- (NSDate*)primitiveLastMessageDate;
- (void)setPrimitiveLastMessageDate:(NSDate*)value;

- (NSNumber*)primitiveLastMessageDisconnected;
- (void)setPrimitiveLastMessageDisconnected:(NSNumber*)value;

- (BOOL)primitiveLastMessageDisconnectedValue;
- (void)setPrimitiveLastMessageDisconnectedValue:(BOOL)value_;

- (NSNumber*)primitiveLastSentChatState;
- (void)setPrimitiveLastSentChatState:(NSNumber*)value;

- (int16_t)primitiveLastSentChatStateValue;
- (void)setPrimitiveLastSentChatStateValue:(int16_t)value_;

- (id)primitivePhoto;
- (void)setPrimitivePhoto:(id)value;

- (OTRManagedAccount*)primitiveAccount;
- (void)setPrimitiveAccount:(OTRManagedAccount*)value;

- (NSMutableSet*)primitiveEncryptionStatusMessages;
- (void)setPrimitiveEncryptionStatusMessages:(NSMutableSet*)value;

- (NSMutableSet*)primitiveGroups;
- (void)setPrimitiveGroups:(NSMutableSet*)value;

- (NSMutableSet*)primitiveMessages;
- (void)setPrimitiveMessages:(NSMutableSet*)value;

- (NSMutableSet*)primitiveMessagesandstatuses;
- (void)setPrimitiveMessagesandstatuses:(NSMutableSet*)value;

- (NSMutableSet*)primitiveStatuses;
- (void)setPrimitiveStatuses:(NSMutableSet*)value;

@end


text:
<MODULE backgroundColor="false" border="module">
{% if banner %}
<CONTAINER type="table">

<CONTAINER type="data">
    <TEXT>
        <LINK href="{{ banner.url}}">
        <IMAGE align="left" type="image/jpeg"
               href="{{ ROOT_URL }}{{ banner.image.url }}"
               caption="ummeli"/>
        </LINK>
    </TEXT>
</CONTAINER>

    <TEXT>
        <LINK href="{{banner.url}}">{{ banner.title }}</LINK>
        {{ banner.description }}
    </TEXT>

</CONTAINER>
{% else %}
<CONTAINER type="table">

    <TEXT>
        <LINK href="/vlive/">Ummeli</LINK>
        lets you find opportunities, build a work profile & connect with others.
    </TEXT>

</CONTAINER>
{% endif %}

</MODULE>


text:
<?php

namespace OpenStackStorage;

/**
 * \OpenStackStorage\Container object and \OpenStackStorage\Object
 * instance factory.
 *
 * If your account has the feature enabled, containers can be publically
 * shared over a global content delivery network.
 */
class Container
{

    /**
     * Connection object.
     *
     * @var \OpenStackStorage\Connection
     */
    protected $connection = null;

    /**
     * Container name.
     *
     * @var string
     */
    protected $name = null;

    /**
     * Number of objects in container.
     *
     * @var integer
     */
    protected $nbObjects = 0;

    /**
     * The sum of the sizes of all objects in this container (in bytes).
     *
     * @var integer
     */
    protected $sizeUsed = 0;

    /**
     * Metadata.
     *
     * @var array
     */
    protected $metadata = array();

    /**
     * URI for this container, if it is publically accessible via the CDN.
     *
     * @var string
     */
    protected $cdnUri = null;

    /**
     * SSL URI for this container, if it is publically accessible via the CDN.
     *
     * @var string
     */
    protected $cdnSslUri = null;

    /**
     * Streaming URI for this container, if it is publically accessible
     * via the CDN.
     *
     * @var string
     */
    protected $cdnStreamingUri = null;

    /**
     * The time-to-live of the CDN's public cache of this container.
     *
     * @var integer
     */
    protected $cdnTtl = null;

    /**
     * Retention of the logs in the container.
     *
     * @var boolean
     */
    protected $cdnLogRetention = false;

    /**
     * List of parameters that are allowed to be used in the GET-requests to
     * fetch
     * information about the objects in this container:
     *  — limit      For an integer value n, limits the number of results to at
     *               most n values.
     *  — marker     Given a string value x, return object names greater in
     *               value than the specified marker.
     *  — end_marker Given a string value x, return object names less in
     *               value than the specified marker.
     *  — prefix     For a string value x, causes the results to be limited to
     *               object names beginning with the substring x.
     *  — format     Response format (json, xml, plain).
     *  — delimiter  For a character c, return all the object names nested in
     *               the container (without the need for the directory marker
     *               objects).
     *
     * @link http://docs.openstack.org/api/openstack-object-storage/1.0/content/list-objects.html
     * @var array
     */
    protected static $allowedParameters = array(
        'limit',
        'marker',
        'end_marker',
        'prefix',
        'format',
        'delimiter',
    );

    /**
     * Local cache of requests to fetch list of objects in this container.
     *
     * @var array
     */
    protected static $listObjectsCache = array();

    /**
     * The class constructor.
     *
     * Containers will rarely if ever need to be instantiated directly by
     * the user.
     *
     * Instead, use the \OpenStackStorage\OpenStackStorage\Connection
     * object methods:
     *
     * $connection->createContainer('test');
     * $connection->getContainer('test');
     * $connection->getContainers();
     *
     *
     * @param \OpenStackStorage\Connection $connection
     * @param string                       $name
     * @param integer                      $nbObjects
     * @param integer                      $sizeUsed
     * @param array                        $metadata
     */
    public function __construct(Connection $connection, $name, $nbObjects = 0, $sizeUsed = 0, array $metadata = array())
    {
        $this->connection = $connection;
        $this->name       = $name;

        if ($nbObjects > 0) {
            $this->nbObjects = intval($nbObjects);
        }

        if ($sizeUsed > 0) {
            $this->sizeUsed = intval($sizeUsed);
        }

        if (!empty($metadata)) {
            $this->metadata = $metadata;
        }

        // Fetch the CDN data from the CDN service
        if ($connection->getCdnEnabled()) {
            $response = $connection->makeCdnRequest(Client::HEAD, array($name));

            $this->cdnUri          = $response['headers']['x-cdn-uri'];
            $this->cdnTtl          = $response['headers']['x-ttl'];
            $this->cdnSslUri       = $response['headers']['x-cdn-ssl-uri'];
            $this->cdnStreamingUri = $response['headers']['x-cdn-streaming-uri'];

            $logRetention = $response['headers']['x-log-retention'];
            if ($logRetention && (0 === strcasecmp($logRetention, 'true'))) {
                $this->cdnLogRetention = true;
            }
        }
    }

    /**
     * Return the value of the $connection property.
     *
     * @return \OpenStackStorage\Connection
     */
    public function getConnection()
    {
        return $this->connection;
    }

    /**
     * Return the value of the $name property.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Returns number of objects in container.
     *
     * @return integer
     */
    public function getNbObjects()
    {
        return $this->nbObjects;
    }

    /**
     * Returns the sum of the sizes of all objects in this container (in bytes).
     *
     * @return int
     */
    public function getSizeUsed()
    {
        return $this->sizeUsed;
    }

    /**
     * Return the value of the $metadata property.
     *
     * @return array
     */
    public function getMetadata()
    {
        return $this->metadata;
    }

    /**
     * Updates container metadata.
     *
     * Example:
     *
     * $container->updateMetadata(array(
     *     'foo' => 'bar',
     * ));
     *
     *
     * @param array $metadata
     */
    public function updateMetadata(array $metadata)
    {
        $processed = array();

        foreach ($metadata as $k => $v) {
            $processed[strtolower(str_ireplace('X-Container-Meta-', '', $k))] = $v;
        }

        $this->connection->makeRequest(Client::POST, array($this->name), $processed);

        $this->metadata = $processed;
    }

    /**
     * Enable static web for this container.
     *
     * Example:
     *
     * $container->enableStaticWeb('index.html', true, 'error.html', 'style.css');
     *
     *
     * @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/StaticWeb.html
     * @param string  $index
     * @param boolean $enableListings
     * @param string  $error
     * @param string  $listingsCss
     */
    public function enableStaticWeb($index = null, $enableListings = null, $error = null, $listingsCss = null)
    {
        $metadata = array(
            'X-Container-Meta-Web-Index'        => '',
            'X-Container-Meta-Web-Listings'     => '',
            'X-Container-Meta-Web-Error'        => '',
            'X-Container-Meta-Web-Listings-CSS' => '',
        );

        if (null !== $index) {
            $metadata['X-Container-Meta-Web-Index'] = strval($index);
        }

        if (null !== $enableListings && is_bool($enableListings)) {
            $metadata['X-Container-Meta-Web-Listings'] = $enableListings ? 'True' : 'False';
        }

        if (null !== $error) {
            $metadata['X-Container-Meta-Web-Error'] = strval($error);
        }

        if (null !== $listingsCss) {
            $metadata['X-Container-Meta-Listings-CSS'] = strval($listingsCss);
        }

        $this->updateMetadata($metadata);
    }

    /**
     * Disable static web for this container.
     */
    public function disableStaticWeb()
    {
        $this->enableStaticWeb();
    }

    /**
     * Enable object versioning on this container.
     *
     * @link http://docs.rackspace.com/files/api/v1/cf-devguide/content/Object_Versioning-e1e3230.html
     * @param string $containerName The container where versions will be stored
     */
    public function enableObjectVersioning($containerName)
    {
        $this->updateMetadata(array('X-Versions-Location' => strval($containerName)));
    }

    /**
     * Disable object versioning on this container.
     */
    public function disableObjectVersioning()
    {
        $this->updateMetadata(array('X-Versions-Location' => ''));
    }

    /**
     * Either publishes the current container to the CDN or updates its
     * CDN attributes.
     * Requires CDN be enabled on the account.
     *
     * @param  integer                                    $ttl cache duration in seconds of the CDN server
     * @throws \OpenStackStorage\Exceptions\CDNNotEnabled
     */
    public function makePublic($ttl = 86400)
    {
        if (!$this->connection->getCdnEnabled()) {
            throw new Exceptions\CDNNotEnabled();
        }

        if ($this->cdnUri) {
            $requestMethod = Client::POST;
        } else {
            $requestMethod = Client::PUT;
        }

        $response = $this->connection->makeCdnRequest(
            $requestMethod,
            array($this->name),
            array(
                'X-TTL'          => strval($ttl),
                'X-CDN-Enabled'  => 'True',
                'Content-Length' => 0,
            )
        );

        $this->cdnTtl    = $ttl;
        $this->cdnUri    = $response['headers']['x-cdn-uri'];
        $this->cdnSslUri = $response['headers']['x-cdn-ssl-uri'];
    }

    /**
     * Disables CDN access to this container.
     * It may continue to be available until its TTL expires.
     *
     * @throws \OpenStackStorage\Exceptions\CDNNotEnabled
     */
    public function makePrivate()
    {
        if (!$this->connection->getCdnEnabled()) {
            throw new Exceptions\CDNNotEnabled();
        }

        $this->cdnUri = null;
        $this->connection->makeCdnRequest(
            Client::POST,
            array($this->name),
            array('X-CDN-Enabled' => 'False')
        );
    }

    /**
     * Purge Edge cache for all object inside of this container.
     * You will be notified by email if one is provided when the
     * job completes.
     *
     *
     * $container1->purgeFromCdn();
     * $container2->purgeFromCdn('user@example.com');
     * $container3->purgeFromCdn('user@example.com,user@example.org);
     *
     *
     * @param  string                                     $email
     * @throws \OpenStackStorage\Exceptions\CDNNotEnabled
     */
    public function purgeFromCdn($email = null)
    {
        if (!$this->connection->getCdnEnabled()) {
            throw new Exceptions\CDNNotEnabled();
        }

        $headers = array();
        if (null !== $email) {
            $headers['X-Purge-Email'] = $email;
        }

        $this->connection->makeCdnRequest(Client::DELETE, array($this->name), $headers);
    }

    /**
     * Enable CDN log retention on the container. If enabled logs will be
     * periodically (at unpredictable intervals) compressed and uploaded to
     * a ".CDN_ACCESS_LOGS" container in the form of
     * "container_name/YYYY/MM/DD/HH/XXXX.gz". Requires CDN be enabled on
     * the account.
     *
     * @param  boolean                                    $logRetention
     * @throws \OpenStackStorage\Exceptions\CDNNotEnabled
     */
    public function logRetention($logRetention = false)
    {
        if (!$this->connection->getCdnEnabled()) {
            throw new Exceptions\CDNNotEnabled();
        }

        $logRetention = (boolean) $logRetention;
        $this->connection->makeCdnRequest(
            Client::POST,
            array($this->name),
            array('X-Log-Retention' => $logRetention ? 'True' : 'False')
        );

        $this->cdnLogRetention = $logRetention;
    }

    /**
     * Return a boolean indicating whether or not this container is
     * publically accessible via the CDN.
     *
     * Example:
     *
     * $container->isPublic(); // false
     * $container->makePublic();
     * $container->isPublic(); // true
     *
     *
     * @return boolean
     * @throws \OpenStackStorage\Exceptions\CDNNotEnabled
     */
    public function isPublic()
    {
        if (!$this->connection->getCdnEnabled()) {
            throw new Exceptions\CDNNotEnabled();
        }

        return null !== $this->cdnUri;
    }

    /**
     * Return the URI for this container, if it is publically
     * accessible via the CDN.
     *
     * Example:
     *
     * echo $container->getPublicUri();
     * // Outputs "http://c00061.cdn.cloudfiles.rackspacecloud.com"
     *
     *
     * @return string
     * @throws \OpenStackStorage\Exceptions\ContainerNotPublic
     */
    public function getPublicUri()
    {
        if (!$this->isPublic()) {
            throw new Exceptions\ContainerNotPublic();
        }

        return $this->cdnUri;
    }

    /**
     * Return the SSL URI for this container, if it is publically
     * accessible via the CDN.
     *
     * Example:
     *
     * echo $container->getPublicSslUri();
     * // Outputs "https://c61.ssl.cf0.rackcdn.com"
     *
     *
     * @return string
     * @throws \OpenStackStorage\Exceptions\ContainerNotPublic
     */
    public function getPublicSslUri()
    {
        if (!$this->isPublic()) {
            throw new Exceptions\ContainerNotPublic();
        }

        return $this->cdnSslUri;
    }

    /**
     * Return the Streaming URI for this container, if it is publically
     * accessible via the CDN.
     *
     * Example:
     *
     * echo $container->getPublicStreamingUri();
     * // Outputs "https://c61.stream.rackcdn.com"
     *
     *
     * @return string
     * @throws \OpenStackStorage\Exceptions\ContainerNotPublic
     */
    public function getPublicStreamingUri()
    {
        if (!$this->isPublic()) {
            throw new Exceptions\ContainerNotPublic();
        }

        return $this->cdnStreamingUri;
    }

    /**
     * Return an \OpenStackStorage\Object instance, creating it if necessary.
     *
     * When passed the name of an existing object, this method will
     * return an instance of that object, otherwise it will create a
     * new one
     *
     * @param  string                   $name
     * @return \OpenStackStorage\Object
     */
    public function createObject($name)
    {
        return new Object($this, $name);
    }

    /**
     * Return an \OpenStackStorage\Object instance for an existing storage object.
     *
     * @param  string                                    $name
     * @return \OpenStackStorage\Object
     * @throws \OpenStackStorage\Exceptions\NoSuchObject
     */
    public function getObject($name)
    {
        return new Object($this, $name, true);
    }

    /**
     * Permanently remove a storage object.
     *
     * @param string|\OpenStackStorage\Object $name
     */
    public function deleteObject($name)
    {
        if (is_object($name) && $name instanceof Object) {
            $name = $name->getName();
        }

        $this->connection->makeRequest(Client::DELETE, array($this->name, $name));
    }

    /**
     * Return array with objects of container.
     *
     * @see \OpenStackStorage\Container::$allowedParameters
     * @param  array                      $parameters
     * @return \OpenStackStorage\Object[]
     */
    public function getObjects(array $parameters = array())
    {
        $objects = array();

        foreach ($this->getObjectsInfo($parameters) as $record) {
            $objects[] = new Object($this, null, false, $record);
        }

        return $objects;
    }

    /**
     * Return information about objects in container.
     *
     * @see \OpenStackStorage\Container::$allowedParameters
     * @param  array $parameters
     * @return array
     */
    public function getObjectsInfo(array $parameters = array())
    {
        $parameters['format'] = 'json';

        return $this->getObjectsRawData($parameters);
    }

    /**
     * Return names of objects in container.
     *
     * @see \OpenStackStorage\Container::$allowedParameters
     * @param  array $parameters
     * @return array
     */
    public function getObjectsList(array $parameters = array())
    {
        $parameters['format'] = 'plain';

        return array_filter(explode("\n", trim($this->getObjectsRawData($parameters))));
    }

    /**
     * Return a raw response string with information about container objects.
     *
     * @see \OpenStackStorage\Container::$allowedParameters
     * @param  array  $parameters
     * @return string
     */
    protected function getObjectsRawData(array $parameters = array())
    {
        $cacheKey = md5(json_encode(array($this->getName(), $parameters)));

        if (!array_key_exists($cacheKey, self::$listObjectsCache)) {
            $tmp = array();

            foreach ($parameters as $k => $v) {
                if (in_array($k, self::$allowedParameters)) {
                    $tmp[$k] = $v;
                }
            }

            $response = $this->connection->makeRequest(Client::GET, array($this->name), array(), $tmp);
            self::$listObjectsCache[$cacheKey] = $response['body'];
        }

        return self::$listObjectsCache[$cacheKey];
    }
}


text:
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;

namespace Content.Client.Utility
{
    [PublicAPI]
    public static class ResourceCacheExtensions
    {
        public static Texture GetTexture(this IResourceCache cache, ResourcePath path)
        {
            return cache.GetResource<TextureResource>(path);
        }

        public static Texture GetTexture(this IResourceCache cache, string path)
        {
            return GetTexture(cache, new ResourcePath(path));
        }

        public static Font GetFont(this IResourceCache cache, ResourcePath path, int size)
        {
            return new VectorFont(cache.GetResource<FontResource>(path), size);
        }

        public static Font GetFont(this IResourceCache cache, string path, int size)
        {
            return cache.GetFont(new ResourcePath(path), size);
        }
    }
}


text:
package de.omnikryptec.resource;

public class FontCharacter {
    private int id;
    private float xTextureCoord;
    private float yTextureCoord;
    private float xMaxTextureCoord;
    private float yMaxTextureCoord;
    private float xOffset;
    private float yOffset;
    private float sizeX;
    private float sizeY;
    private float xAdvance;

    /**
     * @param id            - the ASCII value of the character.
     * @param xTextureCoord - the x texture coordinate for the top left corner of
     *                      the character in the texture atlas.
     * @param yTextureCoord - the y texture coordinate for the top left corner of
     *                      the character in the texture atlas.
     * @param xTexSize      - the width of the character in the texture atlas.
     * @param yTexSize      - the height of the character in the texture atlas.
     * @param xOffset       - the x distance from the curser to the left edge of the
     *                      character's quad.
     * @param yOffset       - the y distance from the curser to the top edge of the
     *                      character's quad.
     * @param sizeX         - the width of the character's quad in screen space.
     * @param sizeY         - the height of the character's quad in screen space.
     * @param xAdvance      - how far in pixels the cursor should advance after
     *                      adding this character.
     */
    protected FontCharacter(int id, float xTextureCoord, float yTextureCoord, float xTexSize, float yTexSize,
            float xOffset, float yOffset, float sizeX, float sizeY, float xAdvance) {
        this.id = id;
        this.xTextureCoord = xTextureCoord;
        this.yTextureCoord = yTextureCoord;
        this.xOffset = xOffset;
        this.yOffset = yOffset;
        this.sizeX = sizeX;
        this.sizeY = sizeY;
        this.xMaxTextureCoord = xTexSize + xTextureCoord;
        this.yMaxTextureCoord = yTexSize + yTextureCoord;
        this.xAdvance = xAdvance;
    }

    @Override
    public int hashCode() {
        return this.id;
    }

    protected int getAscii() {
        return id;
    }

    public float getTextureCoordX() {
        return xTextureCoord;
    }

    public float getTextureCoordY() {
        return yTextureCoord;
    }

    public float getTextureCoordMaxX() {
        return xMaxTextureCoord;
    }

    public float getTextureCoordMaxY() {
        return yMaxTextureCoord;
    }

    public float getOffsetX() {
        return xOffset;
    }

    public float getOffsetY() {
        return yOffset;
    }

    public float getSizeX() {
        return sizeX;
    }

    public float getSizeY() {
        return sizeY;
    }

    public float getCursorAdvanceX() {
        return xAdvance;
    }

}


text:
package builder;

public class Dog {
    private String name;
    private int age;
    private boolean healty;

    private Dog(final Builder builder) {
        this.name = builder.name;
        this.age = builder.age;
        this.healty = builder.healty;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public boolean isHealty() {
        return healty;
    }

    public static class Builder {
        private String name;
        private int age;
        private boolean healty;

        public Builder(final String name) {
            this.name = name;
        }

        public Builder age (final int age){
            this.age = age;
            return this;
        }

        public Builder healty (final boolean healty){
            this.healty = healty;
            return this;
        }

        public Dog build(){
            return  new Dog(this);
        }
    }
    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", healty=" + healty +
                '}';
    }
}