Skip to content

Instantly share code, notes, and snippets.

View cdemi's full-sized avatar

Christopher Demicoli cdemi

View GitHub Profile
@cdemi
cdemi / NicknameGenerator.cs
Created October 28, 2023 11:20
C# class that randomly generates semi-reasonable nicknames
using System.Security.Cryptography;
namespace cdemi
{
public static class NicknameGenerator
{
public static string GetRandomNickname(bool includePrefix = false, int? maxLength = null, string delimeter = "")
{
string nickname;
@cdemi
cdemi / blocklist.txt
Last active January 12, 2020 00:15
Ad Block List
lovinmalta.com
www.lovinmalta.com

Keybase proof

I hereby claim:

  • I am cdemi on github.
  • I am cdemi (https://keybase.io/cdemi) on keybase.
  • I have a public key whose fingerprint is 9FE8 C81D BB6E 5E39 B9FA 4946 4773 B0EE 63C9 B96A

To claim this, I am signing this object:

#bs-example-navbar-collapse-1 > ul.nav.navbar-nav.donation {
display: none;
}
@cdemi
cdemi / CacheAside.cs
Last active July 23, 2021 02:56
Sample Cache Aside Implementation in C# as a Generic Extension Method. Part of Blog: https://blog.cdemi.io/design-patterns-cache-aside-pattern/
private static ConcurrentDictionary<string, object> concurrentDictionary = new ConcurrentDictionary<string, object>();
public static T CacheAside<T>(this ICacheManager cacheManager, Func<T> execute, TimeSpan? expiresIn, string key)
{
var cached = cacheManager.Get(key);
if (EqualityComparer<T>.Default.Equals(cached, default(T)))
{
object lockOn = concurrentDictionary.GetOrAdd(key, new object());
lock (lockOn)
@cdemi
cdemi / feedly.opml
Last active August 29, 2015 14:10
My Followed Blogs
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Christopher subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Design" title="Design">
<outline type="rss" text="Smashing Magazine" title="Smashing Magazine" xmlUrl="http://rss1.smashingmagazine.com/feed/" htmlUrl="http://www.smashingmagazine.com"/>
<outline type="rss" text="A List Apart: The Full Feed" title="A List Apart: The Full Feed" xmlUrl="http://www.alistapart.com/rss.xml" htmlUrl="http://alistapart.com"/>
@cdemi
cdemi / EnumerableDataReader.cs
Created November 22, 2014 00:07
Converts IEnumerable<T> to IDataReader
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace System.Data
{
/// <summary>
/// IDataReader that can be used for "reading" an IEnumerable<T> collection
/// </summary>