Skip to content

Instantly share code, notes, and snippets.

View lruckman's full-sized avatar
🤠

Larry Ruckman lruckman

🤠
View GitHub Profile
@lruckman
lruckman / .prettierrc
Created November 21, 2018 16:21
tslint + prettier + airbnb
{
"printWidth": 120,
"singleQuote": true
}
@lruckman
lruckman / .editorconfig
Created September 24, 2018 15:38
.editorconfig
# EditorConfig is awesome:http://EditorConfig.org
# top-most EditorConfig file
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)
@lruckman
lruckman / ResizeCropExample.cs
Last active February 16, 2018 22:54
ImageSharp Resize with ResizeMode.Crop
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
using System.Net.Http;
using System.Threading.Tasks;
namespace ConsoleApp8
{
class Program
{
@lruckman
lruckman / Sample.cs
Last active April 2, 2017 23:34
iTextSharp Split document and Bates Stamp
private static Action<iTextSharp.text.Rectangle, PdfImportedPage, PdfSmartCopy, int> shrinkForBateStamp =
(pageSizeWithRotation, page, copier, pageNumber) =>
{
// shrink percentage
const float shrinkPercentage = .95f;
var stamp = copier.CreatePageStamp(page);
var w = page.Width > page.Height ? page.Height : page.Width;
var h = page.Width > page.Height ? page.Width : page.Height;
@lruckman
lruckman / ExtendedXmlSerializer.cs
Created January 6, 2017 17:03
Serialization issue when property is set to null
namespace ConsoleApplication1
{
class Program
{
public class Foo
{
public string MyStr { get; set; }
}
static void Main(string[] args)
@lruckman
lruckman / BurteForceAddressNormalize.cs
Last active August 29, 2015 14:27
Brute force address normalization for grouping. Not an exact science but works fairly well for addresses in the US. Use at your own risk.
/// <summary>
/// Used to parse and normalize an address.
/// </summary>
/// <param name="addressline"></param>
/// <param name="cityName"></param>
/// <param name="stateCode"></param>
/// <param name="postalCode"></param>
/// <returns>A normalized string devoid of unit numbers</returns>
internal string ParsedStreetAddress(string addressline, string cityName, string stateCode, string postalCode)