Skip to content

Instantly share code, notes, and snippets.

View pachecoder's full-sized avatar

Jorge Pacheco pachecoder

  • Buenos Aires, Argentina
View GitHub Profile
@pachecoder
pachecoder / bussinesLogic.cs
Created December 8, 2012 20:55
fillParametersDinamically
protected override void fillParametersDinamically(System.Data.IDbCommand com, Object[] args)
{
for (int i = 1; i < com.Parameters.Count; i++)
{
var p = (System.Data.SqlClient.SqlParameter)com.Parameters[i];
p.Value = i <= args.Length ? args[i - 1] ?? DBNull.Value : null;
}
}
@pachecoder
pachecoder / validateDecimalToInt.cs
Last active December 24, 2015 16:28
Valida que el decimal sea entero con la finalidad de realizar una validacion. Validate Decimal value is Int.
public static void Main (string[] args)
{
decimal d = 3.1M;
Console.WriteLine((d % 1) == 0);
d = 3.0M;
Console.WriteLine((d % 1) == 0);
}
@pachecoder
pachecoder / GetDbTypeFromType.cs
Last active December 29, 2015 08:09
Parse Type in DbType
public DbType GetDbType(Type type)
{
DbType dbType = (DbType)Enum.Parse(typeof(DbType), type.Name);
return dbType;
}
@pachecoder
pachecoder / GetLocalNetworkSqlInstances.cs
Created November 29, 2013 19:09
Get all local network sql instances.
//using System.Data.Sql;
public List<string> GetLocalNetworkSqlInstances()
{
SqlDataSourceEnumerator instances = SqlDataSourceEnumerator.Instance;
List<string> listInstance = new List<string>();
DataTable dt = instances.GetDataSources();
listInstance.Clear();
@pachecoder
pachecoder / GetLocalIpAddress.cs
Created January 28, 2014 15:41
Get the local ip address of the principal network adapter card.
public string getLocalIPAddress()
{
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
@pachecoder
pachecoder / GitConfigColorAuto.sh
Created March 12, 2014 15:29
configure the color.ui from git console
#!/bin/sh
#configure the color.ui from git console in ubuntu.
#DOC: http://git-scm.com/book/en/Customizing-Git-Git-Configuration
git config --global color.ui = always
@pachecoder
pachecoder / JsonGetTimeCCS
Created March 25, 2014 13:33
URL que retorna en formato JSON la hora de una Zona Horaria en este caso CCS
http://json-time.appspot.com/time.json?tz=America/Caracas&callback=HoraMundial

Keybase proof

I hereby claim:

  • I am pachecoder on github.
  • I am pachecogeorge (https://keybase.io/pachecogeorge) on keybase.
  • I have a public key whose fingerprint is D4D1 355D A107 4FE1 08EF 2A91 FA95 2217 7BC4 8915

To claim this, I am signing this object:

@pachecoder
pachecoder / mysql-backup-windows.bat
Last active September 19, 2015 11:20 — forked from sindresorhus/mysql-backup-windows.bat
Backup MySQL databases in separate gzipped sql files on Windows
@echo off
set dbUser=root
set dbPassword=yourPassword
set backupDir="C:\Documents and Settings\user\Desktop\backup\mysql"
set mysqldump="C:\Program Files\MySQL\MySQL Workbench 5.2 CE\mysqldump.exe"
set mysqlDataDir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data"
set zip="C:\Program Files\7-Zip\7z.exe"
::Change date delimiter to -
@pachecoder
pachecoder / chiguibot.py
Created August 8, 2016 17:06
Bot para leer y publicar los enlaces al Chiguire Bipolar en Reddit
#!/usr/bin/env python
import praw
import json
import OAuth2Util
import requests
import re
from lxml.cssselect import CSSSelector
import lxml.html
def check_none_type_object(obj):