Skip to content

Instantly share code, notes, and snippets.

@FilipDeVos
FilipDeVos / msbuild.reg
Created March 27, 2013 10:14
Registry file to add an "Execute with MsBuild" menu option when you right click on an MsBuild file. A command window will be opened and stays open when the build is finished. Automatically writes an msbuild.log file as well.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\proj_file\shell\Execute with MSBuild\command]
@="cmd /k C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe /filelogger /p:PublishToNuGetFeedServer=false"
[HKEY_CLASSES_ROOT\.proj]
@="proj_file"
[HKEY_CLASSES_ROOT\.csproj]

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@FilipDeVos
FilipDeVos / IndexStats.sql
Created November 7, 2012 13:34
Index Usage Statistics of the current database.
select OBJECT_NAME(iu.object_id) as table_name
, i.name
, iu.user_seeks
, iu.user_scans
, iu.user_lookups
, iu.user_updates
, iu.last_user_seek
, iu.last_user_scan
, iu.last_user_lookup
, iu.last_user_update
@FilipDeVos
FilipDeVos / TruncateTable.sql
Created October 12, 2012 09:32
TSQL Beginners Training samples
TRUNCATE TABLE t_family
@FilipDeVos
FilipDeVos / ListDiff.cs
Created September 6, 2012 07:21 — forked from praeclarum/ListDiff.cs
Computes a diff between two different IEnumerables. It's better than anything you have ever seen. Ever.
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace TheBestAppEver
{
/// <summary>
/// The type of <see cref="ListDiffAction{S,D}"/>.
Performance of scalar functions is usually not very good, to do what you ask I would write it as a table valued function. A table valued function has the benefit that it is inlined properly.
Other forms of the query will not make a huge difference as it is the calls to the function which eat up the time.
CREATE FUNCTION dbo.fn_age(@birthdate datetime, @current_date datetime)
RETURNS TABLE
WITH SCHEMABINDING
AS
return (
SELECT cast((DATEPART(year, @current_date - @birthdate)) - 1900 as varchar(4)) + 'y '
@FilipDeVos
FilipDeVos / BuildQuotedString.cs
Created July 30, 2012 11:19
ADP.BuildQuotedString
internal static string BuildQuotedString(string quotePrefix, string quoteSuffix, string unQuotedString)
{
StringBuilder builder = new StringBuilder();
if (!IsEmpty(quotePrefix))
{
builder.Append(quotePrefix);
}
if (!IsEmpty(quoteSuffix))
{
builder.Append(unQuotedString.Replace(quoteSuffix, quoteSuffix + quoteSuffix));
@FilipDeVos
FilipDeVos / SignUnsafeAssembly.sql
Last active October 6, 2015 15:28
Script to sign an unsafe assembly.
SET NOCOUNT ON
DECLARE @cert_name sysname = 'MyLovelyCertificate'
, @assembly_name nvarchar(4000) = 'MyAssembly'
, @assembly_path nvarchar(256) = 'c:\MyAssembly.dll'
, @safe_cert_name sysname
, @cert_path nvarchar(256)
, @login_name sysname
, @sid varbinary(85)
, @msg nvarchar(max)
@FilipDeVos
FilipDeVos / CreateTableWithIdentity.sql
Created April 25, 2012 08:41
TSQL Beginners Training samples
CREATE TABLE t_person (
id int identity(1, 1),
first_name nvarchar(50),
last_name nvarchar(100),
alias nvarchar(100)
)
@FilipDeVos
FilipDeVos / While.sql
Created April 24, 2012 12:29
TSQL Beginners Training samples
DECLARE @i int = 0
WHILE @i < 10
BEGIN
PRINT N'The number is: ' + CONVERT(NVARCHAR(3), @i)
SET @i += 1 -- in sql 2005 --> set @i = @i + 1
END