Skip to content

Instantly share code, notes, and snippets.

View moyuanhuang's full-sized avatar

Moyuan Huang moyuanhuang

  • San Diego, CA
View GitHub Profile
@moyuanhuang
moyuanhuang / commit-msg
Last active May 1, 2020 23:53
Quick spelling check after commit
#!/usr/bin/env ruby
# frozen_string_literal: true
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary from
# https://cgit.freedesktop.org/libreoffice/dictionaries/tree/en
# You'll need to put both `.aff` and `.dic` file in "~/Library/Spelling"
@moyuanhuang
moyuanhuang / .vimrc
Last active May 10, 2022 06:48
Define vim terminal emulator's color scheme
" Add this in your ~/.vimrc
" The corresponding color matching is
" let g:terminal_ansi_colors = [
" \ '@guibase02', '@guired', '@guigreen', '@guiyellow',
" \ '@guiblue', '@guimagenta', '@guicyan', '@guibase2',
" \ '@guibase03', '@guiorange', '@guibase01', '@guibase00',
" \ '@guibase0', '@guiviolet', '@guibase1', '@guibase3'
" \]
" set the vim's terminal emulator color scheme
@speric
speric / poodir-notes.md
Last active May 15, 2024 13:39
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
@bowsersenior
bowsersenior / stooge_loader.rb
Created May 18, 2011 23:18
A demo of YAML anchors, references and nested values
require 'rubygems'
require 'yaml'
# A demonstration of YAML anchors, references and handling of nested values
# For more info, see:
# http://atechie.net/2009/07/merging-hashes-in-yaml-conf-files/
stooges = YAML::load( File.read('stooges.yml') )
# => {
# "default" => {