Skip to content

Instantly share code, notes, and snippets.

View Lechus's full-sized avatar

Leszek Lechus

  • UK
View GitHub Profile
@jesperordrup
jesperordrup / FormMailChimpController.cs
Last active August 29, 2015 14:15
Umbraco MailChimp Angularjs Ajax Form Post to WebAPI. Clean App_Code and 100% control of everything.
using MailChimp;
using MailChimp.Helper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceModel.Channels;
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@crallen
crallen / SnakeCaseContractResolver.cs
Created February 26, 2014 20:46
Json.NET contract resolver that uses Ruby-style lowercase with underscore naming conventions.
using Newtonsoft.Json.Serialization;
namespace ConsoleApplication3
{
public class SnakeCaseContractResolver : DefaultContractResolver
{
protected override string ResolvePropertyName(string propertyName)
{
return GetSnakeCase(propertyName);
}
@DavertMik
DavertMik / gist:7969053
Created December 15, 2013 04:53
EmailTestCase for testing emails with MailCatcher in PHPUnit
<?php
class EmailTestCase extends PHPUnit_Framework_TestCase {
/**
* @var \Guzzle\Http\Client
*/
private $mailcatcher;
public function setUp()
{
@barryvdh
barryvdh / _ide_helper.php
Last active May 6, 2024 07:45
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@jbtule
jbtule / AESGCM.cs
Last active October 30, 2023 21:14
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@bradoyler
bradoyler / DataContextWrapper.cs
Created November 2, 2012 13:01
A DataContext wrapper for LINQ to SQL model.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Common;
using System.Data.Linq;
namespace MyApp.Models.DataContextWrapper
{
public interface IDataContextWrapper
@danielcrenna
danielcrenna / XmlFormatter
Created October 2, 2012 20:15
Format XML media as plainly as possible
public class XmlFormatter : MediaTypeFormatter
{
private static readonly IDictionary<Type, XmlSerializer> Cache;
private static readonly XmlSerializerNamespaces IgnoreNamespaces;
static XmlFormatter()
{
Cache = new Dictionary<Type, XmlSerializer>();
IgnoreNamespaces = new XmlSerializerNamespaces();
IgnoreNamespaces.Add("", "");