Coding kata using object calisthenics rules
- Only One Level Of Indentation Per Method
- Don't Use The ELSE Keyword
- Wrap All Primitives And Strings
- First Class Collections
- One Dot Per Line
- Don't Abbreviate
- Keep All Entities Small
private static string CreateCsvTextFile<T>(List<T> data) | |
{ | |
var properties = typeof(T).GetProperties(); | |
var result = new StringBuilder(); | |
var headings = properties.Select(x => x.Name.ToString()); | |
var headerLine = string.Join(",", headings); | |
result.AppendLine(headerLine); |
public static int Compute(string s, string t) | |
{ | |
int n = s.Length; | |
int m = t.Length; | |
int[,] d = new int[n + 1, m + 1]; | |
// Step 1 | |
if (n == 0) | |
{ | |
return m; |
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<solution> | |
<add key="disableSourceControlIntegration" value="true" /> | |
</solution> | |
</configuration> |
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" | |
DefaultTargets="Build" | |
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<OutDir Condition=" '$(OutDir)'=='' ">$(MSBuildThisFileDirectory)bin\</OutDir> | |
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration> | |
<SourceHome Condition=" '$(SourceHome)'=='' ">$(MSBuildThisFileDirectory)</SourceHome> | |
<ToolsHome Condition=" '$(ToolsHome)'=='' ">$(MSBuildThisFileDirectory)tools\</ToolsHome> |
/** | |
* Setup the angular injector so we can get instances | |
* of angular objects | |
* Usage: injector.get('dataContext'); | |
*/ | |
var injector = angular | |
.element(document.body) | |
.injector(); | |
/** |
function getWatchers(root) { | |
root = angular.element(root || document.documentElement); | |
var watcherCount = 0; | |
function getElemWatchers(element) { | |
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope); | |
var scopeWatchers = getWatchersFromScope(element.data().$scope); | |
var watchers = scopeWatchers.concat(isolateWatchers); | |
angular.forEach(element.children(), function (childElement) { | |
watchers = watchers.concat(getElemWatchers(angular.element(childElement))); |
// working d. bodnar 12-21-2017 | |
/* | |
static const uint8_t D0 = 16; | |
static const uint8_t D1 = 5; | |
static const uint8_t D2 = 4; | |
static const uint8_t D3 = 0; | |
static const uint8_t D4 = 2; | |
static const uint8_t D5 = 14; | |
static const uint8_t D6 = 12; |
(function () { | |
'use strict'; | |
// Define the dependencies within an array and have a | |
// separate clean function for the controller code | |
angular | |
.module('app') | |
.controller('MyController'[ | |
'dependecyOne', | |
'dependecyTwo', |
(function () { | |
'use strict'; | |
angular | |
.module('app') | |
.controller('MyController', MyController); | |
MyController.$inject = ['dependencyOne', 'dependecyTwo']; | |
function MyController( |