Skip to content

Instantly share code, notes, and snippets.

View RiansyahTohamba's full-sized avatar
💭
on learning

Riansyah Tohamba RiansyahTohamba

💭
on learning
View GitHub Profile
@RiansyahTohamba
RiansyahTohamba / percent_increase.rb
Last active January 12, 2022 22:54
measure percent of increase in source code
# delta_nom.rb
require 'sqlite3'
class Measurement
def initialize(project)
@db_path = "dch-jcodeodor/#{project}/sqlite-jcodeodor/database"
end
# db_sqlite berisi (before || after)
def get_nom(db_sqlite)
@RiansyahTohamba
RiansyahTohamba / example_promise.js
Created January 17, 2022 11:24
example of promise.js
function getProducts(url){
const promise = new Promise((resolve,reject) => {
const data = getData(url);
if(data.isExist()){
resolve(data.to_json());
}else{
reject("error");
}
})
stages:
- publish
- deploy
variables:
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
@RiansyahTohamba
RiansyahTohamba / nodejs-reminder-cron.js
Last active May 12, 2023 02:01
nodejs set reminder by using cron job
Here's an example of a Node.js script that sets a reminder for a certain date using the node-cron package:
// particular date
const cron = require('node-cron');
const reminderDate = new Date("2022-12-31 23:59:00");
const schedule = cron.schedule(reminderDate, () => {
console.log("Reminder: Do something!");
pipeline {
agent any
parameters {
booleanParam description: 'Is this a production deployment?', name: 'DEPLOY_PROD_PORTAL'
}
environment {
SSH_HOST = '10.2.xx.yyy'
SSH_USER = 'yaadmin'
@RiansyahTohamba
RiansyahTohamba / nodemailer_spy.js
Created May 23, 2023 03:46
Nodemailer testing without actually send Email
const Lab = require("@hapi/lab");
const { expect } = require("chai");
const sinon = require("sinon");
const nodemailer = require("nodemailer");
const { PASS_MAIL, USER_MAIL } = process.env;
const { init } = require("../server_test");
const {
describe, it, beforeEach, afterEach,