Skip to content

Instantly share code, notes, and snippets.

View Vaguery's full-sized avatar

Bill Tozier Vaguery

View GitHub Profile
@Vaguery
Vaguery / sinatra_subtree_spike.rb
Last active August 29, 2015 14:06
A rewriting approach (design spike only)
require 'sinatra/base'
class Subtrees < Sinatra::Base
# articles and all associated images live like this inside sinatra app folder:
#
# /public
# /articles
# /article-slug-1
# article.markdown
@Vaguery
Vaguery / gist:83088b27c557dfbb0617
Created June 10, 2014 12:44
Wrestling with Swift identity functions
import Cocoa
// This is a Swift Playground to explore some unexpected behavior of '==='.
//
// ICYMI, '===' is the test of _identity_ in Swift; two values a,b are
// references to the same object if a === b
//
// My concern with this is the necessity of testing eqality and identity when
// manipulating complex graphs constructed automatically by code.
//
@Vaguery
Vaguery / gist:cfbfab9ba302c6fd3134
Created June 8, 2014 18:40
Discriminated unions, initializer delegation, and all kinds of freaky Swift junk...
// Playground - noun: a place where people can play
import Cocoa
class PushPoint {
enum PushType {
case Noop
case Integer(Int)
case Boolean(Bool)
case Float(Double)
@Vaguery
Vaguery / gist:bb283f8d70685ae1737c
Created June 6, 2014 10:59
Swift protocol conformance
@objc protocol DeepCopyable {
class func deep_copy() -> Self
}
class NonconformingClass {
}
class ImmediatelyConformingClass: DeepCopyable {
# settings
population = 1000 # number of individuals
conditions = 10 # number of training cases
resolution = 8 # number of values each training case can take (iid)
# setup
score_vectors = {}
(0..population).each {|i| score_vectors[i] = conditions.times.collect {rand(resolution)}}
@Vaguery
Vaguery / mcburton_wants_expressions.md
Last active August 29, 2015 13:59
there I sketched the project already

MC Burton Wants Expressions

Statement that We Have Problems

We Begin: Beards Have Been Scratched

Actual Work is Undertaken

A Dramatic Turn!

@Vaguery
Vaguery / winkler14.rb
Last active February 22, 2019 11:43
A brute force approach to find multipliers for the first part of Peter Winkler's math puzzle 'Zeros, ones or twos', in his book _Mathematical Puzzles_
# A horrible awful brute-force approach to Peter Winkler's 'Zeroes, ones and twos' problem, part 1
(1..100).each do |p|
found = false
q = 0
until found
q += 1
product = p * q
if !(product.to_s =~ /[^01]/) || q > 1000000000
found = true
p "#{p} * #{q} = #{product}"
@Vaguery
Vaguery / tp.taskpaper
Last active January 3, 2016 21:59 — forked from ttscoff/tp2md.rb
Trying to update for Ruby 1.9+
Test project 1:
- test task 2 @testTag
- test task 2
Test project 2:
- project 2 task 1
- project 2 task 3
Test sub project:
- sub project task 1 @testTag2
@Vaguery
Vaguery / subsequent_me.txt
Created February 6, 2013 02:55
The poetry of `ShiftLanguage`
subsequent me
subsequent them
atleft impliedby
prior and
subsequent true
below not_me
above impliedby
below or
atright not_impliedby
below nor
<p><code>CsvFormat&lt;List&lt;Transaction&gt;&gt;</code> in body text is rendered as
&#8220;CsvFormat&lt;List<transaction>&gt;".</transaction></p>
<p><code>CsvFormat\&lt;List\&lt;Transaction\&gt;\&gt;</code>
in body text is rendered as &#8220;CsvFormat&lt;List&lt;Transaction&gt;&gt;&#8221;.</p>
<p>In an</p>
<ul>
<li>unordered list</li>