I hereby claim:
- I am beatty on github.
- I am johndbeatty (https://keybase.io/johndbeatty) on keybase.
- I have a public key ASC2-56e3jo9Qn_g8_PD-x3NMdFr0XYagzlkryg7PqCzhAo
To claim this, I am signing this object:
// ==UserScript== | |
// @name OpenCheck | |
// @version 1.0.0 | |
// @description Adds verified OpenCheck information to Twitter profiles and threads | |
// @updateUrl TODO | |
// @icon TODO | |
// @include https://twitter.com/* | |
// ==/UserScript/ | |
const baseUrl = "https://opencheck.is/" |
I hereby claim:
To claim this, I am signing this object:
@Singleton | |
public class AuthFilter<R extends Request> extends BaseFilter<R> { | |
private final String loginUrl; | |
@Inject | |
public AuthFilter(@Named("loginUrl") String loginUrl) { | |
this.loginUrl = loginUrl; | |
} | |
@Override |
/** | |
* A RouteInfo generated by a RegexRoute. We hold the matcher that was used to verify the match | |
* so that we can capture the groups. We also lug along the paramNames list. We lazily evaluate | |
* param names as this is probably cheaper/faster than building a map of names->values up front. | |
*/ | |
class RegexRouteInfo(val matcher: Matcher, val paramNames: List[String]) extends RouteInfo { | |
def param(name: String): String = { | |
val idx = paramNames.findIndexOf(_ == name) | |
if (idx > -1 && idx < matcher.groupCount) matcher.group(idx + 1) else throw new IllegalArgumentException("bad paramName: " + name) | |
} |
/** | |
* A RouteInfo generated by a RegexRoute. We hold the matcher that was used to verify the match | |
* so that we can capture the groups. We also lug along the paramNames list. We lazily evaluate | |
* param names as this is probably cheaper/faster than building a map of names->values up front. | |
*/ | |
class RegexRouteInfo(val matcher: Matcher, val paramNames: List[String]) extends RouteInfo { | |
def param(name: String): String = { | |
val idx = paramNames.findIndexOf(_ == name) | |
if (idx > -1 && idx < matcher.groupCount) { | |
matcher.group(idx + 1) // offset by one for regex match groups |
object Example { | |
def main(args: Array[String]) { | |
val helloFunc = (request: Request) => new TextResponse( | |
"hello, " + request.routeParam("username") + "; extra message: " | |
+ request.queryParameter("extra").getOrElse("[unspecified]")) | |
val router = new Router(List( | |
(new RegexRoute("GET", "/person/([A-Za-z0-9]+)/profile", List("username")), helloFunc), | |
(new RegexRoute("GET", "/"), (request: Request) => new HtmlResponse("<html><body>homepage</body></html>")), | |
(new RegexRoute("GET", "/README"), (request: Request) => new FileResponse(new File("tronada/README"))) |
object Example { | |
def main(args: Array[String]) { | |
val helloFunc = (request: Request) => new TextResponse("hello, " + request.routeParam("username") + "; extra message: " + request.queryParameter("extra").getOrElse("[unspecified]")) | |
val homeFunc = (request: Request) => new HtmlResponse("<html><body>homepage</body></html>") | |
val fileFunc = | |
val router = new Router(List( | |
(new RegexRoute("GET", "/person/([A-Za-z0-9]+)/profile", List("username")), helloFunc), | |
(new RegexRoute("GET", "/"), homeFunc), | |
(new RegexRoute("GET", "/README"), (request: Request) => new FileResponse(new File("tronada/README"))) |