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 class Api : Restish | |
| { | |
| Api() | |
| { | |
| Get("/customers", (req, res) => | |
| { | |
| return View(new[] | |
| { | |
| new { name = "Charles" } | |
| }); |
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 static class AutoMapperExtensions | |
| { | |
| public static void NullSafeMapFrom<T, TResult>(this IMemberConfigurationExpression<T> opt, Expression<Func<T, TResult>> sourceMemberExpression) | |
| { | |
| var sourceMember = sourceMemberExpression.Compile(); | |
| opt.MapFrom(src => | |
| { | |
| try | |
| { |
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 class MyClassMap: ClassMap<MyClass> | |
| { | |
| public MyClassMap() | |
| { | |
| Id(x => x.Id) | |
| .Column("MyClassId") | |
| .GeneratedBy.HiLo("100"); | |
| Map(x => x.Something) | |
| .Length(150); |
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
| @Path("/customers") | |
| class CustomerResource { | |
| @GET | |
| @Produces(Array(MediaType.APPLICATION_JSON)) | |
| @Path("{id}") | |
| def getJson(@PathParam("id") id: Int) = | |
| "Id requested was: " + id.toString() | |
| } |
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
| @Path("/customers") | |
| class CustomerResource { | |
| @GET | |
| def get = | |
| "[{ 'name': 'James' }, { 'name': 'Gregory' }]" | |
| @GET | |
| def get(id) = | |
| "{ 'name': 'James' }" | |
| } |
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 class MyEnum | |
| { | |
| public static readonly MyEnum Value1 = new MyEnum("value1"); | |
| public static readonly MyEnum Value2 = new MyEnum("value2"); | |
| readonly string name; | |
| MyEnum(string name) | |
| { | |
| this.name = name; |
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
| Establish context = () => | |
| controller = Container.Resolve<OrderController>(); |
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
| app.post '/buy', (req, res) -> | |
| googleCheckout.sendInitialOrderRequest req, (redirectUrl) -> | |
| res.redirect redirectUrl |
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
| git status: | |
| # On branch master | |
| # Changes to be committed: | |
| # (use "git reset HEAD <file>..." to unstage) | |
| # | |
| # renamed: file -> elif | |
| # | |
| commit: |
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 class Task<T> | |
| { | |
| readonly T something; | |
| public Task(T something) | |
| { | |
| this.something = something; | |
| } | |
| } |