Skip to content

Instantly share code, notes, and snippets.


Juntao Qiu abruzzi

View GitHub Profile
abruzzi /
Created Sep 12, 2021 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

View detail-chart.js
function detailChart(categories) {
var width = 800,
height = 800;
var outerRadius = 300;
var ratingScale = 45;
var references = [];
View shape-chart.js
function shapeChart(categories) {
var width = 200,
height = 200;
var outerRadius = 50;
var ratingScale = 10;
var angle = d3.scaleLinear()
.range([0, 2 * Math.PI]);
abruzzi / .block
Created May 21, 2019 — forked from mbostock/.block
Stacked Radial Area
View .block
license: gpl-3.0
View SketchSystems.spec
My Awesome Sketch
First State
some event -> Second State
Second State

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
View actions.js
export const getCollections = () => {
return (dispatch, getState) => {
const state = getState()
const params = {
priceLow: state.sidebar.lowPrice,
priceHigh: state.sidebar.highPrice
View gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('sass', function() {
return sass('app/scss/main.scss')
.pipe(reload({ stream:true }));
View Gemfile
source ''
gem 'sinatra'
gem 'sinatra-websocket'