Skip to content

Instantly share code, notes, and snippets.

View tjrobinson's full-sized avatar

Tom Robinson tjrobinson

View GitHub Profile
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript
@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);
}
)
@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)
@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;
@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)
{
@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>