Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Reid Layoric

View GitHub Profile
@Layoric
Layoric / Customers.cs
Last active Jun 2, 2021
autoquery-min-code-first
View Customers.cs
[Route("/customers")]
public class QueryCustomers : QueryDb<Customer> {}
@Layoric
Layoric / AppHost.cs
Created Jun 2, 2021
autoquery-just-apphost
View AppHost.cs
// Connect your database
container.AddSingleton<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(MapProjectPath("~/northwind.sqlite"), SqliteDialect.Provider));
// Add the AutoQuery Plugin
Plugins.Add(new AutoQueryFeature { MaxLimit = 100 });
@Layoric
Layoric / AppHost.cs
Last active Jun 2, 2021
autoquery-custom
View AppHost.cs
// Connect your database
container.AddSingleton<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(MapProjectPath("~/northwind.sqlite"), SqliteDialect.Provider));
// Add the AutoQuery Plugin
Plugins.Add(new AutoQueryFeature { MaxLimit = 100 });
@Layoric
Layoric / AppHost.cs
Last active Jun 2, 2021
Register AutoQuery Plugin
View AppHost.cs
// Connect your database
container.AddSingleton<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(MapProjectPath("~/northwind.sqlite"), SqliteDialect.Provider));
// Configure AutoQuery to Generate CRUD services
Plugins.Add(new AutoQueryFeature {
MaxLimit = 1000,
GenerateCrudServices = new GenerateCrudServices {
AutoRegister = true
}
@Layoric
Layoric / mix.md
Last active Mar 24, 2021 — forked from gistlyn/mix.md
Mix Gists
View mix.md

Available Gists

Projects

  • console-cs {to:'.'} project,C# C# .NET 5 Console App
  • console-fs {to:'.'} project,F# F# .NET 5 Console App
  • console-vb {to:'.'} project,VB VB .NET 5 Console App
  • console-ss {to:'.'} project,S# #Script Console App
  • console-lisp {to:'.'} project,Lisp #Script Lisp Console App
  • init {to:'.'} project,C# Empty .NET 5 ServiceStack App
@Layoric
Layoric / main.cs
Created Aug 27, 2019
SS enum example
View main.cs
using System.Linq;
using System;
using ServiceStack;
using ServiceStack.Text;
public enum Foo
{
None,
Test,
Bar
View fizzbuzz.txt
Create an application that:
1. Loops 100 times
2. Pauses for 200ms each loop
3. Writes 'Fizz' to the console when loop count is divisable by 2
4. Writes 'Buzz' to the console when loop count is divisable by 5
5. Writes 'FizzBuzz' to the console when loop count is divisable by both
Extra
Setup project to write a unit test using NUnit, walk through project steps you need to enable this.
@Layoric
Layoric / solcast_client_example.py
Last active Feb 26, 2017
Example solcast-py API usage.
View solcast_client_example.py
import solcast
# Fetch latest PV power forecast
pv_power_resp = solcast.get_pv_power_forecasts(-35, 149, capacity=2000, tilt=23, azimuth=0, api_key='INSERTYOURAPIKEYHERE')
# Print soonest PV power forecast
print(pv_power_resp.forecasts[0]['pv_estimate'])
@Layoric
Layoric / step-by-step-gatling-idea.md
Last active Dec 12, 2016 — forked from groovybayo/step-by-step-gatling-idea.md
Gatling: Step by step guide to IntelliJ integration
View step-by-step-gatling-idea.md

Step by step guide to setting up IDEA to write gatling simulations

Prerequisites:

Have [SBT plugin][sbt-plugin] installed

Begin

  • [Create a new project][create-project] in IDEA ( File > New Project ...)
    • Make sure you select a maven module
@Layoric
Layoric / main.cs
Last active Sep 30, 2016
LoadSelect Example
View main.cs
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
public class Foo