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 / apt-key.md
Last active December 22, 2019 23:15
linux ubuntu apt-key keys ubuntu key server
  • apt-key add adds a key to /etc/apt/trusted.gpg by default.

These keys are from Ubuntu repositories:

Lists all keys installed in the system;

sudo apt-key list 

Remove it by running:

<?php
$url = API;
$url .= '/resource/refresh/0/format/json';
$login = DIGEST_AUTH_USER . ':' . DIGEST_AUTH_PWD;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, $login);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
$result = curl_exec($curl);
$json = json_decode($result, true);
@ederrafo
ederrafo / java-spring-controllers.md
Last active December 16, 2019 21:29
java spring controllers

Various sample of methods GET

Sample 5

In Controller:

@GetMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<MyEntityRS> search(
    @RequestParam(value = "code") String code,
    @RequestParam(value = "name", required = false) String name) {
    return myEntityService.search(code, name);
@ederrafo
ederrafo / laravel-code.md
Last active December 6, 2019 19:01
laravel code
@if (auth()->user()->can('show User'))
if(!$user->hasRole('jefe-cuentas-cobrar')){
}

When using a many-to-many relation in Laravel, you should use the attach() function to link models. So in this case, you can do the following: App\user::find(14)->skill()->attach(1);

@ederrafo
ederrafo / java-spring.md
Created November 27, 2019 15:18
java spring framework
IncorrectResultSizeDataAccessException
public class IncorrectResultSizeDataAccessException extends DataRetrievalFailureException

Data access exception thrown when a result was not of the expected size, for example when expecting a single row but getting 0 or more than 1 rows.

@ederrafo
ederrafo / java-intefaces.md
Created November 27, 2019 15:14
java interfaces

Segregacion de interfaces en java spring

@ederrafo
ederrafo / mongo_shell.md
Last active May 2, 2025 16:43
noSQL mongo

mongo check verison

db.version()

create database and collection

use salesupdatedb
db.createCollection("myCollection")
@ederrafo
ederrafo / java-spring-mongo.md
Last active April 13, 2025 17:13
java spring mongo

query case insensitive

Criteria regex = Criteria.where("name").regex(".*" + queryCriteria.getName() +".*", "i");
query.addCriteria(regex);
@ederrafo
ederrafo / maven-commands.md
Last active September 8, 2022 05:46
maven jconn

Generar un war con maven

To run only the unit tests, run:

mvn test

Generar un war con maven

$ mvn clean generate-sources install
public String sayHello(@RequestParam(value = "name") String name){
return "Hello " + name + "";
}
db.billings.insertMany([
{
"number" : "405714",
"serial" : "F001",
"totalFare" : 2131.3