- Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
- pathname - The "file/directory" portion of the URL, like
invoices/123
- search - The stuff after
?
in a URL like/assignments?showGrades=1
. - query - A parsed version of search, usually an object but not a standard browser feature.
- hash - The
#
portion of the URL. This is not available to servers inrequest.url
so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things. - state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
- pathname - The "file/directory" portion of the URL, like
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
// pako finally worked (browser, Teams desktop client, Teams Android client); I tried/checked a lot of libraries but they either produced wrong results, did not compress good or were old or without good docs: shorter, shoco, lzma-js, lzutf8 (did not work in Teams Android client), lz-string | |
const pako = require('pako'); | |
const {Base64} = require('js-base64'); | |
let stringToCompress = 'test'; | |
let compressedStringBytes = pako.deflate(stringToCompress); | |
let compressedStringBytesBase64 = Base64.fromUint8Array(compressedStringBytes, true); | |
// send via query parameter | |
// ----------------------------- |
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
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); |
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
import httpx | |
from starlette.requests import Request | |
from starlette.responses import StreamingResponse | |
class Proxy: | |
def __init__(self, hostname): | |
self.hostname = hostname | |
self.client = httpx.AsyncClient() |
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
" .vimrc | |
" Enable persistent undo | |
set undofile | |
" Use a temporary directory to store undo files | |
set undodir=~/.tmp |
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
import React, { Component, useCallback, useState, useRef } from "react"; | |
import "./App.css"; | |
const imgUrl = require("./assets/iPhone-XS-Portrait-Space-Gray.png"); | |
const fullSize = { | |
width: 1325, | |
height: 2616 | |
}; |
import Data.Functor.Yoneda
import Data.Char
import Data.Kind
infixr 5
·
type List :: (Type -> Type) -> Constraint
class List f where
This is the first post of a series about Algebraic Effects and Handlers.
There are 2 ways to approach this topic:
- Denotational: explain Algebraic Effects in terms of their meaning in mathematics/Category theory
- Operational: explain the mechanic of Algebraic Effects by showing how they operate under a chosen runtime environment
Both approaches are valuables and give different insights on the topic. However, not everyone (including me), has the prerequisites to grasp the concepts of Category theory and Abstract Algebra. On the other hand, the operational approach is accessible to a much wider audience of programmers even if it doesn't provide the full picture.
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
// hide HMR and GET | |
/^((?!HMR|GET).)*$/ | |
// Hide Warnings | |
/^((?!warning).)*$/ | |
// Hide all | |
/^((?!warning|HMR|GET).)*$/ | |
// wrap regex in / / if using Canary |
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
#!/usr/bin/osascript | |
-- Copyright © 2016, Mahmood Shafeie Zargar all rights reserved | |
-- This program is released under the terms of MIT License | |
-- Sort routine from http://www.macosxautomation.com/applescript/sbrt/sbrt-05.html | |
on run argv | |
try | |
set argument to item 1 of argv | |
on error |
NewerOlder