Skip to content

Instantly share code, notes, and snippets.

View benjamn's full-sized avatar

Ben Newman benjamn

  • Apollo Graph, Inc (formerly: Meteor, Facebook/Instagram, Quora, Mozilla)
  • New York City
  • 21:38 (UTC -05:00)
View GitHub Profile
@benjamn
benjamn / keybase.md
Created February 3, 2017 20:29
keybase.md

Keybase proof

I hereby claim:

  • I am benjamn on github.
  • I am benjamn (https://keybase.io/benjamn) on keybase.
  • I have a public key whose fingerprint is E9F7 DFFD 6B2E 3C56 AF3E 21D2 DCE2 8F7D 2D7A 77FF

To claim this, I am signing this object:

@benjamn
benjamn / asyncRuntime.es6.js
Last active August 29, 2015 14:22
AwaitArgument example
let runtime = {
awrap(argument) {
return new AwaitArgument(argument);
},
"async"(generatorFunction) {
let generator = generatorFunction();
let previousPromise;
function callNext(...args) {
@benjamn
benjamn / gist:b2f5fcaffe9c83fcad3d
Last active August 29, 2015 14:19
Personal Flickr Importer Privacy Policy

PRIVACY POLICY

This app is not intended for general use. In other words, it has no privacy implications, and neither makes nor needs to make an privacy guarantees. Do not use this app.

@benjamn
benjamn / your_productivity.md
Last active August 29, 2015 14:04
BrooklynJS #9 Ruminations

We've all been told that "premature optimization is the root of all evil," but isn't that almost a tautology? As soon as we label something "premature" we've already basically decided it is undesirable. Try to think of some other premature things, and then classify them as "good" or "bad." One of those categories will be empty.

Premature optimization is a bad idea for the same reason anything else is a bad idea: it is at odds with—it works actively against—what actually matters. And I'm here to remind you that what actually matters in all but the most academic or maintenance-oriented kinds of programming is your productivity. In other words, there is no such thing as premature optimization for productivity. It is never too early to optimize for productivity, because productivity is one of those rare and slippery concepts, like Rationality, that is purely good by definition.

With that value structure in mind, I think we can say it better than Don Knuth:

Early optimization for productivity trumps all o

/** @jsx React.DOM */
define([
'react',
], function(React) {
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
var TestableCSSTransitionGroup = React.createClass({
@benjamn
benjamn / erl_crash.dump
Created March 5, 2013 19:49
erl_crash.dump from running bin/kraken run
=erl_crash_dump:0.1
Tue Mar 5 11:45:48 2013
Slogan: init terminating in do_boot ()
System version: Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Compiled: Tue Mar 5 11:37:12 2013
Taints:
Atoms: 6389
=memory
total: 6322384
processes: 1516099
@benjamn
benjamn / gist:3720055
Created September 14, 2012 05:52
Today I wrote a function whose running time was quadratic in the number of characters it took me to write the function.
exports.testSlice = function(t) {
var code = arguments.callee + "",
lines = fromString(code);
lines.eachPos(function(start) {
lines.eachPos(function(end) {
check(lines.slice(start, end),
lines.bootstrapSlice(start, end));
}, start);
});
<figure id="clock" class="animate active">
<div class="face">
<img class="glare" src="/ipodnano/images/overview_clock_glare.png" alt="" width="65" height="152">
<img class="disc top" src="/ipodnano/images/overview_clock_disc_top.png" alt="" width="14" height="14">
<img class="disc bottom" src="/ipodnano/images/overview_clock_disc_bottom.png" alt="" width="14" height="14">
<span class="date">3</span>
<span class="hour" style="-webkit-transform-origin-x: 50%; -webkit-transform-origin-y: 100%; -webkit-transform: rotate(310.38495000000006deg); "></span>
<span class="minute" style="-webkit-transform-origin-x: 50%; -webkit-transform-origin-y: 100%; -webkit-transform: rotate(124.61940000000004deg); "></span>
<span class="second" style="-webkit-transform-origin-x: 50%; -webkit-transform-origin-y: 100%; -webkit-transform: rotate(637.1640000000189deg) translate3d(0px, 21px, 0px); "></span>
</div>
class HarnessController(a.BaseController):
def editor(self):
return a.page.InternalPage(a.app.view.harness.HarnessEditorComponent(),
title='Test Harness Editor', clean=True).render()
diff --git a/quora/src/main/scala/com/quora/web/app/view/question/question.scala b/quora/src/main/scala/com/quora/web/app/view/question/question.scala
index 330bdb1..47efa80 100644
--- a/quora/src/main/scala/com/quora/web/app/view/question/question.scala
+++ b/quora/src/main/scala/com/quora/web/app/view/question/question.scala
@@ -2239,29 +2239,30 @@ class QuestionMain(qid: Long, redirectedQid: Option[Long] = None)
z += new QuestionWikiPageLink(qid)
needsBullet = true
}
if (m.Permissions.canDoOnQid(viewer, "on_questions", qid)) {