Skip to content

Instantly share code, notes, and snippets.

/*
cargo.toml
[dependencies]
actix = "0.9.0"
actix-rt = "1.0.0"
actix-web = { version="2.0.0", features=["openssl"] }
actix-service = "1.0.5"
env_logger = "0.6.1"
bytes = "0.5.4"
@crmckenzie
crmckenzie / Watch.ps1
Last active August 18, 2017 23:01
Pester-Watch
param([switch] $Start)
function New-FileSystemWatcher(
[Parameter(Mandatory)][ValidateNotNullOrEmpty()] [string] $TargetFile,
[Parameter(Mandatory)][ValidateNotNull()] [ScriptBlock] $Action
) {
$fullPath = Resolve-Path $TargetFile
$fsw= New-Object System.IO.FileSystemWatcher
$fsw.Path = (Split-Path $fullPath -Parent)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer]
"ShowRunAsDifferentUserInStart"=dword:00000001
# BoxStarter script
#START http://boxstarter.org/package/nr/url?<raw url>
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Move-LibraryDirectory "Personal" "$env:UserProfile\OneDrive\documents"
cinst 7zip
cinst chrome
public class ServiceHealthStatus
{
public string Type { get; set; }
public string Status { get; set; }
public string[] Messages { get; set; }
public string Name { get; set; }
public string Data { get; set; }
}
public class ServiceHealthController : ApiController
@crmckenzie
crmckenzie / sample.cs
Created May 4, 2016 23:42
Web Api + OData + AutoMapper + HyperMedia
[System.Web.Http.HttpGet]
[System.Web.OData.EnableQuery]
[System.Web.Http.Route("~/api/v1/widgets/query", Name = "widgets-query")]
[ResponseType(typeof(List<widgetJson>))]
public IQueryable<widgetJson> Query(ODataQueryOptions<WidgetEntity> query)
{
var odata = query.ApplyTo(_dbContext.widgets)
.Cast<WidgetEntity>()
.ToList()
var fs = require('fs');
fs.readFile('package.json', 'utf8', function(err, data){
console.log("reading package.json");
if (err) throw err;
obj = JSON.parse(data);
if (obj.devDependencies) {
var fs = require('fs');
fs.readFile('package.json', 'utf8', function(err, data){
console.log("reading package.json");
if (err) throw err;
obj = JSON.parse(data);
if (obj.devDependencies) {
public int ExecuteSql(string sql, object parameters = null)
{
int result;
using (var connection = ConnectToDb())
using (var command = new SqlCommand(sql, connection))
{
Log.Info(sql);
if (parameters != null)
@crmckenzie
crmckenzie / xd2md.cs
Created February 19, 2016 21:19 — forked from formix/xd2md.cs
Generates Markdown From VisualSturio XML documentation files
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace Formix.Utils
{
class Program