Skip to content

Instantly share code, notes, and snippets.

Darren Reid Layoric

Block or report user

Report or block Layoric

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
@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 XNATextureLoader
/// <summary>
/// Based on http://jakepoz.com/jake_poznanski__background_load_xna.html
/// </summary>
public class TextureLoader
{
static TextureLoader()
{
BlendColorBlendState = new BlendState
{
ColorDestinationBlend = Blend.Zero,
@Layoric
Layoric / web.config
Last active Apr 22, 2018
IIS web config for .dart files
View web.config
<system.webServer>
<staticContent>
<remove fileExtension=".dart" />
<mimeMap fileExtension=".dart" mimeType="application/dart" />
</staticContent>
</system.webServer>
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
@Layoric
Layoric / ec2-startup.sh
Created Sep 13, 2016 — forked from ReedD/ec2-startup.sh
User data for EC2 to set up Docker and Compose (Fig) for ec2-user
View ec2-startup.sh
#!/bin/sh
export PATH=/usr/local/bin:$PATH;
yum update
yum install docker -y
service docker start
# Docker login notes:
# - For no email, just put one blank space.
# - Also the private repo protocol and version are needed for docker
# to properly setup the .dockercfg file to work with compose
@Layoric
Layoric / index.md
Last active Sep 1, 2016
Auto mapping
View index.md

Auto mapping

Auto mapping it a helpful utility in ServiceStack that allows you to easy populate different classes with the same structure allowing you to keep appropriate separations whilst reducing lines of code.

For example, it's common in ServiceStack to keep your request and response DTO classes separate from others like your OrmLite model classes or other logic classes even thought they might share the same structure.

public class GetPersonResponse
{
    public string FirstName { get;set; }
@Layoric
Layoric / main.cs
Last active Sep 1, 2016
New Public Gist
View main.cs
using System;
using ServiceStack;
using ServiceStack.Text;
public class GetPersonResponse
{
public string FirstName { get;set; }
public string LastName { get;set; }
public int Age { get;set; }
public string PostCode { get;set; }
You can’t perform that action at this time.