CINXE.COM

<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 9]><!--><html class='no-js' lang='en'><!--<![endif]--><head> <meta content='IE=edge' http-equiv='X-UA-Compatible'> <meta charset='utf-8'> <meta content='width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1, user-scalable=no' name='viewport'> <meta content='en' name='Content-Language'> <link rel="stylesheet" media="screen" href="https://leanpub.com/assets/stylesheets/app-bundle-3a102529b44722ebfc51.css" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-57x57-3dc48b9be1873ac9bf6d580e7836e3e5.png" sizes="57x57" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-60x60-06b95deca3f378372b051ca8ea42cfbd.png" sizes="60x60" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-72x72-935ba702f9d3da9b4404aa2b797920e5.png" sizes="72x72" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-76x76-937dbc8b688db389b5b872c5ffdffe2d.png" sizes="76x76" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-114x114-9db66ed49dfe9c3ed799923955da36e2.png" sizes="114x114" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-120x120-3fd2359930103db35eb499036b81ba90.png" sizes="120x120" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-144x144-5bee791d2b53cc426eb14e7f6e40a024.png" sizes="144x144" /> <link rel="apple-touch-icon-precomposed" type="image/png" href="https://leanpub.com/assets/favicons/apple-touch-icon-152x152-af69d0ec0fe11cf82324b06ff9a56e3b.png" sizes="152x152" /> <link rel="icon" type="image/png" href="https://leanpub.com/assets/favicons/favicon-16x16-19545df363d1089bccdc59d17ee5b781.png" sizes="16x16" /> <link rel="icon" type="image/png" href="https://leanpub.com/assets/favicons/favicon-32x32-9a0898109481d6450269c966cdf6a2d7.png" sizes="32x32" /> <link rel="icon" type="image/png" href="https://leanpub.com/assets/favicons/favicon-96x96-98f4372a68f5617fc907b7bde8d94e05.png" sizes="96x96" /> <link rel="icon" type="image/png" href="https://leanpub.com/assets/favicons/favicon-128x128-bf73acc329429fbf555afe3b067aa2d6.png" sizes="128x128" /> <link rel="icon" type="image/png" href="https://leanpub.com/assets/favicons/favicon-196x196-24a71f1b4fb02600f635b59a116daf05.png" sizes="196x196" /> <meta content='Leanpub' name='application-name'> <meta content='#ffffff' name='msapplication-TileColor'> <meta content='favicons/mstile-144x144.png' name='msapplication-TileImage'> <meta content='favicons/mstile-150x150.png' name='msapplication-square150x150logo'> <meta content='favicons/mstile-310x150.png' name='msapplication-wide310x150logo'> <meta content='favicons/mstile-310x310.png' name='msapplication-square310x310logo'> <meta content='favicons/mstile-70x70.png' name='msapplication-square70x70logo'> <link href='//fonts.googleapis.com/' rel='dns-prefetch'> <script src='https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js'></script> <script> if (typeof WebFont !== 'undefined') { WebFont.load({ google: { families: [ 'Noto+Sans:ital,wght@0,400;0,700;1,400;1,700', 'Noto+Serif:ital,wght@0,400;0,700;1,400;1,700', 'Inter:wght@400;700', ] } }); } </script> <link rel="stylesheet" media="screen" href="https://leanpub.com/assets/font_awesome-bbab983f4954a5c7dd952efdd403ebe8.css" /> <script> window.__BASE_URL__ = "https://leanpub.com/" window.__RAILS_ENV__ = "production" window.__IGNORE_ANALYTICS__ = false </script> <script> var _rollbarConfig = { accessToken: "3d279f41d3804636adbbba833c2c0d2d", captureUncaught: true, captureUnhandledRejections: true, code_version: "79947072", payload: { environment: "production" } }; // Rollbar Snippet !function(r){function o(n){if(e[n])return e[n].exports;var t=e[n]={exports:{},id:n,loaded:!1};return r[n].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}var e={};return o.m=r,o.c=e,o.p="",o(0)}([function(r,o,e){"use strict";var n=e(1),t=e(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.5.2/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,o,e){"use strict";function n(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}function t(r,o){this.options=r,this._rollbarOldOnError=null;var e=s++;this.shimId=function(){return e},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[e]={handler:o,messages:[]})}function a(r,o){if(r){var e=o.globalAlias||"Rollbar";if("object"==typeof r[e])return r[e];r._rollbarShims={},r._rollbarWrappedError=null;var t=new p(o);return n(function(){o.captureUncaught&&(t._rollbarOldOnError=r.onerror,i.captureUncaughtExceptions(r,t,!0),i.wrapGlobals(r,t,!0)),o.captureUnhandledRejections&&i.captureUnhandledRejections(r,t,!0);var n=o.autoInstrument;return o.enabled!==!1&&(void 0===n||n===!0||"object"==typeof n&&n.network)&&r.addEventListener&&(r.addEventListener("load",t.captureLoad.bind(t)),r.addEventListener("DOMContentLoaded",t.captureDomContentLoaded.bind(t))),r[e]=t,t})()}}function l(r){return n(function(){var o=this,e=Array.prototype.slice.call(arguments,0),n={shim:o,method:r,args:e,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)})}var i=e(2),s=0,d=e(3),c=function(r,o){return new t(r,o)},p=function(r){return new d(c,r)};t.prototype.loadFull=function(r,o,e,t,a){var l=function(){var o;if(void 0===r._rollbarDidLoad){o=new Error("rollbar.js did not load");for(var e,n,t,l,i=0;e=r._rollbarShims[i++];)for(e=e.messages||[];n=e.shift();)for(t=n.args||[],i=0;i<t.length;++i)if(l=t[i],"function"==typeof l){l(o);break}}"function"==typeof a&&a(o)},i=!1,s=o.createElement("script"),d=o.getElementsByTagName("script")[0],c=d.parentNode;s.crossOrigin="",s.src=t.rollbarJsUrl,e||(s.async=!0),s.onload=s.onreadystatechange=n(function(){if(!(i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){s.onload=s.onreadystatechange=null;try{c.removeChild(s)}catch(r){}i=!0,l()}}),c.insertBefore(s,d)},t.prototype.wrap=function(r,o,e){try{var n;if(n="function"==typeof o?o:function(){return o||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){e&&"function"==typeof e&&e.apply(this,arguments);try{return r.apply(this,arguments)}catch(e){var o=e;throw o&&("string"==typeof o&&(o=new String(o)),o._rollbarContext=n()||{},o._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=o),o}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(o){return r}};for(var u="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),f=0;f<u.length;++f)t.prototype[u[f]]=l(u[f]);r.exports={setupShim:a,Rollbar:p}},function(r,o){"use strict";function e(r,o,e){if(r){var t;if("function"==typeof o._rollbarOldOnError)t=o._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;o._rollbarOldOnError=t}var a=function(){var e=Array.prototype.slice.call(arguments,0);n(r,o,t,e)};e&&(a._rollbarOldOnError=t),r.onerror=a}}function n(r,o,e,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null),o.handleUncaughtException.apply(o,n),e&&e.apply(r,n)}function t(r,o,e){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var e,n,t;try{e=r.reason}catch(r){e=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!e&&t&&(e=t.reason,n=t.promise)}catch(r){}e||(e="[unhandledrejection] error getting `reason` from event"),o&&o.handleUnhandledRejection&&o.handleUnhandledRejection(e,n)};n.belongsToShim=e,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}}function a(r,o,e){if(r){var n,t,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(n=0;n<a.length;++n)t=a[n],r[t]&&r[t].prototype&&l(o,r[t].prototype,e)}}function l(r,o,e){if(o.hasOwnProperty&&o.hasOwnProperty("addEventListener")){for(var n=o.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(o,e,t){n.call(this,o,r.wrap(e),t)};t._rollbarOldAdd=n,t.belongsToShim=e,o.addEventListener=t;for(var a=o.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,o,e){a.call(this,r,o&&o._rollbar_wrapped||o,e)};l._rollbarOldRemove=a,l.belongsToShim=e,o.removeEventListener=l}}r.exports={captureUncaughtExceptions:e,captureUnhandledRejections:t,wrapGlobals:a}},function(r,o){"use strict";function e(r,o){this.impl=r(o,this),this.options=o,n(e.prototype)}function n(r){for(var o=function(r){return function(){var o=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,o)}},e="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<e.length;n++)r[e[n]]=o(e[n])}e.prototype._swapAndProcessMessages=function(r,o){this.impl=r(this.options);for(var e,n,t;e=o.shift();)n=e.method,t=e.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],e.ts]):this[n].apply(this,t));return this},r.exports=e},function(r,o){"use strict";r.exports=function(r){return function(o){if(!o&&!window._rollbarInitialized){r=r||{};for(var e,n,t=r.globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;e=window._rollbarShims[i++];)n||(n=e.handler),e.handler._swapAndProcessMessages(l,e.messages);window[t]=n,window._rollbarInitialized=!0}}}}]); // End Rollbar Snippet </script> <script src="https://www.google.com/recaptcha/api.js?render=6LdDCakUAAAAAEFI0Kyx_gg9t-G4r1mOWrIwFLd0"></script> <script src="https://leanpub.com/assets/modernizr-a38b94cc0625ba4488942166ee4d23a4.js"></script> </head> <body> <div id='react-root'></div> <div class='cookies-banner alert alert--info' style='display: none'> Leanpub requires cookies in order to provide you the best experience. <a class='dismiss link'>Dismiss</a> </div> <script type='text/javascript'> window.addEventListener('load', function() { var shouldShowCookies = document.cookie.indexOf('should_show_cookies') !== -1 if (shouldShowCookies) { var banner = document.querySelector('.cookies-banner') // IE < 9 check if (banner.style.removeProperty) { banner.style.removeProperty('display'); } else { banner.style.removeAttribute('display'); } document.querySelector('.cookies-banner').classList.add('shown') // Note that we have to use vanilla JS here because ujs (remote links) code doesn't live in the react app, and i don't // want to have to write this shit twice. document.querySelector('.cookies-banner .dismiss').addEventListener('click', function() { document.querySelector('.cookies-banner').remove() var xhr = new XMLHttpRequest() xhr.open("POST", "/api/v1/accepted_terms/dismiss_cookies", true); xhr.send() }) } }) </script> </body> <script src="https://leanpub.com/assets/polyfill-bundle-f2bf261e3f0b57d19161.js"></script> <script src="https://leanpub.com/assets/app-bundle-3a102529b44722ebfc51.js"></script> <!-- Twitter universal website tag code --> <script> !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments); },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js', a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script'); // Insert Twitter Pixel ID and Standard Event data below twq('init','nw0pa'); twq('track','PageView'); </script> <!-- End Twitter universal website tag code --> </html>