Skip to content

Instantly share code, notes, and snippets.

Configuration smtpServerConfiguration = new Configuration();
smtpServerConfiguration.SetPort(25);
smtpServerConfiguration.SetServer("smtp.8bitclockwork.com");
smtpServerConfiguration.SetTimeout(60);
@pparadis
pparadis / gist:2363890
Created April 12, 2012 00:56
Configuration
Configuration smtpServerConfiguration = new Configuration();
smtpServerConfiguration
.SetPort(3)
.SetServer("bob")
.SetTimeout(333);
@pparadis
pparadis / gist:2363900
Created April 12, 2012 00:57
Configuration class
class Configuration
{
private String _server { get; set; }
private int _timeout { get; set; }
private int _port { get; set; }
public Configuration SetPort(int port)
{
_port = port;
return this;
var result = session
.Query<Wine>()
.Where(p => p.Id == wineId))
.First()
@pparadis
pparadis / gist:2582109
Created May 3, 2012 00:16
Code dynamique
var x = 10;
var y = "2";
var result = x * y;
@pparadis
pparadis / HTTP Request
Created May 9, 2012 00:34
HTTP Request
HTTP/1.0 304 Not Modified
Date: Wed, 09 May 2012 00:26:52 GMT
Content-Type: text/html; charset=UTF-8
Last-Modified: Tue, 08 May 2012 23:51:26 GMT
Age: 113
X-Cache: HIT from cp1015.eqiad.wmnet
X-Cache-Lookup: HIT from cp1015.eqiad.wmnet:3128
X-Cache: MISS from cp1011.eqiad.wmnet
X-Cache-Lookup: MISS from cp1011.eqiad.wmnet:80
Connection: keep-alive
@pparadis
pparadis / gist:2831427
Created May 29, 2012 23:23
ExpandoObject
dynamic expando = new ExpandoObject();
expando.Title = "Ceci est un titre";
expando.Nom = "Paradis";
expando.Prenom = "Pascal";
foreach (var e in (IDictionary<String, Object>) expando)
{
Console.WriteLine(e.Value);
}
dynamic expando = new ExpandoObject();
expando.Title = "Ceci est un titre";
expando.Nom = "Paradis";
expando.Prenom = "Pascal";
@pparadis
pparadis / gist:2885531
Created June 6, 2012 23:41
URL Dictionnary
dynamic urlDictionnary = new UrlDictionnary();
urlDictionnary.HomePage = "http://www.parad.is";
urlDictionnary.About = "http://frenchcoding.wordpress.com/about/";
urlDictionnary.Blog = "http://frenchcoding.wordpress.com";
public class UrlDictionnary : DynamicObject
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
public int Count
{
get
{
return dictionary.Count;
}