Skip to content

Instantly share code, notes, and snippets.

Demis Bellot mythz

Block or report user

Report or block mythz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mythz
mythz / main.cs
Last active Apr 5, 2018
Encode en-dash char test
View main.cs
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
class Dto
{
public string Text { get; set; }
}
var dto = new Dto { Text = "The – (en dash) character" };
@mythz
mythz / main.cs
Created Jan 23, 2018
OrmLite Dynamic Attribute Test
View main.cs
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
using ServiceStack.Logging;
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true);
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
@mythz
mythz / main.cs
Last active Dec 17, 2017
OrmLite 1:1 Users and Roles
View main.cs
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
using ServiceStack.Model;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
@mythz
mythz / main.cs
Created Dec 10, 2017
JsonObject null response
View main.cs
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class CloudflareResponse
{
public JsonObject result { get; set; }
}
var json = "{\"result\":null}";
@mythz
mythz / main.cs
Created Dec 8, 2017
Templates List Dictionary Example
View main.cs
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Templates;
var __Contacts = new List<Dictionary<string,object>> {
new Dictionary<string,object> {
{ "Title", "foo" },
},
@mythz
mythz / data.cs
Last active Oct 31, 2017
OrmLite Multiple Order By
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; }
@mythz
mythz / main.cs
Last active Oct 25, 2017
Test RedisAuthRepository
View main.cs
using System;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.Testing;
using ServiceStack.DataAnnotations;
IUserAuth fromRedis;
var redisManager = new RedisManagerPool("localhost:6379");
@mythz
mythz / main.cs
Last active Jul 15, 2017
Bloomberg API example
View main.cs
using System.Runtime.Serialization;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
// OpenFIGI API: https://www.openfigi.com/api
[DataContract]
public class Mapping
{
@mythz
mythz / main.cs
Last active Jul 9, 2017 — forked from gistlyn/main.cs
What is going on?
View main.cs
var n = "1";
object value;
var hasDecimal = n.IndexOf('.') >= 0;
value = hasDecimal
? double.Parse(n)
: int.Parse(n);
System.Console.WriteLine($"{value} is {value.GetType().Name}");
@mythz
mythz / keyboard-shortcuts.ahk
Created Jun 27, 2017
Reprogram function keys to launch Apps or open URLs using AutoHotKey
View keyboard-shortcuts.ahk
;-----------------------------------------
; keyboard shortcuts using https://autohotkey.com/docs/AutoHotkey.htm
;=========================================
; --------------------------------------------------------------
; NOTES
; --------------------------------------------------------------
; ! = ALT
; ^ = CTRL
; + = SHIFT
You can’t perform that action at this time.