View TriggeredQueue
using System; | |
using System.Collections.Generic; | |
namespace JoeSauve | |
{ | |
/// <summary> | |
/// Triggered queue. Provides events immediately before and after enqueueuing and dequeuing. | |
/// </summary> | |
public class TriggeredQueue<T> | |
{ |
View AsyncDapperDemo.cs
using System; | |
using System.Linq; | |
using System.Data; | |
using System.Data.SqlClient; | |
using System.Threading.Tasks; | |
using Dapper; | |
public class Program | |
{ | |
public static void Main() |
View NiceViewModelAndPageXamarinFormsExample.cs
using System; | |
using MvvmHelpers; | |
using PropertyChanged; | |
using Xamarin.Forms; | |
namespace Blah | |
{ | |
// The rest of this page is of course defined in XAML | |
public partial class MyPage : ContentPage | |
{ |
View RemoveByKey.cs
private static IEnumerable<KeyValuePair<TKey,TValue>> RemoveByKey<TKey,TValue>( | |
this IEnumerable<KeyValuePair<TKey,TValue>> pairs, | |
string key) | |
{ | |
var index = pairs.Select(x => x.Key).ToList().FindIndex(x => x.Equals(key)); | |
if (index >= 0) | |
{ | |
var result = pairs.ToList(); | |
result.RemoveAt(index); |
View gist:3e3de4ba15d89c9ced4d
logoImageUrl = | |
!String.IsNullOrEmpty(logoImageUrl) ? | |
logoImageUrl : null; |
View gist:ef2a2aab137f7e8f33ad
-- USE THIS? | |
IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[mySproc]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) | |
BEGIN | |
DROP PROCEDURE dbo.mySproc; | |
END; | |
GO | |
-- OR JUST THIS? |
View gist:19c084612ac0466921a0
DECLARE @time DATETIME = DATEFROMPARTS(2014, 11, 15); | |
-- Using 998 for milliseconds portion because using 999 winds up being the same as 000 of the next second, for some weird reason. | |
-- This winds up being 2014-11-15 23:59:59.997, even though we've specified 998. | |
SELECT DATETIMEFROMPARTS(DATEPART(year, @endTime), DATEPART(month, @endTime), DATEPART(day, @endTime), 23, 59, 59, 998); |
View gist:d6381ead501a31b85613
DECLARE @brands TABLE (brand NVARCHAR(50)); | |
INSERT INTO @brands (brand) | |
VALUES ('BF Goodrich'); | |
SELECT * | |
FROM dbo.productOwners | |
INNER JOIN @brands ON | |
REPLACE(LOWER(brand), ' ', '') = REPLACE(LOWER(productOwner_name), ' ', '') OR | |
REPLACE(LOWER(productOwner_name), ' ', '') = CONCAT(REPLACE(LOWER(brand), ' ', ''),'®') |
View gist:7468fd3046a70665539a
DECLARE @atdString NVARCHAR(50), @ariString NVARCHAR(50); | |
SET @atdString = 'BF Goodrich'; -- the brand name as it exists in ATD | |
SET @ariString = 'BFGoodrich®'; -- the brand name as it exists in ARI | |
SELECT 1 | |
WHERE | |
( | |
REPLACE(LOWER(@atdString), ' ', '') = REPLACE(LOWER(@ariString), ' ', '') OR | |
REPLACE(LOWER(@ariString), ' ', '') LIKE CONCAT(REPLACE(LOWER(@atdString), ' ', ''),'®') |
View CSharpCodingStandards
public class MyClass | |
{ | |
private Object _Something; | |
public Object Something | |
{ | |
get { return _Something; } | |
set { _Something = value; } | |
} | |
public void MyMethod (object myParam) |