Skip to content

Instantly share code, notes, and snippets.

View bmnick's full-sized avatar

Ben Nicholas bmnick

View GitHub Profile
import UIKit
/**
A specialized scroll view that allows clicking through a trailing section of it's content. This is used for a
transparent section at the end of the target rows that can be tapped through. It simply reports any points
within the last `clickThroughOffset` points of the view as not belonging to the view.
*/
private class BNOffsetClickThroughScrollView: UIScrollView {
/**
@bmnick
bmnick / Main.storyboard
Created August 7, 2014 14:09
Minimal reproduction of focus bug in VENTokenField with table view inputs
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pGg-6v-bdr">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
</dependencies>
<scenes>
<!--Master View Controller - Master-->
<scene sceneID="VgW-fR-Quf">
<objects>
<tableViewController title="Master" id="pGg-6v-bdr" customClass="MasterViewController" sceneMemberID="viewController">
### Keybase proof
I hereby claim:
* I am bmnick on github.
* I am bmnic (https://keybase.io/bmnic) on keybase.
* I have a public key whose fingerprint is 065A C491 C7A5 6B6C DB37 C746 947D 726A 3CC0 8D52
To claim this, I am signing this object:
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@bmnick
bmnick / fizzbuzz.rb
Created October 5, 2012 06:50
Fizz Buzz (and possibly more) with a Chain of Responsibility
class Responder
def initialize(content, divisor, next_responder = FallbackResponder.new)
@content, @divisor, @next_responder = content, divisor, next_responder
end
def respond(value, current = '')
current << @content if value % @divisor == 0
@next_responder.respond(value, current)
end
@bmnick
bmnick / wc.rb
Created May 16, 2012 19:41
Reimplementing wc for fun in ruby
require 'optparse'
require 'pp'
options = {}
counts = []
def count_stream stream, options
counts = []
if options[:line]
/******************************************************************************
* Module (there is no .c file, only this header) to provide timing
* instrumentation macros. The timing instrumentation macros can be
* globally enabled and controlled as using the EN TIME macro. This macro
* can be defined or un-defined within a source code file (even within this
* file). If this is done then the timers cannot be controlled from the
* compiler command line. Since it will often be the case that the
* application would be built with and without the timers it is recommended
* that the EN TIME macro *not* be defined or un-defined directly in the
* source code. Instead, by using the “-D” command line option to gcc (as
//////////////////////////////////////////////////////////////////////////////
// Linear Curve Fitting - This program fits a line to the data points in the
// file provided on the command line (one data point per line of text in the
// file).
//////////////////////////////////////////////////////////////////////////////
#include <fstream>
#include <list>
using namespace std;
#include <iostream>
#include "data.h"
@bmnick
bmnick / RITBuildingNames.txt
Created September 4, 2011 20:52
RIT Building Numbers to abbreviations
EAS 001 George Eastman Hall
RIA 002 Frank Ritter Arena
CLK 003 George H. Clark Gymnasium
SAU 004 Student Alumni Union
WAL 005 Wallace Library
LBR 006 Liberal Arts Hall
UNI/VIG 007A University Gallery/Vignelli Center for Design Studies
GAN 007B Frank E. Gannett Hall
GOS 008 Thomas Gosnell Hall
GLE 009 James E. Gleason Hall
@bmnick
bmnick / twss.rb
Created May 2, 2011 02:17
That's what she said autoresponder for iChat
#!/usr/bin/env ruby
require 'rubygems'
require 'twss'
# Read in from command line arguments
input_value = ARGV.shift
# make it more common
TWSS.threshold = 3.0