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
| server.conneg() { | |
| onAcceptHeader() | |
| onExtension() | |
| onQueryParameter("format") | |
| } | |
| server.get("/customer/:id", | |
| { |
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
| // implementation of favicon interceptor | |
| public class FavIconInterceptor(val icon: String): Interceptor { | |
| override fun intercept(request: Request, response: Response): Boolean { | |
| if (request.method == HttpMethod.GET && request.uri.compareToIgnoreCase("/favicon.ico") == 0) { | |
| response.streamFile(icon, "image/x-icon") | |
| return true | |
| } | |
| return false |
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 appServer = AppServer() | |
| server.static('/public') | |
| server.start() | |
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
| fun takeExtension(func: (Customer.() -> Unit)) { | |
| } | |
| fun takeAFunc(func: (String) -> Unit) { | |
| } | |
| fun theFunc(input: String) { |
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
| fun takeAFunc(func: (String) -> Unit) { | |
| } | |
| fun theFunc(input: String) { | |
| } | |
| fun useAFunc() { |
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
| val server = AppServer() | |
| server.conneg() { | |
| onAcceptHeader() | |
| onExtension() | |
| onQueryParameter("format") | |
| } | |
| server.intercept(BasicAuthenticationInterceptor("secure area", { (user: String, pass: String) -> user == pass}), "*") | |
| server.get("/customer/:id", |
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
| server.conneg() { | |
| onAcceptHeader() | |
| onExtension() | |
| onQueryParameter("format") | |
| } |
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
| server.get("/customer/:id", | |
| any { | |
| }, | |
| "text/html" to { | |
| // return a web page | |
| }, | |
| "application/json" to { | |
| // return json | |
| } |
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.directive('projectLocator', function () { | |
| return { | |
| restrict: 'E', | |
| scope: { | |
| }, | |
| templateUrl: '/partials/projectLocator.html', | |
| controller: function ($scope, $resource) { | |
| $scope.selectd = undefined; | |
| $scope.message = 'loading projects...'; | |
| $resource('/teamcity/projects').query(function (result) { |
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
| Son we live in a world that has JavaScript, needs JavaScript. | |
| And while my existence might seem grotesque, somebody needs to | |
| write and maintain this JavaScript. We use words such as closures | |
| and functions with honour, with understanding. You use them to mock | |
| JavaScript and what we do at your user groups. So instead | |
| of using that web site to register for your little trips and then question | |
| the same technology that runs it, I'd rather you just say thank you | |
| and go on your way. Either way, I don't give a crap what you think about JavaScript. |