Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile

From http://www.cse.ohio-state.edu/~neelam/courses/788/lwb.pdf

A type specification contains the following information:

  • The type's name
  • A description of the type's value space
  • For each of the type's methods:
    • its name
    • its signature (including signalled exceptions)
  • its behavior in terms of preconditions and postconditions
MODES = { "0" => "---",
"1" => "--x",
"2" => "-w-",
"3" => "-wx",
"4" => "r--",
"5" => "r-x",
"6" => "rw-",
"7" => "rwx" }
def permissions(num)

There's no general rule you can follow here, because it's always going to depend on context. In my experience the kind of feedback loops you create, and the kind of safety nets you need are defined entirely by the domain, the organization, and the team culture.

Here are a few examples:

  1. I do a bit of work for a medium-sized dental clinic. The business manager there is really fun to work with, but has the tendency of changing his mind six times before he settles his ideas. So when he asks for a report, I don't put any effort at all into writing tests or worrying about minor bugs even, because my only goal is to flesh out in code something vaguely resembling what he asked for.

Often times, this means doing a handful of 30 minute prototypes until the requirements settle, each of which would have taken me 2 hours if I drove them via TDD. When things finally cool down, I evaluate the complexity and maintainability of the resulting code and either leave it untested, add some acceptance tests, backfill unit tes

A LALR parser is a parser that:

  • Parses text in a single direction. Backtracking is avoided by looking ahead in the input stream before deciding how to parse a single token. (LA = Look-ahead)

  • Parses text starting from the left-most side of the input stream. (L=Left-to-right input processing)

  • Builds a parse-tree from the bottom up by repeatedly attempting to match

$ curl -O http://pkgs.fedoraproject.org/repo/pkgs/libyaml/yaml-0.1.6.tar.gz/5fe00cda18ca5daeb43762b80c38e06e/yaml-0.1.6.tar.gz
$ mv yaml-0.1.6.tar.gz `brew --cache libyaml`
$ brew upgrade libyaml
To begin our explorations, let's look at an example from the Internet
Relay Chat (IRC) protocol. The following string represents the
command that you'd need to send to an IRC server to post a message
to a particular channel:
```ruby
"PRIVMSG #practicing-ruby-testing :Seasons greetings to you all!\r\n"
```
Even if you've never used IRC before or looked into its implementation

To begin our explorations, let's look at an example from the Internet Relay Chat (IRC) protocol. The following string represents the command that you'd send to an IRC server to post a message to a particular channel:

"PRIVMSG #practicing-ruby-testing :Seasons greetings to you all!\r\n"

Even if you've never used IRC before or looked into its implementation

duration,time,difference
1,20.367,3.367
2,23.967,3.600
3,27.167,3.200
4,32.833,5.666
5,37.933,5.100
6,40.333,2.400
7,42.600,2.267
8,45.767,3.167
9,47.333,1.566
class Chainable
def initialize(target)
@target = target
end
def method_missing(*a, &b)
@target.send(*a, &b)
self
end
end