Skip to content

Instantly share code, notes, and snippets.

View AdrianMachado's full-sized avatar

Adrian Machado AdrianMachado

View GitHub Profile
@AdrianMachado
AdrianMachado / hug-openapi-converter.py
Created November 5, 2024 08:10
Python Hug OpenAPI/Swagger Documentation Converter
import yaml
from collections import OrderedDict
def convert_to_openapi(hug_doc):
"""
Converts Hug documentation to OpenAPI format.
:param hug_doc: Documentation generated from Hug framework's annotations.
:return: A dictionary in OpenAPI 3.0 format.
"""
openapi = OrderedDict({
@AdrianMachado
AdrianMachado / FlexSelect.tsx
Created December 9, 2022 23:24
React HTML Select Element with custom arrow and auto-resizing
// NOTE: This sample uses Tailwind CSS
import { SelectorIcon } from "@heroicons/react/outline";
import cn from "classnames";
import { useEffect, useRef } from "react";
type FlexSelectProps = {
className?: string;
value: number | string | undefined;
onChange: React.ChangeEventHandler<HTMLSelectElement> | undefined;
children: React.ReactNode;
};
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Setting<?> setting = (Setting<?>) o;
return Objects.equals(key, setting.key);
}
{
"geocoded_waypoints": [
{
"geocoder_status": "OK",
"place_id": "ChIJUyT9Fx30K4gRjcT3Z9DE_jA",
"types": [
"street_address"
]
},
{
//Lets try to make a HTTP GET request to modulus.io's website.
request('http://www.modulus.io', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body); // Show the HTML for the Modulus homepage.
}
});