Skip to content

Instantly share code, notes, and snippets.

View fernandor777's full-sized avatar
🏠
Working from home

Fernando Miño fernandor777

🏠
Working from home
  • Geosolutions
  • Ecuador
View GitHub Profile
@fernandor777
fernandor777 / clean_code.md
Created August 11, 2020 16:45 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@fernandor777
fernandor777 / PropertyLogger.java
Created January 28, 2019 15:30 — forked from sandor-nemeth/PropertyLogger.java
Spring Boot - Log all configuration properties on application startup
package de.idealo.ecommerce.order.history.config;
import java.util.Arrays;
import java.util.stream.StreamSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.AbstractEnvironment;
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@fernandor777
fernandor777 / SVN_Git_Mirror.md
Created October 8, 2017 00:36 — forked from ticean/SVN_Git_Mirror.md
SVN Git Mirror

Create Git Mirror from SVN Repository

This guide will demonstrate how to mirror an SVN into a Git repo. You're the target audience if you're an SVN user, just getting started with Git and need to coax your project team over to Git.

The branching scenario has been simplified for clarity.

References

@fernandor777
fernandor777 / postgres-cheatsheet.md
Created July 3, 2017 15:50 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

/**
* http://stackoverflow.com/questions/13459718/could-not-serialize-object-cause-of-hibernateproxy
*
* in bootstrap:
* import hbadapter.HibernateProxyTypeAdapter
*
* class BootStrap {
*
* def init = { servletContext ->
*

##注册一个servlet

@WebServlet(name = "captcha-servlet", value = "/getcaptcha")
public class CaptchaServlet extends HttpServlet {

}

GenericServlet要使用HttpServlet

/**
* This code uses Apache Chemistry (http://chemistry.apache.org/).
* License accords to Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;