Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System;
using System.Collections.Generic;
public static class ListEx
{
public static void AddContent(this List<string> list, string content)
{
list.Add($"{DateTime.Now:O} - {content}");
}
}
[alias]
all = "!f() { ls -R -d */.git | sed s,/.git,, | xargs -P10 -I{} bash -c \"echo {} && git -C {} $1\"; }; f"
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brd = branch -D
merged = branch --merged
st = status
@kiwipiet
kiwipiet / Observable.cs
Created September 22, 2019 18:43 — forked from heytherewill/Observable.cs
Use the common method names in Rx.Net instead of using the LINQ ones.
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace System.Reactive.ApiMappings
{
public static class ObservableEx
{
@kiwipiet
kiwipiet / Program.cs
Created May 11, 2018 21:06
DataAnnotationsValidator
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using JetBrains.Annotations;
namespace ConsoleApp1
{
public static class DataAnnotationsValidator
-- #########################################################
-- Author: www.sqlbook.com
-- Copyright: (c) www.sqlbook.com. You are free to use and redistribute
-- this script as long as this comments section with the
-- author and copyright details are not altered.
-- Purpose: For a specified user defined table (or all user defined
-- tables) in the database this script generates 4 Stored
-- Procedure definitions with different Procedure name
-- suffixes:
-- 1) List all records in the table (suffix of _lst)
@kiwipiet
kiwipiet / GoogleServices.cs
Created July 26, 2016 21:15
GoogleServices.IsGoogleServicesAvailable
using System;
using Android.Content;
using Android.Gms.Common;
public static class GoogleServices
{
private static Context _context;
public static void Init(Context context)
{
_context = context;
@kiwipiet
kiwipiet / DefaultFilterProvider
Created July 19, 2016 20:25
Applies FilterAttribute T to all MVC controller actions in case action or it's controller do not have FilterAttribute derived from BaseT
/// <summary>
/// Applies FilterAttribute T to all MVC controller actions
/// in case action or it's controller do not have FilterAttribute derived from BaseT
/// </summary>
/// <example>
/// <![CDATA[
/// FilterProviders.Providers.Add(new DefaultFilterProvider<NoAuthorizeAttribute, AuthorizeUserAttribute>());
/// ]]>
/// </example>
/// <typeparam name="T">FilterAttribute to be applied</typeparam>
@kiwipiet
kiwipiet / Enumeration PCL
Created July 18, 2016 20:22
Enumeration class that is PCL compatible
[DataContract]
[DebuggerDisplay("{DisplayName} - {Value}")]
public abstract class Enumeration<TEnumeration> : Enumeration<TEnumeration, int> where TEnumeration : Enumeration<TEnumeration>
{
protected Enumeration(int value, string displayName) : base(value, displayName) { }
public static TEnumeration FromInt32(int value)
{
return FromValue(value);
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace KiwiPiet
{
[Serializable]
[DebuggerDisplay("{DisplayName} - {Value}")]