import { Hono } from "hono";
import PDFDocument from "pdfkit";
const app = new Hono();
/** | |
* Making promises | |
*/ | |
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
/* Simpler promise creation for static values */ | |
Js.Promise.resolve("easy"); | |
Js.Promise.reject(Invalid_argument("too easy")); |
This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf
window.__testCleanup = () => { | |
const unregisterSW = () => { | |
return navigator.serviceWorker.getRegistrations() | |
.then((registrations) => { | |
const unregisterPromise = registrations.map((registration) => { | |
return registration.unregister(); | |
}); | |
return Promise.all(unregisterPromise); | |
}); | |
}; |
import React, { Component, PropTypes } from 'react'; | |
import Modal from 'react-modal'; | |
/* | |
@desc: wraps any component provided in a react-modal | |
@param: ModalContent - any React component that you want as a modal | |
@param: Trigger (optional) - a clickable component that will trigger the modal to open | |
@param: triggerProps (optional) - some data to provide to the trigger component | |
@usage: |
[based on a true story]
So. Your friend's about to teach you how to make a website. Great!
You make a file, and you save it as 'index.html'. Why it's called 'index' isn't really explained to you, but whatever.
You type the following.
hello world
Earlier this year Facebook open sourced its React based rich text editing framework Draft.js. At Facebook it powers status updates, comments & notes. Others used it to build editors matching Medium’s experience.
Together with a whole team of open source contributors I built a plugin architecture on top of Draft.js. In this talk I walk you through the existing plugins and show how you can build your own feature-rich text editor for the web with only a handful lines of code. 🤓
{ fontWeight: '100' }, // Thin | |
{ fontWeight: '200' }, // Ultra Light | |
{ fontWeight: '300' }, // Light | |
{ fontWeight: '400' }, // Regular | |
{ fontWeight: '500' }, // Medium | |
{ fontWeight: '600' }, // Semibold | |
{ fontWeight: '700' }, // Bold | |
{ fontWeight: '800' }, // Heavy | |
{ fontWeight: '900' }, // Black |
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |