text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding field 'Picasa.width'
        db.add_column('cmsplugin_picasa', 'width',
                      self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True),
                      keep_default=False)

        # Adding field 'Picasa.height'
        db.add_column('cmsplugin_picasa', 'height',
                      self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True),
                      keep_default=False)

        # Adding field 'Picasa.thumbnail_width'
        db.add_column('cmsplugin_picasa', 'thumbnail_width',
                      self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True),
                      keep_default=False)

        # Adding field 'Picasa.thumbnail_height'
        db.add_column('cmsplugin_picasa', 'thumbnail_height',
                      self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True),
                      keep_default=False)

        # Adding field 'Picasa.autoplay'
        db.add_column('cmsplugin_picasa', 'autoplay',
                      self.gf('django.db.models.fields.BooleanField')(default=False),
                      keep_default=False)

    def backwards(self, orm):
        # Deleting field 'Picasa.width'
        db.delete_column('cmsplugin_picasa', 'width')

        # Deleting field 'Picasa.height'
        db.delete_column('cmsplugin_picasa', 'height')

        # Deleting field 'Picasa.thumbnail_width'
        db.delete_column('cmsplugin_picasa', 'thumbnail_width')

        # Deleting field 'Picasa.thumbnail_height'
        db.delete_column('cmsplugin_picasa', 'thumbnail_height')

        # Deleting field 'Picasa.autoplay'
        db.delete_column('cmsplugin_picasa', 'autoplay')

    models = {
        'cms.cmsplugin': {
            'Meta': {'object_name': 'CMSPlugin'},
            'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 1, 9, 0, 0)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
            'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
            'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
            'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
            'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
            'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
        },
        'cms.placeholder': {
            'Meta': {'object_name': 'Placeholder'},
            'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
        },
        'goscale.post': {
            'Meta': {'object_name': 'Post'},
            'attributes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'author': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'categories': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'content_type': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'link': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '200', 'null': 'True', 'blank': 'True'}),
            'permalink': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'published': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
            'slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'summary': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})
        },
        'pictures.picasa': {
            'Meta': {'object_name': 'Picasa', 'db_table': "'cmsplugin_picasa'"},
            'autoplay': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
            'height': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'posts': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['goscale.Post']", 'symmetrical': 'False'}),
            'template': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'thumbnail_height': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'thumbnail_width': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
            'url': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
            'width': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'})
        }
    }

    complete_apps = ['pictures']


text:
@extends('layouts.app')
@section('scripts')
    {{-- Incluimos los scripts de validaciones --}}

@endsection
@section('content')
@include('partials.nav.navParent')

 Empresas Borradas de la Aplicación

                        {{ Form::model($request->only(['name', 'filtros']), ['url' => $urlSearch, 'method' => 'GET', 'class' => 'row', 'role' => 'search', 'id' => 'search-form']) }}
                            {!! csrf_field() !!}
                            @include('partials.search.searcher')
                        {{ Form::close() }}
                        {{ Form::open(['url' => $urlPost, 'method' => 'POST']) }}
                            {!! csrf_field() !!}
                            @include('partials.table.tableDeniedEnterprise')
                            {{ $deniedEnterprise->appends($request->only(['name', 'filtros']))->render() }}

                                    <button type="submit" class="btn btn-primary btn-login-media  waves-effect waves-light">

                                             Restaurar

                                    </button>

                        {{ Form::close() }}

@include('partials.footer.footerWelcome')
@endsection

redpajama_set_name: RedPajamaGithub


text:
export let measurementTypes = [
  {
    displayName: 'Ping',
    sizePerValue: 48,
    defaultInterval: 60
  },
  {
    displayName: 'SNMP',
    sizePerValue: 64,
    defaultInterval: 300
  },
  {
    displayName: 'Business Process Script',
    sizePerValue: 64,
    defaultInterval: 300
  }
];


text:
var gulp = require('gulp'),
    connect = require('gulp-connect'),
    opn = require('opn'),
    less = require('gulp-less'),
    plumber = require('gulp-plumber');

var onError = function(error) {
    console.log(error);
};

// Server

gulp.task('connect', function() {
    connect.server({
        root: 'example/',
        livereload: true,
        port: 8080
    })
});

gulp.task('open', function() {
    opn('http://localhost:8080')
});

// Watchers

gulp.task('html', function() {
    gulp.src('example/*.html')
        .pipe(connect.reload());
});

gulp.task('js', function() {
    gulp.src('example/js/*.js')
        .pipe(connect.reload());
});

gulp.task('watch', function() {
    gulp.watch(['example/*.html'], ['html']);
    gulp.watch(['example/js/*.js'], ['js']);
    gulp.watch(['example/less/**/*.less'], ['less']);
});

// Builds

gulp.task('less', function() {
    gulp.src('example/less/styles.less')
        .pipe(plumber({
            errorHandler: onError
        }))
        .pipe(less())
        .pipe(gulp.dest('./example/css'))
        .pipe(connect.reload());
});

// Main Tasks

gulp.task('default', ['connect', 'less', 'watch', 'open'])


text:
jQuery(document).ready(function() {
    var offset = 50;
    var duration = 200;
    jQuery(window).scroll(function() {
        if (jQuery(this).scrollTop() > offset) {
            jQuery('.back-to-top,#floating-nav').fadeIn(duration,function(){
				$('#floating-nav > .container').css({'opacity': '10','color':'#fff'});
			});
        } else {
			jQuery('.back-to-top,#floating-nav').fadeOut(duration);
        }
    });

    jQuery('.back-to-top').click(function(event) {
        event.preventDefault();
        jQuery('html, body').animate({scrollTop: 0}, duration);
        return false;
    })
});


text:
from __future__ import unicode_literals

from tastypie import fields
from tastypie import http
from tastypie.resources import ModelResource
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.paginator import Paginator
from sorl.thumbnail.shortcuts import get_thumbnail

from .models import Category, Subcategory, Detail, Image, DetailSection
from .mixins import DropNullMixin, DetailMixin
from . import (CATEGORY_THUMB_PARAMS, SUBCATEGORY_THUMB_PARAMS,
               DETAIL_SECTION_THUMB_PARAMS, DETAIL_FULL_IMAGE)

class NoMetaPaginator(Paginator):
    """
    Paginator with no meta.
    """
    def page(self):
        res = super(NoMetaPaginator, self).page()
        del res['meta']
        return res

class BaseModelResource(ModelResource):

    class Meta:
        include_resource_uri = False
        paginator_class = NoMetaPaginator

class ImageResource(DropNullMixin, BaseModelResource):

    thumb_params = None

    class Meta(BaseModelResource.Meta):
        allowed_methods = []
        fields = ('alt_text', 'figcaption', 'url')
        queryset = Image.objects.all()

    def dehydrate(self, bundle):
        bundle = super(ImageResource, self).dehydrate(bundle)
        if self.thumb_params:
            thumb = get_thumbnail(bundle.obj.image, **self.thumb_params)
            bundle.data.update({
                'thumb': thumb.url,
                'full_image': bundle.obj.image.url
            })
        return bundle

class CategoryImageResource(ImageResource):
    thumb_params = CATEGORY_THUMB_PARAMS

class SubcategoryImageResource(ImageResource):
    thumb_params = SUBCATEGORY_THUMB_PARAMS

class DetailImageResource(ImageResource):
    thumb_params = DETAIL_FULL_IMAGE

class DetailSectionImageResource(ImageResource):
    thumb_params = DETAIL_SECTION_THUMB_PARAMS

class CategoryResource(BaseModelResource):

    image = fields.ToOneField(CategoryImageResource, 'image', full=True)

    class Meta(BaseModelResource.Meta):
        resource_name = 'categories'
        collection_name = resource_name
        allowed_methods = ['get']
        queryset = Category.objects.active().select_related('image')
        fields = ('id', 'name', 'type')
        filtering = {
            'type': ('exact',)
        }

class DetailSectionResource(BaseModelResource):

    images = fields.ToManyField(DetailSectionImageResource, 'images', full=True)

    class Meta(BaseModelResource.Meta):
        resource_name = 'detail_sections'
        collection_name = resource_name
        allowed_methods = []
        queryset = DetailSection.objects.active()
        fields = ('label',)

class DetailResource(DetailMixin, BaseModelResource):

    title_image = fields.ToOneField(DetailImageResource, 'title_image', full=True)
    sections = fields.ToManyField(DetailSectionResource, 'sections', full=True)

    class Meta(BaseModelResource.Meta):
        resource_name = 'details'
        collection_name = resource_name
        allowed_methods = ['get']
        queryset = Detail.objects.active().select_related('image')
        fields = ('name', 'caption', 'facts', 'video_url', 'type')
        detail_fields = ('caption', 'facts', 'video_url')
        filtering = {
            'type': ('exact',)
        }

    def get_list(self, request, **kwargs):
        raise ImmediateHttpResponse(http.HttpNotFound('Not found.'))

class EmbeddedDetailResource(DetailResource):
    """
    This resource is not registered in urls.py. Needed only for SubcategoryResource.
    """

    title_image = fields.ToOneField(SubcategoryImageResource, 'title_image', full=True)

    class Meta(DetailResource.Meta):
        fields = ('id', 'name',)
        queryset = Detail.objects.active().only('name').select_related('image')

class SubcategoryResource(BaseModelResource):

    details = fields.ToManyField(EmbeddedDetailResource, 'details', full=True, null=True, blank=True)

    class Meta(BaseModelResource.Meta):
        resource_name = 'subcategories'
        collection_name = resource_name
        allowed_methods = ['get']
        queryset = Subcategory.objects.active().prefetch_related('details')
        fields = ('name', 'caption', 'type')
        filtering = {
            'type': ('exact',),
        }

    def build_filters(self, filters=None):
        if filters is None:
            filters = {}

        orm_filters = super(SubcategoryResource, self).build_filters(filters)

        if 'category' in filters:
            orm_filters['category_id'] = filters['category']

        return orm_filters


text:
import {vec3, quat, mat3, mat4, curve, util} from '../../global';
import {Tw2GeometryRes} from '../resource';
import {Tw2Animation} from './Tw2Animation';
import {Tw2Bone} from './Tw2Bone';
import {Tw2Model} from './Tw2Model';
import {Tw2Track} from './Tw2Track';
import {Tw2TrackGroup} from './Tw2TrackGroup';

/**
 * Tw2AnimationController
 *
 * @property {Array.<Tw2GeometryRes>} geometryResources
 * @property {Array.<Tw2Model>} models
 * @property {Array.<Tw2Animation>} animations
 * @property {Array} meshBindings
 * @property {boolean} loaded
 * @property {boolean} update
 * @property _geometryResource
 * @property {Array} pendingCommands
 * @property {Function} [onLoaded] an optional callback fired when any commands are cleared
 * @class
 */
export class Tw2AnimationController
{

    geometryResources = [];
    models = [];
    animations = [];
    meshBindings = [];
    loaded = false;
    update = true;
    pendingCommands = [];
    onPendingCleared = null;
    _geometryResource = null;

    /**
     * Constructor
     * @param {Tw2GeometryRes} [geometryResource]
     */
    constructor(geometryResource)
    {
        if (geometryResource) this.SetGeometryResource(geometryResource);
    }

    /**
     * Gets a loaded Tw2Animation by it's name
     * @returns {?{ string: Tw2Animation}} an object containing animation names and animations, or null if not loaded
     */
    GetAnimationsByName()
    {
        if (!this.loaded) return null;

        const animations = {};
        for (let i = 0; i < this.animations.length; i++)
        {
            animations[this.animations[i].animationRes.name] = this.animations[i];
        }
        return animations;
    }

    /**
     * Gets a loaded Tw2Animation by it's name
     * @param {String} name
     * @returns {?Tw2Animation} Returns the animation if found
     */
    GetAnimation(name)
    {
        for (let i = 0; i < this.animations.length; i++)
        {
            if (this.animations[i].animationRes.name === name)
            {
                return this.animations[i];
            }
        }
        return null;
    }

    /**
     * Resets a Tw2Animation by it's name
     * @param {String} name
     * @return {boolean}
     */
    ResetAnimation(name)
    {
        const animation = this.GetAnimation(name);
        if (animation)
        {
            animation.time = 0;
            animation.isPlaying = false;
            animation.callback = null;
            return true;
        }
    }

    /**
     * Plays a specific animation by it's name
     * @param {string} name - Animation's Name
     * @param {boolean} [cycle]
     * @param {Function} [callback] - Optional callback which is fired once the animation has completed
     * @return {boolean}
     */
    PlayAnimation(name, cycle, callback)
    {
        if (this.animations.length === 0)
        {
            this.pendingCommands.push({
                'func': this.PlayAnimation,
                'args': [name, cycle, callback]
            });
            return true;
        }

        const animation = this.GetAnimation(name);
        if (animation)
        {
            animation.time = 0;
            animation.isPlaying = true;

            if (!util.isUndefined(cycle))
            {
                animation.cycle = cycle;
            }

            if (callback)
            {
                animation.callback = callback;
            }

            return true;
        }
    }

    /**
     * Plays a specific animation from a specific time
     * @param {string} name - Animation's Name
     * @param {number} from - Time to play from
     * @param {boolean} [cycle]
     * @param {Function} [callback] - Optional callback which is fired once the animation has completed
     * @returns {boolean}
     */
    PlayAnimationFrom(name, from, cycle, callback)
    {
        if (this.animations.length === 0)
        {
            this.pendingCommands.push({
                'func': this.PlayAnimationFrom,
                'args': [name, from, cycle, callback]
            });
            return true;
        }

        const animation = this.GetAnimation(name);
        if (animation)
        {
            animation.time = Math.max(Math.min(from, animation.animationRes.duration), 0);
            animation.isPlaying = true;

            if (!util.isUndefined(cycle))
            {
                animation.cycle = cycle;
            }

            if (callback)
            {
                animation.callback = callback;
            }

            return true;
        }
    }

    /**
     * Gets an array of all the currently playing animations by name
     * @returns {Array}
     */
    GetPlayingAnimations()
    {
        const result = [];
        for (let i = 0; i < this.animations.length; i++)
        {
            if (this.animations[i].isPlaying)
            {
                result.push(this.animations[i].animationRes.name);
            }
        }
        return result;
    }

    /**
     * Stops an animation or an array of animations from playing
     * @param {String| Array.<string>} names - Animation Name, or Array of Animation Names
     */
    StopAnimation(names)
    {
        if (this.animations.length === 0)
        {
            this.pendingCommands.push({
                'func': this.StopAnimation,
                'args': names
            });
            return;
        }

        names = util.toArray(names);

        const toStop = {};
        for (let n = 0; n < names.length; n++)
        {
            toStop[names[n]] = true;
        }

        for (let i = 0; i < this.animations.length; ++i)
        {
            if (this.animations[i].animationRes.name in toStop)
            {
                this.animations[i].isPlaying = false;
            }
        }
    }

    /**
     * Stops all animations from playing
     */
    StopAllAnimations()
    {
        if (this.animations.length === 0)
        {
            this.pendingCommands.push({
                'func': this.StopAllAnimations,
                'args': null
            });
            return;
        }

        for (let i = 0; i < this.animations.length; ++i)
        {
            this.animations[i].isPlaying = false;
        }
    }

    /**
     * Stops all but the supplied list of animations
     * @param {String| Array.<string>} names - Animation Names
     */
    StopAllAnimationsExcept(names)
    {
        if (this.animations.length === 0)
        {
            this.pendingCommands.push({
                'func': this.StopAllAnimationsExcept,
                'args': names
            });
            return;
        }

        util.toArray(names);

        const keepAnimating = {};
        for (let n = 0; n < names.length; n++)
        {
            keepAnimating[names[n]] = true;
        }

        for (let i = 0; i < this.animations.length; ++i)
        {
            if (!(this.animations[i].animationRes.name in keepAnimating))
            {
                this.animations[i].isPlaying = false;
            }
        }
    }

    /**
     * Clears any existing resources and loads the supplied geometry resource
     * @param {Tw2GeometryRes} geometryResource
     */
    SetGeometryResource(geometryResource)
    {
        this.models = [];
        this.animations = [];
        this.meshBindings = [];

        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            this.geometryResources[i].UnregisterNotification(this);
        }

        this.loaded = false;
        this.geometryResources = [];

        if (geometryResource)
        {
            this.geometryResources.push(geometryResource);
            geometryResource.RegisterNotification(this);
        }
    }

    /**
     * Adds a Geometry Resource
     * @param {Tw2GeometryRes} geometryResource
     */
    AddGeometryResource(geometryResource)
    {
        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            if (this.geometryResources[i] === geometryResource)
            {
                return;
            }
        }
        this.geometryResources.push(geometryResource);
        geometryResource.RegisterNotification(this);
    }

    /**
     * Adds animations from a resource
     * @param {Tw2GeometryRes} resource
     */
    AddAnimationsFromRes(resource)
    {
        for (let i = 0; i < resource.animations.length; ++i)
        {
            let animation = null;
            for (let j = 0; j < this.animations.length; ++j)
            {
                if (this.animations[j].animationRes === resource.animations[i])
                {
                    animation = this.animations[i];
                    break;
                }
            }

            if (!animation)
            {
                animation = new Tw2Animation();
                animation.animationRes = resource.animations[i];
                this.animations.push(animation);
            }

            for (let j = 0; j < animation.animationRes.trackGroups.length; ++j)
            {
                let found = false;
                for (let k = 0; k < animation.trackGroups.length; ++k)
                {
                    if (animation.trackGroups[k].trackGroupRes === animation.animationRes.trackGroups[j])
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    continue;
                }

                let model = null;
                for (let k = 0; k < this.models.length; ++k)
                {
                    if (this.models[k].modelRes.name === animation.animationRes.trackGroups[j].name)
                    {
                        model = this.models[k];
                        break;
                    }
                }

                if (model !== null)
                {
                    const group = new Tw2TrackGroup();
                    group.trackGroupRes = animation.animationRes.trackGroups[j];
                    for (let k = 0; k < group.trackGroupRes.transformTracks.length; ++k)
                    {
                        for (let m = 0; m < model.bones.length; ++m)
                        {
                            if (model.bones[m].boneRes.name === group.trackGroupRes.transformTracks[k].name)
                            {
                                const track = new Tw2Track();
                                track.trackRes = group.trackGroupRes.transformTracks[k];
                                track.bone = model.bones[m];
                                group.transformTracks.push(track);
                                break;
                            }
                        }
                    }
                    animation.trackGroups.push(group);
                }
            }
        }
    }

    /**
     * Resets the bone transforms
     */
    ResetBoneTransforms()
    {
        for (let i = 0; i < this.models.length; ++i)
        {
            for (let j = 0; j < this.models[i].bones.length; ++j)
            {
                const
                    bone = this.models[i].bones[j],
                    boneRes = bone.boneRes;

                mat4.copy(bone.localTransform, boneRes.localTransform);

                if (boneRes.parentIndex !== -1)
                {
                    mat4.multiply(bone.worldTransform, bone.localTransform, this.models[i].bones[bone.boneRes.parentIndex].worldTransform);
                }
                else
                {
                    mat4.set(bone.worldTransform, bone.localTransform);
                }
                mat4.identity(bone.offsetTransform);
            }
        }

        const id = mat4.identity(Tw2AnimationController.global.mat4_0);
        for (let i = 0; i < this.meshBindings.length; ++i)
        {
            for (let j = 0; j < this.meshBindings[i].length; ++j)
            {
                for (let k = 0; k * 16 < this.meshBindings[i][j].length; ++k)
                {
                    for (let m = 0; m < 16; ++m)
                    {
                        this.meshBindings[i][j][k * 16 + m] = id[m];
                    }
                }
            }
        }
    }

    /**
     * GetBoneMatrices
     * @param {number} meshIndex
     * @param {Tw2GeometryRes} [geometryResource=this.geometryResources[0]]
     * @returns {Float32Array}
     */
    GetBoneMatrices(meshIndex, geometryResource)
    {
        if (this.geometryResources.length === 0)
        {
            return new Float32Array();
        }

        if (!geometryResource)
        {
            geometryResource = this.geometryResources[0];
        }

        const meshBindings = Tw2AnimationController.FindMeshBindings(this, geometryResource);
        if (meshBindings && meshIndex < meshBindings.length)
        {
            return meshBindings[meshIndex];
        }
        return new Float32Array();
    }

    /**
     * FindModelForMesh
     * @param {number} meshIndex
     * @param {Tw2GeometryRes} [geometryResource=this.geometryResources[0]]
     * @returns {Tw2Model|null} Returns the Tw2Model for the mesh if found and is good, else returns null
     */
    FindModelForMesh(meshIndex, geometryResource)
    {
        if (this.geometryResources.length === 0)
        {
            return null;
        }

        if (!geometryResource)
        {
            geometryResource = this.geometryResources[0];
        }

        if (!geometryResource.IsGood())
        {
            return null;
        }

        const mesh = geometryResource.meshes[meshIndex];
        for (let i = 0; i < this.models.length; ++i)
        {
            for (let j = 0; j < this.models[i].modelRes.meshBindings.length; ++i)
            {
                if (this.models[i].modelRes.meshBindings[j].mesh === mesh)
                {
                    return this.models[i];
                }
            }
        }
        return null;
    }

    /**
     * Gets all animation controller res objects
     * @param {Array} [out=[]] - Optional receiving array
     * @returns {Array.<Tw2Resource>} [out]
     */

    GetResources(out = [])
    {
        for (let i = 0; i < this.geometryResources.length; i++)
        {
            if (!out.includes(this.geometryResources[i]))
            {
                out.push(this.geometryResources[i]);
            }
        }
        return out;
    }

    /**
     * Rebuilds the cached data for a resource (unless it doesn't exist or is already good)
     * @param {Tw2GeometryRes} resource
     */
    RebuildCachedData(resource)
    {
        let found = false;
        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            if (this.geometryResources[i] === resource)
            {
                found = true;
                break;
            }
        }

        if (!found)
        {
            return;
        }

        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            if (!this.geometryResources[i].IsGood())
            {
                return;
            }
        }

        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            Tw2AnimationController.DoRebuildCachedData(this, this.geometryResources[i]);
        }
    }

    /**
     * Internal render/update function which is called every frame
     * @param {number} dt - Delta Time
     */
    Update(dt)
    {
        if (!this.models || !this.update)
        {
            return;
        }

        for (let i = 0; i < this.geometryResources.length; ++i)
        {
            this.geometryResources[i].KeepAlive();
        }

        const
            g = Tw2AnimationController.global,
            rotationMat = g.mat4_0,
            orientation = g.quat_0,
            position = g.vec3_0,
            scale = g.mat3_0;

        //var updateBones = false;
        for (let i = 0; i < this.animations.length; ++i)
        {
            const animation = this.animations[i];
            if (animation.isPlaying)
            {
                const res = animation.animationRes;
                animation.time += dt * animation.timeScale;
                if (animation.time > res.duration)
                {
                    if (animation.callback)
                    {
                        animation.callback(this, animation);
                    }

                    if (animation.cycle)
                    {
                        animation.time = animation.time % res.duration;
                    }
                    else
                    {
                        animation.isPlaying = false;
                        animation.time = res.duration;
                    }
                }

                for (let j = 0; j < animation.trackGroups.length; ++j)
                {
                    for (let k = 0; k < animation.trackGroups[j].transformTracks.length; ++k)
                    {
                        const track = animation.trackGroups[j].transformTracks[k];
                        if (track.trackRes.position)
                        {
                            curve.evaluate(track.trackRes.position, animation.time, position, animation.cycle, res.duration);
                        }
                        else
                        {
                            position[0] = position[1] = position[2] = 0;
                        }
                        if (track.trackRes.orientation)
                        {
                            curve.evaluate(track.trackRes.orientation, animation.time, orientation, animation.cycle, res.duration);
                            quat.normalize(orientation, orientation);
                        }
                        else
                        {
                            quat.identity(orientation);
                        }
                        if (track.trackRes.scaleShear)
                        {
                            curve.evaluate(track.trackRes.scaleShear, animation.time, scale, animation.cycle, res.duration);
                        }
                        else
                        {
                            mat3.identity(scale);
                        }

                        mat4.fromMat3(track.bone.localTransform, scale);
                        mat4.multiply(track.bone.localTransform, track.bone.localTransform, mat4.fromQuat(rotationMat, orientation));
                        track.bone.localTransform[12] = position[0];
                        track.bone.localTransform[13] = position[1];
                        track.bone.localTransform[14] = position[2];
                    }
                }
            }
        }

        for (let i = 0; i < this.models.length; ++i)
        {
            for (let j = 0; j < this.models[i].bones.length; ++j)
            {
                const bone = this.models[i].bones[j];
                if (bone.boneRes.parentIndex !== -1)
                {
                    mat4.multiply(bone.worldTransform, this.models[i].bones[bone.boneRes.parentIndex].worldTransform, bone.localTransform);
                }
                else
                {
                    mat4.copy(bone.worldTransform, bone.localTransform);
                }
                mat4.multiply(bone.offsetTransform, bone.worldTransform, bone.boneRes.worldTransformInv);
                if (bone.bindingArrays)
                {
                    for (let a = 0; a < bone.bindingArrays.length; ++a)
                    {
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 0] = bone.offsetTransform[0];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 1] = bone.offsetTransform[4];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 2] = bone.offsetTransform[8];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 3] = bone.offsetTransform[12];

                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 4] = bone.offsetTransform[1];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 5] = bone.offsetTransform[5];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 6] = bone.offsetTransform[9];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 7] = bone.offsetTransform[13];

                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 8] = bone.offsetTransform[2];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 9] = bone.offsetTransform[6];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 10] = bone.offsetTransform[10];
                        bone.bindingArrays[a].array[bone.bindingArrays[a].offset + 11] = bone.offsetTransform[14];
                    }
                }
            }
        }

    }

    /**
     * RenderDebugInfo
     * TODO: Fix commented out code
     * @param {function} debugHelper
     */
    RenderDebugInfo(debugHelper)
    {
        /*for (var i = 0; i < this.geometryResources.length; ++i)
         {
         this.geometryResources[i].RenderDebugInfo(debugHelper);
         }*/
        for (let i = 0; i < this.models.length; ++i)
        {
            for (let j = 0; j < this.models[i].bones.length; ++j)
            {
                const b0 = this.models[i].bones[j];
                if (b0.boneRes.parentIndex >= 0)
                {
                    const b1 = this.models[i].bones[b0.boneRes.parentIndex];
                    debugHelper['AddLine'](
                        [b0.worldTransform[12], b0.worldTransform[13], b0.worldTransform[14]],
                        [b1.worldTransform[12], b1.worldTransform[13], b1.worldTransform[14]]);
                }
            }
        }
    }

    /**
     * Adds a model resource to an animation controller
     * @param {Tw2AnimationController} animationController
     * @param {Tw2GeometryModel} modelRes
     * @returns {null|Tw2Model} Returns a newly created Tw2Model if the model resource doesn't already exist, and null if it does
     */
    static AddModel(animationController, modelRes)
    {
        for (let i = 0; i < animationController.models.length; ++i)
        {
            if (animationController.models[i].modelRes.name === modelRes.name)
            {
                return null;
            }
        }

        const model = new Tw2Model();
        model.modelRes = modelRes;
        const skeleton = modelRes.skeleton;
        if (skeleton !== null)
        {
            for (let j = 0; j < skeleton.bones.length; ++j)
            {
                const bone = new Tw2Bone();
                bone.boneRes = skeleton.bones[j];
                model.bones.push(bone);
                model.bonesByName[bone.boneRes.name] = bone;
            }
        }
        animationController.models.push(model);
        return model;
    }

    /**
     * Finds a mesh binding for a supplied resource from an animation controller
     * @param {Tw2AnimationController} animationController
     * @param {Tw2GeometryRes} resource
     * @returns {Object|null} Returns the mesh binding of a resource if it exists, null if it doesn't
     * @private
     */
    static FindMeshBindings(animationController, resource)
    {
        for (let i = 0; i < animationController.meshBindings.length; ++i)
        {
            if (animationController.meshBindings[i].resource === resource)
            {
                return animationController.meshBindings[i];
            }
        }
        return null;
    }

    /**
     * DoRebuildCachedData
     * @param {Tw2AnimationController) animationController
     * @param {Tw2GeometryRes} resource
     */
    static DoRebuildCachedData(animationController, resource)
    {
        const newModels = [];
        if (resource.meshes.length)
        {
            for (let i = 0; i < resource.models.length; ++i)
            {
                const model = Tw2AnimationController.AddModel(animationController, resource.models[i]);
                if (model)
                {
                    newModels.push(model);
                }
            }
        }

        for (let i = 0; i < animationController.geometryResources.length; ++i)
        {
            animationController.AddAnimationsFromRes(animationController.geometryResources[i]);
        }

        if (resource.models.length === 0)
        {
            for (let i = 0; i < resource.meshes.length; ++i)
            {
                Tw2GeometryRes.BindMeshToModel(resource.meshes[i], animationController.geometryResources[0].models[0], resource);
            }
            resource.models.push(animationController.geometryResources[0].models[0]);
        }

        for (let i = 0; i < resource.models.length; ++i)
        {
            let model = null;
            for (let j = 0; j < animationController.models.length; ++j)
            {
                if (animationController.models[j].modelRes.name === resource.models[i].name)
                {
                    model = animationController.models[j];
                    break;
                }
            }

            if (model === null)
            {
                continue;
            }

            for (let j = 0; j < resource.models[i].meshBindings.length; ++j)
            {
                const meshIx = resource.meshes.indexOf(resource.models[i].meshBindings[j].mesh);
                let meshBindings = Tw2AnimationController.FindMeshBindings(animationController, resource);

                if (meshBindings === null)
                {
                    meshBindings = [];
                    meshBindings.resource = resource;
                    animationController.meshBindings.push(meshBindings);
                }

                meshBindings[meshIx] = new Float32Array(resource.models[i].meshBindings[j].bones.length * 12);
                for (let k = 0; k < resource.models[i].meshBindings[j].bones.length; ++k)
                {
                    for (let n = 0; n < model.bones.length; ++n)
                    {
                        if (model.bones[n].boneRes.name === resource.models[i].meshBindings[j].bones[k].name)
                        {
                            if (!model.bones[n].bindingArrays)
                            {
                                model.bones[n].bindingArrays = [];
                            }

                            model.bones[n].bindingArrays[model.bones[n].bindingArrays.length] = {
                                'array': meshBindings[meshIx],
                                'offset': k * 12
                            };
                            //meshBindings[meshIx][k] = model.bones[n].offsetTransform;
                            break;
                        }
                    }
                }
            }
        }

        if (resource.meshes.length && resource.models.length)
        {
            animationController.ResetBoneTransforms();
        }

        animationController.loaded = true;
        if (animationController.animations.length)
        {
            if (animationController.pendingCommands.length)
            {
                for (let i = 0; i < animationController.pendingCommands.length; ++i)
                {
                    if (!animationController.pendingCommands[i].args)
                    {
                        animationController.pendingCommands[i].func.apply(animationController);
                    }
                    else
                    {
                        animationController.pendingCommands[i].func.apply(animationController, animationController.pendingCommands[i].args);
                    }
                }
            }
            animationController.pendingCommands = [];
            if (animationController.onPendingCleared) animationController.onPendingCleared(animationController);
        }
    }

    /**
     * Global and Scratch variables
     */
    static global = {
        vec3_0: vec3.create(),
        quat_0: quat.create(),
        mat3_0: mat3.create(),
        mat4_0: mat4.create()
    };

}


text:
from paste.fixture import *
from paste.request import *
from paste.wsgiwrappers import WSGIRequest

def simpleapp(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type','text/plain')]
    start_response(status, response_headers)
    request = WSGIRequest(environ)
    return [
        'Hello world!\n', 'The get is %s' % str(request.GET),
        ' and Val is %s\n' % request.GET.get('name'),
        'The languages are: %s\n' % request.languages,
        'The accepttypes is: %s\n' % request.match_accept(['text/html', 'application/xml'])]

def test_gets():
    app = TestApp(simpleapp)
    res = app.get('/')
    assert 'Hello' in res
    assert "get is MultiDict([])" in res

    res = app.get('/?name=george')
    res.mustcontain("get is MultiDict([('name', 'george')])")
    res.mustcontain("Val is george")

def test_language_parsing():
    app = TestApp(simpleapp)
    res = app.get('/')
    assert "The languages are: ['en-us']" in res

    res = app.get('/', headers={'Accept-Language':'da, en-gb;q=0.8, en;q=0.7'})
    assert "languages are: ['da', 'en-gb', 'en', 'en-us']" in res

    res = app.get('/', headers={'Accept-Language':'en-gb;q=0.8, da, en;q=0.7'})
    assert "languages are: ['da', 'en-gb', 'en', 'en-us']" in res

def test_mime_parsing():
    app = TestApp(simpleapp)
    res = app.get('/', headers={'Accept':'text/html'})
    assert "accepttypes is: ['text/html']" in res

    res = app.get('/', headers={'Accept':'application/xml'})
    assert "accepttypes is: ['application/xml']" in res

    res = app.get('/', headers={'Accept':'application/xml,*/*'})
    assert "accepttypes is: ['text/html', 'application/xml']" in res

def test_bad_cookie():
    env = {}
    env['HTTP_COOKIE'] = '070-it-:><?0'
    assert get_cookie_dict(env) == {}
    env['HTTP_COOKIE'] = 'foo=bar'
    assert get_cookie_dict(env) == {'foo': 'bar'}
    env['HTTP_COOKIE'] = '...'
    assert get_cookie_dict(env) == {}
    env['HTTP_COOKIE'] = '=foo'
    assert get_cookie_dict(env) == {}
    env['HTTP_COOKIE'] = '?='
    assert get_cookie_dict(env) == {}


text:
module Punchblock
  class Event
    module Asterisk
      module AMI
        class Event < Punchblock::Event
          register :event, :ami

          attribute :name
          attribute :headers, Hash, default: {}

          alias :attributes :headers

          def inherit(xml_node)
            xml_node.xpath('//ns:attribute', ns: self.class.registered_ns).to_a.each do |attribute|
              headers[attribute[:name]] = attribute[:value]
            end
            super
          end

          def rayo_attributes
            {'name' => name}
          end

          def rayo_children(root)
            super
            headers.each do |name, value|
              root.attribute name: name, value: value
            end
          end
        end
      end
    end
  end
end


text:
object Test extends dotty.runtime.LegacyApp {
  val str = s"a\nb"
  println(str.length)
  println(str)
}


text:
package main

import (
	"flag"
	"go/build"
	"internal/testenv"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"runtime"
	"strings"
	"testing"
)

func buildObjdump(t *testing.T) (tmp, exe string) {
	testenv.MustHaveGoBuild(t)

	tmp, err := ioutil.TempDir("", "TestObjDump")
	if err != nil {
		t.Fatal("TempDir failed: ", err)
	}

	exe = filepath.Join(tmp, "testobjdump.exe")
	out, err := exec.Command(testenv.GoToolPath(t), "build", "-o", exe, "cmd/objdump").CombinedOutput()
	if err != nil {
		os.RemoveAll(tmp)
		t.Fatalf("go build -o %v cmd/objdump: %v\n%s", exe, err, string(out))
	}
	return
}

var x86Need = []string{
	"fmthello.go:6",
	"TEXT main.main(SB)",
	"JMP main.main(SB)",
	"CALL fmt.Println(SB)",
	"RET",
}

var armNeed = []string{
	"fmthello.go:6",
	"TEXT main.main(SB)",
	//"B.LS main.main(SB)", // TODO(rsc): restore; golang.org/issue/9021
	"BL fmt.Println(SB)",
	"RET",
}

var ppcNeed = []string{
	"fmthello.go:6",
	"TEXT main.main(SB)",
	"BR main.main(SB)",
	"BL fmt.Println(SB)",
	"RET",
}

var target = flag.String("target", "", "test disassembly of `goos/goarch` binary")

// objdump is fully cross platform: it can handle binaries
// from any known operating system and architecture.
// We could in principle add binaries to testdata and check
// all the supported systems during this test. However, the
// binaries would be about 1 MB each, and we don't want to
// add that much junk to the hg repository. Instead, build a
// binary for the current system (only) and test that objdump
// can handle that one.

func testDisasm(t *testing.T, flags ...string) {
	tmp, exe := buildObjdump(t)
	defer os.RemoveAll(tmp)

	goarch := runtime.GOARCH
	if *target != "" {
		f := strings.Split(*target, "/")
		if len(f) != 2 {
			t.Fatalf("-target argument must be goos/goarch")
		}
		defer os.Setenv("GOOS", os.Getenv("GOOS"))
		defer os.Setenv("GOARCH", os.Getenv("GOARCH"))
		os.Setenv("GOOS", f[0])
		os.Setenv("GOARCH", f[1])
		goarch = f[1]
	}

	hello := filepath.Join(tmp, "hello.exe")
	args := []string{"build", "-o", hello}
	args = append(args, flags...)
	args = append(args, "testdata/fmthello.go")
	out, err := exec.Command(testenv.GoToolPath(t), args...).CombinedOutput()
	if err != nil {
		t.Fatalf("go build fmthello.go: %v\n%s", err, out)
	}
	need := []string{
		"fmthello.go:6",
		"TEXT main.main(SB)",
	}
	switch goarch {
	case "amd64", "386":
		need = append(need, x86Need...)
	case "arm":
		need = append(need, armNeed...)
	case "ppc64", "ppc64le":
		need = append(need, ppcNeed...)
	}

	out, err = exec.Command(exe, "-s", "main.main", hello).CombinedOutput()
	if err != nil {
		t.Fatalf("objdump fmthello.exe: %v\n%s", err, out)
	}

	text := string(out)
	ok := true
	for _, s := range need {
		if !strings.Contains(text, s) {
			t.Errorf("disassembly missing '%s'", s)
			ok = false
		}
	}
	if !ok {
		t.Logf("full disassembly:\n%s", text)
	}
}

func TestDisasm(t *testing.T) {
	switch runtime.GOARCH {
	case "arm64":
		t.Skipf("skipping on %s, issue 10106", runtime.GOARCH)
	case "mips64", "mips64le":
		t.Skipf("skipping on %s, issue 12559", runtime.GOARCH)
	case "s390x":
		t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
	}
	testDisasm(t)
}

func TestDisasmExtld(t *testing.T) {
	switch runtime.GOOS {
	case "plan9", "windows":
		t.Skipf("skipping on %s", runtime.GOOS)
	}
	switch runtime.GOARCH {
	case "ppc64", "ppc64le":
		t.Skipf("skipping on %s, no support for external linking, issue 9038", runtime.GOARCH)
	case "arm64":
		t.Skipf("skipping on %s, issue 10106", runtime.GOARCH)
	case "mips64", "mips64le":
		t.Skipf("skipping on %s, issue 12559 and 12560", runtime.GOARCH)
	case "s390x":
		t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
	}
	// TODO(jsing): Reenable once openbsd/arm has external linking support.
	if runtime.GOOS == "openbsd" && runtime.GOARCH == "arm" {
		t.Skip("skipping on openbsd/arm, no support for external linking, issue 10619")
	}
	if !build.Default.CgoEnabled {
		t.Skip("skipping because cgo is not enabled")
	}
	testDisasm(t, "-ldflags=-linkmode=external")
}


text:
/*
 * ComplexData.cpp
 *
 *  Created on: Sep 24, 2012
 *      Author: Mitchell Wills
 */

#include "networktables2/type/ComplexData.h"

ComplexData::ComplexData(ComplexEntryType& _type) : type(_type){}

ComplexEntryType& ComplexData::GetType() {
	return type;
}


text:
from ast import *

from trumpscript.parser import *
from trumpscript.tokenizer import *

class Compiler:
    def __init__(self):
        self.tk = Tokenizer()
        self.prs = Parser()

    def compile(self, source):
        modu = self.parse(self.tokenize(source))

        fix_missing_locations(modu)
        print("Compiled, starting execution\n-------------------\n")
        exec(compile(modu, filename="<ast>", mode="exec"))

    def parse(self, tokens):
        return self.prs.parse(tokens)

    def tokenize(self, filename):
        return self.tk.tokenize(filename)


text:
@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.

@setlocal EnableExtensions EnableDelayedExpansion
@echo off

set current-path=%~dp0

rem Remove trailing slash
set current-path=%current-path:~0,-1%

set build-root=%current-path%\..\build_nodejs

rem Resolve to fully qualified path
for %%i in ("%build-root%") do set build-root=%%~fi

rem Clear the nodejs build folder so we have a fresh build
rmdir /s/q %build-root%
mkdir %build-root%

pushd %build-root%

rem Clone Node.js
git clone -b shared-691 --depth 1 https://github.com/avranju/node.git
pushd node

rem Build Node.js
call vcbuild.bat release nosign dll %*
popd

rem Create a 'dist' folder where the includes/libs live
mkdir dist\inc\libplatform
copy node\src\env.h dist\inc
copy node\src\env-inl.h dist\inc
copy node\src\node.h dist\inc
copy node\src\node_version.h dist\inc
copy node\deps\uv\include\*.h dist\inc
copy node\deps\v8\include\*.h dist\inc
copy node\deps\v8\include\libplatform\*.h dist\inc\libplatform

mkdir dist\lib
copy node\Release\node.dll dist\lib
copy node\Release\node.lib dist\lib
copy node\Release\node.pdb dist\lib
copy node\Release\lib\*.lib dist\lib
copy node\build\Release\lib\*.lib dist\lib

popd

rem Export environment variables for where the include/lib files can be found
set "NODE_INCLUDE=%build-root%\dist\inc"
set "NODE_LIB=%build-root%\dist\lib"

goto :eof


text:
@interface ELIRDFResponseSerialiser () <AFURLResponseSerialization>

@property RedlandStorage *storage;

@end

@implementation ELIRDFResponseSerialiser

- (id)init
{
    self = [super init];
    self.storage = [RedlandStorage new];

    self.acceptableStatusCodes = [NSIndexSet indexSetWithIndex:[@200 unsignedIntegerValue]];
    self.acceptableContentTypes = [NSSet setWithObject:@"application/rdf+xml"];

    return self;
}

- (BOOL)validateResponse:(NSHTTPURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error
{
    NSLog(@"%@", [response.allHeaderFields objectForKey:@"Content-Type"]);

    return YES;
}

- (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error
{
    // instantiate and parse the model

    RedlandParser *parser = [RedlandParser parserWithName:RedlandRDFXMLParserName];
    RedlandURI *uri = [RedlandURI URIWithURL:response.URL];
    RedlandModel *model = [RedlandModel modelWithStorage:self.storage];

    // parse
    @try
    {
        NSLog(@"HERE!!");
        [parser parseData:data intoModel:model withBaseURI:uri];
        NSLog(@"HERE!!!!!");
        return model;
    }
    @catch (NSException *exception)
    {
        NSLog(@"%@", [NSString stringWithFormat:@"Failed to parse RDF: %@", [exception reason]]);
        return nil;
    }
}

@end


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

<title>PackageMetaInfo</title>
<meta name="date" content="2015-07-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.nutiteq.packagemanager

Class PackageMetaInfo

java.lang.Object

com.nutiteq.packagemanager.PackageMetaInfo

public class PackageMetaInfo
extends java.lang.Object

Package meta info element. Can contain JSON-style structured data, including objects and arrays.

Field Summary

Fields

Modifier and Type
Field and Description

protected boolean
swigCMemOwn

Constructor Summary

Constructors

Constructor and Description

PackageMetaInfo(long cPtr,
               boolean cMemoryOwn)

Method Summary

All Methods Static Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
delete()

boolean
equals(java.lang.Object obj)

Checks if this object is equal to the specified object.

protected void
finalize()

PackageMetaInfo
getArrayElement(int idx)

Returns the element of array at specified position.

int
getArraySize()

Returns the number of elements in the array.

boolean
getBool()

Returns the boolean value of this element.

static long
getCPtr(PackageMetaInfo obj)

double
getDouble()

Returns the floating point value of this element.

java.lang.String
getJsonValue()

Returns the underlying JSON value.

long
getLong()

Returns the integer value of this element.

PackageMetaInfo
getMapElement(java.lang.String key)

Returns the element of map with the specified key.

StringVector
getMapKeys()

Returns all the keys in the map.

java.lang.String
getString()

Returns the string value of this element.

PackageMetaInfoType
getType()

Returns the type of this meta info element.

int
hashCode()

Returns the hash value of this object.

Methods inherited from class java.lang.Object

clone, getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

swigCMemOwn

protected boolean swigCMemOwn

Constructor Detail

PackageMetaInfo

public PackageMetaInfo(long cPtr,
                       boolean cMemoryOwn)

Method Detail

getCPtr

public static long getCPtr(PackageMetaInfo obj)

finalize

protected void finalize()

Overrides:

finalize in class java.lang.Object

delete

public void delete()

equals

public boolean equals(java.lang.Object obj)

Checks if this object is equal to the specified object.

Overrides:

equals in class java.lang.Object

Returns:

True when objects are equal, false otherwise.

hashCode

public int hashCode()

Returns the hash value of this object.

Overrides:

hashCode in class java.lang.Object

Returns:

The hash value of this object.

getJsonValue

public java.lang.String getJsonValue()

Returns the underlying JSON value.

Returns:

The value of the element.

getType

public PackageMetaInfoType getType()

Returns the type of this meta info element.

Returns:

The type of this element.

getString

public java.lang.String getString()

Returns the string value of this element.

Returns:

The string value of the element. If the element is not string, empty string will be returned.

getBool

public boolean getBool()

Returns the boolean value of this element.

Returns:

The boolean value of the element. If the element is not boolean, false will be returned.

getLong

public long getLong()

Returns the integer value of this element.

Returns:

The integer value of the element. If the element is not integer, 0 will be returned.

getDouble

public double getDouble()

Returns the floating point value of this element.

Returns:

The floating point value of the element. If the element is integer, it will be converted to floating point. Otherwise 0.0 is be returned.

getArraySize

public int getArraySize()

Returns the number of elements in the array.

Returns:

The number of elements in the array if the element is of array type. Otherwise 0 is returned.

getArrayElement

public PackageMetaInfo getArrayElement(int idx)

Returns the element of array at specified position.

Parameters:

idx - The index of the array element to return (starting from 0).

Returns:

The array element at specified position or null if the element does not exist.

getMapKeys

public StringVector getMapKeys()

Returns all the keys in the map.

Returns:

The list containing all the keys of the map if the element is of map type. Otherwise empty list is returned.

getMapElement

public PackageMetaInfo getMapElement(java.lang.String key)

Returns the element of map with the specified key.

Parameters:

key - The key of the map element to return.

Returns:

The map element with the specified key or null if the element does not exist.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package com.rbmhtechnology.eventuate.adapter.vertx.japi;

public interface ConfirmationType {

  ConfirmationType Single = new SingleConfirmation();

  class Batch {
    public static ConfirmationType withSize(int size) {
      return new BatchConfirmation(size);
    }
  }
}


text: <router-outlet *ngIf="loggedIn"></router-outlet>


text:
Clazz.declarePackage ("J.shape");
Clazz.load (["J.shape.FontLineShape", "JU.P3", "$.V3"], "J.shape.Axes", ["java.lang.Boolean", "JU.PT", "$.SB", "J.c.AXES", "JU.Escape", "JV.JC"], function () {
c$ = Clazz.decorateAsClass (function () {
this.axisXY = null;
this.scale = 0;
this.fixedOrigin = null;
this.originPoint = null;
this.axisPoints = null;
this.labels = null;
this.ptTemp = null;
this.corner = null;
Clazz.instantialize (this, arguments);
}, J.shape, "Axes", J.shape.FontLineShape);
Clazz.prepareFields (c$, function () {
this.axisXY =  new JU.P3 ();
this.originPoint =  new JU.P3 ();
this.axisPoints =  new Array (6);
{
for (var i = 6; --i >= 0; ) this.axisPoints[i] =  new JU.P3 ();

}this.ptTemp =  new JU.P3 ();
this.corner =  new JU.V3 ();
});
Clazz.defineMethod (c$, "getOriginPoint",
function (isDataFrame) {
return (isDataFrame ? J.shape.Axes.pt0 : this.originPoint);
}, "~B");
Clazz.defineMethod (c$, "getAxisPoint",
function (i, isDataFrame) {
if (!isDataFrame && this.axisXY.z == 0) return this.axisPoints[i];
this.ptTemp.sub2 (this.axisPoints[i], this.originPoint);
this.ptTemp.scale (0.5);
return this.ptTemp;
}, "~N,~B");
Clazz.overrideMethod (c$, "setProperty",
function (propertyName, value, bs) {
if ("position" === propertyName) {
this.axisXY = value;
return;
}if ("origin" === propertyName) {
if (value == null) {
this.fixedOrigin = null;
} else {
if (this.fixedOrigin == null) this.fixedOrigin =  new JU.P3 ();
this.fixedOrigin.setT (value);
}this.initShape ();
return;
}if ("labels" === propertyName) {
this.labels = value;
return;
}if ("labelsOn" === propertyName) {
this.labels = null;
return;
}if ("labelsOff" === propertyName) {
this.labels = ["", "", ""];
return;
}this.setPropFLS (propertyName, value);
}, "~S,~O,JU.BS");
Clazz.defineMethod (c$, "initShape",
function () {
Clazz.superCall (this, J.shape.Axes, "initShape", []);
this.myType = "axes";
this.font3d = this.gdata.getFont3D (14);
var axesMode = this.vwr.g.axesMode;
if (this.fixedOrigin == null) this.originPoint.set (0, 0, 0);
 else this.originPoint.setT (this.fixedOrigin);
if (axesMode === J.c.AXES.UNITCELL && this.ms.unitCells != null) {
var unitcell = this.vwr.getCurrentUnitCell ();
if (unitcell != null) {
var vertices = unitcell.getUnitCellVertices ();
var offset = unitcell.getCartesianOffset ();
if (this.fixedOrigin == null) {
this.originPoint.add2 (offset, vertices[0]);
} else {
offset = this.fixedOrigin;
}this.scale = this.vwr.getFloat (570425346) / 2;
this.axisPoints[0].scaleAdd2 (this.scale, vertices[4], offset);
this.axisPoints[1].scaleAdd2 (this.scale, vertices[2], offset);
this.axisPoints[2].scaleAdd2 (this.scale, vertices[1], offset);
return;
}} else if (axesMode === J.c.AXES.BOUNDBOX) {
if (this.fixedOrigin == null) this.originPoint.setT (this.vwr.getBoundBoxCenter ());
}this.setScale (this.vwr.getFloat (570425346) / 2);
});
Clazz.overrideMethod (c$, "getProperty",
function (property, index) {
if (property === "axisPoints") return this.axisPoints;
if (property === "origin") return this.fixedOrigin;
if (property === "axesTypeXY") return (this.axisXY.z == 0 ? Boolean.FALSE : Boolean.TRUE);
return null;
}, "~S,~N");
Clazz.defineMethod (c$, "setScale",
function (scale) {
this.scale = scale;
this.corner.setT (this.vwr.getBoundBoxCornerVector ());
for (var i = 6; --i >= 0; ) {
var axisPoint = this.axisPoints[i];
axisPoint.setT (JV.JC.unitAxisVectors[i]);
if (this.corner.x < 1.5) this.corner.x = 1.5;
if (this.corner.y < 1.5) this.corner.y = 1.5;
if (this.corner.z < 1.5) this.corner.z = 1.5;
if (this.axisXY.z == 0) {
axisPoint.x *= this.corner.x * scale;
axisPoint.y *= this.corner.y * scale;
axisPoint.z *= this.corner.z * scale;
}axisPoint.add (this.originPoint);
}
}, "~N");
Clazz.defineMethod (c$, "getShapeState",
function () {
var sb =  new JU.SB ();
sb.append ("  axes scale ").appendF (this.vwr.getFloat (570425346)).append (";\n");
if (this.fixedOrigin != null) sb.append ("  axes center ").append (JU.Escape.eP (this.fixedOrigin)).append (";\n");
if (this.axisXY.z != 0) sb.append ("  axes position [").appendI (Clazz.floatToInt (this.axisXY.x)).append (" ").appendI (Clazz.floatToInt (this.axisXY.y)).append (" ").append (this.axisXY.z < 0 ? " %" : "").append ("];\n");
if (this.labels != null) {
sb.append ("  axes labels ");
for (var i = 0; i < this.labels.length; i++) if (this.labels[i] != null) sb.append (JU.PT.esc (this.labels[i])).append (" ");

sb.append (";\n");
}return Clazz.superCall (this, J.shape.Axes, "getShapeState", []) + sb;
});
c$.pt0 = c$.prototype.pt0 =  new JU.P3 ();
Clazz.defineStatics (c$,
"MIN_AXIS_LEN", 1.5);
});


text:
namespace OgreTools
{
    bool LinesIntersect2D( Ogre::Vector2 firstStart, Ogre::Vector2 firstEnd,
                              Ogre::Vector2 secondStart, Ogre::Vector2 secondEnd );

    void GetMeshInformation(const Ogre::MeshPtr mesh,
            size_t &vertex_count,
            Ogre::Vector3* &vertices,
            size_t &index_count,
            unsigned long* &indices,
            const Ogre::Vector3 &position,
            const Ogre::Quaternion &orient,
            const Ogre::Vector3 &scale);
}

#endif // __OGRETOOLS_H


text:
using Bridge;
using Bridge.GLMatrix;
using Bridge.Html5;
using Bridge.WebGL;
using System;
using System.Collections.Generic;
using FlatRedBall;
using Microsoft.Xna.Framework.Graphics;

namespace FlatRedBall
{
    public class Renderer
    {
        public List<Sprite> Sprites = new List<Sprite>();
        public HTMLCanvasElement canvas;
        public static WebGLRenderingContext WebGlRenderingContext;
        public WebGLProgram program;

        public bool useBlending = true;
        public double alpha = 1;
        public bool useLighting = true;
        public double ambientR = 0.4;
        public double ambientG = 0.4;
        public double ambientB = 0.4;
        public double lightDirectionX = 0;
        public double lightDirectionY = 0;
        public double lightDirectionZ = -1;
        public double directionalR = 0.25;
        public double directionalG = 0.25;
        public double directionalB = 0.25;

        public double[] mvMatrix = Mat4.Create();
        public double[][] mvMatrixStack = new double[][] { };
        public double[] pMatrix = Mat4.Create();

        public int vertexPositionAttribute;
        public int vertexNormalAttribute;
        public int textureCoordAttribute;

        public WebGLUniformLocation pMatrixUniform;
        public WebGLUniformLocation mvMatrixUniform;
        public WebGLUniformLocation nMatrixUniform;
        public WebGLUniformLocation samplerUniform;
        public WebGLUniformLocation useLightingUniform;
        public WebGLUniformLocation ambientColorUniform;
        public WebGLUniformLocation lightingDirectionUniform;
        public WebGLUniformLocation directionalColorUniform;
        public WebGLUniformLocation alphaUniform;

        public WebGLBuffer cubeVertexPositionBuffer;
        public WebGLBuffer cubeVertexNormalBuffer;
        public WebGLBuffer cubeVertexTextureCoordBuffer;
        public WebGLBuffer cubeVertexIndexBuffer;

        public double xRotation = 0;
        public int xSpeed = 0;

        public double yRotation = 0;
        public int ySpeed = 4;

        public Dictionary<int, bool> currentlyPressedKeys = new Dictionary<int, bool>();

        public double lastTime = 0;

        public WebGLShader GetShader(WebGLRenderingContext gl, string id)
        {
            var shaderScript = Document.GetElementById(id).As<HTMLScriptElement>();

            if (shaderScript == null)
            {
                return null;
            }

            var str = "";
            var k = shaderScript.FirstChild;

            while (k != null)
            {
                if (k.NodeType == NodeType.Text)
                {
                    str += k.TextContent;
                }

                k = k.NextSibling;
            }

            WebGLShader shader;

            if (shaderScript.Type == "x-shader/x-fragment")
            {
                shader = gl.CreateShader(gl.FRAGMENT_SHADER);
            }
            else if (shaderScript.Type == "x-shader/x-vertex")
            {
                shader = gl.CreateShader(gl.VERTEX_SHADER);
            }
            else
            {
                return null;
            }

            gl.ShaderSource(shader, str);
            gl.CompileShader(shader);

            if (!gl.GetShaderParameter(shader, gl.COMPILE_STATUS).As<bool>())
            {
                Global.Alert(gl.GetShaderInfoLog(shader));
                return null;
            }

            return shader;
        }

        public void Initialize(string canvasId)
        {
            InitSettings(this);

            this.canvas = GetCanvasEl(canvasId);
            WebGlRenderingContext = Create3DContext(this.canvas);

            InitShaders();
            InitBuffers();

            //cube.Tick();
            InitSettings(this);
        }

        public static HTMLCanvasElement GetCanvasEl(string id)
        {
            return Document.GetElementById(id).As<HTMLCanvasElement>();
        }

        public void InitShaders()
        {
            var fragmentShader = this.GetShader(WebGlRenderingContext, "shader-fs");
            var vertexShader = this.GetShader(WebGlRenderingContext, "shader-vs");
            var shaderProgram = WebGlRenderingContext.CreateProgram().As<WebGLProgram>();

            if (shaderProgram.Is<int>())
            {
                Global.Alert("Could not initialise program");
            }

            WebGlRenderingContext.AttachShader(shaderProgram, vertexShader);
            WebGlRenderingContext.AttachShader(shaderProgram, fragmentShader);
            WebGlRenderingContext.LinkProgram(shaderProgram);

            if (!WebGlRenderingContext.GetProgramParameter(shaderProgram, WebGlRenderingContext.LINK_STATUS).As<bool>())
            {
                Global.Alert("Could not initialise shaders");
            }

            WebGlRenderingContext.UseProgram(shaderProgram);

            this.vertexPositionAttribute = WebGlRenderingContext.GetAttribLocation(shaderProgram, "aVertexPosition");
            this.vertexNormalAttribute = WebGlRenderingContext.GetAttribLocation(shaderProgram, "aVertexNormal");
            this.textureCoordAttribute = WebGlRenderingContext.GetAttribLocation(shaderProgram, "aTextureCoord");

            WebGlRenderingContext.EnableVertexAttribArray(this.vertexPositionAttribute);
            WebGlRenderingContext.EnableVertexAttribArray(this.vertexNormalAttribute);
            WebGlRenderingContext.EnableVertexAttribArray(this.textureCoordAttribute);

            this.pMatrixUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uPMatrix");
            this.mvMatrixUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uMVMatrix");
            this.nMatrixUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uNMatrix");
            this.samplerUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uSampler");
            this.useLightingUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uUseLighting");
            this.ambientColorUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uAmbientColor");
            this.lightingDirectionUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uLightingDirection");
            this.directionalColorUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uDirectionalColor");
            this.alphaUniform = WebGlRenderingContext.GetUniformLocation(shaderProgram, "uAlpha");

            this.program = shaderProgram;
        }

        public void SetMatrixUniforms()
        {
            WebGlRenderingContext.UniformMatrix4fv(this.pMatrixUniform, false, pMatrix);
            WebGlRenderingContext.UniformMatrix4fv(this.mvMatrixUniform, false, mvMatrix);

            var normalMatrix = Mat3.Create();

            Mat4.ToInverseMat3(mvMatrix, normalMatrix);
            Mat3.Transpose(normalMatrix);

            WebGlRenderingContext.UniformMatrix3fv(this.nMatrixUniform, false, normalMatrix);
        }

        public double DegToRad(double degrees)
        {
            return degrees * Math.PI / 180;
        }

        public void HandleKeyDown(Event e)
        {
            this.currentlyPressedKeys[e.As<KeyboardEvent>().KeyCode] = true;
        }

        public void HandleKeyUp(Event e)
        {
            this.currentlyPressedKeys[e.As<KeyboardEvent>().KeyCode] = false;
        }

        public void HandleKeys()
        {
            if (CheckPressedKey(KeyboardEvent.DOM_VK_A))
            {
                ySpeed -= 1;
            }

            if (CheckPressedKey(KeyboardEvent.DOM_VK_D))
            {
                ySpeed += 1;
            }

            if (CheckPressedKey(KeyboardEvent.DOM_VK_W))
            {
                xSpeed -= 1;
            }

            if (CheckPressedKey(KeyboardEvent.DOM_VK_S))
            {
                xSpeed += 1;
            }
        }

        private bool CheckPressedKey(int key)
        {
            bool b = false;

            currentlyPressedKeys.TryGetValue(key, out b);

            return b;
        }

        public void InitBuffers()
        {
            this.cubeVertexPositionBuffer = WebGlRenderingContext.CreateBuffer();
            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, cubeVertexPositionBuffer);

            var vertices = new double[] {
                // Front face
                -1.0, -1.0,  1.0,
                 1.0, -1.0,  1.0,
                 1.0,  1.0,  1.0,
                -1.0,  1.0,  1.0,

                // Back face
                -1.0, -1.0, -1.0,
                -1.0,  1.0, -1.0,
                 1.0,  1.0, -1.0,
                 1.0, -1.0, -1.0,

                // Top face
                -1.0,  1.0, -1.0,
                -1.0,  1.0,  1.0,
                 1.0,  1.0,  1.0,
                 1.0,  1.0, -1.0,

                // Bottom face
                -1.0, -1.0, -1.0,
                 1.0, -1.0, -1.0,
                 1.0, -1.0,  1.0,
                -1.0, -1.0,  1.0,

                // Right face
                 1.0, -1.0, -1.0,
                 1.0,  1.0, -1.0,
                 1.0,  1.0,  1.0,
                 1.0, -1.0,  1.0,

                // Left face
                -1.0, -1.0, -1.0,
                -1.0, -1.0,  1.0,
                -1.0,  1.0,  1.0,
                -1.0,  1.0, -1.0,
            };

            WebGlRenderingContext.BufferData(WebGlRenderingContext.ARRAY_BUFFER, new Float32Array(vertices), WebGlRenderingContext.STATIC_DRAW);

            this.cubeVertexNormalBuffer = WebGlRenderingContext.CreateBuffer();
            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, cubeVertexNormalBuffer);

            var vertexNormals = new double[] {
                // Front face
                 0.0,  0.0,  1.0,
                 0.0,  0.0,  1.0,
                 0.0,  0.0,  1.0,
                 0.0,  0.0,  1.0,

                // Back face
                 0.0,  0.0, -1.0,
                 0.0,  0.0, -1.0,
                 0.0,  0.0, -1.0,
                 0.0,  0.0, -1.0,

                // Top face
                 0.0,  1.0,  0.0,
                 0.0,  1.0,  0.0,
                 0.0,  1.0,  0.0,
                 0.0,  1.0,  0.0,

                // Bottom face
                 0.0, -1.0,  0.0,
                 0.0, -1.0,  0.0,
                 0.0, -1.0,  0.0,
                 0.0, -1.0,  0.0,

                // Right face
                 1.0,  0.0,  0.0,
                 1.0,  0.0,  0.0,
                 1.0,  0.0,  0.0,
                 1.0,  0.0,  0.0,

                // Left face
                -1.0,  0.0,  0.0,
                -1.0,  0.0,  0.0,
                -1.0,  0.0,  0.0,
                -1.0,  0.0,  0.0
            };

            WebGlRenderingContext.BufferData(WebGlRenderingContext.ARRAY_BUFFER, new Float32Array(vertexNormals), WebGlRenderingContext.STATIC_DRAW);

            this.cubeVertexTextureCoordBuffer = WebGlRenderingContext.CreateBuffer();
            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, cubeVertexTextureCoordBuffer);

            var textureCoords = new double[] {
                // Front face
                0.0, 0.0,
                1.0, 0.0,
                1.0, 1.0,
                0.0, 1.0,

                // Back face
                1.0, 0.0,
                1.0, 1.0,
                0.0, 1.0,
                0.0, 0.0,

                // Top face
                0.0, 1.0,
                0.0, 0.0,
                1.0, 0.0,
                1.0, 1.0,

                // Bottom face
                1.0, 1.0,
                0.0, 1.0,
                0.0, 0.0,
                1.0, 0.0,

                // Right face
                1.0, 0.0,
                1.0, 1.0,
                0.0, 1.0,
                0.0, 0.0,

                // Left face
                0.0, 0.0,
                1.0, 0.0,
                1.0, 1.0,
                0.0, 1.0
            };

            WebGlRenderingContext.BufferData(WebGlRenderingContext.ARRAY_BUFFER, new Float32Array(textureCoords), WebGlRenderingContext.STATIC_DRAW);

            this.cubeVertexIndexBuffer = WebGlRenderingContext.CreateBuffer();
            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);

            var cubeVertexIndices = new int[] {
                 0,  1,  2,    0,  2,  3,  // Front face
                 4,  5,  6,    4,  6,  7,  // Back face
                 8,  9, 10,    8, 10, 11,  // Top face
                12, 13, 14,   12, 14, 15,  // Bottom face
                16, 17, 18,   16, 18, 19,  // Right face
                20, 21, 22,   20, 22, 23   // Left face
            };

            WebGlRenderingContext.BufferData(WebGlRenderingContext.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeVertexIndices), WebGlRenderingContext.STATIC_DRAW);
        }

        void DrawInternal()
        {
            WebGlRenderingContext.Viewport(0, 0, canvas.Width, canvas.Height);
            WebGlRenderingContext.Clear(WebGlRenderingContext.COLOR_BUFFER_BIT |
                WebGlRenderingContext.DEPTH_BUFFER_BIT);
            foreach(var sprite in Sprites)
            {
                DrawSprite(sprite);

            }
        }

        private void Scale(double[] matrix, float x, float y)
        {
            matrix[0] *= x;
            matrix[4] *= x;
            matrix[8] *= x;
            matrix[12] *= x;

            matrix[1] *= y;
            matrix[5] *= y;
            matrix[9] *= y;
            matrix[13] *= y;
        }

        private void DrawSprite(Sprite sprite)
        {

            Mat4.Perspective(45, (double)canvas.Width / canvas.Height, 0.1, 1000, pMatrix);
            Mat4.Identity(mvMatrix);
            Scale(mvMatrix, sprite.Width, sprite.Height);
            Mat4.Translate(mvMatrix, new double[] { sprite.X / sprite.Width, sprite.Y / sprite.Height, -12 });
            //Mat4.Rotate(mvMatrix, this.DegToRad(xRotation), new double[] { 1, 0, 0 });
            //Mat4.Rotate(mvMatrix, this.DegToRad(yRotation), new double[] { 0, 1, 0 });

            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, this.cubeVertexPositionBuffer);
            WebGlRenderingContext.VertexAttribPointer(this.vertexPositionAttribute, 3, WebGlRenderingContext.FLOAT, false, 0, 0);

            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, this.cubeVertexNormalBuffer);
            WebGlRenderingContext.VertexAttribPointer(this.vertexNormalAttribute, 3, WebGlRenderingContext.FLOAT, false, 0, 0);

            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ARRAY_BUFFER, this.cubeVertexTextureCoordBuffer);
            WebGlRenderingContext.VertexAttribPointer(this.textureCoordAttribute, 2, WebGlRenderingContext.FLOAT, false, 0, 0);

            WebGlRenderingContext.ActiveTexture(WebGlRenderingContext.TEXTURE0);
            WebGlRenderingContext.BindTexture(WebGlRenderingContext.TEXTURE_2D, sprite.Texture.WebGLTexture);

            WebGlRenderingContext.Uniform1i(this.samplerUniform, 0);

            // Add Blending
            if (this.useBlending)
            {
                WebGlRenderingContext.BlendFunc(WebGlRenderingContext.SRC_ALPHA, WebGlRenderingContext.ONE);
                WebGlRenderingContext.Enable(WebGlRenderingContext.BLEND);
                WebGlRenderingContext.Disable(WebGlRenderingContext.DEPTH_TEST);
                WebGlRenderingContext.Uniform1f(this.alphaUniform, this.alpha);
            }
            else
            {
                WebGlRenderingContext.Disable(WebGlRenderingContext.BLEND);
                WebGlRenderingContext.Enable(WebGlRenderingContext.DEPTH_TEST);
                WebGlRenderingContext.Uniform1f(this.alphaUniform, 1);
            }

            // Add Lighting
            WebGlRenderingContext.Uniform1i(this.useLightingUniform, this.useLighting);

            if (this.useLighting)
            {
                WebGlRenderingContext.Uniform3f(this.ambientColorUniform, this.ambientR, this.ambientG, this.ambientB);

                var lightingDirection = new double[] { this.lightDirectionX, this.lightDirectionY, this.lightDirectionZ };
                var adjustedLD = Vec3.Create();

                Vec3.Normalize(lightingDirection, adjustedLD);
                Vec3.Scale(adjustedLD, -1);

                WebGlRenderingContext.Uniform3fv(this.lightingDirectionUniform, adjustedLD);
                WebGlRenderingContext.Uniform3f(this.directionalColorUniform, this.directionalR, this.directionalG, this.directionalB);
            }

            WebGlRenderingContext.BindBuffer(WebGlRenderingContext.ELEMENT_ARRAY_BUFFER, this.cubeVertexIndexBuffer);

            this.SetMatrixUniforms();

            WebGlRenderingContext.DrawElements(WebGlRenderingContext.TRIANGLES, 6, WebGlRenderingContext.UNSIGNED_SHORT, 0);
        }

        public void Animate()
        {
            var timeNow = new Date().GetTime();

            if (this.lastTime != 0)
            {
                var elapsed = timeNow - this.lastTime;

                this.xRotation += (this.xSpeed * elapsed) / 1000.0;
                this.yRotation += (this.ySpeed * elapsed) / 1000.0;
            }

            this.lastTime = timeNow;
        }

        public void Draw()
        {
            this.HandleKeys();
            this.DrawInternal();
            this.Animate();

        }

        public void Tick()
        {
            Global.SetTimeout(this.Tick, 20);
        }

        void InitSettings(Renderer cube)
        {
            var useSettings = Document.GetElementById("settings").As<HTMLInputElement>();

            if (useSettings == null || !useSettings.Checked)
            {
                return;
            }

            cube.useBlending = Document.GetElementById("blending").As<HTMLInputElement>().Checked;
            cube.alpha = Global.ParseFloat(Document.GetElementById("alpha").As<HTMLInputElement>().Value);

            cube.useLighting = Document.GetElementById("lighting").As<HTMLInputElement>().Checked;

            cube.ambientR = Global.ParseFloat(Document.GetElementById("ambientR").As<HTMLInputElement>().Value);
            cube.ambientG = Global.ParseFloat(Document.GetElementById("ambientG").As<HTMLInputElement>().Value);
            cube.ambientB = Global.ParseFloat(Document.GetElementById("ambientB").As<HTMLInputElement>().Value);

            cube.lightDirectionX = Global.ParseFloat(Document.GetElementById("lightDirectionX").As<HTMLInputElement>().Value);
            cube.lightDirectionY = Global.ParseFloat(Document.GetElementById("lightDirectionY").As<HTMLInputElement>().Value);
            cube.lightDirectionZ = Global.ParseFloat(Document.GetElementById("lightDirectionZ").As<HTMLInputElement>().Value);

            cube.directionalR = Global.ParseFloat(Document.GetElementById("directionalR").As<HTMLInputElement>().Value);
            cube.directionalG = Global.ParseFloat(Document.GetElementById("directionalG").As<HTMLInputElement>().Value);
            cube.directionalB = Global.ParseFloat(Document.GetElementById("directionalB").As<HTMLInputElement>().Value);

        }

        public static WebGLRenderingContext Create3DContext(HTMLCanvasElement canvas)
        {
            string[] names = new string[]
            {
                "webgl",
                "experimental-webgl",
                "webkit-3d",
                "moz-webgl"
            };

            WebGLRenderingContext context = null;

            foreach (string name in names)
            {
                try
                {
                    context = canvas.GetContext(name).As<WebGLRenderingContext>();
                }
                catch { }

                if (context != null)
                {
                    break;
                }
            }

            return context;
        }
    }
}


text:
namespace OpenInVivaldi
{
    using System;

    /// <summary>
    /// Helper class that exposes all GUIDs used across VS Package.
    /// </summary>
    internal sealed partial class PackageGuids
    {
        public const string guidOpenInAppPackageString = "f590e788-c843-4b26-b9c5-e77dbead1249";
        public const string guidOpenInVsCmdSetString = "4c775dec-71be-42b3-9837-058001d5fe5e";
        public const string guidImagesString = "f45b8baf-2f4f-4546-817f-60c7c2abc432";
        public static Guid guidOpenInAppPackage = new Guid(guidOpenInAppPackageString);
        public static Guid guidOpenInVsCmdSet = new Guid(guidOpenInVsCmdSetString);
        public static Guid guidImages = new Guid(guidImagesString);
    }
    /// <summary>
    /// Helper class that encapsulates all CommandIDs uses across VS Package.
    /// </summary>
    internal sealed partial class PackageIds
    {
        public const int GroupOpenInAppCodeWin = 0x1030;
        public const int CmdIdOpenInAppCodeWin = 0x0100;
        public const int GroupOpenInAppItemNode = 0x1040;
        public const int CmdIdOpenInAppItemNode = 0x0110;
        public const int bmpPic1 = 0x0001;
    }
}


text:
fn give_commoner(gift: Option<&str>) {
    // Specify a specific course of action for each case.
    match gift {
        Some("snake") => println!("Yuck! Throws the snake in the fire."),
        Some(inner)   => println!("{}! How nice.", inner),
        None          => println!("No gift? Oh well."),
    }
}

// A princess is allowed to bring down the task at will so `panic` is an option.
fn give_princess(gift: Option<&str>) {
    // Using `unwrap` defers the case analysis to the std library which will
    // `panic` when it receives a `None`.
    let inside = gift.unwrap();
    if inside == "snake" { panic!("AAAaaaaa!!!!"); }

    println!("I love {}s!!!!!", inside);
}

fn main() {
    let food  = Some("chicken");
    let snake = Some("snake");
    let void  = None;

    give_commoner(food);
    give_commoner(snake);
    give_commoner(void);

    let bird = Some("robin");
    let nothing = None;

    give_princess(bird);
    give_princess(nothing);
}