Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Nick Berardi nberardi

😀
View GitHub Profile
@nberardi
nberardi / FacebookGroupDelete.js
Created Feb 13, 2020
Allows you to delete all the members from a Facebook group, so that it can be removed.
View FacebookGroupDelete.js
var _memberMenus = document.getElementsByTagName('button');
var _confirmed = false;
var _i = 0;
var _f = 0;
var _resetAttempted = false;
var _waitCount = 0;
function clickMemberMenu() {
if (typeof(_memberMenus[_f]) !== 'undefined' && _memberMenus[_f].getAttribute('aria-label') == 'Member Settings') {
_resetAttempted = false;
@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
{
You can’t perform that action at this time.