text:
[![Build Status](https://travis-ci.org/terikon/marker-animate-unobtrusive.svg?branch=master)](https://travis-ci.org/terikon/marker-animate-unobtrusive)

Enables a Google Maps marker to move from its original position to its destination in a natural, animated way
(unlike the current method of suddenly appearing on the destination spot). Please click on the map below in order to see
how it works. Select destination on the map to move marker to.

[![alt tag](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/SlidingMarker.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/markermove-sliding.html)

It can work in two modes.

- In one mode, you create SlidingMarker instead of google.maps.Marker. SlidingMarker inherits google's
marker, so working with it is pretty straight-forward.

- In other mode, SlidingMarker replaces google.maps.Marker with itself, so you just can just forget about it and enjoy
nice and smooth movement of all of your markers.

In both cases, animated and non-animated marker will behave exactly the same.

marker.getPosition() will always return final destination of marker, and position_changed event will only trigger when
movement starts. That's why it called unobtrusive - your current code will not even notice animation, it's completely
transparent.

SlidingMarker is a complete rewrite of markerAnimateUnobtrusive library, with much-much more features and greatly improved
architecture.

# Table of contents

- [Install](#install)
- [Use](#use)
- [Demo](#demo)
- [API](#api)
- [AMD](#amd)
- [MarkerWithGhost](#markerwithghost)
- [Integration with OverlappingMarkerSpiderfier](#integration-with-overlappingmarkerspiderfier)
- [Under the hood](#under-the-hood)
- [Things to consider for future versions](#things-to-consider-for-future-versions)
- [Contribute](#contribute)

This project is based on excellent [marker-animate](https://github.com/combatwombat/marker-animate) project by Robert Gerlach.

This project is one big step towards animated [OverlappingMarkerSpiderfier](https://github.com/jawj/OverlappingMarkerSpiderfier).

# Install

## with bower

```
bower install marker-animate-unobtrusive
```

## include on page

Download **SlidingMarker.js**
[minified](https://raw.githubusercontent.com/terikon/marker-animate-unobtrusive/master/dist/SlidingMarker.min.js) or
[debug](https://raw.githubusercontent.com/terikon/marker-animate-unobtrusive/master/SlidingMarker.js)
from Github, and include it in your page.

SlidingMarker depends on Google Maps and [jquery](http://jquery.com/download) libraries, so include them as well.

jquery.easing may be downloaded from [here](http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js).

Download marker-animate [from here](https://raw.githubusercontent.com/combatwombat/marker-animate/master/markerAnimate.js).

So dependencies look like follows:

```html
<!-- Dependencies -->

<!-- jquery library and jquery.easing plugin are needed -->
<script src="jquery.min.js"></script>
<script src="jquery.easing.1.3.js"></script>

<!-- we provide marker for google maps, so here it comes  -->
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>

<!-- we use markerAnimate to actually animate marker -->
<script src="markerAnimate.js"></script>

<!-- SlidingMarker hides details from you - your markers are just animated automagically -->
<script src="SlidingMarker.min.js"></script>
```
Note: [jQuery](http://jquery.com/download) is soft dependency, you can prefer not to include it. But if you decide not to,
you should provide [alternative animation routine](#SlidingMarker.options.animateFunctionAdapter), and should not include
jquery.easing and markerAnimate libraries.

All needed dependencies are in [vendor](https://github.com/terikon/marker-animate-unobtrusive/tree/master/vendor) folder.

## with npm

```
npm install marker-animate-unobtrusive
```

The library is compatible with [NW.js](http://nwjs.io). Use it following way:

```html
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
  global.google = google;
</script>
<script type="text/javascript" src="app.js"></script>
```

```js
var SlidingMarker = require('marker-animate-unobtrusive');
var marker = new SlidingMarker();
```

# Use

## locally

When you create marker, instantiate SlidingMarker instance with same parameter you used to instantiate google.maps.Marker:

```js
//old code
//var marker = new google.maps.Marker();

//new code
var marker = new SlidingMarker();
```

## globally

If you want to make all markers on map animate, first of all, call SlidingMarker.initializeGlobally() method.
Do it as soon as SlidingMarker script loads, before any other script:

```html
<script src="SlidingMarker.min.js"></script>
<script>
  SlidingMarker.initializeGlobally();
</script>
```

That's it. Now all marker movements will be animated, e.g. :

```js
var marker = new google.maps.Marker();
...
marker.setPosition(latLng); //Will cause smooth animation
```

# API

**SlidingMarker** object that inherits google.maps.Marker is created in global scope (on injected with [AMD](#amd)), with following method in it:

[SlidingMarker.initializeGlobally()](#SlidingMarker.initializeGlobally) when called, replaces google.maps.Marker with SlidingMarker, so all
markers of google maps will be animated.

SlidingMarker has all the events, methods and options of google.maps.Marker - that's its beauty.

- **getPosition()** function returns discrete position, instead of animated one. That means that when one calls setPosition()
and animation is in place, getPosition() will return final position instead of intermediate. Use
[getAnimationPosition()](#getAnimationPosition) to retrieve intermediate position.

- **position_changed** event will be raised one time per call to setPosition(), even when animation is in place. To receive
updates on animated movement, use [animationposition_changed](#animationposition_changed) event.

In addition, following options are supported to fine-tune animation for each marker:

- **easing** - "easeInOutQuint" by default. Possible values are same as in
[jquery.easing](http://gsgd.co.uk/sandbox/jquery/easing/) library.
- **duration** - in ms, 1000 by default.

- **animateFunctionAdapter** - by default, SlidingMarker assumes that google.maps.Marker.prototype is enhanced with animateTo method, but you can provide alternative animation adapter. It should be function with following declaration:
animateFunctionAdapter(marker, destPosition, easing, duration). If destPosition provided is null, adapter should stop animation.

Example:

```js
var marker = new SlidingMarker({
    position: myLatlng,
    map: map,
    title: "I'm sliding marker",
    duration: 2000,
    easing: "easeOutExpo"
});
...
// use marker as ordinal google map's marker.
// few animation customizations are also possible.
marker.setDuration(1000);
```

There are few additions to SlidingMarker instance:

[setDuration(duration)](#SlidingMarker.setDuration) sets duration of animation for marker, in ms.

[getDuration()](#SlidingMarker.getDuration) returns duration of animation.

[setEasing(easing)](#SlidingMarker.setEasing) sets easing type of animation.

[getEasing()](#SlidingMarker.getEasing) return easing type.

[getAnimationPosition()](#SlidingMarker.getAnimationPosition) returns position of animated marker.

[setPositionNotAnimated(position)](#SlidingMarker.setPositionNotAnimated) performs original not animated setPosition() on marker.

[animationposition_changed](#SlidingMarker.animationposition_changed) event is raised when position of visible animated marker changes.

# Demo

Demos reside in [demo](https://github.com/terikon/marker-animate-unobtrusive/tree/master/demo) folder.

In following demo you can see that position_changed is called in natural way. Click any point on map to see marker move.

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/SlidingMarker.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/markermove-sliding.html)

You can use SlidingMarker with other libraries that enhance original marker, like
[MarkerWithLabel](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerwithlabel/docs/reference.html) or
[Geolocation Marker](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/geolocationmarker/docs/reference.html).

It can be used with [OverlappingMarkerSpiderfier](https://github.com/jawj/OverlappingMarkerSpiderfier) as well:

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/oms.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/map-oms-animate.html)

Here is animated MarkerWithLabel for a first time:

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/markerWithLabel.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/markerwithlabelmove-sliding.html)

Here is animated version of Geolocation Marker:

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/geolocationmarker.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/geolocationmarker-sliding.html)

It can be used with InfoWindow:

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/infowindow.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/markermove-infowindow.html)

This demonstrates [MarkerWithGhost](#markerwithghost). Click on map to call setPosition. Right-click to call setGhostPosition.
Only the "ghost" will move, causing no events.

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/SlidingMarker.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/markermove-withghost.html)

Sometimes libraries should be slightly modified to make use of animation. Animated versions of MarkerWithLabel and
Geolocation Marker are in [vendor](https://github.com/terikon/marker-animate-unobtrusive/tree/master/vendor) folder.

# AMD

marker-animate-unobtrusive can be used with [requirejs](http://requirejs.org/).

'jquery' library should be configured with requirejs. marker-animate should be configured as well.

```js
requirejs.config({
  shim: {
    "jquery-easing": ["jquery"],
    "marker-animate": { deps: ["jquery-easing"] }
  }
});
```

The usage is simple:

```js
define(['SlidingMarker'], function (SlidingMarker) {
	//Use it here
}
```

# MarkerWithGhost

In addition to SlidingMarker, you can use MarkerWithGhost class. It useful in less scenarios. Example scenario is usage
with [OverlappingMarkerSpiderfier](https://github.com/jawj/OverlappingMarkerSpiderfier).

MarkerWithGhost provides "ghost" mode. When this mode active, the marker moves as usual, but fires no position_changed
events. It's position returned by getPosition method will not change either.

Ghost mode is activated by calling setGhostPosition method. It will deactivate as soon as you call to plain setPosition().

Ghost will move always and provide ghostPosition property, as well as ghostposition_changed event. When not in "ghost mode",
it will move with marker. When "ghost mode" is active, the ghost will move instead of marker.

## API of MarkerWithGhost

MarkerWithGhost inherits SlidingMarker.

[MarkerWithGhost.initializeGlobally()](#MarkerWithGhost.initializeGlobally) works just as [same method](#SlidingMarker.initializeGlobally)
of SlidingMarker.

### instance methods

[setGhostPosition(ghostPosition)](#MarkerWithGhost.setGhostPosition) starts "ghost mode". Marker moves to provided position,
but will not fire position_changed event, and it's position property will not change. To exit "ghost" mode call setPosition().

[getGhostPosition()](#MarkerWithGhost.getGhostPosition) returns position of ghost. If not in ghost mode, it will be equal to
position property.

[getGhostAnimationPosition()](#MarkerWithGhost.getGhostAnimationPosition) return animation position of ghost. If not in
ghost mode, it will be equal to animationPosition property.

### events

[ghostposition_changed](#MarkerWithGhost.ghostposition_changed) fires as position of ghost changes. If not in ghost mode,
it still will fire.

[ghostanimationposition_changed](#MarkerWithGhost.ghostanimationposition_changed) fires as animationPosition of ghost
changes. If not in ghost mode, it still will fire.

# Integration with OverlappingMarkerSpiderfier

It's possible to add animation to glorious [OverlappingMarkerSpiderfier](https://github.com/jawj/OverlappingMarkerSpiderfier)
project by George MacKerron. You can see a demo here, just click a bunch of markers to see them move:

[![alt unobtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/oms.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/unobtrusive/map-oms-animate.html)

*Declaimer: I think this demo is one of few things one can stare are indefinitely, along with classic Windows Defragmenter and Mac
minimize animation :)*

To achieve this, slightly modified version of oms.js was used that you can find in
[vendor folder](https://github.com/terikon/marker-animate-unobtrusive/tree/master/vendor), or
in [this github fork](https://github.com/viskin/OverlappingMarkerSpiderfier/tree/animation).

For curious ones, the trick to make OverlappingMarkerSpiderfier support animation is to use [MarkerWithGhost](#markerwithghost) instead
of plain google.maps.Marker, and make oms.js call ghosted properties, e.g. to getGhostPosition() instead of
getPosition().

Additional bonus arises from using MarkerWithGhost, and it is that no unnecessary position_changed events are triggered
when spiderfying occurs. For you, getPostion on your marker will return its actual position, and will not be effected by spiderfier.

# Under the hood

## Imperfection of marker-animate

Here's demonstration of difficulties we met with original [marker-animate](https://github.com/combatwombat/marker-animate) library.

- With it you should call animateTo() method instead of usual setPosition(). We wanted fire-and-forget functionality,
so all markers will just animate.
- Huge issue is that original library causes masses of position_changed event while marker is being animated. You can see it in this demo (of original library), with large amount of position_changed event occur:

[![alt obtrusive](http://terikon.github.io/marker-animate-unobtrusive/demo/screenshots/obtrusive.jpg)](http://terikon.github.io/marker-animate-unobtrusive/demo/obtrusive/markermove-obtrusive.html)

- While marker moves in original library, it reports its intermediate position when getPosition() called. If we call
marker.setPosition(point), we want to receive the point from marker.getPosition(), and not some useless animation state.

These facts prevents marker-animate from usage with other libraries that depend on markers.

## Architecture of SlidingMarker

The solution was to use decorator pattern. SlidingMarker inherits google.maps.Marker, so it can be used anywhere just like
google.maps.Marker itself. For example, following is true:

```js
SlidingMarker instanceof google.maps.Marker // true
```

But this marker is never attached to the map, even if you call marker.setMap(map). Instead, there's another visible marker,
called _instance, that is attached to the map. You work directly with marker, and every operation you perform on marker is
redirected to _instance. For example, getMap() method called on marker will call getMap() on _instance .

Every user event, like click, that triggers on visible _instance marker is redirected back to marker itself.

This way animation that occur on visible _instance does not interfere with invisible marker that you work with.

So, storing SlidingMarker takes *2 memory than storing instance of google.maps.Marker.

# Things to consider for future versions

- ~~ Make it possible to use any easing library, not just jquery_easing ~~
- Make it possible to restore google maps to original state after initializeGlobally() called.
- Make it possible to stop animation. Animation should stop as well when setPositionNotAnimated is called.
- Improve speed.
- Provide support for alternative animation engine, e.g. [Velocity](http://julian.com/research/velocity/).
- Compile with closure-compiler. Annotations are already provided at [annotations folder](https://github.com/terikon/marker-animate-unobtrusive/tree/master/annotations).

# Contribute

Use [GitHub issues](https://github.com/terikon/marker-animate-unobtrusive/issues) and [Pull Requests](https://github.com/terikon/marker-animate-unobtrusive/pulls).

Ideas are welcome as well :)

To build:

    npm run build

Before committing, please run jshint:

    npm run jshint

To run tests:

    npm run test

Tests reside in [tests/spec](https://github.com/terikon/marker-animate-unobtrusive/tree/master/tests/spec) folder.

Tests are also runnable in browser and debuggable with [tests/SpecRunner.html](
<https://github.com/terikon/marker-animate-unobtrusive/tree/master/tests/SpecRunner.html>).


text:
module Ruconomic
  module API
    module ProductPrice
      extend Ruconomic::WebService

      # Creates a new product price from a data object.
      # Parameters: data: The data object that specifies the properties of the new product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_CreateFromData
      # @return [Hash] The body content of the SOAP response.
      def self.create_from_data
        response = invoke('ProductPrice_CreateFromData') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Creates new product prices from data objects.
      # Parameters: dataArray: The array of data objects that specifies the properties of the new product prices.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_CreateFromDataArray
      # @return [Hash] The body content of the SOAP response.
      def self.create_from_data_array
        response = invoke('ProductPrice_CreateFromDataArray') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Update product price entities from data objects.
      # Parameters: dataArray: The array of data objects.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_UpdateFromDataArray
      # @return [Hash] The body content of the SOAP response.
      def self.update_from_data_array
        response = invoke('ProductPrice_UpdateFromDataArray') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Updates a product price from a data object.
      # Parameters: data: The data object.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_UpdateFromData
      # @return [Hash] The body content of the SOAP response.
      def self.update_from_data
        response = invoke('ProductPrice_UpdateFromData') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Returns an product price data object for a given product price.
      # Parameters: entityHandle: A handle for the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_GetData
      # @return [Hash] The body content of the SOAP response.
      def self.get_data
        response = invoke('ProductPrice_GetData') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Returns product price data objects for a given set of product price handles.
      # Parameters: entityHandles: An array of the product price handles.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_GetDataArray
      # @return [Hash] The body content of the SOAP response.
      def self.get_data_array
        response = invoke('ProductPrice_GetDataArray') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Creates a new product price.
      # Parameters: product: Handle for the product of the new product price. currency: Handle for the currency of the new product price. price: The price of the new product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_Create
      # @return [Hash] The body content of the SOAP response.
      def self.create
        response = invoke('ProductPrice_Create') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Returns a handle for the product price for a given product and currency.
      # Parameters: product: Product to search for. currency: Currency to search for.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_FindByProductAndCurrency
      # @return [Hash] The body content of the SOAP response.
      def self.find_by_product_and_currency
        response = invoke('ProductPrice_FindByProductAndCurrency') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Deletes a product price.
      # Parameters: productPriceHandle: Handle for the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_Delete
      # @return [Hash] The body content of the SOAP response.
      def self.delete
        response = invoke('ProductPrice_Delete') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Gets a handle for the product of a product price.
      # Parameters: productPriceHandle: Handle for the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_GetProduct
      # @return [Hash] The body content of the SOAP response.
      def self.get_product
        response = invoke('ProductPrice_GetProduct') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Gets a handle for the currency of a product price.
      # Parameters: productPriceHandle: Handle for the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_GetCurrency
      # @return [Hash] The body content of the SOAP response.
      def self.get_currency
        response = invoke('ProductPrice_GetCurrency') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Gets the price of a product price.
      # Parameters: productPriceHandle: Handle for the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_GetPrice
      # @return [Hash] The body content of the SOAP response.
      def self.get_price
        response = invoke('ProductPrice_GetPrice') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

      # Sets the price of a product price.
      # Parameters: productPriceHandle: Handle for the product price. value: The new price of the product price.
      #
      # @note TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
      # @see https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?op=ProductPrice_SetPrice
      # @return [Hash] The body content of the SOAP response.
      def self.set_price
        response = invoke('ProductPrice_SetPrice') do |message|
          raise "TODO: This method was autogenerated from the WSDL - see https://github.com/coherify/ruconomic#contributing"
        end
      end

    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
require 'net/http'
require 'uri'
require 'fileutils'
require 'thor'
require 'streamio'
require 'ruby-progressbar'
require 'streamio-cli/version'

module Streamio::CLI
  class SlowDownloadError < StandardError
  end

  class App < Thor
    desc "export", "export data from target account"
    method_option :username, :desc => 'api username', :aliases => '-u', :required => true
    method_option :password, :desc => 'api password', :aliases => '-p', :required => true
    method_option :include_transcodings, :aliases => '-i', :type => :boolean
    def export
      configure_streamio_gem
      download_videos
      download_audios
      puts "\nAll files successfully downloaded!"
    rescue Streamio::Errors::Unauthorized
      puts "[ERROR]"
      puts "Wrong username or password, please double check that the credentials provided are the same as on your API page on streamio.com."
      exit
    rescue SocketError
      puts "[ERROR]"
      puts "Could not connect to the internet, please check your connection and try again."
      exit
    end

    private
     def configure_streamio_gem
      Streamio.configure do |c|
        c.username = options[:username]
        c.password = options[:password]
        c.skip_ssl_verification = true # to support windows clients etc
      end
    end

    def download_videos
      number_of_items = ::Streamio::Video.count
      current_item = 0
      requests_needed = (number_of_items / 100) + 1

      requests_needed.times do |i|
        ::Streamio::Video.all(:skip => i * 100, :limit => 100).each do |video|
          current_item += 1
          puts "\nVideo #{current_item} / #{number_of_items} - #{video.title} - #{video.id}"

          path = FileUtils.mkdir_p("streamio-export/videos/#{video.id}").first
          progress_bar_title = "Original (#{bytes_to_megabytes(video.original_video['size'])})"
          File.open("#{path}/#{video.id}.json", "w:utf-8") { |file| file.write(MultiJson.dump(video.attributes)) }
          download("http://#{video.original_video['http_uri']}", path, progress_bar_title)

          next unless options[:include_transcodings]

          video.transcodings.each do |transcoding|
            progress_bar_title = "#{transcoding['title']} (#{bytes_to_megabytes(transcoding['size'])})"
            download("http://#{transcoding['http_uri']}", path, progress_bar_title)
          end
        end
      end
    end

    def download_audios
      number_of_items = ::Streamio::Audio.count
      current_item = 0
      requests_needed = (number_of_items / 100) + 1

      requests_needed.times do |i|
        ::Streamio::Audio.all(:skip => i * 100, :limit => 100).each do |audio|
          current_item += 1
          puts "\nAudio #{current_item} / #{number_of_items}: #{audio.title}"

          path = FileUtils.mkdir_p("streamio-export/audios/#{audio.id}").first
          progress_bar_title = "Original (#{bytes_to_megabytes(audio.original_file['size'])})"
          File.open("#{path}/#{audio.id}.json", "w:utf-8") { |file| file.write(MultiJson.dump(audio.attributes)) }
          download("http://#{audio.original_file['http_uri']}", path, progress_bar_title)
        end
      end
    end

    def bytes_to_megabytes(bytes)
      megabytes = bytes / 1048576.0
      "%.1fMB" % [megabytes]
    end

    def download(url, path, progress_bar_title)
      uri = URI.parse(url)
      filename = "#{path}/#{File.basename(uri.path)}"
      http = Net::HTTP.new(uri.host, uri.port)
      size = http.request_head(uri.path)['Content-Length'].to_i
      bytes_loaded = File.exist?(filename) ? File.size(filename) : 0

      if size == bytes_loaded
        puts "  #{progress_bar_title}: Already downloaded..."
        return
      end

      progress_bar = ProgressBar.create(
        :title => "  #{progress_bar_title}",
        :starting_at => 0,
        :total => size,
        :format => "%t: |%B| %P%"
      )

      waiting_for_speed_test = true
      start_time = nil
      http.request_get(uri.path) do |response|
        File.open(filename, "wb") do |file|
          response.read_body do |data|
            progress_bar.progress += data.length
            file << data

            if waiting_for_speed_test
              start_time ||= Time.now
              bytes_loaded_since_connection = progress_bar.progress
              if bytes_loaded_since_connection > 524288
                waiting_for_speed_test = false
                seconds_taken = Time.now - start_time
                bytes_per_second = bytes_loaded_since_connection / seconds_taken
                raise SlowDownloadError if bytes_per_second < 65536
              end
            end
          end
        end
      end
    rescue SlowDownloadError, Timeout::Error => e
      http.finish if http.started?
      progress_bar.stop
      if e.class == SlowDownloadError
        puts "  Slow download detected - retrying!"
      else
        puts "  Download timed out - retrying!"
      end
      retry
    end
  end
end

Streamio::CLI::App.start


text:
package storm.trident.planner;

import backtype.storm.tuple.Fields;
import java.io.Serializable;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class Node implements Serializable {
    private static AtomicInteger INDEX = new AtomicInteger(0);

    private String nodeId;

    public String name = null;
    public Fields allOutputFields;
    public String streamId;
    public Integer parallelismHint = null;
    public NodeStateInfo stateInfo = null;
    public int creationIndex;

    public Node(String streamId, String name, Fields allOutputFields) {
        this.nodeId = UUID.randomUUID().toString();
        this.allOutputFields = allOutputFields;
        this.streamId = streamId;
        this.name = name;
        this.creationIndex = INDEX.incrementAndGet();
    }

    @Override
    public boolean equals(Object o) {
        return nodeId.equals(((Node) o).nodeId);
    }

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

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

}


text:
module Contentful
  module Management
    module Resource
      # Adds metadata logic for [Resource] classes
      module Metadata
        # Returns the metadata hash
        attr_reader :_metadata

        # @private
        def initialize(object = nil, *)
          super
          @_metadata = {}
          extract_metadata_from_object! object if object
        end

        # @private
        def inspect(info = nil)
          if _metadata.empty?
            super(info)
          else
            super("#{info} @_metadata=#{_metadata.inspect}")
          end
        end

        private

        def extract_metadata_from_object!(object)
          return unless object.key?('metadata')
          object['metadata'].each do |key, value|
            @_metadata[key.to_sym] = if key == 'tags'
                                       coerce_tags(value)
                                     else
                                       value
                                     end
          end
        end

        def coerce_tags(tags)
          tags.map { |tag| Contentful::Management::Link.new(tag) }
        end
      end
    end
  end
end


text:
module JacintheManagement
  module Selectors
    # selectors for the Selector GUI
    class Selector
      @year = Time.now.year
      @month = Time.now.month

      # @return [Range] back years to put in menu
      def self.range_for_month
        case @month
        when 1..3
          (0..2)
        when 4..9
          (0..1)
        when 10..12
          (-1..1)
        end
      end

      # @param [Boolean] complex type of menu
      # @return [Array<String>] menu items
      def self.year_choice(complex)
        range = range_for_month
        simple = range.each.map do |val|
          "= #{@year - val}"
        end
        complex ? simple << "<= #{@year - range.end - 1}" : simple
      end

      # @param [Path] path path of file to read selector from
      # @return [Selector] selector read from the given file
      def self.from_file(path)
        new(YAML.load_file(path))
      end

      attr_reader :name, :description, :command_name
      attr_reader :table

      # @param [Hash] hsh Hash of instance initial values
      # @return [Selector] a new instance
      def initialize(hsh)
        hsh.each_pair do |key, value|
          # self.attr_accessor key.to_sym
          instance_variable_set("@#{key}", value)
          # define_method key.to_sym { instance_variable_get :"@#{key}"}
        end
      end

      # @api
      # @return [Array<String>] Parameters to be shown in GUI
      def parameter_list
        @parameters ? @parameters.keys : nil
      end

      # @api
      # @param [String] query generic query with parameters
      # @param [Array] values transmitted by the GUI
      # @return [Array<String>] edited SQl answer
      def ask_sql(query, values)
        qry = parameter(query, values)
        Formatters.fetch_list(qry)
      end

      # @api
      # @return [HTML String] edited message for GUI
      # @param [Array] values transmitted by the GUI
      def creation_message(values)
        _, call, condition = extract(values)
        par = "Paramètre : #{call}." if call
        ann = "Année de référence #{condition.sub('<=', '≤')}." if @years
        text = 'Vous pouvez créer la sélection.'
        [par, ann, text].compact.join('
')
      end

      # @api
      # @return [HTML String] message (when selector includes a command)
      def command_message
        ['Vous pouvez tout aussi bien :
',
         '
router
',
         "
lancer la commande par le bouton '#{command_name}'
",
         '
 lancer la commande, puis router
',
         '
router, puis lancer la commande

'].join
      end

      # @api
      # Build the tiers_list
      #
      # @param [Array] values transmitted by the GUI
      # @return [Fixnum] number of content lines (excluding field names line)
      def build_selection(values)
        answer = ask_sql(@query, values)
        @table = Table.from_sql(answer)
      end

      # @api
      # @param [Array] values transmitted by the GUI
      # @return [String] report
      # @param [Array] tiers_list list of tiers_id's
      def execute(values, tiers_list)
        cmds = command(values, tiers_list)
        Sql.query(JACINTHE_MODE, cmds.join(';'))
        'Commande exécutée'
      end

      # private from here

      # @return [Array<String>] menu for the @years choice
      def year_choice
        case @years
        when 'complex'
          Selector.year_choice(true)
        when 'simple'
          Selector.year_choice(false)
        end
      end

      # @param [Array] values transmitted by the GUI
      # @return [Array] formatted parameters
      def extract(values)
        indx, condition = *values
        return [nil, nil, condition] if indx < 0
        parameter = @parameters.values[indx]
        call = @parameters.keys[indx]
        [parameter, call, condition]
      end

      # @param [String] query generic query with parameters
      # @param [Array] values transmitted by the GUI
      # @return [String] actual query
      def parameter(query, values)
        parameter, _, condition = extract(values)
        qry = parameter ? query.gsub('PARAM', parameter.to_s) : query
        condition ? qry.gsub('CONDITION', condition) : qry
      end

      # @param [Array] values transmitted by the GUI
      # @return [String] actual query of command
      def command(values, tiers_list)
        qry = parameter(@command_query, values)
        tiers_list.map do |tiers_id|
          qry.sub('TIERS_ID', tiers_id)
        end
      end
    end
  end
end


text:
package fr.openwide.core.wicket.more.console.maintenance.upgrade.page;

import org.apache.wicket.RestartResponseException;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import fr.openwide.core.wicket.more.console.maintenance.template.ConsoleMaintenanceTemplate;
import fr.openwide.core.wicket.more.console.maintenance.upgrade.component.DataUpgradePanel;
import fr.openwide.core.wicket.more.console.template.ConsoleTemplate;

public class ConsoleMaintenanceDonneesPage extends ConsoleMaintenanceTemplate {

	private static final long serialVersionUID = -6149952103369498125L;

	public ConsoleMaintenanceDonneesPage(PageParameters parameters) {
		super(parameters);

		if (dataUpgradeService == null) {
			throw new RestartResponseException(getMenuSectionPageClass());
		}

		addHeadPageTitleKey("console.maintenance.donnees");

		add(new DataUpgradePanel("dataUpgradesPanel"));
	}

	@Override
	protected Class<? extends ConsoleTemplate> getMenuItemPageClass() {
		return ConsoleMaintenanceDonneesPage.class;
	}
}


text:
package mx.udlap.is522.tedroid.data.dao;

import static org.fest.assertions.api.Assertions.assertThat;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;

import mx.udlap.is522.tedroid.data.Score;
import mx.udlap.is522.tedroid.data.dao.impl.DAOFactory;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

@RunWith(RobolectricTestRunner.class)
public class ScoreSpecialDAOTest {

    private ScoreDAO scoreDAO;

    @Before
    public void setUp() throws Exception {
        scoreDAO = new DAOFactory(Robolectric.application).getScoreSpecialDAO();
        assertThat(scoreDAO).isNotNull();
    }

    @Test
    public void shouldPersist() throws Exception {
        Score newScore = new Score();
        newScore.setLevel(5);
        newScore.setLines(54);
        newScore.setPoints(27442346);

        shouldPersist(newScore);
    }

    @Test
    public void shouldDeleteAll() throws Exception {
        Score score1 = new Score();
        score1.setLevel(5);
        score1.setLines(54);
        score1.setPoints(27442346);

        Score score2 = new Score();
        score2.setLevel(6);
        score2.setLines(65);
        score2.setPoints(453543678);

        Score score3 = new Score();
        score3.setLevel(2);
        score3.setLines(21);
        score3.setPoints(456456);

        shouldPersist(score1, score2, score3);

        scoreDAO.deleteAll();
        List<Score> all = scoreDAO.readAllOrderedByPointsDesc();
        assertThat(all).isNotNull().isEmpty();
    }

    @Test
    public void shouldSumCorrectly() throws Exception {
        Score score1 = new Score();
        score1.setLevel(5);
        score1.setLines(54);
        score1.setPoints(27442346);

        Score score2 = new Score();
        score2.setLevel(6);
        score2.setLines(65);
        score2.setPoints(453543678);

        Score score3 = new Score();
        score3.setLevel(2);
        score3.setLines(21);
        score3.setPoints(456456);

        shouldPersist(score1, score2, score3);

        int expectedPointsSum = score1.getPoints() + score2.getPoints() + score3.getPoints();
        int expectedLinesSum = score1.getLines() + score2.getLines() + score3.getLines();

        Map<String, Integer> sums = scoreDAO.readSumOfLinesAndPoints();

        assertThat(sums.get("points_sum")).isEqualTo(expectedPointsSum);
        assertThat(sums.get("lines_sum")).isEqualTo(expectedLinesSum);
    }

    private void shouldPersist(Score... scores) throws Exception {
        List<Score> all = scoreDAO.readAllOrderedByPointsDesc();
        assertThat(all).isNotNull().isEmpty();

        for (Score score : scores) {
            scoreDAO.save(score);
            Thread.sleep(1000L);
        }

        Arrays.sort(scores, new Comparator<Score>() {

            @Override
            public int compare(Score o1, Score o2) {
                return o1.getPoints() < o2.getPoints() ? 1
                       : o1.getPoints() > o2.getPoints() ? -1
                       : 0;
            }
        });

        all = scoreDAO.readAllOrderedByPointsDesc();
        assertThat(all).isNotNull().isNotEmpty().hasSize(scores.length).doesNotContainNull();

        for (int i = 0; i < scores.length; i++) {
            assertThat(all.get(i)).isNotNull().isLenientEqualsToByIgnoringFields(scores[i], "obtainedAt");
            assertThat(all.get(i).getObtainedAt()).isNotNull();
        }
    }
}


text:
/* trailsearch.js                                                         */
/* Description: trail search engines                                      */
/* Date: 9/1/2017                                                         */
/* Author: Wallis Chau, Sangeetha Kaliaperumal, Ed Quintana, Kelly Wenzel */

//calculate route
//source could be address or coord pair e.g. (lat,lon)
//If boolShowMap is false, only check availability
//If boolShowMap is true, show map
//If transit mode is not available, check driving mode
function calcRoute(source, dest, index, boolShowMap) {
  $('#form3-panel').empty();
  $('#form3-map').empty();
  var directionsService = new google.maps.DirectionsService();
  var directionsDisplay = new google.maps.DirectionsRenderer();
  var map = new google.maps.Map(document.getElementById('form3-map'), {
    zoom: 7,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
  });
  directionsDisplay.setMap(map);
  var request = {
    origin: source,
    destination: dest,
    travelMode: google.maps.DirectionsTravelMode.TRANSIT,
  };

  directionsService.route(request, function(response, status ) {
    //don't show map
    if (!boolShowMap) {
      // console.log(response);
      console.log(status + " " + index);
      //update td-transit
      if (status == google.maps.DirectionsStatus.OK) {
          $('#row-' + index + " td.td-transit").html('YES');
          $('#row-' + index + " td.td-time").html(response.routes[0].legs[0].duration.text);
          console.log(response.routes[0].legs[0].duration);
      }
      else if (status != "OVER_QUERY_LIMIT") {
          $('#row-' + index + " td.td-transit").html('NO');
          $('#row-' + index + " td.td-time").html("N/A");
          console.error('DirectionsStatus is ' + status);
      }
      //over query limit
      else {
        console.log(index + " " + status);
      }
    } //if !boolShowMap
    //show map
    else {
      console.log('here2');
      if (status == google.maps.DirectionsStatus.OK) {
        console.log(response);
        directionsDisplay.setDirections(response);
        writeDirectionsSteps(directionsDisplay.directions.routes[0].legs[0].steps);
      }
      else { //status is not ok, change query to driving mode and search again
        request.travelMode = google.maps.DirectionsTravelMode.DRIVING,
        directionsService.route(request, function(response, status ) {
          console.log('here3');
          if (status == google.maps.DirectionsStatus.OK) {
            console.log(response);
            directionsDisplay.setDirections(response);
            writeDirectionsSteps(directionsDisplay.directions.routes[0].legs[0].steps);

          }//if
          else {
            console.error('DirectionsStatus is ' + status);
          }
        }); //.route
      } //else
    } //else
  });  //route
}//calroute

function writeDirectionsSteps(steps) {
  var directions = $('#form3-panel');
  directions.html('');
  for (var i = 0; i < steps.length; i++) {

    directions.append('
' + steps[i].instructions + '
'+ steps[i].distance.text);
    if (typeof steps[i].transit !== "undefined") {
      directions.append('
' + steps[i].transit.arrival_stop.name);
    }
  }
}


text:
import { Node } from '@babel/types';
import { Token } from '../types';

export default function getParenthesesRanges(node: Node, tokens: Array<Token>): Array<{ start: number, end: number }> {
  let leftParenTokens = [];
  let rightParenTokens = [];

  for (let i = 0; i < tokens.length; i++) {
    let token = tokens[i];
    if (token.start === node.start) {
      for (let j = i - 1; j >= 0; j--) {
        if (tokens[j].type.label === '(') {
          leftParenTokens.unshift(tokens[j]);
        } else {
          break;
        }
      }
    } else if (token.end === node.end) {
      for (let j = i + 1; j < tokens.length; j++) {
        if (tokens[j].type.label === ')') {
          rightParenTokens.push(tokens[j]);
        } else {
          break;
        }
      }
      break;
    }
  }

  if (leftParenTokens.length === 0 || leftParenTokens.length !== rightParenTokens.length) {
    return [];
  }

  return [
    {
      start: leftParenTokens[0].start,
      end: leftParenTokens[leftParenTokens.length - 1].end
    },
    {
      start: rightParenTokens[0].start,
      end: rightParenTokens[rightParenTokens.length - 1].end
    }
  ];
}


text:
"""
    Pynba
    ~~~~~

    :copyright: (c) 2015 by Xavier Barbosa.
    :license: MIT, see LICENSE for more details.
"""

from __future__ import absolute_import

from .script import ScriptMonitor

__all__ = ['ScriptMonitor']


text:
// See LICENSE.txt for license information.

namespace VictorBush.Ego.NefsEdit.Utility
{
    using System.Collections.Generic;
    using System.Windows.Forms;

    /// <summary>
    /// Extension methods for tree nodes.
    /// </summary>
    public static class TreeNodeExtensions
    {
        /// <summary>
        /// Gets all descendant nodes of a TreeNode.
        /// </summary>
        /// <remarks>See https://stackoverflow.com/questions/177277/how-to-get-a-list-of-all-child-nodes-in-a-treeview-in-net.</remarks>
        /// <param name="input">The TreeNode to get descendants off.</param>
        /// <returns>List of descendant tree nodes.</returns>
        public static IEnumerable<TreeNode> DescendantNodes(this TreeNode input)
        {
            foreach (TreeNode node in input.Nodes)
            {
                yield return node;
                foreach (var subnode in node.DescendantNodes())
                {
                    yield return subnode;
                }
            }
        }
    }
}


text:
Before deep sleeping, you will want to ensure that all messages are sent, including property values of your `HomieNode` and the `$online →  false`. To do that, you can call `Homie.prepareToSleep()`. But the event `MQTT_READY` is emitted before your `HomieNode`s `loop()` method is called. Therefore you need to postpone the call to `Homie.prepareToSleep()` until the `loop()` method of all `HomieNode`s is called and their properties are submitted over MQTT. For that the additional Timer is necessary. Then `Homie.prepareToSleep()` will disconnect everything cleanly, so that you can call `Homie.doDeepSleep()`.

```c++
#include <Homie.h>
#include "Timer.h"

Timer t;

void prepareSleep() {
  Homie.prepareToSleep();
}

void onHomieEvent(const HomieEvent& event) {
  switch(event.type) {
    case HomieEventType::MQTT_READY:
      Homie.getLogger() << "MQTT connected, preparing for deep sleep after 100ms..." << endl;
      t.after(100, prepareSleep);
      break;
    case HomieEventType::READY_TO_SLEEP:
      Homie.getLogger() << "Ready to sleep" << endl;
      Homie.doDeepSleep();
      break;
  }
}

void setup() {
  Serial.begin(115200);
  Serial << endl << endl;
  Homie.onEvent(onHomieEvent);
  Homie.setup();
}

void loop() {
  Homie.loop();
  t.update();
}
```


text:
import React from 'react'
import PropTypes from 'prop-types'
import {Link} from 'react-router-dom'

import './Artist.scss'
import Input from '../../../components/Input'

export class Artists extends React.Component {
  static propTypes = {
    filteredArtists: PropTypes.arrayOf(PropTypes.object).isRequired,
    fetching: PropTypes.bool,

    getArtists: PropTypes.func.isRequired,
    changeArtistsFilter: PropTypes.func.isRequired
  }

  componentDidMount() {
    this.props.getArtists()
    this.props.changeArtistsFilter('')
  }

  changeFilter = (newValue) => {
    this.props.changeArtistsFilter(newValue)
  }

  render() {
    return (

Artists:

        <Input onChange={this.changeFilter} />
        {this.props.fetching ? (

Loading...

        ) : (

            {this.props.filteredArtists.map(comp =>

                <Link to={`/music/libraries/${comp.library}/${comp.name}`} className='list-group-item-action'>
                  {comp.name}
                </Link>
                <button type='button' className='btn btn-def fa'
                  data-for='moreCompilationsPopup' data-click='dropdown' data-from={comp.name}>
                  ...
                </button>

            )}

        )}

    )
  }
}

export default Artists


text:
using System.Threading.Tasks;
using Fody;
using VerifyTests;
using VerifyXunit;
using Xunit;

[UsesVerify]
public class ApprovedTests
{
    static VerifySettings uniqueForRuntime;

    static ApprovedTests()
    {
        uniqueForRuntime = new VerifySettings();
        uniqueForRuntime.UniqueForRuntime();
    }

    [Fact]
    public Task ClassWithNullableContext1()
    {
        return Verifier.Verify(Decompile<ClassWithNullableContext1>(), uniqueForRuntime);
    }

    [Fact]
    public Task ClassWithNullableContext2()
    {
        return Verifier.Verify(Decompile<ClassWithNullableContext2>(), uniqueForRuntime);
    }

    [Fact]
    public Task ClassWithNullableReferenceMethod()
    {
        return Verifier.Verify(Decompile<ClassWithNullableReferenceMethod>());
    }

    [Fact]
    public Task ClassWithGenericNestedClass()
    {
        return Verifier.Verify(Decompile<ClassWithGenericNestedClass>(), uniqueForRuntime);
    }

    [Fact]
    public Task ClassWithAsyncMethods()
    {
        return Verifier.Verify(Decompile<ClassWithAsyncMethods>());
    }

    [Fact]
    public Task ClassWithRefReturns()
    {
        return Verifier.Verify(Decompile<ClassWithRefReturns>(), uniqueForRuntime);
    }

    string Decompile<T>()
    {
        return Ildasm.Decompile(typeof(T).Assembly.Location, typeof(T).Name)
            .Replace("[netstandard]", "[mscorlib]");
    }
}


text:
namespace SampleRenderer
{

static GLenum getGLPrimitive(RendererMesh::Primitive primitive)
{
	GLenum glprim = ~(GLenum)0;
	switch(primitive)
	{
		case RendererMesh::PRIMITIVE_POINTS:         glprim = GL_POINTS;         break;
		case RendererMesh::PRIMITIVE_LINES:          glprim = GL_LINES;          break;
		case RendererMesh::PRIMITIVE_LINE_STRIP:     glprim = GL_LINE_STRIP;     break;
		case RendererMesh::PRIMITIVE_TRIANGLES:      glprim = GL_TRIANGLES;      break;
		case RendererMesh::PRIMITIVE_TRIANGLE_STRIP: glprim = GL_TRIANGLE_STRIP; break;
		case RendererMesh::PRIMITIVE_POINT_SPRITES:  glprim = GL_POINTS;         break;
		default: break;
	}
	RENDERER_ASSERT(glprim != ~(GLenum)0, "Unable to find GL Primitive type.");
	return glprim;
}

static GLenum getGLIndexType(RendererIndexBuffer::Format format)
{
	GLenum gltype = 0;
	switch(format)
	{
		case RendererIndexBuffer::FORMAT_UINT16: gltype = GL_UNSIGNED_SHORT; break;
		case RendererIndexBuffer::FORMAT_UINT32: gltype = GL_UNSIGNED_INT;   break;
		default: break;
	}
	RENDERER_ASSERT(gltype, "Unable to convert to GL Index Type.");
	return gltype;
}

GLES2RendererMesh::GLES2RendererMesh(GLES2Renderer& renderer, const RendererMeshDesc &desc) :
	RendererMesh(desc), m_renderer(renderer)
{

}

GLES2RendererMesh::~GLES2RendererMesh(void)
{

}

void GLES2RendererMesh::renderIndices(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const
{
	const PxU32 indexSize = RendererIndexBuffer::getFormatByteSize(indexFormat);
	void *buffer = ((PxU8*) 0)+indexSize*firstIndex;
	glDrawElements(getGLPrimitive(getPrimitives()), numIndices, getGLIndexType(indexFormat), buffer);
}

void GLES2RendererMesh::renderVertices(PxU32 numVertices, RendererMaterial *material) const
{
	RendererMesh::Primitive primitive = getPrimitives();
	if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) glDepthMask(false);
	glDrawArrays(getGLPrimitive(primitive), 0, numVertices);
	if(primitive == RendererMesh::PRIMITIVE_POINT_SPRITES) glDepthMask(true);
	}

void GLES2RendererMesh::renderIndicesInstanced(PxU32 numVertices, PxU32 firstIndex, PxU32 numIndices, RendererIndexBuffer::Format indexFormat, RendererMaterial *material) const
{
	RENDERER_ASSERT(0, "TODO")
}

void GLES2RendererMesh::renderVerticesInstanced(PxU32 numVertices, RendererMaterial *material) const
{
	RENDERER_ASSERT(0, "TODO")
}

}
#endif // #if defined(RENDERER_ENABLE_GLES2)


text:
@import UIKit;

@implementation Utils

+ (void)showAlertWithTitle:(NSString *)title andMessage:(NSString *)message {
    [[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
}

+ (NSDate *)dateFromString:(NSString *)stringDate {
    NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
    NSDate *date = [dateFormatter dateFromString:stringDate];
    return date;
}

+ (NSString *)prettyStringFromDate:(NSDate *)date {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateStyle = NSDateFormatterLongStyle;
    return [formatter stringFromDate:date];
}

@end