This is an unofficial manual for the couchdb Python module I wish I had had.
pip install couchdb
| import { writable } from 'svelte/store' | |
| // returns a store with HTTP access functions for get, post, patch, delete | |
| // anytime an HTTP request is made, the store is updated and all subscribers are notified. | |
| export default function(initial) { | |
| // create the underlying store | |
| const store = writable(initial) | |
| // define a request function that will do `fetch` and update store when request finishes | |
| store.request = async (method, url, params=null) => { |
| mkdir ~/.pip | |
| cat <<EOF > ~/.pip/pip.conf | |
| [global] | |
| trusted-host = mirrors.aliyun.com | |
| index-url = http://mirrors.aliyun.com/pypi/simple | |
| EOF |
| var IMAGE_MIME_REGEX = /^image\/(p?jpeg|gif|png)$/i; | |
| var loadImage = function (file) { | |
| var reader = new FileReader(); | |
| reader.onload = function(e){ | |
| var img = document.createElement('img'); | |
| img.src = e.target.result; | |
| var range = window.getSelection().getRangeAt(0); | |
| range.deleteContents(); |
| import { v4 as uuid } from 'uuid'; | |
| export function generateId() { | |
| return uuid(); | |
| } | |
| const v4 = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i); | |
| console.log(generateId().match(v4)); | |
| //console.log(generateId().length) |
This is an unofficial manual for the couchdb Python module I wish I had had.
pip install couchdb