Skip to content

Instantly share code, notes, and snippets.

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace ClassLibrary1
{
public class SignedXmlSerializer<T> : XmlSerializer where T : Signable
#light
module Roman
open System
type RomanNumber ={
num:string;
decimal_num:int;
left_bound:int;
right_bound:int;
}
require "activerecord"
class ActiveRecord::Base
class <<self
def hidden_columns(*hidden)
write_inheritable_array("hidden_column", hidden.collect(&:to_s))
end
def columns_hidden
read_inheritable_attribute("hidden_column") || []
"""
Each new term in the Fibonacci sequence is generated by adding
the previous two terms. By starting with 1 and 2, the first
10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence
whose values do not exceed four million, find the sum
of the even-valued terms.
@hibri
hibri / Scraper.cs
Created May 14, 2011 11:07
Scraper
using System;
using System.Collections.Generic;
using System.Net;
using NUnit.Framework;
namespace Songkick
{
[TestFixture]
public class Scraper
{
@hibri
hibri / gist:1008889
Created June 5, 2011 11:40
Http Mocking
[Test]
public void Foo() {
IHttpEndpoint httpEndpoint = new HttpEndpoint()
.At(new Uri("Http://localhost:8080/api"))
.WithNewContext();
httpEndpoint
.Stub(x => x.Get("/"))
.Return("Index")
.OK();
@hibri
hibri / gist:2300074
Created April 4, 2012 10:01
SourceGear Diffmerge 3 way merge params for TortiseGit
--merge --result=%merged %mine %base %theirs --title1="Mine : %yname" --title2="Merged: %mname" --title3="Theirs : %tname"
@hibri
hibri / gist:2936617
Created June 15, 2012 14:01
See all the web requests a web app makes with Fiddler
<system.net>
<defaultProxy >
<proxy proxyaddress="http://localhost:8888" />
</defaultProxy>
</system.net>
@hibri
hibri / gist:2973309
Created June 22, 2012 15:04 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@hibri
hibri / gist:2973312
Created June 22, 2012 15:04
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after