Skip to content

Instantly share code, notes, and snippets.

View Ulriksen's full-sized avatar

Harald Schult Ulriksen Ulriksen

View GitHub Profile
// paket outdated / update -> git commit
open System
open System.Diagnostics
open System.IO
open System.Threading
let info format =
printf "%s " (DateTime.Now.ToString("g"))
printfn format
let run filename arg =
# Build file with the latest packages in cache
FROM microsoft/dotnet:2.2-sdk
# fix Perl locale warnings :-(
RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \
apt-get update && \
apt-get --no-install-recommends install -y locales
WORKDIR /usr/mycode
@Ulriksen
Ulriksen / gist:d04575733fea468226d1e3542c67b87f
Created June 22, 2017 10:47
Cosmos DB default indexing
var collectionSpecification = new DocumentCollection { Id = collectionId };
collectionSpecification.IndexingPolicy.IncludedPaths = new Collection<IncludedPath>
{
new IncludedPath
{
Path = "/*",
Indexes = new Collection<Index>
{
new RangeIndex(DataType.Number),
new RangeIndex(DataType.String),
var client = new Microsoft.Azure.Documents.Client.DocumentClient(new Uri(dbEndpoint),key);
var urlDocument = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);
var query = "SELECT * FROM c";
var taskQuery = Task.Run(
() => client.CreateDocumentQuery(urlDocument, query,
new FeedOptions
{
MaxItemCount = 10,
public class VersionedRoute : RouteFactoryAttribute
{
private readonly int _allowedVersion;
public VersionedRoute(string template, int allowedVersion) : base(template)
{
_allowedVersion = allowedVersion;
}
public override IDictionary<string, object> Constraints
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Description;
using System.Web.Http.Routing;
@Ulriksen
Ulriksen / gist:5411380
Created April 18, 2013 09:14
asp.net validation display override AOP style.
//before postback
if (typeof WebFormWebForm_DoPostBackWithOptions != 'undefined') {
var originalWebFormWebFormDoPostBackWithOptions = WebFormWebForm_DoPostBackWithOptions;
WebFormWebForm_DoPostBackWithOptions = function (options) {
//add custom stuff here for execution before postback.
originalWebFormWebFormDoPostBackWithOptions(options);
};
}