(println "Hello, world!")
- The same in Python,
// zod schema | |
z.object({ | |
// valid if string or: | |
optional: z.string().optional(), // field not provided, or explicitly `undefined` | |
nullable: z.string().nullable(), // field explicitly `null` | |
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined` | |
}); | |
// type | |
{ |
// Basic Types | |
let id: number = 5 | |
let company: string = 'Traversy Media' | |
let isPublished: boolean = true | |
let x: any = 'Hello' | |
let ids: number[] = [1, 2, 3, 4, 5] | |
let arr: any[] = [1, true, 'Hello'] | |
// Tuple |
import React, { useEffect, useState } from 'react'; | |
// Set this to your public ReCAPTCHA client key | |
const RECAPTCHA_SITE_KEY = 'YOUR_KEY_HERE'; | |
// Set this to your backend URL that verifies ReCAPTCHA tokens | |
const RECAPTCHA_VERIFY_URL = 'http://www.mocky.io/v2/5e88253631000025303f4835'; | |
/** | |
* Sends a request to your server to verify the given token |
[ | |
{ | |
"code": "aa", | |
"name": "Afar", | |
"native": "Afar" | |
}, | |
{ | |
"code": "ab", | |
"name": "Abkhazian", | |
"native": "Аҧсуа" |
import React, {useCallback, useRef} from 'react' | |
function useHookWithRefCallback() { | |
const ref = useRef(null) | |
const setRef = useCallback(node => { | |
if (ref.current) { | |
// Make sure to cleanup any events/references added to the last instance | |
} | |
if (node) { |
At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.
This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create()
can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.
class MyPromise { | |
constructor(executor) { | |
if (typeof executor !== 'function') { | |
throw new Error('Executor must be a function'); | |
} | |
// Internal state. `$state` is the state of the promise, and `$chained` is | |
// an array of the functions we need to call once this promise is settled. | |
this.$state = 'PENDING'; | |
this.$chained = []; |
class MyPromise { | |
constructor(executor) { | |
if (typeof executor !== 'function') { | |
throw new Error('Executor must be a function'); | |
} | |
// Internal state. `$state` is the state of the promise, and `$chained` is | |
// an array of the functions we need to call once this promise is settled. | |
this.$state = 'PENDING'; | |
this.$chained = []; |
[ | |
{ "city": "Abbeville", "state": "Louisiana" }, | |
{ "city": "Aberdeen", "state": "Maryland" }, | |
{ "city": "Aberdeen", "state": "Mississippi" }, | |
{ "city": "Aberdeen", "state": "South Dakota" }, | |
{ "city": "Aberdeen", "state": "Washington" }, | |
{ "city": "Abilene", "state": "Texas" }, | |
{ "city": "Abilene", "state": "Kansas" }, | |
{ "city": "Abingdon", "state": "Virginia" }, | |
{ "city": "Abington", "state": "Massachusetts" }, |