I hereby claim:
- I am jbrestan on github.
- I am jbrestan (https://keybase.io/jbrestan) on keybase.
- I have a public key whose fingerprint is 806C 03DD D1B2 E3F3 53E4 5C3F 6912 176F 7B2A 8734
To claim this, I am signing this object:
public static IGetOperationResult<T> ExecuteGetOrCreateWithLock<T>(this ICouchbaseClient client, | |
string key, Func<T> defaultNewValue, TimeSpan keyExpiration, TimeSpan lockExpiration) | |
{ | |
var initialGetResult = client.ExecuteGetWithLock<T>(key, lockExpiration); | |
if (initialGetResult.StatusCode == (int) StatusCodeEnums.NotFound || | |
(initialGetResult.InnerResult != null && | |
initialGetResult.InnerResult.StatusCode == (int) StatusCodeEnums.NotFound)) | |
{ | |
// Key not found. We'll have to create it with the default value and make sure we get the lock. |
void Main() | |
{ | |
var u = new Union | |
{ | |
Foo = null, | |
Bar = new Bar() | |
}; | |
u.Foo.S = "ohai!"; | |
let inline tryParse input = | |
let mutable result = Unchecked.defaultof< ^a> | |
if (^a: (static member TryParse : string -> ^a byref -> bool) (input, &result)) | |
then Some(result) else None |
public static class Ensure | |
{ | |
public static TValue NotNull<TValue>(Expression<Func<TValue>> parameterExpression) | |
{ | |
var possibleNull = parameterExpression.Compile().Invoke(); | |
if (possibleNull == null) | |
{ | |
var paramName = GetVariableName(parameterExpression); | |
throw new ArgumentNullException(paramName); |
let zip xs ys = | |
let step acc x = | |
match acc with | |
| (rs, y::ys) -> ((x,y)::rs, ys) | |
| _ -> acc | |
Seq.fold step ([], ys) xs | |
|> fst | |
|> List.rev |
I hereby claim:
To claim this, I am signing this object:
public class AutoLogger : DynamicObject | |
{ | |
private readonly Action<string> _logMethod; | |
const string SplitterName = "splitNameBy"; | |
public AutoLogger(Action<string> logMethod) | |
{ | |
_logMethod = logMethod; | |
} |
public IDictionary<string, TValue> Dict<TValue>( | |
params Func<dynamic, TValue>[] pairs) | |
{ | |
return pairs.ToDictionary(pair => pair.Method.GetParameters()[0].Name, | |
pair => pair(null)); | |
} |
public static Func<A, R> Y<A, R>(Func<Func<A, R>, Func<A, R>> f) | |
{ | |
Func<A, R> g = null; | |
g = f(a => g(a)); | |
return g; | |
} |
public abstract class TypeSafetyWrapper<T> | |
{ | |
private readonly T value; | |
public TypeSafetyWrapper(T value) | |
{ | |
this.value = value; | |
} | |
public T Value { get { return value; } } |