Skip to content

Instantly share code, notes, and snippets.

View amendoncabh's full-sized avatar

André Mendonça amendoncabh

  • solutii
  • Belo Horizonte
View GitHub Profile
@amendoncabh
amendoncabh / configuration_manager.py
Created March 2, 2023 15:29 — forked from Bachsau/configuration_manager.py
A simple abstraction of Python’s ConfigParser
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# A simple abstraction of Python’s ConfigParser.
# It features implicit type conversion and defaults through prior
# registration of settings. It can be used to save and read settings
# without bothering about the specifics of ConfigParser or the INI files
# themselves. It could also serve as a starting point to abstract
# platform-specific saving methods through its general API.
#include 'hbclass.ch'
#define CRLF Chr( 13 ) + Chr( 10 )
External AllTrim
Class CTE
Hidden:
Data cTable
Data cIdField
@amendoncabh
amendoncabh / download.prw
Created April 6, 2021 12:12 — forked from vitorebatista/download.prw
ADVPL Function to download a file using SOAP or REST api
//---------------------------------------------------------------------
/*/{Protheus.doc} Download
Download de arquivo via HTTP (SOAP, REST)
@since 14/03/2016
@version P12
@return logic
/*/
//---------------------------------------------------------------------
Static Function Download( oWebService, cPath, cFileName )
@amendoncabh
amendoncabh / tstwsrest.prw
Created April 6, 2021 12:09 — forked from vitorebatista/tstwsrest.prw
Exemplo webservice REST ADVPL
#include "PROTHEUS.ch"
#include "RESTFUL.ch"
#xtranslate @{Header <(cName)>} => ::GetHeader( <(cName)> )
#xtranslate @{Param <n>} => ::aURLParms\[ <n> \]
#xtranslate @{EndRoute} => EndCase
#xtranslate @{Route} => Do Case
#xtranslate @{When <path>} => Case NGIsRoute( ::aURLParms, <path> )
#xtranslate @{Default} => Otherwise
@amendoncabh
amendoncabh / VarDump.prw
Created December 16, 2020 20:07 — forked from haskellcamargo/VarDump.prw
Expressions analyzer - AdvPL
#include "protheus.ch"
/**
* Gramatica formal da analise de expressoes, dentro do parser, levando em conta
* a geracao de tokens.
* @author Marcelo Camargo
* @since 17/04/2015
*
* expr := string | number | array | nil | codeblock | date | object
* string := <? T_STRING ?>
@amendoncabh
amendoncabh / YahooHistoricStockApi.php
Created October 22, 2020 00:09
PHP classes to get stock data from various Yahoo finance APIs
<?php
/**
* Get historic stock symbol information from Yahoo
*
* Based on https://code.google.com/p/yahoo-finance-managed/wiki/csvHistQuotesDownload
*/
class YahooHistoricStockApi
{
@amendoncabh
amendoncabh / Usuarios.php
Created October 4, 2020 19:04 — forked from gilsonbp/Usuarios.php
Zend Form 1.12 usando Twitter Bootstrap e Decorators.
<?php
class Forms_Usuario extends Zend_Form {
public function init() {
$this->setMethod('post');
$this->setAttribs(array(
'class' => 'form span9',
'name' => 'form_usuarios'
@amendoncabh
amendoncabh / Tags.php
Created October 3, 2020 23:34 — forked from asaokamei/Tags.php
PHP HTML Tag Generator Class.
<?php
/**
* @method Tags a()
* @method Tags href()
* @method Tags target()
* @method Tags style()
* @method Tags div()
* @method Tags input()
* @method Tags value()

Bootstrap 3 Nav Menu Responsive Brand Logo Image

This demo corresponds to a this question answered on stackoverflow about Bootstrap Navbar Logos

There is a bug in Firefox with the bootstrap navbar-brand image. These methods above FIX the firefox issue by applying padding to the image and not the .navbar-brand tag removing the padding on .navbar-brand.

If you're looking for my original post using object fit method I have removed it for now because it is not fully supported in IE without a polyfill or fallback using css tables.

These are all examples of how to use a logo image in the bootstrap nav using tag. Using height on the logo along with width: auto, the image will resize to fit within the navbar and not overflow onto the page. This works exactly the same way .img-responsive does except in reverse. However, there is currently a bug in firefox so we have to apply the padding to the im

@amendoncabh
amendoncabh / jQuery.download.js
Created August 31, 2020 01:19 — forked from vivisidea/jQuery.download.js
download file using jquery
jQuery.download = function(url, data, method){
if( url && data ){
data = typeof data == 'string' ? data : jQuery.param(data);
//split params into form inputs
var inputs = '';
jQuery.each(data.split('&'), function(){
var pair = this.split('=');
inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
});
//send request