Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
@macagua
macagua / clases.py
Last active September 27, 2018 01:40
Uso de Clases en Python 2.7.x
# -*- coding: utf8 -*-
class Persona(object):
""" Clase que representa una persona. """
def __init__(self, cedula, nombre, apellido, sexo):
""" Constructor de clase Persona """
self.cedula = cedula
self.nombre = nombre
self.apellido = apellido
@macagua
macagua / README.rst
Last active December 1, 2018 17:48
Uso de Clases en Python 3.5.x

Clases en Python 3

Este es un ejemplo de Programación Orientado a Objetos usando la Herencia simple de Clase en Python 3.5.x.

Para crear objetos desde la clase Persona, entonces ejecute el siguiente comando:

python clases.py persona

@macagua
macagua / python27_tipado_dinamico.py
Last active September 27, 2018 02:48
Uso tipado dinámico en Python 2.7.x
# -*- coding: utf8 -*-
""" El tipado dinámico significa que los objetos en tiempo de
ejecución (valores) tienen un tipo, a diferencia del tipado
estático donde las variables tienen un tipo.
>>> variable = 11
>>> print variable, type(variable)
11 <type 'int'>
>>> variable = "activo"
@macagua
macagua / python35_tipado_dinamico.py
Created September 27, 2018 02:46
Uso tipado dinámico en Python 3.5.x
""" El tipado dinámico significa que los objetos en tiempo de
ejecución (valores) tienen un tipo, a diferencia del tipado
estático donde las variables tienen un tipo.
>>> variable = 11
>>> print ((variable), type(variable))
<class 'int'>
>>> variable = "activo"
>>> print ((variable), type(variable))
<class 'str'>
@macagua
macagua / python27_fuertemente_tipados.py
Last active September 27, 2018 03:13
Uso del fuertemente tipado en Python 2.7.x
# -*- coding: utf8 -*-
""" El fuertemente tipado significa que el tipo de valor no
cambia repentinamente. Una cadena que contiene solo dígitos
no se convierte mágicamente en un número. Cada cambio de tipo
requiere una conversión explícita.
>>> valor1 = 2
>>> valor2 = "5"
>>> total = valor1 + valor2
@macagua
macagua / python35_fuertemente_tipados.py
Created September 27, 2018 03:12
Uso del fuertemente tipado en Python 3.5.x
""" El fuertemente tipado significa que el tipo de valor no
cambia repentinamente. Una cadena que contiene solo dígitos
no se convierte mágicamente en un número. Cada cambio de tipo
requiere una conversión explícita.
>>> valor1 = 2
>>> valor2 = "5"
>>> total = valor1 + valor2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@macagua
macagua / index.html
Created October 2, 2018 14:12
AdminLTE 2 Dashboard Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AdminLTE 2 | Dashboard</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet" href="https://adminlte.io/themes/AdminLTE/bower_components/bootstrap/dist/css/bootstrap.min.css">
@macagua
macagua / README.rst
Last active October 4, 2018 16:42
HTTP Server request and response for GET and POST verbs demostration with Python 2

README

To use this:

  1. Install httpie via pip inside a virtualenv, executing the following command: pip install httpie
  2. Execute HTTP Server script on your machine, executing the following command: python3 my-httpserver.py
  3. Test a HEAD request using http script from httpie package,
@macagua
macagua / README.rst
Last active October 4, 2018 16:57
HTTP Server request and response for GET and POST verbs demostration with Python 3

README

To use this:

  1. Install httpie via pip inside a virtualenv, executing the following command: pip install httpie
  2. Execute HTTP Server script on your machine, executing the following command: python3 my-httpserver.py
  3. Test a HEAD request using http script from httpie package,
@macagua
macagua / info.php
Created June 23, 2019 13:04
phpinfo example for show details information about PHP's configuration
<?php phpinfo(); ?>