Skip to content

Instantly share code, notes, and snippets.

Nick Berardi nberardi

Block or report user

Report or block nberardi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nberardi
nberardi / NSUrlSessionHandler.cs
Last active May 4, 2016
A rethinking of the NSUrlSessionHandler.
View NSUrlSessionHandler.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@nberardi
nberardi / HomeController.cs
Created Mar 20, 2014
Example For Flushing Before Execution for Nik Molnar
View HomeController.cs
public class HomeController : Controller {
public ActionResult Index () {
ViewBag.ExecuteAction = () => {
// do stuff here
return model;
};
return View();
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am nberardi on github.
  • I am nberardi (https://keybase.io/nberardi) on keybase.
  • I have a public key whose fingerprint is 2404 DB48 5F66 9949 BECB A593 FFE7 811A CF75 F8CE

To claim this, I am signing this object:

View NSDataStream.cs
public unsafe class NSDataStream : UnmanagedMemoryStream
{
public NSDataStream(NSData data)
: base((byte*)data.Bytes, data.Length)
{
_data = data;
}
private readonly NSData _data;
@nberardi
nberardi / executify.csx
Last active Dec 20, 2015
executify.csx
View executify.csx
#r "System.Drawing.dll"
/*
* To use a GitHub Gist with Executify, you need to have a
* file named "executify.csx" in your Gist. Then you reference
* the Gist Identity in the Executify URL as
* http://executify.com/gist/{gist_id}
*/
using System.IO;
View example.cs
#r "System.Drawing.dll"
using System.IO;
using System.Drawing;
using System.Net;
var client = new WebClient();
var bytes = client.DownloadData("http://www.hdwallpapersplus.com/wp-content/uploads/2013/05/Funny-Cat-Pictures-cats-935656_500_375.jpg");
var stream = new MemoryStream(bytes);
var image = Image.FromStream(stream);
View Poker.cs
namespace Consensus.Hubs
{
public class Poker : Hub
{
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
private static Dictionary<string, PokerUser> _users = new Dictionary<string, PokerUser>();
private static List<PokerRoom> _rooms = new List<PokerRoom>();
public PokerUser Join(PokerUser user)
@nberardi
nberardi / DateTimePrecise.cs
Created Sep 21, 2012
A more precise DateTime in .NET
View DateTimePrecise.cs
using System;
using System.Diagnostics;
using System.Linq;
namespace System
{
public class DateTimePrecise
{
private static readonly DateTimePrecise Instance = new DateTimePrecise(10);
@nberardi
nberardi / GuidGenerator.cs
Created Sep 21, 2012
TimeUUID Generator for .NET
View GuidGenerator.cs
using System;
namespace FluentCassandra
{
/// <summary>
/// Used for generating UUID based on RFC 4122.
/// </summary>
/// <seealso href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace</seealso>
public static partial class GuidGenerator
{
@nberardi
nberardi / BigDecimal.cs
Created May 12, 2012
BigDecimal type in .NET
View BigDecimal.cs
using System;
using System.Linq;
namespace System.Numerics
{
public struct BigDecimal : IConvertible, IFormattable, IComparable, IComparable<BigDecimal>, IEquatable<BigDecimal>
{
public static readonly BigDecimal MinusOne = new BigDecimal(BigInteger.MinusOne, 0);
public static readonly BigDecimal Zero = new BigDecimal(BigInteger.Zero, 0);
public static readonly BigDecimal One = new BigDecimal(BigInteger.One, 0);
You can’t perform that action at this time.