Skip to content

Instantly share code, notes, and snippets.

View KerryRitter's full-sized avatar

Kerry Ritter KerryRitter

View GitHub Profile
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "none",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"inlineSources": true,
@KerryRitter
KerryRitter / loadingService.ts
Created January 17, 2017 19:07
Angular Loading service using Bootstrap UI
import { Inject, Service } from "core/decorators";
@Service("loadingService")
export class LoadingService {
private _modal: ng.ui.bootstrap.IModalServiceInstance;
constructor(
@Inject("$uibModal") private _modalService: ng.ui.bootstrap.IModalService
) {
}
@KerryRitter
KerryRitter / app.ts
Created December 13, 2016 02:32
webpack typescript test
import { Person } from "./person";
import "test";
const person = new Person("Kerry", "Ritter");
alert(person.fullName);
@KerryRitter
KerryRitter / dappermap.cs
Created December 9, 2016 17:19
dapper mapping
public class OmgDapperRules
{
public List<ProjectVersionField> GetAllForVersion(int projectVersionId)
{
using (var connection = _connectionFactory.Create())
{
var fields = connection.Query<ProjectVersionField, ProjectTemplateField, ProjectTemplateFieldType, ProjectVersionField>(@"
SELECT pvf.*, ptf.*, ptft.*
FROM [dbo].[ProjectVersionField] pvf
INNER JOIN [dbo].[ProjectTemplateField] ptf ON ptf.Id = pvf.ProjectTemplateFieldId
@KerryRitter
KerryRitter / CigarController.cs
Last active November 7, 2016 16:53
bedframe example
public class CigarSerializer : Serializer<Cigar, CigarDto>
{
public Cigar Serialize(CigarDto request)
{
return new Cigar
{
Name = request.Name,
Brand = request.Brand
};
}
@KerryRitter
KerryRitter / example.cs
Last active November 3, 2016 14:36
Dapper relationship query example
using (var connection = new SqlConnection(_config["Connection"]))
{
string query = @"SELECT *
FROM [Template]
WHERE [Type] = @type;
SELECT tct.TemplateId as TemplateId, tc.Name as CategoryName
FROM [TemplateCategory_Template] tct
JOIN [TemplateCategory] tc ON tct.TemplateCategoryId = tc.Id;
@KerryRitter
KerryRitter / ContextFactory.cs
Last active November 3, 2016 14:16
Dapper.Contrib test
using System.Data.SqlClient;
using System.Configuration;
namespace DapperTest
{
public static class ContextFactory
{
public static SqlConnection Create() => new SqlConnection(ConfigurationManager.ConnectionStrings["MyCxn"].ConnectionString);
}
}
@KerryRitter
KerryRitter / CsvBuilder.cs
Created August 17, 2016 20:34
CsvBuilder.cs
/// <summary>
/// Class for building CSV outputs
/// </summary>
/// <seealso cref="System.IDisposable" />
public class CsvBuilder : IDisposable
{
private readonly StringBuilder _stringBuilder;
private readonly string _delimiter;
@KerryRitter
KerryRitter / tslint.json
Created July 20, 2016 17:08
tslint.json
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"indent": [
true,
@KerryRitter
KerryRitter / gulpfile.js
Last active July 18, 2016 20:39
TypeScript/LESS Build
/// <binding ProjectOpened='watch' />
/// <reference path="node_modules/systemjs/dist/system.js" />
/// <binding ProjectOpened='default' />
var gulp = require("gulp");
var less = require("gulp-less");
var ts = require("gulp-typescript");
var minifyCss = require("gulp-minify-css");
var concatCss = require("gulp-concat-css");
var concat = require("gulp-concat");