Skip to content

Commit

Permalink
Misc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubarov committed May 30, 2018
1 parent 7bbb18c commit 07237bc
Show file tree
Hide file tree
Showing 97 changed files with 349 additions and 240 deletions.
11 changes: 9 additions & 2 deletions bdb/src/main/java/com/lubarov/daniel/bdb/RawDatabase.java
Expand Up @@ -5,7 +5,14 @@
import com.lubarov.daniel.data.stack.DynamicArray;
import com.lubarov.daniel.data.stack.MutableStack;
import com.lubarov.daniel.data.util.Check;
import com.sleepycat.je.*;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.OperationStatus;

import java.io.File;

Expand Down Expand Up @@ -36,7 +43,7 @@ public Option<byte[]> tryGet(byte[] key) {
OperationStatus status = db.get(null, new DatabaseEntry(key), result, null);
return status == OperationStatus.SUCCESS
? Option.some(result.getData())
: Option.<byte[]>none();
: Option.none();
}

public void put(byte[] key, byte[] value) {
Expand Down
Expand Up @@ -29,7 +29,7 @@ public HttpResponse handle(HttpRequest request) {
String authorEmail = request.getUrlencodedPostData().getValues("author_email")
.tryGetOnlyElement().getOrThrow();
Option<String> optAuthorEmail = authorEmail.isEmpty()
? Option.<String>none()
? Option.none()
: Option.some(authorEmail);
String content = request.getUrlencodedPostData().getValues("content")
.tryGetOnlyElement().getOrThrow();
Expand Down
Expand Up @@ -29,7 +29,7 @@ public HttpResponse handle(HttpRequest request) {
.addEscapedText("You are not allowed to delete posts.")
.build();
Element html = Layout.createDocument(request,
Option.some("Forbidden"), Option.<Instant>none(), content);
Option.some("Forbidden"), Option.none(), content);
return HttpResponseFactory.xhtmlResponse(HttpStatus.FORBIDDEN, html);
}

Expand All @@ -56,7 +56,7 @@ private HttpResponse handleGet(HttpRequest request) {
.build())
.build();
Element document = Layout.createDocument(request,
Option.some("Delete Post"), Option.<Instant>none(), form);
Option.some("Delete Post"), Option.none(), form);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}

Expand Down
Expand Up @@ -30,7 +30,7 @@ public HttpResponse handle(HttpRequest request) {
.addEscapedText("You are not allowed to edit posts.")
.build();
Element html = Layout.createDocument(request,
Option.some("Forbidden"), Option.<Instant>none(), content);
Option.some("Forbidden"), Option.none(), content);
return HttpResponseFactory.xhtmlResponse(HttpStatus.FORBIDDEN, html);
}

Expand Down Expand Up @@ -71,7 +71,7 @@ private HttpResponse handleGet(HttpRequest request) {
.build())
.build();
Element document = Layout.createDocument(request,
Option.some("Edit Post"), Option.<Instant>none(), form);
Option.some("Edit Post"), Option.none(), form);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}

Expand Down
18 changes: 15 additions & 3 deletions blog/src/main/java/com/lubarov/daniel/blog/HomeHandler.java
Expand Up @@ -9,6 +9,8 @@
import com.lubarov.daniel.data.order.Relation;
import com.lubarov.daniel.data.sequence.Sequence;
import com.lubarov.daniel.data.unit.Instant;
import com.lubarov.daniel.web.html.AnchorBuilder;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.Tag;
Expand All @@ -23,7 +25,7 @@ final class HomeHandler implements PartialHandler {

private static final String INTRO = ""
+ "I'm an engineer at Google, previously at Square. "
+ "Some of my interests are graphics, storage systems, language design and compilers. "
+ "Some of my interests are graphics, languages/compilers, cryptocurrencies and distributed systems in general. "
+ "Feel free to email me at <a href=\"daniel@lubarov.com\">daniel@lubarov.com</a>.";

private HomeHandler() {}
Expand All @@ -49,10 +51,20 @@ public Relation compare(Post a, Post b) {
listBuilder.addChild(new Element(Tag.LI, summaryLink));
}

Element intro = new ParagraphBuilder().setId("intro").addRawText(INTRO).build();
Element intro = new Element.Builder(Tag.DIV).setEscapedAttribtue(Attribute.ID, "intro")
.addChild(new ParagraphBuilder()
.addEscapedText("I'm an engineer at Google, previously at Square. "
+ "Some of my interests are graphics, languages/compilers, cryptocurrencies and distributed systems in general.")
.build())
.addChild(new Element.Builder(Tag.UL)
.addChild(new Element(Tag.LI, new AnchorBuilder().setHref("mailto:daniel@lubarov.com").addEscapedText("daniel@lubarov.com").build()))
.addChild(new Element(Tag.LI, new AnchorBuilder().setHref("https://github.com/dlubarov").addEscapedText("Github").build()))
.addChild(new Element(Tag.LI, new AnchorBuilder().setHref("http://daniel.lubarov.com/resume/online.html").addEscapedText("Resume").build()))
.build())
.build();

Element document = Layout.createDocument(request,
Option.<String>none(), Option.<Instant>none(),
Option.none(), Option.none(),
intro, listBuilder.build());
return Option.some(HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document));
}
Expand Down
12 changes: 11 additions & 1 deletion blog/src/main/java/com/lubarov/daniel/blog/Layout.java
Expand Up @@ -3,7 +3,17 @@
import com.lubarov.daniel.data.collection.Collection;
import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.unit.Instant;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.AnchorBuilder;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.HtmlUtils;
import com.lubarov.daniel.web.html.JavaScriptUtils;
import com.lubarov.daniel.web.html.Node;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.StylesheetUtils;
import com.lubarov.daniel.web.html.Tag;
import com.lubarov.daniel.web.html.TextNode;
import com.lubarov.daniel.web.html.TitleBuilder;
import com.lubarov.daniel.web.http.DateUtils;
import com.lubarov.daniel.web.http.HttpRequest;
import com.lubarov.daniel.web.util.UserAgentUtils;
Expand Down
Expand Up @@ -22,7 +22,7 @@ public static Collection<String> getAndClearMessages(HttpRequest request) {
}

private static SinglyLinkedList<String> getMessages(HttpRequest request) {
return messageData.tryGet(request).getOrDefault(SinglyLinkedList.<String>create());
return messageData.tryGet(request).getOrDefault(SinglyLinkedList.create());
}

private static void clearMessages(HttpRequest request) {
Expand Down
Expand Up @@ -42,7 +42,7 @@ public Option<HttpResponse> tryHandle(HttpRequest request) {

Element document = Layout.createDocument(
request, Option.some("Admin Control Panel"),
Option.<Instant>none(), whatsUp, linkList);
Option.none(), whatsUp, linkList);
return Option.some(HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document));
}
}
Expand Up @@ -5,7 +5,11 @@
import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.unit.Duration;
import com.lubarov.daniel.data.unit.Instant;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.InputBuilder;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.Tag;
import com.lubarov.daniel.web.http.HttpRequest;
import com.lubarov.daniel.web.http.HttpResponse;
import com.lubarov.daniel.web.http.HttpStatus;
Expand Down Expand Up @@ -43,13 +47,13 @@ private HttpResponse handlePost(HttpRequest request) {
.build();
CookieManager.setCooke(cookie);
Element document = Layout.createDocument(request,
Option.some("Success"), Option.<Instant>none(),
Option.some("Success"), Option.none(),
new ParagraphBuilder().addEscapedText("You have been signed in.").build()
);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
} else {
Element document = Layout.createDocument(request,
Option.some("Oops"), Option.<Instant>none(),
Option.some("Oops"), Option.none(),
new ParagraphBuilder().addEscapedText("Wrong password.").build()
);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
Expand All @@ -58,7 +62,7 @@ private HttpResponse handlePost(HttpRequest request) {

private HttpResponse handleGet(HttpRequest request) {
Element document = Layout.createDocument(request,
Option.some("Admin Login"), Option.<Instant>none(), getForm());
Option.some("Admin Login"), Option.none(), getForm());
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}

Expand Down
Expand Up @@ -5,7 +5,11 @@
import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.unit.Instant;
import com.lubarov.daniel.data.util.Check;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.Node;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.Tag;
import com.lubarov.daniel.web.http.HttpRequest;
import com.lubarov.daniel.web.http.HttpResponse;
import com.lubarov.daniel.web.http.HttpStatus;
Expand Down Expand Up @@ -38,7 +42,7 @@ private HttpResponse handlePost(HttpRequest request) {
.tryGetOnlyElement().getOrThrow("Expected exactly one password in post data.");
MiscStorage.setAdminPassword(adminPassword);
Element document = Layout.createDocument(request,
Option.some("Success"), Option.<Instant>none(),
Option.some("Success"), Option.none(),
new ParagraphBuilder().addEscapedText("Password has been set.").build());
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}
Expand All @@ -62,7 +66,7 @@ private HttpResponse handleGet(HttpRequest request) {
.build();

Element document = Layout.createDocument(request,
Option.some("Admin Setup"), Option.<Instant>none(), content);
Option.some("Admin Setup"), Option.none(), content);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}
}
Expand Up @@ -65,7 +65,7 @@ private static HttpResponse handleGet(HttpRequest request) {
.build();

Element document = Layout.createDocument(request,
Option.some("Create a Post"), Option.<Instant>none(), form);
Option.some("Create a Post"), Option.none(), form);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, document);
}

Expand Down
Expand Up @@ -12,7 +12,11 @@
import com.lubarov.daniel.data.collection.Collection;
import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.unit.Instant;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.Node;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.Tag;
import com.lubarov.daniel.web.http.HttpRequest;
import com.lubarov.daniel.web.http.HttpResponse;
import com.lubarov.daniel.web.http.HttpStatus;
Expand Down Expand Up @@ -48,7 +52,7 @@ private HttpResponse handleGet(HttpRequest request) {
Post post = PostStorage.getPostByUuid(comment.getPostUuid()).getOrThrow();
Element form = commentReviewForm(comment, post);
Element html = Layout.createDocument(request,
Option.some("Review Comments"), Option.<Instant>none(), form);
Option.some("Review Comments"), Option.none(), form);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, html);
}

Expand Down Expand Up @@ -77,7 +81,7 @@ private static HttpResponse nothingToReviewResponse(HttpRequest request) {
.addEscapedText("There are no comments needing review.")
.build();
Element html = Layout.createDocument(request,
Option.some("Review Comments"), Option.<Instant>none(), content);
Option.some("Review Comments"), Option.none(), content);
return HttpResponseFactory.xhtmlResponse(HttpStatus.OK, html);
}

Expand Down
Expand Up @@ -2,7 +2,13 @@

import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.util.DigestUtils;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.EscapeUtils;
import com.lubarov.daniel.web.html.HtmlUtils;
import com.lubarov.daniel.web.html.Node;
import com.lubarov.daniel.web.html.ParagraphBuilder;
import com.lubarov.daniel.web.html.Tag;
import com.lubarov.daniel.web.http.DateUtils;

import java.nio.charset.Charset;
Expand Down
@@ -1,7 +1,14 @@
package com.lubarov.daniel.blog.comment;

import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.serialization.*;
import com.lubarov.daniel.data.serialization.AbstractSerializer;
import com.lubarov.daniel.data.serialization.BooleanSerializer;
import com.lubarov.daniel.data.serialization.ByteSink;
import com.lubarov.daniel.data.serialization.ByteSource;
import com.lubarov.daniel.data.serialization.InstantSerializer;
import com.lubarov.daniel.data.serialization.OptionSerializer;
import com.lubarov.daniel.data.serialization.Serializer;
import com.lubarov.daniel.data.serialization.StringSerializer;

public final class CommentSerializer extends AbstractSerializer<Comment> {
public static final CommentSerializer singleton = new CommentSerializer();
Expand Down
Expand Up @@ -56,6 +56,6 @@ public static synchronized Collection<Comment> getCommentsByPost(String postUuid
}

private static synchronized Collection<String> getCommentUuidsByPost(String postUuid) {
return indexByPostUuid.get(postUuid).getOrDefault(ImmutableArray.<String>create());
return indexByPostUuid.get(postUuid).getOrDefault(ImmutableArray.create());
}
}
Expand Up @@ -5,7 +5,11 @@
import com.lubarov.daniel.blog.comment.CommentFormatter;
import com.lubarov.daniel.data.option.Option;
import com.lubarov.daniel.data.sequence.Sequence;
import com.lubarov.daniel.web.html.*;
import com.lubarov.daniel.web.html.AnchorBuilder;
import com.lubarov.daniel.web.html.Attribute;
import com.lubarov.daniel.web.html.Element;
import com.lubarov.daniel.web.html.HtmlUtils;
import com.lubarov.daniel.web.html.Tag;

public final class PostFormatter {
private PostFormatter() {}
Expand Down
@@ -1,6 +1,11 @@
package com.lubarov.daniel.blog.post;

import com.lubarov.daniel.data.serialization.*;
import com.lubarov.daniel.data.serialization.AbstractSerializer;
import com.lubarov.daniel.data.serialization.BooleanSerializer;
import com.lubarov.daniel.data.serialization.ByteSink;
import com.lubarov.daniel.data.serialization.ByteSource;
import com.lubarov.daniel.data.serialization.InstantSerializer;
import com.lubarov.daniel.data.serialization.StringSerializer;

public final class PostSerializer extends AbstractSerializer<Post> {
public static final PostSerializer singleton = new PostSerializer();
Expand Down
16 changes: 10 additions & 6 deletions blog/src/main/resources/resume/online.html
Expand Up @@ -37,14 +37,18 @@ <h2>Experience</h2>
<div class="right">
<div class="gutter">
<h3>Engineer at Google (2016—present)</h3>
<p>I work on the wearables team. Our projects are secret. ;-)</p>
<ul>
<li>Designed and implemented several prototypes for Google Glass.</li>
<li>Designed and implemented the real-time translation feature of Google Pixel Buds.</li>
<li>Responsible for Android emulator systems which execute millions of tests per day.</li>
</ul>

<h3>Engineer at <a href="https://squareup.com/">Square</a> (2012—present)</h3>
<ul>
<li>Developed scalable and highly-available payment services; led integrations with new card networks.</li>
<li>Worked on our Android Register application. Wrote our first instrumentation tests, and a library called <a href="https://github.com/square/burst">Burst</a> for parameterized tests. Also worked on customer-facing features like invoicing.</li>
<li>Designed and implemented an Android CI system, which runs 6000+ unit tests and 500+ instrumentation tests in parallel across many devices.</li>
<li>Designed and implemented an internal website which hosts our Android and iOS builds, and provides over-the-air installs.</li>
<li>Worked on the Android Register application. Developed its first emulator tests, and a library called <a href="https://github.com/square/burst">Burst</a> for parameterized tests. Also developed customer-facing features like invoicing.</li>
<li>Designed and implemented an Android CI system, which runs 6000+ unit tests and 500+ emulator tests in parallel across many devices.</li>
<li>Designed and implemented an internal website which hosts Square's Android and iOS builds, and provides over-the-air installs.</li>
</ul>

<h3>Engineering Intern at <a href="http://www.linkedin.com/">LinkedIn</a> (2011)</h3>
Expand Down Expand Up @@ -72,7 +76,7 @@ <h2>Skills</h2>
<div class="right">
<div class="gutter">
<h3>Languages</h3>
<p>Java, Python, Ruby, Scala, C++, Bash</p>
<p>Java, Python, Ruby, Scala, Go, C++, Bash</p>
<h3>Frontend technologies</h3>
<p>HTML/CSS, JavaScript, WebGL</p>
<h3>Misc</h3>
Expand All @@ -94,7 +98,7 @@ <h3>UIST <a href="http://www.acm.org/uist/uist2009/program/sicwinners.html">Stud
<p>1<sup>st</sup> place for Most Useful. We developed the “Heelblazer,” a foot typing system with intelligent word prediction, using a prototype pressure-sensitive keyboard from Microsoft Research.</p>
<h3><a href="http://cm.baylor.edu/">ACM ICPC</a> Programming Contest</h3>
<p>Competed in the <a href="http://www.socalcontest.org/">Southern California regional</a>. Placed 6<sup>th</sup> (2008), 13<sup>th</sup> (2009), 3<sup>rd</sup> (2010), and 8<sup>th</sup> (2011).</p>
<h3><a href="http://cm.baylor.edu/">Google Code Jam</a></h3>
<h3><a href="https://code.google.com/codejam/">Google Code Jam</a></h3>
<p>Advanced to Round 2 in 2009, 2014, 2015 and 2016.</p>
</div>
</div>
Expand Down

0 comments on commit 07237bc

Please sign in to comment.