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
*.meta |
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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
/* | |
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Promises |
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
// pipe is a utility function that passes the result of previous step to the next | |
// pipe(a, b, c) === c(b(a)) | |
pipe( | |
// This function returns an array of messages for chat completion | |
getTurnPromptMessages(state, action), | |
// This turns an array into the CC request object | |
mkCCRequestFromMessages, | |
pipe( | |
// flow returns a function that combines passed functions into it | |
// flow(a, b, c) = (x) => c(b(a(x))) |
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 AgeBrand = { | |
readonly Age: unique symbol | |
} | |
const Age = t.brand( | |
t.number, // A codec representing the new type, here it's a number | |
(n): n is t.Branded<number, AgeBrand> => n >= 0, // A type guard | |
'Age' // The name of the codec | |
) |