Skip to content

Instantly share code, notes, and snippets.

View dealproc's full-sized avatar

Richard Bennett dealproc

View GitHub Profile

I'm trying to figure out how to describe the issue of what everyone calls a CRUD application, and subsequently start to explain why a CRUD app isn't about CRUD, since those screens need validation involved in them more than most developers understand.

Let's look at the acronym, CRUD:

  • C - Create (Insert) values inside the database
  • R - Read (Select) values from the database
  • U - Update (Update :trollface:) values inside the database
  • D - Delete (Delete :trollface:) values from existence

This gives a 1-1 relationship between a users actions and what we do in the database. We're either inserting data (create/insert), displaying those values that we just created (read/select), updating values that exist (update), and when we no longer need the data, we're deleting the data (delete). The hard part with this notion is that in the real world, this is never the case. To support this theory, we should look at one of the most widely accepted CRUD applications that exist out there... a CRM

@dealproc
dealproc / xUnit.proj
Created June 17, 2015 08:42
xUnit run file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Test"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(SolutionDir)packages\xunit.runner.msbuild.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.runner.msbuild.dll"
TaskName="Xunit.Runner.MSBuild.xunit" />
<ItemGroup>
<TestAssemblies Include="**/*.Tests.dll;**/*.IntegrationTests.dll" Exclude="**/obj/**;**/*IntegrationTests*;" />
</ItemGroup>
<Target Name="Test">
@dealproc
dealproc / CalculateVersion.ps1
Last active August 29, 2015 14:23
SemVer Script
# These are project build parameters in TeamCity
# Depending on the branch, we will use different major/minor versions
$majorMinorVersionMaster = "%system.MajorMinorVersion.Master%"
$majorMinorVersionDevelop = "%system.MajorMinorVersion.Develop%"
$assemblyVersion = ""
# TeamCity's auto-incrementing build counter; ensures each build is unique
$buildCounter = "%build.counter%"
# This gets the name of the current Git branch.
@dealproc
dealproc / downloader.js
Created June 23, 2015 05:32
Downloader for binary files.
// Would be best to store this in ~/Scripts/durandal/plugins for convenience.
// This is so that when you must download a file from the web, via WebAPI with an OAuth2 token, you can validate yourself to the Api.
// This has been tested with small-ish files, but has not been tested with larger files, like installers. Please offer contributions
// back for those items.
define(["durandal/system", "durandal/app"], function (system, app) {
var defaults = {
url: "", // to be provided by end user.
method: "GET",
mimeType: "application/octet-stream",
filename: "download.bin",
@dealproc
dealproc / !Notes.md
Last active August 29, 2015 14:23
Issuing a Self-Signed certificate

Depends on using BouncyCastle nuget package for the certificate generation.

@dealproc
dealproc / TokenManager.cs
Created July 5, 2015 05:13
C# OAuth Token Manager
public class TokenManager {
static readonly ILog _log = LogProvider.For<TokenManager>();
string _clientId = "{your client id}";
string _secret = "{your secret}";
string _scopes = "{claims} offline_access"; // needs the offline_access to get the refresh token.
CloudConnectConfiguration _configuration;
Task _workerLoop;
CancellationTokenSource _cts;
@dealproc
dealproc / something.ps1
Last active August 29, 2015 14:25
Gist on how i setup teamcity, based on octopus deploy's script.
# These are project build parameters in TeamCity
# Depending on the branch, we will use different major/minor versions
$majorMinorVersionMaster = "%system.MajorMinorVersion.Master%"
#$majorMinorVersionMaster = "1.9.0"
# TeamCity's auto-incrementing build counter; ensures each build is unique
$buildCounter = "%build.counter%"
#$buildCounter = "999"
# This gets the name of the current Git branch.
@dealproc
dealproc / TestingDelegatingHandler.cs
Created September 2, 2015 12:29
Testing Delegating Handler
/// <summary>
/// From: http://blogs.msmvps.com/theproblemsolver/2013/05/20/unit-testing-code-depending-on-the-asp-net-webapi-httpclient/
/// </summary>
/// <typeparam name="T"></typeparam>
public class TestingDelegatingHandler<T> : DelegatingHandler {
private Func<HttpRequestMessage, HttpResponseMessage> _httpResponseMessageFunc;
public TestingDelegatingHandler(T value) : this(HttpStatusCode.OK, value) { }
public TestingDelegatingHandler(HttpStatusCode statusCode) : this(statusCode, default(T)) { }
public TestingDelegatingHandler(HttpStatusCode statusCode, T value) {
@dealproc
dealproc / install.ps1
Created October 20, 2015 20:09
drey.install.ps1
param (
$installPath,
$toolsPath,
$package,
$project
)
# Find Debug configuration and set debugger settings.
Write-Host "`tSetting startup information in Debug configuration"
@dealproc
dealproc / applicationsettingshelper.cs
Last active December 14, 2015 15:29
app settings helper
public class ApplicationSettingsHelper : IApplicationSettingsHelper
{
readonly IApplicationSettingRepository _applicationSettingRepository;
/// <summary>
/// Default constructor
/// </summary>
public ApplicationSettingsHelper(IApplicationSettingRepository applicationSettingsRepository)
{
_applicationSettingRepository = applicationSettingsRepository;