Skip to content

Instantly share code, notes, and snippets.

View cmshawns's full-sized avatar

Shawn S. cmshawns

View GitHub Profile
@cmshawns
cmshawns / ftgCodeOfConduct.md
Created November 12, 2019 17:50
Code of Conduct for Friendly Tahoma Geeks

Code of Conduct Policy for Friendly Tahoma Geeks


1. Purpose

A primary goal of Friendly Tahoma Geeks is to be inclusive of participants with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, age, ability, ethnicity, socioeconomic status, and religion (or lack thereof).

Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences of unacceptable behavior.

@cmshawns
cmshawns / LazyLinqExecution.cs
Last active November 5, 2019 00:57
Demonstrates why you probably want to call `ToList()`
void Main()
{
Console.WriteLine("=== without calling ToList() ===\n");
var enumerable = GetEnumerable();
EnumerateMultipleTimes(enumerable);
Console.WriteLine("\n=== when calling ToList() ===\n");
var list = GetEnumerable().ToList();
@cmshawns
cmshawns / Party Health
Last active November 11, 2018 18:47
Roll 20 macros
&{template:default} {{name=Health Check}} {{Arthur Hickey= AC @{Arthur Hickey|ac} - HP @{Arthur Hickey|hp} / @{Arthur Hickey|hp|max}}} {{Apophenia= AC @{Apophenia|ac} - HP @{Apophenia|hp} / @{Apophenia|hp|max}}} {{Dog= AC @{Dog|ac} - HP @{Dog|hp} / @{Dog|hp|max}}} {{Kathrine= AC @{Kathrine|ac} - HP @{Kathrine|hp} / @{Kathrine|hp|max}}} {{Lidara= AC @{Lidara|ac} - HP @{Lidara|hp} / @{Lidara|hp|max}}} {{Traphanis= AC @{Traphanis|ac} - HP @{Traphanis|hp} / @{Traphanis|hp|max}}}
@cmshawns
cmshawns / Ability Check
Last active May 4, 2020 16:52
Roll20 macros - Token actions
@{selected|wtype}&{template:default} {{name=Ability Score for @{selected|character_name}}} {{?{Ability Score
| Strength, Strength +@{selected|strength_mod}@{selected|jack_bonus}=[[@{selected|d20}+@{selected|strength_mod}@{selected|jack_bonus}]] - [[@{selected|d20}+@{selected|strength_mod}@{selected|jack_bonus}]]
| Dexterity, Dexterity +@{selected|dexterity_mod}@{selected|jack_bonus}=[[@{selected|d20}+@{selected|dexterity_mod}@{selected|jack_bonus}]] - [[@{selected|d20}+@{selected|dexterity_mod}@{selected|jack_bonus}]]
| Constitution, Constitution +@{selected|constitution_mod}@{selected|jack_bonus}=[[@{selected|d20}+@{selected|constitution_mod}@{selected|jack_bonus}]] - [[@{selected|d20}+@{selected|constitution_mod}@{selected|jack_bonus}]]
| Intelligence, Intelligence +@{selected|intelligence_mod}@{selected|jack_bonus}=[[@{selected|d20}+@{selected|intelligence_mod}@{selected|jack_bonus}]] - [[@{selected|d20}+@{selected|intelligence_mod}@{selected|jack_bonus}]]
| Wisdom, Wisdom +@{selected|wisdom_mod}
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client]
"DisabledByDefault"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server]
string str = "CamelCase";
char[] chars = str.ToCharArray();
chars[0] = str.ToLower()[0];
string newStr = new string(chars);
@cmshawns
cmshawns / RestSharpDropboxUpload.cs
Created December 30, 2014 23:02
Upload File to Dropbox with RestSharp
public static void UploadFileToDropbox(string filePath)
{
RestClient client = new RestClient("https://api-content.dropbox.com/1/");
IRestRequest request = new RestRequest("files_put/auto/{path}", Method.PUT);
FileInfo fileInfo = new FileInfo(filePath);
long fileLength = fileInfo.Length;
request.AddHeader("Authorization", "Bearer INSERT_DEVELOPER_TOKEN_HERE");
request.AddHeader("Content-Length", fileLength.ToString());
@cmshawns
cmshawns / PerformanceTimer.cs
Last active August 29, 2015 14:10
Record the time it takes to execute a block of code
using System.Diagnostics;
using System;
namespace MyNamespace
{
public enum TimerOutput
{
Debug,
Console
}
@cmshawns
cmshawns / Program.cs
Last active August 29, 2015 14:05
Dynamically generates and executes (using Reflection) a LINQ Where() method against an oData service.
using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using TestODAta.NorthwindService;
namespace TestODAta
{
<?xml version="1.0" encoding="utf-8"?>
<DeclarationSortingDefinition>
<DeclarationSorter type="DeclarationSorter">
<!-- for all files/classes/etc.... -->
<DeclarationComparer type="MultiDeclarationComparer">
<!-- First, sort by member type... -->
<DeclarationComparer type="TypeDeclarationComparer" TypeOrder="Constant,Field,Property,Constructor,Method"/>
<!-- sub-sort methods by... -->
<DeclarationComparer type="ConditionalDeclarationComparer">
<DeclarationCondition type="TypeDeclarationCondition" Types="Method" />