text:
package CSS::Prepare::Property::Generated;

use Modern::Perl;
use CSS::Prepare::Property::Expansions;
use CSS::Prepare::Property::Values;

sub parse {
    my $self        = shift;
    my $has_hack    = shift;
    my $location    = shift;
    my %declaration = @_;

    my $property = $declaration{'property'};
    my $value    = $declaration{'value'};
    my %canonical;
    my @errors;

    my $valid_property_or_error = sub {
            my $type  = shift;

            my $sub      = "is_${type}_value";
            my $is_valid = 0;

            eval {
                no strict 'refs';
                $is_valid = &$sub( $value );
            };

            if ( $is_valid ) {
                $canonical{ $property } = $value;
            }
            else {
                $type =~ s{_}{-}g;
                push @errors, {
                        error => "invalid ${type} property: '${value}'"
                    };
            }
            return $is_valid;
        };

    foreach my $type qw( content  quotes ) {
        &$valid_property_or_error( $type )
            if $type eq $property;
    }

    &$valid_property_or_error( 'counter_increment' )
        if 'counter-increment' eq $property;

    &$valid_property_or_error( 'counter_reset' )
        if 'counter-reset' eq $property;

    &$valid_property_or_error( 'list_style_type' )
        if 'list-style-type' eq $property;

    &$valid_property_or_error( 'list_style_image' )
        if 'list-style-image' eq $property;

    &$valid_property_or_error( 'list_style_position' )
        if 'list-style-position' eq $property;

    if ( 'list-style' eq $property ) {
        my %types = (
                'list-style-type'     => $list_style_type_value,
                'list-style-image'    => $list_style_image_value,
                'list-style-position' => $list_style_position_value,
            );

        %canonical = validate_any_order_shorthand( $value, %types );

        push @errors, {
                error => "invalid list-style property: '${value}'"
            }
            unless %canonical;
    }

    if ( defined $canonical{'list-style-image'} ) {
        $canonical{'list-style-image'} = shorten_url_value(
                $canonical{'list-style-image'},
                $location,
                $self,
            );
    }

    return \%canonical, \@errors;
}
sub output {
    my $self  = shift;
    my $block = shift;
    my @output;

    my @properties = qw( content  counter-increment  counter-reset );
    foreach my $property ( @properties ) {
        my $value = $block->{ $property };

        push @output, sprintf $self->output_format, "${property}:", $value
            if defined $value;
    }

    if ( defined $block->{'quotes'} ) {
        my $value = $block->{'quotes'};
        my $quote_pairs = qr{ ( $string_value \s+ $string_value ) \s* }x;
        my @values;

        while ( $value =~ s{^ $quote_pairs }{}x ) {
            push @values, $1;
        }

        $value = join $self->output_separator, @values;

        push @output, sprintf $self->output_format, "quotes:", $value;
    }

    my @list_properties = qw(
            list-style-type  list-style-image  list-style-position
        );
    my @values;
    my @list;
    foreach my $property ( @list_properties ) {
        my $value = $block->{ $property };

        if ( defined $value ) {
            push @list, sprintf $self->output_format, "${property}:", $value;
            push @values, $value
                if $value;
        }
    }

    if ( 3 == scalar @list ) {
        my $value = join $self->output_separator, @values;

        push @output, sprintf $self->output_format, 'list-style:', $value;
    }
    else {
        push @output, @list;
    }

    return @output;
}

1;


text:
@implementation KVGameStats

@end

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * PlugindvbNewsletterSubscription
 *
 * This class has been auto-generated by the Doctrine ORM Framework
 *
 * @package    ##PACKAGE##
 * @subpackage ##SUBPACKAGE##
 * @author     ##NAME## <##EMAIL##>
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class PlugindvbNewsletterSubscription extends BasedvbNewsletterSubscription
{

}


text:
Orbitals
========

This project aims to simulate the orbital structure of a hydrogen atom. It
evaluates the quantum wavefunction at a large number of points, composing an
image of the spatial probability of the single electron's location. OpenCL is
used to parallelize the process, resulting in significant speedups.

This software was designed and developed as my final project for RPI's
CSCI-4320, Parallel Programming.

All code is being released under the two-clause BSD license, which can be found
in the toplevel LICENSE file.

Dependencies
------------

* Python
* PyOpenCL
* PIL
* numpy


text:
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var _open = require('gulp-open');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var jsdoc = require("gulp-jsdoc");
var rename = require("gulp-rename");

/**********************************************
 * Javascript Section
 * 1. jshint
 * 2. concat
 * 3. minify
 * 4. move to destination folder
 */

var libs = "src/libs/*.js";
var modules = "src/modules/*.js";
var main = "src/main.js";

// TODO: probably also lint background.js and contentscript.js in Chrome folder
gulp.task('lint', function() {
  gulp.src(modules)
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter(stylish));

  return gulp.src(main)
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter(stylish));
});

/* Concat only main.js with modules */
gulp.task('concat', ['lint'], function() {

  // concat the modules as is
  gulp.src([modules, main])
    .pipe(concat('drivepass.js'))
    .pipe(gulp.dest('src/build'));

  // concat the third party libraries separately
  return gulp.src(libs)
    .pipe(concat('dp.libs.js'))
    .pipe(gulp.dest('src/build'));
});

gulp.task('minify', ['concat'], function() {

  return gulp.src('./src/build/drivepass.js')
    .pipe(uglify({
      outSourceMap: true
    }))
    .pipe(rename("drivepass.min.js"))
    .pipe(gulp.dest('src/build'));
});

// JSDoc stuff
gulp.task('doc', function() {
  gulp.src("./src/modules/*.js")
    .pipe(jsdoc('./doc'));
});

/**********************************************
 * Move files to current destination folder
 */

// Global setting to state which browser you are building for
var buildFor = "Chrome";

function moveStuff(cfg) {
  return gulp.src(cfg.src)
    .pipe(gulp.dest(cfg.dest));
}

function exportTo(_dest) {
  moveStuff({
    src: "src/css/**",
    dest: _dest + "/css"
  });
  moveStuff({
    src: "src/build/*",
    dest: _dest + "/js"
  });
  moveStuff({
    src: "src/img/*",
    dest: _dest + "/img"
  });
}

gulp.task('export', ['minify'], function() {
  exportTo(buildFor);
});

/**********************************************
 * Reload Chrome Extension
 */

gulp.task("reload_chrome_extension", function() {
  var options = {
    url: "http://reload.extensions",
    app: "google-chrome"
  };
  return gulp.src("./index.html") // A file must be specified as the src when running options.url or gulp will overlook the task.
  .pipe(_open("", options));
});

/**********************************************
 * Watch
 */

gulp.task('watch', ['export'], function() {
  gulp.watch(modules, ['export']);
  gulp.watch(main, ['export']);
  gulp.watch('src/css/*.css', ['export']);
  gulp.watch('src/img/**', ['export']);
});

gulp.task('watch_chrome', ['export'], function() {
  // override buildFor just in case it has been set to something else
  buildFor = "Chrome";
  gulp.watch(modules, ['export', "reload_chrome_extension"]);
  gulp.watch(main, ['export', "reload_chrome_extension"]);

  gulp.watch('Chrome/background.js', ["reload_chrome_extension"]);
  gulp.watch('Chrome/js/contentscript.js', ["reload_chrome_extension"]);

  gulp.watch('src/css/*.css', ['export', "reload_chrome_extension"]);
  gulp.watch('src/img/**', ['export', "reload_chrome_extension"]);
});

gulp.task('default', ['export']);


text:
namespace Zu.ChromeDevTools.Network
{
    using Newtonsoft.Json;

    ///
    /// WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.
    ///
    public sealed class WebSocketFrame
    {
        ///
        /// WebSocket message opcode.
        ///
        [JsonProperty("opcode")]
        public double Opcode
        {
            get;
            set;
        }
        ///
        /// WebSocket message mask.
        ///
        [JsonProperty("mask")]
        public bool Mask
        {
            get;
            set;
        }
        ///
        /// WebSocket message payload data.
        /// If the opcode is 1, this is a text message and payloadData is a UTF-8 string.
        /// If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.
        ///
        [JsonProperty("payloadData")]
        public string PayloadData
        {
            get;
            set;
        }
    }
}


text:
<?php

namespace minsalSIG\minsalSIGBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ConsolidadoPlazaController extends Controller
{
	 public function ConsolidadoPlazaAction(Request $request)
    {

             return $this->render('minsalSIGminsalSIGBundle:Estrategico:conPlazas.html.twig');

     }
}


text:
namespace JF.AspNet.Identity.DocumentDB {

	/// <summary>
	///     Represents an identity claim
	/// </summary>
	public class IdentityUserClaim : IIdentityUserClaim {

		/// <summary>
		///     The claim type
		/// </summary>
		public string ClaimType { get; set; }

		/// <summary>
		///     The claim value
		/// </summary>
		public string ClaimValue { get; set; }

	}

}


text:
/**
 * This package contains interfaces, implementations, and other utilities for
 * working with {@link java.util.Collection}s and {@link java.util.Map}s.
 */
package com.palamida.util.collect;


text:
#ifndef PLORTH_CLI_TERMINAL_HPP_GUARD
#define PLORTH_CLI_TERMINAL_HPP_GUARD

#include <string>

namespace plorth
{
  namespace cli
  {
    namespace terminal
    {
      bool prompt(const std::string&, std::u32string&);
      void add_to_history(const std::u32string&);
    }
  }
}

#endif /* !PLORTH_CLI_TERMINAL_HPP_GUARD */


text:
	<title>Phat Pham | Projects</title>
	<link rel='shortcut icon' href='assets/palmtrees.ico' type='image/x-icon'/ >
	<link rel="stylesheet" type="text/css" href="style/layout.css" />
	<link rel="stylesheet" type="text/css" href="style/content.css" />

About

Resume

Education

Experiences

Projects

Phat Pham

    			☰

Projects

		The project page is currently under construction.

		Please come back again later.

Want to contact or learn more about Phat Pham?


text:
package blue.lapis.common.economy.event.impl;

import blue.lapis.common.economy.EconomyAccount;
import blue.lapis.common.economy.event.AccountCreatedEvent;

public class AccountCreatedEventImpl extends EconomyEventImpl implements AccountCreatedEvent {
    public AccountCreatedEventImpl(EconomyAccount account) {
        super(account);
    }
}


text:
package at.alladin.rmbt.android.adapter.result;

/**
 *
 * @author lb
 *
 */
public interface OnCompleteListener {

	public final static int ERROR = -1;

	public final static int INITIALIZED = 0;

	public final static int DATA_LOADED = 1;

	/**
	 *
	 */
	public void onComplete(int flag, Object object);
}


text:
package com.salesforce.keystone.roadrunner;

import com.salesforce.keystone.roadrunner.bytes.ByteAccessor;
import com.salesforce.keystone.roadrunner.bytes.ByteConverter;
import com.salesforce.keystone.roadrunner.header.RoadRunnerHeader;
import com.salesforce.keystone.roadrunner.header.RoadRunnerHeaderCodec;
import com.salesforce.keystone.roadrunner.memory.BytesManager;
import com.salesforce.keystone.roadrunner.memory.ConvertingByteManager;
import com.salesforce.keystone.roadrunner.nio.streams.ByteBufferOutputStream;

import java.io.IOException;

/**
 * Helper class to encode a {@link RoadRunnerMessage} to bytes
 */
public class RoadRunnerMessageSerializer<T> {

  private final BytesManager<ByteAccessor> manager;
  private final ByteConverter<T> converter;

  public RoadRunnerMessageSerializer(ByteConverter<T> converter, BytesManager<T> manager) {
    this.converter = converter;
    this.manager = new ConvertingByteManager<>(converter, manager);
  }

  /**
   * writes the frame header & message (but not the trailer) to a new buffer,
   * and flips the buffer so it is ready for writing
   */
  public T serialize(RoadRunnerMessage message) throws IOException {
    ByteAccessor b = manager.allocate(message.getMsgLen() + RoadRunnerHeader.HEADER_LENGTH);
    serializeTo(message, b);
    //flip it so we can write from the the buffer immediately
    b.flip();
    return converter.unwrap(b);
  }

  /**
   * writes the serialized frame header & protocol buffer message to the buffer,
   * does <b>NOT</b> flip it
   */
  ByteAccessor serializeTo(RoadRunnerMessage m, ByteAccessor b) throws IOException {
    RoadRunnerHeaderCodec.serializeHeader(m, b);
    m.getMessage().writeTo(converter.toOutputStream(b));
    return b;
  }
}


text:
[![Build Status](https://travis-ci.org/dimelo/rightnow.png?branch=master)](https://travis-ci.org/dimelo/rightnow)

Ruby wrapper for the Oracle Rightnow Social API v2

## Installation

Add this line to your application's Gemfile:

    gem 'rightnow-client'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rightnow-client

## Usage

Instanciate a new client with your community url, API keys and API default user:

```ruby
client = Rightnow::Client.new "http://community.company.com", :api_key => "YOUR_PUBLIC_KEY", :secret_key => "YOUR_PRIVATE_KEY", :user => "api@dimelo.com"
```

The user specified here is a user of the community (usually a superadmin) which must have the permissions for all the actions you want to do with the client.

Then you can query the search API with:

```ruby
res = client.search term: 'white', limit: 50
```

Get more details for one or more post:

```ruby
client.post_get res.first
client.post_get ["fa8e6cc713", "fa8e6cb714"]
```

Fetch all comments for a post:

```ruby
client.comment_list res.first
client.comment_list "fa8e6cc713"
```

Add a comment:

```ruby
client.comment_add res.first, "Hello", as: 'user@email.com'
client.comment_add "fa8e6cc713", "Hello", as: 'user@email.com'
```

Edit a comment:

```ruby
client.comment_update res.first, "Hello 2", as: 'user@email.com'
client.comment_update "fa8e6cc713", "Hello 2", as: 'user@email.com'
```

Delete a comment:

```ruby
client.comment_delete 777, as: 'author@email.com'
```

Get more details for one or more users:

```ruby
client.user_get res.first.created_by.hash
client.user_get ["fa8e6cc713", "fa8e6cb714"]
```

Or any other generic request:

```ruby
client.request 'UserList', :as => 'admin@domain.com'
```

## Debug

Instanciate the client with a `:debug => true` option to get debug info:

```ruby
client = Rightnow::Client.new "http://community.company.com", ..., :debug => true
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
/**
 * Created by Florin Chelaru ( florin [dot] chelaru [at] gmail [dot] com )
 * Date: 8/28/2015
 * Time: 2:17 PM
 */

goog.provide('vs.models.DataArray');
goog.require('vs.models.Boundaries');

/**
 * @param {Array} d
 * @param {string} [label]
 * @param {vs.models.Boundaries} [boundaries]
 * @constructor
 */
vs.models.DataArray = function(d, label, boundaries) {
  /**
   * @type {Array}
   * @private
   */
  this._d = d;

  /**
   * @type {string|undefined}
   * @private
   */
  this._label = label;

  /**
   * @type {vs.models.Boundaries|undefined}
   * @private
   */
  this._boundaries = boundaries;
};

/**
 * @type {string|undefined}
 * @name vs.models.DataArray#label
 */
vs.models.DataArray.prototype.label;

/**
 * @type {Array}
 * @name vs.models.DataArray#d
 */
vs.models.DataArray.prototype.d;

/**
 * @type {vs.models.Boundaries|undefined}
 * @name vs.models.DataArray#boundaries
 */
vs.models.DataArray.prototype.boundaries;

Object.defineProperties(vs.models.DataArray.prototype, {
  'label': { get: /** @type {function (this:vs.models.DataArray)} */ (function () { return this._label; })},
  'd': { get: /** @type {function (this:vs.models.DataArray)} */ (function() { return this._d; })},
  'boundaries': { get: /** @type {function (this:vs.models.DataArray)} */ (function() { return this._boundaries; })}
});


text:
PIPELINE_CSS = {
    'common': {
        'source_filenames': (
            'normalize-css/normalize.css',
            'sumo/less/main.less',
            'sumo/less/search.less',
        ),
        'output_filename': 'build/common-min.css'
    },
    'community': {
        'source_filenames': (
            'sumo/less/wiki-content.less',
            'community/less/community.less',
            'community/less/select.less',
        ),
        'output_filename': 'build/community-min.css'
    },
    'community-new': {
        'source_filenames': (
            'fontawesome/css/font-awesome.css',
            'pikaday/css/pikaday.css',
            'sumo/less/wiki-content.less',
            'community/less/community-new.less',
        ),
        'output_filename': 'build/community-new-min.css'
    },
    'mobile-common': {
        'source_filenames': (
            'fontawesome/css/font-awesome.css',
            'normalize-css/normalize.css',
            'sumo/less/mobile/main.less',
            'sumo/less/mobile/search.less',
        ),
        'output_filename': 'build/mobile-common-min.css'
    },
    'print': {
        'source_filenames': (
            'sumo/css/print.css',
        ),
        'output_filename': 'build/print-min.css',
        'extra_context': {
            'media': 'print',
        }
    },
    # TODO: remove dependency on jquery ui CSS and use our own
    'jqueryui': {
        'source_filenames': (
            'sumo/css/jqueryui/jqueryui.css',
        ),
        'output_filename': 'build/jqueryui-min.css'
    },
    'forums': {
        'source_filenames': (
            'sumo/less/forums.less',
            'sumo/less/reportabuse.less',
        ),
        'output_filename': 'build/forums-min.css'
    },
    'questions': {
        'source_filenames': (
            'sumo/less/questions.less',
            'sumo/css/cannedresponses.css',
            'sumo/less/reportabuse.less',
        ),
        'output_filename': 'build/questions-min.css'
    },
    'questions.metrics': {
        'source_filenames': (
            'sumo/less/questions.metrics.less',
        ),
        'output_filename': 'build/questions.metrics-min.css'
    },
    'questions.aaq.react': {
        'source_filenames': (
            'fontawesome/css/font-awesome.css',
            'questions/less/questions.aaq.react.less',
        ),
        'output_filename': 'build/questions.aaq.react-min.css'
    },
    'mobile-questions': {
        'source_filenames': (
            'sumo/less/mobile/questions.less',
        ),
        'output_filename': 'build/mobile-questions-min.css'
    },
    'mobile-aaq': {
        'source_filenames': (
            'sumo/less/mobile/aaq.less',
        ),
        'output_filename': 'build/mobile-aaq-min.css'
    },
    'rickshaw': {
        'source_filenames': (
            'sumo/css/jqueryui/jqueryui.css',
            'sumo/css/rickshaw.css',
            'sumo/less/rickshaw.sumo.less',
        ),
        'output_filename': 'build/rickshaw-min.css'
    },
    'mobile-search': {
        'source_filenames': (
            'sumo/less/mobile/search.less',
        ),
        'output_filename': 'build/mobile-search-min.css'
    },
    'wiki': {
        'source_filenames': (
            'sumo/css/users.autocomplete.css',
            'sumo/css/users.list.css',
            'sumo/less/wiki.less',
            'sumo/less/wiki-content.less',
            'sumo/css/screencast.css',
        ),
        'output_filename': 'build/wiki-min.css'
    },
    'wiki-editor': {
        'source_filenames': (
            'codemirror/lib/codemirror.css',
            'codemirror/addon/hint/show-hint.css',
        ),
        'output_filename': 'wiki-editor-min.css'
    },
    'mobile-wiki': {
        'source_filenames': (
            'sumo/less/mobile/wiki.less',
            'sumo/less/wiki-content.less',
        ),
        'output_filename': 'build/mobile-wiki-min.css'
    },
    'mobile-wiki-minimal': {
        'source_filenames': (
            'normalize-css/normalize.css',
            'sumo/less/mobile/main.less',
            'sumo/less/mobile/wiki.less',
            'sumo/less/wiki-content.less',
        ),
        'output_filename': 'build/mobile-wiki-minimal-min.css'
    },
    'home': {
        'source_filenames': (
            'sumo/less/home.less',
        ),
        'output_filename': 'build/home-min.css'
    },
    'gallery': {
        'source_filenames': (
            'sumo/less/gallery.less',
        ),
        'output_filename': 'build/gallery-min.css'
    },
    'ie': {
        'source_filenames': (
            'sumo/css/ie.css',
            'sumo/css/ie8.css',
        ),
        'output_filename': 'build/ie-min.css'
    },
    'ie8': {
        'source_filenames': (  # IE 8 needs some specific help.
            'sumo/css/ie8.css',
        ),
        'output_filename': 'build/ie8-min.css'
    },
    'customercare': {
        'source_filenames': (
            'sumo/less/customercare.less',
        ),
        'output_filename': 'build/customercare-min.css'
    },
    'users': {
        'source_filenames': (
            'sumo/less/users.less',
            'sumo/less/reportabuse.less',
        ),
        'output_filename': 'build/users-min.css'
    },
    'mobile-users': {
        'source_filenames': (
            'sumo/less/mobile/users.less',
        ),
        'output_filename': 'build/mobile-users-min.css'
    },
    'monitor': {
        'source_filenames': (
            'sumo/css/monitor.css',
        ),
        'output_filename': 'build/monitor-min.css'
    },
    'messages': {
        'source_filenames': (
            'sumo/css/users.autocomplete.css',
            'sumo/less/messages.less',
        ),
        'output_filename': 'build/messages-min.css'
    },
    'mobile-messages': {
        'source_filenames': (
            'sumo/less/mobile/messages.less',
        ),
        'output_filename': 'build/mobile-messages-min.css'
    },
    'products': {
        'source_filenames': (
            'sumo/less/products.less',
        ),
        'output_filename': 'build/products-min.css'
    },
    'mobile-products': {
        'source_filenames': (
            'sumo/less/mobile/products.less',
        ),
        'output_filename': 'build/mobile-products-min.css'
    },
    'groups': {
        'source_filenames': (
            'sumo/css/users.autocomplete.css',
            'sumo/css/users.list.css',
            'sumo/css/groups.css',
            'sumo/css/wiki_syntax.css',
        ),
        'output_filename': 'build/groups-min.css'
    },
    'kpi.dashboard': {
        'source_filenames': (
            'sumo/less/kpi.dashboard.less',
        ),
        'output_filename': 'build/kpi.dashboard-min.css'
    },
    'locale-switcher': {
        'source_filenames': (
            'sumo/less/locale-switcher.less',
        ),
        'output_filename': 'build/locale-switcher-min.css'
    },
    'mobile-locale-switcher': {
        'source_filenames': (
            'sumo/less/mobile/locales.less',
        ),
        'output_filename': 'build/mobile-locale-switcher-min.css'
    },
    'kbdashboards': {
        'source_filenames': (
            'sumo/less/kbdashboards.less',
        ),
        'output_filename': 'build/kbdashboards-min.css'
    },
    'landings-get-involved': {
        'source_filenames': (
            'sumo/less/landings/get-involved.less',
        ),
        'output_filename': 'build/landings-get-involved-min.css'
    },
    'mobile-landings-get-involved': {
        'source_filenames': (
            'sumo/less/mobile/landings/get-involved.less',
        ),
        'output_filename': 'build/mobile-landings-get-involved-min.css'
    },
    'badges': {
        'source_filenames': (
            'sumo/less/badges.less',
        ),
        'output_filename': 'build/badges-min.css'
    }
}

PIPELINE_JS = {
    'common': {
        'source_filenames': (
            'sumo/js/i18n.js',
            'underscore/underscore.js',
            'moment/moment.js',
            'jquery/jquery.min.js',
            'jquery/jquery-migrate.js',
            'sumo/js/libs/jquery.cookie.js',
            'sumo/js/libs/jquery.placeholder.js',
            'sumo/js/templates/macros.js',
            'sumo/js/templates/search-results-list.js',
            'sumo/js/templates/search-results.js',
            'nunjucks/browser/nunjucks-slim.js',
            'sumo/js/nunjucks.js',
            'sumo/js/cached_xhr.js',
            'sumo/js/search_utils.js',
            'sumo/js/browserdetect.js',
            'sumo/js/libs/uitour.js',
            'sumo/js/kbox.js',
            'sumo/js/main.js',
            'sumo/js/format.js',
            'modernizr/modernizr.js',
            'sumo/js/geoip-locale.js',
            'mailcheck/src/mailcheck.js',
            'sumo/js/ui.js',
            'sumo/js/analytics.js',
            'sumo/js/surveygizmo.js',
            'sumo/js/instant_search.js',
        ),
        'output_filename': 'build/common-min.js'
    },
    'community': {
        'source_filenames': (
            'jquery/jquery.min.js',
            'jquery/jquery-migrate.js',
            'community/js/community.js',
            'community/js/select.js',
        ),
        'output_filename': 'build/community-min.js'
    },
    'community-new-questions': {
        'source_filenames': (
            # This uses the minified version because it is optimized to leave
            # out lots of debug stuff, so it is significantly smaller than
            # just minifying react.js.
            # TODO: Figure out how to include the full sized version in dev,
            # because it produces much nicer error messages.
            'react/react.min.js',
            # 'react/react.js',
            'pikaday/pikaday.js',
            'community/js/community-questions.browserify.js',
        ),
        'output_filename': 'build/community-questions-min.js'
    },
    'community-new-l10n': {
        'source_filenames': (
            # This uses the minified version because it is optimized to leave
            # out lots of debug stuff, so it is significantly smaller than
            # just minifying react.js.
            # TODO: Figure out how to include the full sized version in dev,
            # because it produces much nicer error messages.
            'react/react.min.js',
            # 'react/react.js',
            'pikaday/pikaday.js',
            'community/js/community-l10n.browserify.js',
        ),
        'output_filename': 'build/community-l10n-min.js'
    },
    'mobile-common': {
        'source_filenames': (
            'sumo/js/templates/mobile-search-results.js',
            'moment/moment.js',
            'sumo/js/i18n.js',
            'underscore/underscore.js',
            'jquery/jquery.min.js',
            'jquery/jquery-migrate.js',
            'modernizr/modernizr.js',
            'nunjucks/browser/nunjucks-slim.js',
            'sumo/js/nunjucks.js',
            'sumo/js/browserdetect.js',
            'sumo/js/cached_xhr.js',
            'sumo/js/search_utils.js',
            'sumo/js/aaq.js',
            'sumo/js/mobile/ui.js',
            'sumo/js/analytics.js',
            'sumo/js/instant_search.js',
            'sumo/js/mobile/instant_search.js',
        ),
        'output_filename': 'build/mobile-common-min.js'
    },
    'ie6-8': {
        'source_filenames': (
            'nwmatcher/src/nwmatcher.js',
            'sumo/js/libs/selectivizr-1.0.2.js',
        ),
        'output_filename': 'build/ie6-8-min.js'
    },
    'jqueryui': {
        'source_filenames': (
            'jquery-ui/ui/jquery.ui.core.js',
            'jquery-ui/ui/jquery.ui.widget.js',
            'jquery-ui/ui/jquery.ui.mouse.js',
            'jquery-ui/ui/jquery.ui.position.js',
            'jquery-ui/ui/jquery.ui.sortable.js',
            'jquery-ui/ui/jquery.ui.accordion.js',
            'jquery-ui/ui/jquery.ui.autocomplete.js',
            'jquery-ui/ui/jquery.ui.datepicker.js',
            'jquery-ui/ui/jquery.ui.menu.js',
            'jquery-ui/ui/jquery.ui.slider.js',
            'jquery-ui/ui/jquery.ui.tabs.js',
        ),
        'output_filename': 'build/jqueryui-min.js'
    },
    'questions': {
        'source_filenames': (
            'sumo/js/markup.js',
            'sumo/js/ajaxvote.js',
            'sumo/js/ajaxpreview.js',
            'sumo/js/remote.js',
            'sumo/js/aaq.js',
            'sumo/js/questions.js',
            'sumo/js/libs/jquery.tokeninput.js',
            'sumo/js/tags.filter.js',
            'sumo/js/tags.js',
            'sumo/js/reportabuse.js',
            'sumo/js/questions.metrics.js',
            'sumo/js/libs/jquery.ajaxupload.js',
            'sumo/js/upload.js',
        ),
        'output_filename': 'build/questions-min.js'
    },
    'questions.metrics': {
        'source_filenames': (
            'sumo/js/questions.metrics-dashboard.js',
        ),
        'output_filename': 'build/questions.metrics-min.js'
    },
    'questions.aaq.react': {
        'source_filenames': (
            # This uses the minified version because it is optimized to leave
            # out lots of debug stuff, so it is significantly smaller than
            # just minifying react.js.
            # TODO: Figure out how to include the full sized version in dev,
            # because it produces much nicer error messages.
            'react/react.min.js',
            # 'react/react.js',
            'flux/dist/Flux.js',
            'underscore/underscore.js',

            'questions/js/aaq.browserify.js',

        ),
        'output_filename': 'build/questions.aaq.react-min.js',
    },
    'mobile-questions': {
        'source_filenames': (
            'sumo/js/mobile/questions.js',
            'sumo/js/questions.metrics.js',
        ),
        'output_filename': 'build/mobile-questions-min.js'
    },
    'mobile-aaq': {
        'source_filenames': (
            'sumo/js/aaq.js',
            'sumo/js/mobile/aaq.js',
        ),
        'output_filename': 'build/mobile-aaq-min.js'
    },
    'products': {
        'source_filenames': (
            'sumo/js/compare_versions.js',
            'sumo/js/products.js',
        ),
        'output_filename': 'build/products-min.js'
    },
    'mobile-products': {
        'source_filenames': (
            'sumo/js/templates/mobile-product-search-results.js',
            'nunjucks/browser/nunjucks-slim.js',
            'sumo/js/nunjucks.js',
            'moment/moment.js',
            'sumo/js/cached_xhr.js',
            'sumo/js/search_utils.js',
            'sumo/js/instant_search.js',
            'sumo/js/mobile/products.js',
        ),
        'output_filename': 'build/mobile-products-min.js'
    },
    'search': {
        'source_filenames': (
            'sumo/js/search.js',
        ),
        'output_filename': 'build/search-min.js'
    },
    'forums': {
        'source_filenames': (
            'sumo/js/markup.js',
            'sumo/js/ajaxpreview.js',
            'sumo/js/forums.js',
            'sumo/js/reportabuse.js',
        ),
        'output_filename': 'build/forums-min.js'
    },
    'gallery': {
        'source_filenames': (
            'sumo/js/libs/jquery.ajaxupload.js',
            'sumo/js/gallery.js',
        ),
        'output_filename': 'build/gallery-min.js'
    },
    'wiki': {
        'source_filenames': (
            'sumo/js/markup.js',
            'sumo/js/libs/django/urlify.js',
            'sumo/js/libs/django/prepopulate.js',
            'sumo/js/libs/jquery.lazyload.js',
            'sumo/js/libs/jquery.tokeninput.js',
            'sumo/js/users.autocomplete.js',
            'sumo/js/screencast.js',
            'sumo/js/showfor.js',
            'sumo/js/ajaxvote.js',
            'sumo/js/ajaxpreview.js',
            'sumo/js/wiki.js',
            'sumo/js/tags.js',
            'sumo/js/dashboards.js',
            'sumo/js/editable.js',
            'sumo/js/wiki.metrics.js',
            'sumo/js/templates/wiki-related-doc.js',
            'sumo/js/templates/wiki-search-results.js',
            'sumo/js/wiki_search.js',
        ),
        'output_filename': 'build/wiki-min.js'
    },
    'rickshaw': {
        'source_filenames': (
            'd3/d3.js',
            'sumo/js/libs/d3.layout.min.js',
            'sumo/js/libs/rickshaw.js',
            'sumo/js/rickshaw_utils.js',
        ),
        'output_filename': 'build/rickshaw-min.js'
    },
    'mobile-wiki': {
        'source_filenames': (
            'underscore/underscore.js',
            'sumo/js/libs/jquery.cookie.js',
            'sumo/js/libs/jquery.lazyload.js',
            'sumo/js/browserdetect.js',
            'sumo/js/showfor.js',
            'sumo/js/ajaxform.js',
            'sumo/js/mobile/wiki.js',
            'sumo/js/wiki.metrics.js',
        ),
        'output_filename': 'build/mobile-wiki-min.js'
    },
    'mobile-wiki-minimal': {
        'source_filenames': (
            'sumo/js/i18n.js',
            'underscore/underscore.js',
            'jquery/jquery.min.js',
            'jquery/jquery-migrate.js',
            'modernizr/modernizr.js',
            'sumo/js/browserdetect.js',
            'sumo/js/mobile/ui.js',
            'sumo/js/analytics.js',
            'sumo/js/libs/jquery.cookie.js',
            'sumo/js/libs/jquery.lazyload.js',
            'sumo/js/showfor.js',
            'sumo/js/ajaxform.js',
            'sumo/js/mobile/wiki.js',
            'sumo/js/wiki.metrics.js',
        ),
        'output_filename': 'build/mobile-wiki-minimal-min.js'
    },
    'wiki.history': {
        'source_filenames': (
            'sumo/js/historycharts.js',
        ),
        'output_filename': 'build/wiki.history-min.js'
    },
    'wiki.diff': {
        'source_filenames': (
            'sumo/js/libs/diff_match_patch_uncompressed.js',
            'sumo/js/diff.js',
        ),
        'output_filename': 'build/wiki.diff-min.js'
    },
    'wiki.editor': {
        'source_filenames': (
            'codemirror/lib/codemirror.js',
            'codemirror/addon/mode/simple.js',
            'codemirror/addon/hint/show-hint.js',
            'sumo/js/codemirror.sumo-hint.js',
            'sumo/js/codemirror.sumo-mode.js',
        ),
        'output_filename': 'build/wiki.editor-min.js'
    },
    'wiki.dashboard': {
        'source_filenames': (
            'sumo/js/wiki.dashboard.js',
        ),
        'output_filename': 'build/wiki.dashboard-min.js'
    },
    'customercare': {
        'source_filenames': (
            'sumo/js/libs/jquery.cookie.js',
            'sumo/js/libs/jquery.bullseye-1.0.min.js',
            'sumo/js/libs/twitter-text.js',
            'sumo/js/customercare.js',
            'sumo/js/users.js',
        ),
        'output_filename': 'build/customercare-min.js'
    },
    'users': {
        'source_filenames': (
            'sumo/js/users.js',
            'sumo/js/reportabuse.js',
        ),
        'output_filename': 'build/users-min.js'
    },
    'messages': {
        'source_filenames': (
            'sumo/js/markup.js',
            'sumo/js/libs/jquery.autoresize.js',
            'sumo/js/libs/jquery.tokeninput.js',
            'sumo/js/users.autocomplete.js',
            'sumo/js/ajaxpreview.js',
            'sumo/js/messages.js',
        ),
        'output_filename': 'build/messages-min.js'
    },
    'mobile-messages': {
        'source_filenames': (
            'sumo/js/libs/jquery.tokeninput.js',
            'sumo/js/users.autocomplete.js',
        ),
        'output_filename': 'build/mobile-messages-min.js'
    },
    'groups': {
        'source_filenames': (
            'sumo/js/libs/jquery.tokeninput.js',
            'sumo/js/users.autocomplete.js',
            'sumo/js/markup.js',
            'sumo/js/groups.js',
            'sumo/js/editable.js',
        ),
        'output_filename': 'build/groups-min.js'
    },
    'kpi.dashboard': {
        'source_filenames': (
            'sumo/js/kpi.dashboard.js',
        ),
        'output_filename': 'build/kpi.dashboard-min.js'
    }
}


text:
#include <string.h>
#include <stdarg.h>
#include <assert.h>

#include "nlr.h"
#include "misc.h"
#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
#include "runtime.h"
#include "runtime0.h"

typedef struct _mp_obj_exception_t {
    mp_obj_base_t base;
    mp_obj_t traceback; // a list object, holding (file,line,block) as numbers (not Python objects); a hack for now
    mp_obj_tuple_t args;
} mp_obj_exception_t;

// Instance of MemoryError exception - needed by mp_malloc_fail
const mp_obj_exception_t mp_const_MemoryError_obj = {{&mp_type_MemoryError}, MP_OBJ_NULL, {{&mp_type_tuple}, 0}};

// Local non-heap memory for allocating an exception when we run out of RAM
STATIC mp_obj_exception_t mp_emergency_exception_obj;

// Instance of GeneratorExit exception - needed by generator.close()
// This would belong to objgenerator.c, but to keep mp_obj_exception_t
// definition module-private so far, have it here.
const mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, MP_OBJ_NULL, {{&mp_type_tuple}, 0}};

STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
    mp_obj_exception_t *o = o_in;
    if (kind == PRINT_REPR) {
        print(env, "%s", qstr_str(o->base.type->name));
    } else if (kind == PRINT_EXC) {
        print(env, "%s: ", qstr_str(o->base.type->name));
    }
    if (kind == PRINT_STR || kind == PRINT_EXC) {
        if (o->args.len == 0) {
            print(env, "");
            return;
        } else if (o->args.len == 1) {
            mp_obj_print_helper(print, env, o->args.items[0], PRINT_STR);
            return;
        }
    }
    tuple_print(print, env, &o->args, kind);
}

STATIC mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
    mp_obj_type_t *type = type_in;

    if (n_kw != 0) {
        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "%s does not take keyword arguments", mp_obj_get_type_str(type_in)));
    }

    mp_obj_exception_t *o = m_new_obj_var_maybe(mp_obj_exception_t, mp_obj_t, n_args);
    if (o == NULL) {
        // Couldn't allocate heap memory; use local data instead.
        o = &mp_emergency_exception_obj;
        // We can't store any args.
        n_args = 0;
    }
    o->base.type = type;
    o->traceback = MP_OBJ_NULL;
    o->args.base.type = &mp_type_tuple;
    o->args.len = n_args;
    memcpy(o->args.items, args, n_args * sizeof(mp_obj_t));
    return o;
}

// Get exception "value" - that is, first argument, or None
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in) {
    mp_obj_exception_t *self = self_in;
    if (self->args.len == 0) {
        return mp_const_none;
    } else {
        return self->args.items[0];
    }
}

STATIC void exception_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
    mp_obj_exception_t *self = self_in;
    if (attr == MP_QSTR_args) {
        dest[0] = &self->args;
    } else if (self->base.type == &mp_type_StopIteration && attr == MP_QSTR_value) {
        dest[0] = mp_obj_exception_get_value(self);
    }
}

const mp_obj_type_t mp_type_BaseException = {
    { &mp_type_type },
    .name = MP_QSTR_BaseException,
    .print = mp_obj_exception_print,
    .make_new = mp_obj_exception_make_new,
    .load_attr = exception_load_attr,
};

#define MP_DEFINE_EXCEPTION_BASE(base_name) \
STATIC const mp_obj_tuple_t mp_type_ ## base_name ## _base_tuple = {{&mp_type_tuple}, 1, {(mp_obj_t)&mp_type_ ## base_name}};\

#define MP_DEFINE_EXCEPTION(exc_name, base_name) \
const mp_obj_type_t mp_type_ ## exc_name = { \
    { &mp_type_type }, \
    .name = MP_QSTR_ ## exc_name, \
    .print = mp_obj_exception_print, \
    .make_new = mp_obj_exception_make_new, \
    .load_attr = exception_load_attr, \
    .bases_tuple = (mp_obj_t)&mp_type_ ## base_name ## _base_tuple, \
};

// List of all exceptions, arranged as in the table at:
// http://docs.python.org/3.3/library/exceptions.html
MP_DEFINE_EXCEPTION_BASE(BaseException)
//MP_DEFINE_EXCEPTION(SystemExit, BaseException)
//MP_DEFINE_EXCEPTION(KeyboardInterrupt, BaseException)
MP_DEFINE_EXCEPTION(GeneratorExit, BaseException)
MP_DEFINE_EXCEPTION(Exception, BaseException)
  MP_DEFINE_EXCEPTION_BASE(Exception)
  MP_DEFINE_EXCEPTION(StopIteration, Exception)
  MP_DEFINE_EXCEPTION(ArithmeticError, Exception)
    MP_DEFINE_EXCEPTION_BASE(ArithmeticError)
    //MP_DEFINE_EXCEPTION(FloatingPointError, ArithmeticError)
    MP_DEFINE_EXCEPTION(OverflowError, ArithmeticError)
    MP_DEFINE_EXCEPTION(ZeroDivisionError, ArithmeticError)
  MP_DEFINE_EXCEPTION(AssertionError, Exception)
  MP_DEFINE_EXCEPTION(AttributeError, Exception)
  //MP_DEFINE_EXCEPTION(BufferError, Exception)
  //MP_DEFINE_EXCEPTION(EnvironmentError, Exception)
  MP_DEFINE_EXCEPTION(EOFError, Exception)
  MP_DEFINE_EXCEPTION(ImportError, Exception)
  MP_DEFINE_EXCEPTION(IOError, Exception)
  MP_DEFINE_EXCEPTION(LookupError, Exception)
    MP_DEFINE_EXCEPTION_BASE(LookupError)
    MP_DEFINE_EXCEPTION(IndexError, LookupError)
    MP_DEFINE_EXCEPTION(KeyError, LookupError)
  MP_DEFINE_EXCEPTION(MemoryError, Exception)
  MP_DEFINE_EXCEPTION(NameError, Exception)
    MP_DEFINE_EXCEPTION_BASE(NameError)
    //MP_DEFINE_EXCEPTION(UnboundLocalError, NameError)
  MP_DEFINE_EXCEPTION(OSError, Exception)
    MP_DEFINE_EXCEPTION_BASE(OSError)
    /*
    MP_DEFINE_EXCEPTION(BlockingIOError, OSError)
    MP_DEFINE_EXCEPTION(ChildProcessError, OSError)
    MP_DEFINE_EXCEPTION(ConnectionError, OSError)
      MP_DEFINE_EXCEPTION(BrokenPipeError, ConnectionError)
      MP_DEFINE_EXCEPTION(ConnectionAbortedError, ConnectionError)
      MP_DEFINE_EXCEPTION(ConnectionRefusedError, ConnectionError)
      MP_DEFINE_EXCEPTION(ConnectionResetError, ConnectionError)
    MP_DEFINE_EXCEPTION(InterruptedError, OSError)
    MP_DEFINE_EXCEPTION(IsADirectoryError, OSError)
    MP_DEFINE_EXCEPTION(NotADirectoryError, OSError)
    MP_DEFINE_EXCEPTION(PermissionError, OSError)
    MP_DEFINE_EXCEPTION(ProcessLookupError, OSError)
    MP_DEFINE_EXCEPTION(TimeoutError, OSError)
    MP_DEFINE_EXCEPTION(FileExistsError, OSError)
    MP_DEFINE_EXCEPTION(FileNotFoundError, OSError)
    MP_DEFINE_EXCEPTION(ReferenceError, Exception)
    */
  MP_DEFINE_EXCEPTION(RuntimeError, Exception)
    MP_DEFINE_EXCEPTION_BASE(RuntimeError)
    MP_DEFINE_EXCEPTION(NotImplementedError, RuntimeError)
  MP_DEFINE_EXCEPTION(SyntaxError, Exception)
    MP_DEFINE_EXCEPTION_BASE(SyntaxError)
    MP_DEFINE_EXCEPTION(IndentationError, SyntaxError)
    /*
      MP_DEFINE_EXCEPTION_BASE(IndentationError)
      MP_DEFINE_EXCEPTION(TabError, IndentationError)
      */
  MP_DEFINE_EXCEPTION(SystemError, Exception)
  MP_DEFINE_EXCEPTION(TypeError, Exception)
  MP_DEFINE_EXCEPTION(ValueError, Exception)
    //TODO: Implement UnicodeErrors which take arguments
  /*
  MP_DEFINE_EXCEPTION(Warning, Exception)
    MP_DEFINE_EXCEPTION_BASE(Warning)
    MP_DEFINE_EXCEPTION(DeprecationWarning, Warning)
    MP_DEFINE_EXCEPTION(PendingDeprecationWarning, Warning)
    MP_DEFINE_EXCEPTION(RuntimeWarning, Warning)
    MP_DEFINE_EXCEPTION(SyntaxWarning, Warning)
    MP_DEFINE_EXCEPTION(UserWarning, Warning)
    MP_DEFINE_EXCEPTION(FutureWarning, Warning)
    MP_DEFINE_EXCEPTION(ImportWarning, Warning)
    MP_DEFINE_EXCEPTION(UnicodeWarning, Warning)
    MP_DEFINE_EXCEPTION(BytesWarning, Warning)
    MP_DEFINE_EXCEPTION(ResourceWarning, Warning)
    */

mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type) {
    return mp_obj_new_exception_args(exc_type, 0, NULL);
}

mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, uint n_args, const mp_obj_t *args) {
    assert(exc_type->make_new == mp_obj_exception_make_new);
    return exc_type->make_new((mp_obj_t)exc_type, n_args, 0, args);
}

mp_obj_t mp_obj_new_exception_msg(const mp_obj_type_t *exc_type, const char *msg) {
    return mp_obj_new_exception_msg_varg(exc_type, msg);
}

mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char *fmt, ...) {
    // check that the given type is an exception type
    assert(exc_type->make_new == mp_obj_exception_make_new);

    // make exception object
    mp_obj_exception_t *o = m_new_obj_var_maybe(mp_obj_exception_t, mp_obj_t, 1);
    if (o == NULL) {
        // Couldn't allocate heap memory; use local data instead.
        // Unfortunately, we won't be able to format the string...
        o = &mp_emergency_exception_obj;
        o->base.type = exc_type;
        o->traceback = MP_OBJ_NULL;
        o->args.base.type = &mp_type_tuple;
        o->args.len = 0;
    } else {
        o->base.type = exc_type;
        o->traceback = MP_OBJ_NULL;
        o->args.base.type = &mp_type_tuple;
        o->args.len = 1;

        if (fmt == NULL) {
            // no message
            assert(0);
        } else {
            // render exception message and store as .args[0]
            // TODO: optimize bufferbloat
            vstr_t *vstr = vstr_new();
            va_list ap;
            va_start(ap, fmt);
            vstr_vprintf(vstr, fmt, ap);
            va_end(ap);
            o->args.items[0] = mp_obj_new_str((byte*)vstr->buf, vstr->len, false);
            vstr_free(vstr);
        }
    }

    return o;
}

// return true if the given object is an exception type
bool mp_obj_is_exception_type(mp_obj_t self_in) {
    if (MP_OBJ_IS_TYPE(self_in, &mp_type_type)) {
        // optimisation when self_in is a builtin exception
        mp_obj_type_t *self = self_in;
        if (self->make_new == mp_obj_exception_make_new) {
            return true;
        }
    }
    return mp_obj_is_subclass_fast(self_in, &mp_type_BaseException);
}

// return true if the given object is an instance of an exception type
bool mp_obj_is_exception_instance(mp_obj_t self_in) {
    return mp_obj_is_exception_type(mp_obj_get_type(self_in));
}

// return true if exception (type or instance) is a subclass of given
// exception type.
bool mp_obj_exception_match(mp_obj_t exc, const mp_obj_type_t *exc_type) {
    // TODO: move implementation from RT_BINARY_OP_EXCEPTION_MATCH here.
    return mp_binary_op(MP_BINARY_OP_EXCEPTION_MATCH, exc, (mp_obj_t)exc_type) == mp_const_true;
}

void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
    // make sure self_in is an exception instance
    // TODO add traceback information to user-defined exceptions (need proper builtin subclassing for that)
    if (mp_obj_get_type(self_in)->make_new == mp_obj_exception_make_new) {
        mp_obj_exception_t *self = self_in;

        // just set the traceback to the null object
        // we don't want to call any memory management functions here
        self->traceback = MP_OBJ_NULL;
    }
}

void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, machine_uint_t line, qstr block) {
    // make sure self_in is an exception instance
    // TODO add traceback information to user-defined exceptions (need proper builtin subclassing for that)
    if (mp_obj_get_type(self_in)->make_new == mp_obj_exception_make_new && self_in != &mp_emergency_exception_obj) {
        mp_obj_exception_t *self = self_in;

        // for traceback, we are just using the list object for convenience, it's not really a list of Python objects
        if (self->traceback == MP_OBJ_NULL) {
            self->traceback = mp_obj_new_list(0, NULL);
        }
        mp_obj_list_append(self->traceback, (mp_obj_t)(machine_uint_t)file);
        mp_obj_list_append(self->traceback, (mp_obj_t)(machine_uint_t)line);
        mp_obj_list_append(self->traceback, (mp_obj_t)(machine_uint_t)block);
    }
}

void mp_obj_exception_get_traceback(mp_obj_t self_in, machine_uint_t *n, machine_uint_t **values) {
    // make sure self_in is an exception instance
    assert(mp_obj_get_type(self_in)->make_new == mp_obj_exception_make_new);
    mp_obj_exception_t *self = self_in;

    if (self->traceback == MP_OBJ_NULL) {
        *n = 0;
        *values = NULL;
    } else {
        uint n2;
        mp_obj_list_get(self->traceback, &n2, (mp_obj_t**)values);
        *n = n2;
    }
}


text:
require File.dirname(__FILE__) + '/../test_helper'

class MessageModelTest < Minitest::Test

  def setup
    @aleks = create_user(:login => "aleks")
    @john = create_user(:login => "john")
    @message = create_message
  end

  def test_create_message
    @message = create_message

    assert_equal @message.sender, @john
    assert_equal @message.recipient, @aleks
    assert_equal @message.subject, "Hi, Aleks!"
    assert_equal @message.body, "Hello, Aleks! Long time no see."
    assert @message.read_at.nil?
  end

  def test_read_returns_message
    assert_equal @message, Message.read_message(@message, @john)
  end

  def test_read_records_timestamp
    assert !@message.nil?
  end

  def test_read?
    Message.read_message(@message, @aleks)
    @message.reload
    assert @message.message_read?
  end

  def test_mark_deleted_sender
    @message.mark_deleted(@john)
    @message.reload
    assert @message.sender_deleted
  end

  def test_mark_deleted_recipient
    @message.mark_deleted(@aleks)
    @message.reload
    assert @message.recipient_deleted
  end

  def test_mark_deleted_both
    id = @message.id
    @message.mark_deleted(@aleks)
    @message.mark_deleted(@john)
    assert !Message.exists?(id)
  end

end


text:
package org.statmantis.stat.common;

import org.statmantis.model.Play;
import org.statmantis.model.Team;
import org.statmantis.stat.StatisticInfo;
import org.statmantis.stat.StatisticType;
import org.statmantis.stat.TeamBasedStatistic;

@StatisticInfo(
        name = "Left On Base",
        abbreviations = "LOB",
        types = { StatisticType.BATTING, StatisticType.PITCHING })
public class LeftOnBase extends PitcherAndBatterBasedPlayStatistic<Integer>
        implements TeamBasedStatistic {

    @Override
    public void setCurrentTeam(Team team) {
        //TODO: revisit this when I answer these questions...
        //  1. Is individual batter LOB counted during errors?
        //  2. Are pitcher LOB numbers only calc'd at the end
        //      of the half inning like team LOB?
    }

    @Override
    public void applyPlay(Play play) {
    }

    @Override
    public Integer getCurrentValue() {
        throw new UnsupportedOperationException();
    }
}


text:
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FunctionalDependencies, FlexibleContexts #-}

module Lcars.DHT.Classes (DHT(..)) where
import Data.Bits
import qualified Data.ByteString as BS
import qualified Data.Serialize as Ser
import Data.List

import Crypto.Types
import Control.Monad.IO.Class

class (MonadIO m, Functor m, Eq (DHTHash d), Ser.Serialize (DHTHash d)) =>
      DHT d h t m | h -> d, d -> h, d -> t, t -> d, d -> m where
  type DHTHash d :: *
  type DHTNodeAddress d :: *
  data DhtFunctorCtx h :: *

  dhtNewNode :: DhtFunctorCtx h -> m d
  dhtRandomHash :: d -> m h
  dhtFunctorContext :: d -> DhtFunctorCtx h
  dhtLocalInsert :: d -> DHTHash d -> t -> m ()
  dhtLocalGet :: d -> DHTHash d -> m (Maybe t)
  dhtLocalDelete :: d -> DHTHash d -> m ()
  dhtLocalMapSize :: d -> m Integer
  dhtNodeId :: d -> DHTHash d
  dhtNodeAddress :: d -> DHTHash d -> m (Maybe (DHTNodeAddress d))
  dhtPut :: d -> t -> m (Maybe (DHTHash d))
  dhtHash :: t -> (DHTHash d)
  dhtNodes :: d -> m [DHTHash d]
  dhtHashI :: d -> DHTHash d -> Integer
  dhtHashMax :: d -> Integer
  dhtHashOutputBits :: d -> BitLength
  dhtHashOutputBytes :: d -> Int
  dhtDist :: d -> DHTHash d -> DHTHash d -> Integer
  dhtTryPutRemote ::
    DhtFunctorCtx h -> DHTNodeAddress d -> DHTHash d -> t ->
    m (Maybe (DHTHash d))
  dhtTryPutRemotes ::
    d -> [DHTHash d] -> DHTHash d -> m (Maybe (DHTHash d))

  dhtTryPutRemotes d ns' h =
    let ns = sortBy (\n1 n2 -> compare (hdist n1) (hdist n2)) ns'
        hdist = dhtDist d h
        fctx = dhtFunctorContext d
        putR _ [] _ _ = do return Nothing
        putR d (n:ns) h v = do
          let putRNext = putR d ns h v
          na' <- dhtNodeAddress d n
          case na' of
            Nothing -> putRNext
            Just na -> do
              ret <- dhtTryPutRemote fctx na h v
              case ret of
                Nothing -> putRNext
                Just hRet -> if (not $ hRet == h)
                             then putRNext
                             else do
                               dhtLocalDelete d h
                               return $ Just h
    in do
      value <- dhtLocalGet d h
      case value of
        Nothing -> fail "no value in local table for hash"
        Just value' -> putR d ns h value'

  dhtHashOutputBytes dht = div (dhtHashOutputBits dht) 8

  dhtHashMax d = 2 ^ dhtHashOutputBits d
  dhtHashI d h =
    let hfold =
          foldl (\i w -> (i `shiftL` 8) .|. toInteger w) (0 :: Integer)
        enc   = BS.unpack $ Ser.encode h
    in hfold $ take (dhtHashOutputBytes d) enc

  dhtDist d h1 h2 =
    let d1 = abs $ (dhtHashI d h1) - (dhtHashI d h2)
        d2 = (dhtHashMax d) - d1
    in min d1 d2

  dhtPut d bs =
    let h = dhtHash bs
        hdist = dhtDist d h
        d0 = hdist (dhtNodeId d)
        closerP n = hdist n < d0
    in do
      dhtLocalInsert d h bs
      hs <- dhtNodes d
      let closerNodes =
            map fst $ sortBy (\(_, d1) (_, d2) -> compare d1 d2)
            [(n, hdist n) | n <- filter closerP hs]
      case closerNodes of
        [] -> return $ Just h
        cns -> do
          res <- dhtTryPutRemotes d cns h
          case res of
            Nothing -> return $ Just h
            Just h' -> if (not $ h == h')
                       then fail $ "unexpected hash from remote"
                       else do
                         dhtLocalDelete d h'
                         return $ Just h'


text:
var util = module.exports = require('util');

// and augmenting it
util.extend = require('./extend');


text:
'use strict';
var common = require('../common');
var assert = require('assert');

if (!common.hasCrypto) {
  console.log('1..0 # Skipped: missing crypto');
  return;
}
var tls = require('tls');

var fs = require('fs');
var net = require('net');
var crypto = require('crypto');

var keys = crypto.randomBytes(48);
var serverLog = [];
var ticketLog = [];

var serverCount = 0;
function createServer() {
  var id = serverCount++;

  var counter = 0;
  var previousKey = null;

  var server = tls.createServer({
    key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
    cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
    ticketKeys: keys
  }, function(c) {
    serverLog.push(id);
    c.end();

    counter++;

    // Rotate ticket keys
    if (counter === 1) {
      previousKey = server.getTicketKeys();
      server.setTicketKeys(crypto.randomBytes(48));
    } else if (counter === 2) {
      server.setTicketKeys(previousKey);
    } else if (counter === 3) {
      // Use keys from counter=2
    } else {
      throw new Error('UNREACHABLE');
    }
  });

  return server;
}

var naturalServers = [ createServer(), createServer(), createServer() ];

// 3x servers
var servers = naturalServers.concat(naturalServers).concat(naturalServers);

// Create one TCP server and balance sockets to multiple TLS server instances
var shared = net.createServer(function(c) {
  servers.shift().emit('connection', c);
}).listen(common.PORT, function() {
  start(function() {
    shared.close();
  });
});

function start(callback) {
  var sess = null;
  var left = servers.length;

  function connect() {
    var s = tls.connect(common.PORT, {
      session: sess,
      rejectUnauthorized: false
    }, function() {
      sess = sess || s.getSession();
      ticketLog.push(s.getTLSTicket().toString('hex'));
    });
    s.on('close', function() {
      if (--left === 0)
        callback();
      else
        connect();
    });
  }

  connect();
}

process.on('exit', function() {
  assert.equal(ticketLog.length, serverLog.length);
  for (var i = 0; i < naturalServers.length - 1; i++) {
    assert.notEqual(serverLog[i], serverLog[i + 1]);
    assert.equal(ticketLog[i], ticketLog[i + 1]);

    // 2nd connection should have different ticket
    assert.notEqual(ticketLog[i], ticketLog[i + naturalServers.length]);

    // 3rd connection should have the same ticket
    assert.equal(ticketLog[i], ticketLog[i + naturalServers.length * 2]);
  }
});


text:
BASE=/opt/ws
LIB=$BASE/lib
ETC=$BASE/etc

PATH=$PATH:$ETC:$LIB
LIB_PATH=-Djava.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib:$ETC:$LIB
JAVA=`which java`

ulimit -c unlimited

$JAVA -Xms1024m -Xmx1024m -verbose:gc -XX:+UseSerialGC -DbaseApplicationContext=/opt/ws/etc/baseApplicationContext.xml -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog -D{classref}.LEVEL=DEBUG -Djava.library.path=$LIB_PATH -Ddynamic.loader=$LIB -cp $ETC:$LIB/inodes-util-0.1.9.jar:$LIB/jetty-util-6.1.26.jar:$LIB/dcm-services-0.1.war com.inodes.util.DynamicLoader org.dcm.services.cli.CLI $@ > /opt/ws/log/server.log 2>> /opt/ws/log/server.log &


text:
#
#######################DISA INFORMATION##################################
# Group ID (Vulid): RHEL-06-000039
# Group Title: SRG-OS-999999
#

# Rule ID: RHEL-06-000039_rule
# Severity: medium
# Rule Version (STIG-ID): RHEL-06-000039
# Rule Title: The /etc/passwd file must be owned by root.
#
# Vulnerability Discussion: The "/etc/passwd" file contains information
# about the users that are configured on the system. Protection of this
# file is critical for system security.
#
# Responsibility:
# IAControls:
#
# Check Content:
#
# To check the ownership of "/etc/passwd", run the command:

# $ ls -l /etc/passwd

# If properly configured, the output should indicate the following owner:
# "root"
# If it does not, this is a finding.
#
# Fix Text:
#
# To properly set the owner of "/etc/passwd", run the command:

# chown root /etc/passwd

#######################DISA INFORMATION##################################
#
# Global Variables
PDI=RHEL-06-000039
SEVERITY=medium
#
#BEGIN_CHECK
. ./aqueduct_functions
MOD_MSG="/etc/passwd root ownership"
if [ -a "/etc/passwd" ]
then
    CUROWN=`stat -c %U /etc/passwd`;
fi

#END_CHECK
#BEGIN_REMEDY

if [ "$CUROWN" != "root" ]
then
    	chown root /etc/passwd
	show_message $PDI "$MOD_MSG" fixed
else
	show_message $PDI "$MOD_MSG" pass
fi

#END_REMEDY


text:
FactoryGirl.define do
  factory :user do
    sequence :email do |n|
      "#{n}-#{Faker::Internet.free_email}"
    end
    password { Faker::Internet.password(8) }
    confirmed_at { Time.now }
  end
  # factory :user_admin, parent: :user do
  #   role     'admin'
  # end
  #
  # factory :user_manager, parent: :user do
  #   role     'manager'
  # end
end


text:
import os
import argparse
import logging
from ppci.api import asm, c3c, link, objcopy, get_arch
from ppci.binutils.objectfile import merge_memories
from ppci.utils.reporting import html_reporter

parser = argparse.ArgumentParser()
parser.add_argument("-v", help="Increase verbosity", action="count", default=0)
parser.add_argument("example", help="example name from the c3src directory")
parser.add_argument(
    "-g",
    "--debug",
    action="store_true",
    default=False,
    help="Enable debug code",
)
args = parser.parse_args()
loglevel = logging.DEBUG if args.v else logging.INFO
logging.basicConfig(level=loglevel, filename="debug.log")

with html_reporter("report.html") as reporter:
    arch = get_arch("riscv")
    if args.debug:
        obj1 = asm("startdbg.s", arch)
    else:
        obj1 = asm("start.s", arch)

    c3_sources = [
        os.path.join("c3src", "bsp.c3"),
        os.path.join("c3src", "io.c3"),
        os.path.join("c3src", args.example, "main.c3"),
    ]
    if args.debug:
        c3_sources.append(os.path.join("c3src", "gdbstub.c3"))
        c3_sources.append(os.path.join("c3src", "irq.c3"))

    obj2 = c3c(
        c3_sources, [], "riscv", reporter=reporter, debug=True, opt_level=2
    )
    obj = link(
        [obj1, obj2],
        "firmware.mmap",
        use_runtime=False,
        reporter=reporter,
        debug=True,
    )

    with open("firmware.oj", "w") as of:
        obj.save(of)

    objcopy(obj, "flash", "bin", "code.bin")
    objcopy(obj, "ram", "bin", "data.bin")
    objcopy(obj, "flash", "elf", "firmware.elf")
    size = 0x8000
    cimg = obj.get_image("flash")
    dimg = obj.get_image("ram")
    img = merge_memories(cimg, dimg, "img")
    imgdata = img.data

with open("firmware.hex", "w") as f:
    for i in range(size):
        if i < len(imgdata) // 4:
            w = imgdata[4 * i : 4 * i + 4]
            print("%02x%02x%02x%02x" % (w[3], w[2], w[1], w[0]), file=f)
        else:
            print("00000000", file=f)


text:
namespace android.net
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class ConnectivityManager : java.lang.Object
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected ConnectivityManager(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public static bool isNetworkTypeValid(int arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.net.ConnectivityManager._m0.native == global::System.IntPtr.Zero)
				global::android.net.ConnectivityManager._m0 = @__env.GetStaticMethodIDNoThrow(global::android.net.ConnectivityManager.staticClass, "isNetworkTypeValid", "(I)Z");
			return @__env.CallStaticBooleanMethod(android.net.ConnectivityManager.staticClass, global::android.net.ConnectivityManager._m0, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public virtual void setNetworkPreference(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::android.net.ConnectivityManager.staticClass, "setNetworkPreference", "(I)V", ref global::android.net.ConnectivityManager._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		public new int NetworkPreference
		{
			get
			{
				return getNetworkPreference();
			}
			set
			{
				setNetworkPreference(value);
			}
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public virtual int getNetworkPreference()
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.net.ConnectivityManager.staticClass, "getNetworkPreference", "()I", ref global::android.net.ConnectivityManager._m2);
		}
		public new global::android.net.NetworkInfo ActiveNetworkInfo
		{
			get
			{
				return getActiveNetworkInfo();
			}
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public virtual global::android.net.NetworkInfo getActiveNetworkInfo()
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::android.net.ConnectivityManager.staticClass, "getActiveNetworkInfo", "()Landroid/net/NetworkInfo;", ref global::android.net.ConnectivityManager._m3) as android.net.NetworkInfo;
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public virtual global::android.net.NetworkInfo getNetworkInfo(int arg0)
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::android.net.ConnectivityManager.staticClass, "getNetworkInfo", "(I)Landroid/net/NetworkInfo;", ref global::android.net.ConnectivityManager._m4, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)) as android.net.NetworkInfo;
		}
		public new global::android.net.NetworkInfo[] AllNetworkInfo
		{
			get
			{
				return getAllNetworkInfo();
			}
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public virtual global::android.net.NetworkInfo[] getAllNetworkInfo()
		{
			return global::MonoJavaBridge.JavaBridge.CallArrayObjectMethod<android.net.NetworkInfo>(this, global::android.net.ConnectivityManager.staticClass, "getAllNetworkInfo", "()[Landroid/net/NetworkInfo;", ref global::android.net.ConnectivityManager._m5) as android.net.NetworkInfo[];
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public virtual int startUsingNetworkFeature(int arg0, java.lang.String arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.net.ConnectivityManager.staticClass, "startUsingNetworkFeature", "(ILjava/lang/String;)I", ref global::android.net.ConnectivityManager._m6, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public virtual int stopUsingNetworkFeature(int arg0, java.lang.String arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallIntMethod(this, global::android.net.ConnectivityManager.staticClass, "stopUsingNetworkFeature", "(ILjava/lang/String;)I", ref global::android.net.ConnectivityManager._m7, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public virtual bool requestRouteToHost(int arg0, int arg1)
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::android.net.ConnectivityManager.staticClass, "requestRouteToHost", "(II)Z", ref global::android.net.ConnectivityManager._m8, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		public new bool BackgroundDataSetting
		{
			get
			{
				return getBackgroundDataSetting();
			}
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public virtual bool getBackgroundDataSetting()
		{
			return global::MonoJavaBridge.JavaBridge.CallBooleanMethod(this, global::android.net.ConnectivityManager.staticClass, "getBackgroundDataSetting", "()Z", ref global::android.net.ConnectivityManager._m9);
		}
		public static global::java.lang.String CONNECTIVITY_ACTION
		{
			get
			{
				return "android.net.conn.CONNECTIVITY_CHANGE";
			}
		}
		public static global::java.lang.String EXTRA_NETWORK_INFO
		{
			get
			{
				return "networkInfo";
			}
		}
		public static global::java.lang.String EXTRA_IS_FAILOVER
		{
			get
			{
				return "isFailover";
			}
		}
		public static global::java.lang.String EXTRA_OTHER_NETWORK_INFO
		{
			get
			{
				return "otherNetwork";
			}
		}
		public static global::java.lang.String EXTRA_NO_CONNECTIVITY
		{
			get
			{
				return "noConnectivity";
			}
		}
		public static global::java.lang.String EXTRA_REASON
		{
			get
			{
				return "reason";
			}
		}
		public static global::java.lang.String EXTRA_EXTRA_INFO
		{
			get
			{
				return "extraInfo";
			}
		}
		public static global::java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED
		{
			get
			{
				return "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
			}
		}
		public static int TYPE_MOBILE
		{
			get
			{
				return 0;
			}
		}
		public static int TYPE_WIFI
		{
			get
			{
				return 1;
			}
		}
		public static int TYPE_MOBILE_MMS
		{
			get
			{
				return 2;
			}
		}
		public static int TYPE_MOBILE_SUPL
		{
			get
			{
				return 3;
			}
		}
		public static int TYPE_MOBILE_DUN
		{
			get
			{
				return 4;
			}
		}
		public static int TYPE_MOBILE_HIPRI
		{
			get
			{
				return 5;
			}
		}
		public static int TYPE_WIMAX
		{
			get
			{
				return 6;
			}
		}
		public static int DEFAULT_NETWORK_PREFERENCE
		{
			get
			{
				return 1;
			}
		}
		static ConnectivityManager()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::android.net.ConnectivityManager.staticClass = @__env.NewGlobalRef(@__env.FindClass("android/net/ConnectivityManager"));
		}
	}
}


text:
CREATE TABLE Logs (
	LogID int IDENTITY,
	AccountID int,
	OldSum money,
	NewSum money,
	CONSTRAINT PK_LogID PRIMARY KEY (LogID)
)

GO

CREATE TRIGGER tr_UpdateSum ON Accounts
FOR UPDATE
AS
	DECLARE @accountId int;
	DECLARE @oldSum money;
	DECLARE @newSum money;

	SELECT @accountId = a.Id FROM inserted a;
	SELECT @oldSum = a.Balance FROM deleted a;
	SELECT @newSum = a.Balance FROM inserted a;

	INSERT INTO Logs
	VALUES(@accountId, @oldSum, @newSum)
GO

EXEC usp_WithdrawMoney 1, 3000

EXEC usp_DepositMoney 1, 3000

EXEC usp_WithdrawMoney 2, 5000

EXEC usp_DepositMoney 2, 5000

EXEC usp_WithdrawMoney 3, 6000

EXEC usp_DepositMoney 3, 6000

SELECT *
FROM Logs


text:
import { parse, differenceInYears } from 'date-fns'
import fs from 'fs/promises'
import { resolve } from 'path'

import getPool from './db'

export const parseHeight = (str: string | undefined): number | null => {
  if (!str) return null

  const height = /\(or (.+) cm\)/.exec(str)?.[1]

  if (!height) return 666

  return parseInt(height, 10)
}

export const parseEthnicity = (str: string | undefined): string | null => {
  if (!str) return null

  let eth = str
  if (str === 'Caucaision') {
    eth = 'Caucasian'
  }
  if (str.indexOf('Mixed') > -1 || str.indexOf(',') > -1) {
    eth = 'Mixed'
  }

  return eth
}

export const parseWeight = (str: string | undefined): number | null => {
  if (!str) return null

  const weight = /or (.+) kg/.exec(str)?.[1]

  if (!weight) return 666

  return parseInt(weight, 10)
}

export const parseMeasurements = (
  str: string | undefined,
): null | { bust: number; waist: number; hips: number; cup: string } => {
  if (!str) return null

  const matches = /(\d\d)([A-Z]?[A-Z])?[- \/]+(\d\d)[- \/](\d\d)/.exec(str)
  if (!matches) {
    return null
  }

  return {
    bust: +matches[1],
    waist: +matches[3],
    hips: +matches[4],
    cup: matches[2],
  }
}

export const parseHair = (str: string | undefined): string | null => {
  if (!str) return null

  const colors: { [key: string]: string[] } = {
    Blonde: ['Blonde'],
    Brunette: ['Brunette', 'Brown', 'Hazel'],
    Black: ['Black'],
    Red: ['Red', 'Redhead'],
    Auburn: ['Auburn'],
  }

  for (let color of Object.keys(colors)) {
    const [first] = str.split(/[,;]/)
    if (colors[color].includes(first)) return color
  }

  return null
}

export const parseBorn = (str: string | undefined): Date | null => {
  if (!str) return null

  return parse(str, `EEEE do 'of' MMMM yyyy`, new Date())
}

export const parseCup = (str: string | undefined): string | null => {
  if (!str) return null

  if (str.length === 1) return str

  const m1 = /(\d\d)?([A-Z]+)/.exec(str)

  if (m1) return m1[2]

  return null
}

export const parseTattoos = (str: string | undefined): boolean | null => {
  if (!str) return null

  if (!['None', 'none', 'no'].includes(str)) return true

  return false
}

const cm2in = num => (num ? num / 2.54 : null)
const in2cm = num => (num ? num * 2.54 : null)
const kg2lb = num => (num ? num / 0.45359237 : null)

function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1)
}

const run = async () => {
  const pool = getPool()
  const { rows } = await pool.query('select * from playboy.playmates')

  const mates = rows
    .map(row => {
      const bp = row.babepedia
      const mp = row.mypmates

      const height = mp.height
      const weight = mp.weight
      const bust = mp.bust
      const waist = mp.waist
      const hips = mp.hips
      const zodiac = mp.zodiac
      const hair = capitalizeFirstLetter(mp.hair)
      const ethnicity = mp.ethnicity
      const born = new Date(mp.born)

      const measurements = parseMeasurements(bp?.['Measurements'])
      const cup = parseCup(bp?.['Bra/cup size'])

      const [country, state, town] = mp.birthplace.split(', ').reverse()

      return {
        name: row.name,
        heightCM: height,
        heightIN: cm2in(height),
        weightKG: weight,
        weightLB: kg2lb(weight),
        bustIN: cm2in(bust),
        bustCM: bust,
        waistIN: cm2in(waist),
        waistCM: waist,
        hipsIN: cm2in(hips),
        hipsCM: hips,
        cup: measurements?.cup ?? cup,
        hair: hair,
        breasts: bp?.['Boobs'],
        ethnicity,
        born,
        month: row.month,
        year: row.year,
        mateAge: born
          ? differenceInYears(new Date(row.year, row.month, 1), born)
          : null,
        first: row.first,
        babepediaUrl: bp.url,
        mypmatesUrl: mp.url,
        country,
        state,
        town,
      }
    })
    .sort((a, b) => {
      const yr = a.year - b.year
      if (yr !== 0) return yr

      return a.month - b.month
    })

  await fs.writeFile(
    resolve(__dirname, '../../viz/data.json'),
    JSON.stringify(mates, null, 2),
  )
}

run()


text:
body{ background:#f2f4f5;}

.nav{width:100%; position:fixed; top:0;left:0; background:#fff;}
.nav ul{width:4.38rem;height:0.6rem; margin:0 auto;}
.nav ul li{width:1.46rem;height:0.6rem; float:left;}
.nav ul li a{ display:block;width:1.46rem;height:0.6rem; line-height:0.6rem; text-align:center; font-size:0.3rem; color:#9e9a95;}
.nav ul li.active a{height:0.5rem; border-bottom:0.1rem solid #5477b2; color:#5477b2;}

.content{max-width:6.4rem; margin:0 auto; margin-bottom:0.8rem;}
.content .banner{margin-top:0.6rem;position: relative;overflow: hidden;}
.banner ul li{width:6.4rem;float:left;position: relative;}
.banner ul li img{width:100%; display:block;}
.banner ul li .text-box{width:5.8rem; padding:0 0.3rem;height:1.24rem; position:absolute; left:0; bottom:0; color:#fff; background:rgba(0,0,0,0.5);}
.text-box h2{ font-size:0.3rem; font-weight:normal; margin-top:0.22rem; line-height:100%; margin-bottom:0.22rem; overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.text-box p{ line-height:100%;}

.banner ol{position:absolute; right:0.2rem;bottom:0.2rem;}
.banner ol li{width:0.15rem;height:0.15rem; background:#5477b2; float:left; border-radius:50%; margin-right:0.08rem;}
.banner ol li.active{ background:#fff;}

.content .newsList{width:6.4rem; margin:0 auto;}
.newsList ul{ padding:0 0.4rem;}
.newsList ul li{ color:#494d4d; padding:0.2rem 0; border-bottom:1px dashed #ccc;}
.newsList ul li h2{max-height:0.9rem; font-size:0.33rem; overflow:hidden;}
.newsList ul li p{max-height:1.8rem; margin-top:0.05rem;overflow:hidden;}

.foot-btn{width:100%;height:0.8rem; background:#fff; position:fixed; left:0; bottom:0; border-top:1px solid #9e9a95;}
.foot-btn ul{width:4.08rem; margin:0 auto;}
.foot-btn ul li{ float:left;}
.foot-btn ul li a{ display:block; width:100%;height:100%;}
.foot-btn ul .home{width:0.44rem;height:0.59rem; background:url(../img/home.png) no-repeat 0 0; background-size:100%; margin-top:0.1rem;}
.foot-btn ul .write{width:0.82rem;height:0.81rem; background:url(../img/write.png) no-repeat 0 0; background-size:100%; margin-left:1.18rem;}
.foot-btn ul .my{width:0.39rem;height:0.63rem; background:url(../img/my.png) no-repeat 0 0;background-size:100%; margin-left:1.18rem; margin-top:0.07rem;}


text:
<TITLE>Low-level topology functions</TITLE>

6.5.7. Low-level topology functions

Up:  Topology Constructors
Next:  An Application Example
Previous:  Partitioning of Cartesian structures

The two additional functions introduced in this section can be used to
implement all other topology functions. In general they will not be
called by the user directly, unless he or she is creating additional
virtual topology capability other than that provided by  MPI.

     MPI_CART_MAP(comm, ndims, dims, periods, newrank)

[  IN    comm]  input communicator (handle)

[  IN    ndims]  number of dimensions of cartesian structure (integer)

[  IN    dims]  integer array of size <tt> ndims</tt> specifying the number of processes in each coordinate direction

[  IN     periods]  logical array of size <tt> ndims</tt> specifying the periodicity specification in each coordinate direction

[  OUT    newrank]  reordered rank of the calling process;  MPI_UNDEFINED if calling process does not belong to grid (integer)

 <tt> int MPI_Cart_map(MPI_Comm comm, int ndims, int *dims, int *periods, int *newrank)
</tt>

 <tt> MPI_CART_MAP(COMM, NDIMS, DIMS, PERIODS, NEWRANK, IERROR)
 INTEGER COMM, NDIMS, DIMS(*), NEWRANK, IERROR
LOGICAL PERIODS(*)
</tt>

 MPI_CART_MAP
computes an ``optimal'' placement for the calling process on the
physical machine.  A possible implementation of this function is to always
return the rank of the calling process, that is, not to perform any reordering.

[] Advice
 to implementors.

The function  MPI_CART_CREATE(comm, ndims, dims,
periods, reorder, comm_cart), with <tt> reorder = true</tt> can be implemented by
calling
 MPI_CART_MAP(comm, ndims, dims, periods, newrank), then calling

 MPI_COMM_SPLIT(comm, color, key, comm_cart), with
<tt> color = 0</tt> if <tt> newrank

MPI_UNDEFINED</tt>, <tt> color = MPI_UNDEFINED</tt> otherwise,
and <tt> key = newrank</tt>.

The function  MPI_CART_SUB(comm, remain_dims, comm_new) can be
implemented by a call to  MPI_COMM_SPLIT(comm, color, key, comm_new),
using a single number encoding of the lost dimensions as <tt> color</tt> and a
single number encoding of the preserved dimensions as <tt> key</tt>.

All other cartesian topology functions can be implemented locally, using
the topology information that is cached with the communicator.
 ( End of advice to implementors.)

The corresponding new function for general graph structures is as follows.

     MPI_GRAPH_MAP(comm, nnodes, index, edges, newrank)

[  IN    comm]  input communicator (handle)

[  IN    nnodes]  number of graph nodes (integer)

[  IN    index] integer array specifying the graph structure, see
 MPI_GRAPH_CREATE

[  IN    edges] integer array specifying the graph structure

[  OUT    newrank]  reordered rank of the calling process;  MPI_UNDEFINED if the calling process does not belong to graph (integer)

 <tt> int MPI_Graph_map(MPI_Comm comm, int nnodes, int *index, int *edges, int *newrank)
</tt>

 <tt> MPI_GRAPH_MAP(COMM, NNODES, INDEX, EDGES, NEWRANK, IERROR)
 INTEGER COMM, NNODES, INDEX(*), EDGES(*), NEWRANK, IERROR
</tt>

[] Advice
 to implementors.

The function  MPI_GRAPH_CREATE(comm, nnodes, index, edges,
reorder, comm_graph),
with <tt> reorder = true</tt> can be implemented by calling
 MPI_GRAPH_MAP(comm, nnodes, index, edges, newrank),
then calling

 MPI_COMM_SPLIT(comm, color, key, comm_graph), with <tt> color = 0</tt>
if <tt> newrank

MPI_UNDEFINED</tt>, <tt> color = MPI_UNDEFINED</tt>
otherwise, and <tt> key = newrank</tt>.

All other graph topology functions can be implemented locally, using the
topology information that is cached with the communicator.
 ( End of advice to implementors.)

Up:  Topology Constructors
Next:  An Application Example
Previous:  Partitioning of Cartesian structures

Return to MPI 1.1 Standard Index

Return to MPI-2 Standard Index

Return to MPI Forum Home Page

MPI-1.1 of June 12, 1995

HTML Generated on August 6, 1997


text:
// Defines a test server for running jasmine unit tests
// with coverage support.

var path = require('path');

/**
 * Return URL friendly browser string
 */
function browser(b) {
  /* The browser string starts with the basic browser name (Firefox, PhantomJS,
   * etc.  Split on the first space or dash to isolate this name. */
  return b.toLowerCase().split(/[ /-]/)[0];
}

function subdir_name(b) {
  var subdir = browser(b);
  if (process.env.GEOJS_TEST_CASE) {
    /* Use thes test case and as part of the name so that different tests end
     * up in different coverage directories.  Get the last element of the path
     * without the extension from the test case for this purpose. */
    var parts = /^(.+\/)*(([^\/]+)\.[^\/.]*|[^\/.]+)$/.exec(process.env.GEOJS_TEST_CASE);
    if (parts) {
      subdir += '_' + (parts[3] || parts[2]);
    }
  }
  return subdir;
}

module.exports = function (config) {
  var karma_config = require('./karma-base')(config);

  karma_config.reporters = ['progress', 'coverage'];
  karma_config.coverageReporter = {
    reporters: [
      {type: 'html', dir: 'dist/coverage/', subdir: subdir_name},
      {type: 'cobertura', dir: 'dist/cobertura/', file: 'coverage.xml', subdir: subdir_name},
      {type: 'json', dir: 'dist/coverage/json/', subdir: subdir_name},
      {type: 'lcovonly', dir: 'lcov', subdir: subdir_name},
      {type: 'text'}
    ]
  };
  karma_config.webpack.module.preLoaders = [
    {
      test: /\.js$/,
      include: path.resolve('src/'),
      loader: 'istanbul-instrumenter'
    }
  ];

  config.set(karma_config);
};


text: p { margin-bottom: 10px; }


text:
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Response } from '@angular/http';

import { Observable } from 'rxjs/Rx';
import { NgbActiveModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager, JhiAlertService } from 'ng-jhipster';

import { Aluno } from './aluno.model';
import { AlunoPopupService } from './aluno-popup.service';
import { AlunoService } from './aluno.service';
import { User, UserService } from '../../shared';
import { Nota, NotaService } from '../nota';
import { Turma, TurmaService } from '../turma';
import { ResponseWrapper } from '../../shared';

@Component({
    selector: 'jhi-aluno-dialog',
    templateUrl: './aluno-dialog.component.html'
})
export class AlunoDialogComponent implements OnInit {

    aluno: Aluno;
    isSaving: boolean;

    users: User[];

    notas: Nota[];

    turmas: Turma[];

    constructor(
        public activeModal: NgbActiveModal,
        private alertService: JhiAlertService,
        private alunoService: AlunoService,
        private userService: UserService,
        private notaService: NotaService,
        private turmaService: TurmaService,
        private eventManager: JhiEventManager
    ) {
    }

    ngOnInit() {
        this.isSaving = false;
        this.userService.query()
            .subscribe((res: ResponseWrapper) => { this.users = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
        this.notaService.query()
            .subscribe((res: ResponseWrapper) => { this.notas = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
        this.turmaService.query()
            .subscribe((res: ResponseWrapper) => { this.turmas = res.json; }, (res: ResponseWrapper) => this.onError(res.json));
    }

    clear() {
        this.activeModal.dismiss('cancel');
    }

    save() {
        this.isSaving = true;
        if (this.aluno.id !== undefined) {
            this.subscribeToSaveResponse(
                this.alunoService.update(this.aluno));
        } else {
            this.subscribeToSaveResponse(
                this.alunoService.create(this.aluno));
        }
    }

    private subscribeToSaveResponse(result: Observable<Aluno>) {
        result.subscribe((res: Aluno) =>
            this.onSaveSuccess(res), (res: Response) => this.onSaveError(res));
    }

    private onSaveSuccess(result: Aluno) {
        this.eventManager.broadcast({ name: 'alunoListModification', content: 'OK'});
        this.isSaving = false;
        this.activeModal.dismiss(result);
    }

    private onSaveError(error) {
        try {
            error.json();
        } catch (exception) {
            error.message = error.text();
        }
        this.isSaving = false;
        this.onError(error);
    }

    private onError(error) {
        this.alertService.error(error.message, null, null);
    }

    trackUserById(index: number, item: User) {
        return item.id;
    }

    trackNotaById(index: number, item: Nota) {
        return item.id;
    }

    trackTurmaById(index: number, item: Turma) {
        return item.id;
    }

    getSelected(selectedVals: Array<any>, option: any) {
        if (selectedVals) {
            for (let i = 0; i < selectedVals.length; i++) {
                if (option.id === selectedVals[i].id) {
                    return selectedVals[i];
                }
            }
        }
        return option;
    }
}

@Component({
    selector: 'jhi-aluno-popup',
    template: ''
})
export class AlunoPopupComponent implements OnInit, OnDestroy {

    routeSub: any;

    constructor(
        private route: ActivatedRoute,
        private alunoPopupService: AlunoPopupService
    ) {}

    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            if ( params['id'] ) {
                this.alunoPopupService
                    .open(AlunoDialogComponent as Component, params['id']);
            } else {
                this.alunoPopupService
                    .open(AlunoDialogComponent as Component);
            }
        });
    }

    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}


text:
Put your openweathermap.org api key to <tt>gradle.properties</tt>
```groovy
org.openweathermap.appId = ABCD12345
```


text:
class GclNavRenderer < SimpleNavigation::Renderer::List

  def render(item_container)
    super
  end

  protected

  def tag_for(item)
    super
  end

  private

  def list_content(item_container)
    super
  end
end


text:
import { jest } from '@jest/globals'
import fs from 'fs-extra'
import njk from '../lib/command.js'

const sample = 'tests/fixtures/example'

beforeAll(() => {
  fs.ensureDir = jest.fn()
  fs.outputFile = jest.fn()
  console.log = jest.fn()
})

it('should render single page', async () => {
  expect(
    await njk(
      `${sample}/pages/prose.html -b -v -c -t ${sample}/templates -d ${sample}/data`.split(
        ' '
      )
    )
  ).toBeUndefined()

  expect(console.log).toBeCalledTimes(3)
  expect(fs.outputFile.mock.calls[0]).toMatchSnapshot()
})

it('should render multiple pages', async () => {
  expect(
    await njk(
      `${sample}/pages/*.{html,md} -b -c -t ${sample}/templates -d ${sample}/data`.split(
        ' '
      )
    )
  ).toBeUndefined()

  expect(console.log).toBeCalledTimes(1)

  expect(Object.fromEntries(fs.outputFile.mock.calls)).toMatchSnapshot()
})


text:
from ramen.db import *
from ramen.views import *

class Test(object):

    class Meta:
        a = 1
        b = 2

class User(Record):
    _collection = 'users'

    name = Field()

class SubUser(User):

    subname = Field()

u = User()
s = SubUser()

#print User.Q.get(11)

# users = User.Q.filter( Q.id.contained([11, 12, 13, 14]) )

# users.load()

# print users.cursor.to_list()

# while users.more():
#     print users.next()


text:
var express = require("express");
var http = require("http");
var app;

app = express();
http.createServer(app).listen(3000);

// Dateien im "static" Unterverzeichnis ausliefern
// Index deaktivieren mit ...static(PATH,{index:false})
app.use(express.static(__dirname + "/static"));

// Mit Express ist Routing einfach:
app.get("/", function(req, res) {
	// Auch HTTP Header werden automatisch gesetzt
	res.send("What?");
});

app.get("/greetings", function(req, res) {
	const url_parts = new URL(req.url, `http://${req.headers.host}`);
	const query = url_parts.searchParams;

	var name = (query.has("name")) ? query.get("name") : "Anonymous";
	res.send("Greetings " + name);
});

app.get("/cheerio", function(req, res) {
	res.send("Cheerio.");
});


text:
namespace extensions {

namespace errors = manifest_errors;
namespace keys = manifest_keys;

class ExtensionManifestBackgroundTest : public ChromeManifestTest {
};

TEST_F(ExtensionManifestBackgroundTest, BackgroundPermission) {
  LoadAndExpectError("background_permission.json",
                     errors::kBackgroundPermissionNeeded);
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundScripts) {
  std::string error;
  std::unique_ptr<base::DictionaryValue> manifest =
      LoadManifest("background_scripts.json", &error);
  ASSERT_TRUE(manifest.get());

  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess(ManifestData(manifest.get(), "")));
  ASSERT_TRUE(extension.get());
  const std::vector<std::string>& background_scripts =
      BackgroundInfo::GetBackgroundScripts(extension.get());
  ASSERT_EQ(2u, background_scripts.size());
  EXPECT_EQ("foo.js", background_scripts[0u]);
  EXPECT_EQ("bar/baz.js", background_scripts[1u]);

  EXPECT_TRUE(BackgroundInfo::HasBackgroundPage(extension.get()));
  EXPECT_EQ(
      std::string("/") + kGeneratedBackgroundPageFilename,
      BackgroundInfo::GetBackgroundURL(extension.get()).path());

  manifest->SetString("background_page", "monkey.html");
  LoadAndExpectError(ManifestData(manifest.get(), ""),
                     errors::kInvalidBackgroundCombination);
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundPage) {
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess("background_page.json"));
  ASSERT_TRUE(extension.get());
  EXPECT_EQ("/foo.html",
            BackgroundInfo::GetBackgroundURL(extension.get()).path());
  EXPECT_TRUE(BackgroundInfo::AllowJSAccess(extension.get()));

  std::string error;
  std::unique_ptr<base::DictionaryValue> manifest(
      LoadManifest("background_page_legacy.json", &error));
  ASSERT_TRUE(manifest.get());
  extension = LoadAndExpectSuccess(ManifestData(manifest.get(), ""));
  ASSERT_TRUE(extension.get());
  EXPECT_EQ("/foo.html",
            BackgroundInfo::GetBackgroundURL(extension.get()).path());

  manifest->SetInteger(keys::kManifestVersion, 2);
  LoadAndExpectWarning(
      ManifestData(manifest.get(), ""),
      "'background_page' requires manifest version of 1 or lower.");
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundAllowNoJsAccess) {
  scoped_refptr<Extension> extension;
  extension = LoadAndExpectSuccess("background_allow_no_js_access.json");
  ASSERT_TRUE(extension.get());
  EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get()));

  extension = LoadAndExpectSuccess("background_allow_no_js_access2.json");
  ASSERT_TRUE(extension.get());
  EXPECT_FALSE(BackgroundInfo::AllowJSAccess(extension.get()));
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundPageWebRequest) {
  ScopedCurrentChannel current_channel(version_info::Channel::DEV);

  std::string error;
  std::unique_ptr<base::DictionaryValue> manifest(
      LoadManifest("background_page.json", &error));
  ASSERT_TRUE(manifest.get());
  manifest->SetBoolean(keys::kBackgroundPersistent, false);
  manifest->SetInteger(keys::kManifestVersion, 2);
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess(ManifestData(manifest.get(), "")));
  ASSERT_TRUE(extension.get());
  EXPECT_TRUE(BackgroundInfo::HasLazyBackgroundPage(extension.get()));

  base::ListValue* permissions = new base::ListValue();
  permissions->AppendString("webRequest");
  manifest->Set(keys::kPermissions, permissions);
  LoadAndExpectError(ManifestData(manifest.get(), ""),
                     errors::kWebRequestConflictsWithLazyBackground);
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundPagePersistentPlatformApp) {
  scoped_refptr<Extension> extension =
      LoadAndExpectSuccess("background_page_persistent_app.json");
  ASSERT_TRUE(extension->is_platform_app());
  ASSERT_TRUE(BackgroundInfo::HasBackgroundPage(extension.get()));
  EXPECT_FALSE(BackgroundInfo::HasPersistentBackgroundPage(extension.get()));

  std::string error;
  std::vector<InstallWarning> warnings;
  ManifestHandler::ValidateExtension(extension.get(), &error, &warnings);
  // Persistent background pages are not supported for packaged apps.
  // The persistent flag is ignored and a warining is printed.
  EXPECT_EQ(1U, warnings.size());
  EXPECT_EQ(errors::kInvalidBackgroundPersistentInPlatformApp,
            warnings[0].message);
}

TEST_F(ExtensionManifestBackgroundTest, BackgroundPagePersistentInvalidKey) {
  scoped_refptr<Extension> extension =
      LoadAndExpectSuccess("background_page_invalid_persistent_key_app.json");
  ASSERT_TRUE(extension->is_platform_app());
  ASSERT_TRUE(BackgroundInfo::HasBackgroundPage(extension.get()));
  EXPECT_FALSE(BackgroundInfo::HasPersistentBackgroundPage(extension.get()));

  std::string error;
  std::vector<InstallWarning> warnings;
  ManifestHandler::ValidateExtension(extension.get(), &error, &warnings);
  // The key 'background.persistent' is not supported for packaged apps.
  EXPECT_EQ(1U, warnings.size());
  EXPECT_EQ(errors::kBackgroundPersistentInvalidForPlatformApps,
            warnings[0].message);
}

}  // namespace extensions


text:
@implementation UIImage (Extension)

+ (UIImage *)imageWithColor:(UIColor *)color {
    CGFloat imageW = 100;
    CGFloat imageH = 100;
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(imageW, imageH), NO, 0.0);
    [color set];
    UIRectFill(CGRectMake(0, 0, imageW, imageH));
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

@end


text:
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;

namespace DnsUtils.Services
{
	public class Llmnr : INameResolver
	{
		public static readonly IPAddress MulticastAddress = IPAddress.Parse("224.0.0.252");
		public const int Port = 5355;

		public async Task<IPAddress> ResolveAsync(string hostname, int timeout = 2000)
		{
			IPEndPoint llmnrEndPoint = new IPEndPoint(MulticastAddress, Port);

			UdpClient client = new UdpClient();
			DnsPacket questionPacket = new DnsPacket();

			questionPacket.Questions.Add(new DnsQuestion(hostname, DnsRecordType.A, DnsRecordClass.InterNetwork));

			byte[] data = questionPacket.ToBytes();

			client.JoinMulticastGroup(MulticastAddress);
			client.Send(data, data.Length, llmnrEndPoint);

			client.Client.ReceiveTimeout = timeout;

			DateTime endTime = DateTime.Now + new TimeSpan(0, 0, 0, 0, timeout);

			CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(timeout);

			while (DateTime.Now < endTime)
			{
				UdpReceiveResult receiveTask = await Task.Run(client.ReceiveAsync, cancellationTokenSource.Token);

				DnsPacket responsePacket = DnsPacket.FromBytes(receiveTask.Buffer);

				if (responsePacket.ID == questionPacket.ID && responsePacket.AnswerCount > 0)
				{
					foreach (var answer in responsePacket.Answers)
					{
						DnsARecord aRecord = answer as DnsARecord;

						if (aRecord != null)
						{
							return aRecord.IPAddress;
						}
					}
				}
			}

			return null;
		}
	}
}


text:
function Map(){
	this.pin = "";
}

Map.prototype.getAnnotations = function(){
	var gasolinerasList = JSON.parse(Titanium.App.Properties.getString("gasolinerasList"));
	var coordenadas = JSON.parse(Titanium.App.Properties.getString("coordenadas"));
	//declare module dependencies
	var Annotations = require('lib/Annotations');
	var anotaciones = new Annotations();

	var anotacionesList = anotaciones.Make();
	this.pin = anotaciones.pin;
	//distancia del elemento mas lejano para centrar el mapa

return anotacionesList;

};

Map.prototype.getRegion = function(){
	var gasolinerasList = JSON.parse(Titanium.App.Properties.getString("gasolinerasList"));
	var coordenadas = JSON.parse(Titanium.App.Properties.getString("coordenadas"));
	//distancia del elemento mas lejano para centrar el mapa
	var delta = gasolinerasList[gasolinerasList.length - 1].distancia/70;
	var region = {latitude:coordenadas.lat,longitude:coordenadas.lng,animate:true,latitudeDelta:delta, longitudeDelta:delta};

return region;

};

module.exports = Map;


text:
namespace DynThings.Data.Models
{

using System;
    using System.Collections.Generic;

public partial class LinkDevicesLocation
{

    public long ID { get; set; }

    public Nullable<long> LocationID { get; set; }

    public Nullable<long> DeviceID { get; set; }

    public Nullable<System.DateTime> StartTimeStamp { get; set; }

    public Nullable<System.DateTime> EndTimeStamp { get; set; }

    public string StartByUser { get; set; }

    public string EndByUser { get; set; }

    public virtual AspNetUser EndByAspNetUser { get; set; }

    public virtual AspNetUser StartByAspNetUser { get; set; }

    public virtual Device Device { get; set; }

    public virtual Location Location { get; set; }

}

}


text:
require 'spec_helper'

describe Esearch::Cluster do
  let(:object)     { described_class.new(connection) }

  let(:connection) { double('Connection')            }

  describe '.connect' do
    subject { object.connect(*arguments) }

    let(:object)     { described_class      }

    let(:arguments) { [:foo, :bar] }

    before do
      Esearch::Connection.should_receive(:build).with(:foo, :bar).and_return(connection)
    end

    it { should eql(described_class.new(connection)) }
  end

  describe '#health' do
    subject { object.health }

    let(:expected_arguments) { [{}] }

    expect_to_run_command(Esearch::Command::Cluster::Health)
  end

  describe '#index' do
    subject { object.index(name) }

    let(:name) { 'foo' }

    it { should eql(Esearch::Index.new(connection, name)) }
  end

  describe '#all_indices' do
    subject { object.all_indices }

    it { should eql(Esearch::Indices::All.new(connection)) }
  end

  describe '#indices' do
    subject { object.indices(names) }

    let(:names) { %w(foo bar) }

    it { should eql(Esearch::Indices.new(connection, names)) }
  end

  describe '#path' do
    subject { object.path }

    it { should eql(Pathname.new('/')) }
  end
end


text:
#ifdef HAVE_CONFIG_H
#  include <oasys-config.h>
#endif

#include "inet_aton.h"

#if !defined(HAVE_INET_ATON)
#if  defined(HAVE_INET_PTON)

int
inet_aton_with_pton(const char * name, struct in_addr *addr)
{
    return inet_pton(AF_INET, name, addr);
}

#endif
#endif


text:
package org.z.zerofix.fixml.degister;

public class Field extends Node {

	private int tag;

	private String type;

	public int getNumber() {
		return tag;
	}
	public void setNumber(int number) {
		this.tag = number;
	}
	public int getTag() {
		return tag;
	}
	public void setTag(int tag) {
		this.tag = tag;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	@Override
	public String getTagName() {
		return "field";
	}

}