std::set phoenix;
phoenix.key_comp();
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
/** | |
* Given "0-360" returns the nearest cardinal direction "N/NE/E/SE/S/SW/W/NW" | |
*/ | |
export function getCardinal(angle) { | |
/** | |
* Customize by changing the number of directions you have | |
* We have 8 | |
*/ | |
const degreePerDirection = 360 / 8; |
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
namespace ILExaminer | |
{ | |
using System; | |
static class Program | |
{ | |
internal static Func<T> AsFunc<T>(this T value) | |
where T : class | |
{ | |
return new Func<T>(value.Return); |
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
--- | |
AWSTemplateFormatVersion: "2010-09-09" | |
Description: Creates a stack containing an IAM role used to grant | |
Datadog monitoring access to AWS infrastructures. See | |
http://docs.datadoghq.com/integrations/aws/#installation for | |
details. | |
Parameters: | |
DatadogAwsAccountId: |
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
/** | |
* Rotates coordinate system for velocities | |
* | |
* Takes velocities and alters them as if the coordinate system they're on was rotated | |
* | |
* @param Object | velocity | The velocity of an individual particle | |
* @param Float | angle | The angle of collision between two objects in radians | |
* @return Object | The altered x and y velocities after the coordinate system has been rotated | |
*/ |
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
exports.handler = (event, context, callback) => { | |
const response = { | |
statusCode: 301, | |
headers: { | |
Location: 'https://google.com', | |
} | |
}; | |
return callback(null, response); | |
} |
A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.
Syntax emits zero JavaScript.
type RESULT = VM<
[
["push", N_1], // 1
["push", False], // 2
["peek", _], // 3
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
export class AwaitLocker { | |
private static lockerCallbacks: {[key: string]: {callback?: () => void}[]} = {}; | |
static async startLock(key: string) { | |
if (!AwaitLocker.lockerCallbacks[key]) { | |
AwaitLocker.lockerCallbacks[key] = []; | |
} | |
if (AwaitLocker.lockerCallbacks[key].length > 0) { | |
let callback: () => void; | |
const promise = new Promise<void>((res) => { |