Skip to content

Instantly share code, notes, and snippets.


Richard Osmar Leon Ingaruca jrichardsz

View GitHub Profile
jrichardsz /
Created Dec 13, 2021
JDBC mock for tests:
//initial source:
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
View java database
public ArrayList<?> executeSimpleScriptString1(String engine, String host, int port, String sid,
String user, String password, String sqlString) throws Exception {
Connection c = getConnection(engine, host, port, sid, user, password);
try {
* CallableStatement cs = c.prepareCall(sqlString); cs.execute();
Statement stmt = c.createStatement();
View java string
public static HashMap<String, String> severalKeyValuesInlineToMap(String rawVariables) {
String rawPairs[] = rawVariables.split("\\s+");
HashMap<String, String> params = new HashMap<String, String>();
for (String rawPair : rawPairs) {
String[] pair = rawPair.split("=");
if (pair.length == 2 && pair[0] != null && pair[1] != null) {
params.put(pair[0], pair[1]);
return params;
jrichardsz / java maven like young languages, javashell,
Created Nov 27, 2021
java maven like young languages, javashell, mavenshell
View java maven like young languages, javashell,
  • create starter
mvn archetype:generate -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  • add logic
nano src/main/java/com/mycompany/app/
  • build
View api microservice
View google apps script

entire column range

function sumHours(range) {
  return JSON.stringify(range);

is an array of items in which any item is another array containg the cell value, in this case the row

jrichardsz / mermaid code as diagram,
Last active Nov 5, 2021
mermaid code as diagram, codeasdiagram
View mermaid code as diagram,
<!doctype html>
<html lang="en">
  <meta charset="utf-8">

  <title>ACME Projects</title>
  <meta name="description" content="The HTML5 Herald">
  <meta name="author" content="SitePoint">
jrichardsz / docker aws
Last active Oct 22, 2021
docker aws snippets , dockeraws dockerawssnippet
View docker aws

Dockerfile v1

FROM amazon/aws-cli
COPY /usr/local/bin/
RUN chmod 744 /usr/local/bin/

jrichardsz / docker run.log
Last active Oct 20, 2021
openxava with maven and docker
View docker run.log
Sending build context to Docker daemon 11.41MB
Step 1/36 : FROM openjdk:8-jdk AS BUILDER
---> eca41db787bd
Step 2/36 : ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 ANT_VERSION=1.10.11 ANT_MIRROR= ANT_HOME=/opt/ant
---> Using cache
---> a4ca03d88e6c
Step 3/36 : RUN apt-get update && apt-get install -y --no-install-recommends wget && wget --no-check-certificate --no-cookies ${ANT_MIRROR}/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && ln -sf /opt/apache-ant-${ANT_VERSION} /opt/ant && rm -f apache-ant-${ANT_VERSION}-bin.tar.gz* && update-alternatives --install /usr/bin/ant ant /opt/ant/bin/ant 1000 && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 63f5ca91441b
Step 4/36 : ARG MAVEN_VERSION=3.5.2