text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.oauthclienttest;

import org.scribe.builder.ServiceBuilder;
import org.scribe.builder.api.*;
import org.scribe.model.SignatureType;
import org.scribe.model.Token;
import org.scribe.model.Verifier;
import org.scribe.oauth.OAuthService;
import static spark.Spark.*;
import spark.SparkBase;

/**
 *
 * @author Roberto
 */
public class App {

    private static final Token EMPTY_TOKEN = null;

    public static void main(String[] args) {

        SparkBase.setSecure("C:\\Users\\Roberto\\Documents\\NetBeansProjects\\OauthClientTest\\keystore.jks", "password", null, null);

        OAuthService service = new ServiceBuilder()
                           .provider(VSOnlineApi.class)
                           .apiKey("4B287A91-61CB-4AA4-A20A-7D3257E72195")
                           .apiSecret("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im9PdmN6NU1fN3AtSGpJS2xGWHo5M3VfVjBabyJ9.eyJjaWQiOiI0YjI4N2E5MS02MWNiLTRhYTQtYTIwYS03ZDMyNTdlNzIxOTUiLCJjc2kiOiJkMDJjZTdjMi01NTY4LTQwMTEtYWI3MS04YTFjNzAxOTg3ODIiLCJuYW1laWQiOiIzMzljYmQxYi1iNmRkLTQzOGUtODE1OC0xODIzMjM4NTU3N2EiLCJpc3MiOiJhcHAudnNzcHMudmlzdWFsc3R1ZGlvLmNvbSIsImF1ZCI6ImFwcC52c3Nwcy52aXN1YWxzdHVkaW8uY29tIiwibmJmIjoxNDIyOTg4ODYxLCJleHAiOjE0NTQ1MjQ4NjF9.3yByavT6QAXcgw2l4QjxGbuXwgcK7qaZS-dOBIpnlUQ7oAOaW9guHGoGacTp1Rob_E3B4LC4XsCdwqibswtiHclw4xtBoYBOBWlIvtGtr4XbdA7BtsFXH-JUdNYhyX3jeUMQ6fupE2FgeAQzLr92e7rLZ6APTYZWYhEEp1LQQxwGcG_CFyQxPHBBvqDaKSz10JcGjHn26QTjAiGDc3iZF4DssDxo6q8kMfZjDFuovM54e5lSJpN1-bLm-kxcp67lNd9P79_eccTrEnMLhjWrgppk9zBMCXkHIcHfIWmA7hotfotIhGTZXaYQtji93YqG3C3ZHrRB850EJyFBDVPI7Q")
                           .callback("https://rlbisbe.dev:4567/callback")
                           .signatureType(SignatureType.QueryString)
                           .debugStream(System.out)
                           .debug()
                           .build();

        get("/index", (req, res) -> "Hello World");

        get("/auth", (req, res) -> {
            res.redirect(service.getAuthorizationUrl(EMPTY_TOKEN));
            return null;
        });

         get("/callback", (req, res) -> {

             String code = req.queryParams("code");
             Verifier verifier = new Verifier(code);
            Token token = service.getAccessToken(EMPTY_TOKEN, verifier);
                return token;
        });
    }
}


text:
; Copyright (c) 2015-2019, Satoshi Tanda. All rights reserved.
; Use of this source code is governed by a MIT-style license that can be
; found in the LICENSE file.

;
; This module implements all assembler code
;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; References to C functions
;
EXTERN VmmVmExitHandler : PROC
EXTERN VmmVmxFailureHandler : PROC
EXTERN UtilDumpGpRegisters : PROC

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; constants
;
.CONST

VMX_OK                      EQU     0
VMX_ERROR_WITH_STATUS       EQU     1
VMX_ERROR_WITHOUT_STATUS    EQU     2
KTRAP_FRAME_SIZE            EQU     190h
MACHINE_FRAME_SIZE          EQU     28h

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; macros
;

; Saves all general purpose registers to the stack
PUSHAQ MACRO
    push    rax
    push    rcx
    push    rdx
    push    rbx
    push    -1      ; dummy for rsp
    push    rbp
    push    rsi
    push    rdi
    push    r8
    push    r9
    push    r10
    push    r11
    push    r12
    push    r13
    push    r14
    push    r15
ENDM

; Loads all general purpose registers from the stack
POPAQ MACRO
    pop     r15
    pop     r14
    pop     r13
    pop     r12
    pop     r11
    pop     r10
    pop     r9
    pop     r8
    pop     rdi
    pop     rsi
    pop     rbp
    add     rsp, 8    ; dummy for rsp
    pop     rbx
    pop     rdx
    pop     rcx
    pop     rax
ENDM

; Dumps all general purpose registers and a flag register.
ASM_DUMP_REGISTERS MACRO
    pushfq
    PUSHAQ                      ; -8 * 16
    mov rcx, rsp                ; all_regs
    mov rdx, rsp
    add rdx, 8*17               ; stack_pointer

    sub rsp, 28h                ; 28h for alignment
    call UtilDumpGpRegisters    ; UtilDumpGpRegisters(all_regs, stack_pointer);
    add rsp, 28h

    POPAQ
    popfq
ENDM

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; implementations
;
.CODE

; bool __stdcall AsmInitializeVm(
;     _In_ void (*vm_initialization_routine)(_In_ ULONG_PTR, _In_ ULONG_PTR,
;                                            _In_opt_ void *),
;     _In_opt_ void *context);
AsmInitializeVm PROC
    ; RSP is not 16 bit aligned when it gets called, but the following odd
    ; number (17 times) of push makes RSP 16 bit aligned.
    pushfq
    PUSHAQ              ; -8 * 16

    mov rax, rcx
    mov r8, rdx
    mov rdx, asmResumeVm
    mov rcx, rsp

    sub rsp, 20h
    call rax            ; vm_initialization_routine(rsp, asmResumeVm, context)
    add rsp, 20h

    POPAQ
    popfq
    xor rax, rax        ; return false
    ret

    ; This is where the virtualized guest start to execute after successful
    ; vmlaunch.
asmResumeVm:
    nop                 ; keep this nop for ease of debugging
    POPAQ
    popfq

    sub rsp, 8          ; align RSP
    ASM_DUMP_REGISTERS
    add rsp, 8          ; restore RSP

    xor rax, rax
    inc rax             ; return true
    ret
AsmInitializeVm ENDP

; void __stdcall AsmVmmEntryPoint();
AsmVmmEntryPoint PROC FRAME
    ; In oder for Windbg to display the stack trace of the guest while the
    ; VM-exit handlers are being executed, we use several tricks:
    ;   - The use of the FRAME (above) attribute. This emits a function table
    ;     entry for this function in the .pdata section. See also:
    ;     https://docs.microsoft.com/en-us/cpp/assembler/masm/proc?view=vs-2017
    ;
    ;   - The use of the .PUSHFRAME pseudo operation: This emits unwind data
    ;     indicating that a machine frame has been pushed on the stack. A machine
    ;     frame is usually pushed by the CPU in response to a trap or fault (
    ;     see: Exception- or Interrupt-Handler Procedures), hence this pseudo
    ;     operation is often used for their handler code. (In Windows kernel, the
    ;     use of this pseudo operation is often wrapped in the GENERATE_TRAP_FRAME
    ;     macro.) In our case, since VM-exit does not push the machine frame, we
    ;     manually allocate it in right above the VMM stack pointer. Nothing has
    ;     to be done in this function with regard to pushing the machine frame
    ;     since that and the VMM stack pointer are both already set up in
    ;     VmpInitializeVm. See the diagram in VmpInitializeVm for more details.
    ;     See also:
    ;     https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-pushframe?view=vs-2017
    ;
    ;   - The use of the .ALLOCSTACK pseudo operation: This also emits another
    ;     unwind data indicating how much the function uses stack. (This pseudo
    ;     code is often wrapped by the alloc_stack macro and used within the
    ;     GENERATE_TRAP_FRAME macro). This function consumes 108h of stack on
    ;     the top of the KTRAP_FRAME size (minus the machine frame size which is
    ;     already allocated outside this function). See also:
    ;     https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-allocstack?view=vs-2017
    .PUSHFRAME
    sub rsp, KTRAP_FRAME_SIZE - MACHINE_FRAME_SIZE
    .ALLOCSTACK KTRAP_FRAME_SIZE - MACHINE_FRAME_SIZE + 108h

    ; No need to save the flag registers since it is restored from the VMCS at
    ; the time of vmresume.
    PUSHAQ                  ; -8 * 16
    mov rcx, rsp            ; save the "stack" parameter for VmmVmExitHandler

    ; save volatile XMM registers
    sub rsp, 68h            ; 8 for alignment
    movaps xmmword ptr [rsp +  0h], xmm0
    movaps xmmword ptr [rsp + 10h], xmm1
    movaps xmmword ptr [rsp + 20h], xmm2
    movaps xmmword ptr [rsp + 30h], xmm3
    movaps xmmword ptr [rsp + 40h], xmm4
    movaps xmmword ptr [rsp + 50h], xmm5

    sub rsp, 20h

    ; All stack allocation is done now. Indicate the end of prologue as required
    ; by the FRAME attribute.
    .ENDPROLOG

    call VmmVmExitHandler   ; bool vm_continue = VmmVmExitHandler(stack);
    add rsp, 20h

    ; restore XMM registers
    movaps xmm0, xmmword ptr [rsp +  0h]
    movaps xmm1, xmmword ptr [rsp + 10h]
    movaps xmm2, xmmword ptr [rsp + 20h]
    movaps xmm3, xmmword ptr [rsp + 30h]
    movaps xmm4, xmmword ptr [rsp + 40h]
    movaps xmm5, xmmword ptr [rsp + 50h]
    add rsp, 68h

    test al, al
    jz exitVm               ; if (!vm_continue) jmp exitVm

    POPAQ
    vmresume
    jmp vmxError

exitVm:
    ; Executes vmxoff and ends virtualization
    ;   rax = Guest's rflags
    ;   rdx = Guest's rsp
    ;   rcx = Guest's rip for the next instruction
    POPAQ
    vmxoff
    jz vmxError             ; if (ZF) jmp
    jc vmxError             ; if (CF) jmp
    push rax
    popfq                   ; rflags <= GurstFlags
    mov rsp, rdx            ; rsp <= GuestRsp
    push rcx
    ret                     ; jmp AddressToReturn

vmxError:
    ; Diagnose a critical error
    pushfq
    PUSHAQ                      ; -8 * 16
    mov rcx, rsp                ; all_regs

    sub rsp, 28h                ; 28h for alignment
    call VmmVmxFailureHandler   ; VmmVmxFailureHandler(all_regs);
    add rsp, 28h
    int 3
AsmVmmEntryPoint ENDP

; unsigned char __stdcall AsmVmxCall(_In_ ULONG_PTR hypercall_number,
;                                    _In_opt_ void *context);
AsmVmxCall PROC
    vmcall                  ; vmcall(hypercall_number, context)
    jz errorWithCode        ; if (ZF) jmp
    jc errorWithoutCode     ; if (CF) jmp
    xor rax, rax            ; return VMX_OK
    ret

errorWithoutCode:
    mov rax, VMX_ERROR_WITHOUT_STATUS
    ret

errorWithCode:
    mov rax, VMX_ERROR_WITH_STATUS
    ret
AsmVmxCall ENDP

; void __stdcall AsmWriteGDT(_In_ const GDTR *gdtr);
AsmWriteGDT PROC
    lgdt fword ptr [rcx]
    ret
AsmWriteGDT ENDP

; void __stdcall AsmWriteLDTR(_In_ USHORT local_segmeng_selector);
AsmWriteLDTR PROC
    lldt cx
    ret
AsmWriteLDTR ENDP

; USHORT __stdcall AsmReadLDTR();
AsmReadLDTR PROC
    sldt ax
    ret
AsmReadLDTR ENDP

; void __stdcall AsmWriteTR(_In_ USHORT task_register);
AsmWriteTR PROC
    ltr cx
    ret
AsmWriteTR ENDP

; USHORT __stdcall AsmReadTR();
AsmReadTR PROC
    str ax
    ret
AsmReadTR ENDP

; void __stdcall AsmWriteES(_In_ USHORT segment_selector);
AsmWriteES PROC
    mov es, cx
    ret
AsmWriteES ENDP

; USHORT __stdcall AsmReadES();
AsmReadES PROC
    mov ax, es
    ret
AsmReadES ENDP

; void __stdcall AsmWriteCS(_In_ USHORT segment_selector);
AsmWriteCS PROC
    mov cs, cx
    ret
AsmWriteCS ENDP

; USHORT __stdcall AsmReadCS();
AsmReadCS PROC
    mov ax, cs
    ret
AsmReadCS ENDP

; void __stdcall AsmWriteSS(_In_ USHORT segment_selector);
AsmWriteSS PROC
    mov ss, cx
    ret
AsmWriteSS ENDP

; USHORT __stdcall AsmReadSS();
AsmReadSS PROC
    mov ax, ss
    ret
AsmReadSS ENDP

; void __stdcall AsmWriteDS(_In_ USHORT segment_selector);
AsmWriteDS PROC
    mov ds, cx
    ret
AsmWriteDS ENDP

; USHORT __stdcall AsmReadDS();
AsmReadDS PROC
    mov ax, ds
    ret
AsmReadDS ENDP

; void __stdcall AsmWriteFS(_In_ USHORT segment_selector);
AsmWriteFS PROC
    mov fs, cx
    ret
AsmWriteFS ENDP

; USHORT __stdcall AsmReadFS();
AsmReadFS PROC
    mov ax, fs
    ret
AsmReadFS ENDP

; void __stdcall AsmWriteGS(_In_ USHORT segment_selector);
AsmWriteGS PROC
    mov gs, cx
    ret
AsmWriteGS ENDP

; USHORT __stdcall AsmReadGS();
AsmReadGS PROC
    mov ax, gs
    ret
AsmReadGS ENDP

; ULONG_PTR __stdcall AsmLoadAccessRightsByte(_In_ ULONG_PTR segment_selector);
AsmLoadAccessRightsByte PROC
    lar rax, rcx
    ret
AsmLoadAccessRightsByte ENDP

; void __stdcall AsmInvalidateInternalCaches();
AsmInvalidateInternalCaches PROC
    invd
    ret
AsmInvalidateInternalCaches ENDP

; void __stdcall AsmWriteCR2(_In_ ULONG_PTR cr2_value);
AsmWriteCR2 PROC
    mov cr2, rcx
    ret
AsmWriteCR2 ENDP

; unsigned char __stdcall AsmInvept(
;     _In_ InvEptType invept_type,
;     _In_ const InvEptDescriptor *invept_descriptor);
AsmInvept PROC
    invept rcx, oword ptr [rdx]
    jz errorWithCode        ; if (ZF) jmp
    jc errorWithoutCode     ; if (CF) jmp
    xor rax, rax            ; return VMX_OK
    ret

errorWithoutCode:
    mov rax, VMX_ERROR_WITHOUT_STATUS
    ret

errorWithCode:
    mov rax, VMX_ERROR_WITH_STATUS
    ret
AsmInvept ENDP

; unsigned char __stdcall AsmInvvpid(
;     _In_ InvVpidType invvpid_type,
;     _In_ const InvVpidDescriptor *invvpid_descriptor);
AsmInvvpid PROC
    invvpid rcx, oword ptr [rdx]
    jz errorWithCode        ; if (ZF) jmp
    jc errorWithoutCode     ; if (CF) jmp
    xor rax, rax            ; return VMX_OK
    ret

errorWithoutCode:
    mov rax, VMX_ERROR_WITHOUT_STATUS
    ret

errorWithCode:
    mov rax, VMX_ERROR_WITH_STATUS
    ret
AsmInvvpid ENDP

PURGE PUSHAQ
PURGE POPAQ
PURGE ASM_DUMP_REGISTERS
END

redpajama_set_name: RedPajamaGithub


text:
<?php

require_once(dirname(__FILE__) . '/../ActiveRecord.php');

/**
 * This class provides a base for creating relationship between models
 *
 * @package db
 * @subpackage relations
 * @author wilker
 */
abstract class ActiveRelation
{
    private $_data;
    private $_newdata;
    private $_changed;

    protected $local_model;
    protected $foreign_model;
    protected $options;

    public function __construct($local_model, $foreign_model, $options = array())
    {
        $this->local_model = $local_model;
        $this->foreign_model = class_exists($foreign_model) ? ActiveRecord::model($foreign_model) : $foreign_model;
        $this->options = $options;

        $this->_data = null;
        $this->_newdata = null;
        $this->_changed = false;
    }

    public function get_local_field()
    {
    	if (isset($this->options['local_field'])) {
    		return $this->options['local_field'];
    	}

        return 'id';
    }

    public function get_foreign_field($model)
    {
    	if (isset($this->options['foreign_field'])) {
    		return $this->options['foreign_field'];
    	}

    	$class = get_class($model);
		$field = $class[0];

		for ($i = 1; $i < strlen($class); $i++) {
			$char = $class[$i];

			if (ord($char) > 64 && ord($char) < 91) {
				$field .= '_' . strtolower($char);
			} else {
				$field .= $char;
			}
		}

		return strtolower($field) . '_id';
    }

    public function get_data($force_refresh = false)
    {
        if (!$this->_data || $force_refresh === true) {
            $this->_data = $this->refresh();
        }

        return $this->_data;
    }

    public function get_foreign_model()
    {
    	return $this->foreign_model;
    }

    public function is_loaded()
    {
    	return $this->_data !== null;
    }

    public function set_data($data)
    {
    	$this->_newdata = $data;
    	$this->_changed = true;
    }

    public function save()
    {
    	if ($this->_changed) {
    		$this->push($this->_newdata);
    	}
    }

    public abstract function refresh();
    public abstract function push($data);
} // END abstract class ActiveRelation


text:
use crate::parsers::sql::Env;

use crate::parsers::sql::Field;

#[derive(Debug, Default, Clone)]
pub struct Drain(pub Vec<Field>);

impl Drain {
    pub fn execute(self, env: &mut Env) {
        for field in self.0 {
            if let Some(alias) = field.alias {
                env.insert(&alias, &field.expr);
            }
        }
    }
}


text:
class sinCosineLut{

public:
    static vector<float>sinLut;
    static vector<float>cosLut;
    static inline void changeResolution(int res){
        resolution = res;
    }
    static int getResolution(){return resolution;}
private:
    static int resolution;

    static inline vector<float>initSin(){
        vector<float> temp;
        for (int i = 0; i<resolution; i++) {
            sinLut.push_back(sin((float(i)/resolution)*TWO_PI));
        }
        return temp;
    }

    static inline vector<float>initCos(){
        vector<float> temp;
        for (int i = 0; i<resolution; i++) {
            cosLut.push_back(cos((float(i)/resolution)*TWO_PI));
        }
        return temp;
    }
};


text:
/**
 * @author: @AngularClass
 */

const helpers = require('./helpers');
const path = require('path');
var stringify = require('json-stringify');

/**
 * Webpack Plugins
 */
const webpack = require('webpack');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
// const ExtractTextPlugin = require('extract-text-webpack-plugin');

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
const FABRIC8_FORGE_API_URL = process.env.FABRIC8_FORGE_API_URL;
const FABRIC8_WIT_API_URL = process.env.FABRIC8_WIT_API_URL;
const FABRIC8_RECOMMENDER_API_URL = process.env.FABRIC8_RECOMMENDER_API_URL || 'http://api-bayesian.dev.rdu2c.fabric8.io/api/v1/';
const FABRIC8_PIPELINES_NAMESPACE = process.env.FABRIC8_PIPELINES_NAMESPACE || '-development';
const FABRIC8_BRANDING = 'fabric8';

const sassModules = [
  {
    name: 'bootstrap'
  }, {
    name: 'font-awesome',
    module: 'font-awesome',
    path: 'font-awesome',
    sass: 'scss'
  }, {
    name: 'patternfly',
    module: 'patternfly-sass-with-css'
  }
];

sassModules.forEach(function (val) {
  val.module = val.module || val.name + '-sass';
  val.path = val.path || path.join(val.module, 'assets');
  val.modulePath = val.modulePath || path.join('node_modules', val.path);
  val.sass = val.sass || path.join('stylesheets');
  val.sassPath = path.join(helpers.root(), val.modulePath, val.sass);
});

/**
 * Webpack configuration
 *
 * See: http://webpack.github.io/docs/configuration.html#cli
 */
module.exports = function (options) {
  return {

    entry: {
      'app': './src/main.browser.ts'
    },

    /**
     * Source map for Karma from the help of karma-sourcemap-loader &  karma-webpack
     *
     * Do not change, leave as is or it wont work.
     * See: https://github.com/webpack/karma-webpack#source-maps
     */
    devtool: 'inline-source-map',

    /**
     * Options affecting the resolving of modules.
     *
     * See: http://webpack.github.io/docs/configuration.html#resolve
     */
    resolve: {

      /**
       * An array of extensions that should be used to resolve modules.
       *
       * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
       */
      extensions: ['.ts', '.js']
    },

    /**
     * Options affecting the normal modules.
     *
     * See: http://webpack.github.io/docs/configuration.html#module
     */
    module: {

      /**
       * An array of automatically applied loaders.
       *
       * IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
       * This means they are not resolved relative to the configuration file.
       *
       * See: http://webpack.github.io/docs/configuration.html#module-loaders
       */
      rules: [

        /**
         * Source map loader support for *.js files
         * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
         *
         * See: https://github.com/webpack/source-map-loader
         */
        {
          test: /\.js$/,
          use: ['source-map-loader'],
          exclude: [
            // these packages have problems with their sourcemaps
            helpers.nodeModulePath("mydatepicker"),
            helpers.nodeModulePath("ng2-completer"),
            helpers.nodeModulePath("angular2-flash-messages"),
            helpers.nodeModulePath("ngx-dropdown"),
            helpers.nodeModulePath("ngx-modal"),
            helpers.nodeModulePath("ng2-modal"),
            helpers.nodeModulePath("ng2-dnd")
          ]
        },

        /**
         * Typescript loader support for .ts and Angular 2 async routes via .async.ts
         *
         * See: https://github.com/s-panferov/awesome-typescript-loader
         */
        {
          test: /\.ts$/,
          use: [
            'awesome-typescript-loader',
            'angular2-template-loader'
          ],
          exclude: [/\.e2e\.ts$/]
        },

        /**
         * Json loader support for *.json files.
         *
         * See: https://github.com/webpack/json-loader
         */
        {
          test: /\.json$/,
          use: ['json-loader'],
          exclude: [ path.resolve(__dirname, 'src/index.html') ]
        },

        /*
         * to string and css loader support for *.css files
         * Returns file content as string
         *
         */
        {
          test: /\.css$/,
          use: [
            {
              loader: "to-string-loader"
            },
            {
              loader: "style-loader"
            },
            {
              loader: "css-loader"
            }
          ]
        },

        {
          test: /\.scss$/,
          use: [
            {
              loader: 'to-string-loader'
            },
            {
              loader: 'css-loader'
            },
            {
              loader: 'sass-loader',
              query: {
                includePaths: sassModules.map(function (val) {
                  return val.sassPath;
                })
              }
            }
          ]
        },

        /* File loader for supporting fonts, for example, in CSS files.
         */
        {
          test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
          loaders: [
            {
              loader: "url-loader",
              query: {
                limit: 3000,
                name: 'vendor/fonts/[name].[hash].[ext]'
              }
            }
          ]
        }, {
          test: /\.jpg$|\.png$|\.gif$|\.jpeg$/,
          loaders: [
            {
              loader: "url-loader",
              query: {
                limit: 3000,
                name: 'vendor/images/[name].[hash].[ext]'
              }
            }
          ]
        },

        /**
         * Raw loader support for *.html
         * Returns file content as string
         *
         * See: https://github.com/webpack/raw-loader
         */
        {
          test: /\.html$/,
          loader: 'raw-loader',
          exclude: [ path.resolve(__dirname, 'src/index.html') ]
        }
      ]
    },

     /**
     * Add additional plugins to the compiler.
     *
     * See: http://webpack.github.io/docs/configuration.html#plugins
     */
    plugins: [
      /**
       * Plugin: DefinePlugin
       * Description: Define free variables.
       * Useful for having development builds with debug logging or adding global constants.
       *
       * Environment helpers
       *
       * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
       */
      // NOTE: when adding more properties make sure you include them in custom-typings.d.ts
      new DefinePlugin({
        'ENV': stringify(ENV),
        'HMR': false,
        'process.env': {
          'ENV': stringify(ENV),
          'FABRIC8_FORGE_API_URL': stringify(FABRIC8_FORGE_API_URL),
          'FABRIC8_WIT_API_URL': stringify(FABRIC8_WIT_API_URL),
          'FABRIC8_RECOMMENDER_API_URL' : stringify(FABRIC8_RECOMMENDER_API_URL),
          'NODE_ENV': stringify(ENV),
          'HMR': false
        }
      }),

      /**
       * Plugin: ContextReplacementPlugin
       * Description: Provides context to Angular's use of System.import
       *
       * See: https://webpack.github.io/docs/list-of-plugins.html#contextreplacementplugin
       * See: https://github.com/angular/angular/issues/11580
       */
      new ContextReplacementPlugin(
        // The (\\|\/) piece accounts for path separators in *nix and Windows
        /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
        path.resolve(__dirname, 'src') // location of your src
      ),

       /**
       * Plugin LoaderOptionsPlugin (experimental)
       *
       * See: https://gist.github.com/sokra/27b24881210b56bbaff7
       */
      new LoaderOptionsPlugin({
        debug: true,
        options: {

          /**
           * Static analysis linter for TypeScript advanced options configuration
           * Description: An extensible linter for the TypeScript language.
           *
           * See: https://github.com/wbuchwalter/tslint-loader
           */
          tslint: {
            emitErrors: false,
            failOnHint: false,
            resourcePath: 'src'
          }
        }
      })
    ],

    /**
     * Include polyfills or mocks for various node stuff
     * Description: Node configuration
     *
     * See: https://webpack.github.io/docs/configuration.html#node
     */
    node: {
      global: true,
      process: false,
      crypto: 'empty',
      module: false,
      clearImmediate: false,
      setImmediate: false
    },

    stats: "verbose"
  };
};


text:
using UnityEngine;
using System.Collections.Generic;
using System.Linq;

namespace Skinner
{
    /// A serializable class holding a preprocessed vertex array.
    public class SkinnerModel : ScriptableObject
    {
        // This is basically a skinned mesh object without topological
        // infomation. The vertex array in the mesh is optimized for Skinner
        // renderers (e.g. overlapped vertices removal).

        #region Public properties

        /// Number of vertices (read only).
        public int vertexCount {
            get { return _vertexCount; }
        }

        [SerializeField] int _vertexCount;

        /// Preprocessed vertex array as a mesh (read only).
        public Mesh mesh {
            get { return _mesh; }
        }

        [SerializeField] Mesh _mesh;

        #endregion

        #region Public methods

        #if UNITY_EDITOR

        /// Asset initialization
        public void Initialize(Mesh source)
        {
            // Input vertices
            var inVertices = source.vertices;
            var inNormals = source.normals;
            var inTangents = source.tangents;
            var inBoneWeights = source.boneWeights;

            // Enumerate unique vertices.
            var outVertices = new List<Vector3>();
            var outNormals = new List<Vector3>();
            var outTangents = new List<Vector4>();
            var outBoneWeights = new List<BoneWeight>();

            for (var i = 0; i < inVertices.Length; i++)
            {
                if (!outVertices.Any(_ => _ == inVertices[i]))
                {
                    outVertices.Add(inVertices[i]);
                    outNormals.Add(inNormals[i]);
                    outTangents.Add(inTangents[i]);
                    outBoneWeights.Add(inBoneWeights[i]);
                }
            }

            // Assign unique UVs to the vertices.
            var outUVs = Enumerable.Range(0, outVertices.Count).
                Select(i => Vector2.right * (i + 0.5f) / outVertices.Count).ToList();

            // Enumerate vertex indices.
            var indices = Enumerable.Range(0, outVertices.Count).ToArray();

            // Make a clone of the source mesh to avoid
            // the SMR internal caching problem - https://goo.gl/mORHCR
            _mesh = Instantiate<Mesh>(source);
            _mesh.name = _mesh.name.Substring(0, _mesh.name.Length - 7);

            // Clear the unused attributes.
            _mesh.colors = null;
            _mesh.uv2 = null;
            _mesh.uv3 = null;
            _mesh.uv4 = null;

            // Overwrite the vertices.
            _mesh.subMeshCount = 0;
            _mesh.SetVertices(outVertices);
            _mesh.SetNormals(outNormals);
            _mesh.SetTangents(outTangents);
            _mesh.SetUVs(0, outUVs);
            _mesh.bindposes = source.bindposes;
            _mesh.boneWeights = outBoneWeights.ToArray();

            // Add point primitives.
            _mesh.subMeshCount = 1;
            _mesh.SetIndices(indices, MeshTopology.Points, 0);

            // Finishing up.
            _mesh.UploadMeshData(true);

            // Store the vertex count.
            _vertexCount = outVertices.Count;
        }

        #endif

        #endregion

        #region ScriptableObject functions

        void OnEnable()
        {
        }

        #endregion
    }
}


text:
/**
 * Panel class
 * @param {PhotoSphereViewer} psv
 * @constructor
 * @extends module:components.PSVComponent
 * @memberof module:components
 */
function PSVPanel(psv) {
  PSVComponent.call(this, psv);

  /**
   * @summary Content container
   * @member {HTMLElement}
   * @readonly
   * @private
   */
  this.content = null;

  /**
   * @member {Object}
   * @private
   */
  this.prop = {
    mouse_x: 0,
    mouse_y: 0,
    mousedown: false,
    opened: false
  };

  this.create();
}

PSVPanel.prototype = Object.create(PSVComponent.prototype);
PSVPanel.prototype.constructor = PSVPanel;

PSVPanel.className = 'psv-panel';
PSVPanel.publicMethods = ['showPanel', 'hidePanel'];

/**
 * @override
 */
PSVPanel.prototype.create = function() {
  PSVComponent.prototype.create.call(this);

  this.container.innerHTML =
    '

' +
    '

' +
    '

';

  this.content = this.container.querySelector('.psv-panel-content');

  var closeBtn = this.container.querySelector('.psv-panel-close-button');
  closeBtn.addEventListener('click', this.hidePanel.bind(this));

  // Stop event bubling from panel
  if (this.psv.config.mousewheel) {
    this.container.addEventListener(PhotoSphereViewer.SYSTEM.mouseWheelEvent, function(e) {
      e.stopPropagation();
    });
  }

  // Event for panel resizing + stop bubling
  var resizer = this.container.querySelector('.psv-panel-resizer');
  resizer.addEventListener('mousedown', this);
  resizer.addEventListener('touchstart', this);
  this.psv.container.addEventListener('mouseup', this);
  this.psv.container.addEventListener('touchend', this);
  this.psv.container.addEventListener('mousemove', this);
  this.psv.container.addEventListener('touchmove', this);
};

/**
 * @override
 */
PSVPanel.prototype.destroy = function() {
  this.psv.container.removeEventListener('mousemove', this);
  this.psv.container.removeEventListener('touchmove', this);
  this.psv.container.removeEventListener('mouseup', this);
  this.psv.container.removeEventListener('touchend', this);

  delete this.prop;
  delete this.content;

  PSVComponent.prototype.destroy.call(this);
};

/**
 * @summary Handles events
 * @param {Event} e
 * @private
 */
PSVPanel.prototype.handleEvent = function(e) {
  switch (e.type) {
    // @formatter:off
    case 'mousedown': this._onMouseDown(e); break;
    case 'touchstart': this._onTouchStart(e); break;
    case 'mousemove': this._onMouseMove(e); break;
    case 'touchmove': this._onTouchMove(e); break;
    case 'mouseup': this._onMouseUp(e); break;
    case 'touchend': this._onMouseUp(e); break;
    // @formatter:on
  }
};

/**
 * @summary Shows the panel
 * @param {string} content
 * @param {boolean} [noMargin=false]
 * @fires module:components.PSVPanel.open-panel
 */
PSVPanel.prototype.showPanel = function(content, noMargin) {
  this.content.innerHTML = content;
  this.content.scrollTop = 0;
  this.container.classList.add('psv-panel--open');

  PSVUtils.toggleClass(this.content, 'psv-panel-content--no-margin', !!noMargin);

  this.prop.opened = true;

  /**
   * @event open-panel
   * @memberof module:components.PSVPanel
   * @summary Triggered when the panel is opened
   */
  this.psv.trigger('open-panel');
};

/**
 * @summary Hides the panel
 * @fires module:components.PSVPanel.close-panel
 */
PSVPanel.prototype.hidePanel = function() {
  this.content.innerHTML = null;
  this.prop.opened = false;
  this.container.classList.remove('psv-panel--open');

  /**
   * @event close-panel
   * @memberof module:components.PSVPanel
   * @summary Trigered when the panel is closed
   */
  this.psv.trigger('close-panel');
};

/**
 * @summary Handles mouse down events
 * @param {MouseEvent} evt
 * @private
 */
PSVPanel.prototype._onMouseDown = function(evt) {
  evt.stopPropagation();
  this._startResize(evt);
};

/**
 * @summary Handles touch events
 * @param {TouchEvent} evt
 * @private
 */
PSVPanel.prototype._onTouchStart = function(evt) {
  evt.stopPropagation();
  this._startResize(evt.changedTouches[0]);
};

/**
 * @summary Handles mouse up events
 * @param {MouseEvent} evt
 * @private
 */
PSVPanel.prototype._onMouseUp = function(evt) {
  if (this.prop.mousedown) {
    evt.stopPropagation();
    this.prop.mousedown = false;
    this.content.classList.remove('psv-panel-content--no-interaction');
  }
};

/**
 * @summary Handles mouse move events
 * @param {MouseEvent} evt
 * @private
 */
PSVPanel.prototype._onMouseMove = function(evt) {
  if (this.prop.mousedown) {
    evt.stopPropagation();
    this._resize(evt);
  }
};

/**
 * @summary Handles touch move events
 * @param {TouchEvent} evt
 * @private
 */
PSVPanel.prototype._onTouchMove = function(evt) {
  if (this.prop.mousedown) {
    evt.stopPropagation();
    this._resize(evt.touches[0]);
  }
};

/**
 * @summary Initializes the panel resize
 * @param {MouseEvent|Touch} evt
 * @private
 */
PSVPanel.prototype._startResize = function(evt) {
  this.prop.mouse_x = parseInt(evt.clientX);
  this.prop.mouse_y = parseInt(evt.clientY);
  this.prop.mousedown = true;
  this.content.classList.add('psv-panel-content--no-interaction');
};

/**
 * @summary Resizes the panel
 * @param {MouseEvent|Touch} evt
 * @private
 */
PSVPanel.prototype._resize = function(evt) {
  var x = parseInt(evt.clientX);
  var y = parseInt(evt.clientY);

  this.container.style.width = (this.container.offsetWidth - (x - this.prop.mouse_x)) + 'px';

  this.prop.mouse_x = x;
  this.prop.mouse_y = y;
};


text:
package com.elsewhat.android.slideshow.api;

import java.io.File;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextSwitcher;
import android.widget.TextView;

import com.elsewhat.android.slideshow.R;
import com.elsewhat.android.slideshow.activities.ISlideshowInstance;

/**
 * The image adapter for the gallery which binds it to the data
 *
 * @author dagfinn.parnas
 *
 */
public class ImageAdapter extends ArrayAdapter<SlideshowPhoto> {
    private final int mGalleryItemBackground;
    private final Context context;
    private ISlideshowInstance slideshowInstance;
    private File rootPhotoFolder;
    private boolean doDisplayPhotoTitle;
    private HashMap<Integer,WeakReference<View>> mapWeakRefViews;
    private final String LOADING_TAG="loading";
    private final String LOADED_TAG="Finished";
    private final String LOG_PREFIX="ElsewhatSlideshow";
    private int screenWidthPx;
    private int screenHeightPx;

    public ImageAdapter(Context context, ISlideshowInstance slideshowInstance, int textViewResourceId, List<SlideshowPhoto> listObjects, File rootPhotoFolder, boolean doDisplayPhotoTitle) {
    	super(context,textViewResourceId,listObjects);
    	this.context=context;
    	this.slideshowInstance=slideshowInstance;
    	this.rootPhotoFolder=rootPhotoFolder;
    	this.doDisplayPhotoTitle=doDisplayPhotoTitle;
        // See res/values/attrs.xml for the <declare-styleable>
    	// ensures the default handling of the theme is used
        TypedArray a = context.obtainStyledAttributes(R.styleable.Gallery);
        mGalleryItemBackground = a.getResourceId(
                R.styleable.Gallery_android_galleryItemBackground, 0);
        a.recycle();

        mapWeakRefViews= new HashMap<Integer,WeakReference<View>>(500);

        screenWidthPx = slideshowInstance.getScreenWidth();
        screenHeightPx = slideshowInstance.getScreenHeight();

    }

    public void setDoDisplayPhotoTitle( boolean doDisplayPhotoTitle){
    	this.doDisplayPhotoTitle=doDisplayPhotoTitle;
    }

    public boolean shouldDisplayPhotoTitle(){
    	return doDisplayPhotoTitle;
    }

    /**
     * Trigger the actionToggleTitle method to be call.
     * This is useful since the adapter is the only visible part for the Gallery
     *
     */
    public void triggerActionToggleTitle(){
    	slideshowInstance.actionToggleTitle();
    }

    public View getView(int position, View convertView, ViewGroup parent) {
    	View slideshowView=convertView;
    	if(position>= getCount()){
    		return null;
    	}

    	SlideshowPhoto slideshowPhoto=getItem(position);
    	Log.d(LOG_PREFIX,position + " title:"+slideshowPhoto.getTitle());

    	boolean copyDrawableFromCachedView=false;
    	View cachedView=null;
    	Integer mapKey = new Integer(position);
        if (slideshowView == null) {
        	//let's check the weak references for this View
        	if(mapWeakRefViews.containsKey(mapKey)){
        		//we have a key, but the View may be garbage collected
        		WeakReference<View> weakRefView = mapWeakRefViews.get(mapKey);
        		cachedView = weakRefView.get();
        		if(cachedView==null){
        			//view was cached, but has been deleted.
        			//it will be replaced later in this method, so don't bother deleting it from the hashmap
        		}else if(cachedView.getParent()!=null){
        			//Log.i(LOG_PREFIX,position + " was cached, but had a parent. So close!");
        			copyDrawableFromCachedView=true;
        		}else {
        			Log.d(LOG_PREFIX,position + " returned through weak reference caching. Yeah!");
        			return cachedView;
        		}
        	}

        	//if no cached value, create it from the resource definition
        	LayoutInflater viewInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        	slideshowView = viewInflater.inflate(R.layout.slideshow_item, null);
        }

        ImageView slideshowImageView = (ImageView)slideshowView.findViewById(R.id.slideshow_photo);
        slideshowImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        slideshowImageView.setAdjustViewBounds(true);
        //make sure we do not exceed the opengl hardware accl max size
        slideshowImageView.setMaxHeight(2048);
        slideshowImageView.setMaxWidth(2048);

        // The preferred Gallery item background
        slideshowImageView.setBackgroundResource(mGalleryItemBackground);
        slideshowImageView.setBackgroundColor(Color.TRANSPARENT);

        slideshowImageView.setTag(LOADING_TAG);
        slideshowImageView.setImageResource(R.drawable.loading);

        //OLD METHOD
        //These lines of code are in a separate async task in order to not block the UI thread for approx 300 ms
        //Drawable drawable = slideshowPhoto.getLargePhotoDrawable(rootPhotoFolder);
        //slideshowImageView.setImageDrawable(drawable);
        //new ReadPhotoFromFileTask(slideshowImageView,slideshowPhoto,rootPhotoFolder).execute();

        //This section applies if we have a cached view, but it cannot be reuse directly since it has a parent
        //let us copy the drawable
        boolean slideShowImageDrawableMissing=true;
        if(copyDrawableFromCachedView==true && cachedView!=null){
        	//reusing the drawable from a cached view
        	ImageView cachedSlideshowImageView = (ImageView)cachedView.findViewById(R.id.slideshow_photo);
        	String cachedTag = (String)cachedSlideshowImageView.getTag();
        	if(cachedSlideshowImageView!=null && cachedTag!=null && cachedTag.equals(LOADED_TAG)){
        		slideshowImageView.setImageDrawable(cachedSlideshowImageView.getDrawable());
        		slideShowImageDrawableMissing=false;
        		Log.d(LOG_PREFIX,position+" Cached photo drawable reused. Yeah!");
        	}else {
        		Log.i(LOG_PREFIX,position+" Cached Photo is not loaded yet, so could not use cache. Doh!");
        	}
        }

        if(slideShowImageDrawableMissing){
            //NEW METHOD
            //Add to a last-in/first-out queue
        	AsyncQueueableObject queueablePhotoObject=null;
            queueablePhotoObject = new QueueablePhotoObject(slideshowPhoto, slideshowView, rootPhotoFolder,LOADED_TAG, screenWidthPx,screenHeightPx);
            slideshowInstance.addToAsyncReadQueue(queueablePhotoObject);
            Log.d(LOG_PREFIX,position+" is being loaded in a background async task");
        }

        TextView slideshowTitle = (TextView)slideshowView.findViewById(R.id.slideshow_title);
        slideshowTitle.setText(slideshowPhoto.getTitle());

        //Scrolling for the description causes a memory leak
        //ref http://stackoverflow.com/questions/8900212/adding-a-simple-scrollview-to-gallery-causes-a-memory-leak
        //Therefore we use a TextSwitcher which we will use a Timer job to swap between parts of the string
        final TextSwitcher slideshowDescription = (TextSwitcher)slideshowView.findViewById(R.id.slideshow_description);
        Animation outAnim = AnimationUtils.loadAnimation(context,
                R.anim.slide_out_down);
        Animation inAnim = AnimationUtils.loadAnimation(context,
                R.anim.slide_in_up);

        slideshowDescription.setInAnimation(inAnim);
        slideshowDescription.setOutAnimation(outAnim);

        slideshowDescription.setText(slideshowPhoto.getDescription());

        //find out if we should hide the text descriptions
        boolean isEmptyTitle =false;
        if(slideshowPhoto.getTitle()==null|| "".equals(slideshowPhoto.getTitle().trim())){
        	isEmptyTitle=true;
        }

        if(doDisplayPhotoTitle==false || slideshowPhoto.isPromotion() || isEmptyTitle){
        	slideshowTitle.setVisibility(View.INVISIBLE);
        	slideshowDescription.setVisibility(View.INVISIBLE);
        	View layout= slideshowView.findViewById(R.id.slideshow_text_background);
        	layout.setVisibility(View.INVISIBLE);
        }

        //lastView = slideshowView;
        //lastFileName=slideshowPhoto.getFileName();

        //add the view to our weak reference caching
        WeakReference<View> weakRefView = new WeakReference<View>(slideshowView);
        mapWeakRefViews.put(mapKey, weakRefView);

        //DEBUG
        String classLayoutParam=null;
        Object objectLayoutParam = slideshowView.getLayoutParams();
        if(objectLayoutParam!=null){
        	classLayoutParam=objectLayoutParam.getClass().getName();
        }
        Log.d(LOG_PREFIX, "Layout params class="+classLayoutParam+ " value="+objectLayoutParam);

        return slideshowView;
    }

	public void onGalleryNewPhoto(View view) {
		slideshowInstance.setUpScrollingOfDescription();

	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace SME.VHDL.CustomRenders.Native
{
    /// <summary>
    /// Class for generating a Xilinx single port RAM by using macros.
    /// </summary>
    public class XilinxTrueDualPortRam : ICustomRenderer
    {
        /// <summary>
        /// Returns the string, which should be written in the include region of the VHDL file.
        /// </summary>
        /// <param name="renderer">The renderer currently rendering VHDL files.</param>
        /// <param name="indentation">The indentation at the current location in the VHDL file.</param>
        public string IncludeRegion(RenderStateProcess renderer, int indentation)
        {
            return VHDLHelper.CreateComponentInclude(renderer.Parent.Config, indentation);
        }

        /// <summary>
        /// Gets a set of signals for communicating with a single blockram instance.
        /// </summary>
        /// <returns>The signal region.</returns>
        /// <param name="config">The configuration to generate the signals for.</param>
        /// <param name="index">The instance index to use, or negative for no indexing.</param>
        /// <param name="overrideAddrWidth">Value for overriding the width of the address bus.</param>
        private string GetSignalRegion(BlockRamConfig config, int index = -1, int overrideAddrWidth = -1)
        {
            var index_suffix = index < 0 ? string.Empty : $"_{index}";
            return $@"
signal ENA_internal{index_suffix}: std_logic;
signal WEA_internal{index_suffix}: std_logic_vector({config.wewidth - 1} downto 0);
signal DIA_internal{index_suffix}: std_logic_vector({config.datawidth - 1} downto 0);
signal DOA_internal{index_suffix}: std_logic_vector({config.datawidth - 1} downto 0);
signal ADDRA_internal{index_suffix}: std_logic_vector({(overrideAddrWidth <= 0 ? (config.realaddrwidth - 1) : (overrideAddrWidth - 1))} downto 0);

signal ENB_internal{index_suffix}: std_logic;
signal WEB_internal{index_suffix}: std_logic_vector({config.wewidth - 1} downto 0);
signal DIB_internal{index_suffix}: std_logic_vector({config.datawidth - 1} downto 0);
signal DOB_internal{index_suffix}: std_logic_vector({config.datawidth - 1} downto 0);
signal ADDRB_internal{index_suffix}: std_logic_vector({(overrideAddrWidth <= 0 ? (config.realaddrwidth - 1) : (overrideAddrWidth - 1))} downto 0);
";
        }

        /// <summary>
        /// Creates VHDL code that chooses the block ram component data results with the top bits.
        /// </summary>
        /// <returns>The output selector.</returns>
        /// <param name="instancename">The name of the instance to create.</param>
        /// <param name="port">The port to use</param>
        /// <param name="blocks">The number of blocks.</param>
        /// <param name="fullAddressWidth">The full address width.</param>
        /// <param name="blockAddrWidth">The block address width.</param>
        private string GenerateOutputSelector(string instancename, string port, int blocks, int fullAddressWidth, int blockAddrWidth)
        {
            var cases = Enumerable
                .Range(0, blocks)
                .Select(i => $@"    when ""{VHDLHelper.GetDataBitString(i, fullAddressWidth - blockAddrWidth).Substring(32 - (fullAddressWidth - blockAddrWidth))}"" =>
        DO{port}_internal <= DO{port}_internal_{i};");

            return $@"
{instancename}{port}_Output: process(ADDR{port}_READ_internal, {string.Join(", ", Enumerable.Range(0, blocks).Select(x => $"DO{port}_internal_{x}"))})
begin
    case ADDR{port}_READ_internal({fullAddressWidth - 1} downto {blockAddrWidth}) is
{string.Join(Environment.NewLine, cases)}
    when others =>
        -- Implicit latching
    end case;
end process;
";
        }

        /// <summary>
        /// Gets the instantiation block for a single blockram instance.
        /// </summary>
        /// <returns>The instantiation region.</returns>
        /// <param name="config">The configuration to generate the instantiation for.</param>
        /// <param name="instancename">The name of the encapsulating instance.</param>
        /// <param name="initialvalue">The initial value for the output</param>
        /// <param name="memdatalines">The lines to initially fill the block RAM with.</param>
        /// <param name="pardatalines">The lines to initially fill the parity bits with.</param>
        /// <param name="index">The instance index to use, or negative for no indexing.</param>
        private string GetInstantiationRegion(BlockRamConfig config, string instancename, string initialvalue, IEnumerable<string> memdatalines, IEnumerable<string> pardatalines, int index = -1)
        {
            var memlines = string.Join(
                "," + Environment.NewLine,
                Enumerable.Range(0, int.MaxValue)
                .Zip(
                    memdatalines,
                    (a, b) => string.Format("    INIT_{0:X2} => X\"{1}\"", a, b)
                )
            );

            var paritylines = string.Join(
                "," + Environment.NewLine,
                Enumerable.Range(0, int.MaxValue)
                .Zip(
                    pardatalines,
                    (a, b) => string.Format("    INITP_{0:X2} => X\"{1}\"", a, b)
                )
            );

            var index_suffix = index < 0 ? string.Empty : $"_{index}";

            return
$@"
{instancename}_inst{index_suffix} : BRAM_TDP_MACRO
generic map (
    BRAM_SIZE => ""{(config.use36k ? "36Kb" : "18Kb")}"", -- Target BRAM, ""18Kb"" or ""36Kb""
    DEVICE => ""{ config.targetdevice }"", --Target device: ""VIRTEX5"", ""VIRTEX6"", ""7SERIES"", ""SPARTAN6""
    DOA_REG => 0, --Optional port A output register(0 or 1)
    DOB_REG => 0, --Optional port B output register(0 or 1)
    INIT_FILE => ""NONE"",
    READ_WIDTH_A => { config.datawidth },     -- Valid values are 1 - 36(19 - 36 only valid when BRAM_SIZE = ""36Kb"")
    READ_WIDTH_B => { config.datawidth },     -- Valid values are 1 - 36(19 - 36 only valid when BRAM_SIZE = ""36Kb"")
    SIM_COLLISION_CHECK => ""GENERATE_X_ONLY"", --Collision check enable ""ALL"", ""WARNING_ONLY"",
                                 --""GENERATE_X_ONLY"" or ""NONE""
    SRVAL_A => X""{ initialvalue}"", --Set / Reset value for A port output
    SRVAL_B => X""{ initialvalue}"", --Set / Reset value for B port output
    WRITE_MODE_A => ""READ_FIRST"", -- ""WRITE_FIRST"", ""READ_FIRST"" or ""NO_CHANGE""
    WRITE_MODE_B => ""READ_FIRST"", -- ""WRITE_FIRST"", ""READ_FIRST"" or ""NO_CHANGE""
    WRITE_WIDTH_A => { config.datawidth },     -- Valid values are 1 - 36(19 - 36 only valid when BRAM_SIZE = ""36Kb"")
    WRITE_WIDTH_B => { config.datawidth },     -- Valid values are 1 - 36(19 - 36 only valid when BRAM_SIZE = ""36Kb"")

    -- The following INIT_xx declarations specify the initial contents of the RAM
{ memlines },

    -- The next set of INITP_xx are for the parity bits
{ paritylines },

    INIT_A => X""{ initialvalue}"", --Initial values on A output port
    INIT_B => X""{ initialvalue}""  --Initial values on B output port
)
port map (
    DOA => DOA_internal{index_suffix},         -- Output port-A, width defined by READ_WIDTH_A parameter
    DOB => DOB_internal{index_suffix},         -- Output port-B, width defined by READ_WIDTH_B parameter
    ADDRA => ADDRA_internal{index_suffix},     -- Input port-A address, width defined by Port A depth
    ADDRB => ADDRB_internal{index_suffix},     -- Input port-B address, width defined by Port B depth
    CLKA => CLK,                 -- 1-bit input port-A clock
    CLKB => CLK,                 -- 1-bit input port-B clock
    DIA => DIA_internal{index_suffix},         -- Input port-A data, width defined by WRITE_WIDTH_A parameter
    DIB => DIB_internal{index_suffix},         -- Input port-B data, width defined by WRITE_WIDTH_B parameter
    ENA => ENA_internal{index_suffix},         -- 1-bit input port-A enable
    ENB => ENB_internal{index_suffix},         -- 1-bit input port-B enable
    REGCEA => '0',               -- 1-bit input port-A register enable
    REGCEB => '0',               -- 1-bit input port-B register enable
    RSTA => RST,                 -- 1-bit input port-A reset
    RSTB => RST,                 -- 1-bit input port-B reset
    WEA => WEA_internal{index_suffix},         -- Input port-A write enable, width defined by port A depth
    WEB => WEB_internal{index_suffix}          -- Input port-B write enable, width defined by port B depth
);
-- End of BRAM_TDP_MACRO_inst instantiation
";
        }

        /// <summary>
        /// Returns the string, which should be written in the body region of the VHDL file.
        /// </summary>
        /// <param name="renderer">The renderer currently rendering VHDL files.</param>
        /// <param name="indentation">The indentation at the current location in the VHDL file.</param>
        public string BodyRegion(RenderStateProcess renderer, int indentation)
        {
            var initialdata = (Array)renderer.Process.SharedVariables.First(x => x.Name == "m_memory").DefaultValue;
            var size = initialdata.Length;
            var datawidth = VHDLHelper.GetBitWidthFromType(initialdata.GetType().GetElementType());

            var resetinitial = renderer.Process.LocalBusNames.Keys.Where(x => x.SourceType.Name == nameof(SME.Components.TrueDualPortMemory<int>.IReadResult)).SelectMany(x => x.Signals).First(x => x.Name == nameof(SME.Components.TrueDualPortMemory<int>.IReadResult.Data)).DefaultValue;
            var initialvalue = VHDLHelper.GetDataBitString(initialdata.GetType().GetElementType(), resetinitial, datawidth);

            var itemsPr18k = ((18 * 1024) + (datawidth - 1)) / datawidth;
            var in18kBlocks = (size + (itemsPr18k - 1)) / itemsPr18k;

            var fullAddressWidth = (int)Math.Ceiling(Math.Log(size, 2));

            var self = renderer.Process;
            var outabus = self.OutputBusses.First(x => renderer.Parent.GetLocalBusName(x, renderer.Process) == nameof(SME.Components.TrueDualPortMemory<int>.ReadResultA));
            var outbbus = self.OutputBusses.First(x => renderer.Parent.GetLocalBusName(x, renderer.Process) == nameof(SME.Components.TrueDualPortMemory<int>.ReadResultB));

            var inabus = self.InputBusses.First(x => renderer.Parent.GetLocalBusName(x, renderer.Process) == nameof(SME.Components.TrueDualPortMemory<int>.ControlA));
            var inbbus = self.InputBusses.First(x => renderer.Parent.GetLocalBusName(x, renderer.Process) == nameof(SME.Components.TrueDualPortMemory<int>.ControlB));

            string signaltemplate;
            string instancetemplate;
            string gluetemplate;
            string clocktemplate;
            int targetwidth;

            // Single 18k or single 36k item instantiation
            if (in18kBlocks <= 2)
            {
                var config = new BlockRamConfig(renderer, datawidth, datawidth * size, false);
                signaltemplate = GetSignalRegion(config, -1);

                var initlines = VHDLHelper.SplitDataBitStringToMemInit(
                    VHDLHelper.GetDataBitStrings(initialdata),
                    config.datawidth,
                    config.paritybits
                );

                targetwidth = config.realaddrwidth;
                instancetemplate = GetInstantiationRegion(config, renderer.Process.InstanceName, initialvalue, initlines.Item1, initlines.Item2, -1);
                gluetemplate = string.Empty;
                clocktemplate = string.Empty;

            }
            // Multi-unit instantiation
            else
            {
                var addrWidth = (int)Math.Floor(Math.Log(((36 * 1024) + (datawidth - 1)) / datawidth, 2));
                var itemsPrBlock = (int)Math.Pow(2, addrWidth);
                var blocks = (size + (itemsPrBlock - 1)) / itemsPrBlock;

                var sbsignals = new System.Text.StringBuilder();
                var sbinstances = new System.Text.StringBuilder();
                var sbglue = new System.Text.StringBuilder();

                var itemConfig = new BlockRamConfig(renderer, datawidth, itemsPrBlock * datawidth, true);
                sbsignals.Append(GetSignalRegion(itemConfig, -1, fullAddressWidth));
                sbsignals.AppendLine($"signal ADDRA_READ_internal: std_logic_vector({fullAddressWidth - 1} downto 0);");
                sbsignals.AppendLine($"signal ADDRB_READ_internal: std_logic_vector({fullAddressWidth - 1} downto 0);");

                for (var i = 0; i < blocks; i++)
                {
                    var config = new BlockRamConfig(renderer, datawidth, itemsPrBlock * datawidth, false);
                    sbsignals.Append(GetSignalRegion(config, i));

                    var initlines = VHDLHelper.SplitDataBitStringToMemInit(
                        VHDLHelper.GetDataBitStrings(initialdata, i * itemsPrBlock, itemsPrBlock),
                        config.datawidth,
                        config.paritybits
                    );

                    sbinstances.Append(GetInstantiationRegion(config, renderer.Process.InstanceName, initialvalue, initlines.Item1, initlines.Item2, i));

                    var indexAsBitString = VHDLHelper.GetDataBitString(i, fullAddressWidth - addrWidth);
                    indexAsBitString = indexAsBitString.Substring(indexAsBitString.Length - (fullAddressWidth - addrWidth));

                    sbglue.AppendLine($@"
ENA_internal_{i} <= '1' when (ENA_internal = '1') and (ADDRA_internal({fullAddressWidth - 1} downto {addrWidth}) = ""{indexAsBitString}"") else '0';
WEA_internal_{i} <= WEA_internal;
DIA_internal_{i} <= DIA_internal;
ADDRA_internal_{i} <= ADDRA_internal({addrWidth - 1} downto 0);

ENB_internal_{i} <= '1' when (ENB_internal = '1') and (ADDRB_internal({fullAddressWidth - 1} downto {addrWidth}) = ""{indexAsBitString}"") else '0';
WEB_internal_{i} <= WEB_internal;
DIB_internal_{i} <= DIB_internal;
ADDRB_internal_{i} <= ADDRB_internal({addrWidth - 1} downto 0);
                    ");
                }

                // Create the output driver
                sbglue.AppendLine(GenerateOutputSelector(self.InstanceName, "A", blocks, fullAddressWidth, addrWidth));
                sbglue.AppendLine(GenerateOutputSelector(self.InstanceName, "B", blocks, fullAddressWidth, addrWidth));

                targetwidth = fullAddressWidth;
                signaltemplate = sbsignals.ToString();
                instancetemplate = sbinstances.ToString();
                gluetemplate = sbglue.ToString();
                clocktemplate = $"ADDRA_READ_internal <= ADDRA_internal;{Environment.NewLine}    ADDRB_READ_internal <= ADDRB_internal;";
            }

            var addrpadding =
                fullAddressWidth < targetwidth
                ? string.Format("\"{0}\" & ", new string('0', (targetwidth - fullAddressWidth)))
                : string.Empty;

            var partialaddrsuffix =
                fullAddressWidth > targetwidth
                ? "_partial"
                : string.Empty;

            var template =
$@"
{signaltemplate}

begin

{instancetemplate}

{self.InstanceName}_Helper: process(RST,CLK, RDY)
begin
if RST = '1' then
    FIN <= '0';
elsif rising_edge(CLK) then
    FIN <= not RDY;
    {clocktemplate}
end if;
end process;

{gluetemplate}

ENA_internal <= ENB and {Naming.ToValidName(renderer.Parent.GetLocalBusName(inabus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Enabled)) };
WEA_internal <= (others => ENA_internal and {Naming.ToValidName(renderer.Parent.GetLocalBusName(inabus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.IsWriting)) });
DIA_internal <= std_logic_vector({ Naming.ToValidName(renderer.Parent.GetLocalBusName(inabus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Data)) });
ADDRA_internal <= std_logic_vector(resize(unsigned({ Naming.ToValidName(renderer.Parent.GetLocalBusName(inabus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Address)) }), {targetwidth}));
{ Naming.ToValidName(renderer.Parent.GetLocalBusName(outabus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IReadResult.Data)) } <= {renderer.Parent.VHDLWrappedTypeName(outabus.Signals.First())}(DOA_internal);

ENB_internal <= ENB and {Naming.ToValidName(renderer.Parent.GetLocalBusName(inbbus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Enabled)) };
WEB_internal <= (others => ENB_internal and {Naming.ToValidName(renderer.Parent.GetLocalBusName(inbbus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.IsWriting)) });
DIB_internal <= std_logic_vector({ Naming.ToValidName(renderer.Parent.GetLocalBusName(inbbus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Data)) });
ADDRB_internal <= std_logic_vector(resize(unsigned({ Naming.ToValidName(renderer.Parent.GetLocalBusName(inbbus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IControl.Address)) }), {targetwidth}));
{ Naming.ToValidName(renderer.Parent.GetLocalBusName(outbbus, self) + "_" + nameof(SME.Components.TrueDualPortMemory<int>.IReadResult.Data)) } <= {renderer.Parent.VHDLWrappedTypeName(outbbus.Signals.First())}(DOB_internal);

";

            return VHDLHelper.ReIndentTemplate(template, indentation);
        }
    }
}


text:
'use strict';

var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;

angular.module('status2App').factory('OpenTimeData', function ($q, $http, TimeUtils) {

    function prepareChartData(data) {
      var chartData = [];
      // for every year
      angular.forEach(data.years, function (year, yearIndex) {
        // for every slot (= day)
        angular.forEach(data[year], function (slotEntries, slotIndex) {
          var ts = new Date(year, 0, 1).getTime() + (MILLIS_PER_DAY * slotIndex);
          var tmpData = [];
          var slotDuration = 0;
          // if we don't have any entries for this day, we crate an empty entry
          if (slotEntries.length === 0) {
            chartData.push({
              date: ts,
              open: 0,
              close: 0,
              duration: 0,
              durationMs: 0
            });
          } else {
            // for every open/duration entry
            angular.forEach(slotEntries, function (entry, entryIndex) {
              slotDuration += entry.d;
              var close = entry.b + entry.d;
              tmpData.push({
                'date': ts,
                'open': TimeUtils.toHours(entry.b),
                'close': TimeUtils.toHours(close)
              });
            });
            // add the tmp data to the cart data and add the duration
            angular.forEach(tmpData, function (dataEntry, index) {
              dataEntry.duration = TimeUtils.toHours(slotDuration);
              // for the stats part
              dataEntry.durationMs = slotDuration;
              chartData.push(dataEntry);
            });
          }
        });
      });

      return chartData;
    }

    var srv = {
      _dataPromis: null,

      get: function () {

        if (srv._dataPromis) {
          return srv._dataPromis.promise;
        }

        srv._dataPromis = $q.defer();

        $http.get('/api/openStatistics').then(
          function (resp) {
            var data = resp.data;
            if (!data || !data.years) {
              srv._dataPromis.reject(new Error('Invalid opentime data.'));
              return;
            }

            srv._cache = prepareChartData(data);
            srv._dataPromis.resolve(srv._cache);
          },
          function (resp) {
            srv._dataPromis.reject(new Error('Error during opentime data request.'));
          });

        return srv._dataPromis.promise;
      }
    };

    return srv;
  }
);


text:
(function($){

    /**
     * Handles the display-all functionality and filtering
     */

    var display_inventory = {
        host: window.apiRoute + "/displayInventory/",
        inventory: false,
        customerSelector: null,
        consolidated: false,

        /**
         * Go fetch everything and get it set up
         */
        init: function() {
            navigation.setTitle("View Inventory");
            var self = this;

            $("#track_by").change(function() {
                $("#customer-filter").hide();
                $("#item-filter").hide();

                switch($("#track_by option:selected").val()) {
                    case "Customer":
                        $("#customer-filter").show();
                        $("#qr_button").removeClass("hidden");
                        break;
                    case "Product":
                        $("#item-filter").show();
                        $("#qr_button").removeClass("hidden");
                        break;
                    case "All":
                        self.showAllItems();
                        $("#qr_button").addClass("hidden");
                        break;
                    default:
                        break;
                }
            });

            // Setup customer search bar.
            $("#customer").autocomplete({
                minLength: 1,
                source: function(request, response) {
                    $.getJSON(window.apiRoute + "/customerAutoComplete/" + encodeURIComponent(request.term), response); // data = [{label:"item 1"}, {label:"item 2"}, ..]
                },
                select: function(event, ui) {
                    // ui { item { label, value } }
                    self.searchCustomer(ui.item.label);
                }
            });

            $("#customer").keypress(function(e) {
                if (e.which == 13) {
                    self.searchCustomer($("#customer").val());
                }
            });

            $("#search_customer_button").click(function() {
                self.searchItem($("#customer").val());
            });

            // Setup item search bar.
            $("#item").autocomplete({
                minLength: 1,
                source: function(request, response) {
                    $.getJSON(window.apiRoute + "/itemAutoComplete/" + encodeURIComponent(request.term), response); // data = [{label:"item 1"}, {label:"item 2"}, ..]
                },
                select: function(event, ui) {
                    // ui { item { label, value } }
                    self.searchItem(ui.item.label);
                }
            });

            $("#item").keypress(function(e) {
                if (e.which == 13) {
                    self.searchItem($("#item").val());
                }
            });

            $("#search_item_button").click(function() {
                self.searchItem($("#item").val());
            });

            // State
            var filter = "";
            var keyword = "";

            if (window.state && window.state.filter && window.state.keyword) {
                filter = window.state.filter || "";
                keyword = window.state.keyword || "";
            } else {
                var query = window.location.search.substring(1).split('&');
                var pair = query[0].split('=');

                filter = decodeURIComponent(pair[0]);
                keyword = decodeURIComponent(pair[1]);

                navigation.saveState({filter:filter, keyword:keyword});
            }

            // Show state
            switch (filter.toLowerCase()) {
                case "customer":
                    $("#track_by option:contains('Customer')").prop("selected", true);
                    $("#track_by").trigger("change");
                    $("#customer").val(keyword);
                    this.searchCustomer(keyword);
                    break;
                case "product":
                    $("#track_by option:contains('Product')").prop("selected", true);
                    $("#track_by").trigger("change");
                    $("#item").val(keyword);
                    this.searchItem(keyword);
                    break;
                case "all":
                    if (keyword.toLowerCase() == "true") {
                        $("#track_by option:contains('All')").prop("selected", true);
                        $("#track_by").trigger("change");
                        this.showAllItems();
                    }
                    break;
                default:
                    break;
            }
        },

        searchItem: function(keyword) {
            if (!keyword) return;
            this.hideError();

            //console.log("Search product: " + keyword); return;
            var self = this;

            $.getJSON(window.apiRoute + "/searchItem/" + encodeURIComponent(keyword), function(data) {
                if (!data.length || data[0] === null) {
                    self.showNotFound();
                    return;
                }

                self.inventory = data;
                self.display_inventory();
                $("#customer").val("");
                navigation.saveState({filter:"product", keyword:keyword});
            }).fail(function() {
                self.showError("Failed to search for product: " + keyword + ".");
            });
        },

        searchCustomer: function(keyword) {
            if (!keyword) return;
            this.hideError();

            //console.log("Search customer: " + keyword); return;
            var self = this;

            $.getJSON(window.apiRoute + "/searchCustomer/" + encodeURIComponent(keyword), function(data) {
                if (!data.length || data[0] === null) {
                    self.showNotFound();
                    return;
                }

                self.inventory = data;
                self.display_inventory();
                $("#item").val("");
                navigation.saveState({filter:"customer", keyword:keyword});
            }).fail(function() {
                self.showError("Failed to search for customer: " + keyword + ".");
            });
        },

        showAllItems: function() {
            this.hideError();
            var self = this;

            $.getJSON( this.host, function( data ) {
                if( data && data.length && data[0] !== null){
                    self.inventory = data;
                    //self.consolidate_inventory();
                    self.display_inventory();
                    $("#customer").val("");
                    $("#item").val("");
                    navigation.saveState({filter:"all", keyword:"true"});
                } else {
                    self.showNotFound();
                }
            }).fail( function(response){
                self.showError("Failed to show all inventory: " + response + ".");
            });
        },

        showNotFound: function() {
            $(".inventory-container")
                .empty()
                .html("
No inventory found.");
        },

        /**
         * Consolidate all of the items by product id
         */
        /*consolidate_inventory: function() {
         this.consolidated = new Array();
         if( !this.inventory || !this.inventory.length )
         return;
         for( var i = 0; i < this.inventory.length; ++i ){
         var found = false;
         for( var j = 0; j < this.consolidated.length; ++j ){
         if( this.consolidated[j].ProductID == this.inventory[i].ProductID ){
         found = true;
         this.consolidated[j].Runs.push( this.inventory[i] );
         this.consolidated[j].Total += this.inventory[i].Amount;
         this.consolidated[j].Runs.sort( function(a, b){ return a.Date.localeCompare( b.Date ) } );
         break;
         }
         }
         if( !found ){
         this.consolidated.push({
         ProductID: this.inventory[i].ProductID,
         Total: this.inventory[i].Amount,
         Runs: [ this.inventory[i] ]
         });
         }
         }
         },*/

        /**
         * Output all of the items to the screen
         */
        display_inventory: function() {

            //if( !this.consolidated || !this.consolidated.length )
            //    return;

            var inventory_container = $( '.inventory-container' );
            inventory_container.empty();

            //var customer_filter_container = $( '.filter.customer');
            //customer_filter_container.empty();

            for( var i = 0; i < this.inventory.length; ++i ){

                //var latest_run = this.inventory[i].LastRunDate;
                //var concatenated_customer = this.inventory[i].Runs[0].Customer.replace(/ /g,"_");

                var ProductID = this.inventory[i].ProductID;
                var ProductName = this.inventory[i].ProductName;
                var TotalQuantity = this.inventory[i].TotalQuantityAvailable;

                var inventory_item = "
";
                inventory_item +=
                    "
"
                    + "

No Image

"
                    + "" + this.inventory[i].ProductName + ""
                    + "
";
                inventory_item += "
" +
                    "<button class='btn btn-default' onclick='gotoAddInventory(" + ProductID + "," + "\"" + ProductName + "\"" + ")' type='button'>Add</button>";

                inventory_item += "<button class='btn btn-default' onclick='gotoPullInventory(" + ProductID + "," + "\"" + ProductName + "\"" + "," + TotalQuantity + ")' type='button'>Pull</button>
";
                if( this.inventory[i].LastRunInitialQuantity )
                    inventory_item += "
Last run: " + this.inventory[i].LastRunDate + " (+" + this.inventory[i].LastRunInitialQuantity + ")
";
                else
                    inventory_item += "
No runs yet
";
                inventory_item += "
" + TotalQuantity + "
";
                inventory_item += "
";

                inventory_container.append( inventory_item );

                /*customer_filter_container.append(
                 "<option value='" + concatenated_customer + "'>" +
                 this.inventory[i].Runs[0].Customer +
                 "</option>"*/
            }

            //Fetch the thumbnails
            $('.detail-view').each(function(){
                var id = $( this).data('id');
                var self = this;

                if( !id )
                    return;

                var thumbSource = navigation.makeImageURL( id );
                navigation.checkImage( thumbSource,
                    function(){
                        $( self ).find(".thumbnail").html( "" );
                    },
                    function(){}
                );
            });

            //this.setup_customer_select_menu();
            this.setup_links();
        },

        /**
         * Set up the filter actions for the customer select filter
         */
        setup_customer_select_menu: function() {
            var select_menu = $( '.filter.customer' );

            select_menu.change( function(){

                var selection = select_menu.val()

                if( selection == "0" ){
                    $('.inventory-item').show();
                } else {
                    $( '.inventory-item').hide();
                    $( '.'+selection).show();
                }

            });
        },

        setup_links: function() {

            $( '.display-inventory-container').find( '.detail-view').on( 'touchend click', function( evt ){

                evt.preventDefault();

                var product_id = $( this).data( 'id' );

                navigation.go("ItemDetailView.html", {
                    ProductID: product_id
                });

                /*$('#main_cont').load('ItemDetailView.html', function(){
                 detailView.init( product_id );
                 });*/

            });
        },

        // Show the error message on top of the page.
        // msg: The error message to show.
        showError: function (msg) {
            $("#error").removeClass("hidden").text(msg);
        },

        // Hide the error message.
        hideError: function () {
            $("#error").addClass("hidden");
        }

    };

    display_inventory.init();

})( jQuery );

/**
 * Created by Kun on 6/18/2015.
 */

var gotoPullInventory = function (pid, pname, tlq) {
    navigation.go("ViewCarts.html", {
        ProductID: pid,
        ProductName: pname,
        TotalQuantity: tlq
    });
};
var gotoAddInventory = function (pid, pname) {
    navigation.go("AddInventory.html", {
        ProductID: pid,
        ProductName: pname || ""
    });
};

var qrCode = function () {
    var filter = "";
    var keyword = null;

    switch($("#track_by option:selected").val()) {
        case "Customer":
            filter = "customer";
            keyword = encodeURIComponent($("#customer").val());
            break;
        case "Product":
            filter = "product";
            keyword = encodeURIComponent($("#item").val());
            break;
        default:
            break;
    }

    if (!filter || !keyword) return;

    navigation.go("ShowQRCode.html", {
        Text: window.location.protocol + "//" + window.location.hostname + "/" + "DisplayInventory?" + filter + "=" + keyword
    });
};


text:
{% import "_helpers/_card.html" as card_helpers %}

{{ card_helpers.render_button('Google Docs Spreadsheet', 'Use the Google Docs importer', url_for(target, short_name=project.short_name, type='gdocs'), 'fa-google') }}


text:
public class threads_001 {
	public static void main(String[] args) {
		//double  t0 = System.currentTimeMillis();
		long acc = 0;
		int L = 10000000;
		int n = 2 * L;

		for (int i = 0; i <= n; ++i) acc += i;

		//double  t1 = System.currentTimeMillis();
		//System.out.println("Time elapsed single-thread version Java: " + (t1 - t0) / 1000);
		System.out.println("Java");
		System.out.println(acc);
	}
}


text:
/*
**      @author : Nicolas Turlais : nicolas-at-insipi.de
**      @version : V0.4 - Feb 2014
**      @license : Licensed under CCAttribution-ShareAlike
**      @website : http://chocolat.insipi.de
**/

; (function($, window, document, undefined) {
    var calls = 0;
    var defaults = {
        container         : window,
        linksContainer    : '.chocolat-links',
        imageSelector     : '.chocolat-image',
        fullWindow        : false, // false, 'contain', or 'cover'
        fullScreen        : false,
        displayAsALink    : false,
        loop              : false,
        linkImages        : true,
        setTitle          : '',
        separator1        : '|',
        separator2        : '/',
        mobileBreakpoint  : 480,
        setIndex          : 0,
        firstImage        : 0,
        lastImage         : false,
        currentImage      : false,
        initialized       : false,
        timer             : false,
        timerDebounce     : false,
        images            : []
    };

    function Chocolat(element, settings) {
        var that = this;

        this.settings  = settings;
        this._defaults = defaults;
        this.elems     = {};

        element.find(this.settings.imageSelector).each(function () {
            that.settings.images.push({
                title  : $(this).attr('title'),
                src    : $(this).attr('href'),
                height : false,
                width  : false
            });
        });

        if(settings.displayAsALink){
            this.createLink().off('click').on('click', function(e){
                that.init(that.settings.firstImage);
                e.preventDefault();
            });

            element.hide();
        }
        else{
            element.find(this.settings.imageSelector).each(function (i) {
                $(this).off('click').on('click', function(event){
                    that.init(i);
                    event.preventDefault();
                });
            });
        }

        //return an API YEAH!
        return {
            open : function(i){
                var i = i || 0;
                that.init(i);
            },

            close : function(){
                that.close();
            },

            next : function(){
                that.change(1);
            },

            prev : function(){
                that.change(-1);
            },

            goto : function(i){ // open alias
                that.init(i);
            },
            current : function(){
                return that.currentImage;
            }
        };
    }

    Chocolat.prototype = {
        init : function(i) {
            if(!this.settings.initialized){
                this.setDomContainer();
                this.markup();
                this.events();
                this.settings.lastImage   = this.settings.images.length - 1;
                this.settings.initialized = true;
            }

            this.load(i);
        },

        preload : function(i, callback) {
            callback         = this.optFuncParam(callback);
            imgLoader        = new Image();
            imgLoader.onload = $.proxy(callback, this, i, imgLoader);
            imgLoader.src    = this.settings.images[i].src;
        },

        load : function(i) {

            if(this.settings.fullScreen){
                this.openFullScreen();
            }

            if(this.settings.currentImage === i){
                return;
            }

            this.elems.overlay.fadeIn(800);

            this.settings.timer = setTimeout(function(){
                $.proxy(this.elems.loader.fadeIn(), this)
            },400);
            this.preload(i,this.place);
        },

        place : function(i, imgLoader) {
            var that = this;

            this.settings.currentImage = i;
            this.description();
            this.pagination();
            this.breakpoint();

            this.elems.img.fadeTo(200,0, function() {
                that.storeImgSize(imgLoader, i);
                fitting = that.fit(
                    that.settings.images[i].height,
                    that.settings.images[i].width,
                    $(that.settings.container).height(),
                    $(that.settings.container).width(),
                    that.getOutMarginH(),
                    that.getOutMarginW()
                );
                that.center(
                    fitting.width,
                    fitting.height,
                    fitting.left,
                    fitting.top,
                    150,
                    that.appear(i)
                );
                that.arrows();
            });
        },

        appear : function(i) {
            var that = this;
            clearTimeout(this.settings.timer);

            this.elems.loader.stop().fadeOut(300, function() {
                that.elems.img
                    .attr('src', that.settings.images[i].src)
                    .fadeTo(400,1);
            });
        },

        fit : function(imgHeight, imgWidth, holderHeight, holderWidth, holderOutMarginH, holderOutMarginW) {
            var holderGlobalWidth = holderWidth-holderOutMarginW;
            var holderGlobalHeight = holderHeight-holderOutMarginH;
            var holderGlobalRatio = (holderGlobalHeight / holderGlobalWidth);
            var holderRatio = (holderHeight / holderWidth);
            var imgRatio = (imgHeight / imgWidth);

            if(this.settings.fullWindow == 'cover') {
                if(imgRatio < holderRatio) {
                    height = holderHeight;
                    width = height / imgRatio;

                }
                else {
                    width = holderWidth;
                    height = width * imgRatio;
                }
            }
            else {
                if(imgRatio>holderGlobalRatio) {
                    height = holderGlobalHeight;
                    width = height / imgRatio;
                }
                else {
                    width = holderGlobalWidth;
                    height = width * imgRatio;
                }
                if(!this.settings.fullWindow && (width >= imgWidth || height >= imgHeight)) {
                    width=imgWidth;
                    height=imgHeight;
                }
            }

            return {
                'height' : height,
                'width'  : width,
                'top'    : (holderHeight - height)/2,
                'left'   : (holderWidth - width)/2
            }
        },

        center : function(width, height, left, top, duration, callback) {
            callback = this.optFuncParam(callback);
            this.elems.content.animate({
                'width'  :width,
                'height' :height,
                'left'   :left,
                'top'    :top
            }, duration, $.proxy(callback(), this))
            .css('overflow', 'visible');
        },

        change : function(signe) {
            var requestedImage = this.settings.currentImage + parseInt(signe);
            if(requestedImage > this.settings.lastImage) {
                if(this.settings.loop){
                    this.load(0);
                }
            }
            else if(requestedImage < 0) {
                if(this.settings.loop) {
                    this.load(this.settings.lastImage);
                }
            }
            else {
                this.load(requestedImage);
            }
        },

        arrows: function() {
            if(this.settings.loop) {
                $([this.elems.left[0],this.elems.right[0]])
                    .css('display','block');
            }
            else if(this.settings.linkImages) {
                // right
                if(this.settings.currentImage == this.settings.lastImage) {
                    this.elems.right.fadeOut(300);
                }
                else {
                    this.elems.right.fadeIn(300);
                }
                // left
                if(this.settings.currentImage == 0) {
                    this.elems.left.fadeOut(300);
                }
                else {
                    this.elems.left.fadeIn(300);
                }
            }
            else {
                $([this.elems.left[0],this.elems.right[0]])
                    .css('display','none');
            }
        },

        description : function() {
            var that = this;
            this.elems.description.fadeTo(200, 0, function() {
                $(this)
                    .html(that.settings.images[that.settings.currentImage].title)
                    .fadeTo(400,1);
            });
        },

        pagination : function() {
            var that      = this;
            var last      = this.settings.lastImage + 1;
            var position  = this.settings.currentImage + 1;
            var separator = (this.settings.setTitle == '') ? '' : this.settings.separator1;

            this.elems.pagination.fadeTo(200, 0, function() {
                $(this)
                    .html(that.settings.setTitle + ' '
                          + separator + ' '
                          + position
                          + that.settings.separator2
                          + last)
                    .fadeTo(400,1);
            });
        },

        breakpoint : function() {
            if($(this.settings.container).width() < this.settings.mobileBreakpoint) {
                this.elems.domContainer.addClass('chocolat-mobile');
            }
            else {
                this.elems.domContainer.removeClass('chocolat-mobile');
            }
        },

        storeImgSize : function(img, i) {
            if(!this.settings.images[i].height || !this.settings.images[i].width){
                this.settings.images[i].height = img.height;
                this.settings.images[i].width  = img.width;
            }
        },

        close : function() {
            var els = [
                this.elems.overlay[0],
                this.elems.loader[0],
                this.elems.content[0]
            ];
            var that = this;
            $.when($(els).fadeOut(200)).then(function () {
                that.elems.domContainer.removeClass('chocolat-open chocolat-mobile chocolat-in-container chocolat-cover');
            });
            this.settings.currentImage = false;
            this.settings.initialized = false;
        },

        getOutMarginW : function() {
            var left  = this.elems.left.outerWidth() - this.elems.left.width();
            var right = this.elems.right.outerWidth() - this.elems.right.width();
            return left + right;
        },

        getOutMarginH : function() {
            return this.elems.top.outerHeight() + this.elems.bottom.outerHeight();
        },

        markup : function() {
            this.elems.domContainer.addClass('chocolat-open');
            if(this.settings.fullWindow == 'cover') {
                this.elems.domContainer.addClass('chocolat-cover');
            }
            if(this.settings.container !== window) {
                this.elems.domContainer.addClass('chocolat-in-container');
            }
            var that = this;

            this.elems.overlay = $('<div/>', {
                'class' : 'chocolat-overlay'
            }).appendTo(this.elems.domContainer);

            this.elems.loader = $('<div/>', {
                'class' : 'chocolat-loader'
            }).appendTo(this.elems.domContainer);

            this.elems.content = $('<div/>', {
                'class' : 'chocolat-content',
                'id' : 'chocolat-content-' + this.settings.setIndex
            }).appendTo(this.elems.domContainer);

            this.elems.img = $('<img/>', {
                'class' : 'chocolat-img',
                'src' : ''
            }).appendTo(this.elems.content);

            this.elems.top = $('<div/>', {
                'class' : 'chocolat-top'
            }).appendTo(this.elems.content);

            this.elems.left = $('<div/>', {
                'class' : 'chocolat-left'
            }).appendTo(this.elems.content);

            this.elems.right = $('<div/>', {
                'class' : 'chocolat-right'
            }).appendTo(this.elems.content);

            this.elems.bottom = $('<div/>', {
                'class' : 'chocolat-bottom'
            }).appendTo(this.elems.content);

            this.elems.description = $('<span/>', {
                'class' : 'chocolat-description'
            }).appendTo(this.elems.bottom);

            this.elems.pagination = $('<span/>', {
                'class' : 'chocolat-pagination'
            }).appendTo(this.elems.bottom);

            this.elems.close = $('<span/>', {
                'class' : 'chocolat-close'
            }).appendTo(this.elems.top);
        },

        createLink : function() {
            var li = $('<li/>').appendTo(this.settings.linksContainer);

            return $('<a/>', {
                    'id'    : 'chocolat-set-'+this.settings.setIndex,
                    'class' : 'chocolat-link',
                    'href'  : '#'
                })
                .html(this.settings.setTitle)
                .appendTo(li);
        },

        openFullScreen : function() {
            var docElm = document.documentElement;
            if (docElm.requestFullscreen) {
                docElm.requestFullscreen();
            }
            else if (docElm.mozRequestFullScreen) {
                docElm.mozRequestFullScreen();
            }
            else if (docElm.webkitRequestFullScreen) {
                docElm.webkitRequestFullScreen();
            }
        },

        events : function() {
            var that = this;

            $(document).off('keydown').on('keydown', function(e) {
                if(e.keyCode == 37) {
                    that.change(-1);
                }
                else if(e.keyCode == 39) {
                    that.change(1);
                }
                else if(e.keyCode == 27) {
                    that.close();
                }
            });
            $(this.elems.content).find('.chocolat-right')
                .off('click')
                .on('click', function() {
                    that.change(+1);
            });

            $(this.elems.content).find('.chocolat-left')
                .off('click')
                .on('click', function() {
                    that.change(-1);
            });

            $([this.elems.overlay[0], this.elems.close[0]])
                .off('click')
                .on('click', function() {
                    that.close();
            });

            $(window).on('resize', function() {
                if(!that.settings.initialized){
                    return;
                }
                that.debounce(50, function() {
                    that.breakpoint();
                    fitting = that.fit(
                        that.settings.images[that.settings.currentImage].height,
                        that.settings.images[that.settings.currentImage].width,
                        $(that.settings.container).height(),
                        $(that.settings.container).width(),
                        that.getOutMarginH(),
                        that.getOutMarginW()
                    );
                    that.center(fitting.width, fitting.height, fitting.left, fitting.top, 150);
                });
            });
        },

        setDomContainer : function() {
            // if container == window
            // domContainer = body

            if(typeof this.settings.container === 'object') {
                this.elems.domContainer = $('body');
            }
            else {
                this.elems.domContainer = $(this.settings.container);
            }

        },

        debounce: function(duration, callback) {
            clearTimeout(this.settings.timerDebounce);
            this.settings.timerDebounce = setTimeout(function() {
                callback();
            }, duration);
        },

        optFuncParam: function(f) {
            if(!$.isFunction(f)){return function(){};}
            else{return f;}
        }
    };

    $.fn['Chocolat'] = function (options) {
        return this.each(function() {

            calls++;

            var settings = $.extend(true, {}, defaults, options, {setIndex:calls} );

            if (!$.data(this, 'api-chocolat')) {
                $.data(this, 'api-chocolat',
                    new Chocolat($(this), settings)
                );
            }
        });
    }
})( jQuery, window, document );


text:
'use strict'

const Boom = require('boom')

const Model = require('./model')

const internals = {}

module.exports = function (options) {
  internals.model = Model(options)

  return {
    create,
    read,
    update,
    remove,
    list
  }
}

function create (request, reply) {
  return internals.model.create(request.payload)
    .then(id => reply({ ok: true, message: `Created user with id ${id}` }).code(201))
    .catch(err => reply(Boom.wrap(err)))
}

function read (request, reply) {
  const id = request.params.id
  return internals.model.read(id)
    .then(reply)
    .catch(err => reply(Boom.wrap(err)))
}

function update (request, reply) {
  const id = request.params.id
  const payload = request.payload
  return internals.model.update(id, payload)
    .then(user => reply({ ok: true, message: `Updated user ${user.id}` }))
    .catch(err => reply(Boom.wrap(err)))
}

function remove (request, reply) {
  const id = request.params.id
  return internals.model.remove(id)
    .then(() => reply().code(204))
    .catch(err => reply(Boom.wrap(err)))
}

function list (request, reply) {
  return internals.model.list(request.query)
    .then(reply)
    .catch(err => reply(Boom.wrap(err)))
}


text:
package sbttest.multitest

import scala.scalajs.js

import org.junit.Test
import org.junit.Assert.assertTrue

class JUnitBootstrapTest {
  @Test def testClassBootstrap(): Unit = {
    // This tests that the Scala.js JUnit runtime is working
    assertTrue(true)
  }
}

object JUnitBootstrapTest extends js.JSApp {
  def main(): Unit = {
    // This should not fail
    JUnitUtil.loadBootstrapper("sbttest.multitest.JUnitBootstrapTest")
  }
}


text:
<?php

namespace simplator\medialib;

class Module extends \simplator\base\Module
{
    public $controllerNamespace = 'simplator\medialib\controllers';

	public $mediaFolder = 'media';

	public $engines = [];

    static protected $_filetypes=[];

    static protected $_mimetypes=[];

	public $defaultStorage = 'local';

	protected $_storage;

	public $models;

    public function init()
    {
        parent::init();

		if ( ! $this->_storage )
			die('Need set storage for medialib');

        $this->setMimetypes([
            'file' => [ '*/*', 'asd/*'],
//            'image' => ['image/*'],
        ]);

		if ( ! isset($this->models['folder']) )
			$this->models['folder'] = 'simplator\\medialib\\models\\Folder';

		models\Entity::$models = $this->models;

        // custom initialization code goes here
    }

    /**
     * @var string The prefix for user module URL.
     * @See [[GroupUrlRule::prefix]]
     */
    public $urlPrefix = 'medialib';

    /** @var array The rules to be used in URL management. */
    public $urlRules = [
        'pic<id:\d+>/<size:\w+>'	=> 'file/picture',
        'pic<id:\d+>'				=> 'file/picture',
		'folder'					=> 'json/index',
        'picture/<id:\d+>'			=> 'picture/view',
    ];

    public function setFiletypes($list)
    {
        foreach ($list as $t=>$c)
        {
            self::$_filetypes[$t]=$c;
        }
    }

    public function setMimetypes($list)
    {
        foreach ($list as $t=>$c)
        {
            if (!is_array($c))
                throw new \yii\base\NotSupportedException("Filetype must be array");

            foreach ($c as $i)
                self::$_mimetypes[$i]=$t;
        }
    }

    public function getFiletypes()
    {
        return self::$_filetypes;
    }

    public function getMimetypes()
    {
        return self::$_mimetypes;
    }

	public function getStorage($name = false)
	{
		if ( $name === true)
			return $this->_storage;

		if ( $name )
			if ( isset($this->_storage[$name]) )
				return $this->_storage[$name];
			else
				return null;

		return $this->_storage[$this->defaultStorage];
	}

	public function setStorage($value)
	{
		/*
		if ( is_string($value) )
			$value = [
				'default' => [
					$value
				]
			];

		if ( ! is_array($value) )
			die('bad storage config');
		*/
		$this->_storage = $value;

		foreach ($this->_storage as $name=>$cfg)
			$this->_storage[$name] = \Yii::createObject($cfg);
	}

    public function typeByMime($mime)
    {
        $types = [];

        krsort(self::$_mimetypes);

        $sepmime=explode('/', $mime);

        foreach (self::$_mimetypes as $t=>$p)
        {
            $arr=explode('/', $t);
            if ($arr[0]=='*') return $p;
            if ($arr[1]=='*' && $sepmime[0]==$arr[0]) return $p;
            if ($t==$mime) return $p;
        }
        return 'file';
    }
}