Skip to content

Instantly share code, notes, and snippets.

View Programazing's full-sized avatar
🏳️‍⚧️

Christopher C. Johnson Programazing

🏳️‍⚧️
View GitHub Profile
# Navigation
alias a='nano ~/.bash_aliases'
alias ae='gedit ~/.bash_aliases'
alias ..='cd ..'
alias ...='cd ../..'
alias todev='cd /media/programazing/Documents/Dev'
alias toproj='cd /media/programazing/Documents/Dev/personal/projects'
# cloneproj linkToGitRepo
@Programazing
Programazing / Alphabet.cs
Last active February 7, 2020 00:27
A simple way to generate the English Alphabet in C#
// IEnumerable<char> Lowercase
var alphabet = Enumerable.Range('a', 26).Select(n => (char)n);
// IEnumerable<char> Uppercase
var alphabet = Enumerable.Range('A', 26).Select(n => (char)n);
// IEnumerable<string> Lowercase
var alphabet = Enumerable.Range('a', 26).Select(n => ((char)n).ToString());
{"lastUpload":"2019-12-29T17:56:40.049Z","extensionVersion":"v3.4.3"}
@Programazing
Programazing / ToDataTable
Created April 18, 2019 15:38
An extension method to convert a List of any type to a DataTable.
public static DataTable ToDataTable<T>(this List<T> input)
{
var props = TypeDescriptor.GetProperties(typeof(T));
var output = new DataTable();
foreach(PropertyDescriptor item in props)
{
if (item.PropertyType.IsGenericType && item.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
output.Columns.Add(item.Name, item.PropertyType.GetGenericArguments()[0]);
else
using Xunit;
namespace FizzBuzzChecker.Test
{
public class FizzBuzzTests
{
[InlineData(3, "Fizz")]
[InlineData(6, "Fizz")]
[InlineData(9, "Fizz")]
[InlineData(12, "Fizz")]
var book = (from theBook in _context.Books.Where(b => b.BookId == id)
join loan in _context.BookLoans.Where(x => !x.ReturnedOn.HasValue) on theBook.BookId equals loan.BookID into result
from loanWithDefault in result.DefaultIfEmpty()
select new BookDetailsViewModel
{
BookID = theBook.BookId,
SubTitle = theBook.SubTitle,
Title = theBook.Title,
Author = theBook.Author,
ISBN = theBook.ISBN,