Skip to content

Instantly share code, notes, and snippets.

View lnickers2004's full-sized avatar

Larry Nickerson lnickers2004

View GitHub Profile
@lnickers2004
lnickers2004 / gist:8d4b718b0623d393ecf6
Created May 6, 2014 15:30
Qt QDebug qDebug() usage
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << "Hello World!";
qDebug("Yes!");
return a.exec();
}
@lnickers2004
lnickers2004 / Angular_directives.html
Last active January 4, 2016 02:18
AngularJS: Recipes Cheatsheet angular Directives exampls
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!-- application ng-app directive-->
<!--html ng-app="alphaApp"></html-->
@lnickers2004
lnickers2004 / BaseApiController.cs
Created January 19, 2014 08:09
WebApi 2: Implemented Post of DiaryEntries. Added a Parse method to the ModelFactory to build the DiaryEntry from the model. Return appropriate Http Status codes in success and failure cases. Updated Base api controller to pass the the repository into the ModelFactory so the model factory's new Parse() method can use the repository to get data t…
using CountingKs.Data;
using CountingKs.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace CountingKs.Controllers
@lnickers2004
lnickers2004 / BaseApiController.cs
Last active January 3, 2016 18:19
WebApi 2: Add DiaryEntriesController and implement Gets Diary Entries using IdentityService, Repository, ModelFactory
using CountingKs.Data;
using CountingKs.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace CountingKs.Controllers
@lnickers2004
lnickers2004 / CountingKsIdentityService.cs
Created January 18, 2014 07:59
WebApi2: Added a Diary Controller which uses an Identity Service for authorization to return logged-in user's private daily diary. also added testing to ensure a diary is found and return the apropriate HttpReponse Codes-- either 200 OK or 404 not found. Also have special case code for returning a date as part of the URI (making use of string fo…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace CountingKs.Services
{
public class CountingKsIdentityService : CountingKs.Services.ICountingKsIdentityService
{
public CountingKsIdentityService()
@lnickers2004
lnickers2004 / BaseApiController.cs
Last active January 3, 2016 15:59 — forked from anonymous/gist:8486727
WebApi2: DTO ModelFactory which has been refactored to include the creation of HATEOAS URIs-- HyperMedia Links NOTE: we were not able to use automapper to Map between Entities and DTO's because we wanted to create Hypertext URIs for the DTOs inside the Factory. So we opted to use the Factory Pattern for the creation of our DTO's
using CountingKs.Data;
using CountingKs.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace CountingKs.Controllers
@lnickers2004
lnickers2004 / gist:8468955
Created January 17, 2014 05:46
SQL: Helpful CountingKs Pluralsight Course SQL statements. Implementing WebAPI ... shawn wildermuth
use countingks;
select distinct top 3 * from nutrition.food
select distinct top 3 * from Nutrition.Measure
select distinct top 3 * from CountingKs.FoodDiaries.Diary
select distinct top 3 * from CountingKs.FoodDiaries.DiaryEntry
select distinct top 3 * from CountingKs.Security.ApiUser
select distinct top 3 * from CountingKs.Security.AuthToken
@lnickers2004
lnickers2004 / FoodsController_sln1.cs
Last active January 3, 2016 13:09
WebApi 2: JSON Serialization Exception-- self-referencing circular reference exception Solution 1: project anonymous types removing the self-referring offending property Solution 2: Use a projection into a DTO Model that does not have the self referencing property Solution 3: Use a projection into a Model Factory to create our DTO with flexibili…
using CountingKs.Data;
using CountingKs.Data.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace CountingKs.Controllers
@lnickers2004
lnickers2004 / NinjectWebCommon.cs
Created January 17, 2014 03:13
WebAPI Ninject Dependency Reslover-- we need webapicontrib Ninject files from packagemanager for dependency resolution
[assembly: WebActivator.PreApplicationStartMethod(typeof(CountingKs.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(CountingKs.App_Start.NinjectWebCommon), "Stop")]
namespace CountingKs.App_Start
{
using System;
using System.Web;
using System.Web.Http;
using CountingKs.Data;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
@lnickers2004
lnickers2004 / ApiUser.cs
Last active January 3, 2016 13:08 — forked from nickarthur/CountingKsSeeder.cs
DATABASE: SEED SQL SERVER DATABASE FROM EXCEL SPREADSHEET.xls file example for entity framework codefirst and sqlserver. Also show repository pattern.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CountingKs.Data.Entities
{
public class ApiUser
{