Skip to content

Instantly share code, notes, and snippets.

@rogerluces
rogerluces / mailer.php
Created August 19, 2017 13:52
PHP MAILER smtp
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = ""; // SMTP a utilizar. Por ej. smtp.elserver.com
$mail->Username = ""; // Correo completo a utilizar
$mail->Password = ""; // Contraseña
$mail->Port = 25; // Puerto a utilizar
$mail->From = "info@elserver.com"; // Desde donde enviamos (Para mostrar)
@rogerluces
rogerluces / new_gist_file
Created August 18, 2017 15:17
Salvar información de entorno C# (ip, equipo, fecha, hora) con conversion de fecha y hora para DB2
string ipequipo = Request.UserHostAddress;
string nombrequipo = System.Net.Dns.GetHostEntry(Request.UserHostAddress).HostName;
// pasar hora a ANSI
string fechaAnsi = DateTime.Now.ToString("yyyy/MM/dd");
// Quitar barras y pasar fecha a numerico
string fechaeq = (Int32.Parse(fechaAnsi.Replace(@"/", ""))).ToString();
// Salvar hora entorno
string horaf = DateTime.Now.ToString("H:mm") + ":00";
// Eliminar : dejar fecha numerica
string horaeq = (Int32.Parse(horaf.Replace(@":", ""))).ToString();
@rogerluces
rogerluces / new_gist_file
Created August 18, 2017 14:48
Excel to datatable
public DataTable ExceltoDatatable(DataTable nombreTabla, string nombreArchivo)
{
string rutacompletafile = nombreArchivo;
if (File.Exists(rutacompletafile))
{
string myConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + nombreArchivo + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\"";
OleDbConnection conn = new OleDbConnection(myConnection);
string strSQL = "SELECT * FROM [Hoja1$]";
@rogerluces
rogerluces / 0_reuse_code.js
Created August 18, 2017 13:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console