Skip to content

Instantly share code, notes, and snippets.

Focusing coding

胡锋 hufeng

Focusing coding
View GitHub Profile
hufeng /
Created Nov 16, 2020
rust - command -demo
use std::env::args;
use std::process::Command;
fn main() {
// get command args
let arg: Vec<String> = args().collect();
// get compile filename
let filename = &arg[1];
println!("{}", filename);
// compile
View tag-string-demo
export const tpl = (strs: TemplateStringsArray, ...value: Array<Function>) => {
return (props: Object) => {
const merge = [] as Array<any>;
const params = => v(props));
const pLen = params.length;
const sLen = strs.length;
for (let i = 0; i < sLen; i++) {
View babel-add-default-demo.js
* Copyright (c) Facebook, Inc. and its affiliates.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
'use strict';
const declare = require('@babel/helper-plugin-utils').declare;
hufeng / nanjing.js
Created Dec 20, 2018
View nanjing.js
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
* 南京经度随机
hufeng / output
Created Oct 21, 2018 — forked from andrzejsliwa/output
Erlang tracing (nested and flat)
View output
~/erlang_learning $ erl
Erlang R15B03 (erts- [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.9.3.1 (abort with ^G)
(erlang_learning@> trace(recursive).
(erlang_learning@> recursive:fac(10).
call: <0.42.0> recursive:fac(10), level: 0
call: <0.42.0> recursive:fac(9), level: 1
call: <0.42.0> recursive:fac(8), level: 2
hufeng / rollup.config.js
Created Sep 10, 2018 — forked from EmielM/rollup.config.js
react-native rollup bundle attempt
View rollup.config.js
import fs from 'fs';
import path from 'path';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import replace from 'rollup-plugin-replace';
function findVersion(file, extensions) {
for (let e of extensions) {
hufeng /
Created Dec 5, 2017 — forked from staltz/
The introduction to Reactive Programming you've been missing
View gist:288aa7755d4bc62760e5
1. 以store为中心,校验声明式,配置规则和message,错误信息自动绑定到store
2. 异步直接走正常的逻辑,不直接支持
View gist:b5a4ac3138191e3fc981
* React支持es6的class语法,但是在class中并没有一个很好的概念来对应mixin
* 我们也要考虑弱化mixin
* 那怎么做呢?使用高阶函数来解决这个问题
* 但是有个难点还会是需要再想想,怎么把store的更新和react的render结合起来,做到透明
* 比如
View gist:5931330

Hot Swapping With Maven, Jetty and IntelliJ

Based on Configuring Jetty, Maven, and Eclipse together with Hot Swap

I've always been a bit jealous when it comes to the Play! framework and the great dev mode they have for hot swapping classes at runtime. Jetty has a configuration setting, scanIntervalSeconds, that mimics this when working with a more traditional WAR, but does so by looking for changes to a file and restarting the server.

Fortunately, Jetty also provides the ability to rapidly test code with hot swapping. No more server restarts. The trick to getting hot swapping to work is to attach a remote debugger to your Jetty process. The following instructions outline how to do this in IntelliJ (tested with IDEA 10.5 CE).

Modify your jetty-maven-plugin to ignore the scan interval

  1. Open your pom and locate the plugins section