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> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.6.0/rxjs.umd.js"></script> | |
</head> | |
<body> | |
<input id="name" /> | |
<div id="gender">Gender: null</div> |
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 app = new App({ | |
socketMode: true, | |
token: String(process.env.SLACK_BOT_TOKEN), | |
appToken: String(process.env.SLACK_APP_TOKEN), | |
signingSecret: String(process.env.SLACK_SIGNING_SECRET), | |
}); | |
;(async () => { | |
// Start your app | |
app.start().catch((error) => { |
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
use std::fmt; | |
struct Position { | |
longitude: f32, | |
latitude: f32, | |
} | |
impl fmt::Display for Position { | |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
write!(f, "({}, {})", self.longitude, self.latitude) |
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
{ | |
"configurations": [ | |
{ | |
"name": "Launch Frontend", | |
"request": "launch", | |
"runtimeArgs": [ | |
"run-script", | |
"dev" | |
], | |
"runtimeExecutable": "npm", |
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
// nginx.conf | |
events { } | |
http { | |
include mime.types; | |
include /etc/nginx/conf.d/*; | |
} | |
// default.conf | |
// See $PORT is taken from container run envs |
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 extractParams = (after: string) => { | |
if (!after.startsWith('(')) { | |
return [after, {}]; | |
} | |
const paramsEnd = after.indexOf(')'); | |
return [ | |
after.slice(paramsEnd + 1), | |
Object.fromEntries( |
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
import React from 'react'; | |
import styled, { css } from 'styled-components'; | |
type PropsOf<T> = T extends React.FC<infer P> ? P : never; | |
export type BaseProps = { | |
p?: string; | |
pt?: string; | |
pl?: string; | |
pr?: string; |
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
// tsconfig | |
{ | |
"compilerOptions": { | |
"esModuleInterop": true, | |
"allowSyntheticDefaultImports": true, | |
"baseUrl": "./src", | |
"outDir": "./dist", | |
"sourceMap": true, | |
"declaration": false, |
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 observable = (predicate) => (listener) => predicate(listener); | |
const pipe = (obs) => (...operators) => operators.reduce((acc, op) => op(acc), obs); | |
const map = (mapper) => (obs) => observable((resolve) => obs((data) => resolve(mapper(data)))); | |
const mergeMap = (mapper) => (obs) => observable((resolve) => obs((data) => mapper(data)(resolve))) | |
const filter = (predicate) => (obs) => observable((resolve) => obs((data) => predicate(data) && resolve(data))); | |
// { |
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
export type Image = HTMLImageElement; | |
const loadImage = async (url: string) => new Promise<Image>((resolve, reject) => { | |
const img = new Image(); | |
img.onload = () => resolve(img); | |
img.onerror = (e) => reject(e); | |
img.src = url; | |
}); |
OlderNewer