Skip to content

Instantly share code, notes, and snippets.

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

Cristiam Diaz cdiaz

🏠
Working from home
  • Quantux, @Noders
  • Florencia, Caquetá, Colombia
View GitHub Profile
@cdiaz
cdiaz / alien_translator.js
Created March 17, 2016 08:42
Alien Translator Javascript
var dictionary = ['miel', 'extraterrestre', 'al', 'automovil', 'auto', 'revestir'];
var alienPattern = 'zyxwvutsrqponmlkjihgfedcba';
function ordenar_extraterrestre(alienPattern, dictionary){
var humanPattern = 'abcdefghijklmnopqrstuvwxyz';
var translation = [];
for (var i in dictionary) {
var humanWord = dictionary[i];
var alienWord = '';
@cdiaz
cdiaz / TrmSoapClient.py
Last active October 17, 2024 18:02
Obtener La tasa de cambio representativa del mercado (TRM) para Colombia consumiendo el webservice de la Superintentencia Financiera desde Python
#!/usr/bin/env python
from suds.client import Client
import time
WSDL_URL = 'https://www.superfinanciera.gov.co/SuperfinancieraWebServiceTRM/TCRMServicesWebService/TCRMServicesWebService?WSDL'
date = time.strftime('%Y-%m-%d')
def trm(date):
try:
client = Client(WSDL_URL, location=WSDL_URL, faults=True)
@cdiaz
cdiaz / ConsultaNitRUES.js
Last active November 15, 2024 13:52
Consulta NIT en el Registro Único Empresarial y Social (RUES)
var request = require('request');
// Digite el NIT sin puntos ni guiones, el dígito de Verificación no es requerido.
request.post(
'http://www.rues.org.co/RUES_Web/Consultas/ConsultaNIT_json',
{ form: {strNIT: '891190346' } },
function (error, response, result) {
if (!error && response.statusCode == 200) {
console.log(result)
@cdiaz
cdiaz / TrmSoapClient.php
Created April 7, 2016 07:35
Obtener la tasa de cambio representativa del mercado para Colombia con PHP
<?php
$date = date("Y-m-d");
try {
$soap = new soapclient("https://www.superfinanciera.gov.co/SuperfinancieraWebServiceTRM/TCRMServicesWebService/TCRMServicesWebService?WSDL", array(
'soap_version' => SOAP_1_1,
'trace' => 1,
"location" => "http://www.superfinanciera.gov.co/SuperfinancieraWebServiceTRM/TCRMServicesWebService/TCRMServicesWebService",
));
@cdiaz
cdiaz / README.md
Last active April 30, 2017 01:02
Automation script to login into Chairá Platform from PowerShell

##Instructions:

####Download and Install Chocolatey (Package Manager for PowerShell) Run in the Command Line (cmd)

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

#####Other installation methods: https://github.com/chocolatey/choco/wiki/Installation

from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
from urlparse import urlparse, parse_qs
import os
app = Flask(__name__)
client_id = "2727775315301"
client_secret = ""
var dictionary = ['miel', 'extraterrestre', 'al', 'automovil', 'auto', 'revestir'];
var alphabet = "zyxwvutsrqponmlkjihgfedcba";
function sort(dictionary, alphabet) {
function translate(str, alphabet) {
var abc = "abcdefghijklmnopqrstuvwxyz";
return [].map.call(str, function(c) {
return alphabet[abc.indexOf(c)] || c;
}).join(" ");
@cdiaz
cdiaz / groupby.js
Last active September 8, 2016 06:08
Json Object Group by column
function sortOn( data, attribute ) {
data.sort(
function( a, b ) {
if ( a[ attribute ] <= b[ attribute ] ) {
return( -1 );
}
return( 1 );
}
@cdiaz
cdiaz / getWeek.js
Last active September 16, 2016 05:47
Obtener los proximos 7 dias a partir del dia actual
function getweek(curr) {
if (curr instanceof Date){
curr.setDate(curr.getDate()-1);
var week=[];
for(var i = 0; i<7; i++) {
week.push({[i]:[getday(new Date( curr.setDate(curr.getDate() + 1)))]});
}
return week;
@cdiaz
cdiaz / app.js
Last active March 7, 2018 00:12
get and post XMLHttpRequest
function main() {
// ENVIAR DATOS AL SERVIDOR
let data = JSON.stringify({ title: 'foo', body: 'bar', userId: 1 });
SendJSON(data)
// PEDIR DATOS AL SERVIDOR
loadJSON((response) => {
console.log(response);
//ACA PUEDE MANIPULAR LA RESPUESTA