Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris McVittie chrismcv

  • Blue Zinc IT
  • Belfast
View GitHub Profile
@chrismcv
chrismcv / RsaKeyConverter.cs
Created Aug 15, 2019 — 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!
View RsaKeyConverter.cs
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;
@chrismcv
chrismcv / data.cs
Last active May 31, 2017 — forked from gistlyn/data.cs
Join with Alias
View data.cs
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 / main.cs
Created May 12, 2017 — forked from mythz/main.cs
Custom SQL with Custom Select Fields demo
View main.cs
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 / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:3839583
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 / gist:3810439
Created Oct 1, 2012
Live Projection that doesn't seem to work
View gist:3810439
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:1682443
Created Jan 26, 2012
Gzip upload with formidable
View gist:1682443
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);
View heradar construction issue
[ExtendWith(typeof(ErrorInfo))]
public class SimpleWorks
{
}
[ExtendWith(typeof(ErrorInfo))]
public class ThisOneDoesNotWork
{
private readonly IEventAggregator _eventAggregator;