Skip to content

Instantly share code, notes, and snippets.

View naikrovek's full-sized avatar

Jeremiah Johnson naikrovek

View GitHub Profile
template <class _Ty>
_NODISCARD /* constexpr */ _Ty _Common_lerp(const _Ty _ArgA, const _Ty _ArgB, const _Ty _ArgT) noexcept {
// on a line intersecting {(0.0, _ArgA), (1.0, _ArgB)}, return the Y value for X == _ArgT
const int _Finite_mask = (int{isfinite(_ArgA)} << 2) | (int{isfinite(_ArgB)} << 1) | int{isfinite(_ArgT)};
if (_Finite_mask == 0b111) {
// 99% case, put it first; this block comes from P0811R3
if ((_ArgA <= 0 && _ArgB >= 0) || (_ArgA >= 0 && _ArgB <= 0)) {
// exact, monotonic, bounded, determinate, and (for _ArgA == _ArgB == 0) consistent:
return _ArgT * _ArgB + (1 - _ArgT) * _ArgA;
@phil-blain
phil-blain / .gitattributes
Last active June 25, 2025 07:05
Git pickaxe : show only relevant hunks (filter displayed hunks using the given search string)
*.md diff=markdown

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@MPThLee
MPThLee / enableDiscordExperiments.js
Last active July 27, 2025 01:25
This code doesn't work anymore. I just decided to remove this code. You can check working code on comments.
/**
* !!!! This code doesn't work anymore !!!!
*
* - You can check working code on comments. I won't update this code anymore.
*
* Also, I just decided to remove this code. You can check revisions for old code.
* Since this code was made for discord client that almost 5 years ago, It seems like doesn't work anymore.
* I don't want people keep arguing in the comments, i decided to remove this code.
*
* Note: This code is now fulfilled with Javascript comments. This code won't work even if you pasted to console. doesn't do anything.
@beesandbombs
beesandbombs / hexesTris.pde
Created November 5, 2018 21:28
hexes / tris
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active August 2, 2025 16:35
set -e, -u, -o, -x pipefail explanation
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@kennygoff
kennygoff / pair-programming-bunny.js
Last active May 3, 2018 22:46
Bunny with sign ascii art meme with "this is your spot" for sharing code tasks with developers
//
// | ̄ ̄ ̄ ̄ ̄ ̄|
// | this is |
// | your |
// | spot |
// |__________|
// (\__/) ||
// (•ㅅ•) ||
// / づ
//
@keijiro
keijiro / 00_FlipCheck.shader.md
Last active July 5, 2018 11:02
A Unity shader that detects flipped polygons.

screenshot

@beesandbombs
beesandbombs / swingers.pde
Created November 27, 2017 23:54
swingers
// swingers, by davey
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {