crypto.go
usescrypto/rand
, which returns abig.Int
.uuid.go
usesgithub.com/google/uuid
that converts to abig.Int
.
Sockets are provided by github.com/gorilla/websocket
.
9f973d2866fdd083ef30fe4fcc955fbb search query for the gist.github testing proposes that can be found at https://github.com/github/feedback/discussions/4862#discussioncomment-1104441 |
find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' |
// run with `node infinite.js` in node v4.x+ | |
// must have Inquirer installed (`npm install inquirer`) | |
const inquirer = require('inquirer'); | |
const Rx = require('rx'); | |
const prompts = new Rx.Subject(); | |
function makePrompt(msg, i) { | |
return { |
Random.new.bytes(3).unpack("H*")[0] |
import axios, { CancelToken } from 'axios'; | |
import { CANCEL } from 'redux-saga'; | |
export const fetchAutocomplete = () => { | |
const url = 'some/url'; | |
const source = CancelToken.source(); | |
const request = axios.get(url, { cancelToken: source.token }); | |
request[CANCEL] = () => source.cancel(); | |
return request; | |
}; |
import { fork, debounce } from 'redux-saga/effects'; | |
import fetch from './fetch'; | |
import { fetchSomeInfo } from './someApi'; | |
import { | |
loadSomeInfoStart, | |
loadSomeInfoSuccess, | |
loadSomeInfoError | |
} from './actions'; |
# 100% useful | |
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + |
function* getRandomNumberSeed(counter = 0, min = 0, max = 100) { | |
while (counter--) { | |
yield Math.floor(Math.random() * (max - min + 1)) + min | |
} | |
} | |
const seed = [...getRandomNumberSeed(10)]; | |
console.log(seed); |
const modules = require.context('path/to/folder', false, /\.type$/); | |
modules.keys().forEach(modules); |