Skip to content

Instantly share code, notes, and snippets.

View icalderond's full-sized avatar
👨‍💻
Working in home

Israel Calderon de la Cruz icalderond

👨‍💻
Working in home
View GitHub Profile
@icalderond
icalderond / Merge PDF
Last active January 6, 2023 21:46
Unir pdf con iTextSharp
/// <summary>
/// Une dos PDF uno detras del otro dependiendo de como los va encontrando
/// </summary>
/// <param name="targetPDF">La ruta completa del archivo .PDF que se va a crear</param>
/// <param name="sourceDir">La ruta del folder que contiene los .PDF a unir</param>
public void CreateMergedPDF(string targetPDF, string sourceDir)
{
using (FileStream stream = new FileStream(targetPDF, FileMode.Create))
{
Document pdfDoc = new Document(PageSize.A4);
@icalderond
icalderond / ReadIniFile
Created December 26, 2014 23:33
Leer archivo ini y convertirlo a objectos
public class Configuration
{
public Configuration(string _seccion)
{
this.Seccion = _seccion;
}
public string Seccion { get; set; }
private List<Parameter> parameters;
public List<Parameter> Parameters
@icalderond
icalderond / view name tables of database
Created January 22, 2015 16:52
Ver los nombres de las tablas en sql server
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND TABLE_NAME like '%requisi%'
@icalderond
icalderond / FormatDate
Created January 26, 2015 16:56
Ver formatos de fecha en SQL Server
declare @dob2 DATETIME=getdate()
select convert(varchar, @dob2, 101)--01/26/2015
select convert(varchar, @dob2, 102)--2015.01.26
select convert(varchar, @dob2, 103)--26/01/2015
select convert(varchar, @dob2, 104)--26.01.2015
select convert(varchar, @dob2, 105)--26-01-2015
select convert(varchar, @dob2, 106)--26 Jan 2015
select convert(varchar, @dob2, 107)--Jan 26, 2015
select convert(varchar, @dob2, 108)--10:52:40
@icalderond
icalderond / Calculo dias
Last active August 29, 2015 14:16
Calculo de dias de la semana
declare @primer_dia datetime
declare @ultimo_dia DATETIME
DECLARE @ultimo_dia_habil datetime
declare @d varchar(2)
DECLARE @m varchar(2)
DECLARE @a varchar(4)
DECLARE @FE varchar(50)
DECLARE @FI varchar(50)
DECLARE @FN varchar(50)
@icalderond
icalderond / Lista temporal
Created March 25, 2015 18:10
Lista temporal SQL Server
--For SQL Server 2012:
DECLARE @ListofIDs TABLE(IDs VARCHAR(100));
INSERT INTO @ListofIDs
VALUES('a'),('10'),('20'),('c'),('30'),('d');
SELECT IDs FROM @ListofIDs;
GO
using System.Windows;
using System.Windows.Controls;
namespace CustomControl
{
public class BindablePasswordBox : Decorator
{
/// <summary>
/// The password dependency property.
/// </summary>
@icalderond
icalderond / hideAndShowKeyboard.cs
Created June 20, 2016 22:30
Hide and show keyboard android Xamarin
/**
* Hides the soft keyboard
*/
public void hideSoftKeyboard ()
{
var currentFocus = Activity.CurrentFocus;
if (currentFocus != null) {
InputMethodManager inputMethodManager = (InputMethodManager)Activity.GetSystemService (Context.InputMethodService);
inputMethodManager.HideSoftInputFromWindow (currentFocus.WindowToken, HideSoftInputFlags.None);
}
@icalderond
icalderond / UppercaseFirst.cs
Created July 7, 2016 21:53
Convertir la primera letra en Mayuscula
public static string UppercaseFirst(string text)
{
var s = text.TrimEnd().TrimStart().ToLower();
// Check for empty string.
if (string.IsNullOrEmpty(s))
return string.Empty;
var arr = s.Split(' ');
foreach (var item in arr)
s = s.Replace(item, char.ToUpper(item[0]) + item.Substring(1));
@icalderond
icalderond / git-tag-delete-local-and-remote.sh
Created June 13, 2017 17:04 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName