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
{ | |
"scripts": { | |
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min", | |
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015", | |
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm", | |
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs", | |
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js", | |
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz", | |
} | |
} |
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, { | |
useState, | |
useCallback, | |
useEffect, | |
useRef, | |
useMemo | |
} from "react"; | |
export enum KeyCodes { | |
Right = 39, |
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
enum keyCodes { | |
BACKSPACE: 8, | |
TAB: 9, | |
ENTER: 13, | |
SHIFT: 16, | |
CTRL: 17, | |
ALT: 18, | |
PAUSE: 19, | |
CAPS_LOCK: 20, | |
ESCAPE: 27, |
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 function move<T>( | |
source: Array<T>, | |
destination: Array<T>, | |
droppableSource: number, | |
droppableDestination: number | |
) { | |
const sourceClone = Array.from(source); | |
const destClone = Array.from(destination); | |
const [removed] = sourceClone.splice(droppableSource, 1); | |
destClone.splice(droppableDestination, 0, removed); |
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
/** | |
* number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. | |
* It formats a number to a string with grouped thousands, with custom seperator and custom decimal point | |
* @param {number} number - number to format | |
* @param {number} [decimals=0] - (optional) count of decimals to show | |
* @param {string} [decPoint=.] - (optional) decimal point | |
* @param {string} [thousandsSep=,] - (optional) thousands seperator | |
* @author Felix Leupold <[email protected]> | |
*/ | |
function number_format(number, decimals, decPoint, thousandsSep) { |
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
headerProps={{ | |
title: config.chatBotTitle, | |
inline: config.chatBotInline | |
}} | |
avatarProps={{ | |
avatarBot: config.botAvatar, | |
avatarUser: config.userAvatar, | |
}} | |
bubbleProps={{ | |
label: config.chatBotBubbleLabel |
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 PropTypes from 'prop-types' | |
import ReactDOM from 'react-dom' | |
import cx from 'classnames' | |
const TAB_KEY = 9 | |
const ESC_KEY = 27 | |
const FOCUSABLE_ELEMENTS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA', 'A'] | |
class ModalPortal extends React.Component { |
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
{ | |
"docs": [ | |
{ | |
"id": 1, | |
"content": "A reusable launch system (RLS, or reusable launch vehicle, RLV) is a launch system which is capable of launching a payload into space more than once. This contrasts with expendable launch systems, where each launch vehicle is launched once and then discarded. No completely reusable orbital launch system has ever been created. Two partially reusable launch systems were developed, the Space Shuttle and Falcon 9. The Space Shuttle was partially reusable: the orbiter (which included the Space Shuttle main engines and the Orbital Maneuvering System engines), and the two solid rocket boosters were reused after several months of refitting work for each launch. The external tank was discarded after each flight." | |
} | |
], | |
"query": "how long did it take to work" | |
} |
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
# This small script shows how to use AllenNLP Semantic Role Labeling (http://allennlp.org/) with SpaCy 2.0 (http://spacy.io) components and extensions | |
# Script installs allennlp default model | |
# Important: Install allennlp form source and replace the spacy requirement with spacy-nightly in the requirements.txt | |
# Developed for SpaCy 2.0.0a18 | |
from allennlp.commands import DEFAULT_MODELS | |
from allennlp.common.file_utils import cached_path | |
from allennlp.service.predictors import SemanticRoleLabelerPredictor | |
from allennlp.models.archival import load_archive |
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 threading | |
import time | |
class ThreadingExample(object): | |
""" Threading example class | |
The run() method will be started and it will run in the background | |
until the application exits. | |
""" |