Skip to content

Instantly share code, notes, and snippets.

@lukesmith
lukesmith / common.target
Created May 19, 2011 13:26
common target file for sharing settings across projects
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(ToolsDir)' == ''">
<ToolsDir>$(SolutionDir)\Tools\</ToolsDir>
</PropertyGroup>
<PropertyGroup>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
<StyleCopAnalysisTarget Condition=" '$(StyleCopAnalysisTarget)' == '' ">$(ToolsDir)StyleCop\Microsoft.SourceAnalysis.targets</StyleCopAnalysisTarget>
@staticcat
staticcat / ZmqSocket_Dump
Created November 24, 2012 09:11
Function to dump what's on a ZmqSocket
public static void Dump(ZmqSocket socket, Encoding encoding)
{
if (socket == null) {
throw new ArgumentNullException("socket");
}
Console.WriteLine(new String('-', 38));
ZmqMessage message = socket.ReceiveMessage();
foreach (var frame in message)
{
@dariusclay
dariusclay / ODataEntityFrameworkModelBuilder.cs
Last active December 1, 2022 22:35
How to build OData IEdmModel from Entity Framework model
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Data.Entity;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Infrastructure;
using System.Diagnostics;
@kntajus
kntajus / SpeechElements
Last active August 29, 2015 13:55
Turns an integer into an array of strings that correspond to the correct wav file names to read out.
let emptyIfZero f x =
match x with
| 0 -> []
| _ -> f x
let elementsBetween0And20 = emptyIfZero (fun x -> [ string x ])
let elementsBetween21And99 x = string (x - (x % 10)) :: elementsBetween0And20 (x % 10)
let ifGreaterThan y f g x = if x > y then f x else g x
let elementsFor2DigitNumber = ifGreaterThan 20 elementsBetween21And99 elementsBetween0And20
let elementsBetween100And999 x = string (x / 100) :: "hundred" :: emptyIfZero (fun x -> "and" :: elementsFor2DigitNumber x) (x % 100)
@chrisckchang
chrisckchang / currentOp.js
Last active May 4, 2016 04:30
Command for getting current operations on a MongoDB
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript
using System.Globalization;
using Irony.Parsing;
namespace Grammar
{
[Language("LuceneGrammar", "1.0", "Lucene Grammar")]
public class LuceneGrammar : Irony.Parsing.Grammar
{
public LuceneGrammar()
: base(true) // true means case sensitive
@davidfowl
davidfowl / dotnetlayout.md
Last active November 13, 2024 13:19
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@ThatRendle
ThatRendle / README.md
Last active August 5, 2017 13:35
Vagrantfile to run Kafka in boot2docker

Kafka in Docker in Vagrant

I'm using this Vagrantfile to run Kafka on a Windows 8.1 laptop for development purposes.

It runs the ultra-lightweight boot2docker Linux, then uses Vagrant's Docker provisioning support to spin up ZooKeeper and Kafka.

The fun bits to work out were:

  • You need to forward the ports on both Vagrant (lines 13 & 14) and Docker (the -p flag), so you can access the instance from Windows using localhost:9092
@haacked
haacked / download-nuget-licenses.ps1
Last active September 5, 2022 16:35
A PowerShell script to download your NuGet package licenses as first seen in http://haacked.com/archive/2015/03/28/download-nuget-package-licenses/
Split-Path -parent $dte.Solution.FileName | cd
New-Item -ItemType Directory -Force -Path ".\licenses"
@( Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } ) | Sort -Unique Id | % { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, (Join-Path (pwd) 'licenses\') + $pkg.Id + ".html") } Catch [system.exception] { Write-Host "Could not download license for $($pkg.Id)" } }