Jim Cheung

Monday, February 02, 2015

an even cooler tool for creating GIF screencasts of a terminal: mkcast

in vim, the asterisk key * will search for the word under the cursor. emacs doesn't have a built in function for it, but in elisp we trust:

(defun usrj/asterisk ()
 (interactive)
 (save-excursion
   (backward-word)
   (kill-ring-save (point) (progn
                             (forward-word)
                             (point)))
   (occur (substring-no-properties (car kill-ring)))))

Wednesday, February 04, 2015

yahoo open sources Kafka Manager (blog), looks nice.


the above usrj/asterisk function, using thing-at-point will be more concise:

(defun usrj/asterisk()
    (interactive)
    (save-excursion
        (occur (thing-at-point 'symbol))
        (other-window 1)))

also will switch to the occur buffer, type e can do instant editing.

copy line is easy too (which I do a lot under netbeans):

(defun usrj/copy-line-down()
    (interactive)
    (let ((line (thing-at-point 'line)))
        (forward-line 1)
        (insert line)))

but then I found thing-at-point inclues newline char (and slow), as suggested I switched to:

(let (line)
    (setq line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))

one more, a function to insert markdown link, it will fetch the url content and grab title tag as link description:

(defun usrj/md-link(url)
    (interactive (list(read-string "url: ")))
    (let (title buf)
        (with-temp-buffer
            (url-insert-file-contents url)
            (setq buf (buffer-string))
            (string-match "<title>\\(.*\\)</title>" buf)
            (setq title (match-string 1 buf))
            (message ""))
        (insert (concat "[" title "](" url ")"))))

Thursday, February 05, 2015

quick links


these are some Windows patched fonts for powerline, works with following characters:

  TMUX_POWERLINE_SEPARATOR_LEFT_BOLD=""
  TMUX_POWERLINE_SEPARATOR_LEFT_THIN=""
  TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD=""
  TMUX_POWERLINE_SEPARATOR_RIGHT_THIN=""


I still don't quite get what reactive means, Manning has few upcoming books on reactive programming:

first chapter of above books is free, which should be explaining what reactive is:

(from Reactive Web Applications with Play)

reactive programs:

four traits that make up reactive applications are:

Friday, February 06, 2015

knowing that Atom is moved to io.js, I think io.js has a more bright future than Node.js

but that's not what I'm interested in, ES6 is. more about ES6:


solved another emacs problem under windows – retrieving https content:

  1. get gnutls-3.x.x-w32-bin.zip
  2. unzip all .dll files from bin/ to emacs bin/
  3. restart emacs

Monday, February 09, 2015

display current DNS cache: ipconfig /displaydns


when reading first chapter of Reactive Web Applications with Play, few new concepts I didn't hear before:

Reactive Application Development explains What’s the difference between Message, Command, and Event?:

Events are something that has happened, which is an important distinction when compared to commands. You can reject a command as its a request to do something, whereas an event, you cannot reject because it represent something that has already occurred.

Wednesday, February 11, 2015

reading Play for Java and Practical Load Balancing

Play actually is very Symfony-like, much friendly than the spring framework.


this week's podcast:


DAGGER 2 - A New Type of dependency injection - YouTube

Friday, February 13, 2015

listened to More Languages! episode of the mostly erlang podcast, known that Seven More Languages in Seven Weeks is out.


this year I was planned to learn erlang and ocaml, but I'll add 3 more on the list (maybe next year): elixir, elm and julia.

Wednesday, February 18, 2015

quick read Modern PHP: New Features and Good Practices, few things I didn't notice before:

this book covers hhvm too.

there's a new blog post about new features in hhvm 3.6: Coming Soon in HHVM


when I tried to find out some questions about event loop and process (maybe I need to read some libuv, updated: I found what I want here, and I understand now why people say freebsd is better for node.js), I found this talk: Brian Ford: Is Node.js Better?, I like the way he talks and his talk is quite informative. but I couldn't find any talk he gave after 2012, then I know he changed his name to Brian Shirai

he's also creator or Rubinius and RubySpec (project ended)

happy lunar new year !

Sunday, February 22, 2015

some java 8 stuff

// infinite stream
Stream.iterate(1, n -> n + 1);

// use limit() to get a lazy stream
Stream.iterate(1, n -> n + 1).limit(10);

// stream can not be reused
// create a supplier of stream if want to reuse
Supplier<Stream> R = () -> Stream.iterate(1, n -> n + 1).limit(10);

R.get()... // stream

// range
IntStream.rangeClosed(1, 10);

IntStream.rangeClosed(1, 10).boxed(); // Stream

and about flatMap, an easy way to understand it is this figure

Tuesday, February 24, 2015

the latest episode of NodeUp is about libuv

Tuesday, February 24, 2015

a very interesting site: Many things about OCaml

reading Java 8 in Action, it's really good.

Thursday, February 26, 2015

RancherOS an interesting os for docker containers (20MB only?)

System Docker creates a special system service container called User Docker. A separate Docker daemon runs in the User Docker container.

looks nice, time to vagrant up:

git clone https://github.com/rancherio/os-vagrant.git
cd os-vagrant
vagrant up
vagrant ssh

another interesting project is The Recki Compiler Toolkit for PHP, heard from this post

Track JavaScript, AngularJS and jQuery errors with Google Analytics is worth trying too (even though I don't use google analytics myself)

listened Taylor Otwell on The Changelog podcast episode, it's good that php has it's heroku: Laravel Forge

Blog Archive