Skip to content

Instantly share code, notes, and snippets.

View juanch0x's full-sized avatar

Juan Salvador Portugal juanch0x

  • NoNerds No Problem
  • Mendoza, Argentina
View GitHub Profile
using AngleSharp;
using AngleSharp.Dom;
using System;
using System.Collections.Generic;
using System.Text;
namespace PruebaHTML
{
public class AvisoDeCambio : IAvisoDeCambio
{
@juanch0x
juanch0x / PlacaIram2250.cs
Created February 18, 2020 19:39
Ejemplo para nicolás
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleNetCore
{
internal class PlacaIram2250
{
private readonly IDictionary<int, double> mRegulaciones = new Dictionary<int, double>
{
@juanch0x
juanch0x / EjemploRotativa.cs
Created September 4, 2019 15:26
Ejemplo Rotativa
public ActionResult ImprimirDetalleDistribucion(string CodigoDelfos, int Revision, string Versiones)
{
int[] version = JsonConvert.DeserializeObject<int[]>(Versiones);
using(DBTrafosContext db = new DBTrafosContext()) {
var Trafo = db.Transformador.AsNoTracking().FirstOrDefault(c => c.Codigo_delfos == CodigoDelfos && c.Revision == Revision);
Trafo.Datos_Garantizados = Trafo.Datos_Garantizados.Where(c => version.Contains(c.Version)).ToList();
ImprimirDetalleDistribucionViewModel im = new ImprimirDetalleDistribucionViewModel(Trafo);
return View(im);
@juanch0x
juanch0x / Messenger.cs
Created May 16, 2019 19:54
Es una implementación de Messenger para C# MVVM (similar a la que usa MVVM light)
/*
* Uso:
* Registro -> Messenger.Default.Register<Catalogo>(this, (o) => cat = new CatalogoSimpleViewModel(o));
* Ahora la acción (segundo parámetro se disparará cuando desde otro lugar se envíe el sgte mensaje)
* Envío -> Messenger.Default.Send(((CatalogoViewModel)e).Model);
*/
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
namespace ChequeadorDeDespiece.Base
//https://github.com/ziyasal/FireSharp
using FireSharp;
using FireSharp.Config;
using FireSharp.Interfaces;
using FireSharp.Response;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
@juanch0x
juanch0x / SingletonGeneric<T>.cs
Created December 6, 2018 11:22
Clase genérica para administrar las instancias de un singleton.
public abstract class SingletonClass<T>
where T : SingletonClass<T>, new()
{
private static T _instance = null;
public static T Instance
{
get
{
if(_instance == null)
@juanch0x
juanch0x / IEnumerableExtensionWithLambda.cs
Created October 3, 2018 18:51
Ejemplo de una extensión de un IEnumerable usando expresiones lambda para quitar los null con cierta lógica.
class Program {
static void Main (string[] args)
{
List<Persona> t = new List<Persona> ();
t.Add (new Persona { Nombre = "Juan", Apellido = "Portugal" });
t.Add (new Persona { Nombre = "AA", Apellido = "BB" });
t.Add (new Persona { Nombre = "CC", Apellido = null });
t.Add (new Persona { Nombre = "EE", Apellido = "FF" });
t.Add (new Persona { Nombre = "FF", Apellido = null });
t.Add (new Persona { Nombre = "AA", Apellido = "HH" });
@juanch0x
juanch0x / CrearYLeerCustomAttribute.cs
Created September 28, 2018 20:06
Creo y leo un Custom Attribute usando una práctica similar a la de un HtmlHelper.
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)