Skip to content

Instantly share code, notes, and snippets.

Sohum Banerjea SohumB

Block or report user

Report or block SohumB

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 variance.scala
import scala.reflect.runtime.universe.{TypeTag, typeOf}
trait Foo[T]
class Baz extends Foo[String]
def foo[T <: String:TypeTag]: Class[_ <: Foo[T]] = typeOf[T] match {
case t if t =:= typeOf[String] => classOf[Baz]
}
// [error] ...: type mismatch;
@SohumB
SohumB / cpu.prof
Last active Aug 29, 2015
profiles for magit-next (1b46712) opening a one-line diff in the status window
View cpu.prof
[profiler-profile "24.3" cpu #s(hash-table size 97 test equal rehash-size 1.5 rehash-threshold 0.8 data ([easy-menu-name-match easy-menu-define-key easy-menu-add-item prelude-mode-add-menu if let prelude-mode prelude-on funcall if if if save-current-buffer progn if while] 4 [maphash profiler-calltree-build-unified profiler-calltree-build profiler-report-render-calltree-1 profiler-report-rerender-calltree profiler-report-render-calltree profiler-report-setup-buffer profiler-report-profile-other-window profiler-report-cpu profiler-report "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute execute-extended-command] 4 [record-window-buffer set-window-buffer window--display-buffer display-buffer-use-some-window display-buffer pop-to-buffer switch-to-buffer-other-window profiler-report-profile-other-window profiler-report-cpu profiler-report "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute execute-extended-command] 4 [f
View gist:09c4a31ceed10f1bf55d
pageRecurse(fn, opts, page) {
var withPage = _.clone(opts);
  withPage.page = page;
  return fn(withPage).then(results => {
    return _.isEmpty(results)
             ? results
             : this.pageRecurse(fn, opts, page + 1).then(following => results.concat(following));
  });
}
View gist:d13c5f8f980a1460fd98

A Loint of Paw

There was no question that Montie Stein had, through clever fraud, stolen better than $100,000. There was also no question that he was apprehended one day after the statute of limitations had expired.

It was his manner of avoiding arrest during that interval that brought on the epoch-making case of the State of New York. Montgomery Harlow Stein, with all its consequences introduced law to the fourth dimension.

For you see after having committed the fraud and possessed himself of the hundred grand plus, Stein had calmly entered a time machine, of which he was in illegal possession, and set the controls for seven years and one day in the future.

Stein’s lawyer put it simply. Hiding in time was not fundamentally different from hiding in space. If the forces of law had not uncovered Stein in the seven-year interval that was their hard luck.

View hmm.js
var fs = require('fs');
// then
hug(null, fs.writeFileSync, 'filename', 'data')
// should return the following function:
function() {
fs.writeFileSync('filename', 'data');
View microsoft hpricot crashing html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_Head1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>
Microsoft Academic Search: A provenly correct translation of Fickle into Java
</title><link rel="stylesheet" type="text/css" href="../Style/libra3_en.css" media="screen" />
<script type="text/javascript" language="javascript">
var isSilverlightInstalled = false;
function CheckSilverlightInstalled() {
try {
You can’t perform that action at this time.