Skip to content

Instantly share code, notes, and snippets.

litera / Augment.js
Created Apr 4, 2017
Slack common keyboard shortcuts
View Augment.js
$(function() {
alert("Initializing additional Slack keyboard shortcuts.\n\nCTRL+B = bold\nCTRL+I = italic\nCTRL+S = strike through\nCTRL+P = preformatted\nCTRL+< = code");
var keys = {
b: "*",
i: "_",
"<": "`",
p: "\n```\n",
s : "~"
litera / Parameter checking VS code
Last active Aug 29, 2015
Method parameter checking Visual Studio code snippets
View Parameter checking VS code

Parameter checking using Code snippets

Don't write the same code over and over again and rather save these two code snippets to simplify your coding. YOu will still have the same code in your methods, but will gain two main things:

  1. You will be faster doing this as code snippet template will do majority of typing for you
  2. You won't misspell parameter name when providing its testual name to exception constructor

So until we get Visual Studio 2014 with new C# ?. operator this is the simplest way without additional code in the form of either extension methods or other things.

There are two snippets

litera / NPoco strong typed Stored Procedures calls
Last active Aug 7, 2019
NPoco/PetaPoco strong typed and named stored procedures T4 generator
View NPoco strong typed Stored Procedures calls

NPoco/PetaPoco stored procedures with named strong type parameters file automatically generates a C# code file with calsses and methods corresponding to your database stored procedure definitions. This is then used to simply call stored procedures within NPoco/PetaPoco and avoid magic strings and parameter type guessing. It also supports output parameters.

Stored procedures naming conventions

In order to have your stored procedure calls well structured there are particular yet simple naming conventions you should follow when creating your stored procedures:

  1. Name your stored procedures as ClassName_Method
  2. If a particular stored procedure shouldn't be parsed you should omit underscore character in its name; this will make it private from the perspective of your C# as it will only be accessible to other stored procedures but won't be parsed.
litera / SQL code
Last active Mar 28, 2017
SQL Database development automated scripts
View SQL code

Version following TSQL files

  • 00 Backup Data.sql - automated
  • 01 Drop Model.sql - automated
  • 02 Create Model.sql
  • 03 Functions.sql
  • 04 Procedures.sql
  • 05 Static Data.sql
  • 06 Test Data.sql
  • 07 Restore Data.sql - automated
litera / Angular.Filter.Format.js
Created Mar 19, 2014
string.Format for AngularJS
View Angular.Filter.Format.js
/* AngularJS string.Format filter
* This filter provides string variable replacement similar to C# string.Format("{0}", "something");
* Usage: {{ "From model: {0}; and a constant: {1};" |"constant":...:... }}
(function (angular) {
litera / Mixins.scss
Created Jan 29, 2012
SCSS common mixins with cross browser style definitions
View Mixins.scss
// Global reusable mixins
* Version: 2.0 (2 Feb 2012)
* Copyright (c) 2011 Robert Koritnik
* Licensed under the terms of the MIT license
litera / Program.cs
Created Nov 29, 2011
Console application conparimg Lambda implementation performance
View Program.cs
public class Program
private static Random rnd = new Random();
private const int RangeLength = 365;
private const int RangeCount = 1;
private const int MaxRangeLength = 100;
private const int IterationCount = 1000000;
private const int RepeatCount = 5;
private static readonly DateTime RangeStart = new DateTime(2012, 1, 1);
litera / IRangeChecker.cs
Created Nov 22, 2011
Range data lookups using foreach loops and LINQ expressions
View IRangeChecker.cs
namespace RangeTester
/// <summary>
/// Defines range related members to implementing classes.
/// </summary>
/// <typeparam name="TPoint">The type of the range point.</typeparam>
public interface IRangeChecker<TPoint>
/// <summary>
/// Gets the range starting point.
You can’t perform that action at this time.