Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Atif Aziz atifaziz

View GitHub Profile
@atifaziz
atifaziz / MoreLinqStaticImports.snippet
Last active Apr 5, 2019
Visual Studio snippet for explicitly importing MoreLINQ extensions to avoid current & future potential for conflicts with System.Linq or similar libraries
View MoreLinqStaticImports.snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>linq</Keyword>
<Keyword>extensions</Keyword>
</Keywords>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@atifaziz
atifaziz / Demo.csproj
Created Mar 26, 2019
Demo program for discussion of dotnet/cli#11016
View Demo.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
@atifaziz
atifaziz / dir
Created Mar 7, 2019
Recolor examples
View dir
yellow=<DIR>.+$
magenta=<(JUNCTION|SYMLINKD)>.+$
yellow=(?<=<(JUNCTION|SYMLINKD)>.+)\[.+\]$
cyan=(?<=\x20)(?i:[^\x20]+\.(cmd|bat|exe|com|ps1|wsh|wsf|vbs))$
gray=\(([0-9][0-9]?|[0-9][0-9,'.][0-9]*)\)
View MapOut.cs
#region Copyright (c) 2018 Atif Aziz. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@atifaziz
atifaziz / csharp-query-expression-pattern.md
Created Sep 10, 2018
C# Query Expression Pattern (§7.15.3, C# Language Specification, Version 3.0)
View csharp-query-expression-pattern.md

C# Query Expression Pattern

§7.15.3 The query expression pattern, C# Language Specification, Version 3.0

Copyright © Microsoft Corporation 1999-2007. All Rights Reserved.

The Query expression pattern establishes a pattern of methods that

@atifaziz
atifaziz / Box.cs
Last active Jun 27, 2018
Generic Box in C# for explicit boxing of value types
View Box.cs
#region The MIT License (MIT)
//
// Copyright (c) 2018 Atif Aziz. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
@atifaziz
atifaziz / MoreLinqAwaitCompletionDemo.linq
Created May 25, 2018
Demo of MoreLINQ's AwaitCompletion
View MoreLinqAwaitCompletionDemo.linq
<Query Kind="Expression">
<NuGetReference Prerelease="true">morelinq</NuGetReference>
<Namespace>MoreLinq</Namespace>
<Namespace>MoreLinq.Experimental</Namespace>
</Query>
Enumerable
.Range(1, 5)
.Select(x => TimeSpan.FromSeconds(x))
.RandomSubset(5)
@atifaziz
atifaziz / git-aliases.txt
Last active Mar 13, 2019
My Git aliases
View git-aliases.txt
git config --global alias.aliases "config --get-regexp ^alias\."
git config --global alias.last "log -1 HEAD"
git config --global alias.ls "log --decorate --pretty=format:%Cgreen%h%Cred%d%Creset\ %s\ [%an]"
git config --global alias.ll "log --pretty=fuller"
git config --global alias.st "status"
git config --global alias.diffc "diff --cached"
git config --global alias.ci "commit"
git config --global alias.cia "commit --amend"
git config --global alias.mff "merge --ff-only"
git config --global alias.mt "mergetool"
View QueenSongs.linq
<Query Kind="Expression">
<NuGetReference Version="3.1.0">System.Reactive</NuGetReference>
<NuGetReference Version="1.2.0">TryParsers</NuGetReference>
<NuGetReference Version="1.0.0-alpha-20170321T1506" Prerelease="true">WebLinq</NuGetReference>
<Namespace>static WebLinq.Modules.HttpModule</Namespace>
<Namespace>System.Reactive</Namespace>
<Namespace>System.Reactive.Linq</Namespace>
<Namespace>TryParsers</Namespace>
<Namespace>WebLinq</Namespace>
<Namespace>WebLinq.Html</Namespace>
@atifaziz
atifaziz / Get-MyNuGetApiKeys.ps1
Created Feb 28, 2018
Show ApiKeys from NuGet.Config
View Get-MyNuGetApiKeys.ps1
Add-Type -AssemblyName System.Security; ([xml](type -Raw C:\Users\aziz1a\AppData\Roaming\NuGet\NuGet.Config)).configuration.apiKeys.add | Add-Member -PassThru original -Type ScriptProperty { [Text.Encoding]::UTF8.GetString([Security.Cryptography.ProtectedData]::Unprotect([Conver
t]::FromBase64String($this.value), [Text.Encoding]::UTF8.GetBytes('NuGet'), 'CurrentUser')) }
You can’t perform that action at this time.