This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @objc protocol DeepCopyable { | |
| class func deep_copy() -> Self | |
| } | |
| class NonconformingClass { | |
| } | |
| class ImmediatelyConformingClass: DeepCopyable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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)}} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| subsequent me | |
| subsequent them | |
| atleft impliedby | |
| prior and | |
| subsequent true | |
| below not_me | |
| above impliedby | |
| below or | |
| atright not_impliedby | |
| below nor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p><code>CsvFormat<List<Transaction>></code> in body text is rendered as | |
| “CsvFormat<List<transaction>>".</transaction></p> | |
| <p><code>CsvFormat\<List\<Transaction\>\></code> | |
| in body text is rendered as “CsvFormat<List<Transaction>>”.</p> | |
| <p>In an</p> | |
| <ul> | |
| <li>unordered list</li> |