Skip to content

Instantly share code, notes, and snippets.

{
"version": 8,
"name": "OS Outdoor",
"metadata": {
"mapbox:autocomposite": true,
"mapbox:type": "template",
"mapbox:print": {
"units": "in",
"width": 8.5,
"height": 11,
@hubgit
hubgit / index.html
Created September 5, 2018 12:38
JSON format
<!doctype html>
<meta charset="utf-8">
<title>JSON</title>
<body style="margin: 0; height: 100vh; width: 100vw; overflow: hidden; display: flex">
<textarea style="height: 100%; overflow-y: auto; flex: 1; flex-shrink: 0; padding: 1em; border: none; background: #eee; font: 400 11px system-ui" autofocus spellcheck="false" placeholder="JSON input…"></textarea>
<output style="height: 100%; overflow-y: auto; flex: 1; flex-shrink: 0; padding: 1em; white-space: pre-wrap; font: 400 11px system-ui" laceholder="JSON output…"></output>
<script>
const input = document.querySelector('textarea')
const output = document.querySelector('output')
tar c data | gzip --best > data.tar.gz
const prefixes = [
'10.9734',
'10.4172',
'10.3844',
'10.30534',
'10.5897',
'10.26420',
'10.9790',
'10.4066',
'10.11648',
@hubgit
hubgit / urlsearchparams.js
Created July 27, 2018 20:36
URLSearchParams
(() => {
// build
const params = new URLSearchParams()
params.append('q', 'bar')
params.append('n', 5)
// stringify
// const url = `https://example.com/resources?${params.toString()}`
const location = new URL('https://example.com/resources')
@hubgit
hubgit / SelectField.tsx
Last active March 31, 2025 22:59
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
export const resizeTextarea = (textarea: HTMLTextAreaElement) => {
textarea.style.height = 'auto'
window.requestAnimationFrame(() => {
textarea.style.height = textarea.scrollHeight + 'px'
})
}
@hubgit
hubgit / https.sh
Last active November 17, 2019 07:45
# https://www.digitalocean.com/community/tutorials/how-to-set-up-let-s-encrypt-with-nginx-server-blocks-on-ubuntu-16-04
# Create a DigitalOcean droplet.
# Register a domain name. If DreamHost, set it to "DNS only" _and_ click "Remove" to remove the default DNS A records.
# Add new A records for example.com and www.example.com, using the droplet's IP address as the value.
ssh root@${DROPLET_IP_ADDRESS}
add-apt-repository ppa:certbot/certbot
apt-get update
{"Hogrefe Publishing Group":36250,"Ebsco Publishing":89,"American Medical Association (AMA)":592637,"Elsevier BV":15988260,"American Psychological Association (APA)":340119,"Allen Press":0,"Revista de Enfermagem, UFPE Online":1246,"Instytut Badan Literackich PAN/The Institute of Literary Research PAS":37,"Teknik Dergi":46,"Institution of Engineering and Technology (IET)":219980,"Georg Thieme Verlag KG":738586,"New England Journal of Medicine (NEJM/MMS)":181428,"American Society of Civil Engineers (ASCE)":139789,"Online Turk Saglik Bilimleri Dergisi":14,"Pion Ltd":1287,"Turpion-Moscow Limited":35860,"CSIRO Publishing":83699,"University of Chicago Press":434825,"Association of Learned and Professional Society Publishers (ALPSP)":0,"IOP Publishing":731503,"Mary Ann Liebert Inc":149052,"American Mathematical Society (AMS)":121585,"Metapress":214,"Scientific Societies":40724,"Private Publisher Chaban O.S.":36,"Instituto Tecnologico de Santo Domingo (INTEC)":1184,"Balai Riset dan Standardisasi Industri Palembang":9
const Twit = require('twit')
module.exports = (context, done) => {
const client = new Twit({
consumer_key: context.secrets.CONSUMER_KEY,
consumer_secret: context.secrets.CONSUMER_SECRET,
app_only_auth: true,
})
client.get('search/tweets', context.query, (error, data, response) => {