Skip to content

Instantly share code, notes, and snippets.

View ederrafo's full-sized avatar

Eder Rafo Jose Pariwana Espinhal ederrafo

View GitHub Profile
@ederrafo
ederrafo / phpunit-laravel.md
Last active April 28, 2023 00:31
phpunit test

ExampleTest basic

<?php

namespace Tests\Feature;

use Tests\TestCase;
@ederrafo
ederrafo / bigdecimal.md
Last active December 25, 2023 22:29
java bigdecimal
0 : if value of this BigDecimal is equal to that of BigDecimal object passed as parameter.
1 : if value of this BigDecimal is greater than that of BigDecimal object passed as parameter.
-1 : if value of this BigDecimal is less than that of BigDecimal object passed as parameter.
  if (accountingInvoice.getRetention().getAmount().compareTo(BigDecimal.ZERO) == 1) {
   hasRetention = true;
<?php
private function restTemplate($method, $uriTemplate, $request, $logging = [])
{
$account_id = null;
if (isset($request['accountId'])) {
$account_id = $request['accountId'];
}
$pnr = null;
if (isset($request['reference'])) {
@ederrafo
ederrafo / breadcrumbs
Created January 31, 2023 16:19
thymeleaf breadcrumb
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page" th:each="breadcrumb, i : ${breadcrumbs}" >
<th:block th:switch="${breadcrumb.last}">
<th:block th:case="true"> <span th:text="${breadcrumb.name}"></span></th:block>
<th:block th:case="false"><a th:href="${breadcrumb.href}" th:text="${breadcrumb.name}">name</a></th:block>
</th:block>
</li>
</ol>
@ederrafo
ederrafo / ReflectionUtils.java
Last active April 27, 2023 05:29
junit java test
private ItemGroupTransfer itemGroupTransfer;
@Before
public void setUp() {
businessData = SupportTest.getBusinessData();
itemGroupTransfer = new ItemGroupTransfer(
correlativeServiceStub, apiConnectorMock, saleInformationRepositoryMock);
ReflectionTestUtils.setField(itemGroupTransfer, "refundIgvConnector", refundIgvConnector);
ReflectionTestUtils.setField(itemGroupTransfer, "contractService", contractService);
ReflectionTestUtils.setField(itemGroupTransfer, "zMerxService", zMerxService);
<form method="POST" th:action="@{/expenses/plannings/update}"
th:object="${planBranchReport}">
<input type="hidden" name="id" th:value="${ planBranchReport.id }">
<input type="hidden" name="status" value="V">
<input type="hidden" name="branch" th:value="${planBranchReport.branch}">
<input type="hidden" name="name" th:value="${officeName}">
<button th:if="${planBranchReport.status == 'O'}" type="submit"
class="btn btn-success" onclick="if (confirm('Esta Usted seguro?')) {
return true;
@ederrafo
ederrafo / vagrantfile
Created January 17, 2023 05:03
vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@PostMapping({"/expenses/plannings/insert"})
public String insertDistribution(RedirectAttributes redirectAttributes, @ModelAttribute PlanBranch planBranch,
BindingResult result) {
PlanBranchRS planBranchRS = planningService.store(planBranch);
redirectAttributes.addFlashAttribute("success", planBranchRS.isSuccess());
redirectAttributes.addFlashAttribute("message", planBranchRS.getMessage());
return "redirect:/expenses/plannings/" + planBranch.getBranch() + "/" + planBranch.getName();
}
@ederrafo
ederrafo / junittest.md
Last active April 8, 2023 04:03
junit test

test @bean from file json

package tech.zdev.payment.bot.bean;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@ederrafo
ederrafo / dockerfile.md
Last active December 7, 2022 23:19
docker dockerfile

Dockerfile

Contiene todos las instrucciones necesarias para crear una imagen donde corra nuestra aplicacion
Dockerfile + docker image build + imagen
Las imagenes 

Creamos una imagen de ejemplo

$ touch ~/dockerfiles/sample/Dockerfile