1<!DOCTYPE html> 2<html> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 6 <title>i am Chris Smith</title> 7 <meta name="viewport" content="width=device-width, initial-scale=1"> 8 <meta name="description" content=""> 9
9<script data-goatcounter="https://iamchrissmith.goatcounter.com/count" async src="//gc.zgo.at/count.js" type="6a4aa0c27887339ab1df194d-text/javascript"></script>
9 10 <link rel="canonical" 11 href="https://iamchrissmith.io/"> 12 13 <!-- Harmony styles --> 14 <link rel="stylesheet" type="text/css" href="/assets/css/main.css"> 15 16 <!-- Modernizr js --> 17
17<script async src="/assets/js/modernizr.js" type="6a4aa0c27887339ab1df194d-text/javascript"></script>
17 18 19 <!-- Font Awesome --> 20
20<script src="https://use.fontawesome.com/992197cd17.js" type="6a4aa0c27887339ab1df194d-text/javascript"></script>
20 21 <!-- IE Fixes --> 22 <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> 23 <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 24 <!--[if lt IE 9]> 25
25<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
25 26
26<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
26 27 <![endif]--> 28 </head> 29 <body class="darken"> 30 <header class="main-header"> 31 <div class="wc-container"> 32 <h1><a href="/">i am Chris Smith</a></h1> 33 <h2>Protocol Engineer, Security Researcher, Software Consultant</h2> 34 <ul> 35 <li> 36 <a href="https://iamchrissmith.io/">Home</a> 37 </li> 38 <li> 39 <a href="https://iamchrissmith.io/about">About</a><span>/</span> 40 </li> 41 42 <li> 43 <a href="https://lefthandcypher.com">Current Work</a><span>/</span> 44 </li> 45 <li> 46 <a href="https://www.crs.photography">Photography</a><span>/</span> 47 </li> 48 <li> 49 <a href="https://iamchrissmith.io/blog">Blog</a><span>/</span> 50 </li> 51 <li> 52 <a href="https://iamchrissmith.io/projects">Past Projects</a><span>/</span> 53 </li> 54 <li> 55 <a href="https://iamchrissmith.io/resources">Resources</a><span>/</span> 56 </li> 57 58 <li> 59 <a title="iamchrissmith on Github" 60 href="https://github.com/iamchrissmith" target="_blank"> 61 GitHub 62 </a><span>/</span> 63 </li> 64 65</ul> 66 67 </div> 68 </header> 69 <div id="home" class="page-content wc-container"> 70 <div class="posts"> 71 72 <div class="post"> 73 <h3 class="post-title"> 74 <a href="https://iamchrissmith.io/blog/solidity/smart%20contract/ethereum/testing/truffle/migrations/2018/11/04/testing-truffle-migrations/"> 75 Testing Truffle Migrations 76 </a> 77 </h3> 78 79 <p class="post-meta"> 80 81 <span class="categories"> 82 blog, Solidity, Smart Contract, Ethereum, Testing, Truffle, and Migrations 83 </span> | 84 85 <span class="post-date"> 86 Nov 4, 2018 87 </span> 88 </p> 89 90 <p> 91 <p>At the beginning of October, I spoke at TruffleCon 2018 on âSmart Contract Testing Strategiesâ. <a href="https://github.com/iamchrissmith/trufflecon-2018-testing-strategies">You can view the code and presentation from that talk on Github</a>. While preparing for that talk, I looked at a lot of smart contract tutorials that showed smart contract tests using <code class="language-plaintext highlighter-rouge">MyContract.deployed()</code> in their mocha tests. While this benefits your tests by making use of the Truffle <a href="https://truffleframework.com/docs/truffle/testing/testing-your-contracts#clean-room-environment">Clean Room Environment</a> and speeds up your tests by only deploying a new set of contracts once per test file, I do not believe this leads to clean, easy to understand unit tests for your smart contracts. As I describe in that talk, I believe it is better to use <code class="language-plaintext highlighter-rouge">beforeEach</code> blocks in your tests to deploy new contracts for each test, creating a clean state in which each individual test can run. For instance: 92```javascript 93const MyContractAbstraction = artifacts.require(âMyContractâ);</p> 94 95 96 </p> 97 <p> 98 <a href="https://iamchrissmith.io/blog/solidity/smart%20contract/ethereum/testing/truffle/migrations/2018/11/04/testing-truffle-migrations/" title="Testing Truffle Migrations"> 99 Read More 100 </a> 101 </p> 102 </div> 103 104 <div class="post"> 105 <h3 class="post-title"> 106 <a href="https://iamchrissmith.io/blog/javascript/expressjs/middleware/nodejs/2017/09/09/expressjs-next-exploration/"> 107 Exploring the uses of next() in ExpressJS 108 </a> 109 </h3> 110 111 <p class="post-meta"> 112 113 <span class="categories"> 114 blog, JavaScript, ExpressJS, middleware, and NodeJS 115 </span> | 116 117 <span class="post-date"> 118 Sep 9, 2017 119 </span> 120 </p> 121 122 <p> 123 <p>When our Turing cohort explored ExpressJS this module, there was a quick comment at the bottom of one of our lessons about the <code class="language-plaintext highlighter-rouge">next()</code> function in ExpressJS. While I was in the middle of a project figuring out API endpoints and using <a href="http://knexjs.org/">Knex</a> with NodeJS, I could not fully absorb the possibilities of <code class="language-plaintext highlighter-rouge">next()</code>. Having now gone through that project, I wanted to circle back and gain a better understanding of how <code class="language-plaintext highlighter-rouge">next()</code> worked and how to look for patterns where it might be useful. In short, <code class="language-plaintext highlighter-rouge">next()</code> sends the request to the next function (those clever developers with their fancy
123names) that handles the request. Still unclear? I know it certainly was when I first looked at <code class="language-plaintext highlighter-rouge">next()</code>.</p> 124 125 126 </p> 127 <p> 128 <a href="https://iamchrissmith.io/blog/javascript/expressjs/middleware/nodejs/2017/09/09/expressjs-next-exploration/" title="Exploring the uses of next() in ExpressJS"> 129 Read More 130 </a> 131 </p> 132 </div> 133 134 <div class="post"> 135 <h3 class="post-title"> 136 <a href="https://iamchrissmith.io/blog/ethereum/blockchain/go-ethereum/geth/aws/amazon%20web%20services/2017/06/01/building-a-private-geth-network-part-2/"> 137 Up and Running with a Private Go-Ethereum Network Part 2 138 </a> 139 </h3> 140 141 <p class="post-meta"> 142 143 <span class="categories"> 144 blog, ethereum, blockchain, Go-Ethereum, geth, AWS, and Amazon Web Services 145 </span> | 146 147 <span class="post-date"> 148 Jun 1, 2017 149 </span> 150 </p> 151 152 <p> 153 <p>In the first post of this series, I talked about <a href="/blog/ethereum/blockchain/go-ethereum/geth/aws/amazon%20web%20services/2017/05/26/building-a-private-geth-network/">
153getting AWS setup and running your genesis node</a> for a TestNet. Its great to have your own node, but really, you donât want to have to SSH into the server every time you want to do something. Ideally you would be able to connect your computer to an always live test chain and get to work.</p> 154 155 156 </p> 157 <p> 158 <a href="https://iamchrissmith.io/blog/ethereum/blockchain/go-ethereum/geth/aws/amazon%20web%20services/2017/06/01/building-a-private-geth-network-part-2/" title="Up and Running with a Private Go-Ethereum Network Part 2"> 159 Read More 160 </a> 161 </p> 162 </div> 163 164 <div class="post"> 165 <h3 class="post-title"> 166 <a href="https://iamchrissmith.io/blog/ethereum/blockchain/go-ethereum/geth/aws/amazon%20web%20services/2017/05/26/building-a-private-geth-network/"> 167 Up and Running with a Private Go-Ethereum Network 168 </a> 169 </h3> 170 171 <p class="post-meta"> 172 173 <span class="categories"> 174 blog, ethereum, blockchain, Go-Ethereum, geth, AWS, and Amazon Web Services 175 </span> | 176 177 <span class="post-date"> 178 May 26, 2017 179 </span> 180 </p> 181 182 <p> 183 <h2 id="setting-up-aws">Setting Up AWS</h2> 184<p>We are going to focus on getting this set up on AWS since that is the most flexible for a team to work on contracts in the future.</p> 185 186 187 </p> 188 <p> 189 <a href="https://iamchrissmith.io/blog/ethereum/blockchain/go-ethereum/geth/aws/amazon%20web%20services/2017/05/26/building-a-private-geth-network/" title="Up and Running with a Private Go-Ethereum Network"> 190 Read More 191 </a> 192 </p> 193 </div> 194 195 <div class="post"> 196 <h3 class="post-title"> 197 <a href="https://iamchrissmith.io/blog/rails/ruby/2017/05/18/adding-checkboxes-to-rails-forms/"> 198 Rails - Form Checkboxes 199 </a> 200 </h3> 201 202 <p class="post-meta"> 203 204 <span class="categories"> 205 blog, rails, and ruby 206 </span> | 207 208 <span class="post-date"> 209 May 18, 2017 210 </span> 211 </p> 212 213 <p> 214 <p>Rails makes outputting a form pretty easy. Unfortunately, like with many things at this point in my Rails journey, the magic seems pretty opaque. One of the things that was confusing in our latest project was adding checkboxes to our forms.</p> 215 216 217 </p> 218 <p> 219 <a href="https://iamchrissmith.io/blog/rails/ruby/2017/05/18/adding-checkboxes-to-rails-forms/" title="Rails - Form Checkboxes"> 220 Read More 221 </a> 222 </p> 223 </div> 224 225 <div class="post"> 226 <h3 class="post-title"> 227 <a href="https://iamchrissmith.io/blog/turing/logic/2017/04/25/turing-mod-1-and-recursion/"> 228 Turing Mod 1 and Recursion 229 </a> 230 </h3> 231 232 <p class="post-meta"> 233 234 <span class="categories"> 235 blog, turing, and logic 236 </span> | 237 238 <span class="post-date"> 239 Apr 25, 2017 240 </span> 241 </p> 242 243 <p> 244 <h2 id="recursion---favorite-technical-concept-from-mod-1">Recursion - Favorite Technical Concept from Mod 1</h2> 245<p>One of the hardest and most fun concepts I learned during mod 1 was ârecursionâ. This at times can feel like something out of the movie Inception, but it was one of the most powerful tools I learned. It allows you to loop over a part of your program until a condition is met. Each new layer puts a temporary pause on the layer that spawned it and then ruby cycles back up through the layers completing the remaining program at each level before returning to the level that spawned it.</p> 246 247 248 </p> 249 <p> 250 <a href="https://iamchrissmith.io/blog/turing/logic/2017/04/25/turing-mod-1-and-recursion/" title="Turing Mod 1 and Recursion"> 251 Read More 252 </a> 253 </p> 254 </div> 255 256 <div class="post"> 257 <h3 class="post-title"> 258 <a href="https://iamchrissmith.io/ruby-send-method-exploration"> 259 Ruby's send method 260 </a> 261 </h3> 262 263 <p class="post-meta"> 264
265 <span class="categories"> 266 blog and ruby 267 </span> | 268 269 <span class="post-date"> 270 Apr 19, 2017 271 </span> 272 </p> 273 274 <p> 275 <p>A pattern I see recurring in my programming is that I need to take an argument, then based on what it is do something, for instance:</p> 276 277<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">def</span> <span class="nf">my_method</span><span class="p">(</span><span class="n">array_of_args</span><span class="p">,</span> <span class="n">action</span><span class="p">)</span> 278 <span class="k">if</span> <span class="n">action</span> <span class="o">==</span> <span class="ss">:sum</span> 279 <span class="n">my_math</span><span class="p">.</span><span class="nf">sum</span><span class="p">(</span><span class="n">array_of_args</span><span class="p">)</span> 280 <span class="k">elsif</span> <span class="n">action</span> <span class="o">==</span> <span class="ss">:average</span> 281 <span class="n">my_math</span><span class="p">.</span><span class="nf">average</span><span class="p">(</span><span class="n">array_of_args</span><span class="p">)</span> 282 <span class="k">end</span> 283<span class="k">end</span></code></pre></figure> 284 285 286 </p> 287 <p> 288 <a href="https://iamchrissmith.io/ruby-send-method-exploration" title="Ruby's send method"> 289 Read More 290 </a> 291 </p> 292 </div> 293 294 <div class="post"> 295 <h3 class="post-title"> 296 <a href="https://iamchrissmith.io/ruby-hashes-what-are-they"> 297 Ruby Hashes... what are they good for? 298 </a> 299 </h3> 300 301 <p class="post-meta"> 302 303 <span class="categories"> 304 blog and ruby 305 </span> | 306 307 <span class="post-date"> 308 Apr 16, 2017 309 </span> 310 </p> 311 312 <p> 313 <p>Hashes are a very powerful and useful tool in Ruby, so I wanted to dig a little more into them.</p> 314 315 316 </p> 317 <p> 318 <a href="https://iamchrissmith.io/ruby-hashes-what-are-they" title="Ruby Hashes... what are they good for?"> 319 Read More 320 </a> 321 </p> 322 </div> 323 324 <div class="post"> 325 <h3 class="post-title"> 326 <a href="https://iamchrissmith.io/blog/ruby/logic/2017/04/15/smart-nodes/"> 327 Smart Nodes all the time! 328 </a> 329 </h3> 330 331 <p class="post-meta"> 332 333 <span class="categories"> 334 blog, ruby, and logic 335 </span> | 336 337 <span class="post-date"> 338 Apr 15, 2017 339 </span> 340 </p> 341 342 <p> 343 <p>With Ruby, one of the topics/strategies that keeps coming up is the idea of pushing logic as far down the object tree as possible.</p> 344 345 346 </p> 347 <p> 348 <a href="https://iamchrissmith.io/blog/ruby/logic/2017/04/15/smart-nodes/" title="Smart Nodes all the time!"> 349 Read More 350 </a> 351 </p> 352 </div> 353 354 </div> 355 <div class="post-footer"> 356 <div class="column-full"><a href="https://iamchrissmith.io/blog">Blog archive</a></div> 357 </div> 358</div> 359 360 <footer class="main-footer"> 361 <div class="wc-container"> 362 <div class="column one"> 363 <h6>Few more links</h6> 364<ul class="menu"> 365 <li><a href="https://iamchrissmith.io/about">About</a></li> 366 <li><a href="https://iamchrissmith.io/blog">Blog</a></li> 367 <!-- <li><a href="https://iamchrissmith.io/faq">Help / FAQ</a></li> --> 368</ul> 369 370 </div> 371 <div class="column two"> 372 <h6>Follow me</h6> 373<ul class="social-media"> 374 375 <li> 376 <a title="iamchrissmith on Twitter" 377 href="https://twitter.com/iamchrissmith" 378 aria-label="Twitter" class="twitter" target="_blank"> 379 <i class="fa fa-twitter" aria-hidden="true"></i> 380 <span class="sr-only">Twitter</span> 381 </a> 382 </li> 383 384 385 386 <li> 387 <a title="iamchrissmith on Github" 388 href="https://github.com/iamchrissmith" 389 aria-label="GitHub" class="github" target="_blank"> 390 <i class="fa fa-github" aria-hidden="true"></i>
391 <span class="sr-only">Github</span> 392 </a> 393 </li> 394 395 396 397 <li> 398 <a title="iamchrisryansmith on LinkedIn" 399 href="https://linkedin.com/in/iamchrisryansmith" 400 aria-label="LinkedIn" class="linkedin" target="_blank"> 401 <i class="fa fa-linkedin" aria-hidden="true"></i> 402 <span class="sr-only">LinkedIn</span> 403 </a> 404 </li> 405 406 407</ul> 408 409 </div> 410 </div> 411 <p class="wc-container disclaimer"> 412 413 Made by <a href="https://iamchrissmith.io">Chris Smith</a> For everyone. 414 415Powered by <a href="http://jekyllrb.com" target="_blank">Jekyll</a> 416 417 </p> 418 </footer> 419
419<script type="6a4aa0c27887339ab1df194d-text/javascript"> 420 /* To avoid render blocking css */ 421 var cb = function() { 422 var l = document.createElement('link'); l.rel = 'stylesheet'; 423 l.href = 'https://fonts.googleapis.com/css?family=Ubuntu+Mono&subset=latin'; 424 var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h); 425 }; 426 var raf = requestAnimationFrame || mozRequestAnimationFrame || 427 webkitRequestAnimationFrame || msRequestAnimationFrame; 428 if (raf) raf(cb); 429 else window.addEventListener('load', cb); 430 </script>
430 431 <!-- jQuery --> 432
432<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="6a4aa0c27887339ab1df194d-text/javascript"></script>
432 433 <!-- When no internet load JQuery from local --> 434
434<script type="6a4aa0c27887339ab1df194d-text/javascript">window.jQuery || document.write('
434<script src="/assets/js/jquery.min.js"><\/script>')</script>
434 435 <!-- Site js --> 436
436<script src="/assets/js/all.js" type="6a4aa0c27887339ab1df194d-text/javascript"></script>
436 437 <!-- Google analytics --> 438
439<script type="6a4aa0c27887339ab1df194d-text/javascript"> 440 441 var _gaq = _gaq || []; 442 _gaq.push(['_setAccount', 'UA-xxxx-x']); 443 _gaq.push(['_trackPageview']); 444 445 (function() { 446 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 447 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 448 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 449 })(); 450 451</script>
vendor: 148 bytes, lines 451-453
451 452 453 <script src="/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js" data-cf-settings="6a4aa0c27887339ab1df194d-|49" defer></script>
453<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v4bc70e2c01a94c73b74392e4234840661791215815920" integrity="sha512-L0ha0OXavK/8okipN9F8BtP84dg9DUhPERbBXzwI6dgTA55d2+yweo3pn5CSFYs45/r8md2+xvUPtTdvTNRfjA==" data-cf-beacon='{"version":"2024.11.0","token":"525ddb2c12d74c52ab49ae655bbc7871","r":1,"spa":2}' crossorigin="anonymous"></script>
453 454</body> 455</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.