Skip to content

Instantly share code, notes, and snippets.

Avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / main.cs
Created Jul 1, 2020 — forked from alfredoPacheco/main.cs
Redis Redis/Memory RemoveAll repro
View main.cs
using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.DataAnnotations;
using ServiceStack.Caching;
var redisManager = new RedisManagerPool("localhost:6379");
var redis = redisManager.GetClient();
redis.FlushAll();
@mythz
mythz / main.cs
Created Mar 28, 2020 — forked from gistlyn/main.cs
OrmLite runtime attributes
View main.cs
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
OrmLiteUtils.PrintSql();
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
@mythz
mythz / main.cs
Created Jul 10, 2019 — forked from sashapodgoreanu/main.cs
Auto Mapping Converter Example
View main.cs
using System;
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using System.Collections.Generic;
AutoMapping.RegisterConverter((CarRevisionDbo from) => {
var to = from.ConvertTo<CarRevisionDto>(skipConverters:true);
to.PopulateWith(from.Car);
return to;
@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 / data.cs
Last active Nov 18, 2016 — forked from gistlyn/data.cs
OrmLite LoadSelect Example
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 / Afile.cs
Last active Jul 25, 2016 — forked from gistlyn/data.cs
OrmLite Reference Test Data
View Afile.cs
// Afile.cs
// Created by mythz on 2016/07/25
class File {
}
@mythz
mythz / data.cs
Last active Jul 23, 2016
OrmLite SELECT Examples
View data.cs
using System.Collections.Generic;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
[Reference]
public List<Track> Tracks { get; set; }
View fizzbuzz.bat
REM courtesy of https://github.com/nixha
@echo off
for /L %%I IN (1, 1, 100) DO (
call :OUTPUT %%I
)
pause
exit
@mythz
mythz / Cat.cs
Created Sep 10, 2011 — forked from anonymous/cat.coffee
Go and CoffeeScript examples of writing a file to stdout
View Cat.cs
using System;
public class File {
public string Name { get; set; }
public string Read() {
return System.IO.File.ReadAllText(Name);
}
}
class Program {