Skip to content

Instantly share code, notes, and snippets.

Jiayu Liu Jimexist

View GitHub Profile
View Makefile
SUBDIRS := $(wildcard files/*)
all: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
.PHONY: all $(SUBDIRS)
@Jimexist
Jimexist / StreamDemo.java
Created Nov 21, 2016
Java 8 streaming API example
View StreamDemo.java
package com.madadata.demo.stream;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.common.io.Resources;
import io.dropwizard.jackson.Jackson;
import java.io.IOException;
import java.math.BigDecimal;
View MonadTransformer.hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where
import qualified Control.Exception as E
import qualified Data.Bifunctor as BF
import qualified Data.Bool as B
import qualified Data.Char as C
import Options.Applicative
@Jimexist
Jimexist / settings.xml
Created Jul 28, 2016
Bintray Maven Settings
View settings.xml
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd' xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<mirrors></mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
View keybase.md

Keybase proof

I hereby claim:

  • I am Jimexist on github.
  • I am jiayu (https://keybase.io/jiayu) on keybase.
  • I have a public key whose fingerprint is 12D0 7ECE 5A8A 644F 6F3F EC1D E41C ED27 BCB3 CB4E

To claim this, I am signing this object:

@Jimexist
Jimexist / caravel.sql
Created May 30, 2016
Caravel Data Model
View caravel.sql
CREATE TABLE ab_view_menu (
id INTEGER NOT NULL,
name VARCHAR(100) NOT NULL,
PRIMARY KEY (id),
UNIQUE (name)
);
CREATE TABLE ab_permission (
id INTEGER NOT NULL,
name VARCHAR(100) NOT NULL,
PRIMARY KEY (id),
View 1. Writing test is very important.md

Test early, test often, test automatically

  • The pragmatic programmer.
View process.py
from functools import wraps
import csv
import json
import re
from collections import namedtuple
Item = namedtuple('Item', 'country group_id group name name_id month value')
def until_empty(func):
@wraps(func)
@Jimexist
Jimexist / design for reuse.md
Last active Apr 8, 2016
Java short tutorials
View design for reuse.md

Design for reuse

You should aim to design for reuse, otherwise, hide it!

The reasoning behind this is that your users, including yourself in future, will naturally ignore any documentation and convention that you put in code, and use it the way they like.

If you design the class, you should aim for reusability and otherwise hide them, leaving yourself with leeway to redo.

@Jimexist
Jimexist / immutability.md
Last active Apr 4, 2016
Java short tutorials
View immutability.md

Prefer immutable objects by default

POJO

public class Person {
  
  private firstName;
  private lastName;
  private email;
You can’t perform that action at this time.