Skip to content

Instantly share code, notes, and snippets.

@m4rw3r
m4rw3r / expanded_parser.rs
Last active August 29, 2015 14:27
Macros expanded in the parser.
Compiling my_own v0.1.0 (file:///Users/m4rw3r/Desktop/attoparsec/examples/my_own)
#![feature(no_std)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
#[macro_use]
extern crate parser;
@m4rw3r
m4rw3r / parser_attoparsec_example2.rs
Last active August 29, 2015 14:27
Second version of the attoparsec benchmark for parsing HTTP header dumps writtien in rust using my experimental parser combinator.
//! http parser comparable to the http-parser found in attoparsec's examples.
//!
//! Reads data in the following format:
//!
//! ```text
//! GET /robot.txt HTTP/1.1
//! Host: localhost
//! Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
//!
//! ```
@m4rw3r
m4rw3r / parser_attoparsec_example_nom.rs
Last active August 29, 2015 14:27
Version of the attoparsec benchmark for parsing HTTP header dumps writtien in rust for the nom parser library.
#[macro_use]
extern crate nom;
use nom::IResult;
use std::env;
use std::fs::File;
#[derive(Debug)]
struct Request<'a> {
method: &'a [u8],
@m4rw3r
m4rw3r / parser_attoparsec_example.rs
Last active August 29, 2015 14:27
Version of the attoparsec benchmark for parsing HTTP header dumps writtien in rust using my experimental parser combinator.
extern crate parser;
use parser::{Parser, Error};
use std::fs::File;
use std::env;
#[derive(Debug)]
struct Request<'a> {
method: &'a [u8],
mod parser {
use std::fmt::Debug;
#[derive(Debug)]
pub enum Error<T> {
DidNotSatisfy(T)
}
#[derive(Debug)]
enum State<T, E> {
trait Source<'a> {
fn get(&mut self) -> Option<u8>;
fn mark(&self) -> &'a [u8];
fn restore(&mut self, &'a [u8]);
}
struct Slice<'a>(&'a [u8]);
impl<'a> Source<'a> for Slice<'a> {
fn get(&mut self) -> Option<u8> {
@m4rw3r
m4rw3r / Vella Gear Guide.md
Last active August 29, 2015 14:01
Vindictus Vella Gear guide

Vindictus Vella Gear Guide

This guide is slightly opinionated, as it is influenced by my own playstyle as well as the opinions of people I play with on "how to play the game". Therefore DEF is usually not prioritized, though I will try to provide decent alternatives which provide more defense without sacrificing too much in the offensive department.

Most of the sets listed here will force you to diversify your armor-proficiencies, as there is no set-combination listed here which is of only one armor-type.

Credits go to NaygetivReign for providing the original Sword Vella gear guide and also for teaching me the game.

@m4rw3r
m4rw3r / header.rs
Last active January 13, 2016 06:19
http.rs: Simple HTTP-library for Rust
use std::fmt;
use std::ascii::StrAsciiExt;
#[deriving(Clone,Eq)]
pub enum HeaderName {
Accept,
AcceptCharset,
AcceptEncoding,
AcceptLanguage,
Age,
@m4rw3r
m4rw3r / functions.php
Created November 18, 2013 10:32
Attempting to implement something akin to Haskell's typeclasses
<?php
namespace m4rw3r;
use ReflectionMethod;
use ReflectionFunction;
function compose($f, $g)
{
switch(callableReflection($g)->getNumberOfParameters()) {
<?php
class F
{
protected $f;
protected $params = array();
public function __construct(callable $c, array $params = null)
{
$this->f = $c;