Skip to content

Instantly share code, notes, and snippets.

View ndizazzo's full-sized avatar

Nick DiZazzo ndizazzo

View GitHub Profile
@ndizazzo
ndizazzo / MulticastDelegate.swift
Created November 8, 2018 16:02
Swift Multicast Delegate
// Original obtained from: https://stackoverflow.com/a/44697868
// Modified to avoid force casts + use Swift 4.2 features
internal final class MulticastDelegate <T> {
private let delegates: NSHashTable<AnyObject> = NSHashTable.weakObjects()
func add(delegate: T) {
delegates.add(delegate as AnyObject)
}

Keybase proof

I hereby claim:

  • I am ndizazzo on github.
  • I am ndizazzo (https://keybase.io/ndizazzo) on keybase.
  • I have a public key ASDIzhfuaWY-G-tMIhRRjkNNKYWrFl8YHDzl75WI68UiUAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ndizazzo on github.
  • I am ndizazzo (https://keybase.io/ndizazzo) on keybase.
  • I have a public key ASDCyS-wZ-4H_Q1nFJn37jV_ftVauoBtI9vjRT-VcJWfrwo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1E5xo8qHgzVzmw8SKLYgW1w76cy3MAwnVP https://explorer.blockstack.org/address/1E5xo8qHgzVzmw8SKLYgW1w76cy3MAwnVP
@ndizazzo
ndizazzo / gist:7add514dd59243f352049c1278c61091
Created May 5, 2017 14:57
Abort commit if snapshot tests are left on
PROJ_PREFIX='*-ios'
function projroot()
{
while [[ $PWD != '/' && ${PWD##*/} != $PROJ_PREFIX ]]; do cd ..; done
}
projroot
if test $(grep -R "self.recordMode = true" ./*SnapshotTests | wc -c) != 0 ; then
echo "You have left record mode on in this commit!"
@ndizazzo
ndizazzo / button_link.rb
Last active December 17, 2015 10:09
Rails helper code that generates a bootstrap font icon, which links to the provided path.
@ndizazzo
ndizazzo / rails_routes.rb
Last active December 17, 2015 05:38
Provides an array of your root-level rails routes without leading slashes.
routes = Rails.application.routes.routes.map { |route| route.path.spec.to_s }.each { |r| r.replace(r.match(/^\/(\w+)/).to_s).tr!('/', '') }.delete_if(&:empty?).uniq!