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
| /** | |
| * Setup the angular injector so we can get instances | |
| * of angular objects | |
| * Usage: injector.get('dataContext'); | |
| */ | |
| var injector = angular | |
| .element(document.body) | |
| .injector(); | |
| /** |
| <?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> |
| <?xml version="1.0" encoding="utf-8"?> | |
| <configuration> | |
| <solution> | |
| <add key="disableSourceControlIntegration" value="true" /> | |
| </solution> | |
| </configuration> |
| 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; |
| 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); |
| (function () { | |
| 'use strict'; | |
| angular | |
| .module('SampleApp') | |
| .controller('HomeController', HomeController); | |
| function HomeController() { | |
| var vm = this; |
| /// <reference path="../MvcAngularJasmineTests/Scripts/angular.js"/> | |
| /// <reference path="../MvcAngularJasmineTests/Scripts/angular-route.js"/> | |
| /// <reference path="Scripts/angular-mocks.js"/> | |
| /// <reference path="../MvcAngularJasmineTests/Scripts/app/app.js"/> | |
| /// <reference path="../MvcAngularJasmineTests/Scripts/home/home.controller.js"/> | |
| /// <reference path="Scripts/jasmine/jasmine.js"/> | |
| describe('When working with the home.controller', function () { |
| SELECT t.name AS table_name, | |
| SCHEMA_NAME(schema_id) AS schema_name, | |
| c.name AS column_name | |
| FROM sys.tables AS t | |
| INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID | |
| WHERE c.name LIKE '%name of column%' | |
| ORDER BY schema_name, table_name; |