Skip to content

Instantly share code, notes, and snippets.

View chrismcv's full-sized avatar

Chris McVittie chrismcv

  • Blue Zinc IT
  • Belfast
View GitHub Profile
[ExtendWith(typeof(ErrorInfo))]
public class SimpleWorks
{
}
[ExtendWith(typeof(ErrorInfo))]
public class ThisOneDoesNotWork
{
private readonly IEventAggregator _eventAggregator;
@chrismcv
chrismcv / gist:1682443
Created January 26, 2012 11:57
Gzip upload with formidable
var receivedFile, form = new formidable.IncomingForm();
form.keepExtensions = true;
form.on('file', function (field, file) {
receivedFile = file;
}).on('end', function () {
var inp = fs.createReadStream(receivedFile.path);
var out = fs.createWriteStream(receivedFile.filename);
inp.pipe(gzip).pipe(out);
@chrismcv
chrismcv / gist:3810439
Created October 1, 2012 08:59
Live Projection that doesn't seem to work
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client.Document;
using Raven.Client.Indexes;
namespace ravenplay
{
public class Activity
@chrismcv
chrismcv / gist:3839583
Created October 5, 2012 12:31
DNF Index Issue
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using Raven.Abstractions.Data;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
using Raven.Client.Listeners;
@chrismcv
chrismcv / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@chrismcv
chrismcv / main.cs
Created May 12, 2017 14:13 — forked from mythz/main.cs
Custom SQL with Custom Select Fields demo
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
@chrismcv
chrismcv / data.cs
Last active May 31, 2017 16:10 — forked from gistlyn/data.cs
Join with Alias
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@chrismcv
chrismcv / RsaKeyConverter.cs
Created August 15, 2019 08:03 — forked from GlitchedPolygons/RsaKeyConverter.cs
Useful extension method class for converting RSA key strings back and forth from and to XML/PEM. Kudos to misaxi (https://github.com/misaxi), a huge thank you for the original gist!
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Security.Cryptography;
using Org.BouncyCastle.Pkcs;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.OpenSsl;