Skip to content

Instantly share code, notes, and snippets.

View allrameest's full-sized avatar

Erik Juhlin allrameest

  • Helsingborg, Sweden
View GitHub Profile
var keys = new[] {1, 2, 3};
var map1 = new Dictionary<int, string>();
var map2 = new Dictionary<int, string>();
var items =
from key in keys
let value1 = map1.GetValueOrDefault(key)
where value1 != null
let value2 = map2.GetValueOrDefault(key)
let whatever = 123
select new
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MyNamespace
{
using MyType = Task<IDictionary<string, IList<(long, int)>>>;
public class MyClass
{
public MyType DoStuff()
httpDelete = httpReq "DELETE"
httpPut = httpReq "PUT"
httpReq : String -> String -> Http.Body -> Decode.Decoder a -> Http.Request a
httpReq method url body decoder =
Http.request
{ method = method
, headers = []
, url = url
, body = body
public static class UrlSlugGenerator
{
private static readonly IDictionary<string, string> UrlReplacementMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{"&", "-"},
{" ", "-"},
{"/", "-"},
{"+", "-"},
};
@allrameest
allrameest / gist:7172848
Last active December 26, 2015 15:29
NHibernate FetchMany/Single
var existingCustomer = session.Query<Customer>()
.Where(c => c.CustomerId == imported.CustomerId)
.FetchMany(c => c.DeliveryAddresses)
.ToArray()
.SingleOrDefault();
@allrameest
allrameest / NameValueCollectionParsing.cs
Created May 3, 2012 19:43
NameValueCollection parsing extensions
using System;
using System.Collections.Specialized;
using System.Threading;
namespace ConsoleApplication1
{
internal class Program
{
private static void Main()
{