Skip to content

Instantly share code, notes, and snippets.

View alexdelgado0792's full-sized avatar

Alex Delgado alexdelgado0792

  • Mexico
View GitHub Profile
@alexdelgado0792
alexdelgado0792 / ObjectExtensions.cs
Created October 28, 2023 03:17
method to help to create dynamically object from a dictionary and vice versa
using System.Reflection;
namespace Util
{
public static class ObjectExtensions
{
public static T ToObject<T>(this IDictionary<string, object> source)
where T : class, new()
{
var someObject = new T();
@alexdelgado0792
alexdelgado0792 / CIO_AddUpdateUser.rb
Created March 29, 2023 22:09
Example for Create or Update a user in Customer IO
require "uri"
require "json"
require "net/http"
require 'time'
class CustomerData
attr_reader :id
def initialize(email, id, fullName, phone, terms)
@email = email
@id = id
@alexdelgado0792
alexdelgado0792 / HomeController.cs
Created June 6, 2019 20:02
Get Facebook Graph API Authorization
using DemoFb.Models;
using System.Web.Mvc;
using Newtonsoft.Json;
namespace DemoFb.Controllers
{
public class HomeController : Controller
{
//TODO: Pass configuration to web config.
private readonly string FbAppId = "app-id";
@alexdelgado0792
alexdelgado0792 / App.config
Last active November 13, 2019 18:09
WinScp SFTP transfer file snippet
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--SFTP-->
<add key="Host" value="" />
<add key="UploadFolder" value="/mis/myfolder/Upload_Test/{0}" />
<add key="ArchiveFolder" value="/mis/myfolder/Archive/" />
<add key="SFTP_User" value="" />
<add key="SFTP_Pass" value="" />
@alexdelgado0792
alexdelgado0792 / App.config
Created May 21, 2019 19:54
SendGrid Email API
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--SendGrid Configuration-->
<add key ="SendGridKey" value="Example.Key"/>
<!--Emails-->
<add key ="DX Team" value="test@example.com"/>
</appSettings>
</configuration>
@alexdelgado0792
alexdelgado0792 / BlobStorage.cs
Created May 9, 2019 13:57
Azure storage (File, Blob, Queue, Table) helper classes
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
namespace Azure.Storage
{
public class BlobStorage
{
@alexdelgado0792
alexdelgado0792 / LiteDbBase.cs
Created May 8, 2019 18:53
NoSQL database using LiteDB API
using LiteDB;
using System;
namespace LiteDbDemo
{
public class LiteDbBase : IDisposable
{
private readonly string DbFile = "MyData.db";
private LiteDatabase _liteDatabase;
public LiteDatabase LiteDb
@alexdelgado0792
alexdelgado0792 / QrGenerator.cs
Last active April 23, 2019 22:05
QR Code generator snippet
using QRCoder;
using System.Drawing;
using System.Linq;
using static QRCoder.PayloadGenerator;
namespace Support
{
/// <summary>
/// QR Code bar genetor using (QR Coder Library).
/// <seealso cref="https://github.com/codebude/QRCoder"/>
@alexdelgado0792
alexdelgado0792 / TimeZoneUtil.cs
Last active May 29, 2019 16:49
NodeTime API used for time zone convertion
using NodaTime;
using NodaTime.Text;
using System;
using System.IO;
namespace ConsoleAppDemo
{
/// <summary>
/// Noda Time API. Use for convert into different timezones.
/// <seealso cref="https://nodatime.org"/>
@alexdelgado0792
alexdelgado0792 / StringUtil.cs
Last active June 11, 2019 14:45
String utilery
using System.Collections.Generic;
using System.Linq;
namespace ConsoleAppDemo
{
public static class StringUtil
{
private const string Space = " ";
public static string WithoutSpaces(this string value)