Skip to content

Instantly share code, notes, and snippets.

@antoniusostermann
antoniusostermann / configuration_object_example.ts
Created January 24, 2018 14:38
An example of how to do configuration with typescript objects. Module developers have the possbility to define default values (which means they are optional for module users) and required values while module clients get only one simple interface to fulfill.
/** Users of your module possibly never need interfaces in this namespace. But you will. */
export namespace Configuration {
/** Configuration defaults -> all of these keys are optional for users of your module. */
export interface Defaults {
/** If set to true, my module will always fail. Default = false */
alwaysFail: boolean;
}
/** Required configuration options, no defaults are used here */
@antoniusostermann
antoniusostermann / net_ntlm_monkeypatch.rb
Created January 12, 2015 18:08
A monkey patch to solve the problem described in https://github.com/savonrb/httpi/issues/139. This monkey patch prioritizes ntlm over negotiate and makes it possible to use the httpi gem if server supports both / sends header including both arguments.
# A monkey patch concerning this issue: https://github.com/savonrb/httpi/issues/139
# Basically, this monkey patch priors NTLM over Negotiate and not vice-versa
# All monkey patched spots are marked with "## MONKEY PATCHED"
# All in all, there are 2 monkey patched spots, both in private method "negotiate_ntlm_auth"
# Compare it with: https://github.com/savonrb/httpi/blob/d6a3825a8e896f794e54b634c39521e6956f72ff/lib/httpi/adapter/net_http.rb
require "uri"
require "httpi/adapter/base"
require "httpi/response"