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
namespace Visitor | |
type IPrescription = | |
abstract member Accept : IPrescriptionVisitor -> unit | |
and IPrescriptionVisitor = | |
abstract member Visit : PointInTime -> unit | |
abstract member Visit : Infusion -> unit | |
and PointInTime() = |
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 ClassName = () => { | |
const createdClasses = []; | |
const stringToCss = str => str.split('').map(c => c.charCodeAt(0) >= 97 | |
? c | |
: `-${String.fromCharCode(c.charCodeAt(0) + 32)}`).join(''); | |
const cssString = css => Object.keys(css).map(key => `${stringToCss(key)}:${css[key]}`).join(';'); | |
const addStyle = (name, css) => { |
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
require('colors'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
const launchAndRun = (url, opts, config = null) => | |
chromeLauncher.launch({ chromeFlags: opts.chromeFlags }) | |
.then(chrome => { | |
opts.port = chrome.port; | |
return lighthouse(url, opts, config).then(results => chrome.kill().then(() => results.lhr)); | |
}); |
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 * as React from "react"; | |
class CreateRef extends React.Component { | |
divRef = React.createRef<HTMLDivElement>(); | |
componentDidMount() { | |
if (this.divRef.current) { | |
console.log(`createRefRef div width: ${this.divRef.current.clientWidth}`); | |
} | |
} |
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 * as React from "react"; | |
class CallbackRef extends React.Component { | |
divRef: HTMLDivElement | null = null; | |
setDivRef = (element: HTMLDivElement) => { | |
this.divRef = element; | |
}; | |
componentDidMount() { |
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
function evenWord(word) { | |
let charCounts = [...word].reduce( | |
(charCount, char) => ({ | |
...charCount, | |
[char]: charCount[char] ? charCount[char] + 1 : 1, | |
}), | |
{}, | |
); | |
return Object.entries(charCounts).filter(([_, count]) => count % 2 !== 0).length; | |
} |
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 { Dropdown, Checkbox, RadioButtons, FormElement } from "@emisgroup/ui-kit-react"; | |
const testData = [ | |
{ | |
text: "Item one", | |
isChecked: false, | |
radioItem: "one", | |
}, | |
{ |
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 { Tabs, ButtonGroup, Button } from "@emisgroup/ui-kit-react"; | |
const TabComponent = () => { | |
const tabsList = [{ text: "Tab1" }, { text: "Tab2" }, { text: "Tab3" }]; | |
const [selectedTab, setSelectedTab] = React.useState(0); | |
return ( | |
<> | |
<Tabs tabsList={tabsList} activeTab={selectedTab} onTabSelect={setSelectedTab} /> |
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 * as React from "react"; | |
import { render, RenderResult } from "@testing-library/react"; | |
import fetch from "jest-fetch-mock"; | |
import { useGetAnnotation } from "./useGetAnnotation"; | |
import { act } from "react-dom/test-utils"; | |
fetch.enableMocks(); | |
const presignedUrl = "https:/a-presigned-url"; | |
const testXml = btoa("<something/>"); |
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
function longestPrefix(strings: string[]) { | |
const { 0: first, [strings.length - 1]: last } = [...strings].sort(); | |
let prefixLength = -1; | |
for (let i = 0; i < Math.min(first.length, last.length); i++) { | |
if (first[i] === last[i]) { | |
prefixLength = i; | |
} else { | |
break; | |
} | |
} |
OlderNewer