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 quine() { | |
console.log("(" + quine.toString() + ")()"); | |
})() |
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
// @flow | |
import * as React from 'react'; | |
import { createContext, useContext, useState } from 'react'; | |
export const $TM_FILENAME_BASE$ = createContext(); | |
export function use$TM_FILENAME_BASE$() { | |
return useContext($TM_FILENAME_BASE$); | |
} |
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 const MIMES = [ | |
{ | |
Extension: 'doc', | |
mimeType: 'application/msword', | |
}, | |
{ | |
Extension: 'docm', | |
mimeType: 'application/vnd.ms-word.document.macroEnabled.12', | |
}, | |
{ |
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 const isValidFile = async (file: File) => { | |
const contentBuffer = await readFileAsync(file); | |
if (!(window.FileReader && window.Blob)) { | |
console.error('FileReader && Blob are not supported'); | |
} | |
let header = ''; | |
const arr = new Uint8Array(contentBuffer).subarray(0, 4); | |
for (let i = 0; i < arr.length; i += 1) { | |
header += arr[i].toString(16); |
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
// A block is stored as a tuple of [parent_hash, transactions, hash_itself] | |
const { | |
createHash, | |
} = require('crypto'); | |
// get hash of some data | |
function hash(data) { | |
return createHash('sha256').update(data).digest('hex'); | |
} |
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
/* ----------- simple-select.js ----------- */ | |
import * as React from 'react'; | |
import Select from 'react-select'; | |
import type { Props } from 'react-select'; | |
import { defaultClassNames, defaultStyles } from './helper'; | |
import { | |
ClearIndicator, | |
DropdownIndicator, | |
MultiValueRemove, | |
Option |