Skip to content

Instantly share code, notes, and snippets.

View jakobt's full-sized avatar

Jakob Tikjøb Andersen jakobt

View GitHub Profile
@jakobt
jakobt / woocommerce-csharp-client
Created January 19, 2015 20:06
Consuming WooCommerce REST API from C#
//C# port of the https://github.com/kloon/WooCommerce-REST-API-Client-Library
//Including handling of woocommerce insisting on uppercase UrlEncoded entities
public class WoocommerceApiClient
{
private static byte[] HashHMAC(byte[] key, byte[] message)
{
var hash = new HMACSHA256(key);
return hash.ComputeHash(message);
}
@jakobt
jakobt / AutoGeneratingImageNameAzureBlobStorageMultipartProvider
Last active August 29, 2015 14:11
"Restream" images to Azure Blob Storage from Web API
public class AutoGeneratingImageNameAzureBlobStorageMultipartProvider : MultipartStreamProvider
{
/* Let the consumer read the generated filenames and the headers after uploading for persisting to database etc. */
public Dictionary<string, HttpHeaders> UploadedFiles { get; set; }
private readonly bool _returnFullUri;
private readonly string _blockprefix;
private readonly CloudBlobContainer _container;
protected Dictionary<string,string> ImageMediaTypesToExtensions = new Dictionary<string, string>()