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 ApiBase { | |
const _configurationService; | |
constructor(configurationService) { | |
this._configurationService = configurationService; | |
} | |
callApi(action: (baseUrl: String) => TResult) : Promise<TResult> { | |
return new Promise<TResult>((succeeded, failed) => { | |
this._configurationService.getConfig("Foo") |
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
akka { | |
loggers = [ | |
"akka.event.slf4j.Slf4jLogger" | |
] | |
loglevel = warning | |
actor { | |
provider = "akka.cluster.ClusterActorRefProvider" | |
} | |
log-dead-letters = 5 | |
log-dead-letters-during-shutdown = off |
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
defmodule Guess do | |
@moduledoc """ | |
Number guessing game module. | |
""" | |
@doc """ | |
Guess the supplied `secret` by recursively bisecting the specified number `range`. | |
""" | |
def guess(secret, range = lo..hi) when lo <= hi do | |
_guess(_mid(range), secret, range) |
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
/// <summary> | |
/// Extension methods for Akka's <see cref="IDecider">decider</see>s. | |
/// </summary> | |
public static class DeciderChaining | |
{ | |
/// <summary> | |
/// Create a new <see cref="LocalOnlyDecider"/> that first calls the <paramref name="decider"/>, but then calls <paramref name="escalateToDecider"/> if the original <paramref name="decider"/> returns <see cref="Directive.Escalate"/>. | |
/// </summary> | |
/// <param name="decider"> | |
/// The original <see cref="IDecider"/>. |
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
// A basic prototypal inheritance chain (ignores constructor chaining) | |
// If you ask for property 'a' on an object created from function 'C', it will check if the object has a property 'a'. | |
// If not, it will check if C's prototype (an instance of B) has a property 'a'. | |
// If not, it will check if B's prototype (an instance of A) has a property 'a' (which it will). | |
function A() { } | |
A.prototype.a = 'A' | |
function B(a, b) { } | |
B.prototype = new A(); |
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 strict"; | |
import * as Promise from "bluebird"; | |
import { ReadLine, createInterface } from "readline"; | |
const readLine = createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false | |
}); |
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 ( | |
"fmt" | |
"github.com/masterzen/winrm" | |
"io" | |
"net/http" | |
"os" | |
"time" |
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
resource "template_file" "vm-winrm-bootstrap-public" { | |
template = <<TMPLT | |
{ | |
"foo": "bar", | |
"baz": 3 | |
"tpl": "${greeting}, World" | |
}, | |
TMPLT | |
vars { |
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
{ | |
"$schema": "http://json-schema.org/schema#", | |
"title": "Polls API messsages", | |
"oneOf": [ | |
{ "$ref": "#/definitions/PollCreated" }, | |
{ "$ref": "#/definitions/PollUpdated" }, | |
{ "$ref": "#/definitions/QuestionCreated" }, | |
{ "$ref": "#/definitions/QuestionUpdated" }, | |
{ "$ref": "#/definitions/ChoiceCreated" }, | |
{ "$ref": "#/definitions/ChoiceUpdated" } |
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
#!/usr/bin/env python3 | |
import datetime | |
import logging | |
import requests | |
# Well-known keyword arguments used by the logging system. | |
_well_known_logger_kwargs = [ | |
"extra", | |
"exc_info", |
OlderNewer