Skip to content

Commit

Permalink
Generate Pelican site
Browse files Browse the repository at this point in the history
  • Loading branch information
nevillelyh committed Aug 21, 2017
1 parent 81760ce commit 38332c8
Show file tree
Hide file tree
Showing 50 changed files with 1,779 additions and 348 deletions.
6 changes: 5 additions & 1 deletion archives.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<section id="content">
<h1>Archives for Das Keyboard Shredder</h1>
<div id="archives">
<p>
<span class="categories-timestamp"><time datetime="2017-08-21T09:30:00-04:00">Mon 21 August 2017</time></span>
<a href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">Automatic type-class derivation with&nbsp;Shapeless</a>
</p>
<p>
<span class="categories-timestamp"><time datetime="2017-08-01T13:51:00-04:00">Tue 01 August 2017</time></span>
<a href="http://www.lyh.me/lambda-serialization.html">Lambda&nbsp;serialization</a>
Expand Down Expand Up @@ -215,11 +219,11 @@ <h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Social</span></h4>
<li class="list-group-item">
<h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Recent Posts</span></h4>
<ul class="list-group" id="recentposts">
<li class="list-group-item"><a href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">Automatic type-class derivation with&nbsp;Shapeless</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lambda-serialization.html">Lambda&nbsp;serialization</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lawfulness-of-aggregatebykey.html">Lawfulness of&nbsp;aggregateByKey</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/canbuildfrom.html">CanBuildFrom</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/decompiling-scala-code.html">Decompiling Scala&nbsp;code</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/implicits.html">Implicits</a></li>
</ul>
</li>
<!-- End Sidebar/Recent Posts -->
Expand Down
80 changes: 48 additions & 32 deletions author/neville-li.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,53 @@
<div class="container">
<div class="row">
<div class="col-sm-9">
<article>
<h2><a href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">Automatic type-class derivation with&nbsp;Shapeless</a></h2>
<div class="well well-sm">
<footer class="post-info">
<span class="label label-default">Date</span>
<span class="published">
<i class="fa fa-calendar"></i><time datetime="2017-08-21T09:30:00-04:00"> Mon 21 August 2017</time>
</span>



<span class="label label-default">Category</span>
<a href="http://www.lyh.me/category/code.html">code</a>


<span class="label label-default">Tags</span>
<a href="http://www.lyh.me/tag/scala.html">scala</a>
/
<a href="http://www.lyh.me/tag/fp.html">fp</a>

</footer><!-- /.post-info --> </div>
<div class="summary"><p>We had a knowledge sharing session at work recently on <a href="https://github.com/milessabin/shapeless/">Shapeless</a> for automatic type class derivation. Here is a little write-up for the&nbsp;topic.</p>
<h2>Scala&nbsp;List</h2>
<p>First let&#8217;s review how <code>List</code> works in Scala. A <code>List</code> is a linked list with <code>head</code> and <code>tail</code>, plus <code>Nil</code> for empty list. It can be represented with the following abstract data&nbsp;type:</p>
<div class="highlight"><pre><span></span><span class="k">sealed</span> <span class="k">trait</span> <span class="nc">List</span><span class="o">[</span><span class="kt">+A</span><span class="o">]</span> <span class="o">{</span>
<span class="k">def</span> <span class="o">::[</span><span class="kt">B</span> <span class="k">&gt;:</span> <span class="kt">A</span><span class="o">](</span><span class="n">head</span><span class="k">:</span> <span class="kt">B</span><span class="o">)</span><span class="k">:</span> <span class="kt">List</span><span class="o">[</span><span class="kt">B</span><span class="o">]</span> <span class="k">=</span> <span class="nc">Cons</span><span class="o">(</span><span class="n">head</span><span class="o">,</span> <span class="k">this</span><span class="o">)</span>
<span class="o">}</span>
<span class="k">case</span> <span class="k">object</span> <span class="nc">Nil</span> <span class="k">extends</span> <span class="nc">List</span><span class="o">[</span><span class="kt">Nothing</span><span class="o">]</span> <span class="c1">// Nothing is a sub-type of every other type</span>
<span class="k">case</span> <span class="k">class</span> <span class="nc">Cons</span><span class="o">[</span><span class="kt">+A</span><span class="o">](</span><span class="n">head</span><span class="k">:</span> <span class="kt">A</span><span class="o">,</span> <span class="n">tail</span><span class="k">:</span> <span class="kt">List</span><span class="o">[</span><span class="kt">A</span><span class="o">])</span> <span class="k">extends</span> <span class="nc">List</span><span class="o">[</span><span class="kt">A</span><span class="o">]</span>
</pre></div>


<p>Notice that <code>::</code>, the list concatenation operation, is just a method on trait <code>List[+A]</code>. Since Scala operators that end with <code>:</code> are right-associative, we can conveniently create lists by chaining multiple <code>::</code>s. Therefore the following expressions are&nbsp;equivalent:</p>
<div class="highlight"><pre><span></span><span class="mi">1</span> <span class="o">::</span> <span class="mi">2</span> <span class="o">::</span> <span class="nc">Nil</span>
<span class="mi">1</span> <span class="o">::</span> <span class="o">(</span><span class="mi">2</span> <span class="o">::</span> <span class="nc">Nil</span><span class="o">)</span>
<span class="nc">Nil</span><span class="o">.::(</span><span class="mi">2</span><span class="o">).::(</span><span class="mi">1</span><span class="o">)</span>
<span class="nc">Cons</span><span class="o">(</span><span class="mi">1</span><span class="o">,</span> <span class="nc">Cons</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="nc">Nil</span><span class="o">))</span>
</pre></div>


<p>It&#8217;s important to point out here that Scala <code>List</code> is homogeneous, i.e. it has a single type parameter <code>A</code> and thus can only store elements of <code>A</code> and its sub-types. On the other hand, it can have varying numbers of elements at&nbsp;runtime.</p>
<h2>Shapeless&nbsp;HList</h2>
<p>Since <code>List …</code></p>
<a class="btn btn-default btn-xs" href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">more ...</a>
</div>
</article>
<hr/>
<article>
<h2><a href="http://www.lyh.me/lambda-serialization.html">Lambda&nbsp;serialization</a></h2>
<div class="well well-sm">
Expand Down Expand Up @@ -492,37 +539,6 @@ <h2><a href="http://www.lyh.me/scio-at-scala-by-the-bay.html">Scio at Scala by t
</div>
</article>
<hr/>
<article>
<h2><a href="http://www.lyh.me/semigroups.html">Semigroups</a></h2>
<div class="well well-sm">
<footer class="post-info">
<span class="label label-default">Date</span>
<span class="published">
<i class="fa fa-calendar"></i><time datetime="2016-09-21T19:22:00-04:00"> Wed 21 September 2016</time>
</span>



<span class="label label-default">Category</span>
<a href="http://www.lyh.me/category/code.html">code</a>


<span class="label label-default">Tags</span>
<a href="http://www.lyh.me/tag/scala.html">scala</a>
/
<a href="http://www.lyh.me/tag/fp.html">fp</a>
/
<a href="http://www.lyh.me/tag/scio.html">scio</a>
/
<a href="http://www.lyh.me/tag/data.html">data</a>

</footer><!-- /.post-info --> </div>
<div class="summary"><p>It&#8217;s been a while since my last post. Both <a href="https://github.com/spotify/scio">Scio</a> and Scala have been picking up a lot of momentum within <a href="https://www.spotify.com">Spotify</a> and a lot of people are starting to leveraging the power of <a href="https://github.com/twitter/algebird">Algebird</a>. So here&#8217;s another mini-talk on <a href="/slides/semigroups.html">Semigroups</a>.</p>
<iframe src="/slides/semigroups.html" width="800" height="450"></iframe>
<a class="btn btn-default btn-xs" href="http://www.lyh.me/semigroups.html">more ...</a>
</div>
</article>
<hr/>

<ul class="pagination">
<li class="prev disabled"><a href="#">&laquo;</a></li>
Expand Down Expand Up @@ -571,11 +587,11 @@ <h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Social</span></h4>
<li class="list-group-item">
<h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Recent Posts</span></h4>
<ul class="list-group" id="recentposts">
<li class="list-group-item"><a href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">Automatic type-class derivation with&nbsp;Shapeless</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lambda-serialization.html">Lambda&nbsp;serialization</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lawfulness-of-aggregatebykey.html">Lawfulness of&nbsp;aggregateByKey</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/canbuildfrom.html">CanBuildFrom</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/decompiling-scala-code.html">Decompiling Scala&nbsp;code</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/implicits.html">Implicits</a></li>
</ul>
</li>
<!-- End Sidebar/Recent Posts -->
Expand Down
64 changes: 32 additions & 32 deletions author/neville-li2.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,37 @@
<div class="container">
<div class="row">
<div class="col-sm-9">
<article>
<h2><a href="http://www.lyh.me/semigroups.html">Semigroups</a></h2>
<div class="well well-sm">
<footer class="post-info">
<span class="label label-default">Date</span>
<span class="published">
<i class="fa fa-calendar"></i><time datetime="2016-09-21T19:22:00-04:00"> Wed 21 September 2016</time>
</span>



<span class="label label-default">Category</span>
<a href="http://www.lyh.me/category/code.html">code</a>


<span class="label label-default">Tags</span>
<a href="http://www.lyh.me/tag/scala.html">scala</a>
/
<a href="http://www.lyh.me/tag/fp.html">fp</a>
/
<a href="http://www.lyh.me/tag/scio.html">scio</a>
/
<a href="http://www.lyh.me/tag/data.html">data</a>

</footer><!-- /.post-info --> </div>
<div class="summary"><p>It&#8217;s been a while since my last post. Both <a href="https://github.com/spotify/scio">Scio</a> and Scala have been picking up a lot of momentum within <a href="https://www.spotify.com">Spotify</a> and a lot of people are starting to leveraging the power of <a href="https://github.com/twitter/algebird">Algebird</a>. So here&#8217;s another mini-talk on <a href="/slides/semigroups.html">Semigroups</a>.</p>
<iframe src="/slides/semigroups.html" width="800" height="450"></iframe>
<a class="btn btn-default btn-xs" href="http://www.lyh.me/semigroups.html">more ...</a>
</div>
</article>
<hr/>
<article>
<h2><a href="http://www.lyh.me/scio-a-scala-api-for-google-cloud-dataflow.html">Scio, a Scala <span class="caps">API</span> for Google Cloud&nbsp;Dataflow</a></h2>
<div class="well well-sm">
Expand Down Expand Up @@ -370,37 +401,6 @@ <h2><a href="http://www.lyh.me/using-cql-with-legacy-column-families.html">Using
</div>
</article>
<hr/>
<article>
<h2><a href="http://www.lyh.me/dotfiles-update.html">dotfiles&nbsp;update</a></h2>
<div class="well well-sm">
<footer class="post-info">
<span class="label label-default">Date</span>
<span class="published">
<i class="fa fa-calendar"></i><time datetime="2014-08-21T22:14:00-04:00"> Thu 21 August 2014</time>
</span>



<span class="label label-default">Category</span>
<a href="http://www.lyh.me/category/code.html">code</a>


<span class="label label-default">Tags</span>
<a href="http://www.lyh.me/tag/dotfiles.html">dotfiles</a>
/
<a href="http://www.lyh.me/tag/tmux.html">tmux</a>
/
<a href="http://www.lyh.me/tag/vim.html">vim</a>

</footer><!-- /.post-info --> </div>
<div class="summary"><p>I&#8217;ve been using my current <a href="http://www.lyh.me/dotfiles.html">dotfiles</a> setup for a while and felt it&#8217;s time to freshen up. I focused on updating the look and feel of Vim and tmux this&nbsp;round.</p>
<p>First I switched to <a href="https://github.com/tomasr/molokai">molokai</a> color theme for Vim, <a href="http://macromates.com/">TextMate</a> (monokai) and <a href="http://www.jetbrains.com/idea/">IntelliJ <span class="caps">IDEA</span></a> (using <a href="https://github.com/y3sh/Intellij-Colors-Sublime-Monokai">this</a>). I guess I grew tired of the old trusted <a href="http://ethanschoonover.com/solarized">solarized</a>, plus with my new MacBook Pro 13&#8221; at highest resolution, it just doesn&#8217;t feel sharp&nbsp;enough.</p>
<p>The <a href="https://github.com/Lokaltog/vim-powerline">vim-powerline</a> plugin I was using is being deprecated and replaced by <a href="https://github.com/Lokaltog/powerline">powerline</a>, which supports vim, tmux, zsh, and many others. However it requires Python and I had trouble using it with some really old Vim versions at work. So instead I switched to a pure VimL plugin, <a href="https://github.com/bling/vim-airline">vim-airline</a>. Not surprisingly there&#8217;s a companion plugin, <a href="https://github.com/edkolev/tmuxline.vim">tmuxline</a> for tmux as well. Both have no extra dependencies which is a big plus for me since I use the same dotfiles on Mac, my Ubuntu Trusty destop at work, and many Debian Squeeze&nbsp;servers.</p>
<p>I also updated a couple of other Vim plugins along the process, replacing <a href="https://github.com/garbas/vim-snipmate">vim-snipmate</a> with <a href="https://github.com/SirVer/ultisnips">ultisnips</a>, <a href="https://github.com/bitc/vim-bad-whitespace">vim-bad-whitespace</a> with <a href="https://github.com/ntpeters/vim-better-whitespace">vim-better-whitespace</a> (no pun intended), and adding <a href="https://github.com/airblade/vim-gitgutter">vim-gutter</a>. The biggest discovery is <a href="https://github.com/Lokaltog/vim-easymotion">vim-easymotion</a> though, perfect …</p>
<a class="btn btn-default btn-xs" href="http://www.lyh.me/dotfiles-update.html">more ...</a>
</div>
</article>
<hr/>

<ul class="pagination">
<li class="prev"><a href="http://www.lyh.me/author/neville-li.html">&laquo;</a>
Expand Down Expand Up @@ -450,11 +450,11 @@ <h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Social</span></h4>
<li class="list-group-item">
<h4><i class="fa fa-home fa-lg"></i><span class="icon-label">Recent Posts</span></h4>
<ul class="list-group" id="recentposts">
<li class="list-group-item"><a href="http://www.lyh.me/automatic-type-class-derivation-with-shapeless.html">Automatic type-class derivation with&nbsp;Shapeless</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lambda-serialization.html">Lambda&nbsp;serialization</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/lawfulness-of-aggregatebykey.html">Lawfulness of&nbsp;aggregateByKey</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/canbuildfrom.html">CanBuildFrom</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/decompiling-scala-code.html">Decompiling Scala&nbsp;code</a></li>
<li class="list-group-item"><a href="http://www.lyh.me/implicits.html">Implicits</a></li>
</ul>
</li>
<!-- End Sidebar/Recent Posts -->
Expand Down
Loading

0 comments on commit 38332c8

Please sign in to comment.