- Settings use the Dainty theme for VS Code
- The used font family is Jetbrains Mono
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PersonService: | |
@property | |
def person_repo(self) -> PersonRepo: | |
return PersonRepoFactory().create() | |
def set_name(self, person_id: int, new_name: str) -> None: | |
p = self.person_repo.find(person_id) | |
p.name = new_name | |
self.person_repo.add_or_update(p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog(Mammal): | |
pass | |
class Cat(Mammal): | |
pass | |
TMammal = TypeVar("TMammal", bound=Mammal) | |
class MammalCollection(Generic[TMammal]): | |
def __init__(self, *mammals: TMammal) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/> | |
<script src="http://cmx.io/v/0.1/cmx.js"></script> | |
<body> | |
<scene id="scene1"> | |
<label t="translate(0,346)"> | |
<tspan x="0" y="0em">A Comix Sample</tspan> | |
</label> | |
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a component, which is global and can be used anywhere | |
// in the application | |
const Hello = Vue.component( | |
'Hello', // Name of the component | |
{ templdate: '<span>Hello</span>' } // Options object, which contains a template | |
) | |
new Vue({ | |
template: '<div><Hello/> there</div>', // Hardcoded 'Hello' is replated with the component | |
el: '#app' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Simple script to check whether a C# Guid is really a UUID version 4. | |
/// </summary> | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine($"{"Current",-10}{"Errors found",-10}"); | |
Console.WriteLine($"{"-------",-10}{"------------",-10}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
var connectionString = Configuration.GetConnectionString("ApiTestsDbContext"); | |
services.AddDbContext<PersonDbContext>(options => | |
options.UseSqlServer(connectionString)); | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); | |
services.AddScoped<IPersonRepository, PersonRepository>(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Post_PersonWithoutName_PersonNotSaved() | |
{ | |
// Create new person, without a name, which will not be accepted by the controller | |
var person = new Person(); | |
// Create new controller with mock repository | |
var controller = new PersonController(this._repository.Object); | |
// Call controller to post person |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Post_Person_PersonSaved() | |
{ | |
// Create person to post to controller | |
var person = new Person {Name = "Johan", Age = 37}; | |
// Create new controller with mock repository | |
var controller = new PersonController(this._repository.Object); | |
// Call controller to post person |
NewerOlder