- 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.urlso 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
| export type Token = string | Symbol | |
| export enum DependencyContainerErrors { | |
| NoDependencyWithToken = 'NoDependencyWithToken' | |
| } | |
| export class DependencyContainer { | |
| private _dependencies: Map<Token, any> = new Map() | |
| public provide(token: Token, dependency: any): void { |
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 * as React from "react" | |
| import { useState, useEffect } from "react" | |
| // Hook | |
| let cachedScripts = [] | |
| export function useScript(src) { | |
| // Keeping track of script loaded and error state | |
| const [state, setState] = useState({ | |
| loaded: false, |
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
| // create context with no upfront defaultValue | |
| // without having to do undefined check all the time | |
| function createCtx<A>() { | |
| const ctx = React.createContext<A | undefined>(undefined) | |
| function useCtx() { | |
| const c = React.useContext(ctx) | |
| if (!c) throw new Error("useCtx must be inside a Provider with a value") | |
| return c | |
| } | |
| return [useCtx, ctx.Provider] as const |
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
| { | |
| "parser": "@typescript-eslint/parser", | |
| "parserOptions": { | |
| "project": "./tsconfig.json", | |
| "tsconfigRootDir": "." | |
| }, | |
| "env": { | |
| "browser": true, | |
| "jest/globals": true | |
| }, |
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 createCloudinary = (cloudName, unsignedUploadPreset) => ({ | |
| process: (fieldName, file, metadata, load, error, progress, abort) => { | |
| // `fieldName` and `meta` are not used for now | |
| const url = `https://api.cloudinary.com/v1_1/${cloudName}/upload`; | |
| const xhr = new XMLHttpRequest(); | |
| const formData = new FormData(); |
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
| [Settings] | |
| ID = "Your_Site_ID" | |
| # Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts. | |
| [build] | |
| # This is the directory to change to before starting a build. | |
| base = "project/" | |
| # NOTE: This is where we will look for package.json/.nvmrc/etc, not root. | |
| # This is the directory that you are publishing from (relative to root of your repo) |
- http://stackoverflow.com/questions/804115 (
rebasevsmerge). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebasevsmerge) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
resetvscheckoutvsrevert) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse) - http://stackoverflow.com/questions/292357 (
pullvsfetch) - http://stackoverflow.com/questions/39651 (
stashvsbranch) - http://stackoverflow.com/questions/8358035 (
resetvscheckoutvsrevert)
Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.
[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
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
| // source: http://stackoverflow.com/a/11058858 | |
| function ab2str(buf) { | |
| return String.fromCharCode.apply(null, new Uint16Array(buf)); | |
| } |
NewerOlder