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
| $(function() { | |
| jasmine.getFixtures().fixturesPath = '../../../app/views'; | |
| }) |
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
| describe("ContactEdit", function() { | |
| beforeEach(function() { | |
| loadFixtures('contacts/_edit.html.erb'); | |
| ... |
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 MyObjectManagerExtensions | |
| { | |
| public static IEnumerable<selectlistitem> AsSelectList(this IEnumerable<myobject> list, int? value) | |
| { | |
| return (from item in list | |
| select new SelectListItem | |
| { | |
| Selected = value.HasValue && item.Id == value.Value, | |
| Text = item.Name, | |
| Value = item.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
| public static class SelectListExtension | |
| { | |
| public static IEnumerable<selectlistitem> WithDefault(this IEnumerable<selectlistitem> list, string defaultLabel = "Select one...", string value = "") | |
| { | |
| return (new[] { new SelectListItem { Text = defaultLabel, Value = value } }).Concat(list); | |
| } | |
| } |
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
| ViewBag.MyObject = myObjectManager | |
| .GetAllMyObjectBy(isForFoo: true, orderBy: MyObjectColumns.Name) | |
| .AsSelectList(myObjectId) | |
| .WithDefault(); |
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; | |
| namespace ApacheMimeTypes | |
| { | |
| class Apache | |
| { | |
| public static Dictionary<string, string> MimeTypes = new Dictionary<string, string> | |
| { | |
| { "123", "application/vnd.lotus-1-2-3" }, |
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
| Mapper.CreateMap<Person, Person>() | |
| .ForMember(x => x.BrainSize, opt => opt.Ignore()); | |
| var person = Mapper.Map<Person, Person>(anotherPerson); |
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
| Mapper.CreateMap<Person, Person>(); | |
| anotherPerson.BrainSize = 5000; | |
| var einstein = Mapper.Map<Person, Person>(anotherPerson); |
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
| Mapper.Reset(); // don't want some other area's usage polluting us | |
| // create some mappings here that we don't want to pollute other areas | |
| ... | |
| Mapper.Reset(); |
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
| #!/usr/bin/php -q | |
| <?php | |
| $list = shell_exec("gem list"); | |
| foreach (split("\n", $list) as $line) | |
| { | |
| $entries = split(" ", $line); | |
| $program = $entries[0]; |