Skip to content

Instantly share code, notes, and snippets.

View Elshaman's full-sized avatar
💭
Working in JAVA JAKARTA

Cristian Buitrago Elshaman

💭
Working in JAVA JAKARTA
  • SENA(Servicio Nacional de Aprendizaje), Colombia
  • Bogotá, D.C
View GitHub Profile
@Elshaman
Elshaman / lector.py
Last active December 9, 2019 16:41
Cómo Recorrer un archivo csv en python
import csv
for row in csv.reader(open('city.csv', encoding='utf-8') ):
print(row)
#donde row es el arreglo donde se contiene cada fila del archivo csv.
#para acceder a cada posicion se accede mediante su indice
#ej: print(row[5])
@Elshaman
Elshaman / Models.py
Created December 22, 2019 00:57
Segunda parte del recorrido de un archivo csv, esta vez Registrando en Base de datos si no se encuentra el dato de un pais
from app import db
class Pais(db.Model):
id = db.Column(db.Integer, primary_key=True)
codigo = db.Column(db.String(8), index=True, unique = True , nullable = True)
nombre = db.Column(db.String(32), index=True, unique = True)
regiones = db.relationship('Region' , backref = "pais" , lazy="dynamic" )
ciudades = db.relationship('Ciudad' , backref = "pais" , lazy="dynamic" )
@Elshaman
Elshaman / Models.py
Created January 11, 2020 18:23
INSERT con modelos en python, utilizando SQLAlchemy
from app import db
class Pais(db.Model):
id = db.Column(db.Integer, primary_key=True)
codigo = db.Column(db.String(8), index=True, unique = True , nullable = True)
nombre = db.Column(db.String(32), index=True, unique = True)
##Las relaciones indican vistas de alto nivel de la relación entre:
##Paises y sus regiones
##Paises y sus ciudades
@Elshaman
Elshaman / ajax_classic_request.js
Last active September 16, 2020 14:40
asynchronous api request(Chapter One) : Classic Stone-aged JavascriptXMLHttpRequest
/**
* Cristian Buitrago´s Weather API request
* First Iteration
* Sample with XMLHttpRequest classic's with callbacks
* Execute: browser only
* Architectural style: Callback
* Calls openweathermap's API(openweathermap.com/current for info)
*/
function get_weather_data(url, success , fail){
@Elshaman
Elshaman / ajax_classic_request_with_arrows.js
Last active September 16, 2020 14:42
asynchronous api request(Chapter two): Classic Stone-aged Javascript XMLHttpRequest , this time with arrow syntax
/**
* Cristian Buitrago´s Weather API
* Second Iteration
* Sample with XMLHttpRequest classic's with callbacks, this time with arrow syntax
* Execute with any web browser
* method: GET
* Architectural Style: Callback
* Calls openweathermap's API(openweathermap.com/current for info)
*/
@Elshaman
Elshaman / ajax_native_nodejs.js
Last active September 16, 2020 14:42
asynchronous api request(Chapter Three): native nodejs http's request
/**
* Cristian Buitrago´s Weather API
* Third Iteration
* Sample with Native https library(nodejs)
* method: GET
* Architectural Style: Callback
* Execute: nodejs
* Calls openweathermap's API(openweathermap.com/current for info)
*/
@Elshaman
Elshaman / ajax_nodejs_request_library.js
Last active September 16, 2020 14:52
asynchronous api request(Chapter four): Node js request using "request", third party library
/**
* Cristian Buitrago´s Weather API
* Fourth Iteration
* Sample with Node js's "request", third party library
* Execute: nodejs
* Architectural Style: Callback
* method: GET
* Calls openweathermap's API(openweathermap.com/current for info)
*/
@Elshaman
Elshaman / ajax_nodejs_needle.js
Last active September 16, 2020 14:56
asynchronous api request(Chapter Five): using Node js's "needle", third party library
/**
* Cristian Buitrago´s Weather API
* Fifth Iteration
* Sample with Node js's "needle", third party library
* Execute: nodejs
* Architechtural Style: Callback
* method: GET
* Calls openweathermap's API(openweathermap.com/current for info)
*/
const needle = require('needle');
@Elshaman
Elshaman / ajax_axios_array_of_promises.js
Created September 16, 2020 15:59
asynchronous api request(Chapter 8): nodejs´s request using "Axios" , third party library with promises array
/**
* Cristian Buitrago´s Weather API
* Fourth Iteration
* Sample with Node js's "axios", third party library
* Execute: nodejs
* Architectural style: Promises
* method: GET
* Calls openweathermap's API(openweathermap.com/current for info)
*/
@Elshaman
Elshaman / ajax_axios.js
Last active September 16, 2020 15:59
asynchronous api request(Chapter Seven): api request with Axios
/**
* Cristian Buitrago´s Weather API
* Seventh Iteration
* Sample with Node js's "axios", third party library
* Execute: nodejs
* Architectural style: Promises
* method: GET
* Calls openweathermap's API(openweathermap.com/current for info)
*/