Skip to content

Instantly share code, notes, and snippets.

🌦️
Working from home

Ben Newman benjamn

🌦️
Working from home
Block or report user

Report or block benjamn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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 Aug 29, 2015
AwaitArgument example
View asyncRuntime.es6.js
let runtime = {
awrap(argument) {
return new AwaitArgument(argument);
},
"async"(generatorFunction) {
let generator = generatorFunction();
let previousPromise;
function callNext(...args) {
@benjamn
benjamn / gist:b2f5fcaffe9c83fcad3d
Last active Aug 29, 2015
Personal Flickr Importer Privacy Policy
View gist:b2f5fcaffe9c83fcad3d

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 Aug 29, 2015
BrooklynJS #9 Ruminations
View your_productivity.md

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

View testable.js
/** @jsx React.DOM */
define([
'react',
], function(React) {
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
var TestableCSSTransitionGroup = React.createClass({
@benjamn
benjamn / erl_crash.dump
Created Mar 5, 2013
erl_crash.dump from running bin/kraken run
View erl_crash.dump
=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 Sep 14, 2012
Today I wrote a function whose running time was quadratic in the number of characters it took me to write the function.
View gist:3720055
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);
});
View gist:2293846
<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>
View gist:1764799
class HarnessController(a.BaseController):
def editor(self):
return a.page.InternalPage(a.app.view.harness.HarnessEditorComponent(),
title='Test Harness Editor', clean=True).render()
View gist:1285143
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)) {
You can’t perform that action at this time.