2017.06.03

This is a very detailed guide on how to add syntax highlighting in Jekyll (Github Pages). Basically, rouge will slice the codes accordingly into separate HTML tags, the css will color it according to your theme. kramdown is the Markdown processor supported in Github Pages. What I did on my Jekyll Bootstrap:

  1. Install rouge and kramdown to generate css and render locally in the same manner as Github Pages.
     gem install kramdown rouge
    
  2. Update _config.yml
     markdown: kramdown
     highlighter: rouge
     kramdown:
       input: GFM #Github Flavored Markdown
       hard_wrap: false  
       syntax_highlighter: rouge
    
  3. Create css file to color the syntax. I use the Bootstrap-3 theme.
     rougify style monokai > assets/themes/bootstrap-3/css/syntax.css  
    
  4. Add css link in <head> in _includes/themes/bootstrap-3/default.html.
     <link href="/css/syntax.css" rel="stylesheet">  
    

Jekyll 3.3.1 did not render the indented code block for numbered lists correctly. When I did bundle update and was updated to jekyll 3.4.3, it showed up fine.

2017.06.02

As I understand it.

  • Functional programming: Opposed to object-oriented programming, the return value of a function does not depend on the state of the object, ie. it will always be the same given the same argument.
  • First-class functions: A language can either have first-class functions or not. It can: return a function, create an array of functions (source).
  • Higher-order functions: Functions that can take functions as input (arguments) or output (return value).

These three are characteristically used by languages with first class functions.

  • Anonymous functions: Functions defined without a name.
  • Closure: When defining a function inside a function, the inner function has access to the arguments given to the outer function (source). Example in JavaScript:

    function makeCounter (a) {
    var b = a;
    return function (c) {
      b += c;
      return b;
    }
    }
    var x = makeCounter(1);
    x(2); //returns 3
    x(3); //returns 6
    makeCounter(1)(3); //returns 4
    
  • Lambda expression: Most likely is an anonymous function, but not always. A shorter way to write functions. Comes from the concept of lambda calculus. \( \lambda x.x^{2} \) is the lambda expression for the function \( f(x) = x^{2} \). Lambda is usable in a language because the functions are first class (source).
2017.05.19

Japanese

  • compile with xelatex
  • \usepackage{xeCJK}
  • default fonts need to be set for macOS. I used \setCJKmainfont{Hiragino Mincho Pro W3} for the serif font

Extra Latex packages with MacPort

Installing Latex with MacPorts wastes harddisk space, since I’d have to download single .stys in bulk packages. I have yet to try installing MacTeX in this Mac, so bulky MacPorts for now.

2017.01.21

I used to use PlainText long time ago. I just found out that they stop the support and somehow I couldn’t find it in the AppStore. I was looking for an alternative, and found this awesome site which lists all iOS Text Editors.

After trying several stuff, I found UpWord. It syncs to an Apps folder in Dropbox smoothly, including deleting files and adding files through and from other computer. It has this cool swipe gesture to change the format of a line. Awesome. It seems to have a reminder function as well, but being able to edit the text is enough for me.

2015.08.03

It didn’t work for me the first time (was stuck at the preparing for install screen), so I guess the order of the rEFInd and partition are important. Reference.

I use a Macbook Alu (late 2008) with clean fresh install of Yosemite.

Step 1

Download Ubuntu for Mac. I used ubuntu-14.04.2-desktop-amd64+mac.iso.

Make boot drive of Ubuntu. The instructions using dd command didn’t work for me. Probably because I use a partitioned harddrive instead of a USB stick? Anyways, I ended up burning the iso file instead. The instructions from Ubuntu works well.

Step 2

Install rEFInd. Basically download the file (I used refind-bin-0.8.7) and run the install.sh script. Shut down the computer and power on again, you should see the different boot screen.

Step 3

Make the partition of the OS X smaller to make space for Ubuntu with Disk Utility. Do not make a new partition (I did it the first time, may be this was the problem).

Step 4

Restart and boot to the Ubuntu DVD. Choose Install Ubuntu alongside Mac OS X. And I had no problem booting into Ubuntu, except… my Wi-Fi is not working.