<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Livvie Lin</title>
    <description>Software Engineer</description>
    <link></link>
    <atom:link href="/feed.xml" rel="self" type="application/rss+xml" />
    
      <item>
        <title>Demystify Angular Controller $scope vs. this</title>
        <description>&lt;p&gt;There are two main patterns we can use to construct controller functions in Angular.  The classic way is to use &lt;code&gt;$scope&lt;/code&gt; to link controllers to views as such:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;// View: &amp;lt;div ng-controller=&amp;#39;LabController&amp;#39;&amp;gt;&amp;lt;/div&amp;gt;
app.controller(&amp;#39;LabController&amp;#39;, function ($scope) {
  $scope.labEquipment = {
    labEquipmentProperty: &amp;#39;Some value&amp;#39;
  };
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since Angular version 1.2.0, we could use the &lt;code&gt;this&lt;/code&gt; and &lt;code&gt;Controller as&lt;/code&gt; syntax:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;// View: &amp;lt;div ng-controller=&amp;#39;LabController as lab&amp;#39;&amp;gt;&amp;lt;/div&amp;gt;
app.controller(&amp;#39;LabController&amp;#39;, function () {
  this.labEquipment = {
    labEquipmentProperty: &amp;#39;Some value&amp;#39;
  };
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These two paradigms are generally interchangeable.  However, binding properties to the view using &lt;code&gt;$scope&lt;/code&gt; is an expensive operation, so the use of &lt;code&gt;this&lt;/code&gt; can be advantageous for keeping &lt;code&gt;$scope&lt;/code&gt; uncluttered.  But when using &lt;code&gt;this&lt;/code&gt;, make sure to check that it is bound the the proper scope!&lt;/p&gt;

&lt;p&gt;Whichever paradigm you choose, remember that the use of one pattern over another should remain consistent within an application, and &lt;code&gt;$scope&lt;/code&gt; does need to be injected into the controller to use &lt;code&gt;$scope&lt;/code&gt; functions such as &lt;code&gt;$watch&lt;/code&gt; and &lt;code&gt;$digest&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Check out the resources below for a more in-depth exploration of &lt;code&gt;$scope&lt;/code&gt; and &lt;code&gt;this&lt;/code&gt; syntax.&lt;/p&gt;

&lt;h5&gt;Resources&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://toddmotto.com/digging-into-angulars-controller-as-syntax/&quot; target=&quot;_blank&quot;&gt;Digging into Angular&amp;#39;s &amp;quot;Controller as&amp;quot; syntax&lt;/a&gt; by Todd Motto&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://toddmotto.com/rethinking-angular-js-controllers/
&quot; target=&quot;_blank&quot;&gt;Rethinking AngularJS Controllers&lt;/a&gt; by Todd Motto&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.johnpapa.net/do-you-like-your-angular-controllers-with-or-without-sugar/&quot; target=&quot;_blank&quot;&gt;Do You Like Your Angular Controllers with or without Sugar?&lt;/a&gt; by John Papa&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Tue, 20 Oct 2015 00:00:00 +0000</pubDate>
        <link>/Demystify-Angular-Controller-$scope-vs-this/</link>
        <guid isPermaLink="true">/Demystify-Angular-Controller-$scope-vs-this/</guid>
      </item>
    
      <item>
        <title>Start a Blog with Jekyll and GitHub Pages</title>
        <description>&lt;p&gt;In starting this blog, one of the first questions I considered was which blogging platform I should use.  My initial top choice was WordPress, but in the end I decided to go with Jekyll and GitHub Pages.  If you&amp;#39;re familiar with GitHub, Jekyll is a great blogging platform that provides simplicity and speed.&lt;/p&gt;

&lt;h5&gt;Content Management System (CMS) or Static Website&lt;/h5&gt;

&lt;p&gt;WordPress and other similar platforms are Content Management Systems (CMS) that use databases to store content.  Content Management Systems are very powerful applications, but if you only need a static site, like I did for my blog, CMS dynamic code and database calls can unnecessarily slow down loading time.&lt;/p&gt;

&lt;p&gt;On the other hand, Jekyll is a static blog generator that compiles all files into static HTML before publication and has no database, which is great for loading speed.  Essentially, Jekyll is a minimalist platform, with the bonus of free GitHub Pages hosting.  If you don&amp;#39;t need the added complexity of a dynamic blog, Jekyll is a solid choice.&lt;/p&gt;

&lt;p&gt;If you need some help deciding whether a CMS or static website is right for you, check out &lt;a href=&quot;http://www.dmgbluegill.com/blog/content-management-system-cms-or-static-website-which-right-you&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;h5&gt;Quickstart Guide to Jekyll&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;Fork an existing Jekyll template.  I used &lt;a href=&quot;https://github.com/barryclark/jekyll-now&quot; target=&quot;_blank&quot;&gt;Jekyll Now&lt;/a&gt; to start, but you can find some other great themes 
&lt;a href=&quot;https://github.com/jekyll/jekyll/wiki/Themes&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click the Settings button on your forked repository and change the repository name to &lt;code&gt;yourusername.github.io&lt;/code&gt;, replacing &lt;code&gt;yourusername&lt;/code&gt; with your GitHub handle.  Your website should go live within a couple minutes and be accessible from &lt;code&gt;http://yourusername.github.io&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Edit the &lt;code&gt;_config.yml&lt;/code&gt; file and save the changes to your repository.  There are two main ways to edit the blog and publish the changes:

&lt;ul&gt;
&lt;li&gt;Clone the repository onto your local machine, edit the file, and commit and push the changes to GitHub.&lt;/li&gt;
&lt;li&gt;Make changes to the file in the browser on GitHub by navigating to the file in your repository and clicking the pencil icon to edit.  Edit the file and commit the changes.
&lt;img src=&quot;/images/githubEdit.png&quot; alt=&quot;alt text&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Edit the &lt;code&gt;about.md&lt;/code&gt; file to change the content on the About page.&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;Previewing Your Blog Locally&lt;/h5&gt;

&lt;p&gt;If you&amp;#39;re editing your blog locally, you may want to preview your blog on your local machine before pushing your commits.  To do this, first make sure you have &lt;a href=&quot;https://www.ruby-lang.org/en/&quot; target=&quot;_blank&quot;&gt;Ruby&lt;/a&gt; and &lt;a href=&quot;https://rubygems.org/&quot; target=&quot;_blank&quot;&gt;Ruby Gems&lt;/a&gt; installed.  Then run the following commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem install jekyll&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem install github pages&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, in your blog&amp;#39;s repository, run &lt;code&gt;jekyll serve&lt;/code&gt; in the command line and navigate to &lt;code&gt;http://localhost:4000&lt;/code&gt; in the browser to see your blog!&lt;/p&gt;

&lt;h5&gt;Writing a Blog Post in Jekyll&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;For your first post, edit the &lt;code&gt;/_posts/2014-3-3-Hello-World.md&lt;/code&gt; file on your local repository or on GitHub.&lt;/li&gt;
&lt;li&gt;Update the title at the top of the Markdown file.  The variables at the top between the triple&amp;#45;dashed lines are called front matter, which you can read more about &lt;a href=&quot;http://jekyllrb.com/docs/frontmatter/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Rename the file name to include the date and title of the post in the format &lt;code&gt;year-month-day-title.md&lt;/code&gt;.  Jekyll requires this format for your posts&amp;#39; file names.&lt;/li&gt;
&lt;li&gt;Preview the post either on GitHub or on your local machine.  Commit and save the changes.&lt;/li&gt;
&lt;li&gt;For future blog posts, create a new file in the &lt;code&gt;_posts&lt;/code&gt; folder.  You can create a new file either in your local repository, or on GitHub by navigating to the &lt;code&gt;_posts&lt;/code&gt; folder in your remote repository and clicking on the &lt;code&gt;+&lt;/code&gt; icon.  Remember to format the file name correctly and include the front matter, which is set at the top of the file between triple&amp;#45;dashed lines.
&lt;img src=&quot;/images/githubAddPost.png&quot; alt=&quot;alt text&quot;&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Blog posts are generally written in Markdown.  A great reference is this &lt;a href=&quot;https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet&quot; target=&quot;_blank&quot;&gt;Markdown Cheatsheet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy blogging!&lt;/p&gt;
</description>
        <pubDate>Sat, 10 Oct 2015 00:00:00 +0000</pubDate>
        <link>/Start-A-Blog-With-Jekyll-And-GitHub-Pages/</link>
        <guid isPermaLink="true">/Start-A-Blog-With-Jekyll-And-GitHub-Pages/</guid>
      </item>
    
  </channel>
</rss>