Skip to content

Instantly share code, notes, and snippets.

View Momus's full-sized avatar

Dmitri Brengauz Momus

View GitHub Profile
@Momus
Momus / Structured Design
Created May 20, 2018 01:59
W. P. Stevens, G. J. Myers, and L. L. Constantine, “Structured Design,” IBM Systems Journal, Vol. 13, No. 2, 1974
Simplicity is the primary measurement recommended for evaluating alternative
designs relative to reduced debugging and modification time. Simplicity can be
enhanced by dividing the system into separate pieces in such a way that pieces
can be considered, implemented, fixed and changed with minimal consideration
or effect on the other pieces of the system.
@Momus
Momus / Successive Refinement
Created May 20, 2018 01:49
Thinking Forth p12
Successive Refinement
An approach that relies heavily on subroutines is called “Successive Refinement.”
The idea is that you begin by writing a skeletal version of your program
using natural names for procedures for data structures.
Then you write versionsof each of the named procedures.
You continue this process to greater levels of detail until
the procedures can only be written in the computer language itself.
An Englishman, a Frenchman, and a Bavarian were arguing about
what is the hardest language.
"English!" says the Englishman:
"We write 'Leichester' but say 'Lester'"
"No, French!" says the Frenchman:
"We "write 'hors d'ouvres' but say
'Or-derv.'"
"That's nothing," says the Bavarian:
"We write, 'excuse me Sir, could you repeat
youself, I must have misunderstood?' But we say,
A bear sees a rabbit desperatly running through the woods.
The bear says, "what's the hurry?"
The rabbit says, "they're shooting ferrets!"
"But you're not a ferret," says the bear.
"Yeah, OK, and after they shoot you,
good luck explaining you're not a ferret,"
replies the rabbit, and they both start running.
Why do you think that God intended one-based indexing?
Because the He didn't say, "Let there be light!" on the Zeroths Day
@Momus
Momus / errors.txt
Last active March 22, 2016 22:35
Intro to Literate Programming by Howard Abrams possible errors
- Too Many Parameters?
error: should "howard" should be in quotes?
#+HEADER: :dir /etc
#+HEADER: :var USER=howard
#+BEGIN_SRC sh
grep $USER passwd
#+END_SRC
@Momus
Momus / davtools-test.el
Last active August 27, 2015 22:29
Run devtools::test_that on file save
(defun devtools-test ()
;;Run test_that on each save by Brian Malehorn
;;http://stackoverflow.com/questions/32257685/running-rdevtooltest-that-on-buffer-save-in-ess
(interactive)
(when
(let* ((old (current-buffer)))
(string-match (rx-to-string `(: ".R" eos) t) (buffer-name))
(switch-to-buffer "*R*")
(end-of-buffer)
(insert "devtools::test()")
@Momus
Momus / gist:ed3b5bab637b5391a0ea
Last active August 29, 2015 14:22
Bloody Prize

Bloody Prize

  • 1/2 lemon
  • 1 blood orange
  • Your entire purser's ration of @YourBlackMagic
  • As much light agave as needed to take drink from "buccaneer" to "cabin boy"

Squeeze into glass, ice, stir.

@Momus
Momus / MinitestDebug.rb
Last active August 29, 2015 14:21
Using Minitest assertions for debugging in Ruby on Rails
## When you
require 'test_helper'
## and create tests with, for example,
class UsersLoginTest < ActionDispatch::IntegrationTest
## In your
test "verify an important feature" do
## you can use assert statements to print out debugging info
@Momus
Momus / gist:860d9a8c59b1948e154d
Created January 21, 2015 20:24
A little Emacs eshell magic
git rm $(git ls-files --deleted)