Skip to content

Instantly share code, notes, and snippets.

🌞
building

Reuben Bond ReubenBond

🌞
building
Block or report user

Report or block ReubenBond

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ReubenBond
ReubenBond / docdb_signature.cs
Last active Aug 29, 2015
Azure DocumentDB: Compute Signature
View docdb_signature.cs
public static string GetSignature(string masterKey, string resourceId, string resourceType, string xDate = null, string date = null)
{
if (string.IsNullOrEmpty(xDate) && string.IsNullOrEmpty(date))
{
throw new ArgumentException("Either xDate or date must be provided.");
}
const string AuthorizationFormat = "type={0}&ver={1}&sig={2}";
const string MasterToken = "master";
const string TokenVersion = "1.0";
View gist:c8406be708057c3bb14e
public async Task SendSms(string phoneNumber, string body)
{
// Sanitize the phone number.
phoneNumber = Regex.Replace(phoneNumber, "[^0-9]", string.Empty);
// Build the request.
var builder = new UriBuilder("https://rest.nexmo.com/sms/json");
var parameters = new Dictionary<string, string>
{
{ "api_key", this.apiKey },
View AzureJsonStore.cs
// --------------------------------------------------------------------------------------------------------------------
// <summary>
// The Azure JSON table storage provider.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Grains.Utilities
{
using System.Configuration;
using System.Threading.Tasks;
@ReubenBond
ReubenBond / WorkerRole.cs
Created Feb 26, 2015
Orleans: modifying internal provider config
View WorkerRole.cs
namespace Orleans.Azure.Silos
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Reflection;
using Microsoft.WindowsAzure;
@ReubenBond
ReubenBond / ChatRoomGrain.cs
Created May 14, 2015
ChatRoomGrain snippet
View ChatRoomGrain.cs
"Don't expect this to compile - it's just a snippet"
/// <summary>
/// The chat room grain.
/// </summary>
[StorageProvider(ProviderName = "chats")]
[Reentrant]
@ReubenBond
ReubenBond / Program.cs
Created Jul 6, 2015
Orleans with client/server/interfaces/implementations in a single file. https://github.com/dotnet/orleans/pull/528
View Program.cs
namespace RosleansSilo
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using Orleans;
@ReubenBond
ReubenBond / SerializationCodeGenerator.cs
Created Oct 16, 2015
Orleans IL-based Serializer generator (WIP)
View SerializationCodeGenerator.cs
namespace Orleans.CodeGeneration
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
View Program.cs
namespace TestAzureSilo
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Net;
using Orleans;
using Orleans.Runtime;
@ReubenBond
ReubenBond / ObjectTask.cs
Created Nov 5, 2015
ObjectTask: movified version of ValueTask for use in generated dispatchers
View ObjectTask.cs
public struct ObjectTask : IEquatable<ObjectTask>
{
private static object GetResult<TResult>(Task typedTask)
{
return ((Task<TResult>)typedTask).GetAwaiter().GetResult();
}
private static object GetResult(Task untypedTask)
{
untypedTask?.GetAwaiter().GetResult();
@ReubenBond
ReubenBond / OrleansJsonSerialization.cs
Created Nov 6, 2015
Orleans JSON (JObject, etc) Serialization
View OrleansJsonSerialization.cs
/// <summary>
/// Provides support for serializing JSON values.
/// </summary>
[RegisterSerializer]
public class OrleansJsonSerialization
{
/// <summary>
/// Initializes static members of the <see cref="OrleansJsonSerialization"/> class.
/// </summary>
static OrleansJsonSerialization()
You can’t perform that action at this time.