This file contains 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
#!/bin/bash | |
CurrentPath=$(pwd) | |
# a directory where two repositories will get fetched to | |
SynchLocation="/C/git-synch/" | |
# bundle file location - typicly on a media that transfers the file (like USB-stick) | |
BundleLocation="/E/bundlefile.bundle" | |
# remote location and alias name for repository A | |
RemoteA="https://github.com/LocationOfRepoA.git" | |
RepoA="RepoA" | |
# remote location and alias name for repository B |
This file contains 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 static class ObjectExtensions | |
{ | |
public static T Map<T>(this object source) | |
{ | |
return AutoMapper.Mapper.Map<T>(source); | |
} | |
} |
This file contains 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 class BusinessMappingProfile : Profile | |
{ | |
public BusinessMappingProfile() | |
{ | |
CreateMap<Cat, CatDTO>() | |
.ReverseMap(); | |
CreateMap<Dog, DogDTO>() | |
.ReverseMap(); | |
} |
This file contains 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
// AutoMapper will scan the assemblies passed in for Profile instances and add each to the configuration | |
Mapper.Initialize(config => | |
config.AddProfiles(new[] | |
{ | |
// Marker types for assemblies | |
// Only one type from assembly | |
typeof (BusinessMappingProfile), | |
typeof (ClassFromSomeOtherAssemblyWithMappings) | |
})); |
This file contains 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
return cats.Map<List<CatDTO>>(); |
This file contains 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 class Car { | |
protected String BrandName; | |
public void Go() { | |
System.out.println("I'm " + BrandName + " and I'm on my way..."); | |
} | |
} | |
public class MercedesCar extends Car { | |
public MercedesCar() { | |
BrandName = "Mercedes"; |
This file contains 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 class CarDecorator extends Car { | |
protected Car decoratedCar; | |
public CarDecorator(Car car) { | |
decoratedCar = car; | |
} | |
@Override | |
public void Go() { | |
decoratedCar.Go(); | |
} | |
} |
This file contains 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 class AmbulanceCar extends CarDecorator { | |
public AmbulanceCar(Car car) { | |
super(car); | |
} | |
@Override | |
public void Go() { | |
super.Go(); | |
System.out.println("...beep-beep-beep-..."); | |
} | |
} |
This file contains 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
Car doctorsDream = new AmbulanceCar(new MercedesCar()); | |
doctorsDream.Go(); |
This file contains 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
#!/bin/bash | |
db_set () { | |
echo "$1,$2" >> database | |
} | |
db_get () { | |
grep "^$1," database | sed -e "s/^$1,//" || tail -n 1 | |
} |