Breadth-first search (BFS) is a strategy for searching in a graph.
The BFS begins at a root node and inspects all the neighboring nodes. Then for each of those neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so on.
| class Canadianize | |
| def initialize(app, arg = "") | |
| @app = app | |
| @arg = arg | |
| end | |
| def call(env) | |
| status, headers, content = @app.call(env) | |
| content[0] += @arg + ", eh?" | |
| [ status, headers, content ] |
| git diff --ignore-space-at-eol --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" > patch.diff |
| ### Keybase proof | |
| I hereby claim: | |
| * I am brianstorti on github. | |
| * I am brianstorti (https://keybase.io/brianstorti) on keybase. | |
| * I have a public key whose fingerprint is AC83 2A13 C81A FD98 4C06 4FF4 01CF 37BD BDBE 035C | |
| To claim this, I am signing this object: |
| ; with "require", I need to use the namespace-qualified name | |
| (require 'examples.foo) | |
| ("bar" examples.foo/function-name) | |
| ; I can use "refer" to avoid that | |
| (require 'examples.foo) | |
| (refer 'examples.foo) | |
| ("bar" function-name) | |
| ; or I can use "use", that will do both the steps for me |
| ; sum the square of the parameters. | |
| (def add-squares | |
| (fn [& args] | |
| (apply + (map * args args)))) | |
| (add-squares 1 2 5) | |
| ; factorial without iteration/recursion. | |
| (def factorial | |
| (fn [number] |
| function virtualenv_info { | |
| [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' | |
| } | |
| function box_name { | |
| [ -f ~/.box-name ] && cat ~/.box-name || hostname -s | |
| } | |
| git_prompt_info () { | |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
Breadth-first search (BFS) is a strategy for searching in a graph.
The BFS begins at a root node and inspects all the neighboring nodes. Then for each of those neighbor nodes in turn, it inspects their neighbor nodes which were unvisited, and so on.
| class Node | |
| attr_reader :name | |
| def initialize(name) | |
| @name = name | |
| @descendants = [] | |
| end | |
| def add_edge(descendant, weight) | |
| @descendants << {:node => descendant, :weight => weight} |
| man() { | |
| PAGER="/bin/sh -c \"col -b | vim -R -c 'set ft=man' -\"" command man $@ | |
| } |
| cap <stage> deploy:cleanup -s keep_releases=1 |