Skip to content

Instantly share code, notes, and snippets.

@pereira-a
pereira-a / gist:e8c24daa2f9c318cec7824c3e48a00bf
Created March 5, 2021 18:31
get month's bussiness days (javascript)
function getWeeksInMonth(year: number, month: number) {
const weeks = [],
firstDate = new Date(year, month, 1),
lastDate = new Date(year, month + 1, 0),
numDays = lastDate.getDate();
let offset = 0;
if(firstDate.getDay() === 0) offset = 1;
else if(firstDate.getDay() === 6) offset = 2;
@pereira-a
pereira-a / Dockerfile
Last active March 11, 2020 09:53
Neo4j docker image w/ apoc plugin that imports cypher scripts
FROM neo4j:4.0.1
COPY apoc.conf /var/lib/neo4j/conf/
COPY import/* /var/lib/neo4j/import/
ENV NEO4JLABS_PLUGINS '["apoc"]'
ENV NEO4J_PASSWD test
@pereira-a
pereira-a / .gitlab-ci.yml
Last active April 10, 2019 14:47
Gitlab CICD stages to build a project, upload docker image to Google Container Registry and update the container of a pre configured Kubernetes Engine Project
services:
- docker:dind
stages:
- build
- package
- deploy
build:
stage: build
@pereira-a
pereira-a / ResultSetToJson.java
Last active March 29, 2019 00:14
Convert a SQL ResultSet to json format
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class ResultsetConverter {