Skip to content

Instantly share code, notes, and snippets.

using JsonSrcGen;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Text;
using System;
using System.Numerics;
using System.Runtime.InteropServices;
using JsonSrcGen.Runtime;
using System.Runtime.CompilerServices;
@trampster
trampster / JsonSrcGenContributorLicenceAgreement.md
Last active September 14, 2020 11:26
JsonSrcGContributorLicenceAgreement

JsonSrcGen Contributor License Agreement

The following terms are used throughout this agreement:

You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.

Contribution - any type of work that is submitted to JsonSrcGen, including any modifications or additions to existing work.

Submitted - conveyed to JsonSrcGen via a pull request, commit, issue, or any form of electronic, written, or verbal communication with JsonSrcGen, contributors or maintainers.

1. Grant of Copyright License.

@trampster
trampster / JsonicsExample.cs
Last active September 15, 2017 11:42
Jsonics Example
//create an optimised Json converter for type Person
var jsonConverter = JsonicFactory.Compile();
//serilize a person instance
string jsonstring = jsonCoverter.ToJson(new Person(){"FirstName"="Luke", "LastName"="Skywalker"});
//deserialise a person json string
Person person = jsonCoverter.FromJson(jsonString);
@trampster
trampster / JsonicsContributorLicenseAgreement.md
Last active July 11, 2017 07:33
Jsonics Contributor License Agreement

Jsonics Contributor License Agreement

The following terms are used throughout this agreement:

You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.

Contribution - any type of work that is submitted to Jsonics, including any modifications or additions to existing work.

Submitted - conveyed to Jsonics via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Jsonics, contributors or maintainers.

1. Grant of Copyright License.

var subscriptTag = new TextTag("SuperScript");
//make the font smaller
subscriptTag.SizePoints = (baseFontSize/2);
//turn on the Rise settings
subscriptTag.RiseSet = true;
//move down
subscriptTag.Rise = -(baseFontSize / 4) * 1024;
@trampster
trampster / gist:5180244
Created March 17, 2013 05:17
Superscript in GTK#
var superscriptTag = new TextTag("SuperScript");
//make the font smaller
superscriptTag.SizePoints = (baseFontSize/2);
//turn on the Rise settings
superscriptTag.RiseSet = true;
//move up
superscriptTag.Rise = (baseFontSize * 3 / 4) * 1024;
public static class WidgetExtensions
{
private static Thread _uiThread;
/// <summary>
/// Determines whether we need to invoke to get onto the UI thread
/// </summary>
public static bool InvokeRequired(this Gtk.Widget widget)
{
if(_uiThread == null)