Skip to content

Instantly share code, notes, and snippets.

@pauldraper
pauldraper / events.ts
Last active Mar 15, 2019
OpenTracing for Node.js http
View events.ts
import { EventEmitter } from 'events';
import { globalTracer, Span } from 'opentracing';
/**
* All events from the emitter share the same span.
*/
export function activateEventEmitter(span: Span, emitter: EventEmitter) {
const { emit } = emitter;
emitter.emit = function(this: any) {
const args = arguments;
@pauldraper
pauldraper / BiMap.scala
Created Dec 22, 2013
Scala BiMap - a bidirectional map for Scala
View BiMap.scala
import scala.collection.mutable.Map
class BiMap[A,B] extends BiMapHelper(Map[A,B](), Map[B,A]()) {
}
object BiMap {
def apply[A,B](elems:(A,B)*) = new BiMap[A,B] ++= elems
You can’t perform that action at this time.