This file contains hidden or 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
| /* | |
| * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | |
| * This product includes software developed at Datadog (https://www.datadoghq.com/). | |
| * Copyright 2019-2020 Datadog, Inc. | |
| */ | |
| import Foundation | |
| public extension URLSession { | |
| internal typealias RequestInterceptor = HookedSession.RequestInterceptor |
This file contains hidden or 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
| # This is a very simple Python 2.7 implementation of the Information Set Monte Carlo Tree Search algorithm. | |
| # The function ISMCTS(rootstate, itermax, verbose = False) is towards the bottom of the code. | |
| # It aims to have the clearest and simplest possible code, and for the sake of clarity, the code | |
| # is orders of magnitude less efficient than it could be made, particularly by using a | |
| # state.GetRandomMove() or state.DoRandomRollout() function. | |
| # | |
| # An example GameState classes for Knockout Whist is included to give some idea of how you | |
| # can write your own GameState to use ISMCTS in your hidden information game. | |
| # | |
| # Written by Peter Cowling, Edward Powley, Daniel Whitehouse (University of York, UK) September 2012 - August 2013. |
This file contains hidden or 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
| // branchless binary search | |
| // https://news.ycombinator.com/item?id=37086796 | |
| func binarySearch<T: Comparable>(_ value: T, in values: UnsafePointer<T>, length: Int) -> Int { | |
| let values = Int(bitPattern: values) | |
| var first = values | |
| var length = length | |
| while length != 0 { | |
| let half = length &>> 1 | |
| if UnsafePointer<T>(bitPattern: first).unsafelyUnwrapped[half] < value { |
This file contains hidden or 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 SwiftUI | |
| class AppDelegate: NSObject, NSApplicationDelegate { } | |
| @main | |
| struct CustomApp: App { | |
| @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate | |
| var body: some Scene { | |
| WindowGroup { |
This file contains hidden or 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
| # https://github.com/uBlockOrigin/uAssets/pull/3517 | |
| twitch-videoad.js application/javascript | |
| (function() { | |
| if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; } | |
| var realFetch = window.fetch; | |
| window.fetch = function(input, init) { | |
| if ( arguments.length >= 2 && typeof input === 'string' && input.includes('/access_token') ) { | |
| var url = new URL(arguments[0]); | |
| url.searchParams.forEach(function(value, key) { | |
| url.searchParams.delete(key); |
This file contains hidden or 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
| (function() { | |
| console.log("Creating compressor"); | |
| let context = new AudioContext(); | |
| let compressor = context.createDynamicsCompressor(); | |
| compressor.threshold.value = -50; | |
| compressor.knee.value = 40; | |
| compressor.ratio.value = 12; |
This file contains hidden or 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 UIKit based Playground for presenting user interface | |
| import UIKit | |
| import PlaygroundSupport | |
| class MyViewController : UIViewController { | |
| override func loadView() { | |
| let view = UIView() | |
| view.backgroundColor = .white | |
| self.view = view |
This file contains hidden or 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
| let textStorage = NSTextStorage() | |
| let layoutManager = NSLayoutManager() | |
| let textContainer = NSTextContainer(size: bounds.size) | |
| layoutManager.addTextContainer(textContainer) | |
| textStorage.addLayoutManager(layoutManager) | |
| let textView = UITextView(frame: bounds, textContainer: textContainer) |
This file contains hidden or 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 CustomUrlProtocol: URLProtocol { | |
| static var requestCount = 0 | |
| open override class func canInit(with request: URLRequest) -> Bool { | |
| guard let url = request.url else { return false } | |
| requestCount = requestCount + 1 | |
| print("NSURLREQUEST: \(request)") | |
NewerOlder