Uses DirectWrite and D2D to render Segoe UI Emojis
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
int main() { | |
char *path = "/path/to/my/directory"; | |
print("watching %s for changes...\n", path); | |
HANDLE file = CreateFile(path, | |
FILE_LIST_DIRECTORY, | |
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | |
NULL, | |
OPEN_EXISTING, | |
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, |
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
// 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 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 |
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
#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 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 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 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset=utf-8> | |
<meta name="viewport" content="minimal-ui, width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="mobile-web-app-capable" content="yes"> | |
<title></title> | |
<meta name="description" content=""> |
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
<a><b><c><d><style>*{background:#09042a}body *{position:fixed;padding:30;border-radius:50%;border:10px solid #09042a;margin:14 19}a{margin:104 90;box-shadow:4em 0 #e78481}c{margin:-146 -38}b,c{background:#f5bb9c}a,d{border-color:#e78481 |
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
// Converts SQL query from named parameters :param to [param] | |
export const sqlParams = ( | |
sql: string, | |
params: Record<string, any> | |
): [string, any[]] => { | |
const matches = sql.split(/([^:]:[A-z]+[A-z0-9])/g); | |
let i = 0; | |
const nextParams: any[] = []; | |
const nextSql = matches.map((str, index) => { |
NewerOlder