Skip to content

Instantly share code, notes, and snippets.

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

Javier Guerrero javierguerrero

🏠
Working from home
View GitHub Profile
@javierguerrero
javierguerrero / gist:1624140
Created January 17, 2012 02:18
Clases abstractas C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
public abstract class Mascota
{
abstract public void hablar();
@javierguerrero
javierguerrero / gist:1624158
Created January 17, 2012 02:22
Ejemplos clases abstractas C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
public abstract class Producto
{
protected double precioVenta;
@javierguerrero
javierguerrero / gist:1624210
Created January 17, 2012 02:35
ejemplo clase abstracta
public abstract class Vehiculo
{
public abstract void Encender();
public abstract void Mover();
public abstract void Parar();
public abstract void Apagar();
}
public class Carro : Vehiculo
@javierguerrero
javierguerrero / gist:1624252
Created January 17, 2012 02:51
métodos virtuales
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Persona
{
public string Nombre;
@javierguerrero
javierguerrero / gist:1624259
Created January 17, 2012 02:53
herencia en c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Persona
{
public string Nombre;
@javierguerrero
javierguerrero / gist:1790260
Created February 10, 2012 15:24
Upcasting y Downcasting
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Animal
{
public void Comer() { }
@javierguerrero
javierguerrero / gist:1818717
Created February 13, 2012 18:05
jQuery Tablesorter and Decimals
$(document).ready(function(){
$.tablesorter.addParser({
// set a unique id
id: 'versions',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
@javierguerrero
javierguerrero / gist:2698097
Created May 14, 2012 23:41
Cómo extraer un número desde una cadena en SQL Server
CREATE FUNCTION dbo.EXTRACT_YEAR(@periodo AS VARCHAR(max))
RETURNS INT
AS
BEGIN
WHILE PATINDEX('%[^0-9]%', @periodo) > 0
BEGIN
SET @periodo = REPLACE(@periodo,SUBSTRING(@periodo,PATINDEX('%[^0-9]%', @periodo),1),'')
END
@javierguerrero
javierguerrero / gist:2883732
Created June 6, 2012 18:25
SQL Exact Match
DECLARE @Tab TABLE(
[id] int,
[test] varchar(100))
INSERT INTO @Tab
VALUES (1, 'This is a test searching for like.')
INSERT INTO @Tab
VALUES (2, 'This is a test for alike messages.')
INSERT INTO @Tab
VALUES (3, 'It is likely the effort will fail.')
INSERT INTO @Tab
@javierguerrero
javierguerrero / gist:2920107
Created June 12, 2012 21:00
How to replace accented characters with non-accented ones
CREATE FUNCTION dbo.Format_RemoveAccents( @Str varchar(8000) )
RETURNS varchar(8000)
AS
BEGIN
/*
EXEMPLE :
SELECT dbo.Format_RemoveAccents( 'ñaàeéêèioô; Œuf un œuf' )
==> naaeeeeioo; OEuf un oeuf
By Domilo