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
| <!-- | |
| the select needs | |
| - "has_other" css class | |
| - "data-other" attribute, which points to the id of the element to hide/show (normally a textbox) | |
| - "data-other-text" attribute, which indicates the text which indicates that other has been selected | |
| --> | |
| <select class="has_other" data-other="#textbox_id" data-other-text="...other"> | |
| <option>option 1</option> | |
| <option>...other</option> |
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
| def time_for | |
| started_at = Time.now | |
| yield | |
| elapsed = Time.now - started_at | |
| end | |
| # elapsed = time_for { 5 * i } | |
| # otherwise Benchmark.measure { 5 * i } |
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 RouteCollectionExtensions | |
| { | |
| private static void MapResources(this RouteCollection routes, string model) | |
| { | |
| MapResources(routes, model, model + "s"); | |
| } | |
| private static void MapResources(this RouteCollection routes, string model, string models) | |
| { | |
| // models - index |
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 JsonBuilder | |
| { | |
| private readonly StringBuilder _sb; | |
| private readonly Stack<bool> _hasPreviousProperties; | |
| private bool RequiresComma { get { return _hasPreviousProperties.Count > 0 && _hasPreviousProperties.Peek(); } } | |
| public JsonBuilder() { | |
| _sb = new StringBuilder(); |
NewerOlder