Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / hide c# System.Object inherited methods.cs
Created November 26, 2010 17:09
Hide System.Object C# methods
#region Hide System.Object inherited methods
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
[EditorBrowsable(EditorBrowsableState.Never)]
@prabirshrestha
prabirshrestha / FacebookOAuthClientAuthorizer.cs
Created January 7, 2011 08:19
IOAuthClientAuthorizer.cs
namespace Facebook
{
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
/// <summary>
/// Represents the Facebook OAuth Helpers
@prabirshrestha
prabirshrestha / FacebookSignedRequest.cs
Created February 7, 2011 19:12
FacebookSignedRequest
namespace Facebook.Web
{
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
@prabirshrestha
prabirshrestha / CombinationStream.cs
Created February 21, 2011 21:21
EeekSoft.Asynchronous
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;
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" }));
private static void Get()
{
var ms = new MemoryStream();
var request = new FluentHttpRequest()
.BaseUrl("https://graph.facebook.com")
.ResourcePath("/prabirshrestha")
.Method("GET")
.QueryStrings(qs =>
qs
// 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
@prabirshrestha
prabirshrestha / iso8601Datetime.cs
Created April 5, 2011 16:43
ISO8601 Date Time helpers
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)
@prabirshrestha
prabirshrestha / MefServiceLocator.cs
Created April 11, 2011 09:55
JobScheduler using Azure Toolkit
public class MefServiceLocator : ServiceLocatorImplBase
{
private ExportProvider provider;
public MefServiceLocator(ExportProvider provider)
{
this.provider = provider;
}
protected override object DoGetInstance(Type serviceType, string key)
@prabirshrestha
prabirshrestha / video.cs
Created May 10, 2011 17:42
video permissions
protected void Page_Load(object sender, EventArgs e)
{
// http://developers.facebook.com/docs/authentication/permissions/
var auth = new CanvasAuthorizer { Permissions = new[] { "user_videos", "publish_stream" } };
if (auth.Authorize())
{
ShowFacebookContent();
}
}