text:
package cfsequence

import (
	"time"
	"sync"
)

type _snowflake struct {
	//节点ID
	nodeId int64
	mutex *sync.Mutex
	index int64
	lastTimestamp int64
}

func NewSequenceService(nodeId int64) SequenceService {
	if nodeId > maxNodeId {
		return nil
	}
	s := &_snowflake{nodeId, new(sync.Mutex),0,0}
	return s
}

func (this *_snowflake) GetEpoch() int64 {
	return epoch
}

func (this *_snowflake) GetNodeId() int64 {
	return this.nodeId
}

func (this *_snowflake)MinId(timestemp int64) int64{
	return (timestemp-epoch)<<timestampLeftShift | 0<<indexShift
}

func (this *_snowflake)getTimeStampAndIndex()(int64,int64){
	this.mutex.Lock()
	defer this.mutex.Unlock()
	index := this.index
	timestamp := getMillisecond()
	if this.lastTimestamp == timestamp/millisecond{
		index = (index + 1) & indexMask
		if index == 0 {
			//当前毫秒内计数满了,则等待下一秒
			timestamp = tilNextMillis(this.lastTimestamp*millisecond)
		}
	}else{
		index = 0
	}
	this.index = index
	this.lastTimestamp = timestamp/millisecond
	return this.lastTimestamp,index
}

func (this *_snowflake) NextId() int64 {
	t,i:=this.getTimeStampAndIndex()
	return (t-epoch)<<timestampLeftShift | i<<indexShift | this.nodeId
}

func (this *_snowflake) ParseSequence(sequence int64) *Sequence {
	index := sequence >> indexShift & indexMask
	unixTime := (epoch + (sequence >> timestampLeftShift)) * millisecond
	createTime := time.Unix(0, unixTime)
	nodeId := sequence & nodeMask
	return &Sequence{sequence, createTime, nodeId, index}
}


text:
(function() {
    // ======================================================
    // VARIABLES
    // ======================================================

    var selectedImage = "";

    // ======================================================
    // INITIALIZATION
    // ======================================================

    $.get(chrome.extension.getURL("html/toolbelt.html"), function(data) {
        $("body").append(data);
        embedFonts();
        kickoffToolbelt();
    });

    function kickoffToolbelt() {
        chrome.storage.sync.get("categories", function(categoriesObj) {
            initToolbelt(categoriesObj.categories);
        });
    }

    function initToolbelt(categories) {
        // Go through each category and generate the list and image nodes needed
        // for the toolbelt
        var smarts = [];
        for (var i = 0; i < categories.length; i++) {
            var name = categories[i].name;
            if (name.charAt(0) == '#') {
                smarts.push({"name": name, "index": i});
                continue;
            }
            var gifs = categories[i].gifs;
            var li = document.createElement("li");
            var ol = document.createElement("ol");

            // If we have gifs in the category...
            for (var j = 0; j < gifs.length; j++) {
                var innerLi = document.createElement("li");
                innerLi.appendChild(generateAnchorGif(gifs[j].animated));
                ol.appendChild(innerLi);

                // If we're doing the last one, we need to add an overlay
                if (j == gifs.length - 1) {
                    li.appendChild(generateAnchorGif(gifs[j].animated));
                    li.appendChild(generateOverlay());
                    li.appendChild(generateNameDiv(name));
                }
            }
            // It it's an empty category (i.e. just added)
            if (gifs.length == 0) {
                var innerLi = document.createElement("li");
                innerLi.appendChild(generateAnchorGif(chrome.extension.getURL("img/empty.jpg")));
                ol.appendChild(innerLi);
                li.appendChild(generateAnchorGif(chrome.extension.getURL("img/empty.jpg")));
                li.appendChild(generateOverlay());
                li.appendChild(generateNameDiv(name));
            }
            li.appendChild(ol);
            $("#js-belt ol")[0].appendChild(li);
        }
        // If we have no smart objects, we're done. Otherwise, we need to add them
        if (smarts.length == 0)
            finishToolbelt();
        else
            addSmartGifs(smarts);
    }

    function finishToolbelt() {
        var addCategory = document.createElement("li");
        addCategory.setAttribute("class", "gifics-add-category");
        addCategory.innerText = "+";
        $("#js-belt ol")[0].appendChild(addCategory);

        $("#js-belt ol li ol").each(function(index){
            var height = Math.min($(this).children().length * 115 - 15, 400);
            $(this).css("height", height + "px");
        });

        // Add mask (we need to do it in js because we need the url)
        // But only add it if there's >= 4 items in the list
        $("#js-belt ol li ol").each(function() {
            if ($(this).children().length >= 4) {
                $(this).css("-webkit-mask", "url(" + chrome.extension.getURL("img/toolbar_fade_mask.svg") + ")");
            }
        });
        initEvents();
    }

    function addSmartGifs(gifs) {
        getSmartGif(gifs, 0);
    }

    function getSmartGif(gifs, index) {
        if (index >= gifs.length) {
            finishToolbelt();
        }
        else {
            $.get("http://api.giphy.com/v1/gifs/search?q=" + gifs[index].name.substring(1) + "&api_key=dc6zaTOxFJmzC&limit=7", function(data) {
                var li = document.createElement("li");
                var ol = document.createElement("ol");
                var arr = data.data;
                for (var j = 0; j < arr.length; j++) {
                    var imgUrl = arr[j].images.fixed_height.url;
                    var innerLi = document.createElement("li");
                    innerLi.appendChild(generateAnchorGif(imgUrl));
                    ol.appendChild(innerLi);

                    // If we're doing the last one, we need to add an overlay
                    if (j == gifs.length - 1) {
                        li.appendChild(generateAnchorGif(imgUrl));
                        li.appendChild(generateOverlay());
                        li.appendChild(generateNameDiv(gifs[index].name));
                    }
                }
                li.appendChild(ol);
                $("#js-belt ol")[0].appendChild(li);
                getSmartGif(gifs, index + 1);
            });
        }
    }

    function initEvents() {
        $("#js-next-button").click(nextCategory);
        $("#js-belt ol li").mouseenter(setScrollToBottom);
        $("#js-belt ol li").mouseleave(setScrollToBottom);
        $("#js-belt ol li ol").bind("mousewheel", function(e) {
            $(this).scrollTop($(this).scrollTop() - e.originalEvent.wheelDeltaY / 2);
            e.preventDefault();
        });
        $(".gifics-add-category").click(addCategory);
        $("#js-belt li a").click(function(e) { e.preventDefault(); });
        $("#js-belt li a").dblclick(promptToDeleteGif);
    }

    function embedFonts() {
        embedFont("Raleway-Bold", "css/fonts/Raleway-Bold.ttf");
        embedFont("Raleway-ExtraBold", "css/fonts/Raleway-ExtraBold.ttf");
    };

    // ======================================================
    // EVENTS
    // ======================================================

    Mousetrap.bind(["command+shift+up", "control+shift+up"], function(e) {
        showBelt();
        return false;
    });

    Mousetrap.bind(["command+shift+down", "control+shift+down"], function(e) {
        hideBelt();
        return false;
    });

    function setScrollToBottom() {
        var elem = $(this).find("ol");
        var height = elem.height();
        elem.scrollTop(height);
        elem.css("opacity", 0);
        elem.animate({"opacity": 1}, 300);
    }

    function addCategory(e) {
        var name = prompt("What would you like to name your new category?");
        chrome.storage.sync.get("categories", function(categoriesObj) {
            var categories = categoriesObj.categories;
            categories.push({"name": name, "symbol": [], "gifs": []});
            chrome.storage.sync.set({ "categories": categories }, function() {
                // resetBelt();
                chrome.runtime.sendMessage({ "refresh": true });
            });
        });
    }

    function promptToDeleteGif(e) {
        var category = $(this).parents("ol").parents("li").find(".gifics-title").text();
        var message = "Would you like to delete this gif?";
        if (category.charAt(0) == '#')
            message = "Would you like to delete this smart category?";
        var result = confirm(message);
        if (result) {
            var src = $(this).attr("href");
            deleteGif(category, src);
        }
    }

    chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) {
        if (request.refresh) {
            resetBelt();
        }
    });

    // ======================================================
    // HELPERS
    // ======================================================

    function showBelt() {
        $("#js-toolbelt").appendTo("body");
        $("#js-toolbelt").animate({"bottom": "0"}, 250);
    }

    function hideBelt() {
        $("#js-toolbelt").animate({"bottom": "-150px"}, 250);
    }

    function resetBelt() {
        $("#js-toolbelt ol").empty();
        kickoffToolbelt();
    }

    function nextCategory() {
        $("#js-belt > ol").append($("#js-belt > ol li:first"));
    }

    function generateAnchorGif(src) {
        var anchor = document.createElement("a");
        anchor.style.backgroundImage = "url(" + src + ")";
        anchor.style.backgroundPosition = "center";
        anchor.style.backgroundSize = "auto 100px";
        anchor.href = src;
        return anchor;
    }

    function generateOverlay() {
        var overlay = document.createElement("div");
        overlay.setAttribute("class", "gifics-overlay");
        return overlay;
    }

    function generateNameDiv(name) {
        var nameDiv = document.createElement("div");
        nameDiv.setAttribute("class", "gifics-title");
        nameDiv.style.fontSize = 50 / Math.sqrt(name.length) + "px";
        nameDiv.innerText = name;
        return nameDiv;
    }

    function deleteGif(category, src) {
        chrome.storage.sync.get("categories", function(categoriesObj) {
            var categories = categoriesObj.categories;
            for (var i = 0; i < categories.length; i++) {
                var c = categories[i];
                // Find the category that matches
                if (c.name == category) {
                    // If you clicked the empty.jpg or it's a smart object, then just delete the
                    // category and skidaddle
                    if (c.gifs.length == 0 || c.name.charAt(0) == '#') {
                        categories.splice(i, 1);
                        break;
                    }
                    // Otherwise, go through all of the gifs and find the matching src
                    for (var j = 0; j < c.gifs.length; j++) {
                        if (c.gifs[j].animated == src) {
                            c.gifs.splice(j, 1);
                            // If you just deleted the last one, delete the category too
                            if (c.gifs.length == 0) {
                                categories.splice(i, 1);
                            }
                            break;
                        }
                    }
                    break;
                }
            }
            chrome.storage.sync.set({"categories": categories}, function() {
                // resetBelt();
                chrome.runtime.sendMessage({ "refresh": true });
            });
        });
    }

    function embedFont(name, path) {
        var node = document.createElement("style");
        node.type = "text/css";
        var url = chrome.extension.getURL(path);
        node.textContent = "@font-face { font-family: '" + name + "'; src: url('" + url + "'); }";
        document.head.appendChild(node);
    };

})();

redpajama_set_name: RedPajamaGithub


text:
@import 'base.css';
@import 'util.css';
@import 'layout.css';
@import 'header.css';
@import 'bubble-chart.css';
@import 'bar-chart.css';
@import 'detail-table.css';
@import 'flux.css';
@import 'modal.css';
@import 'services-list.css';


text:
/*
 * AISheep.h
 *
 *  Created on: 23 févr. 2015
 *      Author: alex
 */

#include <map>
#include "AI.h"
#include <cstdio>
#include <list>

class AISheep :
	public AI
{
public:
	/**
	* Description des actions :
	* INIT : etat de recherche de QrCode
	* END : fin du programme
	*/
	enum action {INIT, END, OTHER};

	AISheep(int argc, char *argv[]);
	virtual ~AISheep();

	/**
	* Retite tout les caractères qui ne font pas parti des tokens
	* @param ifs : stream a traité
	* @return : String contenant seulement token selon la grammaire attendu
	*/
	std::list<std::string> lexer(std::string filepath);
	/**
	* Parse une liste de token et renvoie la table ID-Action a partir des tokens lu
	* @param tokens : suite de token a parser
	*/
	void parse(std::list<std::string> tokens);

	// overload
	virtual void getCommand(
				vector<aruco::Marker>* TheMarkers,
				int* steering,
				int* throttle,
				int width);

	private :
		//type des parametre que l'on peut mettre dans le fichier a parser
		struct param
		{
			int throttle;
			int steering;
			int time;
		};

		int idle;
		std::vector<std::pair<int, struct param>>::iterator itCurrentAction; // iterator de l'action courante
		int timeOutAction; //temps maximal a passer dans une action
		int idCurrentAction; //id de l'action en cours
		double deltaTime; //temps passer dans l'action
		std::vector<std::pair<int, struct param>> tableIDAction; //table de correspondance entre les action et l'ID des QrCode
};


text:
<?php

namespace CascadeEnergy\Monolog\Handler;

use Aws\Kinesis\KinesisClient;
use CascadeEnergy\Monolog\Formatter\KinesisFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;

class KinesisHandler extends AbstractProcessingHandler
{
    /** @var KinesisClient */
    private $kinesisClient;

    /** @var string The name of the stream to send log messages to */
    private $streamName;

    /**
     * Constructor.
     *
     * @param KinesisClient $kinesisClient
     * @param string $streamName
     * @param int $level  The minimum logging level at which this handler will be triggered
     * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
     */
    public function __construct(KinesisClient $kinesisClient, $streamName, $level = Logger::INFO, $bubble = true)
    {
        parent::__construct($level, $bubble);

        $this->kinesisClient = $kinesisClient;
        $this->streamName = $streamName;
    }

    /**
     * {@inheritdoc}
     */
    protected function getDefaultFormatter()
    {
        return new KinesisFormatter();
    }

    /**
     * Writes the record down to the log of the implementing handler
     *
     * @param  array $record
     *
     * @return void
     */
    protected function write(array $record)
    {
        $content = $record['formatted'];
        $content['StreamName'] = $this->streamName;

        try {
            /** @noinspection PhpUndefinedMethodInspection */
            $this->kinesisClient->putRecord($content);
        } catch (\Exception $ex) {
            // We intentionally eat exceptions here -- the purpose of this handler is to emit logs to Kinesis for
            // real-time monitoring, not to guarantee delivery of mission critical logs. If Kinesis cannot accept
            // the log at this time, we just drop it on the floor and move on.
            // @TODO: A more durable (but slower) approach to exception handling would be a nice future option
        }
    }

    /**
     * {@inheritdoc}
     */
    public function handleBatch(array $records)
    {
        $kinesisParameters = $this->getFormatter()->formatBatch($records);
        $kinesisParameters['StreamName'] = $this->streamName;

        try {
            /** @noinspection PhpUndefinedMethodInspection */
            $this->kinesisClient->putRecords($kinesisParameters);
        } catch (\Exception $ex) {
            // As above, we intentionally allow logs to drop when Kinesis fails for any reason
        }

        return false === $this->bubble;
    }
}


text:
'use strict'

const express = require('express')
const bodyParser = require('body-parser')
const request = require('request')
const app = express()

app.set('port', (process.env.PORT || 5000))

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({extended: false}))

// parse application/json
app.use(bodyParser.json())

// index
app.get('/', function (req, res) {
	res.send('hello world i am a secret bot')
})

// for facebook verification
app.get('/webhook/', function (req, res) {
	if (req.query['hub.verify_token'] === 'my_voice_is_my_password_verify_me') {
		res.send(req.query['hub.challenge'])
	}
	res.send('Error, wrong token')
})

// to post data
app.post('/webhook/', function (req, res) {
	let messaging_events = req.body.entry[0].messaging
	for (let i = 0; i < messaging_events.length; i++) {
		let event = req.body.entry[0].messaging[i]
		let sender = event.sender.id
		if (event.message && event.message.text) {
			let text = event.message.text
			if (text === 'Major') {
				sendGenericMessage(sender)
				continue
			}
			if (text === 'Hello') {
				sendTextMessage(sender, "How can I help you?")
				continue
			}
		        if (text === 'Thanks') {
				sendTextMessage(sender, "You're welcome! Would you like our agent contact you to better assist you?")
				continue
			}
			 if (text === 'Financial aid') {
				sendTextMessage(sender, "Receive up to $5,775 in Federal Pell Grants, if you qualify")
				continue
			}
			 if (text === 'Call center hours') {
				sendTextMessage(sender, "Our agent will call you within 9am EST to 5pm EST hours")
				continue
			}
			sendTextMessage(sender, "Text received, echo: " + text.substring(0, 200))
		}
		if (event.postback) {
			let text = JSON.stringify(event.postback)
			sendTextMessage(sender, "Postback received: "+text.substring(0, 200), token)
			continue
		}
	}
	res.sendStatus(200)
})

const token = "EAALFMaX6ry0BAHHWQvrJ5aKPXDcJ9xPd6YgLMQp2yAbkwrTK4aZAmEVZBZAnkl9PGujW1Ei5BSXaiTmJMHL6GXUWd3DB9DPZBjIv2ZB7eNSWt6GCNsasZAhDmAPOigZAZAJ3T26KMZBRrN4OaAXaaHSsA9IulQrfhtpOgw60PZCUTnyNp1PAXKW4rA"

function sendTextMessage(sender, text) {
	let messageData = { text:text }

	request({
		url: 'https://graph.facebook.com/v2.6/me/messages',
		qs: {access_token:token},
		method: 'POST',
		json: {
			recipient: {id:sender},
			message: messageData,
		}
	}, function(error, response, body) {
		if (error) {
			console.log('Error sending messages: ', error)
		} else if (response.body.error) {
			console.log('Error: ', response.body.error)
		}
	})
}

function sendGenericMessage(sender) {
	let messageData = {
		"attachment": {
			"type": "template",
			"payload": {
				"template_type": "generic",
				"elements": [{
					"title": "Art&Design",
					"subtitle": "Areas of Interest",
					"image_url": "https://raw.githubusercontent.com/jennyzzz00/hello-world/master/ArtDesign.png",
					"buttons": [{
						"type": "web_url",
						"url": "https://www.messenger.com",
						"title": "web url"
					}, {
						"type": "postback",
						"title": "Postback",
						"payload": "Payload for first element in a generic bubble",
					}],
				}, {
					"title": "Business",
					"subtitle": "Areas of Interest",
					"image_url": "https://raw.githubusercontent.com/jennyzzz00/hello-world/master/Business.png",
					"buttons": [{
						"type": "postback",
						"title": "Postback",
						"payload": "Payload for second element in a generic bubble",
					}],
				}]
			}
		}
	}
	request({
		url: 'https://graph.facebook.com/v2.6/me/messages',
		qs: {access_token:token},
		method: 'POST',
		json: {
			recipient: {id:sender},
			message: messageData,
		}
	}, function(error, response, body) {
		if (error) {
			console.log('Error sending messages: ', error)
		} else if (response.body.error) {
			console.log('Error: ', response.body.error)
		}
	})
}

// spin spin sugar
app.listen(app.get('port'), function() {
	console.log('running on port', app.get('port'))
})


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.littlewings</groupId>
  <artifactId>spring-boot-hazelcast-wm-integration</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.9.RELEASE</version>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hazelcast</groupId>
      <artifactId>hazelcast-wm</artifactId>
      <version>3.3.3</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
          <args>
            <arg>-Xlint</arg>
            <arg>-unchecked</arg>
            <arg>-deprecation</arg>
            <arg>-feature</arg>
          </args>
          <recompileMode>incremental</recompileMode>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <scala.version>2.11.4</scala.version>
  </properties>
</project>


text:
package parameters_test

import (
	"strings"
	"testing"

	"github.com/eidolon/console/assert"
	"github.com/eidolon/console/parameters"
)

func TestDescribeOptions(t *testing.T) {
	t.Run("should include a title", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{})

		assert.True(t, strings.Contains(result, "OPTIONS:"), "Expected a title.")
	})

	t.Run("should include option names", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names: []string{
					"t",
					"test",
				},
			},
		})

		assert.True(t, strings.Contains(result, "-t"), "Expected option name in result.")
		assert.True(t, strings.Contains(result, "--test"), "Expected option name in result.")
	})

	t.Run("should handle multiple arguments", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names: []string{
					"f",
					"foo",
				},
			},
			{
				Names: []string{
					"b",
					"bar",
				},
			},
		})

		assert.True(t, strings.Contains(result, "-f"), "Expected option name in result.")
		assert.True(t, strings.Contains(result, "--foo"), "Expected option name in result.")
		assert.True(t, strings.Contains(result, "-b"), "Expected option name in result.")
		assert.True(t, strings.Contains(result, "--bar"), "Expected option name in result.")
	})

	t.Run("should sort arguments into alphabetical order", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names: []string{
					"f",
					"foo",
				},
			},
			{
				Names: []string{
					"b",
					"bar",
				},
			},
		})

		fooIdx := strings.Index(result, "--foo")
		barIdx := strings.Index(result, "--bar")

		assert.True(t, fooIdx > barIdx, "Expected FOO to come after BAR.")
	})

	t.Run("should show value names", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names:     []string{"foo"},
				ValueMode: parameters.OptionValueRequired,
				ValueName: "FOO_NAME",
			},
		})

		assert.True(t, strings.Contains(result, "FOO_NAME"), "Expected value name in output.")
	})

	t.Run("should show value names as optional if they are", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names:     []string{"foo"},
				ValueMode: parameters.OptionValueOptional,
				ValueName: "FOO_NAME",
			},
		})

		assert.True(t, strings.Contains(result, "[=FOO_NAME]"), "Expected value name in output.")
	})

	t.Run("should sort short options before long options names", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names: []string{
					"foo",
					"f",
				},
			},
		})

		fooIdx := strings.Index(result, "--foo")
		fIdx := strings.Index(result, "-f")

		assert.True(t, fooIdx > fIdx, "Expected --foo to come after -f.")
	})

	t.Run("should sort short options into alphabetical order", func(t *testing.T) {
		result := parameters.DescribeOptions([]parameters.Option{
			{
				Names: []string{
					"f",
					"b",
				},
			},
		})

		bIdx := strings.Index(result, "-b")
		fIdx := strings.Index(result, "-f")

		assert.True(t, fIdx > bIdx, "Expected -f to come after -b.")
	})
}


text:
var PORT = 8000;
var HOST = '127.0.0.1';
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();

var serverPath = path.join(__dirname, 'public');
var leafletFile = path.join(__dirname, 'leaflet-tracksymbol.js');

app.use(express.static(serverPath));
app.get('/leaflet-tracksymbol.js', function(req, res) {
	res.sendFile(leafletFile);
});

var httpServer = http.createServer(app).listen(PORT);
console.log('Http-server started in port ' + PORT);


text:
#include "config.h"

#include "journal.h"
#include "journal_file.h"

#include "rename_journal.h"
#include "log.h"
#include "opt.h"

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <sys/stat.h>
#include <sys/types.h>

#if HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif

struct priv {
  char* path;
  FILE* fp;
  time_t ot;
  long long nbytes_written;
};

static void destructor(struct journal* this_journal, FILE *log)
{
  struct priv* ppriv;

  this_journal->vtbl->close(this_journal, log);

  ppriv = (struct priv*)this_journal->priv;

  free(ppriv->path);
  free(ppriv);

  this_journal->vtbl = 0;
  this_journal->priv = 0;
}

static int xopen(struct journal* this_journal, int flags, FILE *log)
{
  struct priv* ppriv = (struct priv*)this_journal->priv;
  const char* mode;
  struct stat buf;
  time_t epoch = 0; /* Crashed files may include data from the past. */

  /* If this journal is already open, return an error. */
  if ( ppriv->fp )
    {
      return -1;
    }

  switch ( flags )
    {
      case O_RDONLY:
        mode = "rb";
        break;

      case O_WRONLY:
        mode = "wb";
        if ( 0 == stat(ppriv->path, &buf) )
          {
            rename_journal(ppriv->path, &epoch, log);
          }
        break;

      case O_RDWR:
        mode = "w+b";
        break;

      default:
        return -1;
    }

  ppriv->fp = fopen(ppriv->path, mode);

  if ( ! ppriv->fp )
    {
      return -1;
    }

#if HAVE_SYS_STATVFS_H
  if ( flags == O_WRONLY )
    {
      struct statvfs stfsbuf;

      if ( -1 == statvfs(ppriv->path, &stfsbuf) )
        {
          LOG_WARN(log,"Unable to determine free space available for %s.\n",
                   ppriv->path);
        }
      else
        {
          /* Check free space. */
          /* tmpfs give f_bsize==0 */
          long bsize = (stfsbuf.f_bsize!=0) ? stfsbuf.f_bsize : 4096 ;
          long lsz = ppriv->nbytes_written / bsize ;

          if ( lsz > (stfsbuf.f_bavail / 2.) )
            {
              LOG_WARN(log,"Low on disk space for new log %s.\n", ppriv->path);
              LOG_WARN(log,"Available space is %d blocks of %d bytes each.\n", stfsbuf.f_bavail, bsize);
              LOG_WARN(log,"Last log file contained %lld bytes.\n", ppriv->nbytes_written);
            }
        }
    }
#endif

  ppriv->ot = time(NULL);
  ppriv->nbytes_written = 0;

  return 0;
}

static int xclose(struct journal* this_journal, FILE *log)
{
  struct priv* ppriv = (struct priv*)this_journal->priv;

  if ( ! ppriv->fp )
    {
      return -1;
    }

  if ( fclose(ppriv->fp) )
    {
      ppriv->fp = 0;
      return -1;
    }

  rename_journal(ppriv->path, &ppriv->ot, log);
  ppriv->fp = 0;
  return 0;
}

static int xread(struct journal* this_journal, void* ptr, size_t size)
{
  size_t ret = fread(ptr, size, 1, ((struct priv*)this_journal->priv)->fp);
  return (int)ret * size;
}

static int xwrite(struct journal* this_journal, void* ptr, size_t size)
{
  struct priv* ppriv = (struct priv*)this_journal->priv;

  size_t ret = fwrite(ptr, size, 1, ((struct priv*)this_journal->priv)->fp);
  ppriv->nbytes_written += ret * size;
  return (int)ret * size;
}

int journal_file_ctor(struct journal* this_journal, const char* path, FILE *log)
{
  static struct journal_vtbl vtbl = {
    destructor,
    xopen, xclose,
    xread, xwrite
  };

  struct priv* ppriv;

  this_journal->vtbl = 0;
  this_journal->priv = 0;

  ppriv = (struct priv*)malloc(sizeof(struct priv));
  if ( 0 == ppriv )
    {
      LOG_ER(log,"Failed to allocate %d bytes for journal data.\n",
          sizeof(*ppriv));
      return -1;
    }
  memset(ppriv, 0, sizeof(*ppriv));

  if ( 0 == (ppriv->path = strdup(path)) )
    {
      free(ppriv);
      return -1;
    }

  this_journal->vtbl = &vtbl;
  this_journal->priv = ppriv;

  return 0;
}


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper.Internal;
using Grabacr07.KanColleWrapper.Models;
using Grabacr07.KanColleWrapper.Models.Raw;
using Livet;

namespace Grabacr07.KanColleWrapper
{
	public class Logger : NotificationObject
	{
		public bool EnableLogging { get; set; }

		private bool waitingForShip;
		private int dockid;
		private readonly int[] shipmats;

		private enum LogType
		{
			BuildItem,
			BuildShip,
			ShipDrop
		};

		internal Logger(KanColleProxy proxy)
		{
			this.shipmats = new int[5];

			// ちょっと考えなおす
			proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
			proxy.api_req_kousyou_createship.TryParse<kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
			proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
			proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
		}

		private void CreateItem(kcsapi_createitem item, NameValueCollection req)
		{
			Log(LogType.BuildItem, "{0},{1},{2},{3},{4},{5}",
				item.api_create_flag == 1 ? KanColleClient.Current.Master.SlotItems[item.api_slot_item.api_slotitem_id].Name : "Penguin",
				//KanColleClient.Current.Homeport.Organization.Fleets[1].Ships[0].Info.ShipType.Name,
				req["api_item1"], req["api_item2"], req["api_item3"], req["api_item4"], DateTime.Now.ToString("M/d/yyyy H:mm"));
		}

		private void CreateShip(NameValueCollection req)
		{
			this.waitingForShip = true;
			this.dockid = Int32.Parse(req["api_kdock_id"]);
			this.shipmats[0] = Int32.Parse(req["api_item1"]);
			this.shipmats[1] = Int32.Parse(req["api_item2"]);
			this.shipmats[2] = Int32.Parse(req["api_item3"]);
			this.shipmats[3] = Int32.Parse(req["api_item4"]);
			this.shipmats[4] = Int32.Parse(req["api_item5"]);
		}

		private void KDock(kcsapi_kdock[] docks)
		{
			foreach (var dock in docks.Where(dock => this.waitingForShip && dock.api_id == this.dockid))
			{
				this.Log(LogType.BuildShip, "{0},{1},{2},{3},{4},{5},{6}", KanColleClient.Current.Master.Ships[dock.api_created_ship_id].Name, this.shipmats[0], this.shipmats[1], this.shipmats[2], this.shipmats[3], this.shipmats[4], DateTime.Now.ToString("M/d/yyyy H:mm"));
				this.waitingForShip = false;
			}
		}

		private void BattleResult(kcsapi_battleresult br)
		{
			if (br.api_get_ship == null)
				return;

			Log(LogType.ShipDrop, "{0},{1},{2},{3},{4}", KanColleClient.Current.Translations.GetTranslation(br.api_get_ship.api_ship_name, TranslationType.Ships, br),
				KanColleClient.Current.Translations.GetTranslation(br.api_quest_name, TranslationType.OperationMaps, br),
				KanColleClient.Current.Translations.GetTranslation(br.api_enemy_info.api_deck_name, TranslationType.OperationSortie, br),
				br.api_win_rank, DateTime.Now.ToString("M/d/yyyy H:mm"));
		}

		private void Log(LogType type, string format, params object[] args)
		{
			if (!this.EnableLogging) return;

			try
			{
				string mainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

				switch (type)
				{
					case LogType.BuildItem:
						if (!File.Exists(mainFolder + "\\ItemBuildLog.csv"))
						{
							using (var w = File.AppendText(mainFolder + "\\ItemBuildLog.csv"))
							{
								w.WriteLine("Result,Secretary,Fuel,Ammo,Steel,Bauxite,Date", args);
							}
						}
						using (var w = File.AppendText(mainFolder + "\\ItemBuildLog.csv"))
						{
							w.WriteLine(format, args);
						}
						break;

					case LogType.BuildShip:
						if (!File.Exists(mainFolder + "\\ShipBuildLog.csv"))
						{
							using (var w = File.AppendText(mainFolder + "\\ShipBuildLog.csv"))
							{
								w.WriteLine("Result,Fuel,Ammo,Steel,Bauxite,# of Build Materials,Date", args);
							}
						}
						using (var w = File.AppendText(mainFolder + "\\ShipBuildLog.csv"))
						{
							w.WriteLine(format, args);
						}
						break;

					case LogType.ShipDrop:
						if (!File.Exists(mainFolder + "\\DropLog.csv"))
						{
							using (var w = File.AppendText(mainFolder + "\\DropLog.csv"))
							{
								w.WriteLine("Result,Operation,Enemy Fleet,Rank,Date", args);
							}
						}
						using (var w = File.AppendText(mainFolder + "\\DropLog.csv"))
						{
							w.WriteLine(format, args);
						}
						break;
				}
			}
			catch (Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}
	}
}


text:
      <app-login-settings [loginSettings]="loginSettings"
                          [inheritMode]="true"
                          [readonly]="readonly"
                          (onSavedLoginSettings)="updateLoginSettings($event)">
      </app-login-settings>

Login settings

Features which will be available on the login page.


text:
package com.neulevel.epp.ext.fee;

public abstract class EppResponseFeeType extends EppRequestFeeType
{
	// As of now only supported member as same as in request . All other members
	// which are define in RFC are not supported.
	// So keeping this class as place holder in support of some/all member is
	// started and it that we would not require any restructuring of classes and
	// implementation of other existing classes.
}


text:
<?php

// запрет прямого доступа
defined('_LINDEX') or die('STOP in file ' . __FILE__);

class LibMenuBar
{
    /**
     * Writes the start of the button bar table
     */
    public static function startTable()
    {
        ?>

    <?php
    }

    /**
     * Создание произвольных кнопок тулбара с параметром в виде ссылки и расширенным параметром extra
     */
    public static function ext($alt = _BUTTON, $href = '', $class = '', $extra = '')
    {
        ?>

<a class="tb-ext<?php echo $class; ?>" href="<?php echo $href; ?>" <?php echo $extra; ?>><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a custom option and task button for the button bar
     *
     * @param string  The task to perform (picked up by the switch($task) blocks
     * @param string  The image to display
     * @param string  The image to display when moused over
     * @param string  The alt text for the icon image
     * @param boolean True if required to check that a standard list item is checked
     */
    public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
    {
        if ($listSelect) {
            $href = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('" . _PLEASE_CHOOSE_ELEMENT . "');}else{submitbutton('$task')}";
        } else {
            $href = "javascript:submitbutton('$task')";
        }
        ?>

            <a class="tb-custom<?php echo $icon; ?>" href="<?php echo $href; ?>"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a custom option and task button for the button bar.
     * Extended version of custom() calling hideMainMenu() before submitbutton().
     *
     * @param string  The task to perform (picked up by the switch($task) blocks
     * @param string  The image to display
     * @param string  The image to display when moused over
     * @param string  The alt text for the icon image
     * @param boolean True if required to check that a standard list item is checked
     */
    public static function customX($task = '', $class = '', $iconOver = '', $alt = '', $listSelect = true)
    {
        if ($listSelect) {
            $href = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('" . _PLEASE_CHOOSE_ELEMENT . "');}else{hideMainMenu();submitbutton('$task')}";
        } else {
            $href = "javascript:hideMainMenu();submitbutton('$task')";
        }
        ?>

            <a class="tb-custom-x<?php echo $class; ?>" href="<?php echo $href; ?>"><?php echo
                    $alt; ?>

    <?php
    }

    /**
     * Writes the common 'new' icon for the button bar
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function addNew($task = 'new', $alt = _NEW)
    {
        ?>

            <a class="tb-add-new" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes the common 'new' icon for the button bar.
     * Extended version of addNew() calling hideMainMenu() before submitbutton().
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function addNewX($task = 'new', $alt = _NEW)
    {
        ?>

<a class="tb-add-new-x" href="javascript:hideMainMenu();submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>
<?php
    }

    /**
     * Writes a common 'publish' button
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function publish($task = 'publish', $alt = _SHOW)
    {
        ?>

<a class="tb-publish" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>
<?php
    }

    /**
     * Writes a common 'publish' button for a list of records
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function publishList($task = 'publish', $alt = _SHOW)
    {
        ?>

            <a class="tb-publish-list" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_FOR_PUBLICATION ?>'); } else {submitbutton('<?php echo
            $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'default' button for a record
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function makeDefault($task = 'default', $alt = _DEFAULT)
    {
        ?>

            <a class="tb-makedefault" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_MAKE_DEFAULT ?>'); } else {submitbutton('<?php echo
            $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'assign' button for a record
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function assign($task = 'assign', $alt = _ASSIGN)
    {
        ?>

            <a class="tb-assign" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_ASSIGN ?>'); } else {submitbutton('<?php echo
            $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'unpublish' button
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function unpublish($task = 'unpublish', $alt = _HIDE)
    {
        ?>

            <a class="tb-unpublish" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo
                    $alt; ?>

    <?php
    }

    /**
     * Writes a common 'unpublish' button for a list of records
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function unpublishList($task = 'unpublish', $alt = _HIDE)
    {
        ?>

            <a class="tb-unpublish-list" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_UNPUBLISH ?>'); } else {submitbutton('<?php echo
            $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'archive' button for a list of records
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function archiveList($task = 'archive', $alt = _TO_ARCHIVE)
    {
        ?>

            <a class="tb-archive-list"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_ARCHIVE ?>'); } else {submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes an unarchive button for a list of records
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function unarchiveList($task = 'unarchive', $alt = _FROM_ARCHIVE)
    {
        ?>

            <a class="tb-unarchive-list"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_UNARCHIVE ?>'); } else {submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a list of records
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editList($task = 'edit', $alt = _EDIT)
    {
        ?>

            <a class="tb-edit-list"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a list of records.
     * Extended version of editList() calling hideMainMenu() before submitbutton().
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editListX($task = 'edit', $alt = _EDIT)
    {
        ?>

            <a class="tb-edit-list-x"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {hideMainMenu();submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a template html
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editHtml($task = 'edit_source', $alt = _EDIT_HTML)
    {
        ?>

            <a class="tb-edit-html"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a template html.
     * Extended version of editHtml() calling hideMainMenu() before submitbutton().
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editHtmlX($task = 'edit_source', $alt = _EDIT_HTML)
    {
        ?>

            <a class="tb-edit-html-x"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {hideMainMenu();submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a template css
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editCss($task = 'edit_css', $alt = _EDIT_CSS)
    {
        ?>

            <a class="tb-edit-css"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'edit' button for a template css.
     * Extended version of editCss() calling hideMainMenu() before submitbutton().
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function editCssX($task = 'edit_css', $alt = _EDIT_CSS)
    {
        ?>

            <a class="tb-edit-css-x"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_EDIT ?>'); } else {hideMainMenu();submitbutton('<?php echo $task; ?>', '');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'delete' button for a list of records
     *
     * @param string Postscript for the 'are you sure' message
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function deleteList($msg = '', $task = 'remove', $alt = _DELETE)
    {
        ?>

            <a class="tb-delete-list"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_DELETE ?>'); } else if (confirm('<?php echo _REALLY_WANT_TO_DELETE_OBJECTS ?> <?php echo $msg; ?>')){ submitbutton('<?php echo $task; ?>');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a common 'delete' button for a list of records.
     * Extended version of deleteList() calling hideMainMenu() before submitbutton().
     *
     * @param string Postscript for the 'are you sure' message
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function deleteListX($msg = '', $task = 'remove', $alt = _DELETE)
    {
        ?>

            <a class="tb-delete-list-x"
               href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo _PLEASE_CHOOSE_ELEMENT_TO_DELETE ?>'); } else if (confirm('<?php echo _REALLY_WANT_TO_DELETE_OBJECTS ?> <?php echo $msg; ?>')){ hideMainMenu();submitbutton('<?php echo $task; ?>');}"><?php echo $alt; ?>

    <?php
    }

    /**
     * Write a trash button that will move items to Trash Manager
     */
    public static function trash($task = 'remove', $alt = _REMOVE_TO_TRASH, $check = true)
    {
        if ($check) {
            $js = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('" . _PLEASE_CHOOSE_ELEMENT_TO_TRASH . "'); } else { submitbutton('$task');}";
        } else {
            $js = "javascript:submitbutton('$task');";
        }
        ?>

            <a class="tb-trash" href="<?php echo $js; ?>"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a preview button for a given option (opens a popup window)
     *
     * @param string The name of the popup file (excluding the file extension)
     */
    public static function preview()
    {
        $task = LSef::getTask();
        ?>

            <?php echo _PREVIEW ?>

    <?php
    }

    /**
     * Writes a preview button for a given option (opens a popup window)
     *
     * @param string  The name of the popup file (excluding the file extension for an xml file)
     * @param boolean Use the help file in the component directory
     */
    public static function help($ref, $com = false)
    {
        if (LCore::getCfg('disable_button_help')) {
            return;
        } // при активном отключении кнопки "Помощь" функция прерывается в самом начале
        $url = 'http://wiki.joostinadev.ru/';

        ?>

            <a class="tb-help" href="#"
               onclick="window.open('<?php echo $url; ?>', 'mambo_help_win', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');"><?php echo _HELP ?>

    <?php
    }

    /**
     * Writes a save button for a given option
     * Apply operation leads to a save action only (does not leave edit mode)
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function apply($task = 'apply', $alt = _APPLY)
    {
        ?>

            <a class="tb-apply" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a save button for a given option
     * Save operation leads to a save and then close action
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function save($task = 'save', $alt = _SAVE)
    {
        ?>

            <a class="tb-save" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a save button for a given option (NOTE this is being deprecated)
     */
    public static function savenew()
    {
        ?>

            <?php echo _SAVE ?>

    <?php
    }

    /**
     * Writes a save button for a given option (NOTE this is being deprecated)
     */
    public static function saveedit()
    {
        ?>

            <?php echo _SAVE ?>

    <?php
    }

    /**
     * Writes a cancel button and invokes a cancel operation (eg a checkin)
     *
     * @param string An override for the task
     * @param string An override for the alt text
     */
    public static function cancel($task = 'cancel', $alt = _CANCEL)
    {
        ?>

            <a class="tb-cancel" href="javascript:submitbutton('<?php echo $task; ?>');"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a cancel button that will go back to the previous page without doing
     * any other operation
     */
    public static function back($alt = _MENU_BACK, $href = '')
    {
        if ($href) {
            $link = $href;
        } else {
            $link = 'javascript:window.history.back();';
        }
        ?>

            <a class="tb-back" href="<?php echo $link; ?>"><?php echo $alt; ?>

    <?php
    }

    /**
     * Write a divider between menu buttons
     */
    public static function divider()
    {
        ?>

<?php
    }

    /**
     * Writes a media_manager button
     *
     * @param string The sub-drectory to upload the media to
     */
    public static function media_manager($directory = '', $alt = _TASK_UPLOAD)
    {
        $mainframe = MainFrame::getInstance();;
        $cur_template = TEMPLATE;
        ?>

            <a class="tb-media-manager" href="#"
               onclick="popupWindow('popups/uploadimage.php?directory=<?php echo $directory; ?>&t=<?php echo $cur_template; ?>','win1',250,100,'no');"><?php echo $alt; ?>

    <?php
    }

    /**
     * Writes a spacer cell
     *
     * @param string The width for the cell
     */
    public static function spacer($width = '0')
    {
        return '

';
    }

    /**
     * Writes the end of the menu bar table
     */
    public static function endTable()
    {
        ?>

    <?php
    }
}


text:
package org.unitils.inject.annotation;

import org.unitils.core.annotation.AnnotationDefault;
import org.unitils.core.annotation.FieldAnnotation;
import org.unitils.inject.listener.InjectIntoStaticFieldAnnotationListener;
import org.unitils.inject.util.Restore;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.unitils.inject.util.Restore.DEFAULT;

/**
 * Annotation to inject the object assigned to the annotated field to a static property of the class defined by the target attribute.
 *

 * Explicit injection is used, which means that the object is injected to the property indicated by the {@link #property()}
 * attribute.
 *

 * You can also specify what action needs to be performed after the test. Suppose, for example, that you want to
 * mock a singleton instance by injecting the mock into the static singleton variable. After the test
 * was performed, you typically want to restore the old (real) singleton value, so that the next test can run with
 * the normal instance. This can be done by setting the resetType to the OLD_VALUE value. You can also specify that
 * the static instance should be cleared by setting it to null (or 0) or just leave the injected value.
 *
 * @author Filip Neven
 * @author Tim Ducheyne
 */
@Target(FIELD)
@Retention(RUNTIME)
@FieldAnnotation(InjectIntoStaticFieldAnnotationListener.class)
public @interface InjectIntoStatic {

    /**
     * The target class to which the object referenced by the annotated field is injected
     *
     * @return the target class, null for tested object
     */
    Class<?> target();

    /**
     * OGNL expression that defines the property to which the object referenced by the annotated field is injected
     *
     * @return the ognl expression, not null
     */
    String property();

    /**
     * The action that needs to be performed after the test was performed. Should the old value be put back,
     * should it be set to a java default value (null) or should nothing be done.
     *
     * @return the reset type, not null
     */
    @AnnotationDefault("inject.defaultRestore") Restore restore() default DEFAULT;

    @AnnotationDefault("inject.autoCreateInnerFields") boolean autoCreateInnerFields() default true;
}