Skip to content

Instantly share code, notes, and snippets.

View szalapski's full-sized avatar

Patrick Szalapski szalapski

View GitHub Profile
  • DO keep lines of code to 120 characters or less, unless a particular case is more readable when wider.
  • Use Microsoft's .NET naming guidelines, especially with…
    • DO NOT capitalize prefixes or suffixes e.g. "Subcategory", not "SubCategory"
    • DO use capital letters for two-letter acronyms, but NOT for three or more, nor for the special abbreviation "PPG"
    • DO use PascalCase for properties on record types, as they are not merely parameters
  • AVOID prefixing properties and column names with the class/table name, e.g. use "Description" over "FundDescription"
    • EXCEPTION: Never name a property or column just "Id" or "Type", e.g. should be "FundId" and "FundType"
  • DO set the indent width for HTML code only to two characters (with smart indent, insert spaces).
    • This is in VS Pro > Tools > Options > Text Editor > HTML > Tabs
  • DO NOT let web controller classes depended directly on data-layer classes (which we cal
@szalapski
szalapski / philosophy.md
Last active July 1, 2024 00:44
Philosophy flowchart

Philosophy flowchart

flowchart TD

subgraph Classical
    Pythagoreans[Pythagoreans 500-300 BC]
    --> Socrates[Socrates 410 BC]
    --> Plato[Plato 380 BC]
    --> Aristotle[Aristotle 350 BC]
Imports Datadog.Trace
Imports System.IO
Public Class DatadogSoapRequestModule
Implements IHttpModule
Public Sub Init(context As HttpApplication) Implements IHttpModule.Init
AddHandler context.BeginRequest, AddressOf Application_BeginRequest
End Sub

The Wellness Flowchart

  • Wellness can be overwhelming; this flowchart will help you take it one step at a time. Don't be concerned about later steps till you have habitualized the steps above it.
  • Roughly follow the order below for optimal benefit; Progress in all columns, one step at a time. Some steps you will have already achieved when first reaching it--take the win and move to the next one!
  • This is an opinionated one-size-fits-all framework. You may wish to customize or change some of them. The best wellness plan is whatever one you can stick to.
  • Most habits take 30-60 days to establish. Take on one or two new habits at a time and build on your success.
  • Most improvements in wellness require sustained, permanent changes. If you find yourself regressing, it is far better to pick up where you left off than to regress farther. If you struggle with a step, feel free to skip it or come back to it later. This isn't all or nothing. Don't round down to zero.
  • Inspired by the [Financial Independence
@szalapski
szalapski / gcp.bat
Last active February 25, 2024 18:12
@rem gcp.bat: Git Add, Commit, Push
@rem USAGE: gcp [just type your commit message without any quotation marks anywhere]
@rem EXAMPLE: gcp code cleanup for abc feature for issue 1234
git add -A && git commit -m "%*"
@if errorlevel 1 goto end
git push
:end
@inject NavigationManager navigationManager
...
@code {
// example code to change state based on the querystring.
// Call perhaps from an event callback or whenever the query may have changed.
private void LoadFromQuery()
{
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
public static class GeneralExtensions {
/// <summary>
/// Throws an exception if the task fails to complete within a number of milliseconds from when invoked.
/// </summary>
/// <param name="task">The task on which to enforce the timeout</param>
/// <param name="milliseconds">The timeout in milliseconds.</param>
/// <param name="operationDescription">The text description that should appear in the timeout exception message.
/// Useful for pinpointing the timed-out operation.</param>
/// <returns>The completed task, if the task completed in time.</returns>
/// <exception cref="TimeoutException">Thrown when the timeout is reached before the task is completed.</exception>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace GeneralMills.ResourceDemand.Core.Extensions
{
/// <summary>
/// Contains static methods for working with data queries and LINQ.
/// </summary>
@szalapski
szalapski / TfsWebCompact.bookmarklet.js
Last active September 11, 2024 21:08
TfsWebCompact neatens up the look-and-feel of your Azure DevOps web backlog and task board. See also http://www.szalapski.com/2014/05/a-compact-layout-for-tfs-web-work-items.html .
/* The following is a bookmarklet.
To actually use it, it is easier to drag-and-drop starting with my blog post:
http://www.szalapski.com/2014/05/a-compact-layout-for-tfs-web-work-items.html */
/* version 2024-09-11 */
javascript:(function () {
const s = document.createElement('style');
s.innerText = `
/* version 2024-09-11 */
/* draw attention to button when full-screen */