Skip to content

Instantly share code, notes, and snippets.

View R2D221's full-sized avatar
🤔
Pondering

Arturo Torres Sánchez R2D221

🤔
Pondering
View GitHub Profile

Keybase proof

I hereby claim:

  • I am R2D221 on github.
  • I am r2d221 (https://keybase.io/r2d221) on keybase.
  • I have a public key whose fingerprint is 1EAD 0BD0 5035 338E 8EC3 0294 D9CA 9076 C532 5811

To claim this, I am signing this object:

@R2D221
R2D221 / InnerFunctions.cs
Created March 23, 2015 16:24
Demonstration of “inner functions” in C#
public static int Factorial(int number)
{
if (number < 0)
throw new Exception("Sorry, number must be zero or positive");
Func<int, int> innerFactorial = null;
innerFactorial = (_number) =>
{
if (_number <= 1)
return 1;
(function(){
var special = jQuery.event.special,
uid1 = 'D' + (+new Date()),
uid2 = 'D' + (+new Date() + 1);
special.scrollstart = {
setup: function() {
var timer,
@R2D221
R2D221 / NullableEnumerableExtensions.cs
Created May 13, 2020 21:31
LINQ Extensions to use in tandem with C# 8 Nullable Reference Types.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Linq
{
public struct RequireClass<T> where T : class { }
public struct RequireStruct<T> where T : struct { }
@R2D221
R2D221 / SortedDictionaryExtensions.cs
Created November 16, 2014 23:54
SortedDictionary extensions to mimic behaviour from Java NavigableMap
using System.Linq;
namespace System.Collections.Generic
{
// based on http://stackoverflow.com/a/3486820/1858296
public static class SortedDictionaryExtensions
{
private static Tuple<int, int> GetPossibleIndices<TKey, TValue>(SortedDictionary<TKey, TValue> dictionary, TKey key, bool strictlyDifferent, out List<TKey> list)
{
list = dictionary.Keys.ToList();