Skip to content

Instantly share code, notes, and snippets.

View brikis98's full-sized avatar

Yevgeniy Brikman brikis98

View GitHub Profile
@brikis98
brikis98 / CacheFilter.scala
Last active August 4, 2017 22:22
An outline of how to de-dupe remote service calls in Play.
// Put this filter early in your filter chain so it can initialize and clean up
// the cache
object CacheFilter extends Filter {
def apply(next: RequestHeader => Future[Result])(request: RequestHeader): Future[Result] = {
def init = RestClient.initCacheForRequest(request)
def cleanup = RestClient.cleanupCacheForRequest(request)
// You have to be very careful with error handling to garauntee the cache gets cleaned
// up, or you'll have a memory leak.
At this very moment, somewhere in the world, two programmers are sitting in a garage and creating our future, one line of code at a time. We are in the era of the high tech startup.
This book is the "Hello, World" tutorial for building products, technology, and teams in a startup environment. It's based on the experiences of the author, Yevgeniy Brikman, as well as interviews with programmers from some of the most successful startups of the last decade, including Google, Facebook, LinkedIn, Twitter, GitHub, Stripe, Instagram, AdMob, Pinterest, and many others.
If you're at all interested in startups—whether you're a programmer at the beginning of your career, a seasoned developer bored with the politics of large companies, a manager trying to figure out how to motivate your engineers, or just someone trying to figure out what this startup thing is all about—this book is for you.
Hello there! I'm Yevgeniy (Jim) Brikman. I'm a programmer, writer, speaker, and traveler. You can find me on Twitter (@brikis98), LinkedIn (linkedin.com/in/jbrikman), Blogger (http://brikis98.blogspot.com), and my Homepage (ybrikman.com).
I got my BS and Masters in Computer Science at Cornell Unitversity, started my career at several big companies (Cisco Systems, Thomson Financial), and then made the jump into the startup world (LinkedIn, TripAdvisor). Along the way, I got the chance to work on enterprise products, hiring tools, scalable infrastructure, company culture, engineering branding, travel apps, VoIP software, innovation programs, and much more.
I wish I had a book like "Hello, Startup" back when I was in college. By the time I graduated, I had a BS, a Masters, a bunch of internship experiences—and absolutely no idea what I was doing. What technologies should I learn and use? Why should I spend time writing automated tests? How do I build a user interface that doesn't look terrible? How do I get pe
@brikis98
brikis98 / gist:62f62ba8c0970b5b2c01
Last active August 29, 2015 14:14
AsciiDoc showing too much vertical space in lists within quote blocks
Once you go from storing data on a single server to multiple servers,
you are dealing with a _distributed system_. All distributed
systems are subject to the CAP theorem, which states the following:
[quote, '[<<cap-theorem-2014,CAP Theorem 2014>>]']
____
It is impossible for a distributed computer system to simultaneously
provide all three of the following guarantees:
. Consistency (all nodes see the same data at the same time)
@brikis98
brikis98 / gist:1714d37c4547a839e2dd
Last active August 29, 2015 14:14
AsciiDoc for a quote block with an attribution and cite title
[quote, '[<<collins-porras-2004,Collins Porras 2004>>]', 'Jim Collins and Jerry I. Porras, _Built to Last_']
____
If you woke up tomorrow morning with enough money in the bank that you would
never need to work again, how could we frame the purpose of this organization
such that you would want to continue working anyway? What deeper sense of
purpose would motivate you to continue to dedicate your precious creative
energies to this company's efforts?
____
main()
{
printf("Hello, Startup");
}
@brikis98
brikis98 / classic-comment
Created May 3, 2014 08:23
One of the best comments from the StackOverflow discussion "What is the best comment in source code you have ever encountered?" http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
//
/**
* Returns the number of key-value mappings in this map.
*
* @return the number of key-value mappings in this map
*/
public int size() {
return size;
}
def asyncResult = {
//#async-result
import play.api.libs.concurrent.Execution.Implicits.defaultContext
def index = Action.async {
val futureInt = scala.concurrent.Future { intensiveComputation() }
futureInt.map(i => Ok("Got result: " + i))
}
//#async-result
## Returning futures
While we were using the `Action.apply` builder method to build
actions until now, to send an asynchronous result we need to
use the `Action.async` builder method:
@[async-result](code/ScalaAsync.scala)