text:
describe 'Import decks from the web' do

  before do
    class << self
      include CDQ
    end
    cdq.setup

    @web_timeout = 100
    @sleep_before = 10
  end

  it 'should just init the database' do
    # init database
    wait_max 1000 do
      Card.count.should > 0
    end
    DatabaseGenerator.init_database(nil) do
      true.should == true
      resume
    end
  end

  it 'should import from hearthstone-decks.com' do
    Importer.load 'http://www.hearthstone-decks.com/deck/voir/le-ladder-fun-9017' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Druid'

      @title.should == 'Le Ladder (Fun)'

      @arena.should == false
    end
  end

  it 'should import from hearthpwn.com/decks' do
    wait @sleep_before do
    end
    Importer.load 'http://www.hearthpwn.com/decks/215134-s12-legend-control-warrior' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Warrior'

      @title.should == '[S12 Legend] Control warrior'

      @arena.should == false
    end
  end

  it 'should import from hearthpwn.com/deckbuilder' do
    wait @sleep_before do
    end
    Importer.load 'http://www.hearthpwn.com/deckbuilder/warlock#43:2;73:1;94:2;122:2;153:2;264:2;360:2;372:2;482:1;500:1;503:1;542:2;573:1;673:1;683:1;7746:1;7749:2;12182:1;12227:2;12299:1' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Warlock'

      @title.should == nil

      @arena.should == false
    end
  end

  it 'should import from hearthstats.net' do
    wait @sleep_before do
    end
    Importer.load 'http://hearthstats.net/decks/hstracker-test-import' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Rogue'

      @title.should == 'HSTracker test import'

      @arena.should == false
    end
  end

  it 'should import from hearthhead.com/deck' do
    wait @sleep_before do
    end
    Importer.load 'http://www.hearthhead.com/deck=81740/handlock-mechanization' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Warlock'

      @title.should == 'Handlock Mechanization!'

      @arena.should == false
    end
  end

  it 'should import from hearthnews.fr' do
    wait @sleep_before do
    end
    Importer.load 'http://www.hearthnews.fr/decks/4096' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Druid'

      @title.should == 'Combos ClassicoClassic'

      @arena.should == false
    end
  end

  it 'should import from heartharena.com' do
    wait @sleep_before do
    end
    Importer.load 'http://www.heartharena.com/arena-run/260979' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should.not == nil
      @deck.count_cards.should == 30

      @clazz.should == 'Warrior'

      @title.should == nil

      @arena.should == true
    end
  end

  it 'should not import from www.google.be' do
    wait @sleep_before do
    end
    Importer.load 'https://www.google.be/?q=hearthstone+tracker+mac' do |deck, clazz, title, arena|
      @deck  = deck
      @clazz = clazz
      @title = title
      @arena = arena
      resume
    end
    wait_max @web_timeout do
      @deck.should == nil

      @clazz.should == nil

      @title.should == nil

      @arena.should == nil
    end
  end

end


text:
Esta é a documentação para a versão antiga do Suitup, procure utilizar a versão mais nova...

### Instalação Composer

!!! Caution
        Avoid to install this version

`composer require braghim-sistemas/suitup-php ^1`

### Estrutura do projeto
Esta é a estrutura recomendada do projeto, lembre-se que dentro da pasta de cada módulo temos, os `Controllers`, `views` e `Models` que devem seguir esta estrutura, a estrutura de `Form` é opcional. Você pode colocar a pasta de arquivos css, js, etc, onde julgar melhor.

**Por padrão o primeiro módulo é sempre o `ModuleDefault`, este nunca deve deixar de existir.**

```properties
    assets
    |  example.jpg
    config
    |  database.config.php
    modules
    |  ModuleDefault
    |  |  Controllers
    |  |  |  IndexController.php
    |  |  |  ErrorController.php
    |  |  Form
    |  |  |  Index
    |  |  |  |  Index.php
    |  |  Model
    |  |  |  Gateway
    |  |  |  |  User.php
    |  |  |  UserBusiness.php
    |  |  views
    |  |  |  index
    |  |  |  |  index.phtml
    |  |  |  error
    |  |  |  |  not-found.phtml
    |  |  |  |  error.phtml
    |  ModuleAdmin
    .htaccess
    composer.json
    composer.phar
    index.php
```

---
### .htaccess
Este framework funciona com o `mod rewrite` do apache habilitado.
```properties
RewriteEngine on

# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

```

---
### index.php
Este é o arquivo onde o sistema vai iniciar sempre, independente de qual página o usuário acessa.
```php
<?php
session_start();

// horario de sao paulo
date_default_timezone_set('America/Sao_Paulo');

// Constantes de configuracao definidas no VirtualHost (já chegamos lá).
define('DEVELOPMENT', (bool) getenv("DEVELOPMENT"));
define('SHOW_ERRORS', (bool) getenv("SHOW_ERRORS"));
if (SHOW_ERRORS) {
	error_reporting(E_ALL);
	ini_set('display_errors', true);
}

// Diretorio raiz
// Tudo é relativo à raiz do sistema
chdir(__DIR__);

// Funcoes simples que você pode querer implementar (opcional)
// include_once './functions.php';

// Setup autoloading composer
if (file_exists('vendor/autoload.php')) {
	$loader = include 'vendor/autoload.php';

	// Você pode adicionar suas bibliotecas aqui, se quiser.
	// $loader->add('System', 'library/.');
} else {
	exit("Dependências do projeto não encontradas, execute o comando 'php composer.phar install'");
}

// Para rodar o framework bastam essas duas linhas.
$mvc = new SuitUpStart('caminho/relativo/para/os/modulos/');

// Caso queira monitorar as consultas SQL
// Cuidado para não deixar habilitado em ambiente de produção
$mvc->setSqlMonitor(DEVELOPMENT);

$mvc->run();
```

### Virtual Host
Recomendamos que você crie um Virtual Host para rodar a aplicação, simulando assim um ambiente mais próximo do que ficará online
```bash
<VirtualHost *:80>
        ServerAdmin seumail@seuhost.com.br

        ServerName seuprojeto.dev
        ServerAlias seuprojeto.dev

        DocumentRoot /var/www/seuProjeto
        <Directory /var/www/seuProjeto>
                Options Indexes FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/www/log/seuProjeto/error.log
        CustomLog /var/www/log/seuProjeto/access.log combined

        LogLevel warn

        # Variaveis de ambiente
        # False quando estiver online.
        SetEnv DEVELOPMENT true
        SetEnv SHOW_ERRORS true
</VirtualHost>
```

Isto é tudo para fazer funcionar. Bom trabalho, muito obrigado.

redpajama_set_name: RedPajamaGithub


text:
layout: default
title: Home
---

<div class="post-container">
   {{ content }}
</div>


text:
const { CompositeDisposable, Disposable } = require('atom')
const { config } = require('./config')

module.exports = {
	locationServices: [],

	config,

	activate (state) {
		this.disposables = new CompositeDisposable()

		let resolveActivation, rejectActivation
		this.activationPromise = new Promise((resolve, reject) => {
			resolveActivation = resolve
			rejectActivation = reject
		})

		// speedup activation by async initializing
		setImmediate(() => {
			try {
				// actual initialization after atom has loaded
				const SyncSettings = require('./sync-settings')
				this.syncSettings = new SyncSettings(state)

				if (this.busySignal) {
					this.syncSettings.useBusySignal(this.busySignal)
				}
				if (this.locationServices.length > 0) {
					this.syncSettings.useLocationService(this.locationServices[0])
				}

				this.disposables.add(
					atom.commands.add('atom-workspace', 'sync-settings:check-backup', () => this.syncSettings.checkBackup()),
					atom.commands.add('atom-workspace', 'sync-settings:create-backup', () => this.syncSettings.createBackup()),
					atom.commands.add('atom-workspace', 'sync-settings:fork', () => this.syncSettings.fork()),
					atom.commands.add('atom-workspace', 'sync-settings:delete-backup', () => this.syncSettings.deleteBackup()),
					atom.commands.add('atom-workspace', 'sync-settings:backup', () => this.syncSettings.backup()),
					atom.commands.add('atom-workspace', 'sync-settings:restore', () => this.syncSettings.restore()),
					atom.commands.add('atom-workspace', 'sync-settings:view-backup', () => this.syncSettings.viewBackup()),
					atom.commands.add('atom-workspace', 'sync-settings:view-diff', () => this.syncSettings.viewDiff()),
				)
				resolveActivation()
			} catch (err) {
				rejectActivation(err)
			}
		})

		return this.activationPromise
	},

	deactivate () {
		if (this.disposables) {
			this.disposables.dispose()
		}
		if (this.syncSettings) {
			this.syncSettings.disposeBusySignal()
			this.syncSettings.disposeLocationService()
			this.syncSettings = null
		}
		this.locationServices = []
		this.busySignal = null
	},

	serialize () {},

	busySignalService (busySignal) {
		if (this.syncSettings) {
			this.syncSettings.useBusySignal(busySignal)
		}
		this.busySignal = busySignal
		return new Disposable(() => {
			if (this.syncSettings) {
				this.syncSettings.disposeBusySignal()
			}
			this.busySignal = null
		})
	},

	syncSettingslocationService (locationService) {
		if (this.locationServices.length > 0) {
			require('./utils/notify').multipleLocationServices()
			console.error(new Error('Sync-Settings: Multiple Location Services'), locationService)
		}
		if (this.syncSettings) {
			this.syncSettings.useLocationService(locationService)
		}
		this.locationServices.unshift(locationService)
		return new Disposable(() => {
			this.locationServices = this.locationServices.filter(l => l !== locationService)
			if (this.syncSettings) {
				if (this.locationServices.length > 0) {
					this.syncSettings.useLocationService(this.locationServices[0])
				} else {
					this.syncSettings.disposeLocationService()
				}
			}
		})
	},
}


text:
/*************************************************************************/
/*  collision_solver_sw.cpp                                              */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#include "collision_solver_sw.h"
#include "collision_solver_sat.h"

#include "gjk_epa.h"
#include "collision_solver_sat.h"

#define collision_solver sat_calculate_penetration
//#define collision_solver gjk_epa_calculate_penetration

bool CollisionSolverSW::solve_static_plane(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {

	const PlaneShapeSW *plane = static_cast<const PlaneShapeSW*>(p_shape_A);
	if (p_shape_B->get_type()==PhysicsServer::SHAPE_PLANE)
		return false;
	Plane p = p_transform_A.xform(plane->get_plane());

	static const int max_supports = 16;
	Vector3 supports[max_supports];
	int support_count;

	p_shape_B->get_supports(p_transform_B.basis.xform_inv(-p.normal).normalized(),max_supports,supports,support_count);

	bool found=false;

	for(int i=0;i<support_count;i++) {

		supports[i] = p_transform_B.xform( supports[i] );
		if (p.distance_to(supports[i])>=0)
			continue;
		found=true;

		Vector3 support_A = p.project(supports[i]);

		if (p_result_callback) {
			if (p_swap_result)
				p_result_callback(supports[i],support_A,p_userdata);
			else
				p_result_callback(support_A,supports[i],p_userdata);
		}

	}

	return found;
}

bool CollisionSolverSW::solve_ray(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {

	const RayShapeSW *ray = static_cast<const RayShapeSW*>(p_shape_A);

	Vector3 from = p_transform_A.origin;
	Vector3 to = from+p_transform_A.basis.get_axis(2)*ray->get_length();
	Vector3 support_A=to;

	Transform ai = p_transform_B.affine_inverse();

	from = ai.xform(from);
	to = ai.xform(to);

	Vector3 p,n;
	if (!p_shape_B->intersect_segment(from,to,p,n))
		return false;

	Vector3 support_B=p_transform_B.xform(p);

	if (p_result_callback) {
		if (p_swap_result)
			p_result_callback(support_B,support_A,p_userdata);
		else
			p_result_callback(support_A,support_B,p_userdata);
	}
	return true;
}

struct _ConcaveCollisionInfo {

	const Transform *transform_A;
	const ShapeSW *shape_A;
	const Transform *transform_B;
	CollisionSolverSW::CallbackResult result_callback;
	void *userdata;
	bool swap_result;
	bool collided;
	int aabb_tests;
	int collisions;
	bool tested;
	float margin_A;
	float margin_B;
	Vector3 close_A,close_B;

};

void CollisionSolverSW::concave_callback(void *p_userdata, ShapeSW *p_convex) {

	_ConcaveCollisionInfo &cinfo = *(_ConcaveCollisionInfo*)(p_userdata);
	cinfo.aabb_tests++;

	bool collided = collision_solver(cinfo.shape_A, *cinfo.transform_A, p_convex,*cinfo.transform_B, cinfo.result_callback, cinfo.userdata, cinfo.swap_result,NULL,cinfo.margin_A,cinfo.margin_B);
	if (!collided)
		return;

	cinfo.collided=true;
	cinfo.collisions++;

}

bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,float p_margin_A,float p_margin_B) {

	const ConcaveShapeSW *concave_B=static_cast<const ConcaveShapeSW*>(p_shape_B);

	_ConcaveCollisionInfo cinfo;
	cinfo.transform_A=&p_transform_A;
	cinfo.shape_A=p_shape_A;
	cinfo.transform_B=&p_transform_B;
	cinfo.result_callback=p_result_callback;
	cinfo.userdata=p_userdata;
	cinfo.swap_result=p_swap_result;
	cinfo.collided=false;
	cinfo.collisions=0;
	cinfo.margin_A=p_margin_A;
	cinfo.margin_B=p_margin_B;

	cinfo.aabb_tests=0;

	Transform rel_transform = p_transform_A;
	rel_transform.origin-=p_transform_B.origin;

	//quickly compute a local AABB

	AABB local_aabb;
	for(int i=0;i<3;i++) {

	     Vector3 axis( p_transform_B.basis.get_axis(i) );
	     float axis_scale = 1.0/axis.length();
	     axis*=axis_scale;

	     float smin,smax;
	     p_shape_A->project_range(axis,rel_transform,smin,smax);
	     smin-=p_margin_A;
	     smax+=p_margin_A;
	     smin*=axis_scale;
	     smax*=axis_scale;

	     local_aabb.pos[i]=smin;
	     local_aabb.size[i]=smax-smin;
	}

	concave_B->cull(local_aabb,concave_callback,&cinfo);
	//print_line("COL AABB TESTS: "+itos(cinfo.aabb_tests));

	return cinfo.collided;
}

bool CollisionSolverSW::solve_static(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,Vector3 *r_sep_axis,float p_margin_A,float p_margin_B) {

	PhysicsServer::ShapeType type_A=p_shape_A->get_type();
	PhysicsServer::ShapeType type_B=p_shape_B->get_type();
	bool concave_A=p_shape_A->is_concave();
	bool concave_B=p_shape_B->is_concave();

	bool swap = false;

	if (type_A>type_B) {
		SWAP(type_A,type_B);
		SWAP(concave_A,concave_B);
		swap=true;
	}

	if (type_A==PhysicsServer::SHAPE_PLANE) {

		if (type_B==PhysicsServer::SHAPE_PLANE)
			return false;
		if (type_B==PhysicsServer::SHAPE_RAY) {
			return false;
		}

		if (swap) {
			return solve_static_plane(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true);
		} else {
			return solve_static_plane(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_result_callback,p_userdata,false);
		}

	} else if (type_A==PhysicsServer::SHAPE_RAY) {

		if (type_B==PhysicsServer::SHAPE_RAY)
			return false;

		if (swap) {
			return solve_ray(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true);
		} else {
			return solve_ray(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_result_callback,p_userdata,false);
		}

	} else if (concave_B) {

		if (concave_A)
			return false;

		if (!swap)
			return solve_concave(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_result_callback,p_userdata,false,p_margin_A,p_margin_B);
		else
			return solve_concave(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_result_callback,p_userdata,true,p_margin_A,p_margin_B);

	} else {

		return collision_solver(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback,p_userdata,false,r_sep_axis,p_margin_A,p_margin_B);
	}

	return false;
}

void CollisionSolverSW::concave_distance_callback(void *p_userdata, ShapeSW *p_convex) {

	_ConcaveCollisionInfo &cinfo = *(_ConcaveCollisionInfo*)(p_userdata);
	cinfo.aabb_tests++;
	if (cinfo.collided)
		return;

	Vector3 close_A,close_B;
	cinfo.collided = !gjk_epa_calculate_distance(cinfo.shape_A,*cinfo.transform_A,p_convex,*cinfo.transform_B,close_A,close_B);

	if (cinfo.collided)
		return;
	if (!cinfo.tested || close_A.distance_squared_to(close_B) < cinfo.close_A.distance_squared_to(cinfo.close_B)) {

		cinfo.close_A=close_A;
		cinfo.close_B=close_B;
		cinfo.tested=true;
	}

	cinfo.collisions++;

}

bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B) {

	const PlaneShapeSW *plane = static_cast<const PlaneShapeSW*>(p_shape_A);
	if (p_shape_B->get_type()==PhysicsServer::SHAPE_PLANE)
		return false;
	Plane p = p_transform_A.xform(plane->get_plane());

	static const int max_supports = 16;
	Vector3 supports[max_supports];
	int support_count;

	p_shape_B->get_supports(p_transform_B.basis.xform_inv(-p.normal).normalized(),max_supports,supports,support_count);

	bool collided=false;
	Vector3 closest;
	float closest_d;

	for(int i=0;i<support_count;i++) {

		supports[i] = p_transform_B.xform( supports[i] );
		real_t d = p.distance_to(supports[i]);
		if (i==0 || d<closest_d) {
			closest=supports[i];
			closest_d=d;
			if (d<=0)
				collided=true;
		}

	}

	r_point_A=p.project(closest);
	r_point_B=closest;

	return collided;
}

bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis) {

	if (p_shape_A->is_concave())
		return false;

	if (p_shape_B->get_type()==PhysicsServer::SHAPE_PLANE) {

		Vector3 a,b;
		bool col = solve_distance_plane(p_shape_B,p_transform_B,p_shape_A,p_transform_A,a,b);
		r_point_A=b;
		r_point_B=a;
		return !col;

	} else if (p_shape_B->is_concave()) {

		if (p_shape_A->is_concave())
			return false;

		const ConcaveShapeSW *concave_B=static_cast<const ConcaveShapeSW*>(p_shape_B);

		_ConcaveCollisionInfo cinfo;
		cinfo.transform_A=&p_transform_A;
		cinfo.shape_A=p_shape_A;
		cinfo.transform_B=&p_transform_B;
		cinfo.result_callback=NULL;
		cinfo.userdata=NULL;
		cinfo.swap_result=false;
		cinfo.collided=false;
		cinfo.collisions=0;
		cinfo.aabb_tests=0;
		cinfo.tested=false;

		Transform rel_transform = p_transform_A;
		rel_transform.origin-=p_transform_B.origin;

		//quickly compute a local AABB

		bool use_cc_hint=p_concave_hint!=AABB();
		AABB cc_hint_aabb;
		if (use_cc_hint) {
			cc_hint_aabb=p_concave_hint;
			cc_hint_aabb.pos-=p_transform_B.origin;
		}

		AABB local_aabb;
		for(int i=0;i<3;i++) {

		     Vector3 axis( p_transform_B.basis.get_axis(i) );
		     float axis_scale = 1.0/axis.length();
		     axis*=axis_scale;

		     float smin,smax;

		     if (use_cc_hint) {
			     cc_hint_aabb.project_range_in_plane(Plane(axis,0),smin,smax);
		     } else {
			     p_shape_A->project_range(axis,rel_transform,smin,smax);
		      }

		     smin*=axis_scale;
		     smax*=axis_scale;

		     local_aabb.pos[i]=smin;
		     local_aabb.size[i]=smax-smin;
		}

		concave_B->cull(local_aabb,concave_distance_callback,&cinfo);
		if (!cinfo.collided) {
//			print_line(itos(cinfo.tested));
			r_point_A=cinfo.close_A;
			r_point_B=cinfo.close_B;

		}

		//print_line("DIST AABB TESTS: "+itos(cinfo.aabb_tests));

		return !cinfo.collided;
	} else {

		return gjk_epa_calculate_distance(p_shape_A,p_transform_A,p_shape_B,p_transform_B,r_point_A,r_point_B); //should pass sepaxis..
	}

	return false;
}


text:
=============================================================
Defcore waiver for additional properties on Nova API response
=============================================================

Launchpad blueprint: https://blueprints.launchpad.net/refstack/+spec/refstack-waiver

Defcore waiver: https://review.openstack.org/#/c/333067/

Defcore committee approved above waiver which allows vendors who are using the
Nova 2.0 API with additional properties to disable strict response checking
when testing products for the OpenStack Powered program in 2016.

This spec defines the changes needed for refstack-client to optionally bypass
Tempest strict validation.

Problem description
===================

Vendors need an automated way to apply the waiver. The proposed method is to
run Tempest from the RefStack client, identify tests that fail because of
strict response checking, and rerun those tests with strict checking disabled.

APIs and test cases using the waiver must be clearly identified.

Proposed change
===============

1. Workflow

- Vendor run Tempest suite as usual: via refstack-client test, ostestr, testr
  or with any other test runner. Some test cases failed due to additional
  properties in Nova response.

- Vendor have the subunit test results file from the Tempest test execution.

- Vendor have the Tempest configuration file.

- Vendor rerun failed test cases by running ``refstack-client bypass-extras``
  command. Command identifies failed test cases, disables Tempest strict
  validations, rerun test cases, and enables strict validations again.

.. code-block:: bash

   $ refstack-client bypass-extras --subunit-file <results> --conf-file <tempest-conf-file>

- Output of bypass-extras command is a zip bundle containing the following
  files:

  - tests_list - List of failed test cases due to additional properties.

  - patched_schemas - List of tempest schemas which value was set to True
    (to allow additional properties).

  - api_details - API call details from each failed test case (due to
    additional properties).

  - rerun_test_results - The subunit result file for the re-run test cases.

  - combined_test_results.json - The Refstack JSON file with the combined
    passed TCs from both initial and rerun subunit files.

2. Implement "bypass-extras" Refstack command:
Assume Tempest test suite was run independently.
Subunit test results and Tempest configuration files are available.

*bypass-extras* command is the helper tool for vendors to bypass the strict
validation of additional properties in Tempest. Process steps and
implementation details are explained on step 3.

.. code-block:: bash

    $ refstack-client --help

    usage: refstack-client [-h] <ARG> ...
    ...
        bypass-extras    Apply Defcore waiver to identify additional properties
                         on Nova API response. Re-runs failed test cases
                         without Tempest strict response validations.

    $ refstack-client bypass-extras --help

    usage: refstack-client [-h] <ARG> ...

    To see help on specific argument, do:
    refstack-client <ARG> -h waiver
       [-h] [-s | -v] [-y] [--url URL] [-k] [-i PRIV_KEY] file

    optional arguments:
        -h, --help          Show this help message and exit
        -s, --silent        Suppress output except warnings and errors.
        -v, --verbose       Show verbose output.
        -y                  Assume Yes to all prompt queries
        --subunit-file      Path to subunit test result file.
        -c, --conf-file     Path of the Tempest configuration file to use.

3. Flow for ``bypass-extras`` command.

Having as input a subunit test results file and a Tempest configuration file:

3.1 Find failed test cases and its details

Integrate code from find_additional_properties.py into Refstack-client to
analyze subunit stream (from input results file). Find failed test cases
due to additional properties in the response. Reconstruct the tempest schema
causing the test case failure. Run subunit-describe-calls
filter command to get test cases API call details.

Input: subunit-results

Output files:

- tests_list - List of failed test cases due to additional properties.

- patched_schemas - List of tempest schemas causing errors

- api_details - API calls from each test case.

3.2 Patch Tempest:

Create patch for .tempest virtual environment which lives under refstack-client
installation.

- Modify tempest/lib/api_schema/response/compute/v2_1/__init__.py:

  - Import module where schema lives.

  - Set schema addtionalProperties key to True so that additional properties
    are accepted - bypass strict validation.

3.3 Rerun failed test cases using patched refstack-client .tempest environment

Use tests_list as withelist for ostestr in order to re-run failed test cases.

.. code-block:: bash

   ostestr --serial -w test_list

Input: test_list and conf-file files.

Output: rerun_test_results subunit file

3.4 Remove Tempest patch

Regardless of previous steps outcome, unpatching Tempest step will be
attempted.

Clean __init__.py by opening with access mode 'w'

3.5 Create refstack JSON format files

Transform subunit result files - The one provided as input and the rerun
test results - into a combined refstack JSON format.

Input: initial_results_file, rerun_test_results files.

Output: combined_test_results.json files.

3.6 Create zip bundle

Alternatives
------------

- Add additional property to Tempest config file

- For Tempest patch
  Comment the validate_response call by looking into the service_client.py file
  for the corresponding method (search through code files).

- Manual process
   Products applying for the OpenStack Powered Trademark in 2016 may
   request the waiver by submitting subunit data from their Tempest run
   that can be manually analyzed by the `find_additional_properties.py` script
   from the DefCore repository. This script will identify tests that
   failed because of additional properties. The vendor will then need
   to manually modify tempest-lib to remove additional checks on the impacted
   APIs.

Data model impact
-----------------

None

REST API impact
---------------

None

Security impact
---------------

None

Notifications impact
--------------------

None

Other end user impact
---------------------

None

Performance Impact
------------------

None

Other deployer impact
---------------------

None

Developer impact
----------------

None

Implementation
==============

Assignee(s)
-----------

Primary assignee:

 luz-cazares

Other contributors:

 Chris Hoge

Work Items
----------

- Add *bypass-extras* command to refstack-client.
- Integrate find_additional_properties code
- Method to call subunit-describe-calls filter
- Implement JSON schema gathering from test exception
- Implement Tempest patch
- Implement Tempest unpatch
- Create zip bundle with file results
- Add *bypass-extras* command usage documentation

Dependencies
============

None

Testing
=======

Add unit testing for the new command, verify expected outcomes are met.

Documentation Impact
====================

Add refstack-client bypass-extras  usage information under refstack-client/
README.rst

References
==========

None


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>wMemory | JS Project</title>
  <meta name="author" content="Matt Weber">
  <meta name="description" content="Interactive Memory like card matching game.">
  <meta name="theme-color" content="#184A7F">
  <link rel="stylesheet" href="resources/css/reset-min.css">
  <link rel="stylesheet" href="resources/css/style-min.css">
  <link href="https://fonts.googleapis.com/css?family=Raleway|Share+Tech+Mono" rel="stylesheet">
  <link rel="apple-touch-icon" sizes="180x180" href="/resources/images/favicons/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/resources/images/favicons/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/resources/images/favicons/favicon-16x16.png">
  <link rel="manifest" href="/resources/images/favicons/manifest.json">
  <link rel="mask-icon" href="/resources/images/favicons/safari-pinned-tab.svg" color="#184a7f">
  <link rel="shortcut icon" href="/resources/images/favicons/favicon.ico">
  <meta name="msapplication-config" content="/resources/images/favicons/browserconfig.xml">

      Repo
      wSketch
      Author

Welcome to WEBER DESIGN (TM) Termlink

VAULT-TEC RECREATION TERMINAL

          [OVERSEER MEMO]
          [TOP TEN]
          [Play Tape]

          [Easy]
          [Normal]
          [Hard]

             >  ▮

          STATS

            DIFF

            TIME
            00:00

            MOVE
            0

            RTNG

            Menu

            Top Ten

            Restart

          Congratulations! You Win!
          Time:
          Moves:
          Rating:

           Again?


text:
<!doctype html>

  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Redirect</title>

  <meta name="theme-color" content="#303F9F">

  <link rel="manifest" href="manifest.json">

  <meta name="msapplication-TileColor" content="#83ADCE">

  <meta name="mobile-web-app-capable" content="yes">
  <meta name="application-name" content="Redirect">
  <link rel="icon" sizes="192x192" href="images/ic_launcher.png">

  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Redirect">
  <link rel="apple-touch-icon" href="images/apple-touch-icon.png">

  <meta name="msapplication-TileImage" content="images/ms-touch-icon-144x144-precomposed.png">

  <link rel="stylesheet" href="app/styles/main.css">

  <link rel="import" href="app/elements/elements.html">

  <template is="dom-bind" id="app">

Temporary workaround

  			<paper-button on-tap="redirect" style="background:#4CAF50;margin-top:32px;color:#fff;width:192px;" raised>
  				To the Hub
  			</paper-button>

  </template>


text:
module Striker
	module Tags
		class Tweet < Liquid::Tag

			def initialize(tag, markup, tokens)
				super
				hashtags = markup.match /\s?#\[([\w\-~$^*!?.:;+=\s]+)\]/
				via = markup.match /\s?@\[([\w\-~$^*!?.:;+=\s]+)\]/
				@hashtags = hashtags[1].gsub(" ", ",") unless hashtags.nil?
				@via = via[1].gsub(" ", ",") unless via.nil?
			end

			def render(context)
				<<-TWEET
					Tweet

				TWEET
			end

		end
	end
end

Liquid::Template.register_tag('tweet', Striker::Tags::Tweet)


text:
<?php

/**
 * BaseWfToken
 *
 * This class has been auto-generated by the Doctrine ORM Framework
 *
 * @property integer $id
 * @property integer $wf_id
 * @property integer $case_id
 * @property integer $place_id
 * @property string $context
 * @property integer $token_status
 * @property timestamp $enabled_date
 * @property timestamp $cancelled_date
 * @property timestamp $consumed_date
 * @property WfWorkflow $WfWorkflow
 * @property WfCase $WfCase
 * @property WfPlace $WfPlace
 *
 * @package    ##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author     ##NAME## <##EMAIL##>
 * @version    SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $
 */
abstract class BaseWfToken extends izDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('wf_token');
        $this->hasColumn('id', 'integer', 4, array(
             'primary' => true,
             'autoincrement' => true,
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('wf_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('case_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('place_id', 'integer', 4, array(
             'type' => 'integer',
             'length' => '4',
             ));
        $this->hasColumn('place_type', 'integer', 2, array(
             'type' => 'integer',
             'length' => '2',
             ));
        $this->hasColumn('context', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('token_status', 'integer', 2, array(
             'type' => 'integer',
             'length' => '2',
             ));
        $this->hasColumn('enabled_date', 'timestamp', null, array(
             'type' => 'timestamp',
             ));
        $this->hasColumn('cancelled_date', 'timestamp', null, array(
             'type' => 'timestamp',
             ));
        $this->hasColumn('consumed_date', 'timestamp', null, array(
             'type' => 'timestamp',
             ));

        $this->option('type', 'INNODB');
        $this->option('collate', 'utf8_unicode_ci');
        $this->option('charset', 'utf8');
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('WfWorkflow', array(
             'local' => 'wf_id',
             'foreign' => 'id'));

        $this->hasOne('WfCase', array(
             'local' => 'case_id',
             'foreign' => 'id'));

        $this->hasOne('WfPlace', array(
             'local' => 'place_id',
             'foreign' => 'id'));
    }
}


text:
package com.cloud.vpc;

import com.cloud.legacymodel.exceptions.ResourceUnavailableException;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.network.element.Site2SiteVpnServiceProvider;
import com.cloud.utils.component.ManagerBase;

import javax.naming.ConfigurationException;
import java.util.Map;

import org.springframework.stereotype.Component;

@Component
public class MockSite2SiteVpnServiceProvider extends ManagerBase implements Site2SiteVpnServiceProvider {

    /* (non-Javadoc)
     * @see com.cloud.utils.component.Adapter#getName()
     */
    @Override
    public String getName() {
        // TODO Auto-generated method stub
        return "Site2SiteVpnServiceProvider";
    }

    /* (non-Javadoc)
     * @see com.cloud.utils.component.Adapter#configure(java.lang.String, java.util.Map)
     */
    @Override
    public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
        // TODO Auto-generated method stub
        return true;
    }

    /* (non-Javadoc)
     * @see com.cloud.utils.component.Adapter#start()
     */
    @Override
    public boolean start() {
        // TODO Auto-generated method stub
        return true;
    }

    /* (non-Javadoc)
     * @see com.cloud.utils.component.Adapter#stop()
     */
    @Override
    public boolean stop() {
        // TODO Auto-generated method stub
        return true;
    }

    /* (non-Javadoc)
     * @see com.cloud.network.element.Site2SiteVpnServiceProvider#startSite2SiteVpn(com.cloud.network.Site2SiteVpnConnection)
     */
    @Override
    public boolean startSite2SiteVpn(final Site2SiteVpnConnection conn) throws ResourceUnavailableException {
        // TODO Auto-generated method stub
        return true;
    }

    /* (non-Javadoc)
     * @see com.cloud.network.element.Site2SiteVpnServiceProvider#refreshSite2SiteVpn(com.cloud.network.Site2SiteVpnConnection)
     */
    @Override
    public boolean refreshSite2SiteVpn(final Site2SiteVpnConnection conn) throws ResourceUnavailableException {
        // TODO Auto-generated method stub
        return true;
    }

    /* (non-Javadoc)
     * @see com.cloud.network.element.Site2SiteVpnServiceProvider#stopSite2SiteVpn(com.cloud.network.Site2SiteVpnConnection)
     */
    @Override
    public boolean stopSite2SiteVpn(final Site2SiteVpnConnection conn) throws ResourceUnavailableException {
        // TODO Auto-generated method stub
        return true;
    }
}


text:
package org.apache.solr.explorer.client.core.manager.solr.admin;

import java.util.Date;

/**
 * @author Uri Boness
 */
public class IndexInfo {

    private long indexVersion;
    private boolean optimized;
    private boolean hasDeletions;
    private String directory;
    private Date lastModified;
    private long numberOfDocuments;
    private long numberOfTerms;

    public long getIndexVersion() {
        return indexVersion;
    }

    void setIndexVersion(long indexVersion) {
        this.indexVersion = indexVersion;
    }

    public boolean isOptimized() {
        return optimized;
    }

    void setOptimized(boolean optimized) {
        this.optimized = optimized;
    }

    public boolean isHasDeletions() {
        return hasDeletions;
    }

    void setHasDeletions(boolean hasDeletions) {
        this.hasDeletions = hasDeletions;
    }

    public String getDirectory() {
        return directory;
    }

    void setDirectory(String directory) {
        this.directory = directory;
    }

    public Date getLastModified() {
        return lastModified;
    }

    void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }

    public long getNumberOfDocuments() {
        return numberOfDocuments;
    }

    void setNumberOfDocuments(long numberOfDocuments) {
        this.numberOfDocuments = numberOfDocuments;
    }

    public long getNumberOfTerms() {
        return numberOfTerms;
    }

    void setNumberOfTerms(long numberOfTerms) {
        this.numberOfTerms = numberOfTerms;
    }
}


text:
<!DOCTYPE html>

		<title>First Date</title>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE-edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta description="Enter Description here">
		<meta keywords="keywords">
		<meta author="Rich Sollenne, Pearson Stewart, Catherine Fox, Mindy Leichter">

		<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="css/main.css">

Go to /www for the project to load


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets target frame for form</title>

fdf_open

fdf_save_string

FDF Functions

PHP Manual

fdf_remove_item

(PHP 4 >= 4.3.0, PHP 5)

fdf_remove_item — Sets target frame for form

Description

   bool fdf_remove_item
    ( resource $fdf_document
   , string $fieldname
   , int $item
   )

Warning
This function is
currently not documented; only its argument list is available.

fdf_open

fdf_save_string

FDF Functions

PHP Manual


text:
var notifications = {

	alert: function (message, callback) {

		var id = Math.round(Math.pow(2, 32) * Math.random());

		$('body').append('

' + message + '
<button class="ok">OK</button>

');

		$('#notification-' + id + ' button.ok').click(function () {
			$('#notification-' + id).remove();
			callback();
		});

	},

	confirm: function (question, no, yes, callback) {

		var id = Math.round(Math.pow(2, 32) * Math.random());

		$('body').append('

' + question + '
<button class="no grey">' + no + '</button><button class="yes grey">' + yes + '</button>

');

		$('#notification-' + id + ' button.yes').click(function () {
			$('#notification-' + id).remove();
			callback(true);
		});

		$('#notification-' + id + ' button.no').click(function () {
			$('#notification-' + id).remove();
			callback(false);
		});

	}

}


text:
package com.kixeye.chassis.bootstrap.configuration.zookeeper;

import org.apache.curator.RetryPolicy;
import org.apache.curator.ensemble.exhibitor.ExhibitorEnsembleProvider;
import org.apache.curator.ensemble.exhibitor.ExhibitorRestClient;
import org.apache.curator.ensemble.exhibitor.Exhibitors;

/**
 * Assumes a static list Exhibitor urls as a source for zookeeper connections strings and
 * continues to poll that list. This alters functionality of the superclass in that it only uses the given
 * Exhibitor urls for the initial list of zookeepers and then polls those zookeepers for changes
 * to the Ensemble.
 *
 * This class is useful when the static Exhibitor url list given to it points to a VIP which maintains the pool
 * of Exhibitors.
 *
 * @author dturner@kixeye.com
 */
public class KixeyeExhibitorEnsembleProvider extends ExhibitorEnsembleProvider{

    private Exhibitors initialExhibitors;

    /**
     * @param exhibitors  the current set of exhibitor instances (can be changed later via {@link #setExhibitors(org.apache.curator.ensemble.exhibitor.Exhibitors)})
     * @param restClient  the rest client to use (use {@link org.apache.curator.ensemble.exhibitor.DefaultExhibitorRestClient} for most cases)
     * @param restUriPath the path of the REST call used to get the server set. Usually: <code>/exhibitor/v1/cluster/list</code>
     * @param pollingMs   how ofter to poll the exhibitors for the list
     * @param retryPolicy retry policy to use when connecting to the exhibitors
     */
    public KixeyeExhibitorEnsembleProvider(Exhibitors exhibitors, ExhibitorRestClient restClient, String restUriPath, int pollingMs, RetryPolicy retryPolicy) {
        super(exhibitors, restClient, restUriPath, pollingMs, retryPolicy);
        this.initialExhibitors = exhibitors;
    }

    @Override
    protected synchronized void poll() {
        //always reset the Exhibitors list to the initial list because it is super.poll() changes this list at the end
        setExhibitors(initialExhibitors);
        super.poll();
    }
}


text:
declare
  l_file_list sys.utl_file_nonstandard.t_file_list;
begin
  debug_pkg.debug_on;
  l_file_list := sys.utl_file_nonstandard.get_file_list('DEVTEST_TEMP_DIR', '*.xls');
  for i in 1 .. l_file_list.count loop
    debug_pkg.printf('File %1, file name = %2', i, l_file_list(i));
  end loop;
end;


text:
namespace Core.Exceptions {
    public class InvalidReferenceColumnException : ParilisException {}
}


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// Main header first:
#include "nsSVGTextFrame.h"

// Keep others in (case-insensitive) order:
#include "nsGkAtoms.h"
#include "nsIDOMSVGRect.h"
#include "nsIDOMSVGTextElement.h"
#include "nsISVGGlyphFragmentNode.h"
#include "nsSVGGlyphFrame.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGPathElement.h"
#include "nsSVGTextPathFrame.h"
#include "nsSVGUtils.h"
#include "SVGLengthList.h"

using namespace mozilla;

//----------------------------------------------------------------------
// Implementation

nsIFrame*
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
  return new (aPresShell) nsSVGTextFrame(aContext);
}

NS_IMPL_FRAMEARENA_HELPERS(nsSVGTextFrame)

//----------------------------------------------------------------------
// nsIFrame methods
#ifdef DEBUG
NS_IMETHODIMP
nsSVGTextFrame::Init(nsIContent* aContent,
                     nsIFrame* aParent,
                     nsIFrame* aPrevInFlow)
{
  nsCOMPtr<nsIDOMSVGTextElement> text = do_QueryInterface(aContent);
  NS_ASSERTION(text, "Content is not an SVG text");

  return nsSVGTextFrameBase::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */

NS_IMETHODIMP
nsSVGTextFrame::AttributeChanged(int32_t         aNameSpaceID,
                                 nsIAtom*        aAttribute,
                                 int32_t         aModType)
{
  if (aNameSpaceID != kNameSpaceID_None)
    return NS_OK;

  if (aAttribute == nsGkAtoms::transform) {
    nsSVGUtils::InvalidateBounds(this, false);
    nsSVGUtils::ScheduleReflowSVG(this);
    NotifySVGChanged(TRANSFORM_CHANGED);
  } else if (aAttribute == nsGkAtoms::x ||
             aAttribute == nsGkAtoms::y ||
             aAttribute == nsGkAtoms::dx ||
             aAttribute == nsGkAtoms::dy ||
             aAttribute == nsGkAtoms::rotate) {
    nsSVGUtils::InvalidateBounds(this, false);
    nsSVGUtils::ScheduleReflowSVG(this);
    NotifyGlyphMetricsChange();
  }

 return NS_OK;
}

nsIAtom *
nsSVGTextFrame::GetType() const
{
  return nsGkAtoms::svgTextFrame;
}

NS_IMETHODIMP
nsSVGTextFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists)
{
  UpdateGlyphPositioning(true);
  return nsSVGTextFrameBase::BuildDisplayList(aBuilder, aDirtyRect, aLists);
}

//----------------------------------------------------------------------
// nsSVGTextContainerFrame
uint32_t
nsSVGTextFrame::GetNumberOfChars()
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetNumberOfChars();
}

float
nsSVGTextFrame::GetComputedTextLength()
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetComputedTextLength();
}

float
nsSVGTextFrame::GetSubStringLength(uint32_t charnum, uint32_t nchars)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetSubStringLength(charnum, nchars);
}

int32_t
nsSVGTextFrame::GetCharNumAtPosition(nsIDOMSVGPoint *point)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetCharNumAtPosition(point);
}

NS_IMETHODIMP
nsSVGTextFrame::GetStartPositionOfChar(uint32_t charnum, nsIDOMSVGPoint **_retval)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetStartPositionOfChar(charnum,  _retval);
}

NS_IMETHODIMP
nsSVGTextFrame::GetEndPositionOfChar(uint32_t charnum, nsIDOMSVGPoint **_retval)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetEndPositionOfChar(charnum,  _retval);
}

NS_IMETHODIMP
nsSVGTextFrame::GetExtentOfChar(uint32_t charnum, nsIDOMSVGRect **_retval)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetExtentOfChar(charnum,  _retval);
}

NS_IMETHODIMP
nsSVGTextFrame::GetRotationOfChar(uint32_t charnum, float *_retval)
{
  UpdateGlyphPositioning(false);

  return nsSVGTextFrameBase::GetRotationOfChar(charnum,  _retval);
}

//----------------------------------------------------------------------
// nsISVGChildFrame methods

void
nsSVGTextFrame::NotifySVGChanged(uint32_t aFlags)
{
  NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
                    "Invalidation logic may need adjusting");

  bool updateGlyphMetrics = false;

  if (aFlags & COORD_CONTEXT_CHANGED) {
    updateGlyphMetrics = true;
  }

  if (aFlags & TRANSFORM_CHANGED) {
    if (mCanvasTM && mCanvasTM->IsSingular()) {
      // We won't have calculated the glyph positions correctly
      updateGlyphMetrics = true;
    }
    // make sure our cached transform matrix gets (lazily) updated
    mCanvasTM = nullptr;
  }

  if (updateGlyphMetrics) {
    // Ancestor changes can't affect how we render from the perspective of
    // any rendering observers that we may have, so we don't need to
    // invalidate them. We also don't need to invalidate ourself, since our
    // changed ancestor will have invalidated its entire area, which includes
    // our area.
    // For perf reasons we call this before calling NotifySVGChanged() below.
    nsSVGUtils::ScheduleReflowSVG(this);
  }

  nsSVGTextFrameBase::NotifySVGChanged(aFlags);

  if (updateGlyphMetrics) {
    // If we are positioned using percentage values we need to update our
    // position whenever our viewport's dimensions change.

    // XXX We could check here whether the text frame or any of its children
    // have any percentage co-ordinates and only update if they don't. This
    // may not be worth it as we might need to check each glyph
    NotifyGlyphMetricsChange();
  }
}

NS_IMETHODIMP
nsSVGTextFrame::PaintSVG(nsRenderingContext* aContext,
                         const nsIntRect *aDirtyRect)
{
  NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
               (mState & NS_STATE_SVG_NONDISPLAY_CHILD),
               "If display lists are enabled, only painting of non-display "
               "SVG should take this code path");

  UpdateGlyphPositioning(true);

  return nsSVGTextFrameBase::PaintSVG(aContext, aDirtyRect);
}

NS_IMETHODIMP_(nsIFrame*)
nsSVGTextFrame::GetFrameForPoint(const nsPoint &aPoint)
{
  NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
               (mState & NS_STATE_SVG_NONDISPLAY_CHILD),
               "If display lists are enabled, only hit-testing of non-display "
               "SVG should take this code path");

  UpdateGlyphPositioning(true);

  return nsSVGTextFrameBase::GetFrameForPoint(aPoint);
}

void
nsSVGTextFrame::ReflowSVG()
{
  NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
               "This call is probably a wasteful mistake");

  NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
                    "ReflowSVG mechanism not designed for this");

  if (!nsSVGUtils::NeedsReflowSVG(this)) {
    NS_ASSERTION(!mPositioningDirty, "How did this happen?");
    return;
  }

  // UpdateGlyphPositioning may have been called under DOM calls and set
  // mPositioningDirty to false. We may now have better positioning, though, so
  // set it to true so that UpdateGlyphPositioning will do its work.
  mPositioningDirty = true;

  UpdateGlyphPositioning(false);

  // We only invalidate if we are dirty, if our outer-<svg> has already had its
  // initial reflow (since if it hasn't, its entire area will be invalidated
  // when it gets that initial reflow), and if our parent is not dirty (since
  // if it is, then it will invalidate its entire new area, which will include
  // our new area).
  bool invalidate = (mState & NS_FRAME_IS_DIRTY) &&
    !(GetParent()->GetStateBits() &
       (NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY));

  // With glyph positions updated, our descendants can invalidate their new
  // areas correctly:
  nsSVGTextFrameBase::ReflowSVG();

  if (invalidate) {
    // XXXSDL Let FinishAndStoreOverflow do this.
    nsSVGUtils::InvalidateBounds(this, true);
  }
}

SVGBBox
nsSVGTextFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
                                    uint32_t aFlags)
{
  UpdateGlyphPositioning(true);

  return nsSVGTextFrameBase::GetBBoxContribution(aToBBoxUserspace, aFlags);
}

//----------------------------------------------------------------------
// nsSVGContainerFrame methods:

gfxMatrix
nsSVGTextFrame::GetCanvasTM(uint32_t aFor)
{
  if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
    if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) ||
        (aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) {
      return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
    }
  }

  if (!mCanvasTM) {
    NS_ASSERTION(mParent, "null parent");

    nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
    nsSVGGraphicElement *content = static_cast<nsSVGGraphicElement*>(mContent);

    gfxMatrix tm =
      content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));

    mCanvasTM = new gfxMatrix(tm);
  }

  return *mCanvasTM;
}

//----------------------------------------------------------------------
//

static void
MarkDirtyBitsOnDescendants(nsIFrame *aFrame)
{
  // Do not skip marking of aFrame or any of its descendants if they have
  // the NS_FRAME_IS_DIRTY set, because some of their descendants may not
  // have it set, and we need all descendants to be dirty.
  if (aFrame->GetStateBits() & (NS_FRAME_FIRST_REFLOW)) {
    // Nothing to do if our outer-<svg> hasn't yet had its initial reflow.
    return;
  }
  nsIFrame* kid = aFrame->GetFirstPrincipalChild();
  while (kid) {
    nsISVGChildFrame* svgkid = do_QueryFrame(kid);
    if (svgkid) {
      MarkDirtyBitsOnDescendants(kid);
      kid->AddStateBits(NS_FRAME_IS_DIRTY);
    }
    kid = kid->GetNextSibling();
  }
}

void
nsSVGTextFrame::NotifyGlyphMetricsChange()
{
  // NotifySVGChanged isn't appropriate here, so we just mark our descendants
  // as fully dirty to get ReflowSVG() called on them:
  MarkDirtyBitsOnDescendants(this);

  nsSVGUtils::InvalidateBounds(this, false);
  nsSVGUtils::ScheduleReflowSVG(this);

  mPositioningDirty = true;
}

void
nsSVGTextFrame::SetWhitespaceHandling(nsSVGGlyphFrame *aFrame)
{
  SetWhitespaceCompression();

  nsSVGGlyphFrame* firstFrame = aFrame;
  bool trimLeadingWhitespace = true;
  nsSVGGlyphFrame* lastNonWhitespaceFrame = aFrame;

  // If the previous frame ended with whitespace
  // then display of leading whitespace should be suppressed
  // when we are compressing whitespace.
  while (aFrame) {
    if (!aFrame->IsAllWhitespace()) {
      lastNonWhitespaceFrame = aFrame;
    }

    aFrame->SetTrimLeadingWhitespace(trimLeadingWhitespace);
    trimLeadingWhitespace = aFrame->EndsWithWhitespace();

    aFrame = aFrame->GetNextGlyphFrame();
  }

  // When there is only whitespace left we need to trim off
  // the end of the last frame that isn't entirely whitespace.
  // Making sure that we reset earlier frames as they may once
  // have been the last non-whitespace frame.
  aFrame = firstFrame;
  while (aFrame != lastNonWhitespaceFrame) {
    aFrame->SetTrimTrailingWhitespace(false);
    aFrame = aFrame->GetNextGlyphFrame();
  }

  // We're at the last non-whitespace frame so trim off the end
  // and make sure we set one of the trim bits so that any
  // further whitespace is compressed to nothing
  while (aFrame) {
    aFrame->SetTrimTrailingWhitespace(true);
    aFrame = aFrame->GetNextGlyphFrame();
  }
}

void
nsSVGTextFrame::UpdateGlyphPositioning(bool aForceGlobalTransform)
{
  if (!mPositioningDirty)
    return;

  mPositioningDirty = false;

  nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode();
  if (!node)
    return;

  nsSVGGlyphFrame *frame, *firstFrame;

  firstFrame = node->GetFirstGlyphFrame();
  if (!firstFrame) {
    return;
  }

  SetWhitespaceHandling(firstFrame);

  BuildPositionList(0, 0);

  gfxPoint ctp(0.0, 0.0);

  // loop over chunks
  while (firstFrame) {
    nsSVGTextPathFrame *textPath = firstFrame->FindTextPathParent();

    nsTArray<float> effectiveXList, effectiveYList;
    firstFrame->GetEffectiveXY(firstFrame->GetNumberOfChars(),
                               effectiveXList, effectiveYList);
    if (!effectiveXList.IsEmpty()) ctp.x = effectiveXList[0];
    if (!textPath && !effectiveYList.IsEmpty()) ctp.y = effectiveYList[0];

    // check for startOffset on textPath
    if (textPath) {
      if (!textPath->GetPathFrame()) {
        // invalid text path, give up
        return;
      }
      ctp.x = textPath->GetStartOffset();
    }

    // determine x offset based on text_anchor:

    uint8_t anchor = firstFrame->GetTextAnchor();

    /**
     * XXXsmontagu: The SVG spec is very vague as to how 'text-anchor'
     *  interacts with bidirectional text. It says:
     *
     *   "For scripts that are inherently right to left such as Hebrew and
     *   Arabic [text-anchor: start] is equivalent to right alignment."
     * and
     *   "For scripts that are inherently right to left such as Hebrew and
     *   Arabic, [text-anchor: end] is equivalent to left alignment.
     *
     * It's not clear how this should be implemented in terms of defined
     * properties, i.e. how one should determine that a particular element
     * contains a script that is inherently right to left.
     *
     * The code below follows http://www.w3.org/TR/SVGTiny12/text.html#TextAnchorProperty
     * and swaps the values of text-anchor: end and  text-anchor: start
     * whenever the 'direction' property is rtl.
     *
     * This is probably the "right" thing to do, but other browsers don't do it,
     * so I am leaving it inside #if 0 for now for interoperability.
     *
     * See also XXXsmontagu comments in nsSVGGlyphFrame::EnsureTextRun
     */
#if 0
    if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
      if (anchor == NS_STYLE_TEXT_ANCHOR_END) {
        anchor = NS_STYLE_TEXT_ANCHOR_START;
      } else if (anchor == NS_STYLE_TEXT_ANCHOR_START) {
        anchor = NS_STYLE_TEXT_ANCHOR_END;
      }
    }
#endif

    float chunkLength = 0.0f;
    if (anchor != NS_STYLE_TEXT_ANCHOR_START) {
      // need to get the total chunk length

      frame = firstFrame;
      while (frame) {
        chunkLength += frame->GetAdvance(aForceGlobalTransform);
        frame = frame->GetNextGlyphFrame();
        if (frame && frame->IsAbsolutelyPositioned())
          break;
      }
    }

    if (anchor == NS_STYLE_TEXT_ANCHOR_MIDDLE)
      ctp.x -= chunkLength/2.0f;
    else if (anchor == NS_STYLE_TEXT_ANCHOR_END)
      ctp.x -= chunkLength;

    // set position of each frame in this chunk:

    frame = firstFrame;
    while (frame) {

      frame->SetGlyphPosition(&ctp, aForceGlobalTransform);
      frame = frame->GetNextGlyphFrame();
      if (frame && frame->IsAbsolutelyPositioned())
        break;
    }
    firstFrame = frame;
  }
}


text: A handy application for creating round-robin and playoff tournament


text:
package uk.ac.susx.tag.classificationframework.featureextraction.filtering;

import uk.ac.susx.tag.classificationframework.datastructures.AnnotatedToken;
import uk.ac.susx.tag.classificationframework.datastructures.Document;

import java.util.HashSet;
import java.util.Set;

/**
 * This is a TokenFilter, see the TokenFilter abstract class for details of function and purpose of
 * token filters.
 *
 * Filter tokens based on their PoS tag. A list of exceptions can be provided to.
 *
 * For example:
 *
 *  filter = new TokenFilterByPOS(",", Sets.newHashSet("?","!"))
 *
 * This produces a filter which filters tokens with the "," tag (CMU punctuation tag) attached,
 * so long as they aren't a question mark, or an exclamation mark.
 *
 * User: Andrew D. Robertson
 * Date: 27/07/2013
 * Time: 13:40
 */
public class TokenFilterByPOS extends TokenFilter {

    private static final long serialVersionUID = 0L;

    private String pos;
    private Set<String> exceptions;

    public TokenFilterByPOS(String pos, Set<String> exceptions) {
        this.pos = pos;
        this.exceptions = exceptions;
    }

    public TokenFilterByPOS(String pos){
        this(pos, new HashSet<String>());
    }

    public boolean filter(int index, Document tokens) {
        AnnotatedToken token = tokens.get(index);
        return token.get("pos").equals(pos) && !exceptions.contains(token.get("form"));
    }

    @Override
    public boolean isThreadSafe() {
        return true;
    }
}


text:
namespace media {
namespace cast {

// Partially parse / skip data in the header and the first partition,
// and return the base quantizer in the range [0,63], or -1 on parse error.
int ParseVp8HeaderQuantizer(const uint8_t* data, size_t size);

}  // namespace cast
}  // namespace media

#endif  // MEDIA_CAST_SENDER_VP8_QUANTIZER_PARSER_H_


text:
Python-Delicious
================

Python module to access del.icio.us via its API.

Copyright 2005-2008 by Paul Mucur
BSD License

To install:

    python setup.py install

For usage information and documentation, see index.html.

Contributors
------------

* [Morgan Craft](https://github.com/mgan59)


text:
function JSmacro(ex::Expr)
    mc = ex.args[1]
    if     mc == Symbol("@async")
        return JSasync(ex)
    elseif mc == Symbol("@reg")
        return JSreg(ex)
    elseif mc == Symbol("@posedge")
        return JSedgereg(ex)
    elseif mc == Symbol("@negedge")
        return JSedgereg(ex)
    elseif mc == Symbol("@delay")
        return JSdelay(ex)
    elseif mc == Symbol("@block")
        return JSmacroblock(ex)
    elseif mc == Symbol("@verilog")
        return JSverilog(ex)
    elseif mc == Symbol("@julia")
        return JSjulia(ex)
    else
        error("Hit an unexplored macrocall: $(mc)")
    end
end

function JSasync(ex::Expr)
    if !isa(ex.args[2], Expr)
        error("@async block is not a complete expr:\n$(ex)")
    end

    if !isa(ex.args[2].args[1], Expr)
        error("First argument in @async block is not an expr:\n$(ex)")
    end

    # Throw an error if a :(:=) is used
    JScolonequals(ex.args[2].args[1], ex.args[2].args[1])

    # Throw an error if a :(<=) is used
    JSnonblock(ex.args[2].args[1], ex.args[2].args[1])

    # Descend into the async and recursively do stuff
    ex.args[2].args[1] = JSasynchelper(ex.args[2].args[1])
end

function JSreg(ex::Expr)
    # Throw an error if the basic syntax is not met
    if !isa(ex.args[2], Expr)
        error("@reg block is not a complete expr:\n$(ex)")
    end
    if !isa(ex.args[2].args[1], Expr)
        error("First argument in @reg block is not an expr:\n$(ex)")
    end
    if length(ex.args[2].args[1].args) != 1
        error("Multiple Exprs found in @reg block:\n$(ex)")
    end

    # Throw an error if the first expr is not an if
    if ex.args[2].args[1].head != :if
        error("First argument in @reg block is not an if statement:\n$(ex)")
    end

    # Throws an error if there is more than the first if-else
    if length(ex.args[2].args) != 1
        error("@reg block contains more than 1 nested if-else expr:\n$(ex)")
    end

    # Throw an error if the bottom else is used
    if length(ex.args[2].args[1].args) != 2
        if JSregbottomelse(ex.args[2].args[1].args[3])
            error("The bottom-most else is used in an @reg block:\n$(ex)")
        end
    end

    # Throw an error if a :(:=) is used
    JScolonequals(ex.args[2].args[1])

    # Turn :(<=) into :(=)
    ex.args[2].args[1] = JSregequals(ex.args[2].args[1])

    # Descend into the reg and recursively do stuff
    ex.args[2].args[1] = JSreghelper(ex.args[2].args[1])

    # Turn :(=) into :(<=)
    ex.args[2].args[1] = JSregnonblocking(ex.args[2].args[1])
end

function JSedgereg(ex::Expr)
    # Throw an error if the basic syntax is not met
    if     isa(ex.args[2], Symbol)
        if !haskey(arrowDict , ex.args[2])
            error("Discovered uninstantiated symbol: $(rhs) in expr:\n$(ex)")
        end
        if arrowDict[ex.args[2]].BitCount != 1
            error("Pos or Neg edge register defined by a wire of bit count not 1:\n$(ex)")
        end
    elseif isa(ex.args[2], Expr)
        # MOON matrix stuff
        name = ex.args[2].args[1]
        if !haskey(arrowDict , name)
            error("Discovered uninstantiated symbol: $(name) in expr:\n$(ex)")
        end
        if isa(ex.args[2].args[2] , Expr)
            # Is a ref
            # check for single bit
            bl = ex.args[2].args[2].args[1]
            br = (length(ex.args[2].args) == 3) ?
                ex.args[2].args[2].args[3] : ex.args[2].args[2].args[2]
            bmax = max(bl, br)
            bmin = min(bl, br)
            arrowbl = arrowDict[name].BitLeft
            arrowbr = arrowDict[name].BitRight
            if bmax != bmin
                error("Wire for edge reg is referencing more than 1 bit:\n$(ex)")
            end
            if arrowDict[name].Endian == 1 && (bmax > arrowbl)
                error("Referencing bit $(bmax) which is outside wire $(name):\n$(ex)")
            end
            if arrowDict[name].Endian == 1 && (bmin < arrowbr)
                error("Referencing bit $(bmin) which is outside wire $(name):\n$(ex)")
            end
            if arrowDict[name].Endian == 2 && (bmax > arrowbr)
                error("Referencing bit $(bmax) which is outside wire $(name):\n$(ex)")
            end
            if arrowDict[name].Endian == 2 && (bmin < arrowbl)
                error("Referencing bit $(bmin) which is outside wire $(name):\n$(ex)")
            end
            # check for single bit outside range
        else
            # Must be a single bit
            b = ex.args[2].args[2]
            bl = arrowDict[name].BitLeft
            br = arrowDict[name].BitRight
            if arrowDict[name].Endian == 1 && (b > bl || b < br)
                error("Referencing bit $(b) which is outside wire $(name):\n$(ex)")
            end
            if arrowDict[name].Endian == 2 && (b < bl || b > br)
                error("Referencing bit $(b) which is outside wire $(name):\n$(ex)")
            end
        end
    end

    if !isa(ex.args[3], Expr)
        error("@posedge or @negedge block is not a complete Expr:\n$(ex)")
    end

    # Throw an error if a :(:=) is used
    JScolonequals(ex.args[2].args[1])

    # Turn :(<=) into :(=)
    ex.args[2].args[1] = JSregequals(ex.args[2].args[1])

    # Descend into the reg and recursively do stuff
    ex.args[2].args[1] = JSreghelper(ex.args[2].args[1])

    # Turn :(=) into :(<=)
    ex.args[2].args[1] = JSregnonblocking(ex.args[2].args[1])
end

# TODO this stuff
# Throw an error if all wires are not written to
# Create wires if needed, change to regs as needed
# Accomodate for ifs when they show up,
# for ifs turn condition into JIR
function JSasynchelper(ex::Expr)

end

function JSreghelper(ex::Expr)

end

function JSregbottomelse(ex::Expr)
    # Passed an else statement block
    l = length(ex.args)
    iferror = true
    for i = 1:l
        arg = ex.args[i]
        if isa(arg, Expr) && arg.head == :if
            iferror = false
            if length(arg.args) == 3
                iferror = iferror | JSregbottomelse(arg.args[3])
            end
        end
    end
    return iferror
end

# Throw an error if a :(:=) is recursively found
function JScolonequals(ex::Expr)
    JScolonequalshelper(ex, ex)
end
function JScolonequals(top::Expr, ex::Expr)
    l = length(ex.args)
    for i = 1:l
        arg = ex.args[i]
        if isa(arg, Expr)
            if arg.head == :(:=)
                error("ColonEquals assignment used in $(ex) in @reg block:\n$(top)")
            end
            JScolonequalshelper(top, arg)
        end
    end
end

# Replace :(=) in regs with :(<=)
function JSregnonblocking(ex::Expr)
    l = length(ex.args)
    for i = 1:l
        arg = ex.args[i]
        if isa(arg, Expr)
            if arg.head == :(=)
                ex.args[i] = Expr(:call, :(<=), arg.args[1], arg.args[2])
            else
                ex.args[i] = JSregnonblocking(arg)
            end
        end
    end
    return ex
end

function JSregequals(ex::Expr)
    l = length(ex.args)
    for i = 1:l
        arg = ex.args[i]
        if isa(arg, Expr)
            if arg.head == :call && arg.args[1] == :(<=)
                ex.args[i] = Expr(:(=), arg.args[2], arg.args[3])
            else
                ex.args[i] = JSregnonblocking(arg)
            end
        end
    end
    return ex
end

# Throw an error if a :(<=) is recursively found
function JSnonblock(top::Expr, ex::Expr)
    l = length(ex.args)
    for i = 1:l
        arg = ex.args[i]
        if isa(arg, Expr)
            if arg.head == :call && arg.args[1] == :(<=)
                error("Nonblocking operator used in $(ex) in @async block:\n$(top)")
            end
            JSnonblock(top, arg)
        end
    end
end

function JSdelay(ex::Expr)
    l = length(ex.args)
    if l != 3
        error("Inappopriate number of arguments in @delay block, is $(l-1) should be 2:\n$(ex)")
    end
    if !isa(ex.args[2], Float64)
        error("Time delay does not represent a Float64 number:\n$(ex)")
    end
    if !isa(ex.args[3], Expr)
        error("Final argument of @delay block is not a expr:\n$(ex)")
    end
    return ex
end

function JSmacroblock(ex::Expr)
    if length(ex.args) != 4
        error("@block macro has incorrect number of arguments, should be 3:\n$(ex)")
    end
    if !isa(ex.args[2], Symbol)
        error("@block macro does not have a Symbol as it's first argument:\n$(ex)")
    end
    if !isa(ex.args[3], String)
        error("@block macro does not have a String as it's second argument:\n$(ex)")
    end
    if !isa(ex.args[3], Expr)
        error("@block macro does not have an Expr as it's third argument:\n$(ex)")
    end
    if ex.args[3].head != Tuple
        error("@block macro does not have a Tuple as it's third argument:\n$(ex)")
    end

    return ex
end

function JSverilog(ex::Expr)
    if length(ex.args) != 2
        error("@verilog macro has incorrect number of arguments, should be only 1:\n$(ex)")
    end
    if !isa(ex.args[2], Expr)
        error("@verilog macro does not have an expr as it's argument:\n$(ex)")
    end
    if ex.args[2].head != :block
        error("@verilog macro does not have a block as it's argument:\n$(ex)")
    end
    if length(ex.args[2].args) != 1
        error("@verilog macro expr has incorrect number of exprs, should be only 1:\n$(ex)")
    end
    if !isa(ex.args[2].args[1], String)
        error("@verilog macro does not have contain a String inside it's block argument:\n$(ex)")
    end

    return ex
end

function JSjulia(ex::Expr)
    if length(ex.args) != 2
        error("@julia macro has incorrect number of arguments, should be only 1:\n$(ex)")
    end
    if !isa(ex.args[2], Expr)
        error("@julia macro does not have an expr as it's argument:\n$(ex)")
    end
    if ex.args[2].head != :block
        error("@julia macro does not have a block as it's argument:\n$(ex)")
    end
    if length(ex.args[2].args) != 1
        error("@julia macro expr has incorrect number of exprs, should be only 1:\n$(ex)")
    end
    if !isa(ex.args[2].args[1], String)
        error("@julia macro does not have contain a String inside it's block argument:\n$(ex)")
    end

    return ex
end


text:
![Faker.js](http://imgur.com/KiinQ.png)

[![Build Status](https://travis-ci.org/Marak/faker.js.svg?branch=master)](https://travis-ci.org/Marak/faker.js)

[![npm version](https://badge.fury.io/js/faker.svg)](http://badge.fury.io/js/faker)

## Demo

[http://marak.com/faker.js/](http://marak.com/faker.js/)

## Hosted API Microservice

[http://faker.hook.io](http://faker.hook.io/)
 - Supports all Faker API Methods
 - Full-Featured Microservice
 - Hosted by [hook.io](http://hook.io)

```bash
curl http://faker.hook.io?property=name.findName&locale=de
```

## Usage

### Browser

    <script src = "faker.js" type = "text/javascript"></script>
    <script>
      var randomName = faker.name.findName(); // Caitlyn Kerluke
      var randomEmail = faker.internet.email(); // Rusty@arne.info
      var randomCard = faker.helpers.createCard(); // random contact card containing many properties
    </script>

### Node.js

    var faker = require('faker');

    var randomName = faker.name.findName(); // Rowan Nikolaus
    var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
    var randomCard = faker.helpers.createCard(); // random contact card containing many properties

## API

### Faker.fake()

faker.js contains a super useful generator method `Faker.fake` for combining faker API methods using a mustache string format.

**Example:**

{{=<% %>=}}
``` js
console.log(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
// outputs: "Marks, Dean Sr."
```
<%={{ }}=%>

This will interpolate the format string with the value of methods `name.lastName()`, `name.firstName()`, and `name.suffix()`

### JSDoc API Browser

[http://marak.github.io/faker.js/](http://marak.github.io/faker.js/)

### API Methods

{{{API}}}

## Localization

As of version `v2.0.0` faker.js has support for multiple localities.

The default language locale is set to English.

Setting a new locale is simple:

```js
// sets locale to de
faker.locale = "de";
```

{{LOCALES}}

### Individual Localization Packages

As of vesion `v3.0.0` faker.js supports incremental loading of locales.

By default, requiring `faker` will include *all* locale data.

In a production environment, you may only want to include the locale data for a specific set of locales.

```js
// loads only de locale
var faker = require('faker/locale/de');
```

## Tests

    npm install .
    make test

You can view a code coverage report generated in coverage/lcov-report/index.html.

## Projects Built with faker.js

### Fake JSON Schema

Use faker generators to populate JSON Schema samples.
See: https://github.com/pateketrueke/json-schema-faker/

### CLI

Run faker generators from Command Line.
See: https://github.com/lestoni/faker-cli

**Want to see your project added here? Let us know!**

### Meteor

#### Meteor Installation

```
meteor add practicalmeteor:faker
```

#### Meteor Usage, both client and server

```js
var randomName = faker.name.findName(); // Rowan Nikolaus
var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
var randomCard = faker.helpers.createCard(); // random contact card containing many properties
```

## Building faker.js

faker uses [gulp](http://gulpjs.com/) to automate it's build process. Running the following build command will generate new browser builds, documentation, and code examples for the project.

```
npm run-script build
```

## Building JSDocs

```
npm run-script doc
```

## Version Release Schedule

faker.js is a popular project used by many organizations and individuals in production settings. Major and Minor version releases are generally on a monthly schedule. Bugs fixes are addressed by severity and fixed as soon as possible.

If you require the absolute latest version of `faker.js` the `master` branch @ http://github.com/marak/faker.js/ should always be up to date and working.

## Maintainer

#### Marak Squires

faker.js - Copyright (c) 2016
Matthew Bergman & Marak Squires
http://github.com/marak/faker.js/

faker.js was inspired by and has used data definitions from:

 * https://github.com/stympy/faker/ - Copyright (c) 2007-2010 Benjamin Curtis
 * http://search.cpan.org/~jasonk/Data-Faker-0.07/ - Copyright 2004-2005 by Jason Kohles

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://webservices.samples.jboss.org/")
package org.teiid.example.webservice;


text:
package com.intellij.codeInsight.daemon.impl;

import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.DeprecationUtil;
import com.intellij.codeInspection.InspectionProfile;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiElement;
import consulo.logging.Logger;
import consulo.ui.image.Image;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public interface HighlightInfoType {
  @NonNls String UNUSED_SYMBOL_SHORT_NAME = "unused";
  @NonNls String UNUSED_SYMBOL_DISPLAY_NAME = InspectionsBundle.message("inspection.dead.code.display.name");
  @Deprecated
  @NonNls String UNUSED_SYMBOL_ID = "UnusedDeclaration";

  HighlightInfoType ERROR = new HighlightInfoTypeImpl(HighlightSeverity.ERROR, CodeInsightColors.ERRORS_ATTRIBUTES);
  HighlightInfoType WARNING = new HighlightInfoTypeImpl(HighlightSeverity.WARNING, CodeInsightColors.WARNINGS_ATTRIBUTES);
  /**
   * @deprecated use {@link #WEAK_WARNING} instead
   */
  HighlightInfoType INFO = new HighlightInfoTypeImpl(HighlightSeverity.INFO, CodeInsightColors.INFO_ATTRIBUTES);
  HighlightInfoType WEAK_WARNING = new HighlightInfoTypeImpl(HighlightSeverity.WEAK_WARNING, CodeInsightColors.WEAK_WARNING_ATTRIBUTES);
  HighlightInfoType INFORMATION = new HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, CodeInsightColors.INFORMATION_ATTRIBUTES);

  HighlightInfoType WRONG_REF = new HighlightInfoTypeImpl(HighlightSeverity.ERROR, CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);

  HighlightInfoType GENERIC_WARNINGS_OR_ERRORS_FROM_SERVER =
          new HighlightInfoTypeImpl(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING, CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING);

  HighlightInfoType DUPLICATE_FROM_SERVER = new HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, CodeInsightColors.DUPLICATE_FROM_SERVER);

  HighlightInfoType UNUSED_SYMBOL =
          new HighlightInfoTypeSeverityByKey(HighlightDisplayKey.findOrRegister(UNUSED_SYMBOL_SHORT_NAME, UNUSED_SYMBOL_DISPLAY_NAME, UNUSED_SYMBOL_SHORT_NAME),
                                             CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES);

  HighlightInfoType DEPRECATED = new HighlightInfoTypeSeverityByKey(
          HighlightDisplayKey.findOrRegister(DeprecationUtil.DEPRECATION_SHORT_NAME, DeprecationUtil.DEPRECATION_DISPLAY_NAME, DeprecationUtil.DEPRECATION_ID),
          CodeInsightColors.DEPRECATED_ATTRIBUTES);

  HighlightInfoType MARKED_FOR_REMOVAL =
          new HighlightInfoTypeSeverityByKey(HighlightDisplayKey.findOrRegister(DeprecationUtil.FOR_REMOVAL_SHORT_NAME, DeprecationUtil.FOR_REMOVAL_DISPLAY_NAME, DeprecationUtil.FOR_REMOVAL_ID),
                                             CodeInsightColors.MARKED_FOR_REMOVAL_ATTRIBUTES);

  HighlightSeverity SYMBOL_TYPE_SEVERITY = new HighlightSeverity("SYMBOL_TYPE_SEVERITY", HighlightSeverity.INFORMATION.myVal - 2);

  HighlightInfoType TODO = new HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, CodeInsightColors.TODO_DEFAULT_ATTRIBUTES, false);
          // these are default attributes, can be configured differently for specific patterns
  HighlightInfoType UNHANDLED_EXCEPTION = new HighlightInfoTypeImpl(HighlightSeverity.ERROR, CodeInsightColors.ERRORS_ATTRIBUTES);

  HighlightSeverity INJECTED_FRAGMENT_SEVERITY = new HighlightSeverity("INJECTED_FRAGMENT", SYMBOL_TYPE_SEVERITY.myVal - 1);
  HighlightInfoType INJECTED_LANGUAGE_FRAGMENT = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.INFORMATION_ATTRIBUTES);
  HighlightInfoType INJECTED_LANGUAGE_BACKGROUND = new HighlightInfoTypeImpl(INJECTED_FRAGMENT_SEVERITY, CodeInsightColors.INFORMATION_ATTRIBUTES);

  HighlightSeverity ELEMENT_UNDER_CARET_SEVERITY = new HighlightSeverity("ELEMENT_UNDER_CARET", HighlightSeverity.ERROR.myVal + 1);
  HighlightInfoType ELEMENT_UNDER_CARET_READ =
          new HighlightInfoType.HighlightInfoTypeImpl(ELEMENT_UNDER_CARET_SEVERITY, EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES);
  HighlightInfoType ELEMENT_UNDER_CARET_WRITE =
          new HighlightInfoType.HighlightInfoTypeImpl(ELEMENT_UNDER_CARET_SEVERITY, EditorColors.WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES);

  /**
   * @see com.intellij.openapi.editor.markup.RangeHighlighter#VISIBLE_IF_FOLDED
   */
  Set<HighlightInfoType> VISIBLE_IF_FOLDED = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
          ELEMENT_UNDER_CARET_READ,
          ELEMENT_UNDER_CARET_WRITE,
          WARNING,
          ERROR,
          WRONG_REF
  )));

  @Nonnull
  HighlightSeverity getSeverity(@Nullable PsiElement psiElement);

  TextAttributesKey getAttributesKey();

  class HighlightInfoTypeImpl implements HighlightInfoType, HighlightInfoType.UpdateOnTypingSuppressible {
    private final HighlightSeverity mySeverity;
    private final TextAttributesKey myAttributesKey;
    private boolean myNeedsUpdateOnTyping;

    //read external only
    HighlightInfoTypeImpl(@Nonnull Element element) {
      mySeverity = new HighlightSeverity(element);
      myAttributesKey = new TextAttributesKey(element);
    }

    public HighlightInfoTypeImpl(@Nonnull HighlightSeverity severity, TextAttributesKey attributesKey) {
      this(severity, attributesKey, true);
    }

    public HighlightInfoTypeImpl(@Nonnull HighlightSeverity severity, TextAttributesKey attributesKey, boolean needsUpdateOnTyping) {
      mySeverity = severity;
      myAttributesKey = attributesKey;
      myNeedsUpdateOnTyping = needsUpdateOnTyping;
    }

    @Override
    @Nonnull
    public HighlightSeverity getSeverity(@Nullable PsiElement psiElement) {
      return mySeverity;
    }

    @Override
    public TextAttributesKey getAttributesKey() {
      return myAttributesKey;
    }

    @Override
    @SuppressWarnings({"HardCodedStringLiteral"})
    public String toString() {
      return "HighlightInfoTypeImpl[severity=" + mySeverity + ", key=" + myAttributesKey + "]";
    }

    public void writeExternal(Element element) {
      try {
        mySeverity.writeExternal(element);
      }
      catch (WriteExternalException e) {
        throw new RuntimeException(e);
      }
      myAttributesKey.writeExternal(element);
    }

    @Override
    public boolean equals(final Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;

      final HighlightInfoTypeImpl that = (HighlightInfoTypeImpl)o;

      if (!Comparing.equal(myAttributesKey, that.myAttributesKey)) return false;
      if (!mySeverity.equals(that.mySeverity)) return false;

      return true;
    }

    @Override
    public int hashCode() {
      int result = mySeverity.hashCode();
      result = 29 * result + myAttributesKey.hashCode();
      return result;
    }

    @Override
    public boolean needsUpdateOnTyping() {
      return myNeedsUpdateOnTyping;
    }
  }

  class HighlightInfoTypeSeverityByKey implements HighlightInfoType {
    static final Logger LOG = Logger.getInstance(HighlightInfoTypeSeverityByKey.class);

    private final TextAttributesKey myAttributesKey;
    private final HighlightDisplayKey myToolKey;

    public HighlightInfoTypeSeverityByKey(HighlightDisplayKey severityKey, TextAttributesKey attributesKey) {
      myToolKey = severityKey;
      myAttributesKey = attributesKey;
    }

    @Override
    @Nonnull
    public HighlightSeverity getSeverity(final PsiElement psiElement) {
      InspectionProfile profile = psiElement == null
                                  ? (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile()
                                  : InspectionProjectProfileManager.getInstance(psiElement.getProject()).getInspectionProfile();
      return profile.getErrorLevel(myToolKey, psiElement).getSeverity();
    }

    @Override
    public TextAttributesKey getAttributesKey() {
      return myAttributesKey;
    }

    @Override
    @SuppressWarnings({"HardCodedStringLiteral"})
    public String toString() {
      return "HighlightInfoTypeSeverityByKey[severity=" + myToolKey + ", key=" + myAttributesKey + "]";
    }

    public HighlightDisplayKey getSeverityKey() {
      return myToolKey;
    }
  }

  interface Iconable {
    @Nullable
    Image getIcon();
  }

  interface UpdateOnTypingSuppressible {
    boolean needsUpdateOnTyping();
  }
}


text:
define(['q', 'dust-helper'], function(Q, dustHelper) {
  return function(name) {
    var helper = dustHelper(name);

    helper.renderAsync = Q.nfbind(helper.render);
    helper.streamAsync = Q.nfbind(helper.stream);

    return {
      render: function(context, callback) {
        if(callback || typeof context === 'function') {
          return helper.render(context, callback);
        }
        return helper.renderAsync(context);
      },

      renderSync: function(context) {
        return helper.renderSync(context);
      }
    };
  };
});


text:
import * as actions from './app';

describe('App actions', () => {
  it('should create an action to scroll to bottom', () => {
    expect(actions.setScrolledToBottom('test')).toEqual({
      type: 'SET_SCROLLED_TO_BOTTOM',
      payload: 'test',
    });
  });

  it('should create an action to close modal', () => {
    expect(actions.closeModal()).toEqual({
      type: 'CLOSE_MODAL',
    });
  });

  it('should create an action to open modal', () => {
    expect(actions.openModal('test')).toEqual({
      type: 'OPEN_MODAL',
      payload: 'test',
    });
  });

  it('should create an action to clear activities', () => {
    const mockDispatch = jest.fn();

    actions.clearActivities()(mockDispatch);

    expect(mockDispatch).toHaveBeenLastCalledWith({
      type: 'CLEAR_ACTIVITIES',
    });
  });
  it('should create all actions', () => {
    const mockDispatch = jest.fn();

    const actionsResults = [
      [actions.toggleWindowFocus('test'), 'TOGGLE_WINDOW_FOCUS'],
      [actions.showNotice('test'), 'SHOW_NOTICE'],
      [actions.toggleSoundEnabled('test'), 'TOGGLE_SOUND_ENABLED'],
      [actions.toggleSocketConnected('test'), 'TOGGLE_SOCKET_CONNECTED'],
      [actions.createUser('test'), 'CREATE_USER'],
      [actions.setLanguage('test'), 'CHANGE_LANGUAGE'],
    ];

    actionsResults.forEach(([action, type]) => {
      action(mockDispatch);
      expect(mockDispatch).toHaveBeenLastCalledWith({
        type,
        payload: 'test',
      });
    });
  });
});


text:
import arrayify from './arrayify';
import getExpectedPropsFromSelector from './getExpectedPropsFromSelector';
import getAllMatches from './getAllMatches';

const selectorRegex = /:([\w-_]+)/g;
const elementRegex = /::([\w-_]+)/g;

function makeStyleStateSatisfactionChecker (styleState) {
  return function (propString) {
    const propNames = getAllMatches(selectorRegex, propString.replace(elementRegex, '')).map(matches => matches[1]).filter(m => !!m);
    return propNames.every(p => !!styleState[p]);
  }
}

function makePropsSatisfactionChecker (props) {
  return function (propString) {
    const propsAndValues = getExpectedPropsFromSelector(propString);
    return Object.keys(propsAndValues).every((propName) => {
      const expectedValue = propsAndValues[propName];

      if (expectedValue === undefined) {
        return !!props[propName];
      }

      return props[propName] === expectedValue;
    });
  }
}

function splitPseudoElementString (fullString) {
  const idx = fullString.indexOf('::');
  return [fullString, fullString.substr(0, idx), fullString.substr(idx)];
}

function getValue (style, k, styleState, props) {
  const value = style[k];

  if (typeof value === 'function') {
    return value({styleState, props});
  }

  return value;
}

export default function computeStylesFromState ({styles, styleState={}, props={}}) {
  if (!styles) {
    return [];
  }

  const satisfiesStyleState = makeStyleStateSatisfactionChecker(styleState);
  const satisfiesProps = makePropsSatisfactionChecker(props);
  const satisfiesSelector = str => satisfiesStyleState(str) && satisfiesProps(str);

  return arrayify(styles).filter(s =>
    ['string','function','object'].indexOf(typeof s) > -1
  ).reduce((computedStyles, style) => {
    if (!style) {
      return computedStyles;
    }

    const styleType = (typeof style);

    if (styleType === 'string') {
      computedStyles.push(style);
      return computedStyles;
    }

    if (styleType === 'function') {
      computedStyles.push(...computeStylesFromState({
        styles: style({styleState, props}),
        styleState,
        props,
      }));
      return computedStyles;
    }

    // styleType === 'object':

    let base = style[':base'];

    if ((typeof base) === 'function') {
      base = base({styleState, props});
    }

    arrayify(base).forEach((base) => {
      if ((typeof base) === 'object') {
        Object.assign(style, base);
      } else if ((typeof base) === 'string') {
        computedStyles.push(base);
      }
    });

    const {
      topLevel,
      conditionals,
      pseudoElements,
    } = Object.keys(style).reduce((keys, k) => {
      if (/::/.test(k)) {
        keys.pseudoElements.push(k);
      } else if (/^:|^\[.+\]/.test(k)) {
        keys.conditionals.push(k);
      } else if (k !== ':base') {
        keys.topLevel.push(k);
      }

      return keys;
    }, {
      topLevel: [],
      conditionals: [],
      pseudoElements: [],
    });

    const topLevelStyles = topLevel.reduce((result, k) => {
      result[k] = getValue(style, k, styleState, props);
      return result;
    }, {});

    if (topLevel.length > 0) {
      computedStyles.push(topLevelStyles);
    }

    const addValue = (k) => {
      const value = getValue(style, k, styleState, props);

      if (Array.isArray(value)) {
        computedStyles.push(...value);
      } else {
        computedStyles.push(value);
      }
    }

    conditionals.filter(satisfiesSelector).forEach(addValue);

    pseudoElements.map(splitPseudoElementString)
    .filter(([k, propString]) => {
      return satisfiesSelector(propString);
    }).forEach(([k, _, pseudoElementName]) => {
      computedStyles.push({[pseudoElementName]: getValue(style, k, styleState, props)});
    });

    return computedStyles;
  }, []);
}