Skip to content

Instantly share code, notes, and snippets.

View CesarChaMal's full-sized avatar

Cesar Francisco Chavez Maldonado CesarChaMal

View GitHub Profile
import java.nio.charset.StandardCharsets
import java.nio.charset.Charset
def string = 'おっぱい - うほ'
def bytes = string.getBytes(StandardCharsets.UTF_8)
def toString = {byte[] bs, Charset cs -> new String(bs, cs) }
def toBytes = {String s, Charset cs -> s.getBytes(cs) }
@CesarChaMal
CesarChaMal / Basket.java
Created December 6, 2019 18:42 — forked from mauricioaniche/Basket.java
TDD for Professionals - Discount example
package module1.exercise.discount;
import java.util.List;
public class Basket {
private double amount;
private List<Item> items;
public Basket(List<Item> itemss) {
@CesarChaMal
CesarChaMal / Invoice.java
Created December 6, 2019 18:42 — forked from mauricioaniche/Invoice.java
TDD For Professionals - Mocks
package module2.exercise.mocks;
import java.util.Calendar;
public class Invoice {
private Calendar date;
private String customer;
private double amount;
public Invoice(Calendar date, String customer, double amount) {
@CesarChaMal
CesarChaMal / JitBitSQLAnswers.sql
Created December 4, 2019 12:00 — forked from rsepassi/JitBitSQLAnswers.sql
JitBit SQL Interview Questions Answered
-- JitBit SQL Interview Questions (Posted on Hacker News)
-- http://www.jitbit.com/news/181-jitbits-sql-interview-questions/?utm_source=hackernewsletter&utm_medium=email
-- Schema:
-- employees table
-- EmployeeID
-- DepartmentID
-- BossID
-- Name
-- Salary
@CesarChaMal
CesarChaMal / 1 - sql_interview_questions.md
Created December 4, 2019 11:57 — forked from mjhea0/1 - sql_interview_questions.md
Jitbit's SQL interview questions

While using git-bash, you may need the zip command to zip files. Then you will get error like “command not found“. This is because git-bash is really just a cut down version of mingw. Fortunately you can manually install the command yourself, not only zip, but any command you can get from gnuwin32.

Here are the steps you can follow.

  1. Go to the following link https://sourceforge.net/projects/gnuwin32/files/

  2. Find out whatever command you are missing Here I need zip and bzip2 for zip command. Because zip command relies on bzip2.dll to run. Otherwise you will get error “error while loading shared libraries: ?: cannot open shared object file: No such file or directory”.

@CesarChaMal
CesarChaMal / java-pom-template.xml
Created November 24, 2019 01:21 — forked from sparsick/java-pom-template.xml
Maven POM Template for Java Projects
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId></artifactId>
<version>1.0.0-SNAPSHOT</version>

CSS


What is CSS?

  • CSS stands for Cascading Style Sheet.
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files
@CesarChaMal
CesarChaMal / clean_code.md
Created October 4, 2019 13:17 — 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

@CesarChaMal
CesarChaMal / basic.sql
Created August 16, 2019 10:04 — forked from nesquena/basic.sql
PostgreSQL Common Utility Queries
/* How to calculate postgreSQL database size in disk ? */
SELECT pg_size_pretty(pg_database_size('thedbname'));
/* Calculate size of a table including or excluding the index */
SELECT pg_size_pretty(pg_total_relation_size('big_table'));
SELECT pg_size_pretty(pg_relation_size('big_table')); /* without index */
/* See indexes on a table with `\d tablename` */