An adaptable, human-friendly, web-safe, unique ID spec for modern applications.
- Short
- Human friendly
- URL-safe
- Developer experience
| do you? really? |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> | |
| (function () { |
| 'body': | |
| 'cmd-shift-down': 'window:focus-next-pane' | |
| 'cmd-shift-up': 'window:focus-previous-pane' | |
| 'cmd-ctrl-right': 'window:focus-next-pane' | |
| 'cmd-ctrl-left': 'window:focus-previous-pane' | |
| '.platform-darwin': | |
| 'shift-cmd-alt-right': 'move-panes:move-next' | |
| 'shift-cmd-alt-left': 'move-panes:move-previous' | |
| 'shift-cmd-S': 'project-find:show' | |
| 'cmd-shift-o': 'fuzzy-finder:toggle-file-finder' |
| // export the default export of a legacy (`export =`) module | |
| export import MessageBase = require('./message-base'); | |
| // export the default export of a modern (`export default`) module | |
| export { default as MessageBase } from './message-base'; | |
| // export an interface from a legacy module | |
| import Types = require('./message-types'); | |
| export type IMessage = Types.IMessage; |
| export const getVideoDuration = async (file) => | |
| new Promise((resolve, reject) => { | |
| const mediaType = file.type.split("/")[0]; | |
| if (mediaType === "video" || mediaType === "audio") { | |
| var video = document.createElement(mediaType); | |
| video.preload = "metadata"; | |
| video.onloadedmetadata = function() { | |
| window.URL.revokeObjectURL(video.src); | |
| resolve(video.duration); | |
| }; |
| // Serverless.yml | |
| functions: | |
| myCloudWatch: | |
| handler: myCloudWatch.handler | |
| events: | |
| - cloudwatchEvent: | |
| event: | |
| source: | |
| - "aws.mediaconvert" | |
| detail-type: |
| import * as util from "util"; | |
| type Maybe<T> = T | undefined | null; | |
| export function promisify<Args, R>( | |
| fn: (arg: Args, callback: (e: Maybe<Error>, result: R) => void) => void, | |
| self?: any | |
| ): (arg: Args) => Promise<R> { | |
| return util.promisify(fn).bind(self); | |
| } |
| website { | |
| index_document = "index.html" | |
| error_document = "error.html" | |
| routing_rules = <<EOF | |
| [{ | |
| "Condition": { | |
| "HttpErrorCodeReturnedEquals": "404", | |
| "KeyPrefixEquals": "" |
| find src/ -name "lib.ts" -exec sh -c 'mv "$0" "${0%lib.ts}utils.ts"' {} \; |