Skip to content

Instantly share code, notes, and snippets.

View zzmjohn's full-sized avatar

John Zhang zzmjohn

View GitHub Profile
@zzmjohn
zzmjohn / init.vim
Created September 3, 2020 00:25 — forked from benawad/init.vim
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
@zzmjohn
zzmjohn / vim-cheatsheet.md
Created September 3, 2020 00:24 — forked from 0xadada/README.md
VIM movement, keyboard commands and shortcuts
@zzmjohn
zzmjohn / min-char-rnn.py
Created January 22, 2017 01:51 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@zzmjohn
zzmjohn / 00-about-search-api-examples.md
Last active August 29, 2015 14:25 — forked from jasonrudolph/00-about-search-api-examples.md
5 entertaining things you can find with the GitHub Search API
@zzmjohn
zzmjohn / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

"Why You Don't Get Mock Objects" by Gregory Moeck

RubyConf 2011 | 2011-09-29 | Gregory Moeck (@gregmoeck) | Slides

  • Recommended as the best book on mocks: Growing Object-Oriented Software, Guided by Tests by Steve Freeman & Nat Pryce
  • Common arguments against mocks
    • They duplicate implementation
    • They lead to brittle tests
  • Mock objects + procedural programming = bad idea
  • If you're doing traditional Rails development (which tends to follow more of a "procedural", do-this-and-then-do-that style), mock objects probably aren't for you
@zzmjohn
zzmjohn / usage:ri
Last active December 17, 2015 11:39 — forked from jordelver/gist:3729761
usage:ri
# 5 Reasons You Should Use ri To Read Ruby Documentation
http://jstorimer.com/ri.html
http://samuelmullen.com/2012/01/up-and-running-with-ruby-interactive-ri/
https://github.com/danchoi/ri.vim
## Make sure docs are generated for gems
In `~/.gemrc`
@zzmjohn
zzmjohn / gist:5603750
Last active December 17, 2015 11:39 — forked from jordelver/gist:3818839
blog:Functional-TDD

Functional TDD: A Clash of Cultures - Kent Beck

https://www.facebook.com/notes/kent-beck/functional-tdd-a-clash-of-cultures/472392329460303

I have been taking Bryan O'Sullivan's excellent Haskell course and noticed something during the homework: TDD wasn't working for me, at least not as I apply it in object languages. This has forced me to take a step back and rethink what is really essential about TDD and what is an artifact of the languages I have been using.

A warning: I'm only on week two of the course. I did quite a bit of functional programming in the Dinosaur Computing Era, so the style is familiar, but everything contained herein is subject to change. I'm mostly just thinking aloud (and hoping for contributed wisdom.)

When I use TDD with an object language like Smalltalk, Java, or PHP I typically start programming with a trivial case--a List with no elements, for example. Working through it encourages me (sounds better than "forces") to think about the metaphors I am using and style of the API

@zzmjohn
zzmjohn / usage:base64
Last active December 17, 2015 11:39 — forked from jordelver/gist:3819526
usage:base64
# base64 encoding and decoding
Useful for decoding email message attachments
Source: http://superuser.com/questions/120796/os-x-base64-encode-via-command-line
## To decode from Base64
openssl base64 -d -in <infile> -out <outfile>