Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
@ntotten
ntotten / FacebookSDK.cs
Created January 17, 2013 05:18
Facebook C# SDK Road Map
request.ContentType = contentType;
if (!string.IsNullOrEmpty(etag))
request.Headers[HttpRequestHeader.IfNoneMatch] =
string.Concat('"', etag, '"');
#if !(SILVERLIGHT || WINRT)
request.AutomaticDecompression =
DecompressionMethods.GZip | DecompressionMethods.Deflate;
#endif
#if WINRT
request.Headers[HttpRequestHeader.AcceptEncoding] = "gzip,deflate";
@ntotten
ntotten / Global.asax.cs
Created January 17, 2013 05:21
Windows Azure Toolkit for Social Games Version 1.2.0 (beta) Released
// Setup AutoFac
var builder = new ContainerBuilder();
DependancySetup(builder);
var container = builder.Build();
DependencyResolver.SetResolver(
new AutofacDependencyResolver(container));
// Setup WCF Web API Config
var config = new WebApiConfiguration();
@ntotten
ntotten / EnsureExists.cs
Last active December 11, 2015 05:39
Windows Azure Toolkit for Social Games Version 1.1.1
public void EnsureExist()
{
this.gameContainer.EnsureExist(true);
this.gameQueueContainer.EnsureExist(true);
this.userContainer.EnsureExist(true);
this.inviteQueue.EnsureExist();
this.skirmishGameQueue.EnsureExist();
this.leaveGameQueue.EnsureExist();
}
@ntotten
ntotten / Register.cs
Last active December 11, 2015 05:39
Command-Query Separation on Windows Azure
[HttpPost]
public ActionResult Register(RegisterModel model)
{
var queue =
new AzureQueue<UserRegistrationMessage>
(account);
var registrationBlob =
new AzureBlobContainer<RegistrationTokenEntity>
(account, true);
@ntotten
ntotten / App.cs.html
Created January 22, 2013 00:19
Example template configuration
@using MvcHtmlHelpers;
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
@ntotten
ntotten / ExternalLoginConfirmation.cs.html
Last active December 13, 2016 14:46
Implementing a Simple Registration Code Check in ASP.NET MVC
<li class="name">
@Html.LabelFor(m => m.UserName)
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
</li>
<li class="name">
@Html.LabelFor(m => m.RegistrationCode)
@Html.TextBoxFor(m => m.RegistrationCode)
@Html.ValidationMessageFor(m => m.RegistrationCode)
</li>
@ntotten
ntotten / deploy.sh
Created February 5, 2013 16:51
Docpad on Windows Azure
#!/bin/bash
# ----------------------
# KUDU Deployment Script
# ----------------------
# Helpers
# -------
exitWithMessageOnError () {
@ntotten
ntotten / FacebookClient.cs
Created February 5, 2013 22:55
Facebook C# SDK Road Map
request.ContentType = contentType;
if (!string.IsNullOrEmpty(etag))
request.Headers[HttpRequestHeader.IfNoneMatch] =
string.Concat('"', etag, '"');
#if !(SILVERLIGHT || WINRT)
request.AutomaticDecompression =
DecompressionMethods.GZip | DecompressionMethods.Deflate;
#endif
#if WINRT
request.Headers[HttpRequestHeader.AcceptEncoding] = "gzip,deflate";
@ntotten
ntotten / Global.asax.cs
Created February 5, 2013 22:57
Windows Azure Toolkit for Social Games Version 1.2.0 (beta) Released
// Setup AutoFac
var builder = new ContainerBuilder();
DependancySetup(builder);
var container = builder.Build();
DependencyResolver.SetResolver(
new AutofacDependencyResolver(container));
// Setup WCF Web API Config
var config = new WebApiConfiguration();
@ntotten
ntotten / Application_Start.cs
Last active December 12, 2015 04:58
Windows Azure Toolkit for Social Games Version 1.1.1
protected void Application_Start()
{
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSetter) =>
{
string configuration = RoleEnvironment.IsAvailable ?
RoleEnvironment
.GetConfigurationSettingValue(configName) :
ConfigurationManager.AppSettings[configName];