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 names = persons.map(prop("name")); | |
| // => ['Kalle', 'Line', 'Greta']; |
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
| package ${enclosing_package}; | |
| /** | |
| * Eclipse JUnit template that imports | |
| * Mockito + common asserts and matchers. | |
| * | |
| * Import by select: Window > Preferences > Java > Editor > Templates > New... | |
| * | |
| */ | |
| import static junit.framework.Assert.*; |
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 UserHttpRequest extends HttpServletRequestWrapper { | |
| public UserHttpRequest(final HttpServletRequest req) { | |
| super(req); | |
| } | |
| public UserPrincipal getUser() { | |
| return (UserPrincipal) getUserPrincipal(); | |
| } | |
| } |
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 UserServlet extends HttpServlet { | |
| @Override | |
| protected void service(final HttpServletRequest req, final HttpServletResponse res) { | |
| process(new UserHttpRequest(req)); | |
| } | |
| private static void process(final UserHttpRequest req) { | |
| final UserPrincipal user = req.getUser(); | |
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 UserPrincipal getUser() { | |
| final Object user = getUserPrincipal(); | |
| logger.info("user.getClass().getClassLoader() = {}", user.getClass().getClassLoader()); | |
| logger.info("UserPrincipal.class.getClassLoader() = {}", UserPrincipal.class.getClassLoader()); | |
| return (UserPrincipal) user; | |
| } |
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
| <ul> | |
| <asp:Repeater ID="PersonRepeater" runat="server"> | |
| <ItemTemplate> | |
| <li> | |
| <%# DataBinder.Eval(Container.DataItem,"FullName") %>, | |
| <%# DataBinder.Eval(Container.DataItem,"City") %> | |
| </li> | |
| </ItemTemplate> | |
| </asp:Repeater> | |
| </ul> |
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
| /// <summary> | |
| /// RepeaterItem - wrapper for the current Container.DataItem | |
| /// | |
| /// <param name="T">The item.</param> | |
| /// </summary> | |
| public class RepeaterItem<T> where T : class | |
| { | |
| public T Current { get; private set; } | |
| public RepeaterItem(object dataItem) |
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 partial class PersonListView : Page | |
| { | |
| protected RepeaterItem<Person> Item { get; set; } | |
| protected void Page_Load(object sender, EventArgs e) | |
| { | |
| IPersonService _personService = IoC.Resolve<IPersonService>(); | |
| PersonRepeater.DataSource = _personService.getAll(); | |
| PersonRepeater.DataBind(); |
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
| <ul> | |
| <asp:Repeater ID="PersonRepeater" runat="server"> | |
| <ItemTemplate> | |
| <%# Item = new RepeaterItem<Person>(Container.DataItem) %> | |
| <li> | |
| <% Item.Current.FullName %>, | |
| <% Item.Current.City %> | |
| </li> | |
| </ItemTemplate> | |
| </asp:Repeater> |
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.Linq; | |
| namespace StringCalculatorApp | |
| { | |
| public class StringCalculator | |
| { | |
| private const string CustomDelimiterStart = "//"; | |
| private const char CustomDelimiterEnd = '\n'; |