This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* to build: | |
* download DiffMatchPatch from http://code.google.com/p/google-diff-match-patch/ | |
* then in command line run | |
* "%WINDIR%\Microsoft.NET\Framework\v3.5\csc.exe" /out:DiffMatchPatch.exe DiffMatchPatch.cs DiffMatchPatchProgram.cs | |
* | |
* to create patch: | |
* DiffMatchPatch.exe file1 file2 destination | |
* to apply patch | |
* DiffMatchPatch.exe patch file_to_patch | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TemplatesExport family="Live Templates"> | |
<Template uid="b01f5164-ebc7-4796-92a7-dfebea08afb3" shortcut="sa" description="SubSpec Assert" text=""$Assert$"
 .Assert(
 () => { $END$ });" reformat="True" shortenQualifiedReferences="True"> | |
<Context> | |
<CSharpContext context="Statement" minimumLanguageVersion="2.0" /> | |
</Context> | |
<Categories> | |
<Category name="SubSpec" /> | |
</Categories> | |
<Variables> | |
<Variable name="Assert" expression="" initialRange="0" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetPathRelativeToExecutable(string fileName) | |
{ | |
string executable = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath; | |
return System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(executable), fileName)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" %> | |
<%@ Import Namespace="FacebookSharp.Web.JavascriptSdk" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>Logging you out of facebook...</title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Facebook.Web | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Diagnostics.Contracts; | |
using System.Linq; | |
using System.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace HttpWebHelperSample | |
{ | |
// http://stackoverflow.com/questions/3963483/stitching-together-multiple-streams-in-one-stream-class | |
// todo: implement BeginRead and EndRead. | |
internal class CombinationStream : System.IO.Stream | |
{ | |
private readonly System.Collections.Generic.IList<System.IO.Stream> streams; | |
private int currentStreamIndex; | |
private System.IO.Stream currentStream; | |
private long length = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = fb.Batch( | |
new FacebookBatchParameter { HttpMethod = HttpMethod.Get, Path = "/4" }, | |
new FacebookBatchParameter(HttpMethod.Get, "/me/friends", new Dictionary<string, object> { { "limit", 10 } }) { Data = new { name = "friends", omit_response_on_success = false } }, | |
new FacebookBatchParameter("/me", new { fields = new[] { "id", "name" } }), | |
new FacebookBatchParameter("/me/feed", new { limit = 10 }), | |
new FacebookBatchParameter(HttpMethod.Post, "/me/feed", new { message = "test status update" })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void Get() | |
{ | |
var ms = new MemoryStream(); | |
var request = new FluentHttpRequest() | |
.BaseUrl("https://graph.facebook.com") | |
.ResourcePath("/prabirshrestha") | |
.Method("GET") | |
.QueryStrings(qs => | |
qs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original code from http://tomasp.net/blog/csharp-async.aspx | |
// converted to C# 2.0 compatible code and modified to support exceptions. | |
namespace AsyncEnumerator | |
{ | |
using System; | |
using System.Collections.Generic; | |
#if ASYNC_ENUMERATOR_INTERNAL | |
internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateTimeHelpers | |
{ | |
private static readonly string[] Iso8601Format = new[] | |
{ | |
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'", | |
@"yyyy-MM-dd\THH:mm:ssK" | |
}; | |
//SortableDateTimePattern (ISO 8601) | |
public static string ToIso8601(DateTime value) |