Skip to content

Instantly share code, notes, and snippets.

View cartorjo's full-sized avatar
💛

José cartorjo

💛
View GitHub Profile
import axios, { AxiosResponse } from 'axios';
// Define the base URL for the API
const API_BASE_URL = process.env.API_BASE_URL || 'https://virtserver.swaggerhub.com/ADAS-A2B-Services/adas-a2b-business-objects/0.9.4';
// Define the data types
interface TiposData {
// Define the properties of the data here based on the API requirements
}
@cartorjo
cartorjo / ci-cd.yml
Created December 5, 2023 14:12
CI/CD with Code Quality Workflow
name: CI/CD with Code Quality
# Trigger on push to the main branch
on:
push:
branches:
- main
jobs:
# Build Job
@cartorjo
cartorjo / reverse-geo.js
Last active April 4, 2022 16:04
reverse geocoding
<script>
let data = [
"Address"
];
let myAPIKey = APIKey;
let url = `https://api.geoapify.com/v1/batch/geocode/search?apiKey=${myAPIKey}`;
fetch(url, {
$zero__x-color: rgb(48, 44, 44);
$aave-color: rgb(165, 55, 140);
$algorand-color: rgb(0, 0, 0);
$ankr-color: rgb(0, 109, 255);
$augur-color: rgb(85, 53, 128);
$balancer-color: rgb(29, 40, 42);
$bancor__network-color: rgb(0, 11, 32);
$band__protocol-color: rgb(81, 111, 250);
$basic__attention-color: rgb(255, 80, 0);
$binance-color: rgb(240, 185, 11);
@cartorjo
cartorjo / Person.js
Created January 15, 2021 16:53
TypeORM
import {Column, PrimaryGeneratedColumn, Entity} from "typeorm";
import {MinLength, IsEmail, IsDate} from "class-validator";
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column()
@cartorjo
cartorjo / app.js
Created January 15, 2021 16:07
Establishes a connection to a PostgreSQL database using credentials and handles create and read operations on the database
// Node-postgres, supports for callbacks, promises, async/await,
const pg = require("pg");
// Parse connectionString to get username, password, database name, server, port,...
const parse = require('pg-connection-string').parse;
// Our config details
let config = parse(connectionString);
// Set up a new client using our config details
@cartorjo
cartorjo / UTF-8 characters
Created February 25, 2019 15:46
UTF-8 to ASCII transliteration
// Czech
$text = str_replace('Č', 'c', $text);
$text = str_replace('č', 'c', $text);
$text = str_replace('Ď', 'd', $text);
$text = str_replace('ď', 'd', $text);
$text = str_replace('Ě', 'e', $text);
$text = str_replace('ě', 'e', $text);
$text = str_replace('Ň', 'n', $text);
$text = str_replace('ň', 'n', $text);
$text = str_replace('Ř', 'r', $text);
@cartorjo
cartorjo / functions.php
Last active November 4, 2016 10:21
I18N permalinks (converting common accentuated UTF-8 characters automatically with WordPress)
/**
* I18N permalinks (Czech, German)
*/
add_filter('sanitize_title', 'transliterate_slug', 5, 3);
function transliterate_slug($title, $raw_title = NULL, $context = 'query') {
if ($raw_title != NULL) {
$title = $raw_title;