Skip to content

Instantly share code, notes, and snippets.

@patik
patik / file.html
Created March 23, 2016 11:29
upstate web
<!DOCTYPE html>
<html lang="en">
<head>
<script>
window.ts_endpoint_url = "https:\/\/slack.com\/beacon\/timing";
(function(e) {
var n = Date.now ? Date.now() : +new Date,
r = e.performance || {},
@patik
patik / osx-special-chars.ahk
Last active November 28, 2022 12:02 — forked from aarongustafson/osx-special-chars.ahk
AutoHotKey stuff
#UseHook
!VKC0SC029::Return ; grave -> the grave ` accent gave some probs, used the virtualkey + scancode instead
!e::Return ; acute
!i::Return ; circumflex
!t::Return ; tilde
!u::Return ; umlaut
; 1 2 3 4 5 6 7 8 9 1
; 0
; r g G a A c C t T u U
@patik
patik / format-commas.js
Last active June 22, 2021 00:25
Format number with commas
// Converts "1234567.89" => "1,234,567.89"
function formatNumberWithCommas(number) {
const parts = number.split('.')
return ('' + parts[0]) // Convert to a string
.split('').reverse().join('') // Reverse the order of the characters (which are all digits at this point)
.replace(/(...)/g, '$1,') // Insert a comma after every three digits
.split('').reverse().join('') // Un-reverse the characters
.replace(/^,/, '') // Remove any commas that were added to the beginning (i.e. if the number of digits was a multiple of three)
.concat(parts[1] ? '.' + parts[1] : '') // Re-add the decimal, if any
}
@patik
patik / styles.css
Last active March 18, 2024 10:11 — forked from joshbode/numbered_headings.md
Numbered Headings in Markdown via CSS
body { counter-reset: h1counter h2counter h3counter h4counter h5counter h6counter; }
h1 { counter-reset: h2counter; }
h2 { counter-reset: h3counter; }
h3 { counter-reset: h4counter; }
h4 { counter-reset: h5counter; }
h5 { counter-reset: h6counter; }
h6 {}
h2:before {
@patik
patik / README.md
Last active June 28, 2022 10:14
Combine multiple useInfiniteQuery results from react-query

Merge useInfiniteQuery Results

This utility allows you to make multiple requests with react-query's useInfiniteQuery hook and then combine all of them into a single result. That is, you can fetch data from multiple endpoints, but you'll only need to check one isSuccess status, call only one refetch function, etc.

Allows for sorting and de-duping data, if needed.

Example

const foo = useInfiniteQuery('/api/foo')