Skip to content

Instantly share code, notes, and snippets.

View apbendi's full-sized avatar

Ben DiFrancesco apbendi

View GitHub Profile
Compiling 27 files with 0.8.15
Solc 0.8.15 finished in 4.95s
Compiler run successful (with warnings)
warning[2072]: Warning: Unused local variable.
--> test/UmbraBatchSend.t.sol:162:5:
|
162 | uint256 totalToll = toll * sendEth.length + toll * sendToken.length;
| ^^^^^^^^^^^^^^^^^
// Find the first ViewController of an arbitrary type anywhere in the hierarchy of a base ViewController
private func findParent<V: UIViewController>(ofViewController viewController: UIViewController?) -> V? {
if let typedViewController = viewController as? V {
return typedViewController
}
guard let parentViewController = viewController?.parentViewController else {
return nil
}
@apbendi
apbendi / Regex.swift
Last active January 3, 2016 13:59 — forked from ningsuhen/Regex.swift
Swift extension for Native String class to support Regex match and Regex replace. Credit - http://www.swift-studies.com/blog/2014/6/12/regex-matching-and-template-replacement-operators-in-swift *Updated for Swift 2.0*
import Foundation
struct Regex {
var pattern: String {
didSet {
updateRegex()
}
}
var expressionOptions: NSRegularExpressionOptions {
didSet {
@apbendi
apbendi / 4clojure.clj
Last active August 29, 2015 14:01
A Clojure Noob's 4clojure solutions
; A work in progress: a clojure noob works through 4clojure.com problems.
; Solutions here are by NO MEANS the best way to do these problems.
; Learning as I go here!
; #1
true
; #2
4
@apbendi
apbendi / core_functions_in_depth.clj
Last active October 22, 2021 02:16
Solutions: Clojure for the Brave and True (braveclojure.com)
; In Clojure for the Brave and True (braveclojuure.com),
; at the end of the chapter "Core Functions in Depth", the author
; prevents several challanges to build on top of some sample code
; he has provided
; This code is provided by the author:
;; In ns below, notice that "gen-class" was removed
(ns fwpd.core
;; We haven't gone over require but we will.