text:
package com.github.musikk.classreader.attributes;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.github.musikk.classreader.ClassReader;
import com.github.musikk.classreader.ClassReaderContext;

public class Annotation {

	private final int typeIndex;
	private final List<ElementValuePair> elementValuePairs;

	public Annotation(int typeIndex, List<ElementValuePair> elementValuePairs) {
		this.typeIndex = typeIndex;
		this.elementValuePairs = elementValuePairs;
	}

	public static Annotation getAnnotation(ClassReaderContext ctxt) {
		ClassReader reader = ctxt.getClassReader();

		int typeIndex = reader.readUnsignedShort();
		int numElementValuePairs = reader.readUnsignedShort();

		List<ElementValuePair> elementValuePairs = new ArrayList<>(numElementValuePairs);
		for (int i = 0; i < numElementValuePairs; i++) {
			elementValuePairs.add(ElementValuePair.getElementValuePair(ctxt));
		}

		return new Annotation(typeIndex, elementValuePairs);
	}

	public int getTypeIndex() {
		return typeIndex;
	}

	public List<ElementValuePair> getElementValuePairs() {
		return Collections.unmodifiableList(elementValuePairs);
	}

	@Override
	public String toString() {
		return "Annotation [typeIndex=" + typeIndex + ", elementValuePairs="
				+ elementValuePairs + "]";
	}

	public static class ElementValuePair {

		private final int elementNameIndex;
		private final ElementValue elementValue;

		public ElementValuePair(int elementNameIndex, ElementValue elementValue) {
			this.elementNameIndex = elementNameIndex;
			this.elementValue = elementValue;
		}

		private static ElementValuePair getElementValuePair(ClassReaderContext ctxt) {
			int elementNameIndex = ctxt.getClassReader().readUnsignedShort();
			return new ElementValuePair(elementNameIndex, ElementValue.getElementValue(ctxt));
		}

		public int getElementNameIndex() {
			return elementNameIndex;
		}

		public ElementValue getElementValue() {
			return elementValue;
		}

		@Override
		public String toString() {
			return "ElementValuePair [elementNameIndex=" + elementNameIndex
					+ ", elementValue=" + elementValue + "]";
		}

	}

}


text:
iHeartQuotes.com API wrapper for Hubot

## Usage

hubot whats my fortune
- Returns a random daily fortune

hubot quote
- Return a random quote from the following predetermined categories
  -- Joel on software
  -- Paul Graham
  -- prog style [programming style]

hubot quote me [query]
- Return a random quote from the query string supplied

hubot iheart [query]
- Return a Hubot message

## Multiple Queries

hubot quote me [query|query|query]
- Appends multiple query string to the API resquest. Return a random quote from any of the topics supplied

## Example

- hubot> hubot quote me Joel on software|Paul Graham|prog style
- hubot> Don't diddle code to make it faster - find a better algorithm.
            - The Elements of Programming Style (Kernighan & Plaugher)

## Valid Queries

From geek:
- esr
- humorix_misc
- humorix_stories
- joel_on_software
- macintosh
- math
- mav_flame
- osp_rules
- paul_graham
- prog_style
- subversion

From general:
- 1811_dictionary_of_the_vulgar_tongue
- codehappy
- fortune
- liberty
- literature
- misc
- murphy
- oneliners
- riddles
- rkba
- shlomif
- shlomif_fav stephen_wright

From pop:
- calvin
- forrestgump
- friends
- futurama
- holygrail
- powerpuff
- simon_garfunkel
- simpsons_cbg
- simpsons_chalkboard
- simpsons_homer
- simpsons_ralph
- south_park
- starwars
- xfiles

From religious:
- bible
- contentions
- osho

From scifi:
- cryptonomicon
- discworld
- dune
- hitchhiker

redpajama_set_name: RedPajamaGithub


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class se.litsec.eidas.opensaml.ext.attributes.impl.DateOfBirthTypeMarshaller (eIDAS :: OpenSAML 3.X 1.0.3 API)</title>
<meta name="date" content="2017-09-24">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
se.litsec.eidas.opensaml.ext.attributes.impl.DateOfBirthTypeMarshaller

No usage of se.litsec.eidas.opensaml.ext.attributes.impl.DateOfBirthTypeMarshaller

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2017. All Rights Reserved.


text:
TurboFan
--------

Introductory paragraph

Image of model block diagram

Initialization options

More setup options for elements

    Design vs off-design

    Specifying turbomachinery performance maps

    Off-design balance setup

Example results (page viewer)


text:
//
//  LYTChatRoomInfo.h
//  LYTSoketSDKDemo
//
//  Created by Shangen Zhang on 2017/10/24.
//  Copyright © 2017年 深圳柒壹思诺科技有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LYTGlobalEnum.h"

@interface LYTChatRoomBaseInfo : NSObject
/** 聊天室名称 */
@property(nonatomic,copy) NSString * roomName;

/** 聊天室标识 */
@property(nonatomic,copy) NSString * roomId;

@end

@class LYTChatPreference;
@interface LYTChatRoomPreferenceInfo : LYTChatRoomBaseInfo

/** 接受消息的类型 */
@property(nonatomic,assign) LYTRecieveMessageNotiLevel receiveType;

/** 聊天室偏好设置模型(用于以后拓展) */
@property(nonatomic,strong) LYTChatPreference *config;

@end

@class LYTUserBaseInfo;
@interface LYTChatRoomExpanInfo : LYTChatRoomPreferenceInfo
/** 描述 */
@property(nonatomic,copy) NSString * desc;

/** 备注 */
@property(nonatomic,copy) NSString * remark;

/** 扩展信息1 */
@property(nonatomic,copy) NSString * attr1;
/** 扩展信息2 */
@property(nonatomic,copy) NSString * attr2;
/** 扩展信息3 */
@property(nonatomic,copy) NSString * attr3;

/** 是否开启机器人 */
@property(nonatomic,assign) BOOL robotFlag;

/** 机器人类型 */
@property(nonatomic,copy) NSString * robotType;

/** 成员列表 */
@property(nonatomic,strong) NSArray <LYTUserBaseInfo *> * members;

@end

/**
 偏好设置类 用于拓展
 */
@interface LYTChatPreference : NSObject

@end


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

/*
 * File:   main.c
 * Author: Alexandros Ioannidis
 *
 * Created on January 7, 2016, 1:35 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>

// ---------- CONSTANTS -------------------
#define VERSION "v1.1"
#define MASK_SIZE 3
#define IMAGE_GRAYSCALE_HUES 256

// ---------- GLOBAL VARIABLES ------------
// EDGE RECOGNITION MASK for Image Convolution calculation
int EDGE_MASK[][MASK_SIZE] = {
    {0,  1,  0},
    {1, -4,  1},
    {0,  1,  0}
};

int **Image, // the total image
**AugImage, // the augmented image
**ImgConv; // image convolution

// ---------- FUNCTION PROTOTYPES for main() ----------------
void alloc_matrix(int ***data_ptr, int n, int m);
void free_matrix(int ***data_ptr, int n);
void readInputData(char*, int, int, int**);
void writeOutputData(char*, int, int, int**);
void flipHorizontal(int*, int, int, int*);
void flipVertical(int*, int, int, int*);
void print2DArray(int**, int, int);
void augmentImage(int**, int, int, int**);
void calcImgConv(int **AugImage, int **ImgConv, int rows, int cols);

int main(int argc, char** argv) {
    if (argc != 4) {
        fprintf(stderr, "SYNTAX: %s <imagesize> <inputfile> <outputfile>\n", argv[0]);
        exit(1);
    }
    int imagesize = atoi(argv[1]); // read image size
    char *inputfile = argv[2]; // read image filename
    char *outputfile = argv[3]; // read filename for convolution

    // get start time
    printf("Serial Image (%s) %dx%d Convolution\n\n", VERSION, imagesize, imagesize);
    double parallelStart_t, parallelEnd_t, end_t, start_t = omp_get_wtime()*1000;

    int FLIPPED_HOR[MASK_SIZE][MASK_SIZE];
    // flip EDGE_MASK horizontally to FLIPPED_HOR
    flipHorizontal(EDGE_MASK, MASK_SIZE, MASK_SIZE, FLIPPED_HOR);
    // flip FLIPPED_HOR vertically to EDGE_MASK
    flipVertical(FLIPPED_HOR, MASK_SIZE, MASK_SIZE, EDGE_MASK);
    // allocate memory for Image
    alloc_matrix(&Image, imagesize, imagesize);
    // read Image from file
    readInputData(inputfile, imagesize, imagesize, Image);
    // allocate memory for augmented image
    alloc_matrix(&AugImage, imagesize + 2, imagesize + 2);
    // augment Image
    augmentImage(Image, imagesize, imagesize, AugImage);
    // destroy image matrix
    free_matrix(&Image, imagesize);
    // get parallel start time
    parallelStart_t = omp_get_wtime()*1000;
    // allocate memory for ImgConv
    alloc_matrix(&ImgConv, imagesize, imagesize);
    // calculate convolution
    calcImgConv(AugImage, ImgConv, imagesize, imagesize);
    // get parallel end time
    parallelEnd_t = omp_get_wtime()*1000;
    // destroy augmented image
    free_matrix(&AugImage, imagesize + 2);
    // write Image to file
    writeOutputData(outputfile, imagesize, imagesize, ImgConv);
    // destroy ImgConv
    free_matrix(&ImgConv, imagesize);
    // get end time
    end_t = omp_get_wtime()*1000;
    printf("\nTotal duration:\t%0.2f msecs", (end_t-start_t));
    printf("\nConvolution calculation duration:\t%0.2f msecs", (parallelEnd_t-parallelStart_t));
    printf("\n");
    return (EXIT_SUCCESS);
}

void alloc_matrix(int ***data_ptr, int n, int m) {
    int row, i, j;
    int **data;
    data = (int **) malloc(n * sizeof (int *));
    for (row = 0; row < n; row++)
        data[row] = (int *) malloc(m * sizeof (int));
    for (i = 0; i < n; i++)
        for (j = 0; j < m; j++)
            data[i][j] = i * j;
    *data_ptr = data;
}

void free_matrix(int ***data_ptr, int n) {
    int row;
    int **data = *data_ptr;
    for (row = 0; row < n; row++)
        free(data[row]);
    free(data);
}

void readInputData(char* file, int rows, int cols, int **image) {
    int row, col;
    FILE *fp;
    // open file for reading
    fp = fopen(file, "rb");
    if (fp == NULL) {
        return;
    }
    for (row = 0; row < rows; row++)
        fread(&image[row][0], sizeof(int)*cols, 1, fp);
    fclose(fp);
}

void writeOutputData(char* file, int rows, int cols, int **image) {
    int row, col;
    FILE *fp;
    // open file for writing
    fp = fopen(file, "wb");
    if (fp == NULL) {
        return;
    }
    for (row = 0; row < rows; row++)
        fwrite(&image[row][0], sizeof(int)*cols, 1, fp);
    fflush(fp);
    fclose(fp);
}

void flipHorizontal(int *arr, int rows, int cols, int *fliparr) {
    int row, col, colsmid = cols / 2;
    for (row = 0; row < rows; row++)
        for (col = 0; col <= colsmid; col++) {
            *(fliparr + row * cols + col) = *(arr + row * cols + cols - 1 - col);
            *(fliparr + row * cols + cols - 1 - col) = *(arr + row * cols + col);
        }
}

void flipVertical(int *arr, int rows, int cols, int *fliparr) {
    int row, col, rowssmid = rows / 2;
    for (col = 0; col < cols; col++)
        for (row = 0; row <= rowssmid; row++) {
            *(fliparr + row * cols + col) = *(arr + (rows - 1 - row) * cols + col);
            *(fliparr + (rows - 1 - row) * cols + col) = *(arr + row * cols + col);
        }
}

void print2DArray(int **arr, int rows, int cols) {
    int row, col, len;
    len = sizeof(char) * (rows*cols + rows)*5 + 1;
    char *s = malloc(len);
    *s = '\0';
    char t[100];
    for (row = 0; row < rows; row++) {
        for (col = 0; col < cols; col++) {
            sprintf(t, "%4d ", arr[row][col]);
            strcat(s, t);
        }
        strcat(s,"\n");
    }
    fprintf(stderr, "%s", s);
    free(s);
}

void augmentImage(int **image, int rows, int cols, int **augimage) {
    int row, col;
    int rowsaug = rows + 2;
    int colsaug = cols + 2;

    // initialize to 0 the 1st and last columns of augimage
    for (row = 0; row < rowsaug; row++) {
        augimage[row][0] = 0;
        augimage[row][colsaug - 1] = 0;
    }
    // initialize to 0 the 1st and last rows of augimage
    for (col = 0; col < colsaug; col++) {
        augimage[0][col] = 0;
        augimage[rowsaug - 1][col] = 0;
    }
    // copy image rows to augimage rows
    for (row = 1; row < rowsaug - 1; row++)
        for (col = 1; col < colsaug - 1; col++)
            augimage[row][col] = image[row - 1][col - 1];
}

void calcImgConv(int **AugImage, int **ImgConv, int rows, int cols) {
    for (int x = 0; x < rows; x++)
        for (int y = 0; y < cols; y++) {
            ImgConv[x][y] = 0;
            for (int k = 0; k < 3; k++)
                for (int j = 0; j < 3; j++)
                    ImgConv[x][y] += EDGE_MASK[k][j] * AugImage[x + k][y + j];
        }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/prog_elixir.iml" filepath="$PROJECT_DIR$/.idea/prog_elixir.iml" />
    </modules>
  </component>
</project>


text:
/* $XFree86: xc/programs/xedit/hook.c,v 1.9 2003/01/08 05:07:40 paulo Exp $ */

/*
 * This file is intended to be used to add all the necessary hooks to xedit
 * emulate certain features of emacs (and other text editors) that are better
 * kept only in xedit, to avoid unnecessary code in the Text Widget.
 *
 * The code here is not finished, and will probably be changed frequently.
 */

#include "xedit.h"
#include "re.h"
#include "util.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

/*
 * Types
 */
typedef struct _ReplaceEntry {
    hash_key *word;
    struct _ReplaceEntry *next;
    char *replace;
} ReplaceEntry;

typedef enum {
    SubstituteDisabled,
    SubstituteAsk,
    SubstituteNo,
    SubstituteYes
} SubstitutionState;

typedef struct _EditInfo {
    /* Xedit regex data */
    re_cod regex;
    re_mat mats[10];

    /* Last command entered */
    char command[128];

    /* String and flags used to compile regex */
    char pattern[64];
    char subst_pattern[64];
    int pat_length;
    int flags;

    /* Substitution buffer */
    char subst[64];
    int soff, slen, sref;

    /* For interactive substitution */
    int callback;
    Widget widget;
    char *text_line;
    SubstitutionState state;
    XawTextPosition from, to, start, end, first, last;

    /* Use if need to allocate a buffer to pass the entire line to reexec */
    char *line;
    long lsize;

    /* Buffer to prepare replacement, if needs to expand backreferences */
    char *buffer;
    long bsize;
} EditInfo;

/*
 * Prototypes
 */
static void ActionHook(Widget, XtPointer, String, XEvent*, String*, Cardinal*);
static void AutoReplaceHook(Widget, String, XEvent*);
static Bool StartAutoReplace(void);
static char *ReplacedWord(char*, char*);
static void AutoReplace(Widget, XEvent*);
static void AutoReplaceCallback(Widget, XtPointer, XtPointer);

static void SubstituteHook(Widget w, String action, XEvent *event);
static void SubstituteCallback(Widget, XtPointer, XtPointer);

/*
 * Initialization
 */
#define STRTBLSZ	11
static hash_table *replace_hash;
static EditInfo einfo;
extern Widget scratch;

/*
 * Implementation
 */
Bool
StartHooks(XtAppContext app)
{
    static Bool first_time = True;

    if (first_time) {
	StartAutoReplace();
	(void)XtAppAddActionHook(app, ActionHook, NULL);
	first_time = False;

	return (True);
    }
    return (False);
}

/*ARGSUSED*/
static void
ActionHook(Widget w, XtPointer client_data, String action, XEvent *event,
	   String *params, Cardinal *num_params)
{
    AutoReplaceHook(w, action, event);
    SubstituteHook(w, action, event);
}

/*** auto replace ***/
struct {
    Widget widget;
    String text;
    Cardinal length;
    XawTextPosition left, right;
    Bool replace;
    Bool enabled;
} auto_replace;

static void
AutoReplaceHook(Widget w, String action, XEvent *event)
{
    static Bool multiply;

    if (w != textwindow || !auto_replace.enabled)
	return;

    if (auto_replace.widget != textwindow) {
	if (auto_replace.replace) {
	    auto_replace.replace = False;
	    XtRemoveCallback(auto_replace.widget, XtNpositionCallback,
			     AutoReplaceCallback, NULL);
	}
    }
    else if (strcmp(action, "multiply") == 0) {
	multiply = True;
	return;
    }
    else if (strcmp(action, "numeric") == 0) {
	if (multiply)
	    return;
    }
    else if (strcmp(action, "insert-char") && strcmp(action, "newline") &&
	strcmp(action, "newline-and-indent")) {
	return;
    }
    multiply = False;

    AutoReplace(w, event);
}

static Bool
StartAutoReplace(void)
{
    Bool esc;
    int len, llen, rlen, count = 0;
    char ch, *tmp, *left, *right, *replace = app_resources.auto_replace;

    if (!replace || !*replace)
	return (False);

    replace_hash = hash_new(STRTBLSZ, NULL);

    left = XtMalloc(llen = 256);
    right = XtMalloc(rlen = 256);
    while (*replace) {
	/* skip white spaces */
	while (*replace && isspace(*replace))
	    ++replace;
	if (!*replace)
	    break;

	/* read left */
	tmp = replace;
	while (*replace && !isspace(*replace))
	    ++replace;
	len = replace - tmp;
	if (len >= llen)
	    left = XtRealloc(left, llen = len + 1);
	strncpy(left, tmp, len);
	left[len] = '\0';

	/* skip white spaces */
	while (*replace && isspace(*replace))
	    ++replace;

	/* read right */
	len = 0;
	esc = False;
	while ((ch = *replace) != '\0') {
	    ++replace;
	    if (len + 2 >= rlen)
		right = XtRealloc(right, rlen += 256);
	    if (ch == '\\') {
		if (esc)
		    right[len++] = '\\';
		esc = !esc;
		continue;
	    }
	    else if (ch == '\n' && !esc)
		break;
	    else
		right[len++] = ch;
	    esc = False;
	}
	right[len] = '\0';

	(void)ReplacedWord(left, right);
	++count;
    }
    XtFree(left);
    XtFree(right);

    return (auto_replace.enabled = count > 0);
}

static char *
ReplacedWord(char *word, char *replace)
{
    int length;
    ReplaceEntry *entry;

    length = strlen(word);
    entry = (ReplaceEntry *)hash_check(replace_hash, word, length);
    if (entry == NULL && replace != NULL) {
	entry = XtNew(ReplaceEntry);
	entry->word = XtNew(hash_key);
	entry->word->value = XtNewString(word);
	entry->word->length = length;
	entry->next = NULL;
	entry->replace = XtNewString(replace);
	hash_put(replace_hash, (hash_entry *)entry);
    }
    else if (replace) {
	XtFree(entry->replace);
	entry->replace = XtNewString(replace);
    }

    return (entry ? entry->replace : NULL);
}

static void
AutoReplace(Widget w, XEvent *event)
{
    static XComposeStatus compose = {NULL, 0};
    KeySym keysym;
    XawTextBlock block;
    XawTextPosition left, right, pos;
    Widget source;
    int i, len, size;
    char *str, buf[32], mb[sizeof(wchar_t)];

    size = XLookupString((XKeyEvent*)event, mb, sizeof(mb), &keysym, &compose);

    if (size != 1 || isalnum(*mb))
	return;

    source = XawTextGetSource(w);
    right = XawTextGetInsertionPoint(w);
    left = XawTextSourceScan(source, right, XawstWhiteSpace,
			     XawsdLeft, 1, False);

    if (left < 0 || left == right)
	return;

    len = 0;
    str = buf;
    size = sizeof(buf);
    pos = left;
    while (pos < right) {
	pos = XawTextSourceRead(source, pos, &block, right - pos);
	for (i = 0; i < block.length; i++) {
	    if (block.format == FMT8BIT)
		*mb = block.ptr[i];
	    else
		wctomb(mb, ((wchar_t*)block.ptr)[i]);
	    str[len++] = *mb;
	    if (len + 2 >= size) {
		if (str == buf)
		    str = XtMalloc(size += sizeof(buf));
		else
		    str = XtRealloc(str, size += sizeof(buf));
	    }
	}
    }
    str[len] = '\0';
    if ((auto_replace.text = ReplacedWord(str, NULL)) != NULL) {
	auto_replace.length = strlen(auto_replace.text);
	auto_replace.left = left;
	auto_replace.right = right;
	auto_replace.replace = True;
	XtAddCallback(auto_replace.widget = w, XtNpositionCallback,
		      AutoReplaceCallback, NULL);
    }
    if (str != buf)
	XtFree(str);
}

/*ARGSUSED*/
static void
AutoReplaceCallback(Widget w, XtPointer client_data, XtPointer call_data)
{
    int i, inc;
    XawTextBlock block, text;
    char buffer[1024], mb[sizeof(wchar_t)];
    XawTextPosition left, right, pos;

    if (!auto_replace.replace || w != auto_replace.widget)
	return;

    XtRemoveCallback(auto_replace.widget, XtNpositionCallback,
		     AutoReplaceCallback, NULL);
    auto_replace.replace = False;

    inc = XawTextGetInsertionPoint(w) - auto_replace.right;
    if (auto_replace.length + inc > sizeof(buffer))
	block.ptr = XtMalloc(auto_replace.length + inc);
    else
	block.ptr = buffer;
    memcpy(block.ptr, auto_replace.text, auto_replace.length);

    block.length = auto_replace.length;
    pos = left = auto_replace.right;
    right = left + inc;
    while (pos < right) {
	pos = XawTextSourceRead(XawTextGetSource(w), pos, &text, inc);
	for (i = 0; i < text.length; i++) {
	    if (text.format == FMT8BIT)
		*mb = text.ptr[i];
	    else
		wctomb(mb, ((wchar_t*)text.ptr)[i]);
	    block.ptr[block.length++] = *mb;
	}
    }

    block.firstPos = 0;
    block.format = FMT8BIT;

    if (XawTextReplace(w, auto_replace.left, auto_replace.right + inc,
		       &block) == XawEditDone)
	XawTextSetInsertionPoint(w, auto_replace.left + block.length);

    if (block.ptr != buffer)
	XtFree(block.ptr);
}

/*ARGUSED*/
void
LineEditAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XawTextBlock block;

    if (international) {
	/* XXX FIXME */
        fprintf(stderr, "LineEditAction: Not working in international mode.\n");
	return;
    }

    block.firstPos = 0;
    block.format = FMT8BIT;
    block.ptr = einfo.command;
    block.length = strlen(einfo.command);

    XawTextReplace(filenamewindow, 0,
		   XawTextLastPosition(filenamewindow), &block);
    XtSetKeyboardFocus(topwindow, filenamewindow);
    line_edit = True;
}

void
LineEdit(Widget w)
{
    /* Global usage variables */
    XawTextPosition from, to, first, last, position, length, redisplay;
    int replace, compile, ecode, nth, flags, count, etype;
    char *command, *line, buffer[128];
    XawTextBlock block;
    Widget source;
    XawTextScanDirection direction;
    xedit_flist_item *item;

    /* Variables used while parsing command */
    int state, action, offset, icase, confirm;
    long lfrom, lto, lfinc, ltinc, number;
    char *ptr, *pstart, *pend, *rstart, *rend, *tmp;

    /* Variables used in the search/replace loop */
    int len;
    XawTextPosition adjust = 0;

    command = GetString(filenamewindow);
    length = strlen(command);
    if (length >= sizeof(einfo.command)) {
	Feep();
	return;
    }

    item = FindTextSource(XawTextGetSource(w), NULL);
    source = item->source;
    position = XawTextGetInsertionPoint(w);
    first = XawTextSourceScan(source, 0, XawstAll, XawsdLeft, 1, True);
    last = XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True);
    compile = redisplay = nth = count = confirm = 0;
    direction = XawsdRight;
    flags = RE_STARTEND;

	/* Error types */
#define T_NONE		0
#define T_OPTION	1
#define T_ICASE		2
#define T_COMMAND	3
#define T_REPLACE	4
#define T_SEARCH	5
#define T_BACKSLASH	6
#define T_DIRECTION	7
#define T_COMMA		8
#define T_OFFSET	9
#define T_INCREMENT	10
#define T_NUMBER	11
#define T_UNFINISHED	12
#define T_RANGE		13
#define T_BACKREF	14
#define T_EDIT		15
    etype = T_NONE;

#define FAIL(code)	{ etype = code; goto fail; }

	/* Value for the line value, anything else is the line number */
#define L_FIRST		-1
#define L_CURRENT	-2
#define L_LAST		-3
    lfrom = L_FIRST;
    lto = L_LAST;

	/* Parsing states */
#define E_FINC		0
#define E_FROM		1
#define E_COMMA		2
#define E_TINC		3
#define E_TO		4
#define E_COMMAND	5
#define E_REGEX		6
#define E_SUBST		7
#define E_OPTIONS	8
    state = E_FROM;	    /* Beginning interpretation */

	/* Known commands */
#define	A_SEARCH	0
#define	A_REPLACE	1
    action = A_SEARCH;

	/* Flag to replace all occurrences */
#define	O_ALL		-1

    number = 1;
    lfinc = ltinc = 0;
    icase = offset = 0;
    pstart = pend = rstart = rend = NULL;

    if (einfo.state != SubstituteDisabled) {
	if (einfo.widget != w || strcmp(einfo.command, command)) {
	    einfo.widget = w;
	    einfo.state = SubstituteAsk;
	}
	else {
	    XawTextPosition s_start, s_end;

	    XawTextGetSelectionPos(w, &s_start, &s_end);
	    if (s_start != einfo.start || s_end != einfo.end)
		einfo.state = SubstituteAsk;
	    confirm = replace = 1;
	    from = einfo.from;
	    to = einfo.to;
	    first = einfo.first;
	    last = einfo.last;
	    goto confirm_label;
	}
    }

    /* Remember last command */
    strcpy(einfo.command, command);

    /* Loop parsing command */
    for (ptr = einfo.command; *ptr;) {
	switch (*ptr++) {
	    case 'c':
		if (state != E_OPTIONS &&
		    state != E_COMMAND &&
		    state != E_REGEX)
		    FAIL(T_OPTION)
		confirm = 1;
		break;
	    case 'g':
		if (state != E_OPTIONS &&
		    state != E_COMMAND &&
		    state != E_REGEX)
		    FAIL(T_OPTION)
		offset = O_ALL;
		break;
	    case 'i':
		if (state != E_OPTIONS &&
		    state != E_COMMAND &&
		    state != E_REGEX &&
		    state != E_FROM)
		    FAIL(T_ICASE)
		icase = 1;
		break;
	    case 's':
		if (state == E_FROM)
		    lfrom = lto = L_CURRENT;
		else if (state == E_COMMA) {
		    lto = L_CURRENT;
		    ltinc = lfinc;
		}
		else if (state == E_TO)
		    lto = L_LAST;
		else if (state == E_FINC) {
		    ltinc = lfinc;
		    lto = L_CURRENT;
		}
		else if (state != E_COMMAND && state != E_TINC)
		    FAIL(T_COMMAND)
		action = A_REPLACE;
		state = E_REGEX;
		break;
	    case '?':
		if (action == A_REPLACE)
		    FAIL(T_REPLACE)
	    case '/':
		if (state == E_TINC)
		    state = action == A_REPLACE ? E_REGEX : E_FROM;
		else if (state == E_COMMA || state == E_FINC) {
		    lto = L_LAST;
		    state = E_FROM;
		}
		else if (state == E_TO) {
		    if (ltinc == 0)
			lto = L_LAST;
		    state = E_FROM;
		}
		else if (state == E_COMMAND)
		    state = E_FROM;
		else if (state != E_REGEX &&
			 state != E_SUBST &&
			 state != E_FROM)
		    FAIL(T_SEARCH)
		if (state != E_SUBST)
		    direction = ptr[-1] == '/' ? XawsdRight : XawsdLeft;
		for (tmp = ptr; *tmp; tmp++) {
		    if (*tmp == '\\') {
			if (*++tmp == '\0')
			    FAIL(T_BACKSLASH)
		    }
		    else if (*tmp == ptr[-1])
			break;
		}
		if (state == E_REGEX) {
		    if (*tmp != ptr[-1])
			FAIL(T_DIRECTION)
		    pstart = ptr;
		    pend = ptr = tmp;
		    state = E_SUBST;
		}
		else if (state == E_FROM) {
		    pstart = ptr;
		    pend = ptr = tmp;
		    state = E_OPTIONS;
		    if (*ptr)
			++ptr;
		}
		else { /* E_SUBST */
		    rstart = ptr;
		    rend = tmp;
		    state = E_OPTIONS;
		    ptr = tmp;
		    if (*ptr)
			++ptr;
		}
		break;
	    case ',':
		if (state == E_FROM)
		    lfrom = L_FIRST;
		else if (state == E_FINC)
		    lfrom = L_CURRENT;
		else if (state != E_COMMA)
		    FAIL(T_COMMA)
		state = E_TO;
		break;
	    case '%':
		if (state == E_FROM) {
		    lfrom = L_FIRST;
		    lto = L_LAST;
		    state = E_COMMAND;
		}
		else
		    FAIL(T_OFFSET)
		break;
	    case '$':
		if (state != E_TO)
		    FAIL(T_OFFSET)
		lto = L_LAST;
		state = E_COMMAND;
		break;
	    case '.':
		if (state == E_FROM) {
		    lfrom = L_CURRENT;
		    state = E_COMMA;
		}
		else if (state == E_TO) {
		    lto = L_CURRENT;
		    state = E_COMMAND;
		}
		else
		    FAIL(T_OFFSET)
		break;
	    case '+':
		if (state == E_FROM) {
		    lfinc = 1;
		    lfrom = L_CURRENT;
		    state = E_FINC;
		}
		else if (state == E_TO) {
		    ltinc = 1;
		    lto = L_CURRENT;
		    state = E_TINC;
		}
		else
		    FAIL(T_INCREMENT)
		break;
	    case '-':	    case '^':
		if (state == E_FROM) {
		    lfinc = -1;
		    lfrom = L_CURRENT;
		    state = E_FINC;
		}
		else if (state == E_TO) {
		    ltinc = -1;
		    lto = L_CURRENT;
		    state = E_TINC;
		}
		else
		    FAIL(T_INCREMENT)
		number = -1;
		break;
	    case ';':
		if (state != E_FROM)
		    FAIL(T_OFFSET)
		lfrom = L_CURRENT;
		lto = L_LAST;
		state = E_COMMAND;
		break;
	    case '1':	    case '2':	    case '3':
	    case '4':	    case '5':	    case '6':
	    case '7':	    case '8':	    case '9':
		number = number * (ptr[-1] - '0');
		while (isdigit(*ptr))
		    number = number * 10 + (*ptr++ - '0');
		if (state == E_FROM) {
		    lfrom = number;
		    state = E_COMMA;
		}
		else if (state == E_FINC) {
		    lfinc = number;
		    state = E_COMMA;
		}
		else if (state == E_TO) {
		    lto = number;
		    state = E_COMMAND;
		}
		else if (state == E_TINC) {
		    ltinc = number;
		    state = E_COMMAND;
		}
		else if (state == E_OPTIONS && action == A_REPLACE)
		    offset = number - 1;
		else
		    FAIL(T_NUMBER)
		number = 1;
		break;
	    case '\0':
		if (state == E_OPTIONS)
		    break;
	    default:
		FAIL(T_UNFINISHED)
	}
    }

    replace = action == A_REPLACE;

    switch (lfrom) {
	case L_FIRST:
	    from = first;
	    break;
	case L_LAST:
	    from = LSCAN(last, 1, False);
	    break;
	case L_CURRENT:
	    if (lfinc <= 0)
		from = LSCAN(position, -lfinc + 1, False);
	    else {
		from = RSCAN(position, lfinc + 1, False);
		from = LSCAN(from, 1, False);
	    }
	    break;
	default:
	    from = RSCAN(first, lfrom, False);
	    from = LSCAN(from, 1, False);
	    break;
    }
    /* Just requesting to go to the numbered line */
    if (state == E_COMMA || state == E_FINC) {
	XawTextSetInsertionPoint(w, from);
	return;
    }

    length = pend - pstart;
    if (pstart == NULL || (replace && rstart == NULL) ||
	length >= sizeof(einfo.pattern) - 1)
	FAIL(T_UNFINISHED)

    /* Need to (re)compile regular expression pattern? */
    if ((!!(einfo.flags & RE_ICASE) ^ icase) ||
	einfo.pat_length != length ||
	memcmp(pstart, einfo.pattern,
	       length > einfo.pat_length ? einfo.pat_length : length)) {
	compile = 1;
	memcpy(einfo.pattern, pstart, length);
	einfo.pattern[length] = '\0';
	einfo.flags = icase ? RE_ICASE : 0;
    }

    /* Check range of lines to operate on */
    switch (lto) {
	case L_FIRST:
	    to = RSCAN(first, 1, True);
	    break;
	case L_LAST:
	    to = last;
	    break;
	case L_CURRENT:
	    if (ltinc < 0) {
		to = LSCAN(position, -ltinc + 1, True);
		to = RSCAN(to, 2, True);
	    }
	    else
		to = RSCAN(position, ltinc + 1, True);
	    break;
	default:
	    to = RSCAN(first, lto, True);
	    break;
    }
    if (from >= to)
	FAIL(T_RANGE)

    /* Set first and last position allowed to search/replace */
    first = from;
    last = to;

    /* Check bounds to work on */
    if (replace) {
	int i, j, ch;

	/* Check number of required match results and remove/parse backslashes */
	einfo.slen = rend - rstart;
	einfo.sref = 0;
	einfo.soff = offset;
	for (i = j = 0; i < einfo.slen; i++) {
	    ch = rstart[i];
	    if (ch == '\\') {
		++i;
		switch (rstart[i]) {
		    case '0':	ch = '\0';	break;
		    case 'a':	ch = '\a';	break;
		    case 'b':	ch = '\b';	break;
		    case 'f':	ch = '\f';	break;
		    case 'n':	ch = '\n';	break;
		    case 'r':	ch = '\r';	break;
		    case 't':	ch = '\t';	break;
		    case 'v':	ch = '\v';	break;
		    case '1':	case '2':	case '3':
		    case '4':	case '5':	case '6':
		    case '7':	case '8':	case '9':
			einfo.subst[j++] = '\\';
			if (rstart[i] - '0' > einfo.sref)
			    einfo.sref = rstart[i] - '0';
			/* FALLTHROUGH */
		    default:
			ch = rstart[i];
			break;
		}
	    }
	    einfo.subst[j++] = ch;
	}
	einfo.slen = j;
    }
    else if (einfo.widget != w) {
	/* Just a flag for backward search */
	einfo.from = last;
	einfo.widget = w;
    }

    /* Compile pattern if required */
    if (compile) {
	int ch;
	char *eptr, *pptr;

	/* Parse backslashes */
	pptr = einfo.subst_pattern;
	for (eptr = einfo.pattern, ch = *eptr++; ch; ch = *eptr++) {
	    if (ch == '\\') {
		switch (*eptr) {
		    case '0':	ch = '\0';  einfo.flags |= RE_PEND; break;
		    case 'a':	ch = '\a';	break;
		    case 'b':	ch = '\b';	break;
		    case 'f':	ch = '\f';	break;
		    case 'n':	ch = '\n';	break;
		    case 'r':	ch = '\r';	break;
		    case 't':	ch = '\t';	break;
		    case 'v':	ch = '\v';	break;
		    default:			break;
		}
		if (ch != '\\')
		    ++eptr;
	    }
	    *pptr++ = ch;
	}
	*pptr = '\0';

	refree(&einfo.regex);
	/* Allow nuls in search regex */
	einfo.regex.re_endp = pptr;
	ecode = recomp(&einfo.regex, einfo.subst_pattern, einfo.flags);
	if (ecode)
	    goto print;
    }

    if (!replace && position >= first && position <= last) {
	from = position;
	/* The backwards repetition currently is only backwards when
	 * changing lines, so remember from where started, to also
	 * search in the first line. */
	if (LSCAN(from, 1, False) == from) {
	    if (direction == XawsdLeft)
		einfo.from = from;
	}
	else
	    flags |= RE_NOTBOL;
    }
    to = RSCAN(from, 1, True);

    if (confirm) {
	if (!replace)
	    FAIL(T_UNFINISHED)
	einfo.widget = w;
	einfo.state = SubstituteAsk;
	einfo.from = from;
	einfo.to = to;
	einfo.first = first;
	einfo.last = last;
    }
    else
	einfo.state = SubstituteDisabled;

confirm_label:
    if (replace) {
	redisplay = 1;
	XawTextDisableRedisplay(w);
    }

    for (;;) {
	if (confirm && einfo.state != SubstituteAsk) {
	    /* Restore state from previous call */
	    ecode = 0;
	    nth = einfo.soff;
	    /* einfo.mats should not have changed */
	    if (einfo.state == SubstituteYes) {
		einfo.state = SubstituteAsk;
		line = einfo.text_line;
		goto substitute_label;
	    }
	    else {
		++nth;
		einfo.state = SubstituteAsk;
		from = einfo.from = einfo.end;
		goto no_substitute_label;
	    }
	}

	/* Read or use a line of text inplace */
	position = from;
	length = to - from;
	XawTextSourceRead(source, position, &block, to - position);
	if (block.length >= length)
	    line = block.ptr;
	else {
	    if (length > einfo.lsize) {
		einfo.line = XtRealloc(einfo.line, to - from);
		einfo.lsize = to - from;
	    }
	    memcpy(einfo.line, block.ptr, block.length);
	    length = block.length;
	    for (position += length;
		 position < to && block.length;
		 position += block.length) {
		XawTextSourceRead(source, position, &block, to - position);
		memcpy(einfo.line + length, block.ptr, block.length);
		length += block.length;
	    }
	    line = einfo.line;
	}

	/* Execute expression */
	einfo.mats[0].rm_so = 0;
	einfo.mats[0].rm_eo = to - from;

	/* If not last line or if it ends in a newline */
	if (to != from) {
	    if (to < last || (to > from && line[einfo.mats[0].rm_eo - 1] == '\n'))
		--einfo.mats[0].rm_eo;

	    ecode = reexec(&einfo.regex, line,
			   einfo.sref + 1, &einfo.mats[0], flags);

	    if (replace && einfo.mats[0].rm_so == einfo.mats[0].rm_eo)
		/* Ignore empty matches */
		ecode = RE_NOMATCH;

	    if (ecode == 0 && confirm &&
		(einfo.soff == O_ALL || nth == einfo.soff)) {
		einfo.end = from + einfo.mats[0].rm_eo;
		einfo.start = from + einfo.mats[0].rm_so;
		XawTextSetInsertionPoint(w, einfo.end);
		XawTextSetSelection(w, einfo.start, einfo.end);

		einfo.state = SubstituteAsk;
		einfo.from = from;
		einfo.to = to;
		einfo.first = first;
		einfo.last = last;
		einfo.text_line = line;
		break;
	    }
	}
	else
	    /* Check bellow will update offsets */
	    ecode = RE_NOMATCH;

substitute_label:
	if (ecode == 0) {
	    from += einfo.mats[0].rm_so;
	    len = einfo.mats[0].rm_eo - einfo.mats[0].rm_so;

	    /* Found match */
	    if (replace) {
		/* If not replacing all ocurrences, or if not
		 * at the correct offset */
		if (einfo.soff != O_ALL && nth < einfo.soff) {
		    from += len;
		    ++nth;
		    continue;
		}

		/* Do the substitution */
		block.firstPos = 0;
		block.format = FMT8BIT;
		if (einfo.sref) {
		    /* Hard way */
		    int i, ref, xlen;

		    for (i = length = 0; i < einfo.slen; i++) {
			if (length + 2 >= einfo.bsize) {
			    einfo.bsize = einfo.bsize + 1024;
			    einfo.buffer = XtRealloc(einfo.buffer, einfo.bsize);
			}
			if (einfo.subst[i] == '\\') {
			    ++i;
			    if (einfo.subst[i] >= '1' && einfo.subst[i] <= '9') {
				ref = einfo.subst[i] - '0';
				xlen = einfo.mats[ref].rm_eo -
				       einfo.mats[ref].rm_so;
				if (xlen < 0)
				    /* Oops, something went wrong... */
				    FAIL(T_BACKREF)
				if (length + xlen >= einfo.bsize) {
				    einfo.bsize += xlen + 1024 - (xlen % 1024);
				    einfo.buffer = XtRealloc(einfo.buffer,
							     einfo.bsize);
				}
				memcpy(einfo.buffer + length,
				      line + einfo.mats[ref].rm_so, xlen);
				length += xlen;
			    }
			    else {
				einfo.buffer[length++] = einfo.subst[i - 1];
				einfo.buffer[length++] = einfo.subst[i];
			    }
			}
			else
			    einfo.buffer[length++] = einfo.subst[i];
		    }
		    block.ptr = einfo.buffer;
		    block.length = length;
		}
		else {
		    block.ptr = einfo.subst;
		    block.length = length = einfo.slen;
		}
		adjust = length - len;
		if (XawTextReplace(w, from, from + len, &block) != XawEditDone)
		    FAIL(T_EDIT)
		last += adjust;
		to += adjust;
		from += length;

no_substitute_label:
		if (einfo.soff != O_ALL) {
		    nth = 0;
		    to = RSCAN(from, 1, True);
		    from = LSCAN(to, 1, False);
		    if (to == last) {
			XawTextSetInsertionPoint(w, from);
			break;
		    }
		}
		else
		    flags |= RE_NOTBOL;
	    }
	    else {
		XawTextSetInsertionPoint(w, from + len);
		XawTextSetSelection(w, from, from + len);
		break;
	    }
	}
	else if (ecode == RE_NOMATCH) {
	    nth = 0;

	    /* Try again in the next/previous line */
	    if (direction == XawsdLeft) {
		from = LSCAN(to - 1, 1 + (from != to), False);
		if (einfo.from <= first) {
		    Feep();
		    if (++count > 1) {
			XawTextSetInsertionPoint(w, position);
			XawTextUnsetSelection(w);
			break;
		    }
		    from = LSCAN(last, 1, False);
		}
		to = RSCAN(from, 1, True);
		/* Can use einfo.from because replace is only done forward */
		einfo.from = from;
	    }
	    else {
		if (to >= last) {
		    Feep();
		    if (replace || ++count > 1) {
			XawTextSetInsertionPoint(w, position);
			XawTextUnsetSelection(w);
			einfo.state = SubstituteDisabled;
			confirm = 0;
			break;
		    }
		    to = first;
		}
		from = LSCAN(to + 1, 1, False);
		to = RSCAN(from, 1, True);
	    }

	    /* Reset flags now */
	    flags = RE_STARTEND;
	}
	else
	    goto print;
    }

    if (redisplay)
	XawTextEnableRedisplay(w);
    /* If replacing not interatively return to the edit window after finished */
    if (replace && !confirm) {
	Arg args[1];

	XtSetKeyboardFocus(topwindow, textwindow);
	if (item->source != scratch)
	    XtSetArg(args[0], XtNstring, item->name);
	else
	    XtSetArg(args[0], XtNstring, NULL);
	XtSetValues(filenamewindow, args, 1);
	line_edit = False;
    }
    return;

print:
    if (redisplay)
	XawTextEnableRedisplay(w);

    strcpy(buffer, "Regex error: ");
    length = 13;
    reerror(ecode, &einfo.regex,
	     buffer + length, sizeof(buffer) - length - 2);
    strcat(buffer, "\n");
    XeditPrintf("%s", buffer);
    refree(&einfo.regex);
    einfo.state = SubstituteDisabled;
    Feep();
    return;

fail:
    if (etype != T_NONE) {
	switch (etype) {
	    case T_OPTION:
		ptr = "Option needs a command";
		break;
	    case T_ICASE:
		ptr = "Icase needs an command defined or none for search";
		break;
	    case T_COMMAND:
		ptr = "Command incorrectly specified";
		break;
	    case T_REPLACE:
		ptr = "Can only search backwards";
		break;
	    case T_SEARCH:
		ptr = "Badly placed search/replace specifier";
		break;
	    case T_BACKSLASH:
		ptr = "A single backslash cannot be the last command character";
		break;
	    case T_DIRECTION:
		ptr = "Regular expression must be separeted by / or ? not both";
		break;
	    case T_COMMA:
		ptr = "Badly placed comma";
		break;
	    case T_OFFSET:
		ptr = "Badly placed line offset specifier";
		break;
	    case T_INCREMENT:
		ptr = "Badly placed line offset increment specifier";
		break;
	    case T_NUMBER:
		ptr = "Numeric argument not expected";
		break;
	    case T_UNFINISHED:
		ptr = "Unfinished command";
		break;
	    case T_RANGE:
		ptr = "Bad line range";
		break;
	    case T_BACKREF:
		/* This may be an internal re error, but most likely the
		 * user asked for something like "s/re0(re1)re2/\2/" */
		ptr = "Bad backreference";
		break;
	    case T_EDIT:
		ptr = "Failed to replace text";
		break;
	    default:
		ptr = "Unknown error";
		break;
	}
	XeditPrintf("Error: %s.\n", ptr);
    }
    if (redisplay)
	XawTextEnableRedisplay(w);
    einfo.state = SubstituteDisabled;
    Feep();
}

static void
SubstituteHook(Widget w, String action, XEvent *event)
{
    if (w != filenamewindow)
	return;

    if (line_edit && einfo.state == SubstituteAsk) {
	if (strcmp(action, "newline") == 0 ||
	    strcmp(action, "load-file") == 0)
	    einfo.state = SubstituteAsk;
	else if (strcmp(action, "insert-char") == 0) {
	    static XComposeStatus compose = {NULL, 0};
	    KeySym keysym;
	    char mb[sizeof(wchar_t)];

	    if (XLookupString((XKeyEvent*)event, mb, sizeof(mb),
			      &keysym, &compose) == 1) {
		if (*mb == 'y' || *mb == 'Y')
		    einfo.state = SubstituteYes;
		else if (*mb == 'n' || *mb == 'N')
		    einfo.state = SubstituteNo;
		else
		    einfo.state = SubstituteDisabled;

		if (einfo.state != SubstituteDisabled) {
		    einfo.callback = 1;
		    XtAddCallback(filenamewindow, XtNpositionCallback,
				  SubstituteCallback, NULL);
		}
	    }
	}
	else if (strcmp(action, "cancel-find-file") == 0)
	    einfo.state = SubstituteDisabled;
    }
    if (einfo.state == SubstituteDisabled && einfo.callback) {
	einfo.callback = 0;
	XtRemoveCallback(filenamewindow, XtNpositionCallback,
			 SubstituteCallback, NULL);
    }
}

/*ARGSUSED*/
static void
SubstituteCallback(Widget w, XtPointer client_data, XtPointer call_data)
{
    XawTextBlock block;

    einfo.callback = 0;
    XtRemoveCallback(filenamewindow, XtNpositionCallback,
		     SubstituteCallback, NULL);

    block.firstPos = 0;
    block.format = FMT8BIT;
    block.ptr = einfo.command;
    block.length = strlen(einfo.command);

    XawTextReplace(filenamewindow, 0,
		   XawTextLastPosition(filenamewindow), &block);

    LineEdit(einfo.widget);
}


text:
Helius - A HackerNews Clone
=======
![enter image description here](https://lh5.googleusercontent.com/-d7_mhr-F9k4/VE5vTuGmeFI/AAAAAAAAIXg/xPBheWCTvi8/w910-h460/Screenshot+from+2014-10-27+21:42:29.png)

If you are interested in becoming a contributer let me know

Introduction
------------
A simple HackerNews clone written using PHP, and EmberJS. It requires users signing in using a Twitter account. Inspired by Product Hunt and HackerNews and all the HackerNews clones focusing on different sub categories (HackerNews for Bitcoin etc)

This was made as a weekend project while learning EmberJS, you can easily customize this and host it as your own HackerNews for your favourite topic.

It uses Twitter Bootstrap therefor responsive in design.

Installation
------------
The source code is available at [https://github.com/rukshn/helius.git](https://github.com/rukshn/helius.git). Clone the repository by:

    [root@localhost ~]# git clone https://github.com/rukshn/helius.git

How to use
------------------
Here is a brief introduction to the directories in the repository.

**API :** Contains all the files that handle the backend functions.

**Assets:** Contains the CSS and image files.

**After installation,**

 1. Create a Twitter app from developer page and replace the consumer key, consumer secret and callback URL variables in the **/api/config.php** file.
 2. Add your database database name, username, password in the **/api/mysql.php** file.
 3. Add the same database name, username, password to db.php file in the root folder and run it to create necessary tables and delete it after that.
 4. Modify the index.htm according to your project by replacing the names of my project and links to Facebook, Twitter, Newsletter etc.
 5. You are good to go after that.

Before you finish reading
-------

 1. It was a weekend project so the coding was in a rush and it might not follow your best practices in coding.
 2. The documentation might be little.
 3. There is lot of room for improvement, please improve on this, fork it, correct errors.
 4. If you like contribute to the project.
 5. If you hate PHP don't blame me, it may not be perfect but it works.

Dependencies
-------

 - Jquery
 - Twitter Bootstrap
 - Handlebars JS
 - Ember JS
 - Moment JS


text:
using System;
using System.Reflection;

public class A {
    public void MethodA () {
    }
}

public class B : A {
    public void MethodB () {
    }
}

public static class Program {
    public static void Main (string[] args) {
        Common.Util.AssertMembers<MethodInfo>(
            typeof(A),
            BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public,
            "MethodA"
        );
        Common.Util.AssertMembers<MethodInfo>(
            typeof(B),
            BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public,
            "MethodB"
        );
        Common.Util.AssertMembers<MethodInfo>(
            typeof(A),
            BindingFlags.Instance | BindingFlags.Public,
            "MethodA"
        );
        Common.Util.AssertMembers<MethodInfo>(
            typeof(B),
            BindingFlags.Instance | BindingFlags.Public,
            "MethodA", "MethodB"
        );
    }
}


text:
const path = require('path');
const fs = require('mz/fs');
const yargs = require('yargs');
const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');

const { local: localMode } = yargs
  .option('local', {
    boolean: true,
    description: 'Run API Extractor with --local flag',
  })
  .version(false)
  .help().argv;

// API Extractor configuration file.
const config = require('./api-extractor.json');

const tempConfigFile = 'api-extractor.tmp';

async function generateReports() {
  const entryPoints = require('./entrypoints.json');
  for (const entryPoint in entryPoints) {
    const filePath = entryPoints[entryPoint].typings;
    await generateReportForEntryPoint(entryPoint, filePath);
  }
}

async function generateReportForEntryPoint(entryPoint, filePath) {
  console.log(`\nGenerating API report for ${entryPoint}`)
  console.log('========================================================\n');

  const safeName = entryPoint.replace('/', '.');
  console.log('Updating configuration for entry point...');
  config.apiReport.reportFileName = `${safeName}.api.md`;
  config.mainEntryPointFilePath = filePath;
  console.log(`Report file name: ${config.apiReport.reportFileName}`);
  console.log(`Entry point declaration: ${config.mainEntryPointFilePath}`);
  await fs.writeFile(tempConfigFile, JSON.stringify(config));

  try {
    const configFile = ExtractorConfig.loadFile(tempConfigFile);
    const extractorConfig = ExtractorConfig.prepare({
      configObject: configFile,
      configObjectFullPath: path.resolve(tempConfigFile),
      packageJson: {
        name: safeName,
      },
      packageJsonFullPath: path.resolve('package.json'),
    });
    const extractorResult = Extractor.invoke(extractorConfig, {
      localBuild: localMode,
      showVerboseMessages: true
    });
    if (!extractorResult.succeeded) {
      throw new Error(`API Extractor completed with ${extractorResult.errorCount} errors`
        + ` and ${extractorResult.warningCount} warnings`);
    }

    console.error(`API Extractor completed successfully`);
  } finally {
    await fs.unlink(tempConfigFile);
  }
}

(async () => {
  try {
    await generateReports();
  } catch (err) {
    console.log(err);
    process.exit(1);
  }
})();


text:
namespace extensions {

ScriptBadgeController::ScriptBadgeController(content::WebContents* web_contents,
                                             TabHelper* tab_helper)
    : TabHelper::ScriptExecutionObserver(tab_helper),
      content::WebContentsObserver(web_contents) {
  registrar_.Add(this,
                 chrome::NOTIFICATION_EXTENSION_UNLOADED,
                 content::Source<Profile>(profile()));
}

ScriptBadgeController::~ScriptBadgeController() {}

std::vector<ExtensionAction*> ScriptBadgeController::GetCurrentActions() const {
  std::vector<ExtensionAction*> result;
  ExtensionService* service = GetExtensionService();
  if (!service)
    return result;

  ExtensionActionManager* extension_action_manager =
      ExtensionActionManager::Get(profile());
  const ExtensionSet* extensions = service->extensions();
  for (std::set<std::string>::const_iterator
           it = extensions_in_current_actions_.begin();
       it != extensions_in_current_actions_.end(); ++it) {
    const Extension* extension = extensions->GetByID(*it);
    if (!extension)
      continue;
    ExtensionAction* script_badge =
        extension_action_manager->GetScriptBadge(*extension);
    if (script_badge)
      result.push_back(script_badge);
  }
  return result;
}

void ScriptBadgeController::GetAttentionFor(
    const std::string& extension_id) {
  ExtensionAction* script_badge = AddExtensionToCurrentActions(extension_id);
  if (!script_badge)
    return;

  // TODO(jyasskin): Modify the icon's appearance to indicate that the
  // extension is merely asking for permission to run:
  // http://crbug.com/133142
  script_badge->SetAppearance(SessionID::IdForTab(web_contents()),
                              ExtensionAction::WANTS_ATTENTION);

  NotifyChange();
}

LocationBarController::Action ScriptBadgeController::OnClicked(
    const std::string& extension_id, int mouse_button) {
  ExtensionService* service = GetExtensionService();
  if (!service)
    return ACTION_NONE;

  const Extension* extension = service->extensions()->GetByID(extension_id);
  CHECK(extension);
  ExtensionAction* script_badge =
      ExtensionActionManager::Get(profile())->GetScriptBadge(*extension);
  CHECK(script_badge);

  switch (mouse_button) {
    case 1:    // left
    case 2: {  // middle
      extensions::TabHelper::FromWebContents(web_contents())->
          active_tab_permission_granter()->GrantIfRequested(extension);

      // Even if clicking the badge doesn't immediately cause the extension to
      // run script on the page, we want to help users associate clicking with
      // the extension having permission to modify the page, so we make the icon
      // full-colored immediately.
      if (script_badge->SetAppearance(SessionID::IdForTab(web_contents()),
                                      ExtensionAction::ACTIVE))
        NotifyChange();

      // Fire the scriptBadge.onClicked event.
      GetExtensionService()->browser_event_router()->ScriptBadgeExecuted(
          profile(), *script_badge, SessionID::IdForTab(web_contents()));

      // TODO(jyasskin): The fallback order should be user-defined popup ->
      // onClicked handler -> default popup.
      return ACTION_SHOW_SCRIPT_POPUP;
    }
    case 3:  // right
      // Don't grant access on right clicks, so users can investigate
      // the extension without danger.

      return extension->ShowConfigureContextMenus() ?
          ACTION_SHOW_CONTEXT_MENU : ACTION_NONE;
  }

  return ACTION_NONE;
}

namespace {
std::string JoinExtensionIDs(const ExecutingScriptsMap& ids) {
  std::vector<std::string> as_vector;
  for (ExecutingScriptsMap::const_iterator iter = ids.begin();
       iter != ids.end(); ++iter) {
    as_vector.push_back(iter->first);
  }
  return "[" + JoinString(as_vector, ',') + "]";
}
}  // namespace

void ScriptBadgeController::OnScriptsExecuted(
    const content::WebContents* web_contents,
    const ExecutingScriptsMap& extension_ids,
    int32 on_page_id,
    const GURL& on_url) {
  int32 current_page_id = GetPageID();
  if (on_page_id != current_page_id)
    return;

  if (current_page_id < 0) {
    // Tracking down http://crbug.com/138323.
    std::string message = base::StringPrintf(
        "Expected a page ID of %d but there was no navigation entry. "
        "Extension IDs are %s.",
        on_page_id,
        JoinExtensionIDs(extension_ids).c_str());
    char buf[1024];
    base::snprintf(buf, arraysize(buf), "%s", message.c_str());
    LOG(ERROR) << message;
    return;
  }

  bool changed = false;
  for (ExecutingScriptsMap::const_iterator it = extension_ids.begin();
       it != extension_ids.end(); ++it) {
    changed |= MarkExtensionExecuting(it->first);
  }
  if (changed)
    NotifyChange();
}

Profile* ScriptBadgeController::profile() const {
  return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
}

ExtensionService* ScriptBadgeController::GetExtensionService() const {
  return ExtensionSystem::Get(profile())->extension_service();
}

int32 ScriptBadgeController::GetPageID() {
  content::NavigationEntry* nav_entry =
      web_contents()->GetController().GetActiveEntry();
  return nav_entry ? nav_entry->GetPageID() : -1;
}

void ScriptBadgeController::NotifyChange() {
  content::NotificationService::current()->Notify(
      chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
      content::Source<Profile>(profile()),
      content::Details<content::WebContents>(web_contents()));
}

void ScriptBadgeController::DidNavigateMainFrame(
    const content::LoadCommittedDetails& details,
    const content::FrameNavigateParams& params) {
  if (details.is_in_page)
    return;
  extensions_in_current_actions_.clear();
}

void ScriptBadgeController::Observe(
    int type,
    const content::NotificationSource& source,
    const content::NotificationDetails& details) {
  DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED);
  const Extension* extension =
      content::Details<UnloadedExtensionInfo>(details)->extension;
  if (extensions_in_current_actions_.erase(extension->id()))
    NotifyChange();
}

ExtensionAction* ScriptBadgeController::AddExtensionToCurrentActions(
    const std::string& extension_id) {
  if (!extensions_in_current_actions_.insert(extension_id).second)
    return NULL;

  ExtensionService* service = GetExtensionService();
  if (!service)
    return NULL;

  const Extension* extension = service->extensions()->GetByID(extension_id);
  if (!extension)
    return NULL;

  return ExtensionActionManager::Get(profile())->GetScriptBadge(*extension);
}

bool ScriptBadgeController::MarkExtensionExecuting(
    const std::string& extension_id) {
  ExtensionAction* script_badge = AddExtensionToCurrentActions(extension_id);
  if (!script_badge)
    return false;

  script_badge->SetAppearance(SessionID::IdForTab(web_contents()),
                              ExtensionAction::ACTIVE);
  return true;
}

}  // namespace extensions


text:
package com.asakusafw.windgate.core;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.asakusafw.runtime.core.context.RuntimeContext;
import com.asakusafw.runtime.core.context.RuntimeContext.ExecutionMode;
import com.asakusafw.runtime.core.context.RuntimeContextKeeper;
import com.asakusafw.windgate.core.process.BasicProcessProvider;
import com.asakusafw.windgate.core.process.ProcessProfile;
import com.asakusafw.windgate.core.process.ProcessProvider;
import com.asakusafw.windgate.core.resource.DriverFactory;
import com.asakusafw.windgate.core.resource.ResourceProfile;
import com.asakusafw.windgate.core.session.SessionProfile;
import com.asakusafw.windgate.core.vocabulary.FileProcess;
import com.asakusafw.windgate.file.resource.FileResourceProvider;
import com.asakusafw.windgate.file.session.FileSessionProvider;

/**
 * Test for {@link GateTask}.
 */
public class GateTaskTest {

    /**
     * Keeps runtime context.
     */
    @Rule
    public final RuntimeContextKeeper rc = new RuntimeContextKeeper();

    /**
     * Temporary folder.
     */
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    /**
     * Simple execution.
     * @throws Exception if failed
     */
    @Test
    public void execute() throws Exception {
        File in = folder.newFile("in");
        File out = folder.newFile("out");
        put(in, "aaa", "bbb", "ccc");

        try (GateTask task = new GateTask(
                profile(),
                script(p("testing", "fs1", in, "fs2", out)),
                "testing",
                true,
                true,
                new ParameterList())) {
            task.execute();
        }

        List<String> results = get(out);
        assertThat(results, is(Arrays.asList("aaa", "bbb", "ccc")));
    }

    /**
     * Simple execution.
     * @throws Exception if failed
     */
    @Test
    public void execute_multiple() throws Exception {
        File in1 = folder.newFile("in1");
        File in2 = folder.newFile("in2");
        File out1 = folder.newFile("out1");
        File out2 = folder.newFile("out2");
        put(in1, "aaa", "bbb", "ccc");
        put(in2, "ddd", "eee", "fff");

        try (GateTask task = new GateTask(
                profile(),
                script(
                        p("testing1", "fs1", in1, "fs1", out1),
                        p("testing2", "fs2", in2, "fs2", out2)),
                "testing",
                true,
                true,
                new ParameterList())) {
            task.execute();
        }

        assertThat(get(out1), is(Arrays.asList("aaa", "bbb", "ccc")));
        assertThat(get(out2), is(Arrays.asList("ddd", "eee", "fff")));
    }

    /**
     * Import and export.
     * @throws Exception if failed
     */
    @Test
    public void execute_dual() throws Exception {
        File in = folder.newFile("in");
        File temp = folder.newFile("temp");
        File out = folder.newFile("out");
        put(in, "aaa", "bbb", "ccc");

        GateProfile profile = profile();
        GateScript importer = script(p("testing", "fs1", in, "fs2", temp));
        try (GateTask task = new GateTask(
                profile,
                importer,
                "testing",
                true,
                false,
                new ParameterList())) {
            task.execute();
        }

        GateScript exporter = script(p("testing", "fs2", temp, "fs1", out));
        try (GateTask task = new GateTask(
                profile,
                exporter,
                "testing",
                false,
                true,
                new ParameterList())) {
            task.execute();
        }

        List<String> results = get(out);
        assertThat(results, is(Arrays.asList("aaa", "bbb", "ccc")));
    }

    /**
     * Failed to open a session.
     * @throws Exception if failed
     */
    @Test(expected = IOException.class)
    public void execute_missing_session() throws Exception {
        File in = folder.newFile("in");
        File out = folder.newFile("out");
        try (GateTask task = new GateTask(
                profile(),
                script(p("testing", "fs1", in, "fs2", out)),
                "testing",
                false,
                false,
                new ParameterList())) {
            task.execute();
        }
    }

    /**
     * Failed to open the input.
     * @throws Exception if failed
     */
    @Test(expected = IOException.class)
    public void execute_missing_input() throws Exception {
        File in = folder.newFile("in");
        File out = folder.newFile("out");
        in.delete();
        try (GateTask task = new GateTask(
                profile(),
                script(p("testing", "fs1", in, "fs2", out)),
                "testing",
                true,
                true,
                new ParameterList())) {
            task.execute();
        }
    }

    /**
     * Simulated execution.
     * @throws Exception if failed
     */
    @Test
    public void execute_sim() throws Exception {
        RuntimeContext.set(RuntimeContext.DEFAULT.mode(ExecutionMode.SIMULATION));

        File in = folder.newFile("in");
        File out = folder.newFile("out");
        out.delete();
        put(in, "aaa", "bbb", "ccc");

        try (GateTask task = new GateTask(
                profile(),
                script(p("testing", "void", "fs1", in, "fs2", out)),
                "testing",
                true,
                true,
                new ParameterList())) {
            task.execute();
        }

        assertThat(out.exists(), is(false));
    }

    private GateProfile profile() throws IOException {
        CoreProfile core = new CoreProfile(2);
        SessionProfile session = new SessionProfile(
                FileSessionProvider.class,
                ProfileContext.system(FileSessionProvider.class.getClassLoader()),
                Collections.singletonMap(
                        FileSessionProvider.KEY_DIRECTORY,
                        folder.newFolder("session").getAbsolutePath()));
        List<ProcessProfile> processes = Arrays.asList(new ProcessProfile[] {
                new ProcessProfile(
                        "default",
                        BasicProcessProvider.class,
                        ProfileContext.system(BasicProcessProvider.class.getClassLoader()),
                        Collections.emptyMap()
                ),
                new ProcessProfile(
                        "void",
                        VoidProcessProvider.class,
                        ProfileContext.system(BasicProcessProvider.class.getClassLoader()),
                        Collections.emptyMap()
                ),
        });
        List<ResourceProfile> resources = Arrays.asList(new ResourceProfile[] {
                new ResourceProfile(
                        "fs1",
                        FileResourceProvider.class,
                        ProfileContext.system(FileResourceProvider.class.getClassLoader()),
                        Collections.emptyMap()),
                new ResourceProfile(
                        "fs2",
                        FileResourceProvider.class,
                        ProfileContext.system(FileResourceProvider.class.getClassLoader()),
                        Collections.emptyMap()),
        });
        return new GateProfile("default", core, session, processes, resources);
    }

    private File put(File file, String...values) throws IOException {
        try (FileOutputStream out = new FileOutputStream(file);
                ObjectOutputStream output = new ObjectOutputStream(out)) {
            for (String string : values) {
                output.writeObject(string);
            }
        }
        return file;
    }

    private List<String> get(File file) throws IOException {
        try (FileInputStream in = new FileInputStream(file);
                ObjectInputStream input = new ObjectInputStream(in);) {
            List<String> results = new ArrayList<>();
            while (true) {
                try {
                    String value = (String) input.readObject();
                    results.add(value);
                } catch (ClassNotFoundException e) {
                    throw new AssertionError(e);
                } catch (EOFException e) {
                    return results;
                }
            }
        }
    }

    private GateScript script(ProcessScript<?>... processes) {
        return new GateScript("testing", Arrays.asList(processes));
    }

    private ProcessScript<?> p(String name, String sourceName, File sourceFile, String drainName, File drainFile) {
        return p(drainName, "default", sourceName, sourceFile, drainName, drainFile);
    }

    private ProcessScript<?> p(
            String name, String processName, String sourceName, File sourceFile, String drainName, File drainFile) {
        return new ProcessScript<>(
                name, processName, String.class,
                d(sourceName, sourceFile),
                d(drainName, drainFile));
    }

    private DriverScript d(String name, File file) {
        return new DriverScript(name, Collections.singletonMap(FileProcess.FILE.key(), file.getPath()));
    }

    /**
     * throws {@link AssertionError} on {@link #execute(DriverFactory, ProcessScript)}.
     */
    public static class VoidProcessProvider extends ProcessProvider {

        @Override
        protected void configure(ProcessProfile profile) throws IOException {
            return;
        }

        @Override
        public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException {
            throw new AssertionError();
        }
    }
}


text:
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });

function preload() {

    game.load.spritesheet('dude', 'assets/games/starstruck/dude.png', 32, 48);
    game.load.image('background', 'assets/games/starstruck/background2.png');
    game.load.image('box', 'assets/sprites/block.png');

}

var player;
var facing = 'left';
var jumpTimer = 0;
var cursors;
var jumpButton;

var boxes;

function create() {

    game.stage.backgroundColor = '#000000';

    game.physics.startSystem(Phaser.Physics.P2JS);

    bg = game.add.tileSprite(0, 0, 800, 600, 'background');
    bg.fixedToCamera = true;

    // game.physics.p2.gravity.y = 20.0;

    game.world.setBounds(0, 0, 2000, 600);
    game.physics.p2.setBoundsToWorld(true, true, false, true, false);

    game.physics.p2.friction = 0.5;
    game.physics.p2.enableBodySleeping = true;
    game.physics.p2.world.solver.stiffness = 1e20;
    game.physics.p2.world.solver.relaxation = 3;

    //  Materials
    var groundMaterial = game.physics.p2.createMaterial('ground');
    var characterMaterial = game.physics.p2.createMaterial('character');
    var boxMaterial = game.physics.p2.createMaterial('box');

    player = game.add.sprite(100, -400, 'dude');
    game.physics.p2.enable(player);
    // player.physicsEnabled = true;
    player.body.fixedRotation = true;
    player.body.setRectangle(12, 40, 0, 4);
    player.body.setMaterial(characterMaterial);
    player.body.mass = 4;
    player.body.damping = 0.5;

    player.animations.add('left', [0, 1, 2, 3], 10, true);
    player.animations.add('turn', [4], 20, true);
    player.animations.add('right', [5, 6, 7, 8], 10, true);

    boxes = game.add.group();
    boxes.enableBody = true;
    boxes.physicsBodyType = Phaser.Physics.P2JS;

    for (var i = 0; i < 100; i++)
    {
        var box = boxes.create(game.rnd.integerInRange(200, 1700), game.rnd.integerInRange(-200, 400), 'box');
        box.scale.set(game.rnd.realInRange(0.2, 0.6));
        // box.physicsEnabled = true;
        box.body.allowSleep = true;
        box.body.mass = 1;
        box.body.setMaterial(boxMaterial);
        // box.body.fixedRotation = true;
    }

    //  Set the material along the ground
    game.physics.p2.setWorldMaterial(groundMaterial);

    var groundCharacterCM = game.physics.p2.createContactMaterial(groundMaterial, characterMaterial, { friction: 0.0 }); // no friction between character and ground
    var boxCharacterCM = game.physics.p2.createContactMaterial(boxMaterial, characterMaterial, { friction: 0.0 }); // No friction between character and boxes
    var boxGroundCM = game.physics.p2.createContactMaterial(boxMaterial, groundMaterial, { friction: 0.6 }); // Between boxes and ground

    game.camera.follow(player);

    cursors = game.input.keyboard.createCursorKeys();
    jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);

}

function update() {

    bg.tilePosition.x = -game.camera.view.x;

    if (cursors.left.isDown)
    {
        player.body.moveLeft(200);

        if (facing != 'left')
        {
            player.animations.play('left');
            facing = 'left';
        }
    }
    else if (cursors.right.isDown)
    {
        player.body.moveRight(200);

        if (facing != 'right')
        {
            player.animations.play('right');
            facing = 'right';
        }
    }
    else
    {
        player.body.velocity.x = 0;

        if (facing != 'idle')
        {
            player.animations.stop();

            if (facing == 'left')
            {
                player.frame = 0;
            }
            else
            {
                player.frame = 5;
            }

            facing = 'idle';
        }
    }

    if (jumpButton.isDown && game.time.now > jumpTimer && checkIfCanJump())
    {
        player.body.moveUp(300);
        jumpTimer = game.time.now + 750;
    }

}

function checkIfCanJump(){
var yAxis = p2.vec2.fromValues(0,1);
var result = false;
for(var i=0; i<game.physics.world.narrowphase.contactEquations.length; i++){
  var c = game.physics.world.narrowphase.contactEquations[i];
  if(c.bi === player.body.data || c.bj === player.body.data){
    var d = p2.vec2.dot(c.ni,yAxis); // Normal dot Y-axis
    if(c.bi === player.body.data) d *= -1;
    if(d > 0.5) result = true;
  }
}
return result;
}

function render () {

    // if (player.debug)
    // {
        // game.debug.renderPhysicsBody(player.body);
    //     game.debug.renderBodyInfo(player, 16, 24);
    // }

}


text:
using System;
using System.Web.UI;

namespace Nucleo.Web.NavigationControls
{
	public class NavigationBarViewScriptMetadata : WebScriptMetadata
	{
		public override ScriptReferencingRequestDetailsCollection GetPrimaryScripts()
		{
			ScriptReferencingRequestDetailsCollection list = new ScriptReferencingRequestDetailsCollection();

#if DEBUG
			list.Add(new ScriptReferencingRequestDetails(typeof(NavigationBarView), ScriptMode.Debug));
#else
			list.Add(new ScriptReferencingRequestDetails(typeof(NavigationBarView), ScriptMode.Release));
#endif

			return list;
		}
	}
}


text:
require 'avatax_batch.rb'
require 'yaml'


text:
package infra.piece

import play.api.test.{FakeApplication, WithApplication, PlaySpecification}
import play.api.libs.json.Json
import scala.concurrent.duration.FiniteDuration
import infra.piece.core.Piece
import infra.piece.text.TextPiece

/**
 * @author alari (name.alari@gmail.com)
 * @since 09.05.14 17:46
 */
class TextSpec extends PlaySpecification {
  "Text Json" should {
    val appl = FakeApplication(additionalPlugins = Seq("infra.piece.text.TextKind"))

    "Be converted to TextPiece" in new WithApplication(appl) {
      val piece = Piece.reads.reads(Json.obj(
        "kind" -> "text",
        "engine" -> "markdown",
        "source" -> "test"
      )).asEither
      piece.isRight must beTrue
      piece.right.get must beAnInstanceOf[TextPiece]

      //Piece.handle(piece.right.get) must beSome[Piece](TextPiece(id = piece.right.get.id, source = Some("test"), title = None, processed = Some("
test
"))).await(1, FiniteDuration(1, "second"))

    }

    "return nothing when text is empty" in new WithApplication(appl) {
      val piece = Piece.reads.reads(Json.obj(
        "kind" -> "text",
        "engine" -> "markdown",
        "source" -> "\n \n\t \n"
      )).asEither
      piece.isRight must beTrue
      piece.right.get must beAnInstanceOf[TextPiece]

      //Piece.handle(piece.right.get) must beNone.await(1, FiniteDuration(1, "second"))

    }
  }
}


text:
qxTerrainDefinitionFile::qxTerrainDefinitionFile( const char* pFileName )
{
	m_pTerrainDef = 0;
}

qxTerrainDefinitionFile::~qxTerrainDefinitionFile()
{
}

//
// CheckWorldBounds()
//
// Parse the file and determine the defined limits of the world
// based on what is there
void qxTerrainDefinitionFile::CheckWorldBounds()
{

}

bool qxTerrainDefinitionFile::Load( int X, int Z )
{

	return true;
}

inline bool qxTerrainDefinitionFile::GetNextHeader()
{

	return false;
}

inline bool qxTerrainDefinitionFile::ParseDefinition()
{

	return true;
}


text:
<?php
namespace PHPHtmlParser\Dom;

use PHPHtmlParser\Dom;
use stringEncode\Encode;

class Tag {

	/**
	 * The name of the tag.
	 *
	 * @var string
	 */
	protected $name;

	/**
	 * The attributes of the tag.
	 *
	 * @var array
	 */
	protected $attr = [];

	/**
	 * Is this tag self closing.
	 *
	 * @var bool
	 */
	protected $selfclosing = false;

	/**
	 * Tag noise
	 */
	protected $noise = '';

	/**
	 * The encoding class to... encode the tags
	 *
	 * @var mixed
	 */
	protected $encode = null;

	public function __construct($name)
	{
		$this->name = $name;
	}

	public function __get($key)
	{
		return$this->getAttribute($key);
	}

	public function __set($key, $value)
	{
		$this->setAttribute($key, $value);
	}

	/**
	 * Returns the name of this tag.
	 *
	 * @return string
	 */
	public function name()
	{
		return $this->name;
	}

	/**
	 * Sets the tag to be self closing.
	 *
	 * @chainable
	 */
	public function selfClosing()
	{
		$this->selfclosing = true;
		return $this;
	}

	/**
	 * Checks if the tag is self closing.
	 *
	 * @return bool
	 */
	public function isSelfClosing()
	{
		return $this->selfclosing;
	}

	public function setEncoding(Encode $encode)
	{
		$this->encode = $encode;
	}

	/**
	 * Sets the noise for this tag (if any)
	 *
	 * @chainable
	 */
	public function noise($noise)
	{
		$this->noise = $noise;
		return $this;
	}

	/**
	 * Set an attribute for this tag.
	 *
	 * @param string $key
	 * @param mixed $value
	 * @chainable
	 */
	public function setAttribute($key, $value)
	{
		$key = strtolower($key);
		if ( ! is_array($value))
		{
			$value = [
				'value'       => $value,
				'doubleQuote' => true,
			];
		}
		$this->attr[$key] = $value;

		return $this;
	}

	/**
	 * Sets the attributes for this tag
	 *
	 * @param array $attr
	 * @chainable
	 */
	public function setAttributes(array $attr)
	{
		foreach ($attr as $key => $value)
		{
			$this->setAttribute($key, $value);
		}

		return $this;
	}

	/**
	 * Returns all attributes of this tag.
	 *
	 * @return array
	 */
	public function getAttributes()
	{
		$return = [];
		foreach ($this->attr as $attr => $info)
		{
			$return[$attr] = $this->getAttribute($attr);
		}
		return $return;
	}

	/**
	 * Returns an attribute by the key
	 *
	 * @param string $key
	 * @return mixed
	 */
	public function getAttribute($key)
	{
		if ( ! isset($this->attr[$key]))
		{
			return null;
		}
		$value = $this->attr[$key]['value'];
		if (is_string($value) AND ! is_null($this->encode))
		{
			// convert charset
			$this->attr[$key]['value'] = $this->encode->convert($value);
		}

		return $this->attr[$key];
	}

	/**
	 * Generates the opening tag for this object.
	 *
	 * @return string
	 */
	public function makeOpeningTag()
	{
		$return = '<'.$this->name;

		// add the attributes
		foreach ($this->attr as $key => $info)
		{
			$info = $this->getAttribute($key);
			$val  = $info['value'];
			if (is_null($val))
			{
				$return .= ' '.$key;
			}
			elseif ($info['doubleQuote'])
			{
				$return .= ' '.$key.'="'.$val.'"';
			}
			else
			{
				$return .= ' '.$key.'=\''.$val.'\'';
			}
		}

		if ($this->selfclosing)
		{
			return $return.' />';
		}
		else
		{
			return $return.'>';
		}
	}

	/**
	 * Generates the closing tag for this object.
	 *
	 * @return string
	 */
	public function makeClosingTag()
	{
		if ($this->selfclosing)
		{
			return '';
		}

		return '</'.$this->name.'>';
	}
}


text:
package edu.kit.dama.ui.admin;

import com.vaadin.server.ThemeResource;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import edu.kit.dama.ui.admin.administration.usergroup.UserGroupAdministrationTab;
import edu.kit.dama.ui.admin.staging.accesspoints.StagingAccessPointConfigurationTab;
import edu.kit.dama.ui.admin.staging.processors.StagingProcessorConfigurationTab;
import edu.kit.dama.ui.admin.administration.user.UserDataAdministrationTab;
import edu.kit.dama.ui.admin.schedule.JobScheduleConfigurationTab;
import edu.kit.dama.ui.admin.utils.IconContainer;
import edu.kit.dama.ui.admin.utils.UIComponentTools;
import edu.kit.dama.ui.admin.workflow.DataWorkflowTaskConfigurationTab;
import edu.kit.dama.ui.admin.workflow.ExecutionEnvironmentConfigurationTab;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author jejkal
 */
public final class DataManagerSettingsPanel extends CustomComponent {

    private static final Logger LOGGER
            = LoggerFactory.getLogger(DataManagerSettingsPanel.class);

    public final static String DEBUG_ID_PREFIX = DataManagerSettingsPanel.class.getName() + "_";
    private TabSheet mainComponentContainer;
    private VerticalLayout mainLayout = null;
    private UserDataAdministrationTab userAdministrationTab;
    private UserGroupAdministrationTab groupAdministrationTab;
    private StagingAccessPointConfigurationTab accessPointConfigurationTab;
    private StagingProcessorConfigurationTab processorConfigurationTab;
    private DataWorkflowTaskConfigurationTab dataWorkflowConfigurationTab;
    private ExecutionEnvironmentConfigurationTab executionEnvironmentConfigurationTab;
    private JobScheduleConfigurationTab jobScheduleConfigurationTab;

    public DataManagerSettingsPanel() {
        LOGGER.debug(new StringBuilder("Building ").append(DEBUG_ID_PREFIX).append(" ...").toString());

        setId(DEBUG_ID_PREFIX);
        buildMainComponentContainer();
        setCompositionRoot(mainLayout);
        getUserAdministrationTab().update();
        setSizeFull();
    }

    private void buildMainComponentContainer() {
        String id = "mainComponent";
        LOGGER.debug(new StringBuilder("Building ").append(
                DEBUG_ID_PREFIX).append(id).append(" ...").toString());

        mainComponentContainer = new TabSheet();
        mainComponentContainer.setId(new StringBuilder(DEBUG_ID_PREFIX).append(id).toString());
        mainComponentContainer.setSizeFull();

        // Add tab for user administration
        mainComponentContainer.addTab(getUserAdministrationTab(), "User Administration",
                new ThemeResource(IconContainer.USERS));
        mainComponentContainer.addTab(getGroupAdministrationTab(), "Group Administration",
                new ThemeResource(IconContainer.GROUPS));
        mainComponentContainer.addTab(getAccessPointConfigurationTab(),
                "Staging Access Points", new ThemeResource(IconContainer.ACCESS_POINT));
        mainComponentContainer.addTab(getProcessorConfigurationTab(),
                "Staging Processors", new ThemeResource(IconContainer.STAGING_PROCESSOR));
        mainComponentContainer.addTab(getExecutionEnvironmentConfigurationTab(),
                "Execution Environments", new ThemeResource(IconContainer.EXECUTION_ENVIRONMENT));
        mainComponentContainer.addTab(getDataWorkflowConfigurationTab(),
                "Data Workflow Tasks", new ThemeResource(IconContainer.DATA_WORKFLOW));
        mainComponentContainer.addTab(getJobScheduleConfigurationTab(),
                "Job Scheduling", new ThemeResource(IconContainer.JOB_SCHEDULE));
        // Add listener for tab change
        mainComponentContainer.addSelectedTabChangeListener((TabSheet.SelectedTabChangeEvent event) -> {
            if (!event.getTabSheet().getSelectedTab().isEnabled()) {
                UIComponentTools.showError("You are not authorized to access or modify these settings.");
                return;
            }
            if (event.getTabSheet().getSelectedTab().equals(userAdministrationTab)) {
                userAdministrationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(groupAdministrationTab)) {
                groupAdministrationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(accessPointConfigurationTab)) {
                accessPointConfigurationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(processorConfigurationTab)) {
                processorConfigurationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(dataWorkflowConfigurationTab)) {
                dataWorkflowConfigurationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(executionEnvironmentConfigurationTab)) {
                executionEnvironmentConfigurationTab.update();
            } else if (event.getTabSheet().getSelectedTab().equals(jobScheduleConfigurationTab)) {
                jobScheduleConfigurationTab.update();
            }

            if (!event.getTabSheet().getSelectedTab().isEnabled()) {
                //check again and show error if privileges have changed...in that case recommend a reload
                UIComponentTools.showError("You are not authorized to access or modify these settings. Please reload the page.");
            }
        });

        mainLayout = new VerticalLayout(mainComponentContainer);
        mainLayout.setSpacing(true);
        mainLayout.setMargin(true);
        mainLayout.setSizeFull();
    }

    /**
     * @return the mainComponentContainer
     */
    public TabSheet getMainComponentContainer() {
        if (mainComponentContainer == null) {
            buildMainComponentContainer();
        }
        return mainComponentContainer;
    }

    /**
     * @return the userAdministrationTab
     */
    public UserDataAdministrationTab getUserAdministrationTab() {
        if (userAdministrationTab == null) {
            userAdministrationTab = new UserDataAdministrationTab();
        }
        return userAdministrationTab;
    }

    /**
     * @return the groupAdministrationTab
     */
    public UserGroupAdministrationTab getGroupAdministrationTab() {
        if (groupAdministrationTab == null) {
            groupAdministrationTab = new UserGroupAdministrationTab();
        }
        return groupAdministrationTab;
    }

    /**
     * @return the accessPointConfigurationTab
     */
    public StagingAccessPointConfigurationTab getAccessPointConfigurationTab() {
        if (accessPointConfigurationTab == null) {
            accessPointConfigurationTab = new StagingAccessPointConfigurationTab();
        }
        return accessPointConfigurationTab;
    }

    /**
     * @return the processorConfigurationTab
     */
    public StagingProcessorConfigurationTab getProcessorConfigurationTab() {
        if (processorConfigurationTab == null) {
            processorConfigurationTab = new StagingProcessorConfigurationTab();
        }
        return processorConfigurationTab;
    }

    /**
     * @return the dataWorkflowConfigurationTab
     */
    public DataWorkflowTaskConfigurationTab getDataWorkflowConfigurationTab() {
        if (dataWorkflowConfigurationTab == null) {
            dataWorkflowConfigurationTab = new DataWorkflowTaskConfigurationTab();
        }
        return dataWorkflowConfigurationTab;
    }

    /**
     * @return the executionEnvironmentConfigurationTab
     */
    public ExecutionEnvironmentConfigurationTab getExecutionEnvironmentConfigurationTab() {
        if (executionEnvironmentConfigurationTab == null) {
            executionEnvironmentConfigurationTab = new ExecutionEnvironmentConfigurationTab();
        }
        return executionEnvironmentConfigurationTab;
    }

    /**
     * @return the dataWorkflowConfigurationTab
     */
    public JobScheduleConfigurationTab getJobScheduleConfigurationTab() {
        if (jobScheduleConfigurationTab == null) {
            jobScheduleConfigurationTab = new JobScheduleConfigurationTab();
        }
        return jobScheduleConfigurationTab;
    }
}


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

namespace Model
{
	public class Interest
	{
		public int Id { set; get; }
		public string Name { set; get; }

		public Interest(int id, string name)
		{
			Id = id;
			Name = name;
		}

		public static List<Interest> Get()
		{
			return new List<Interest>()
			{
				new Interest(0, "NATURE" ),
				new Interest(1, "FITNESS"),
				new Interest(2, "MOVIES" ),
				new Interest(3, "GAMING" ),
				new Interest(4, "ELECTRONICS"),
				new Interest(5, "FOOD"),
				new Interest(6, "DRAWING")
			};
		}
	}
}


text:
Kundens vision er at få leveret et terningspil, der kan spilles af 2-6 spillere.
Spillerne rykker rundt på et ringformet spillebræt med 21 felter. Hver spiller
starter med 30.000. Spillet slutter når kun en spiller ikke er bankerot.\\
\FloatBarrier
\begin{figure}[h]
\section*{Domænemodel}
\addcontentsline{toc}{subsection}{Domænemodel}
\centering
\makebox[\textwidth]{\includegraphics[width=\textwidth]{DOM_51_del3}}
\caption{\emph{Domæne model}: Viser hvordan spillet hænger sammen ude i den
virkelige verden. Det man ikke kan se her, er at Field, indeholder forskellige slags
felter.}
\end{figure}
\FloatBarrier
\section*{Use Cases}
\addcontentsline{toc}{subsection}{Use Cases}
Vi har valgt at betragte spillet som bestående af en overordnet spil 'use case',
hvor spillerne efter tur slår med terninger og rykker rundt på felterne. Vi
betragter hvert ophold på et felt som en separat sub use case, der igen udvides
i flere trin (se Use case diagram). Nogle af felterne kan ejes og modelleres
derfor i en separat use case - der igen er delt op i flere typer af felter - alt
efter hvordan lejen af feltet afgøres.\\
\indent Af kunden er det specificeret at netop 'Land on Fleet' skal være særligt
grundigt dokumenteret - 'fully dressed'. Vi har valgt at beskrive en sub use
case, 'Land on Field', der er højere i hierarkiet, som 'fully dressed', idet der
er mange generelle elementer, der går igen i de forskellige use cases. 'Land on
Fleet' er således beskrevet som en extension af den mere generelle 'Land on
Ownable Field', der igen er et specialtilfælde af 'Land on Field'.\\
\FloatBarrier
\begin{figure}[h]
\section*{Use Case Diagram}
\addcontentsline{toc}{subsection}{Use Case Diagram}
\centering
\makebox[\textwidth]{\includegraphics[width=\textwidth]{Usecasediagram1}}
\caption{\emph{Use Case Diagram}: Vi har valgt at beskrive 'Land on Field' som
en include i Play Game - selvom der ikke er flere use cases der include'r 'Land on
Field'. Dette er gjort for at synliggøre relationen mellem sub use cases.}
\end{figure}
\FloatBarrier
\section*{Main Use Case 'Spil Terningspil'}
\addcontentsline{toc}{subsection}{Main Use Case 'Spil Terningspil'}
\begin{enumerate}
  \item Spillerne starter spillet og vælger hvor mange spillere de vil være.
  \item De indtaster spillernavne.
  \item Spillerne starter med 30000 points hver. Spillebrættet har 21 felter,
  der ligger i en ring. Nogle af felterne kan ejes af spillerne.
  \item Spillerne slår efter tur med 2 terninger og rykker summens øjne frem på
  spillebrættet. Alt efter hvilket felt man lander på mister eller får man penge
  og en ejer modtager evt. pengene. Se sub use case 'Land on Field'
  \item Spillet slutter når alle undtagen én spiller er fallit og den
  tilbageværende spiller vinder.
\end{enumerate}
\textbf{Extension:}\\
1a. Spillerne kan vælge sprog\footnote{Er ikke specificeret i oplægget, men vi
har valgt at implementere det, som en ekstra udfordring.}.\\
\\
\textbf{\large Sub Use Case 'Land on Field' (fully dressed)}\\
Included in Main Use Case (4.)\\
\textbf{Scope:} Terningspil.\\
\textbf{Level:} Subfunction.\\
\textbf{Primary Actor:} Aktive spiller (spilleren der har tur).\\
\textbf{Stakeholders and Interests:} Alle spillere:
\begin{itemize}
  \item Er interesserede i at spillerne får opdateret deres pengebeholdning i
  overensstemmelse med reglerne for felttypen.
  \item Er interesserede i at finde ud af om den aktive spiller går fallit.
  \item Forventer entydig kommunikation af resultatet af at lande på feltet.
\end{itemize}
\textbf{Preconditions:} Spillet er startet og der er en aktiv spiller (der har
turen), der lander på et felt.\\
\textbf{Postconditions:} De involverede spillers pengebeholdning bliver
opdateret. Spillerens tur afsluttes.\\
\textbf{Main Success Scenario:}
\begin{enumerate}
  \item Spilleren lander på feltet.
  \item Spillerens penge beholdning opdateres.
  \item Spillerens tur afsluttes.
\end{enumerate}
\textbf{Extensions:}\\
2a. Feltet kan ejes - Sub Use Case Land on Ownable Field.\\
2b. Feltet er af typen 'Tax' - Sub Use Case Land on Tax.\\
2c. Feltet er af typen 'Refuge' - Sub Use Case Land on Refuge\\
2d. Spilleren går fallit
\begin{enumerate}
  \item Spillerens penge sættes til 0.
  \item Spilleren får ikke flere ture.
\end{enumerate}
\textbf{Special Requirements, Technology and Data variations list.}\\
Der er i den givne opgave ikke stillet krav inden for ovenstående.\\
\textbf{Frequency of occurrence.}\\
Hver runde i spillet.\\
\textbf{Open Issues.}\\
Beskrevet under afklaring og antagelser.\\
\\
\textbf{\large Sub Use Case Land on Ownable Field}\\
Extends \emph{Land on Field.}\\
Feltet kan ejes.
\begin{enumerate}
  \item Feltet har ingen ejer.
  \begin{enumerate}
    \item Spilleren tilbydes at købe feltet, har tilstrækkeligt med penge og
    køber feltet.
    \begin{enumerate}
      \item Spilleren bliver ejer af feltet.
      \item Prisen for feltet fratrækkes spillerens saldo.
    \end{enumerate}
    \item Spilleren tilbydes at købe feltet, har tilstrækkeligt med penge, men
    køber ikke feltet.
    \item Spilleren har ikke tilstrækkeligt med penge til at købe feltet.
  \end{enumerate}
  \item Feltet er allerede ejet af spilleren.
  \item Feltet er ejet af en anden spiller.
  \begin{enumerate}
    \item Spilleren betaler leje til ejeren.
  \end{enumerate}
\end{enumerate}
\textbf{Extensions:}\\
3.1a. Feltet er et 'Territory' - Sub Use Case Land on Territory.\\
3.1b. Feltet er et 'Labor Camp' - Sub Use Case Land on Labor Camp.\\
3.1c. Feltet er et 'Fleet' - Sub Use Case Land on Fleet.\\
3.1d. Spilleren har ikke tilstrækkeligt med penge til at betale ejeren.
\begin{enumerate}
  \item Ejeren får spillerens resterende penge.
  \item Spilleren går fallit.
\end{enumerate}
\\
\textbf{\large Sub Use Case Land on Territory}\\
Extends \emph{Land on Ownable Field.}\\
1. Spilleren der lander på 'Territory' betaler ejeren et foruddefineret
beløb.\\
\\
\textbf{\large Sub Use Case Land on Labor Camp}\\
Extends \emph{Land on Ownable Field.}\\
1. Spilleren der lander på 'Labor Camp' betaler ejeren 100 gange øjnene på det
slag, der har bragt ham til feltet.\\
\\
\textbf{\large Sub Use Case Land on Fleet}\\
Extends \emph{Land on Ownable Field.}\\
1. Spilleren der lander på 'Fleet' betaler ejeren $2^n \cdot 250 $, hvor n er
antallet af fleets, som ejeren ejer.\\
\\
\textbf{\large Sub Use Case Land on Tax}\\
Extends \emph{Land on Field.}\\
1. Spilleren mister et foruddefineret beløb.\\
\textbf{Extension:}
1a. På nogle 'Tax' felter kan spilleren i stedet vælge at betale en procentdel
af sin samlede formue\\
\\
\textbf{\large Sub Use Case Land on Refuge}\\
Extends \emph{Land on Field.}\\
Spilleren modtager et foruddefineret beløb.\\
\section*{Non funktionelle krav}
\addcontentsline{toc}{subsection}{Non funktionelle krav}
I den givne opgave er der det er et krav at der er udarbejdet
Kravspecificering:
\begin{enumerate}
  \item Et use-case diagram og use-case beskrivelser. Som minimum skal "Land on
  fleet" være fully dressed.
  \item Domæne-model og BCE-diagram
\end{enumerate}
Kodemæssigt forlanges:
\begin{enumerate}
  \item Lav passende konstruktører.
  \item Lav passende get og set metoder.
  \item Lav passende toString metoder.
  \item Lav en klasse GameBoard der kan indeholde alle felterne i et array.
  \item Tilføj en toString metode der udskriver alle felterne i arrayet.
  \item Lav en Junit test til hver af felttypernes "landOnField"-metode.
  \item Lav det spil kunden har bedt om med de klasser I nu har.
  \item Benyt den udleverede GUI.
\end{enumerate}
Designmæssigt forlanges:
\begin{enumerate}
  \item DSD'er (Design Sekvens Diagrammer). Som minimum "Land on fleet".
  \item Forklaring af arv, keywordet abstract, og konceptet i at implementere
  landOnField metoder i både super og subclasses (override).
  \item Dokumentation for test med screenshots.
  \item Dokumentation for overholdt GRASP.
\end{enumerate}
\section*{Afklaring og antagelser}
\addcontentsline{toc}{subsection}{Afklaring og antagelser}
\begin{enumerate}
  \item Vi adspurgte kunden om felterne skulle ligge i nummereret rækkefølge på
  brættet. Kunden svarede at det var valgfrit, men så gerne at de lå tilfældigt.
  \item Vi antager at alle spillere starter på første felt
  \item Vi antager at alle felter bevarer deres værdi når de er købt - således
  at det koster 10\% af ens saldo + 10\% af indkøbsprisen for de Tax felter hvor
  det er muligt at betale 10\% af sin formue.
\end{enumerate}
\section*{Ikke honorerede krav}
\addcontentsline{toc}{subsection}{Ikke honorerede krav}
Vi har forsøgt at honorere alle krav.\\


text:
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe RTurk::RejectQualificationRequest do

  before(:all) do
    aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
    RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
    faker('reject_qualification_request', :operation => 'RejectQualificationRequest')
  end

  it "should ensure required params" do
    lambda{RTurk::RejectQualificationRequest()}.should raise_error RTurk::MissingParameters
  end

  it "should successfully request the operation" do
    RTurk::Requester.should_receive(:request).once.with(
      hash_including('Operation' => 'RejectQualificationRequest'))
    RTurk::RejectQualificationRequest(:qualification_request_id => "123456789", :reason => "Your work is terrible!") rescue RTurk::InvalidRequest
  end

  it "should parse and return the result" do
    RTurk::RejectQualificationRequest(:qualification_request_id => "123456789", :reason => "Your work is terrible!").should be_a_kind_of RTurk::Response
    RTurk::RejectQualificationRequest(:qualification_request_id => "789RVWYBAZW00EXAMPLE951RVWYBAZW00EXAMPLE").elements.should eql(
      {"RejectQualificationRequestResult"=>{"Request"=>{"IsValid"=>"True"}}}
    )
  end

end


text:
layout: page
title: Charm Entertainment Party
date: 2016-05-24
author: Pamela Hawkins
tags: weekly links, java
status: published
summary: Etiam semper erat odio, in porttitor ante condimentum id.
banner: images/banner/office-01.jpg
booking:
  startDate: 10/30/2016
  endDate: 11/02/2016
  ctyhocn: CRPPTHX
  groupCode: CEP
published: true
---
Nunc a eros quis lacus venenatis porttitor nec et arcu. Cras eget magna eget erat elementum feugiat sed a sapien. Vestibulum at sapien sed nisi aliquet faucibus. Aliquam dapibus ligula ac rutrum sagittis. Fusce a eros suscipit, lacinia dolor sit amet, blandit ipsum. Proin condimentum risus id urna pulvinar, at suscipit nulla scelerisque. Phasellus ut libero libero. Proin at lacinia ante. Sed bibendum mauris est, non sagittis quam tempor eget. Sed pellentesque quam magna, non auctor nibh iaculis et. Ut et convallis justo, vel tempus ipsum.

* Vivamus tincidunt turpis ut vestibulum dignissim
* Nam dapibus risus id lacus suscipit dapibus
* Integer elementum risus et tortor suscipit interdum
* Nulla vel tellus mollis, mattis tellus id, tempus diam
* Integer at mi a purus sollicitudin mollis sit amet in risus
* Phasellus ac purus vel erat molestie interdum.

Aenean aliquam ut dolor non ultricies. Nunc urna diam, mollis nec massa et, molestie cursus purus. Curabitur vulputate ligula sit amet placerat dignissim. Vivamus ac faucibus ante, non facilisis lorem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin pellentesque ut leo id rutrum. Morbi vitae sagittis lacus. Suspendisse vel dignissim nulla. Curabitur consequat risus mi. Praesent vitae volutpat ipsum, at finibus elit. Etiam pretium porta lectus vitae sagittis. Sed justo mauris, gravida non justo vel, congue vestibulum massa. In hac habitasse platea dictumst. Phasellus luctus ante ultrices augue mattis, nec congue sem ultricies. Integer enim ante, suscipit sit amet nunc faucibus, pretium cursus dui.


text:
title: Skins
page_title: Skins - RadNavigation
description: Check our Web Forms article about Skins.
slug: navigation/appearance-and-styling/skins
tags: skins
published: True
position: 0
---

# Skins

The following article describes how to set a preferable Skin to the RadNavigation control.

##

**RadNavigation** uses **skins** to control its overall look-and-feel. A skin is a set of images and a CSS stylesheet that can be applied to the control elements (items, images, etc.) and defines their appearance.

To apply a skin to a **RadNavigation** control, set its **Skin** property.

**RadNavigation** is installed with a number of preset skins. These are shown below:
>caption

![navigation-skins](images/navigation-skins.png)

 @[template - Material skin is available only in Lightweight mode](/_templates/common/skins-notes.md#material-only-in-lightweight)

## See Also

 * [Telerik ThemeBuilder for ASP.NET AJAX](https://themebuilder.telerik.com/)


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <meta property="og:title" content="WHS '06 Reunion"/>
  <meta property="og:type" content="website"/>
  <meta property="og:url" content="http://whs2006reunion.com/"/>
  <meta property="og:image" content="http://whs2006reunion.com/images/logo_og_1200sq.png"/>
  <meta property="og:site_name" content="WHS '06 Reunion"/>
  <meta property="fb:admins" content="erikwithuhk"/>
  <meta property="og:description"
  content="Donate to the WHS '06 Reunion."/>

  <title>Donate | WHS '06 Reunion</title>

  <link href="css/bootstrap.css" rel="stylesheet">

  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:800,300|Lora:400,400italic,700,700italic" type="text/css">

  <link href="css/main.css" rel="stylesheet">

  <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
          Toggle navigation

        </button>

            Buy tickets

            RSVP & signup

            Donate

            Contact

Donate
            to the WHS '06 reunion

We're hoping to have a great 10-year reunion, making new memories with old friends that will last a lifetime. Your donation to the WHS '06 Reunion will allow us to add even more extra-special elements to the reunion, and will be extremely appreciated by not only the planning committee, but our entire class.

Powered by Eventbrite

We hope that you're as excited as we are about our 10-year reunion.

If you're planning on coming, there are only   days left to buy your tickets, so get them now!

            Buy tickets

Do you want to help the WHS '06 reunion committee, or have questions about the reunion? Email the committee.

©2016 Erik Jönsson


text:
class AppStore extends Emitter {

  /**
   * Constructs the AppStore.
   *
   * @return {void}
   */
  constructor() {
    super();

    this.handlers = {};
    this.handlers[AppConstants.BOOTED] = this.onBooted;

    AppDispatcher.register(this.handle.bind(this), 'App');
  }

  /**
   * Handles a payload.
   *
   * @param {Object}
   * @return {void}
   */
  handle(payload) {
    var handler = this.handlers[payload.action];

    if (handler !== undefined) {
      handler(payload);
    }

    this.emit(payload.action, payload);
  }

  /**
   * Fired on the AppConstants.BOOTED event.
   *
   * @return {void}
   */
  onBooted() {
    console.log('App booted.');
  }

}

var AppStore = new AppStore();