Skip to content

Instantly share code, notes, and snippets.

@ridomin
ridomin / clean.proj
Created May 7, 2013 14:44
Clean Binary Files from source Tree
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CleanAll">
<Target Name="CleanAll">
<CreateItem Include=".\**\debug\**\*;.\**\release\**\*;.\**\sql\**\*;.\TestResults\**\*;.\**\*.*scc;.\**\*.user">
<Output ItemName="DbgFiles" TaskParameter="Include"/>
</CreateItem>
<Message Text="Deleting Debug Files" Importance="high" />
<Delete Files="%(DbgFiles.Identity)" ContinueOnError="true" TreatErrorsAsWarnings="true">
<Output ItemName="DeletedFiles1" TaskParameter="DeletedFiles"/>
</Delete>
@ridomin
ridomin / SkipExternals.cs
Last active December 18, 2015 12:10
SkipExternals allows you to skip dependant requests that are not in your domain. You have to specify the inclueded domain as a contextParameter
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.WebTesting;
namespace IntegrationTests
{
public class SkipExternals : WebTestRequestPlugin
{
public override void PostRequest(object sender, PostRequestEventArgs e)
{
@ridomin
ridomin / packages.config
Created July 1, 2013 11:53
Updated NUGet packages config to avoid Build & Deploy Errors (7Jul2013)
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetOpenAuth.AspNet" version="4.3.1.13153" targetFramework="net45" />
<package id="DotNetOpenAuth.Core" version="4.3.1.13153" targetFramework="net45" />
<package id="DotNetOpenAuth.OAuth.Consumer" version="4.3.1.13153" targetFramework="net45" />
<package id="DotNetOpenAuth.OAuth.Core" version="4.3.1.13153" targetFramework="net45" />
<package id="DotNetOpenAuth.OpenId.Core" version="4.3.1.13153" targetFramework="net45" />
<package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.3.1.13153" targetFramework="net45" />
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="jQuery" version="1.8.2" targetFramework="net45" />
@ridomin
ridomin / Disgnostics.config
Last active December 24, 2015 12:29
Basic Logger to use TraceSources and TraceEventTypes from .Net based Apps
<system.diagnostics>
<sharedListeners>
<add name="DefaultListener" type="System.Diagnostics.TextWriterTraceListener"
initializeData="LogFiles\Traces\Traces.log" />
</sharedListeners>
<sources>
<source name="General">
<listeners>
<add name="DefaultListener" />
</listeners>
@ridomin
ridomin / FormsAuthenticationAntiForgeryWebClient.vs
Created January 22, 2014 00:05
FormsAuthenticationAntiForgeryWebClient.vs
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace AppDefinitionDynamicParser
@ridomin
ridomin / TwitterDataProvider
Created April 24, 2014 22:14
Windows App Studio. Build Demo. Adding a Twitter Data Source
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using LinqToTwitter;
namespace AppStudio.Data
{
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore', '.gitignore')"
@echo off
rem Ensure this Node.js and npm are first in the PATH
set PATH=%APPDATA%\npm;%~dp0;%PATH%
setlocal enabledelayedexpansion
pushd "%~dp0"
rem Figure out the node version.
set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'"
@ridomin
ridomin / c.js
Last active May 30, 2016 06:26
Minimal commonjs #javascript #minimal
var exports = {}
var require = function(n){return exports}
@ridomin
ridomin / Serializer.cs
Created August 1, 2016 22:30
DataContractJsonSerializer Sample
public static class Serializer<T>
{
public static T FromJson(string json)
{
var s = new DataContractJsonSerializer(typeof(T));
using (var ms = new MemoryStream(UTF8Encoding.UTF8.GetBytes(json)))
{
ms.Position = 0;
return (T)s.ReadObject(ms);
}