Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Passionate programmer

jianwu

💭
Passionate programmer
View GitHub Profile
@jianwu
jianwu / DIEverything.java
Last active Jun 19, 2019
A typical component in DI every approach
View DIEverything.java
public class OderSericeImpl implement OrderService {
private final ShoppingCartService cartService;
private final PricingService pricingService;
private final InventoryService inventoryService;
private final UserSession userSession;
private final TimeProvider timeProvider;
// ... and many more, this list will keep increasing when more requirements added
public OrderService(
ShoppingCartService cartService,
@jianwu
jianwu / mshell
Last active Oct 27, 2021
mshell: to run jshell for a maven project with all the dependancies injected.
View mshell
# Run this script from the maven module directory to start a jshell with
# all dependent class paths injected.
# Please never run it on the parent maven project directory.
# It depends on java9 or above
if [ ! -d "target" ]; then
echo "Please run it under a module directory. And make sure it's not parent module directory. And make a maven install first"
exit
fi
@jianwu
jianwu / static_server.js
Last active Oct 5, 2022 — forked from ryanflorence/static_server.js
Node.JS static file web server, also provides CORSProxy, Http/Https proxy function. Put it in your path to fire up servers in any directory, takes an optional port argument. If provide second https port argument, it will also start https. For https to work, need to put key and cert file in the folder.
View static_server.js
#!/usr/bin/env node
const { argv } = require('process');
/**
Static http server implemented with NodeJS.
Features:
1. No external dependencies