Skip to content

Instantly share code, notes, and snippets.

@lilac
lilac / Android_notes.md
Created November 3, 2015 05:59
Notes on Android development

Android's bad design

  • Force context object everywhere in the apis, without guaranteeing the context passed is usable, since every context has their own life cycles. This is a problem especially in asynchronous tasks or callbacks. When methods are called asynchronously, the contexts passed in may not be usable.
@lilac
lilac / pushup.sh
Created December 16, 2015 01:12
git push to upstream
#!/usr/bin/env bash
branch=`git rev-parse --abbrev-ref HEAD`
git push origin -u $branch:branches/$branch $@
@lilac
lilac / PullADB.md
Last active March 6, 2016 23:36
Pull files in the app's internal data dir

Q: How to bash source env vars in an env file for docker?

A: In bash, execute commands below:

set -a
[ -f .env ] && . .env
set +a
@lilac
lilac / 0_reuse_code.js
Last active September 8, 2017 12:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
let f = (a, b) => { return a+b; }
@lilac
lilac / red_packet.sql
Created November 15, 2017 13:06
Conditional insert into log
insert into red_packet select 3, 20.0 from red_packet having sum(amount) < 10;
@lilac
lilac / messages.md
Last active January 22, 2018 12:50
登顶大会新方案消息设计

玩家的回答

{
  "type": "answer",
  "payload": {
    "$question_id": "A" // 问题id -> 选项
  }
}
@lilac
lilac / makeTemplate.js
Created March 29, 2018 12:11 — forked from malko/makeTemplate.js
dynamic es6 template string to template methods
//const tpl = makeTemplate('hello ${name}')
//const name = 'world';
//tpl({name});
const makeTemplate = (templateString) => {
return (templateData) => new Function(`{${Object.keys(templateData).join(',')}}`, 'return `' + templateString + '`')(templateData);
}
@lilac
lilac / maven-dep-tree.sh
Created April 9, 2019 05:59
Inspect maven dependency tree of a specific library
mvn dependency:tree -Dverbose -Dincludes=com.google.guava