Skip to content

Instantly share code, notes, and snippets.

View abruzzi's full-sized avatar
⌨️
Writing a React book - React Anti-Patterns

Juntao Qiu abruzzi

⌨️
Writing a React book - React Anti-Patterns
View GitHub Profile
@abruzzi
abruzzi / reduxSelectorPattern.md
Created January 31, 2018 03:02 — forked from abhiaiyer91/reduxSelectorPattern.md
Redux Selector Pattern

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':
      return action.data.items
    default:
export const getCollections = () => {
return (dispatch, getState) => {
const state = getState()
const params = {
priceLow: state.sidebar.lowPrice,
priceHigh: state.sidebar.highPrice
}
dispatch({
type: COLLECTION,
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(gulp.dest('app/css'))
.pipe(reload({ stream:true }));
});
source 'https://gems.ruby-china.org'
gem 'sinatra'
gem 'sinatra-websocket'
@abruzzi
abruzzi / sigma.fruchterman.js
Created May 25, 2017 07:47 — forked from sheymann/sigma.fruchterman.js
Fruchterman-Reingold layout plugin for Sigma.js with automatic cooling and stopping condition.
/**
* Linkurious 2012, all rights reserved.
* Sébastien Heymann <seb@linkurio.us>,
* Romain Yon <romain@linkurio.us>
*
* Please use http://jsbeautifier.org/ and indent with 2 spaces.
*
* Lib docs:
* http://twitter.github.com/bootstrap/
* http://docs.jquery.com/
@abruzzi
abruzzi / .block
Last active February 27, 2017 09:25
Sleeping records visualisation of my daughter
license: mit
scrolling: yes
@abruzzi
abruzzi / BankAccount.java
Created January 3, 2017 06:39 — forked from kt3k/BankAccount.java
BankAccount DCI example in Java
package org.kt3k.bankaccount;
public class BankAccount {
private String id;
private Integer balance;
public BankAccount(String id, Integer balance) {
this.id = id;
this.balance = balance;
@abruzzi
abruzzi / Doxyfile
Created December 6, 2016 10:57 — forked from atneik/Doxyfile
Ideal Doxyfile
# Doxyfile 1.7.5.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
@abruzzi
abruzzi / graphviz.sublime-build
Created June 10, 2016 05:49
graphviz in sublime text build system
{
"shell_cmd": "/usr/local/bin/dot -Tpng $file -o $file_path/$file_base_name.png && open $file_path/$file_base_name.png",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.dot"
}
@abruzzi
abruzzi / gist:7b75f60f82584d3405e6e5937918bc83
Created May 5, 2016 12:07 — forked from rnorth/gist:2031652
Cookie-based authentication with nginx
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}