Skip to content

Instantly share code, notes, and snippets.

Avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / WinformsAppHost.cs
Created Aug 27, 2015
WinformsAppHost.cs
View WinformsAppHost.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using ServiceStack;
using ServiceStack.Text;
@mythz
mythz / starbucks-tracks.md
Last active Aug 29, 2015
Free StarBucks Tracks
View starbucks-tracks.md
Take it on Faith - Natalie Maines
A New Life - Jim James
The Mother we Share - CHVRCHES
Forever Young - Youngblood Hawke
Closer - Tegan and Sara
These Times - Safety Suit
City of Angels - Thrity Seconds to Mars
Strawberry Bubblegum - Justin Timberlake
Riptide - Vance Joy
If Only - Dave Matthews Band
@mythz
mythz / OrmLiteLeftJoin.cs
Created Jun 26, 2014
Left Join in OrmLite
View OrmLiteLeftJoin.cs
using System;
using ServiceStack.OrmLite;
using ServiceStack.Text;
namespace ConsoleApplication2
{
public class TableA
{
public int Id { get; set; }
public string Name { get; set; }
View AssigningRoles.cs
// Call Services as a Super User to pass RequiredRole restrictions
using (var appHost = new BasicAppHost
{
ConfigureAppHost = host =>
{
host.Config.AdminAuthSecret = "allowAdmin";
},
...
}.Init())
@mythz
mythz / swift-crash.swift
Created Jan 20, 2015
Things that can crash Swift
View swift-crash.swift
//Crashes compiler
func toAny(x:AnyObject) -> Any {
return x as Any
}
//SegFaults when Run
reflect(Int)
reflect(Int.self)
reflect(String)
//... and friends
@mythz
mythz / TestJoinSupportForORMLite.sql
Created Jan 21, 2015
TestJoinSupportForORMLite SqlServer SP and tables
View TestJoinSupportForORMLite.sql
--drop table [OrderDetail]
--drop table [Order]
--drop table [Address]
--drop table [ProUser]
DROP TABLE [dbo].[Address]
GO
DROP TABLE [dbo].[Order]
GO
@mythz
mythz / OrmLiteExtensions.cs
Created Feb 25, 2015
OrmLite Extensions to help with intelli-sense in R#-less VS.NET projects, use 'x' suffix for lambda's and 'q' suffix for SqlExpressions
View OrmLiteExtensions.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
namespace ServiceStack.OrmLite
{
public static class OrmLiteExtensions
{
@mythz
mythz / gist:744701
Created Dec 17, 2010
Get IP address of WCF Service
View gist:744701
public static IPAddress GetIpAddress(System.ServiceModel.OperationContext context)
{
var prop = context.IncomingMessageProperties;
if (context.IncomingMessageProperties.ContainsKey(System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name))
{
var endpoint = prop[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name]
as System.ServiceModel.Channels.RemoteEndpointMessageProperty;
if (endpoint != null)
{
return IPAddress.Parse(endpoint.Address);
@mythz
mythz / gist:750202
Created Dec 21, 2010
JavaScript createTableFn
View gist:750202
var createTableWithCaption = function (id, caption, tableStyle)
{
var sb = "<div class='sd-info'><table id='" + id + "' class='itfa_sectionbody' style='" + tableStyle + "'>";
if (caption) sb += "<caption>" + caption + "</caption>";
return sb;
}
var createTableFn = function (id, fieldNames, caption, tableStyle, tfoot)
{
@mythz
mythz / AsyncServiceClientTests
Created Jan 15, 2011
Passing tests for ServiceStack.NET's new C# Async Web Service Clients
View AsyncServiceClientTests
[TestFixture]
public class AsyncServiceClientTests
{
private const string ListeningOn = "http://localhost:82/";
ExampleAppHostHttpListener appHost;
[TestFixtureSetUp]
public void OnTestFixtureSetUp()
{