Skip to content

Instantly share code, notes, and snippets.

philangist / index_user_video.go
Created May 17, 2018 06:46
non-blocking version of IndexUserVideo
func (service *IndexService) IndexUserVideo(userID, videoID string) error {
var indexRequest IndexRequest
var err error
done := make(chan bool)
u := make(chan *UserResponse)
v := make(chan *VideoResponse)
e := make(chan error)
go func(){
Once finished writing the code you must answer the following questions and include them in your documentation:
Was the question/problem clear? Did you feel like something was missing or not explained correctly?
- The problem was well defined, but a few details were left out. The request is to "create a piece of software that collects data from two services and indexes that data through a third service as quickly and efficiently as possible", but a little more context would've been helpful. What does the typical load for our system look like (in other words, what value should i pass in for the -c flag to the `./challenge-linux input -c <LOAD>` command?). I'd also argue that the wording "as quickly and efficiently as possible" is ill-defined, and specific metrics around what success would look like might have been better. For example: We expect the service to index 95% of all incoming requests in under 5 seconds, to have a memory profile that fits this certain use case, etc.
There were also some imp
package main
import (
func write(input chan int) {
for i := 0; i < 4; i++ {
fmt.Printf("sending i: %d to input channel\n", i)
input <- i
type CSVParser struct {
scanner *bufio.Scanner
Validator func([]string) bool
Output chan []string
func ReaderCSVParser(reader io.Reader) *CSVParser {
return &CSVParser{
philangist / user_test.go
Created May 15, 2018 01:54
simple test scenario using net/http/httptest
type getUserTestCase struct {
Tag string
ID string
Expected *UserResponse
func DummyHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")

Asset Picker API


  • Introduction
  • Projects
  • Assets
  • Running a local copy
  • Improvements


Input: {5, 20, 3, 2, 50, 80}, n = 78
Output: Pair Found: (2, 80)
Input: {90, 70, 20, 80, 50}, n = 45
Output: No Such Pair
def find_diff(arr, n):
Objects are not valid as a React child (found: object with keys {currency_code, value}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of `Text`.
POST /target HTTP/1.1
Host: localhost:5000
Cache-Control: no-cache
Postman-Token: b813fe82-040a-4a44-c19a-54e3d8b5a4a1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="target_inet"; filename=""