Skip to content

Instantly share code, notes, and snippets.

View odises's full-sized avatar
🎯
Focusing

Reza Ahmadi odises

🎯
Focusing
View GitHub Profile
@odises
odises / HtmlUtilites.cs
Created August 3, 2016 04:09
A method that removes all tags from html except those that are on the acceptableTags array, and raw text nodes.
using System.Collections.Generic;
using System.Linq;
using HtmlAgilityPack;
namespace Amberizer
{
public class HtmlUtilites
{
public string RemoveUnwantedTags(string data, string[] acceptableTags)
{
@odises
odises / CanvasResizer.cs
Last active January 3, 2016 19:49
Resizing Image Canvas - Fit original Image to an square
private Bitmap ExpandCanvas(System.Drawing.Image inputImage)
{
var img = inputImage;
// Calculate the square side
var max = Math.Max(img.Width, img.Height);
int side;
var isVertical = false;