This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aiohttp | |
def request_tracer(results_collector): | |
""" | |
Provides request tracing to aiohttp client sessions. | |
:param results_collector: a dict to which the tracing results will be added. | |
:return: an aiohttp.TraceConfig object. | |
:example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// Copyright (c) 2020 Anthony N. Simon | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor License Agreement (CLA) | |
This license is for your protection as a Contributor as well as the protection of the maintainers of the Traduora software; it does not change your rights to use your own Contributions for any other purpose. In the following, the maintainers of Traduora are referred to as Traduora. | |
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Traduora. Except for the license granted herein to Traduora and recipients of software distributed by Traduora, You reserve all right, title, and interest in and to Your Contributions. | |
1. Definitions. | |
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Traduora. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, “con |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.JavaConverters._ | |
import com.fasterxml.jackson.databind.node._ | |
import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper} | |
import scala.language.implicitConversions | |
object JacksonDSL { | |
object ObjectNode { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Deferred { | |
constructor(resolver) { | |
this._result; | |
this._error; | |
this._ready = false; | |
this._callbacks = []; | |
if (resolver) { | |
resolver(this.resolve.bind(this), this.reject.bind(this)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chalk from 'chalk'; | |
import * as fs from 'fs'; | |
import * as term from 'terminal-kit'; | |
function sleep(ms: number) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
namespace BF2 { | |
type TraceId = { traceId: number }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Callback<A> = (value: A) => void; | |
class Observable<A> { | |
private subscribers: Callback<A>[] = []; | |
next(value: A): void { | |
this.subscribers.forEach(fn => fn(value)); | |
} | |
map<B>(mapper: (_: A) => B): Observable<B> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
#[derive(Hash, Eq, PartialEq, Debug)] | |
struct Item { | |
rank: u32, | |
revision: u32, | |
} | |
fn should_insert(item: &Item, acc: &HashMap<u32, Item>) -> bool { | |
match acc.get(&item.rank) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
trait Source[+A] { | |
def output(): A | |
} | |
trait Flow[A, B] extends Sink[A] with Source[B] | |
trait Sink[-A] { | |
def input(a: A): Unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"net" | |
"strings" | |
) |
NewerOlder