I have added sample code plugin on git hub so you can download and check it out.
below topic.
1) Code techniques I. Plugin II. Create table using plugin III. How to override action method using plugin IV. How to override service/modelfactory method using plugin V. How to use action filter using plugin VI. How to use Event consumer events using plugin VII. How to override view file using plugin