Skip to content

Instantly share code, notes, and snippets.

View Zonciu's full-sized avatar

Zonciu Liang Zonciu

View GitHub Profile
@Zonciu
Zonciu / GetSVGPoint
Created March 15, 2019 08:47
Calculate point's real position after svg transforming.
/**
*
*
* @param {SVGSVGElement} svg: root svg element
* @param {number} x
* @param {number} y
* @param {SVGMatrix} ctm: element.getScreemCTM()
* @returns {SVGPoint} real position in container
*/
@Zonciu
Zonciu / FixedArray8
Created April 28, 2019 14:33
Fixed length array, available for unmanaged type
[StructLayout(LayoutKind.Sequential)]
public struct FixedArray8<T>
where T : unmanaged
{
public T Value0;
public T Value1;
public T Value2;
@Zonciu
Zonciu / GrainPrimaryKeyExtensions
Created October 30, 2020 08:20
Get Grain PrimaryKey
public static class GrainExtensions
{
/// <summary>
/// Get string Id
/// </summary>
/// <param name="grain"></param>
/// <returns></returns>
public static string GetId(this IGrainWithStringKey grain) => grain.GetPrimaryKeyString();
/// <summary>