Skip to content

Instantly share code, notes, and snippets.

View ngerakines's full-sized avatar
🏠
Working from home

Nick Gerakines ngerakines

🏠
Working from home
View GitHub Profile
class PBLexer(RegexLexer):
"""
A simple Protocol Buffer lexer useful for parsing .proto files.
Contributed by Nick Gerakines <[email protected]>.
"""
name = 'ProtocolBuffers'
aliases = ['pb']
filenames = ['*.proto']
mimetypes = ['text/pb']
@ngerakines
ngerakines / git2foaf.erl
Created December 27, 2008 02:35
A module used to create foaf from git profile pages.
-module(git2foaf).
-compile(export_all).
%% git2foaf:projects("ngerakines").
projects(Username) ->
{ok, {{_Version, 200, _ReasonPhrase}, _Headers, Body}} = http:request(user_url(Username)),
Profile = profile_xml(Body),
CurrentProjects = projects_xml(Body),
Following = following_xml(Body),
[CurrentProjects, Following, Profile].
build_rel() ->
{ok, FD} = file:open("myapp.rel", [write]),
RootDir = code:root_dir(),
Patterns = [
{RootDir ++ "/", "erts-*"},
{RootDir ++ "/lib/", "kernel-*"},
{RootDir ++ "/lib/", "stdlib-*"},
{RootDir ++ "/lib/", "sasl-*"}
],
[Erts, Kerne, Stdl, Sasl] = [begin
Summary: A native Erlang MySQL client library.
Name: erlang_mysql
Version: 1
Release: 1
Requires: erlang
Source0: http://ngerakines.github.com/erlang_mysql/sources/mysql-1.tgz
License: private
Group: dev-erlang
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
%% @doc Pulls wowinsider.com feeds and caches appropiately. Note that inets
%% must be running for this to work. See http://www.wowinsider.com/feeds for
%% all their supported feeds.
%% @type article() = {string(), string()}.
-module(ipwfbfe_wowinsider).
-export([recent/0, feed_articles/1, priest/0]).
-export([ensure_server_started/0, start_server_loop/0, server_loop/1]).
-include_lib("xmerl/include/xmerl.hrl").
Recent Updates
I've burned through a number of the bugs that have been giving us trouble over the past few days. I've also taken the chance to slip a few features in. Here is a brief list of what's changed.
* If possible, character profile pages will display the character's gear. The listed gear is colored by quality (epic, rare, common, etc) and links to the the relevant wowhead.com page for that item. This feature is considered in public testing and depending on user feedback, it may go away.
* I've sprinkled a limited number of wowinsider.com links and references throughout the application. The My Characters page will give the most recent article and I'm working on displaying having relevant class articles on character pages.
* Refresh, Ding and profile content have been cleaned and are much more stable and consistent.
* The messaging that users see when importing a character and there are queues now explains what is going on. It will also give you the current number of characters waiting to
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The Squirrel Mafia</title>
<base target="_top" />
<link rel="SHORTCUT ICON" href="/images/favicon.ico" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>app/controllers/application.rb - C0 code coverage information</title>
<style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
<style type='text/css'>span.marked0 {
background-color: rgb(185, 210, 200);
display: block;
}
span.marked1 {
Recently I've been doing some c/c++ development at work. Its a pretty small project but we are using c++ because its speed over perl. I don't think anyone is really going to argue that point out. Instead of using anything bulky and bloated like KDevelop or the Eclipse I decided to stick wtih vim and make for my compiling needs.
Once I started getting deeper into the project it came to be that I needed a more flexible compiling solution, so I started looking into automake and autoconf. After some googling and alot of trial and error, I found a solution that works well for me. The project consists of building a few libraries and then compiling them into a single executable. It took more effort than it was worth with automake and autoconf but I finally got it working and the results are below.
Hopefully, this step by step guide on using automake and autoconf can help shed some light on any problems you are having. If you have any questions please feel free to leave a comment or something.
I'll start w
%% @spec recv_body(integer()) -> binary()
%% @doc Receive the body of the HTTP request (defined by Content-Length).
%% Will receive up to MaxBody bytes.
recv_body(MaxBody) ->
<<<<<<< HEAD:src/mochiweb_request.erl
case erlang:get(?SAVE_BODY) of
undefined ->
case get_header_value("expect") of
"100-continue" ->
start_raw_response({100, gb_trees:empty()});