Skip to content

Instantly share code, notes, and snippets.

@rationalthinker1
rationalthinker1 / MightyCall.ts
Created February 15, 2023 04:43
MightyCall.ts Rewritten
const MIGHTYCALL_API_URL = 'https://api.mightycall.com/v4/webphone';
const MIGHTYCALL_CORE_URL = 'https://api.mightycall.com/v4/webphone/JavaScriptSDK/mightycall.webphone.core.js';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare let MightyCallWebPhoneCore: any;
const MIGHTYCALL_EVENT = 'mightycall_event';
const MIGHTYCALL_WEBPHONE_STATUS = 'mightycall_webphone_status';
enum CallStatus {
@rationalthinker1
rationalthinker1 / Example.js
Last active April 12, 2020 23:35
React Hook for Google Address Autocomplete
import React, { useRef } from 'react';
import useAutoCompleteAddress from '../_generic/useAutoCompleteAddress';
const Example = () => {
const ref = useRef();
const { addressComponents } = useAutoCompleteAddress(ref);
return (
<>
<input type="text" ref={ref} />
@rationalthinker1
rationalthinker1 / CSVReader.ts
Last active April 30, 2019 13:08
CSVReader for Typescript
import * as csv from 'fast-csv';
import * as fs from 'fs';
interface Row {
[s: string]: string;
}
type RowCallBack = (data: Row, index: number) => object;
export class CSVReader {
protected file: string;
protected csvOptions = {
delimiter: ',',
@rationalthinker1
rationalthinker1 / prototypes.ts
Created October 4, 2017 15:54
Prototypes for Node and NodeList
interface NodeList {first(): Node;}
if (!NodeList.prototype.first) {
NodeList.prototype.first = function (): Node {
if (this.length === 0) {
return null;
}
return this[ 0 ];
};
}