Skip to content

Instantly share code, notes, and snippets.

View tkMageztik's full-sized avatar

Juan José Ruiz de Castilla tkMageztik

View GitHub Profile
@tkMageztik
tkMageztik / make_directories_in_build_events
Created October 25, 2020 22:46
Create directorys using prebuild, postbuild config
https://stackoverflow.com/questions/33067769/how-to-add-a-pre-build-step-to-project-via-the-visual-studio-ide
Some code example:
if not exist DirToCreate mkdir DirToCreate
mkdir $(TargetDir)\Design
//$(TargetDir) put all the path of your bin folder of your project, so is unnecesary if you just want to create in bing folder.
@tkMageztik
tkMageztik / gist:3ba8823117d4b4f4088c2f921e6f4fff
Created October 23, 2020 17:18
Build specific config file by enviroment; debug, release (transform config file)
https://stackoverflow.com/a/11291067/3957327
@tkMageztik
tkMageztik / gist:dfb487aa7c4aff7044a2f6ef9baa1398
Created September 28, 2020 00:38
Awesome link about static code analysis by types for c# / Visual studio
https://stackoverflow.com/questions/38635/what-static-analysis-tools-are-available-for-c
@tkMageztik
tkMageztik / git_escape_character.txt
Created August 27, 2019 01:25
Caracteres de Escape para password de configuración proxy en GIT (Windows)
! # $ & ' ( ) * + , / : ; = ? @ [ ]
%21 %23 %24 %26 %27 %28 %29 %2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D
https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password
@tkMageztik
tkMageztik / licenses.txt
Created May 21, 2018 21:06
Página que explica una posiblemente varios tipos de licencias de software
https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)
@tkMageztik
tkMageztik / dynamic_accounting.sql
Last active May 5, 2017 16:35
Conta dinámica, super útil
DECLARE @STRSQL NVARCHAR(MAX)
SET @STRSQL =
(
SELECT
CONVERT(NVARCHAR(MAX),
(SELECT
'SELECT IdTranFin,FecTran,'
+ B.M03_TIPO_MOVIMIENTO + ' AS ''TIPO_MOVIMIENTO'','
+ B.M03_BANCO + ' AS ''BANCO'','
+ B.M03_OFICINA + ' AS ''OFICINA'','
@tkMageztik
tkMageztik / database_rename.sql
Created May 4, 2017 17:29
Renombrar base de datos, incluye restricción de base de datos, más potente que hacerlo por GUI
USE MASTER
ALTER DATABASE NOMBRE_ANTIGUO
SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
GO
sp_rename 'NOMBRE_ANTIGUO', 'NUEVO_NOMBRE' ,'DATABASE';
GO
ALTER DATABASE NUEVO_NOMBRE
SET MULTI_USER
GO
@tkMageztik
tkMageztik / get_encoding_by_file.cs
Last active May 3, 2017 15:18
Determinar el encoding de un documento, lectura de bytes.
/// <summary>
/// Determina el encoding de un archivo de texto analizando su bytes order mark (BOM).
/// Usa el encoding por defecto del SO cuando la detección del endianes archivo de texto falla.
/// </summary>
/// <param name="filename">La ruta del archivo a analizar.</param>
/// <returns>El encoding detectado.</returns>
public static Encoding GetEncoding(string filename)
{
// Leyendo el BOM
var bom = new byte[4];
@tkMageztik
tkMageztik / validate_credit_card.js
Created December 28, 2016 19:54 — forked from DiegoSalazar/validate_credit_card.js
Luhn algorithm in Javascript. Check valid credit card numbers
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, nDigit = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@tkMageztik
tkMageztik / get_strange_characters_mssql
Created October 20, 2016 20:13
buscar caracteres extraños incluido caracter nchar(65533) collate latin1_general_BIN2.
INSERT INTO TMP_CLIENTES
SELECT '',RTRIM(TipDoc),RTRIM(NroDoc),'',RTRIM(NomPrim),RTRIM(NomSeg),RTRIM(ApePri),RTRIM(ApeSeg),'' FROM CLIENTES
WHERE (replace(APEPRI,' ','') like '%[^.ABCDEFGHIJKLMNOPQRSTUVWXYZÑÁÉÍÓÚÜÖ''\-]%'
OR replace(APESEG,' ','') like '%[^.ABCDEFGHIJKLMNOPQRSTUVWXYZÑÁÉÍÓÚÜÖ''\-]%'
OR replace(NOMPRIM,' ','') like '%[^.ABCDEFGHIJKLMNOPQRSTUVWXYZÑÁÉÍÓÚÜÖ''\-]%'
OR replace(NOMSEG,' ','') like '%[^.ABCDEFGHIJKLMNOPQRSTUVWXYZÑÁÉÍÓÚÜÖ''\-]%')
OR CharIndex(nchar(65533) COLLATE Latin1_General_BIN2, APEPRI) > 0
OR CharIndex(nchar(65533) COLLATE Latin1_General_BIN2, APESEG) > 0
OR CharIndex(nchar(65533) COLLATE Latin1_General_BIN2, NOMPRIM) > 0
OR CharIndex(nchar(65533) COLLATE Latin1_General_BIN2, NOMSEG) > 0