Skip to content

Instantly share code, notes, and snippets.

View yojimbo87's full-sized avatar

Tomas Bosak yojimbo87

View GitHub Profile
@yojimbo87
yojimbo87 / Message.json
Created August 26, 2011 20:04 — forked from jcolebrand/Message.json
DB structures
{
_id: uint, //gives us format :101123 for replies, etc
owner_id: int,
text: String,
room: int, // id of room
starred: [user_id], // ids of users
flagged: [user_id], // ids of users
timestamp: timestamp, // all timestamps are in unix from UTC
deleted: timestamp, // null indicates not deleted
deletedBy: user_id, // indicates who deleted the message
var barWidth = 64,
width = (barWidth + 10) * dataTotalViewsCount.length,
height = 300;
var x = d3.scale.linear()
.domain([0, dataTotalViewsCount.length])
.range([0, width]);
var y = d3.scale.linear()
.domain([0, d3.max(dataTotalViewsCount, function (d) { return d.count; })])
.rangeRound([0, height]);
@yojimbo87
yojimbo87 / gist:2859711
Created June 2, 2012 19:39
SignalR disconnect
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading.Tasks;
using SignalR.Hosting;
using SignalR.Hubs;
namespace SignalrDisconnectIssue
{
@yojimbo87
yojimbo87 / gist:2994627
Created June 26, 2012 09:23
Dynamic url parameters parsing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Dynamic;
using System.Globalization;
namespace Memphis.Framework.ActionFilters
{
public class ParsePathAttribute : ActionFilterAttribute
@yojimbo87
yojimbo87 / gist:3116116
Created July 15, 2012 09:45
Async socket send and receive test
using System;
using System.Text;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace Eastern
{
public class Eastern
@yojimbo87
yojimbo87 / gist:3175713
Created July 25, 2012 11:47
POST validation dump
Statistics partial<br />
<br />
@using(Html.BeginForm("Index", "Statistics", FormMethod.Post, new { id = "form-post" }))
{
@Html.AntiForgeryToken()
@Html.TextBoxFor(m => m.Name)
@Html.ValidationMessageFor(m => m.Name)
<div id="button-wrapper-1">
@yojimbo87
yojimbo87 / gist:3476002
Created August 26, 2012 08:06
Raw document string parsing test
internal static ODocument ToDocument(int version, string rawDocument)
{
ODocument document = new ODocument();
document.Version = version;
int atIndex = rawDocument.IndexOf('@');
int colonIndex = rawDocument.IndexOf(':');
int fieldNameStartIndex = 0;
int stringStartIndex = -1;
bool isNextFieldChild = false;
@yojimbo87
yojimbo87 / gist:3496244
Created August 28, 2012 08:41
Document fields
foo:...,
foo:,
,foo:
,foo:...
,foo:...,
,foo:,
(...,foo:...)
(...,foo:)
(foo:...,
(foo:...)
@yojimbo87
yojimbo87 / gist:3610260
Created September 3, 2012 15:58
Raw document string parsing test 2
internal static ODocument ToDocument(string rawDocument)
{
ODocument document = new ODocument();
int atIndex = rawDocument.IndexOf('@');
int colonIndex = rawDocument.IndexOf(':');
string parsedType = "fieldName";
string lastParsedField = "";
string nesting = "";
@yojimbo87
yojimbo87 / Setup
Created November 21, 2012 11:50
Setup
# -------------------------------------------------------------------------------------------------------------------
# mono installation
#
# https://github.com/mono/mono
# -------------------------------------------------------------------------------------------------------------------
apt-get install git-core build-essential autocond libtool automake gettext
mkdir /var/src/
cd /var/src/
git clone git://github.com/mono/mono.git