How to Check if Struct Has a Method or Implement a Method

In Go Programming Language, we will use interface very often. And sometimes, there are some struct that implemented more than one interface. An example: type Model interface { PrimaryKey() string } type SecretModel interface { GetUnexportedField() []string } type exModel struct { ID uint Name string CreatedAt time.Time } func (exModel) GetPrimaryKey() string { return "ID" } func (exModel) GetUnexportedField() []string { return []string{"CreatedAt"} } type otherModel struct { ID uint Name string Description string CreatedAt time.
Read more →

300

Read more →

ReMap CtrlP in MacVim

Are you using MacVim and using CtrlP plugin? Have you ever found that pressing ctrl+p is not easy on mac? For me, it is faster when pressing cmd+p instead of pressing ctrl+p. That’s why i think i have disable or remap the key. In the official repository of CtrlP has been explained very well to changed this keymap. But, if you are using MacVim replacing the key to cmd+p is not as easy as it looks like.
Read more →

flask.ext.script Deprecated

Flask is one of the best Micro Framework that i’ve been using. It is based on Python, and it’s been a while since i was not using Python in Web Development. Tonight, i started to create some small web application using Flask. The recipe: - Flask (the Framework) - SQLAlchemy (ORM) - Flask Script (Manager) - Flask Migrate (Migration Tool) I use this small boilerplate https://github.com/BugisDev/flask-app to start my development. And it was run smoothly, until i noticed that flask.
Read more →

Removing File or Directory from Git Index

Have you ever found a problem when you ignoring files or directory on git, but it is still saying it’s modified? Well, i am. A lot. It is usually because the file or directory has been modified before and has been indexed on the git tree. What we need to do is removing it from the index. But, Using git rm won’t only remove it from the index but delete it too.
Read more →