Skip to content

Instantly share code, notes, and snippets.

@huangzhuolin
huangzhuolin / create-django-modal-diagram.sh
Created June 15, 2018 09:35
[Generate (and view) a graphviz graph of app models] #mac #python #django
# mac os
brew install graphviz
pip install pygraphviz
pip install django-extensions
python manage.py graph_models trees -o test.png
@huangzhuolin
huangzhuolin / my-controller.js
Created June 7, 2018 05:28
[access search parameters(or $routeParams) in controller with `$inject`] #angularjs
constructor($scope, $injector) {
this.$injector = $injector;
this.$scope = $scope;
// ...
// access url params
someFunc(){
const routeParams = this.$injector.get("$routeParams");
const searchParams = this.$injector.get("$location").search();
// ...
@huangzhuolin
huangzhuolin / panel_ctrl.ts
Last active June 7, 2018 05:15
[grafana panel add/remove tag dynamically] fix: when dynamically remove and add tag, tab template and directive is not updated correctly #grafana #angularjs
// ...
export class PanelCtrl {
// ...
addEditorTab(title, directiveFn, index?) {
let editorTab = { title, directiveFn };
if (_.isString(directiveFn)) {
editorTab.directiveFn = function() {
return { templateUrl: directiveFn };
@huangzhuolin
huangzhuolin / deploy-create-react-app-with-nginx.md
Last active October 9, 2024 19:52
[Deploy create-react-app(react-router) with nginx] #react #nginx

Create-react-app

Create React apps with no build configuration.

Thanks to create-react-app. It's saves a lot of my time. I remember several months ago I had to setup a lot just for a react app, webpack, babel, test environment and so on... Fortunately, everything becomes easy now. Though you have many choices of start boiler plate, you worth trying this.

React router

If you are build a SPA with react, you probably use react-router.