This file contains 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
{ | |
"contractVersion": 1, | |
"layout": { | |
"type": "vertical_list", | |
"content": [ | |
{ | |
"type": "top_sights", | |
"title": "Top sights near Eiffel Tower", | |
"content": [ | |
{ |
This file contains 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
class ItemRepository(val backendApi: BackendApi, val cache: ItemCache) { | |
fun getOrderedItemIds(pageNumber: Int) = backendApi.getItemIds(pageNumber) | |
fun getItemsByIds(itemIds: List<ItemId>): List<Item> { | |
val cachedItems = getCachedItems(itemIds) | |
val notCachedItemIds = getItemIdsNotRepresentedInCache(itemIds) | |
val newlyRequestedItems = requestItemsById(notCachedItemIds) | |
return merge(itemIds, cachedItems, newlyRequestedItems) | |
} |
This file contains 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
inputStream.groupBy(Event::getItemId) | |
.subscribe(substream -> | |
substream.onBackpressureLatest() | |
.subscribe(new Subscriber<Event>() { | |
public void onNext(Event event) { | |
if (shouldSkipEvent(event)) { | |
outputStream.onNext(Response.createSkippedResponse()); | |
request(1); | |
} else { | |
saveLastLaunchedEvent(event); |
This file contains 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
import sys, os, shutil | |
def generateClass(directory, classNumber, methodsPerClass, mainPackage): | |
className = "Foo" + str(classNumber) | |
filePath = os.path.join(directory, className + ".java") | |
with open(filePath,"w+") as f: | |
f.write("package " + mainPackage + "." + directory + ";\n") | |
f.write("public class " + className + " {\n") | |
for i in xrange(0, methodsPerClass): | |
f.write("public void foo" + str(i) + "(){\n") |