Skip to content

Instantly share code, notes, and snippets.

View philipmat's full-sized avatar

Philip Mateescu philipmat

View GitHub Profile
@philipmat
philipmat / custom_maps.vim
Created February 15, 2012 11:01 — forked from scrooloose/custom_maps.vim
Couple of custom key maps for nerdtree
if exists("g:loaded_nerdtree_custom_maps")
finish
endif
let g:loaded_nerdtree_custom_maps = 1
"adds a new keymapping on 'gT' that opens the selected file in a bg tab and
"closes the tree
call NERDTreeAddKeyMap({
\ 'scope': 'FileNode',
\ 'key': 'T',
@philipmat
philipmat / console.log
Created February 15, 2019 22:41
Visual Studio Code macOS freeze
[main 2019-02-15T22:37:18.094Z] Starting VS Code
[main 2019-02-15T22:37:18.095Z] from: /Users/af59986/Applications/Visual Studio Code.app/Contents/Resources/app
[main 2019-02-15T22:37:18.095Z] args: { _: [],
diff: false,
add: false,
goto: false,
'new-window': false,
'reuse-window': false,
wait: false,
version: false,
@philipmat
philipmat / say.ps1
Last active December 9, 2018 00:51
say command in Powershell
[cmdletbinding()]
param(
[Parameter(Position = 1, Mandatory = $true)]
[String]
$message
)
Add-Type -AssemblyName System.Speech
$synth = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$synth.Speak($message)
@philipmat
philipmat / ilog.snippet
Created February 22, 2018 13:56
Code Snippets for C#
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>ilog</Title>
<Shortcut>ilog</Shortcut>
<Description>Generates a private field to hold a Common.Logging.ILog</Description>
<Author>Philip Mateescu</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@philipmat
philipmat / Exported-2017-12-27.vssettings
Created December 27, 2017 16:14
Visual Studio 2017 Settings
<UserSettings><ApplicationIdentity version="15.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"><ToolsOptionsSubCategory name="Documents" RegisteredName="Documents" PackageName="Visual Studio Environment Package"><PropertyValue name="ShowMiscFilesProject">false</PropertyValue><PropertyValue name="AutoloadExternalChanges">true</PropertyValue><PropertyValue name="CheckForConsistentLineEndings">true</PropertyValue><PropertyValue name="SaveDocsAsUnicodeWhenDataLoss">false</PropertyValue><PropertyValue name="InitializeOpenFileFromCurrentDocument">true</PropertyValue><PropertyValue name="ReuseSavedActiveDocWindow">false</PropertyValue><PropertyValue name="DetectFileChangesOutsideIDE">true</PropertyValue><PropertyValue name="DontShowGlobalUndoChangeLossDialog">true</PropertyValue><PropertyValue name="AllowEditingReadOnlyFiles">true</PropertyValue><PropertyValue name="DocumentDockPreference">0</PropertyValue><PropertyValue name="MiscFilesProjectSavesLastNItems">0</PropertyValue>
@philipmat
philipmat / Update-File.ps1
Last active August 21, 2017 13:30
Unix `touch` in Powershell
Function Update-File
{
$Usage = "Usage: Update-File [file1 ... fileN]";
# if no arguments, display an error
if ($args.Count -eq 0) {
throw $Usage;
}
# see if any arguments match -h[elp] or --h[elp]
foreach($file in $args) {
if ($file -ilike "-h*" -or $file -ilike "--h*") {
@philipmat
philipmat / String Concat.cs
Created July 26, 2017 19:52
Speed of String Concatenation
var s1 = string.Empty;
var s2 = new List<string>();
var s3 = new System.Text.StringBuilder();
var sw = new Stopwatch();
const string Message = "Hello I am string number {0}";
sw.Restart();
for (int i = 0; i < 30; i++) {
s1 += string.Format(Message, i) + "\n";
@philipmat
philipmat / dropfk.sql
Created July 26, 2017 19:50
MSSQL - Drop FK
SET NOCOUNT ON
GO
DECLARE Fkeys CURSOR FOR
SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME + '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']'
FROM information_schema.table_constraints
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
OPEN Fkeys
@philipmat
philipmat / Routing.linq
Last active July 22, 2017 13:36
Simple Message Routing: Static vs Dynamic
<Query Kind="Program">
<NuGetReference>Autofac</NuGetReference>
<Namespace>Autofac</Namespace>
</Query>
void Main()
{
var facker = Configure();
// example 1
@philipmat
philipmat / Results.md
Created April 13, 2017 19:53
MSSQL Generated Columns and LINQPad

** TestGenerated Contents **

Id            Value1         SysStartTime                   SysEndTime
1             1              4/13/2017 19:17                12/31/9999 23:59
2             2              4/13/2017 19:17                12/31/9999 23:59

** TestGenerated Columns **