text:
[![Downloads](https://img.shields.io/npm/dm/blazy.svg?style=flat)](https://www.npmjs.com/package/blazy)
[![Latest Stable Version](https://img.shields.io/npm/v/blazy.svg?style=flat)](https://www.npmjs.com/package/blazy)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dinbror/blazy/blob/master/LICENSE)

bLazy is a lightweight script for lazy loading and multi-serving images, iframes, videos and more (less than 1.4KB minified and gzipped). It's written in pure JavaScript why it doesn't depend on 3rd-party libraries such as jQuery. It lets you lazy load and multi-serve your images so you can save bandwidth and server requests. The user will have faster load times and save data usage if he/she doesn't browse the whole page.

**Table of Contents**

1. [Demo](https://github.com/dinbror/blazy#demo)

2. [Usage & API](https://github.com/dinbror/blazy#usage--api)

3. [Why be lazy?](https://github.com/dinbror/blazy#why-be-lazy)

4. [Changelog](https://github.com/dinbror/blazy#changelog)

5. [License](https://github.com/dinbror/blazy#license)

## DEMO ##
[http://dinbror.dk/blazy/](http://dinbror.dk/blazy/?ref=github)

More examples:
[http://dinbror.dk/blazy/examples/](http://dinbror.dk/blazy/examples/?ref=github)

Codepen playground:
http://codepen.io/dinbror/pen/HzCAJ

## USAGE & API ##
[http://dinbror.dk/blog/blazy/](http://dinbror.dk/blog/blazy/?ref=github)

### INSTALL
You can install blazy.js with npm:
``` npm
npm install blazy --save
```
or bower:
``` bower
bower install blazy --save
```

### CDN
If you don't want to host the script yourself you can link to the latest minified file:
`//cdn.jsdelivr.net/blazy/latest/blazy.min.js` on [jsDelivr](http://www.jsdelivr.com/#!blazy).
Exchange `latest` with the specific version number if you want to lock it in.

## WHY BE LAZY? ##
* bLazy is used on big sites with millions of monthly visitors so it has been tested out in the real world.
* bLazy is written in pure JavaScript why it doesn't depend on 3rd-party libraries such as jQuery.
* bLazy is lightweight, less than 1.4KB and less than 1.25KB if you don't need IE7- support.
* bLazy is very fast. It has focus on performance why it also auto-destroys when it's done lazy loading.
* bLazy can lazy load all types of images including background images.
* bLazy is future-proof. It supports srcset and the picture element.
* bLazy can serve retina images on retina devices.
* bLazy can lazy load everything with a src like iframes, HTML5 videos, scripts, unity games etc.
* bLazy supports all browsers used today including legacy browsers like IE7 and 8.
* bLazy supports all main module formats like AMD, CommonJS and globals.

## CHANGELOG
### v 1.6.2 (2016/05/09) ###
* Fixed bug introduced in v.1.6.0, not using retina/breakpoint src [#90](https://github.com/dinbror/blazy/issues/90).

### v 1.6.1 (2016/05/02) ###
* Implemented a workaround for onload/onerror bug introduced in chrome v50, [LINK](https://productforums.google.com/forum/#!topic/chrome/p51Lk7vnP2o). Fixed [#85](https://github.com/dinbror/blazy/issues/85).

### v 1.6.0 (2016/04/30) ###
* Added support for srcset and the picture element. Fixed [#69](https://github.com/dinbror/blazy/issues/69), [#75](https://github.com/dinbror/blazy/issues/75), [#77](https://github.com/dinbror/blazy/issues/77) and [#82](https://github.com/dinbror/blazy/issues/82).
* Added support for lazy load of videos with sources. Fixed [#81](https://github.com/dinbror/blazy/issues/81).
* Bugfix. Ensuring that error and success classes won't be added multiple times. Fixed [#84](https://github.com/dinbror/blazy/issues/84).
* Marked `breakpoints` as obsolete. Will be removed in upcoming version. Use srcset and/or the picture element instead.

### v 1.5.4 (2016/03/06) ###
* Fixed two Safari bugs: [#66](https://github.com/dinbror/blazy/issues/66) and [#78](https://github.com/dinbror/blazy/issues/78). Ensuring "DOM ready".

### v 1.5.3 (2016/03/01) ###
* Implemented [#30](https://github.com/dinbror/blazy/pull/30). Keeping data source until success.
* Fixed [#47](https://github.com/dinbror/blazy/pull/47). After implementing #30 you can now get the image src and more information in the error/success callbacks.
* Added example page to repo `/example/index.html`.

### v 1.5.2 (2015/12/01) ###
* Fixed minor bug where the error class was added when calling `revalidate()`.
* Minor refactoring

### v 1.5.1 (2015/11/14) ###
* Fixed toArray function so it now works in IE7 + 8 again. Bug introduced in 1.4.0. Thanks for reporting [@imcotton](https://github.com/imcotton).
* Fixed [#41](https://github.com/dinbror/blazy/pull/41). Added options for validate and saveViewportOffset delay.

### v 1.5.0 (2015/10/30) ###
* Added new feature. Now you can lazy load everything with a src attribute like iframes, unity games etc.
* Fixed [#45](https://github.com/dinbror/blazy/issues/45). Now you can pass an option if you always want to load invisible images/elements.
* Fixed [#49](https://github.com/dinbror/blazy/issues/49). Expanded the `load` function so it's now possible to pass a list of elements instead of only one element. Tested with getElementById, getElementsByClassName, querySelectorAll, querySelector and jQuery selector.
* Fixed [#63](https://github.com/dinbror/blazy/issues/63).

### v 1.4.1 (2015/10/12) ###
* Fixed [#60](https://github.com/dinbror/blazy/issues/60). An "Uncaught TypeError" when options is null introduced in the refactoring in version 1.4.0.

### v 1.4.0 (2015/09/28) ###
* Fixed [#56](https://github.com/dinbror/blazy/issues/56). Now it's possible to create multiple versions of blazy without overriding options.

### v 1.3.1 (2015/02/01) ###
* Added support for CommonJS-like environments that support module.exports like [node](http://nodejs.org/).

### v 1.3.0 (2015/01/23) ###
* Fixed [#34](https://github.com/dinbror/blazy/issues/34). Expanded public `load` function with force attribute, so you can force hidden images to be loaded.
* Fixed [#24](https://github.com/dinbror/blazy/issues/24), [#32](https://github.com/dinbror/blazy/issues/32) and [#35](https://github.com/dinbror/blazy/issues/35). Updated "elementInView" function with intersection check. Thanks @teohhanhui.

### v 1.2.2 (2014/05/04) ###
* Fixed [#15](https://github.com/dinbror/blazy/issues/15), when you resize the browser window in another tab bLazy didn't trigger new images in view. Thanks joshribakoff.

### v 1.2.1 (2014/03/23) ###
* When lazy loading background images it now only updates the background-image css attribute. Thanks Saku.

### v 1.2.0 (2014/02/15) ###
* Important note: renamed option multi to `breakpoints` because it's much more descriptive.
* Added [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) support.
* Minor refactoring.

### v 1.1.3 (2014/01/21) ###
* Fixed hardcoded retina check (isRetina = true).
* Fixed "Uncaught TypeError" when data-src is null. Instead it'll trigger the `error` callback.

### v 1.1.2 (2014/01/03) ###
* New feature: After many requests I added the possibility to handle retina images (if you're not doing retina-first).
* New feature: Now you can also lazy load background images.
* Added new option, `separator`. Used if you want to pass retina images, default separator is '|'. (data-src="image.jpg|image@2x.jpg").

### v 1.1.1 (2013/12/27) ###
* Fixed #1, resize/scroll events may be detached when adding elements by ajax.
* Added new option, `errorClass`. Classname an image will get if something goes wrong, default is 'b-error'.
* Renamed option loadedClass to `successClass` so naming is aligned. Default is still 'b-loaded'.

### v 1.1.0 (2013/11/22) ###
* Renamed success callback from onLoaded to `success`.
* Added onerror callback; `error`.
* Added the possibility to pass multiple containers instead of one.

### v 1.0.5 (2013/10/7) ###
* Fixed "Uncaught TypeError" when container isn't default (window).

### v 1.0.4 (2013/8/29) ###
* Added null check so we won't try to load an image if it's missing a data source.

### v 1.0.3 (2013/8/27) ###
* Added new option, `loadedClass`. Classname an image will get when loaded.
* Added support for horizontal lazy loading.
* Reduced throttle time for validate.

### v 1.0.2 (2013/8/7) ###
* Fixed typo in unbindEvent function.
* Added support for IE7 as promised (fallback for querySelectorAll).

### v 1.0.1 (2013/8/6) ###
* Performance improvements.
* Added throttle function to ensure that we don't call resize/scroll functions too often.
* Cleaning image markup when image has loaded.

##LICENSE:
Copyright (c) 2013-16 Bjørn Klinggaard. Licensed under the [The MIT License (MIT)](http://opensource.org/licenses/MIT).


text:
package dimitris.android.chessviews;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import dimitris.android.app.PlayPuzzleActivity;
import dimitris.chess.core.ChessPuzzle;

public class BoardContainerView extends View implements View.OnTouchListener {

    protected DrawableBoard chessBoard;
    private MoveDispatcher moveDispatcher;
    private int squareSize;
    private int padding;
    private Typeface typeface;

    public BoardContainerView(Context context) {
        super(context);
        setOnTouchListener(this);
        chessBoard = new DrawableBoard(context);
        moveDispatcher = new MoveDispatcher(chessBoard,this);
    }

    public BoardContainerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setOnTouchListener(this);
        chessBoard = new DrawableBoard(context);
        moveDispatcher = new MoveDispatcher(chessBoard,this);
    }

    public BoardContainerView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        setOnTouchListener(this);
        chessBoard = new DrawableBoard(context);
        moveDispatcher = new MoveDispatcher(chessBoard,this);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        chessBoard.draw(canvas);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        int min = Math.min(getMeasuredWidth(),getMeasuredHeight());
        setMeasuredDimension(min,min);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        resizeBoard(w,h);
    }

    private void resizeBoard(int width, int height){
        int min = (width < height) ? width : height;
        squareSize = min / 8;
        padding = (min % 8) / 2;

        if(chessBoard.getSquareSize() != squareSize){
            chessBoard.setSquareSize(squareSize);
            chessBoard.setBounds(0,0,8 * squareSize,8 * squareSize);
            invalidate();
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {

        if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
            int xCoord = (int) motionEvent.getX();
            int yCoord = (int) motionEvent.getY();

            int row = (yCoord - padding) / squareSize;
            int col = (xCoord - padding) / squareSize;

            moveDispatcher.squareClickedAt(row, col);
            invalidate();
        }

        return true;
    }

    public void setCurrentPuzzle(ChessPuzzle puzzle){
        initializeFontIfNeeded();
        chessBoard.setPosition(puzzle.getFen());
        invalidate();
    }

    private void initializeFontIfNeeded() {
        if(typeface == null)
            typeface = FontLoader.loadDefaultFont(getContext());
    }

    public void moveDetected(String source, String dest){
        PlayPuzzleActivity parent = (PlayPuzzleActivity) this.getContext();
        parent.onMoveDetected(source, dest);
    }

    public void undoMove(){
        chessBoard.undoMove();
        invalidate();
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _PDF_TOKENIZER_H_
#define _PDF_TOKENIZER_H_

#include "PdfDefines.h"
#include "PdfRefCountedBuffer.h"
#include "PdfRefCountedInputDevice.h"

#include <deque>
#include <sstream>

namespace PoDoFo {

class PdfEncrypt;
class PdfVariant;

enum EPdfTokenType {
    ePdfTokenType_Delimiter,
    ePdfTokenType_Token,

    ePdfTokenType_Unknown = 0xFF
};

typedef std::pair<std::string,EPdfTokenType> TTokenizerPair;
typedef std::deque<TTokenizerPair>           TTokenizerQueque;
typedef TTokenizerQueque::iterator           TITokenizerQueque;
typedef TTokenizerQueque::const_iterator     TCITokenizerQueque;

/**
 * A simple tokenizer for PDF files and PDF content streams
 */
class PODOFO_API PdfTokenizer {
 public:
    PdfTokenizer();

    PdfTokenizer( const char* pBuffer, size_t lLen );
    PdfTokenizer( const PdfRefCountedInputDevice & rDevice, const PdfRefCountedBuffer & rBuffer );

    virtual ~PdfTokenizer();

    /** Reads the next token from the current file position
     *  ignoring all comments.
     *
     *  \param[out] pszToken On true return, set to a pointer to the read
     *                     token (a NULL-terminated C string). The pointer is
     *                     to memory owned by PdfTokenizer and must NOT be
     *                     freed.  The contents are invalidated on the next
     *                     call to GetNextToken(..) and by the destruction of
     *                     the PdfTokenizer. Undefined on false return.
     *
     *  \param[out] peType On true return, if not NULL the type of the read token
     *                     will be stored into this parameter. Undefined on false
     *                     return.
     *
     *  \returns           True if a token was read, false if there are no
     *                     more tokens to read.
     *
     *  \see GetBuffer
     */
    virtual bool GetNextToken( const char *& pszToken, EPdfTokenType* peType = NULL);

    /** Reads the next token from the current file position
     *  ignoring all comments and compare the passed token
     *  to the read token.
     *
     *  If there is no next token available, throws UnexpectedEOF.
     *
     *  \param pszToken a token that is compared to the
     *                  read token
     *
     *  \returns true if the read token equals the passed token.
     */
    bool IsNextToken( const char* pszToken );

    /** Read the next number from the current file position
     *  ignoring all comments.
     *
     *  Raises NoNumber exception if the next token is no number, and
     *  UnexpectedEOF if no token could be read. No token is consumed if
     *  NoNumber is thrown.
     *
     *  \returns a number read from the input device.
     */
    pdf_long GetNextNumber();

    /** Read the next variant from the current file position
     *  ignoring all comments.
     *
     *  Raises an UnexpectedEOF exception if there is no variant left in the
     *  file.
     *
     *  \param rVariant write the read variant to this value
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void GetNextVariant( PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Returns true if the given character is a whitespace
     *  according to the pdf reference
     *
     *  \returns true if it is a whitespace character otherwise false
     */
    PODOFO_NOTHROW inline static bool IsWhitespace(const unsigned char ch);

    /** Returns true if the given character is a delimiter
     *  according to the pdf reference
     *
     *  \returns true if it is a delimiter character otherwise false
     */
    PODOFO_NOTHROW inline static bool IsDelimiter(const unsigned char ch);

    /**
     * True if the passed character is a regular character according to the PDF
     * reference (Section 3.1.1, Character Set); ie it is neither a white-space
     * nor a delimeter character.
     */
    PODOFO_NOTHROW inline static bool IsRegular(const unsigned char ch);

    /**
     * True if the passed character is within the generally accepted "printable"
     * ASCII range.
     */
    PODOFO_NOTHROW inline static bool IsPrintable(const unsigned char ch);

    /**
     * Get the hex value from a static map of a given hex character (0-9, A-F, a-f).
     *
     * \param ch hex character
     *
     * \returns hex value or HEX_NOT_FOUND if invalid
     *
     * \see HEX_NOT_FOUND
     */
    PODOFO_NOTHROW inline static int GetHexValue(const unsigned char ch);

    /**
     * Constant which is returned for invalid hex values.
     */
    static const unsigned int HEX_NOT_FOUND;

 protected:
    /** Read the next variant from the current file position
     *  ignoring all comments.
     *
     *  Raises an exception if there is no variant left in the file.
     *
     *  \param pszToken a token that has already been read
     *  \param eType type of the passed token
     *  \param rVariant write the read variant to this value
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void GetNextVariant( const char* pszToken, EPdfTokenType eType, PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Determine the possible datatype of a token.
     *  Numbers, reals, bools or NULL values are parsed directly by this function
     *  and saved to a variant.
     *
     *  \returns the expected datatype
     */
    EPdfDataType DetermineDataType( const char* pszToken, EPdfTokenType eType, PdfVariant& rVariant );

    void ReadDataType( EPdfDataType eDataType, PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Read a dictionary from the input device
     *  and store it into a variant.
     *
     *  \param rVariant store the dictionary into this variable
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void ReadDictionary( PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Read an array from the input device
     *  and store it into a variant.
     *
     *  \param rVariant store the array into this variable
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void ReadArray( PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Read a string from the input device
     *  and store it into a variant.
     *
     *  \param rVariant store the string into this variable
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void ReadString( PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Read a hex string from the input device
     *  and store it into a variant.
     *
     *  \param rVariant store the hex string into this variable
     *  \param pEncrypt an encryption object which is used to decrypt strings during parsing
     */
    void ReadHexString( PdfVariant& rVariant, PdfEncrypt* pEncrypt );

    /** Read a hex string from the input device
     *  and store it into a vector.
     *
     *  \param rVecBuffer store the hex string into this variable
     */
    void ReadHexString( std::vector<char> &rVecBuffer );

    /** Read a name from the input device
     *  and store it into a variant.
     *
     *  Throws UnexpectedEOF if there is nothing to read.
     *
     *  \param rVariant store the name into this variable
     */
    void ReadName( PdfVariant& rVariant );

    /** Add a token to the queue of tokens.
     *  GetNextToken() will return all enqueued tokens first before
     *  reading new tokens from the input device.
     *
     *  \param pszToken string of the token
     *  \param eType type of the token
     *
     *  \see GetNextToken
     */
    void QuequeToken( const char* pszToken, EPdfTokenType eType );

 protected:
    PdfRefCountedInputDevice m_device;
    PdfRefCountedBuffer      m_buffer;

 private:
    // 256-byte array mapping character ordinal values to a truth value
    // indicating whether or not they are whitespace according to the PDF
    // standard.
    static const char * const s_delimiterMap;
    static const char * const s_whitespaceMap;
    static const char s_octMap[]; ///< Map of bool values, if a certain char
                                  ///< is a valid octal digit
    static const char * const s_escMap; ///< Mapping of escape sequences to their value
    static const char * const s_hexMap; ///< Mapping of hex characters to their value

    TTokenizerQueque m_deqQueque;

    // A vector which is used as a buffer to read strings.
    // It is a member of the class to avoid reallocations while parsing.
    std::vector<char> m_vecBuffer; // we use a vector instead of a string
                                   // because we might read a unicode
                                   // string which is allowed to contain 0 bytes.

    /// An istringstream which is used
    /// to read double values instead of strtod
    /// which is locale depend.
    std::istringstream m_doubleParser;
};

// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfTokenizer::IsWhitespace(const unsigned char ch)
{
    return ( PdfTokenizer::s_whitespaceMap[static_cast<size_t>(ch)] != 0 );
}

// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfTokenizer::IsDelimiter(const unsigned char ch)
{
    return ( PdfTokenizer::s_delimiterMap[ch] != 0 );
}

// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfTokenizer::IsRegular(const unsigned char ch)
{
    return !IsWhitespace(ch) && !IsDelimiter(static_cast<size_t>(ch));
}

// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfTokenizer::IsPrintable(const unsigned char ch)
{
    return ((ch > 32U) && (ch < 125U));
}

// -----------------------------------------------------
//
// -----------------------------------------------------
inline int PdfTokenizer::GetHexValue(const unsigned char ch)
{
    return PdfTokenizer::s_hexMap[static_cast<size_t>(ch)];
}

};

#endif // _PDF_TOKENIZER_H_


text:
package mod.bedrock.rtap;

import java.util.List;
import java.util.Random;

import com.google.gson.JsonObject;

import mod.bedrock.rtap.init.ModArmor;
import mod.bedrock.rtap.init.ModBlocks;
import mod.bedrock.rtap.init.ModEvents;
import mod.bedrock.rtap.init.ModItems;
import mod.bedrock.rtap.init.ModLootTables;
import mod.bedrock.rtap.init.ModNonCrafting;
import mod.bedrock.rtap.init.ModSoundHandler;
import mod.bedrock.rtap.init.ModTools;
import mod.bedrock.rtap.init.ModVillageRegister;
import mod.bedrock.rtap.irecipes.sulfur;
import mod.bedrock.rtap.misc.deathByShears;
import mod.bedrock.rtap.misc.villageCropPeppers;
import mod.bedrock.rtap.proxy.CommonProxy;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import net.minecraft.world.gen.structure.StructureVillagePieces.Village;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IRecipeFactory;
import net.minecraftforge.common.crafting.JsonContext;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.VillagerRegistry;

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERISON, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class RTAP {

	@Instance
	public static RTAP instance;

	@SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY)
	public static CommonProxy proxy;

	@EventHandler //Registering Blocks, Items, Entities, Tile Entities. However, those will be handled in their own class.
	public void preInit(FMLPreInitializationEvent event) {

	}

	@EventHandler //Proxies, Sounds, recipes. Could probably move everything out of here.
	public void init(FMLInitializationEvent event) {

		ModLootTables.registerTables();
		proxy.init();
		ModNonCrafting.init();
		MapGenStructureIO.registerStructureComponent(villageCropPeppers.class, Reference.MOD_ID + ":villageCropPeppers");
		VillagerRegistry.instance().registerVillageCreationHandler(Reference.MOD_VILLAGE_REGISTER);
		//ModSoundHandler.init();

	}

	@EventHandler //Cross-Mod Interaction
	public void postInit(FMLPostInitializationEvent event) {

	}

	/**
	 * TODO:
	 *
	 * Key:
	 * - Just a Todo.
	 * * Important
	 * ! Heavily important
	 * = Not important
	 * ~ Maybe really hard to do/impossible, but still wanted
	 *
	 * ! Make "hardened" or "dried" ramen from the liquid ramen. (solar baker? Internal fluid tank for ramen? use RF?) Used in Armors/Tools. Hardened Applies "anti-effect" to the armor/weapon.
	 * - Add Ice XVIII. Sliding velocity is either 1 or 1.1
	 * * Fix Crop Peppers generation
	 * * Fix Ramen Texture
	 * ! FIX SOUNDS!!
	 * - Make itemliquidmeat use sulfur instead of gunpowder. filter + gunpowder?
	 * ! Create jello freezer. Make sure it can be automated with pipes/hoppers. Make it use rf. Internal fuel (Ice XVIII?) can be used if no other rf producing mod exists. Config option available.
	 * * Add crafting recipe for wet gelatine. Make sure to decrement the durability on the filter.
	 * = Make the filter not take damage when hitting / mining
	 * * Add NBT Color crafting to the gelatine to get custom colors, like fireworks/leather armor. Use IRecipe? use getColorFromItemStack?
	 * * Any variation of jello after the dyeing should affect the recipe from then on. Like blocks should be colored, armor, tools, etc..
	 * * Add dimensions for the 4 main tech trees
	 * * Add dimensions for tech trees
	 * - Add guide. Make it like thaumcraft's. Sort of. not really. Could also be like embers. I just really like the small quips on stuff. Add those to everything.
	 * ~= Make ramen armor/tools use nbt crafting to use the potion effect applied when the original ramen is eaten. More of the same ramen used on multiple armor pieces, the better the effect. Will also take texture of original ramen. Idea: add number id nbt to ramen, and copy it to each when crafting. Then, when applying the potion effect, get the id of the potion by the number in the nbt.
	 * - Make Ramen a liquid. Applies potion effect while in it.
	 * ! NEVER ADD PICKLES. MUAHAHAHA
	 * ~* Make Ocelots when right clicked with shears drop cat hair. Fortune increases chances. Perhaps only when it is tamed. And add a cooldown. ~5 mins. Killing them, tamed or not, will drop cat hair. To add nbt to cats, use something about capabilities.
	 * - Make ALL Cat Hair Items burnable as fuel. hehehe.
	 * * Make all recipes use ore dictionary.
	 * - Add Chocolate-chip-mint-ifier. Instantly makes everything better.
	 *
	 */

}


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromeos/system/name_value_pairs_parser.h"

#include "base/cxx17_backports.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace chromeos {
namespace system {

// A parameterized test class running tests for all the formats that are
// compatible with VPD dumps.
class VpdDumpNameValuePairsParserTest
    : public testing::TestWithParam<NameValuePairsFormat> {
 protected:
  NameValuePairsParser::NameValueMap map;
};

TEST_P(VpdDumpNameValuePairsParserTest, TestParseNameValuePairs) {
  const NameValuePairsFormat format = GetParam();
  NameValuePairsParser parser(&map);

  const std::string contents1 = R"(
"initial_locale"="ja"
"keyboard_layout"="mozc-jp"
"empty"=""
)";
  EXPECT_TRUE(parser.ParseNameValuePairs(contents1, format,
                                         /*debug_source=*/"unit test"));
  EXPECT_EQ(3U, map.size());
  EXPECT_EQ("ja", map["initial_locale"]);
  EXPECT_EQ("mozc-jp", map["keyboard_layout"]);
  EXPECT_EQ("", map["empty"]);

  map.clear();
  const std::string contents2 = R"(
"quoted"=""quote""
"serial_number"="BADBADBAD""
"model_name"="15" Chromebook"
)";
  EXPECT_TRUE(parser.ParseNameValuePairs(contents2, format,
                                         /*debug_source=*/"unit test"));
  EXPECT_EQ(3U, map.size());
  EXPECT_EQ("\"quote\"", map["quoted"]);
  EXPECT_EQ("BADBADBAD\"", map["serial_number"]);
  EXPECT_EQ("15\" Chromebook", map["model_name"]);

  map.clear();
  const std::string contents3 = R"(
"a"="
"a"=
"a=b"="c"
""="value"
)";
  EXPECT_FALSE(parser.ParseNameValuePairs(contents3, format,
                                          /*debug_source=*/"unit test"));
  EXPECT_EQ(0U, map.size());

  // This is just for visual confirmations that we have warnings logged and
  // that we don't expose the value of the device stable secret in logs.
  // TODO(crbug.com/1250037): Delete after logging is fixed.
  map.clear();
  const std::string contents5 = R"(
"stable_device_secret_DO_NOT_SHARE"="prettybadtobehere"
"stable_device_secret_DO_NOT_SHARE"="stillprettybadtobehere"
)";
  EXPECT_TRUE(parser.ParseNameValuePairs(contents5, format,
                                         /*debug_source=*/"unit test"));
  EXPECT_EQ(1U, map.size());
}

INSTANTIATE_TEST_SUITE_P(NameValuePairs,
                         VpdDumpNameValuePairsParserTest,
                         testing::Values(NameValuePairsFormat::kVpdDump,
                                         NameValuePairsFormat::kMachineInfo));

TEST(NameValuePairsParser, TestParseNameValuePairsInVpdDumpFormat) {
  constexpr NameValuePairsFormat format = NameValuePairsFormat::kVpdDump;
  NameValuePairsParser::NameValueMap map;
  NameValuePairsParser parser(&map);

  // Names must be quoted in VPD dump format. Unquoted names are ignored.
  const std::string contents1 = R"(
"name1"="value1"
name2="value2"
"name3"="value3"
name4="value4"
)";
  EXPECT_FALSE(parser.ParseNameValuePairs(contents1, format,
                                          /*debug_source=*/"unit test"));
  EXPECT_EQ(2U, map.size());
  EXPECT_EQ("value1", map["name1"]);
  EXPECT_EQ("value3", map["name3"]);
}

TEST(NameValuePairsParser, TestParseNameValuePairsInMachineInfoFormat) {
  constexpr NameValuePairsFormat format = NameValuePairsFormat::kMachineInfo;
  NameValuePairsParser::NameValueMap map;
  NameValuePairsParser parser(&map);

  // Names do not have to be quoted in machine info format.
  const std::string contents1 = R"(
"name1"="value1"
name2="value2"
"name3"="value3"
name4="value4"
)";
  EXPECT_TRUE(parser.ParseNameValuePairs(contents1, format,
                                         /*debug_source=*/"unit test"));
  EXPECT_EQ(4U, map.size());
  EXPECT_EQ("value1", map["name1"]);
  EXPECT_EQ("value2", map["name2"]);
  EXPECT_EQ("value3", map["name3"]);
  EXPECT_EQ("value4", map["name4"]);

  map.clear();
  const std::string contents2 = R"(
="value"
)";
  EXPECT_FALSE(parser.ParseNameValuePairs(contents2, format,
                                          /*debug_source=*/"unit test"));
  EXPECT_EQ(0U, map.size());
}

TEST(NameValuePairsParser, TestParseNameValuePairsFromCrossystemTool) {
  // Sample output is taken from the /usr/bin/crosssytem tool.
  const char* command[] = {
      "/bin/echo",
      "arch                   = x86           # Platform architecture\n"
      "cros_debug             = 1             # OS should allow debug\n"
      "dbg_reset              = (error)       # Debug reset mode request\n"
      "key#with_comment       = some value    # Multiple # comment # delims\n"
      "key                    =               # No value.\n"
      "vdat_timers            = "
      "LFS=0,0 LF=1784220250,2971030570 LK=9064076660,9342689170 "
      "# Timer values from VbSharedData\n"
      "wpsw_cur               = 1             # Firmware hardware WP switch "
      "pos\n"};

  NameValuePairsParser::NameValueMap map;
  NameValuePairsParser parser(&map);
  parser.ParseNameValuePairsFromTool(base::size(command), command,
                                     NameValuePairsFormat::kCrossystem);
  EXPECT_EQ(7u, map.size());
  EXPECT_EQ("x86", map["arch"]);
  EXPECT_EQ("1", map["cros_debug"]);
  EXPECT_EQ("(error)", map["dbg_reset"]);
  EXPECT_EQ("some value", map["key#with_comment"]);
  EXPECT_EQ("", map["key"]);
  EXPECT_EQ("LFS=0,0 LF=1784220250,2971030570 LK=9064076660,9342689170",
            map["vdat_timers"]);
  EXPECT_EQ("1", map["wpsw_cur"]);
}

TEST(NameValuePairsParser, DeletePairsWithValue) {
  NameValuePairsParser::NameValueMap map = {
      {"foo", "good"}, {"bar", "bad"}, {"baz", "good"}, {"end", "bad"},
  };
  NameValuePairsParser parser(&map);
  parser.DeletePairsWithValue("bad");
  ASSERT_EQ(2u, map.size());
  EXPECT_EQ("good", map["foo"]);
  EXPECT_EQ("good", map["baz"]);
}

}  // namespace system
}  // namespace chromeos


text:
class Scaler::Listener::BoshScaler
  class CfVarzProcessor
    attr_reader :buffers

    def initialize(buffer_size)
      @buffers = {}
      @buffer_size = buffer_size
    end

    def drop_missing_entities
      yesterday = Time.now - (60 * 60 * 24)
      @buffers.delete_if do |_, buffer|
        # cut off fractions
        buffer.first.timestamp.to_i < yesterday.to_i
      end
    end

    def process(event)
      return unless event.is_a? Scaler::CfVarzMetric

      @buffers["#{event.source_id}/#{event.key}"] ||= []
      buffer = @buffers["#{event.source_id}/#{event.key}"]
      # need ring buffer for better performance
      if buffer.size >= @buffer_size
        buffer.pop
      end
      buffer.unshift(event)
    end

    def updated_time(buffer_name)
      Time.at(@buffers[buffer_name].first.timestamp)
    end
  end
end


text:
function sharedArraySpecHelper() {

  describe('arrays', function () {

    it('should be able to set array values with correct type(s)', function () {
      expect(function () {
        config.set({
          property1: 5,
          array: [true, false, true]
        });
      }).not.toThrow();
    });

    it('should throw a error when set array values with wrong type(s)', function () {
      expect(function () {
        config.set({
          property1: 5,
          array: [true, false, 'string']
        });
      }).toThrowError(/type mismatch expected `\[object Boolean\]` got `\[object String\]`/);
    });
  });
}


text:
LIST=CPU
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif
include $(QRDIR)$(QRECURSE)


text:
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4927
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: CLSCompliantAttribute(false)]
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyTitleAttribute("Castle.Components.Scheduler.Tests for Mono 3.5 Profile")]
[assembly: AssemblyDescriptionAttribute("")]
[assembly: AssemblyCompanyAttribute("Castle Project")]
[assembly: AssemblyProductAttribute("Castle.Components.Scheduler.Tests")]
[assembly: AssemblyCopyrightAttribute("Castle Project, original author or authors")]
[assembly: AssemblyVersionAttribute("1.1.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.1.0.0")]
[assembly: AssemblyFileVersionAttribute("1.1.0.0")]
[assembly: AssemblyDelaySignAttribute(false)]


text:
#include <sb6.h>
#include <vmath.h>

#include <object.h>
#include <sb6ktx.h>
#include <shader.h>

class fragmentlist_app : public sb6::application
{
public:
    fragmentlist_app()
        : clear_program(0),
          append_program(0),
          resolve_program(0)
    {
    }

protected:
    void init();
    void startup();
    void render(double currentTime);
    void onKey(int key, int action);

    void load_shaders();

    GLuint          clear_program;
    GLuint          append_program;
    GLuint          resolve_program;

    struct
    {
        GLuint      color;
        GLuint      normals;
    } textures;

    struct uniforms_block
    {
        vmath::mat4     mv_matrix;
        vmath::mat4     view_matrix;
        vmath::mat4     proj_matrix;
    };

    GLuint          uniforms_buffer;

    struct
    {
        GLint           mvp;
    } uniforms;

    sb6::object     object;

    GLuint          fragment_buffer;
    GLuint          head_pointer_image;
    GLuint          atomic_counter_buffer;
    GLuint          dummy_vao;
};

void fragmentlist_app::init()
{
    static const char title[] = "OpenGL SuperBible - Fragment List";

    sb6::application::init();

    memcpy(info.title, title, sizeof(title));
}

void fragmentlist_app::startup()
{
    load_shaders();

    glGenBuffers(1, &uniforms_buffer);
    glBindBuffer(GL_UNIFORM_BUFFER, uniforms_buffer);
    glBufferData(GL_UNIFORM_BUFFER, sizeof(uniforms_block), NULL, GL_DYNAMIC_DRAW);

    object.load("media/objects/dragon.sbm");

    glGenBuffers(1, &fragment_buffer);
    glBindBuffer(GL_SHADER_STORAGE_BUFFER, fragment_buffer);
    glBufferData(GL_SHADER_STORAGE_BUFFER, 1024 * 1024 * 16, NULL, GL_DYNAMIC_COPY);

    glGenBuffers(1, &atomic_counter_buffer);
    glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, atomic_counter_buffer);
    glBufferData(GL_ATOMIC_COUNTER_BUFFER, 4, NULL, GL_DYNAMIC_COPY);

    glGenTextures(1, &head_pointer_image);
    glBindTexture(GL_TEXTURE_2D, head_pointer_image);
    glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32UI, 1024, 1024);

    glGenVertexArrays(1, &dummy_vao);
    glBindVertexArray(dummy_vao);
}

void fragmentlist_app::render(double currentTime)
{
    static const GLfloat zeros[] = { 0.0f, 0.0f, 0.0f, 0.0f };
    static const GLfloat gray[] = { 0.1f, 0.1f, 0.1f, 0.0f };
    static const GLfloat ones[] = { 1.0f };
    const float f = (float)currentTime;

    glViewport(0, 0, info.windowWidth, info.windowHeight);

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);

    glUseProgram(clear_program);
    glBindVertexArray(dummy_vao);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    glUseProgram(append_program);

    vmath::mat4 model_matrix = vmath::scale(7.0f);
    vmath::vec3 view_position = vmath::vec3(cosf(f * 0.35f) * 120.0f, cosf(f * 0.4f) * 30.0f, sinf(f * 0.35f) * 120.0f);
    vmath::mat4 view_matrix = vmath::lookat(view_position,
                                            vmath::vec3(0.0f, 30.0f, 0.0f),
                                            vmath::vec3(0.0f, 1.0f, 0.0f));

    vmath::mat4 mv_matrix = view_matrix * model_matrix;
    vmath::mat4 proj_matrix = vmath::perspective(50.0f,
                                                 (float)info.windowWidth / (float)info.windowHeight,
                                                 0.1f,
                                                 1000.0f);

    glUniformMatrix4fv(uniforms.mvp, 1, GL_FALSE, proj_matrix * mv_matrix);

    static const unsigned int zero = 0;
    glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomic_counter_buffer);
    glBufferSubData(GL_ATOMIC_COUNTER_BUFFER, 0, sizeof(zero), &zero);

    glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, fragment_buffer);

    glBindImageTexture(0, head_pointer_image, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI);

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);

    object.render();

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);

    glUseProgram(resolve_program);

    glBindVertexArray(dummy_vao);

    glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

void fragmentlist_app::onKey(int key, int action)
{
    if (action)
    {
        switch (key)
        {
            case 'R':
                load_shaders();
                break;
        }
    }
}

void fragmentlist_app::load_shaders()
{
    GLuint  shaders[2];

    shaders[0] = sb6::shader::load("media/shaders/fragmentlist/clear.vs.glsl", GL_VERTEX_SHADER);
    shaders[1] = sb6::shader::load("media/shaders/fragmentlist/clear.fs.glsl", GL_FRAGMENT_SHADER);

    if (clear_program)
        glDeleteProgram(clear_program);

    clear_program = sb6::program::link_from_shaders(shaders, 2, true);

    shaders[0] = sb6::shader::load("media/shaders/fragmentlist/append.vs.glsl", GL_VERTEX_SHADER);
    shaders[1] = sb6::shader::load("media/shaders/fragmentlist/append.fs.glsl", GL_FRAGMENT_SHADER);

    if (append_program)
        glDeleteProgram(append_program);

    append_program = sb6::program::link_from_shaders(shaders, 2, true);

    uniforms.mvp = glGetUniformLocation(append_program, "mvp");

    shaders[0] = sb6::shader::load("media/shaders/fragmentlist/resolve.vs.glsl", GL_VERTEX_SHADER);
    shaders[1] = sb6::shader::load("media/shaders/fragmentlist/resolve.fs.glsl", GL_FRAGMENT_SHADER);

    if (resolve_program)
        glDeleteProgram(resolve_program);

    resolve_program = sb6::program::link_from_shaders(shaders, 2, true);
}

DECLARE_MAIN(fragmentlist_app)


text:
gearman-async [![Latest Stable Version](https://img.shields.io/packagist/v/zikarsky/react-gearman.svg?style=flat-square)](https://packagist.org/packages/zikarsky/react-gearman) [![Total Downloads](https://img.shields.io/packagist/dt/zikarsky/react-gearman.svg?style=flat-square)](https://packagist.org/packages/zikarsky/react-gearman)
=============
[![Build Status](https://img.shields.io/travis/bzikarsky/react-gearman.svg?style=flat-square)](https://travis-ci.org/bzikarsky/react-gearman)

A async Gearman implementation for PHP ontop of reactphp

## Current status:
- There is a working implementation for a GearmanClient
- There is a partially working implementation for GearmanWorker - will be refactored
- Code is unit-tested and adheres to http://gearman.org/protocol/
- No real integration tests with gearmand yet. Some examples can be found in `examples`

## Development

Your PRs and changes are very welcome!

Please run tests and fix code-style with:

- `bin/phpunit`
- `bin/php-cs-fixer fix`

If you want to check code-style before fixing it, run `bin/php-cs-fixer fix --dry-run --diff`


text:
//Helper functions to deal with file I/O.

/*jslint plusplus: false */
/*global define, Components, xpcUtil */

define(['prim'], function (prim) {
    var file,
        Cc = Components.classes,
        Ci = Components.interfaces,
        //Depends on xpcUtil which is set up in x.js
        xpfile = xpcUtil.xpfile;

    function mkFullDir(dirObj) {
        //1 is DIRECTORY_TYPE, 511 is 0777 permissions
        if (!dirObj.exists()) {
            dirObj.create(1, 511);
        }
    }

    file = {
        backSlashRegExp: /\\/g,

        exclusionRegExp: /^\./,

        getLineSeparator: function () {
            return file.lineSeparator;
        },

        lineSeparator: ('@mozilla.org/windows-registry-key;1' in Cc) ?
                        '\r\n' : '\n',

        exists: function (fileName) {
            return xpfile(fileName).exists();
        },

        parent: function (fileName) {
            return xpfile(fileName).parent;
        },

        normalize: function (fileName) {
            return file.absPath(fileName);
        },

        isFile: function (path) {
            return xpfile(path).isFile();
        },

        isDirectory: function (path) {
            return xpfile(path).isDirectory();
        },

        /**
         * Gets the absolute file path as a string, normalized
         * to using front slashes for path separators.
         * @param {java.io.File||String} file
         */
        absPath: function (fileObj) {
            if (typeof fileObj === "string") {
                fileObj = xpfile(fileObj);
            }
            return fileObj.path;
        },

        getFilteredFileList: function (/*String*/startDir, /*RegExp*/regExpFilters, /*boolean?*/makeUnixPaths, /*boolean?*/startDirIsObject) {
            //summary: Recurses startDir and finds matches to the files that match regExpFilters.include
            //and do not match regExpFilters.exclude. Or just one regexp can be passed in for regExpFilters,
            //and it will be treated as the "include" case.
            //Ignores files/directories that start with a period (.) unless exclusionRegExp
            //is set to another value.
            var files = [], topDir, regExpInclude, regExpExclude, dirFileArray,
                fileObj, filePath, ok, dirFiles;

            topDir = startDir;
            if (!startDirIsObject) {
                topDir = xpfile(startDir);
            }

            regExpInclude = regExpFilters.include || regExpFilters;
            regExpExclude = regExpFilters.exclude || null;

            if (topDir.exists()) {
                dirFileArray = topDir.directoryEntries;
                while (dirFileArray.hasMoreElements()) {
                    fileObj = dirFileArray.getNext().QueryInterface(Ci.nsILocalFile);
                    if (fileObj.isFile()) {
                        filePath = fileObj.path;
                        if (makeUnixPaths) {
                            if (filePath.indexOf("/") === -1) {
                                filePath = filePath.replace(/\\/g, "/");
                            }
                        }

                        ok = true;
                        if (regExpInclude) {
                            ok = filePath.match(regExpInclude);
                        }
                        if (ok && regExpExclude) {
                            ok = !filePath.match(regExpExclude);
                        }

                        if (ok && (!file.exclusionRegExp ||
                            !file.exclusionRegExp.test(fileObj.leafName))) {
                            files.push(filePath);
                        }
                    } else if (fileObj.isDirectory() &&
                              (!file.exclusionRegExp || !file.exclusionRegExp.test(fileObj.leafName))) {
                        dirFiles = this.getFilteredFileList(fileObj, regExpFilters, makeUnixPaths, true);
                        files.push.apply(files, dirFiles);
                    }
                }
            }

            return files; //Array
        },

        copyDir: function (/*String*/srcDir, /*String*/destDir, /*RegExp?*/regExpFilter, /*boolean?*/onlyCopyNew) {
            //summary: copies files from srcDir to destDir using the regExpFilter to determine if the
            //file should be copied. Returns a list file name strings of the destinations that were copied.
            regExpFilter = regExpFilter || /\w/;

            var fileNames = file.getFilteredFileList(srcDir, regExpFilter, true),
            copiedFiles = [], i, srcFileName, destFileName;

            for (i = 0; i < fileNames.length; i += 1) {
                srcFileName = fileNames[i];
                destFileName = srcFileName.replace(srcDir, destDir);

                if (file.copyFile(srcFileName, destFileName, onlyCopyNew)) {
                    copiedFiles.push(destFileName);
                }
            }

            return copiedFiles.length ? copiedFiles : null; //Array or null
        },

        copyFile: function (/*String*/srcFileName, /*String*/destFileName, /*boolean?*/onlyCopyNew) {
            //summary: copies srcFileName to destFileName. If onlyCopyNew is set, it only copies the file if
            //srcFileName is newer than destFileName. Returns a boolean indicating if the copy occurred.
            var destFile = xpfile(destFileName),
            srcFile = xpfile(srcFileName);

            //logger.trace("Src filename: " + srcFileName);
            //logger.trace("Dest filename: " + destFileName);

            //If onlyCopyNew is true, then compare dates and only copy if the src is newer
            //than dest.
            if (onlyCopyNew) {
                if (destFile.exists() && destFile.lastModifiedTime >= srcFile.lastModifiedTime) {
                    return false; //Boolean
                }
            }

            srcFile.copyTo(destFile.parent, destFile.leafName);

            return true; //Boolean
        },

        /**
         * Renames a file. May fail if "to" already exists or is on another drive.
         */
        renameFile: function (from, to) {
            var toFile = xpfile(to);
            return xpfile(from).moveTo(toFile.parent, toFile.leafName);
        },

        readFile: xpcUtil.readFile,

        readFileAsync: function (path, encoding) {
            var d = prim();
            try {
                d.resolve(file.readFile(path, encoding));
            } catch (e) {
                d.reject(e);
            }
            return d.promise;
        },

        saveUtf8File: function (/*String*/fileName, /*String*/fileContents) {
            //summary: saves a file using UTF-8 encoding.
            file.saveFile(fileName, fileContents, "utf-8");
        },

        saveFile: function (/*String*/fileName, /*String*/fileContents, /*String?*/encoding) {
            var outStream, convertStream,
                fileObj = xpfile(fileName);

            mkFullDir(fileObj.parent);

            try {
                outStream = Cc['@mozilla.org/network/file-output-stream;1']
                             .createInstance(Ci.nsIFileOutputStream);
                //438 is decimal for 0777
                outStream.init(fileObj, 0x02 | 0x08 | 0x20, 511, 0);

                convertStream = Cc['@mozilla.org/intl/converter-output-stream;1']
                                  .createInstance(Ci.nsIConverterOutputStream);

                convertStream.init(outStream, encoding, 0, 0);
                convertStream.writeString(fileContents);
            } catch (e) {
                throw new Error((fileObj && fileObj.path || '') + ': ' + e);
            } finally {
                if (convertStream) {
                    convertStream.close();
                }
                if (outStream) {
                    outStream.close();
                }
            }
        },

        deleteFile: function (/*String*/fileName) {
            //summary: deletes a file or directory if it exists.
            var fileObj = xpfile(fileName);
            if (fileObj.exists()) {
                fileObj.remove(true);
            }
        },

        /**
         * Deletes any empty directories under the given directory.
         * The startDirIsJavaObject is private to this implementation's
         * recursion needs.
         */
        deleteEmptyDirs: function (startDir, startDirIsObject) {
            var topDir = startDir,
                dirFileArray, fileObj;

            if (!startDirIsObject) {
                topDir = xpfile(startDir);
            }

            if (topDir.exists()) {
                dirFileArray = topDir.directoryEntries;
                while (dirFileArray.hasMoreElements()) {
                    fileObj = dirFileArray.getNext().QueryInterface(Ci.nsILocalFile);

                    if (fileObj.isDirectory()) {
                        file.deleteEmptyDirs(fileObj, true);
                    }
                }

                //If the directory is empty now, delete it.
                dirFileArray = topDir.directoryEntries;
                if (!dirFileArray.hasMoreElements()) {
                    file.deleteFile(topDir.path);
                }
            }
        }
    };

    return file;
});


text:
package com.github.groovylabs.lyre.engine.APIx.websocket;

import com.github.groovylabs.lyre.domain.Endpoint;
import com.github.groovylabs.lyre.domain.Event;
import com.github.groovylabs.lyre.domain.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.core.MessageSendingOperations;
import org.springframework.stereotype.Component;

@Component
public class Dispatcher {

    private String queuePrefix = "/registry/";

    @Autowired
    private MessageSendingOperations<String> messagingTemplate;

    public void publish(Event<?> event) {
        if (event != null && event.getQueue() != null && event.getAction() != null) {

            String queue = "";

            switch (event.getQueue()) {
                case BUNDLE:
                    queue = queuePrefix + event.getQueue();
                    break;
                case LOG:
                    if (((Log) event.getSource()).getTarget() instanceof Endpoint) {
                        queue = queuePrefix + event.getQueue() + "/" + ((Endpoint) ((Log) event.getSource()).getTarget()).getHash();
                    }

                    break;
            }

            this.messagingTemplate.convertAndSend(queue, event);
        }
    }

}