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
| from numpy.random import choice as random_choice, randint as random_randint, rand | |
| MAX_INPUT_LEN = 40 | |
| AMOUNT_OF_NOISE = 0.2 / MAX_INPUT_LEN | |
| CHARS = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ .") | |
| def add_noise_to_string(a_string, amount_of_noise): | |
| """Add some artificial spelling mistakes to the string""" | |
| if rand() < amount_of_noise * len(a_string): | |
| # Replace a character with a random character | |
| random_char_position = random_randint(len(a_string)) |
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
| //natural code with no code alignment and you can see that | |
| //readability of the code is not that good | |
| var people1 = new List<Person>() | |
| { | |
| new Person { Name = "Benita", Location = "Bareilly India", Age = 25 }, | |
| new Person { Name = "Deedee Almon Fonsec", Location = "Bari Italy", Age = 32 } , | |
| new Person { Name = "Chase Hussain", Location = "Barika Algeria", Age = 45 } , | |
| new Person { Name = "Cordia", Location = "Barinas Venezuela", Age = 26 } , | |
| new Person { Name = "Malvina Neff", Location = "Barisal Bangladesh", Age = 36 } , | |
| new Person { Name = "Erika ", Location = "Barnaul Russia", Age = 56 } , |
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
| //same above code with column indention | |
| var people2 = new List<Person>() | |
| { | |
| new Person { Name = "Benita" , Location = "Bareilly India" , Age = 25 } , | |
| new Person { Name = "Deedee Almon Fonsec" , Location = "Bari Italy" , Age = 32 } , | |
| new Person { Name = "Chase Hussain" , Location = "Barika Algeria" , Age = 45 } , | |
| new Person { Name = "Cordia" , Location = "Barinas Venezuela" , Age = 26 } , | |
| new Person { Name = "Malvina Neff" , Location = "Barisal Bangladesh" , Age = 36 } , | |
| new Person { Name = "Erika " , Location = "Barnaul Russia" , Age = 56 } , | |
| new Person { Name = "Lisabeth Terr" , Location = "Barquisimeto Venezuela" , Age = 67 } , |
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
| var benita = new Person() { Name = "Benita" }; | |
| var deedeeAlmon = new Person() { Name = "Deedee Almon Fonsec" }; | |
| var chaseHussain = new Person() { Name = "Chase Hussain" }; | |
| var cordia = new Person() { Name = "Cordia" }; | |
| benita.Age = 35; | |
| deedeeAlmon.Age = 12; | |
| chaseHussain.Age = 24; | |
| cordia.Age = 22; |
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
| var benita = new Person ( ) { Name = "Benita" } ; | |
| var deedeeAlmon = new Person ( ) { Name = "Deedee Almon Fonsec" } ; | |
| var chaseHussain = new Person ( ) { Name = "Chase Hussain" } ; | |
| var cordia = new Person ( ) { Name = "Cordia" } ; | |
| benita . Age = 35 ; | |
| deedeeAlmon . Age = 12 ; | |
| chaseHussain . Age = 24 ; | |
| cordia . Age = 22 ; |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace Example_02.NoIndention | |
| { | |
| class SyntaxToken | |
| { |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace Example_02.ColumnIndention | |
| { | |
| class SyntaxToken | |
| { |
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
| y = 2x | |
| y/2 = x |
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
| import { Injectable } from '@angular/core'; | |
| import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; | |
| import { Observable, throwError } from 'rxjs'; | |
| import { map, tap, catchError } from 'rxjs/operators'; | |
| import { allBooks, allReaders } from 'app/data'; | |
| import { Reader } from "app/models/reader"; | |
| import { Book } from "app/models/book"; | |
| import { BookTrackerError } from 'app/models/bookTrackerError'; | |
| import { OldBook } from 'app/models/oldBook'; |
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
| import { Injectable } from '@angular/core'; | |
| import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; | |
| import { Observable, of } from 'rxjs'; | |
| import { catchError } from 'rxjs/operators'; | |
| import { Book } from 'app/models/book'; | |
| import { DataService } from 'app/core/data.service'; | |
| import { BookTrackerError } from 'app/models/bookTrackerError'; | |
| @Injectable({ |
OlderNewer