fixedmaster.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>There I Fixed It</title>
  6. <meta name="description" content="An amalgamation of dumb ideas that actually turn out to be kind of great.">
  7. <meta name="author" content="David Banham and Sam Gentle">
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
  10. <link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
  11. <link rel="stylesheet" href="css/reset.css">
  12. <link rel="stylesheet" href="css/main.css">
  13. <link rel="stylesheet" href="css/print.css" type="text/css" media="print">
  14. <link rel="stylesheet" href="lib/css/zenburn.css">
  15. <!--[if lt IE 9]>
  16. <script src="lib/js/html5shiv.js"></script>
  17. <![endif]-->
  18. </head>
  19. <body>
  20. <div class="reveal">
  21. <!-- Used to fade in a background when a specific slide state is reached -->
  22. <div class="state-background"></div>
  23. <!-- Any section element inside of this container is displayed as a slide -->
  24. <div class="slides">
  25. <section>
  26. <h1>There I Fixed It</h1>
  27. <h3 class="inverted">Dumb hacks that end up being great</h3>
  28. <script>
  29. // Delicously hacky. Look away.
  30. if( navigator.userAgent.match( /(iPhone|iPad|iPod|Android)/i ) ) document.write( '<p style="color: rgba(0,0,0,0.3); text-shadow: none;">('+'Tap to navigate'+')</p>' );
  31. </script>
  32. </section>
  33. <section>
  34. <h2>Heads Up</h2>
  35. <p>
  36. This presentation uses a souped-up version of reveal.js
  37. </p>
  38. <p>
  39. Go here on your laptop, smartphone or tablet:
  40. </p>
  41. <p><a href="http://revealjs.jit.su/fixed.html">http://revealjs.jit.su/fixed.html</a></p>
  42. </section>
  43. <section>
  44. <section>
  45. <h2>Who the hell are you?</h2>
  46. <a href="http://www.pinion.gg" class="image">
  47. <img src="http://www.pinion.gg/images/pinion_green_horizontal.png">
  48. </a>
  49. </section>
  50. <section>
  51. <h2>What the hell is this?</h2>
  52. <img src="http://i.chzbgr.com/completestore/2012/2/24/2d633fb0-9205-46f2-9bc1-f508124308aa.jpg">
  53. </section>
  54. <section>
  55. <img src="http://i.chzbgr.com/completestore/2009/12/8/129047925338284784.jpg">
  56. </section>
  57. </section>
  58. <!-- Unql -->
  59. <section>
  60. <section>
  61. <h2>In the beginning.</h2>
  62. <p>
  63. There was SQL.
  64. </p>
  65. <p>
  66. And it was okay.
  67. </p>
  68. </section>
  69. <section>
  70. <h2>And then...</h2>
  71. <p>There was noSQL!</p>
  72. <p>And it scaled and it was all javascripty and all the hipsters loved it and everyone was happy.
  73. </section>
  74. <section>
  75. <h2>But then you want to actually use it</h2>
  76. </section>
  77. <section>
  78. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  79. var request = http.request({
  80. host: 'couchdb.internet.com',
  81. path: '/awesomedb/_all_docs',
  82. auth: 'zer0c00l:God'
  83. });
  84. request.end();
  85. var newrows = []
  86. request.on('response', function (response) {
  87. response.on('data', function (data) {
  88. data.rows.forEach(function(row){
  89. row.value.walkThe = "dinosaur";
  90. newrows.push(row.value);
  91. });
  92. });
  93. });
  94. request.end();
  95. var request = http.request({
  96. host: 'couchdb.internet.com',
  97. method: 'post'
  98. path: '/awesomedb/_bulk_docs',
  99. auth: 'zer0c00l:God'
  100. });
  101. request.write(JSON.stringify({docs:newrows}));
  102. request.end()
  103. </code></pre>
  104. </section>
  105. <section>
  106. <img src="http://c1eatdrinkbettercom.wpengine.netdna-cdn.com/files/2012/05/nope.jpg">
  107. </section>
  108. <section>
  109. <h2>unql-node</h2>
  110. <p>
  111. <a href="https://github.com/sgentle/unql-node">
  112. https://github.com/sgentle/unql-node
  113. </a>
  114. </p>
  115. <p>It's like SQL for NoSQL</p>
  116. <img src="http://geekspodcast.com/geekpress/wp-content/uploads/2009/07/yo_dawg-230x300.jpg">
  117. </section>
  118. <section>
  119. <h2>Deletin' stuff</h2>
  120. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  121. > delete from checkins where username.match(/\d{4}$/) && timestamp > (new Date()).getTime()-1000*60*60*24*7
  122. </code></pre>
  123. </section>
  124. <section>
  125. <h2>Why don't we take all the data...</h2>
  126. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  127. > create collection nag_old_users
  128. > insert into nag_old_users select {username: username, email: email} from user where last_login < (new Date()).getTime()-1000*60*60*24*7
  129. </code></pre>
  130. <h2>And put it over here!</h2>
  131. </section>
  132. <section>
  133. <h2>Want to see my awesome LALR recursive descent parser?</h2>
  134. <img src="http://ic.pics.livejournal.com/ontinia/10827199/5144/original.jpg">
  135. </section>
  136. <section>
  137. <h2>Nope!</h2>
  138. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  139. handle /delete from (\S+)(?: where (.*))?/, (db, expr, cb) ->
  140. query = "update #{db} set _deleted = true"
  141. query += " where #{expr}" if expr
  142. processExpr query, cb
  143. </code></pre>
  144. </section>
  145. <section>
  146. <h2>There I fixed it.</h2>
  147. <img src="http://i.chzbgr.com/completestore/2009/12/4/129043939908502110.jpg"</img>
  148. </section>
  149. </section>
  150. <section>
  151. <section>
  152. <h2>noDB</h2>
  153. <p>So you want to add some persistence to your simple web app.</p>
  154. </section>
  155. <section>
  156. <p>Okay so just require that each user have a couch installation.</p>
  157. <p>Or make redis a dependency. Probably include some build scripts or something to make it easier since it's the only thing in the app that needs to be compiled.</p>
  158. <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/ER_Diagram_MMORPG.png/539px-ER_Diagram_MMORPG.png">
  159. <p>Maybe it would be easier to build SQLite?</p>
  160. </section>
  161. <section>
  162. <h2>Nope!</h2>
  163. <img src="https://dl.dropbox.com/u/176051/nopenopenope.jpeg">
  164. </section>
  165. <section>
  166. <h2>noDB</h2>
  167. <p>SQL < noSQL < noDB</p>
  168. </section>
  169. <section>
  170. <h2>Super simple</h2>
  171. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;" class="javascript">
  172. var users = JSON.parse(fs.readFileSync('data/users.json'))
  173. users.push({name: "newguy"});
  174. fs.writeFileSync('data/users.json', JSON.stringify(users));
  175. res.send('success');
  176. </code></pre>
  177. </section>
  178. <section>
  179. <h2>Session storage too!</h2>
  180. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;" class="javascript">
  181. var store = new express.session.MemoryStore;
  182. store.sessions = JSON.parse(fs.readFileSync('data/sessions.json'));
  183. setInterval(function(){
  184. fs.writeFileSync('data/sessions.json', JSON.stringify(store.sessions));
  185. }, 2000);
  186. </code></pre>
  187. </section>
  188. <section>
  189. <h2>It's basically Redis</h2>
  190. <small>It's not really</small>
  191. </section>
  192. <section>
  193. <h2>But it is:</h2>
  194. <ul>
  195. <li>Deployable</li>
  196. <li>Dependency free</li>
  197. <li>Easily backed up</li>
  198. <li>Debuggable</li>
  199. </ul>
  200. </section>
  201. <section>
  202. <h2>Databases: Fixed</h2>
  203. <img src="http://i.chzbgr.com/completestore/2009/12/20/129058269966385911.jpg">
  204. </section>
  205. </section>
  206. <section>
  207. <section>
  208. <h2>I would like to make some information available on the internet.</h2>
  209. </section>
  210. <section>
  211. <h2>So find a shared hosting provider or something.</h2>
  212. <p>But they're kind of crappy</p>
  213. </section>
  214. <section>
  215. <h2>So I'll just run my own</h2>
  216. <p>On nginx or express or something!</p>
  217. <p>But load balancing and updates and bugs and oh no.</p>
  218. </section>
  219. <section>
  220. <h2>Oh I know!</h2>
  221. <img src="http://s2.wp.com/wp-content/themes/h4/i/logo-v-rgb.png?m=1308937729g">
  222. </section>
  223. <section>
  224. <img src="https://dl.dropbox.com/u/176051/spidernope.jpeg">
  225. </section>
  226. <section>
  227. <blockquote>
  228. Augh. I wish I could just shove all this right on Akamai
  229. </blockquote>
  230. </section>
  231. <section>
  232. <p>...</p>
  233. </section>
  234. <section>
  235. <p>...</p>
  236. </section>
  237. <section>
  238. <p>...</p>
  239. </section>
  240. <section>
  241. <p>Why not?</p>
  242. </section>
  243. <section>
  244. <h2>Step 0: Generate static site</h2>
  245. <p>Use whatever you want. We really like <a href="http://jade-lang.com/">Jade.</a></p>
  246. </section>
  247. <section>
  248. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;" class="jade">
  249. !!! 5
  250. include includes/head.jade
  251. body
  252. include includes/header.jade
  253. // BEGIN Content
  254. .inner-bg
  255. #content-wrapper
  256. Welcome to zombocom!
  257. </code></pre>
  258. </section>
  259. <section>
  260. <h2>make</h2>
  261. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  262. JADE = $(shell find pages/*.jade)
  263. HTML = $(JADE:.jade=.html)
  264. all: $(HTML)
  265. %.html: %.jade
  266. ./jade/bin/jade < $< --path $< > $@
  267. clean:
  268. rm -f $(HTML)
  269. .PHONY: clean
  270. </code></pre>
  271. </section>
  272. <section>
  273. <h2>Rackspace == Akamai</h2>
  274. <p>It's cheap. 18c per GB</p>
  275. <p>You don't have to deal directly with Akamai. Keep your soul!</p>
  276. <p><a href="http://www.rackspace.com/cloud/public/files/">http://www.rackspace.com/cloud/public/files/</a></p>
  277. </section>
  278. <section>
  279. <h2>Getting it there</h2>
  280. <p>There's a node library for that.</p>
  281. <p><a href="https://github.com/nodejitsu/node-cloudfiles">https://github.com/nodejitsu/node-cloudfiles</a></p>
  282. </section>
  283. <section>
  284. <p>There's also some tooling for that.</p>
  285. <p><a href="https://github.com/PinionTech/cloud-loader">https://github.com/PinionTech/cloud-loader</a></p>
  286. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  287. coffee cloud-loader.coffee -x localDir cloudContainer
  288. </code></pre>
  289. </section>
  290. <section>
  291. <h2>Deep magic</h2>
  292. <pre><code contenteditable style="font-size: 18px; margin-top: 20px;">
  293. curl -i -X GET -H "X-Auth-User: pinion" -H "X-Auth-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" "https://auth.api.rackspacecloud.com/v1.0"
  294. curl -X POST -H "X-Container-Meta-Web-Index: index.html" -H "X-Auth-Token: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" "https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_ad499859-aaed-43c6-813b-5e1c545f85cf/pinion-www
  295. </code></pre>
  296. </section>
  297. <section>
  298. <h2>Relax</h2>
  299. <p>Never ever care about whether your website is up.</p>
  300. <p>Go do something useful instead.</p>
  301. <br />
  302. <p>Yeah, it's harder to do pretty URLs.</p>
  303. </section>
  304. <section>
  305. <h2>So fixed</h2>
  306. <img src="http://i.chzbgr.com/completestore/2009/12/19/129057249545630776.jpg">
  307. </section>
  308. </section>
  309. <section>
  310. <section>
  311. <h2>It's not always the right thing to just fix it</h2>
  312. </section>
  313. <section>
  314. <h2>But sometimes it is</h2>
  315. <img src="http://i.chzbgr.com/completestore/2009/12/22/129060139339845620.jpg">
  316. </section>
  317. </section>
  318. <section>
  319. <h1>ALL FIXED</h1>
  320. <h3 class="inverted">BY David Banham and Sam Gentle</h3>
  321. <img src="http://i.chzbgr.com/completestore/2009/12/22/129059992995261245.jpg">
  322. </section>
  323. </div>
  324. <!-- The navigational controls UI -->
  325. <aside class="controls">
  326. <a class="left" href="#">&#x25C4;</a>
  327. <a class="right" href="#">&#x25BA;</a>
  328. <a class="up" href="#">&#x25B2;</a>
  329. <a class="down" href="#">&#x25BC;</a>
  330. </aside>
  331. <!-- Presentation progress bar -->
  332. <div class="progress"><span></span></div>
  333. </div>
  334. <script src="lib/js/head.min.js"></script>
  335. <script>
  336. var multiplex = {
  337. id: 'e754f2af1a284921'
  338. , secret: '13450197174132860353'
  339. , url: 'revealjs.jit.su'
  340. };
  341. var notes = false;
  342. head.ready( function() {
  343. // Fires when a slide with data-state=customevent is activated
  344. Reveal.addEventListener( 'customevent', function() {
  345. console.log( '"customevent" has fired' );
  346. } );
  347. // Fires each time a new slide is activated
  348. Reveal.addEventListener( 'slidechanged', function( event ) {
  349. // event.previousSlide, event.currentSlide, event.indexh, event.indexv
  350. } );
  351. // Full list of configuration options available here:
  352. // https://github.com/hakimel/reveal.js#configuration
  353. Reveal.initialize({
  354. controls: true,
  355. progress: true,
  356. history: true,
  357. theme: Reveal.getQueryHash().theme || 'default', // default/neon/beige
  358. transition: Reveal.getQueryHash().transition || 'default' // default/cube/page/concave/linear(2d)
  359. });
  360. // Load highlight.js for syntax highlighting of code samples
  361. head.js( 'lib/js/highlight.js', function() {
  362. hljs.initHighlightingOnLoad();
  363. } );
  364. } );
  365. // Scripts that should be loaded before initializing
  366. var scripts = [];
  367. // If the browser doesn't support classList, load a polyfill
  368. if( !document.body.classList ) {
  369. head.js( 'lib/js/classList.js' );
  370. }
  371. // Load markdown parser if there are slides defined using markdown
  372. if( document.querySelector( '[data-markdown]' ) ) {
  373. scripts.push( 'lib/js/showdown.js' );
  374. scripts.push( 'lib/js/data-markdown.js' );
  375. }
  376. scripts.push( 'js/reveal.js' );
  377. // If we're runnning the notes server we need to include some additional JS
  378. // TODO Is there a better way to determine if we're running the notes server?
  379. if( window.location.host === 'localhost:1947' || notes === true) {
  380. scripts.push( 'socket.io/socket.io.js' );
  381. scripts.push( 'plugin/speakernotes/client.js' );
  382. }
  383. if( multiplex.id !== null ) {
  384. scripts.push( 'socket.io/socket.io.js' );
  385. scripts.push( 'plugin/multiplex/client.js' );
  386. if( multiplex.secret !== null ) {
  387. scripts.push( 'plugin/multiplex/master.js' );
  388. }
  389. }
  390. // Load the scripts and, when completed, initialize reveal.js
  391. head.js.apply( null, scripts );
  392. </script>
  393. </body>
  394. </html>