Skip to content

Instantly share code, notes, and snippets.

View vcaraulean's full-sized avatar

Valeriu Caraulean vcaraulean

View GitHub Profile
vcaraulean / config_transform.msbuild
Created March 5, 2015 15:53
Confg transformations
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="TransformConfig" xmlns="">
<UsingTask TaskName="TransformXml"
<Target Name="TransformConfig">
<TransformXml Source="$(SourcePath)\Web.config"
vcaraulean / profile.ps1
Created August 17, 2010 21:17
Poweshell profile to combine posh-git and posh-hg prompts
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
$profilePath = split-path $profile
# Load posh-git and posh-hg modules from default profile directory
Import-Module $profilePath\posh-git\posh-git
Import-Module $profilePath\posh-hg\posh-hg
function prompt {
Write-Host($pwd) -nonewline
vcaraulean / rx.cs
Created September 18, 2015 15:11
public static class Ex {
public static IObservable<T> TakeUntilIdleFor<T>(this IObservable<T> source, TimeSpan idleTime)
return Observable.Create<T>(o =>
var published = source.Publish();
var idle = published.Select(_ => Observable.Timer(idleTime)).Switch();
return new CompositeDisposable(published.Connect(), published.TakeUntil(idle).Subscribe(o));
vcaraulean / DoubleClickEvent
Created November 18, 2010 10:16
Mouse Double Click event implementation for Silverlight and Caliburn.Micro
public static class DoubleClickEvent
public static readonly DependencyProperty AttachActionProperty =
typeof (string),
typeof (DoubleClickEvent),
new PropertyMetadata(OnAttachActionChanged));
public static void SetAttachAction(DependencyObject d, string attachText)
vcaraulean / FieldNullValueAttribute.cs
Created May 6, 2011 15:16
Path for for handling empty (not provided) Guid values
// Replace constructor in line 53 with this one
public FieldNullValueAttribute(Type type, string nullValue)
: this(TypeDescriptor.GetConverter(type).ConvertFromString(nullValue))
{ }
vcaraulean / TestFixture.cs
Created May 9, 2011 14:43
Test case for BadUsageException
// Code is throwing exception:
// FileHelpers.BadUsageException : This engine works with record of type Country and you use records of type Country
// at FileHelpers.FileHelperEngine`1.WriteStream(TextWriter writer, IEnumerable`1 records, Int32 maxRecords) in FileHelperEngine.cs: line 558
// at FileHelpers.FileHelperEngine`1.WriteString(IEnumerable`1 records, Int32 maxRecords) in FileHelperEngine.cs: line 600
// at FileHelpers.FileHelperEngine`1.WriteString(IEnumerable`1 records) in FileHelperEngine.cs: line 591
// at FileHelpers.Tests.RunTimeClassesExtra.RuntimeClasses() in RunTimeClassExtra.cs: line 168
public void RuntimeClasses()
vcaraulean / starter.ps1
Created June 10, 2016 15:04
psake - passing in parameters
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
Get-Module psake | Remove-Module
Import-Module ("C:\Dev\Tools\psake.4.6.0\tools\psake.psm1")
$envProperties = @{
"starterParam1"="start param value"
vcaraulean / Program.cs
Last active July 11, 2016 21:43
Benchmarking NLog's TimeSource implementations
// Required nuget packages:
// - NLog
// - BenchmarkDotNet
namespace BenchmarkNlogTimeSources
public class TimeSourceBenchmark
private readonly TimeSource _fastLocalTimeSource = new FastLocalTimeSource();
private readonly TimeSource _fastUtcTimeSource = new FastUtcTimeSource();
private readonly TimeSource _accurateLocalTimeSource = new AccurateLocalTimeSource();
vcaraulean / Spreadsheet-to-Trello
Last active June 26, 2017 15:11
This is a Google Apps Script Engine that imports data from Google Spreadsheet to Trello. This script was used to import SoftShake'13 conference submissions from the spreadsheets to Trello. So, it's highly specific for SoftShake and it's one-off thing. Still, may be used as a base for more complex things. The conference had 2 spreadsheets, for Fr…
* For more information on using the Spreadsheet API, see
function uploadTracksToTrello() {
// Security settings
// Requesting token: app key&name=softshake+upload&expiration=never&response_type=token&scope=read,write
ScriptProperties.setProperty("appKey", "your app key");
ScriptProperties.setProperty("token", "your token");