Uses DirectWrite and D2D to render Segoe UI Emojis
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
const handleFetchResponse = (resp) => { | |
return resp.text().then((text) => { | |
let data = text; | |
const contentType = resp.headers.get("content-type"); | |
const isJSON = contentType && contentType.indexOf("application/json") >= 0; | |
if (isJSON) | |
{ | |
try { | |
data = JSON.parse(text); |
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
// | |
// TODO(nick): | |
// - fix back history being lost on page reload | |
// - add documentation for options | |
// - clean up cache and prefetch configs | |
// - add configurable top bar when fetching | |
// | |
(function() { | |
if (typeof window === 'undefined' || typeof document === 'undefined') |
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
#ifndef defer | |
// Defer macro/thing. | |
template<typename T> | |
struct ExitScope { | |
T lambda; | |
ExitScope(T lambda) : lambda(lambda) {} | |
~ExitScope() { lambda(); } | |
ExitScope(const ExitScope&); | |
private: | |
ExitScope& operator =(const ExitScope&); |
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
// Types | |
#define NULL 0 | |
typedef unsigned char u8; | |
typedef unsigned int u32; | |
typedef signed int i32; | |
typedef signed long long i64; | |
typedef double f64; | |
// Imports |
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
/* | |
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR | |
* --------------------------------------------- | |
* A utility by Viktor Chlumsky, (c) 2014 - 2023 | |
* | |
* The technique used to generate multi-channel distance fields in this code | |
* has been developed by Viktor Chlumsky in 2014 for his master's thesis, | |
* "Shape Decomposition for Multi-Channel Distance Fields". It provides improved | |
* quality of sharp corners in glyphs and other 2D shapes compared to monochrome | |
* distance fields. To reconstruct an image of the shape, apply the median of three |
If you do C programming on Windows you need cl.exe
in your PATH
.
Unfortunately, running the batch file to locate the cl.exe
compiler (vcvarsall.bat
) takes about ~5 seconds!
That's only a problem on new Command Prompt sessions, but if you use a program that kicks off a build step it's really annoying to have to run this before any of your build commands.
But, thankfully, there's a way around this. We can create a script to inflate the same environment variables that vcvarsall.bat
ultimately sets up.
As a side-effect, this is also how to have a single file to manage all of your Command Prompt environment variables in Windows.
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
// | |
// NOTE(nick): | |
// | |
// 1. Get Dawn: | |
// | |
// on Windows get a prebuilt copy of dawn from: https://github.com/mmozeiko/build-dawn | |
// | |
// on MacOS build from source with: | |
// git clone https://github.com/google/dawn | |
// cd dawn |
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
// | |
// NOTE(nick): modified version of spall.h to make it a single-file header library | |
// | |
// Usage: | |
#if 0 | |
// 1) Include this in your C source: | |
#include "spall.h" | |
// 2) Call the setup functions: | |
int main() { |
OlderNewer