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
class Array | |
def to_table | |
column_sizes = self.reduce([]) do |lengths, row| | |
row.each_with_index.map{|iterand, index| [lengths[index] || 0, iterand.to_s.length].max} | |
end | |
puts head = '-' * (column_sizes.inject(&:+) + (3 * column_sizes.count) + 1) | |
self.each do |row| | |
row = row.fill(nil, row.size..(column_sizes.size - 1)) | |
row = row.each_with_index.map{|v, i| v = v.to_s + ' ' * (column_sizes[i] - v.to_s.length)} | |
puts '| ' + row.join(' | ') + ' |' |
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
### Keybase proof | |
I hereby claim: | |
* I am rbwendt on github. | |
* I am rbwendt (https://keybase.io/rbwendt) on keybase. | |
* I have a public key ASAgyHz-jTP3l8PPKmLt9QAuFiLJW0KuQLsodwYyn-CjwAo | |
To claim this, I am signing this object: |
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
class DynamicFlow::DimensionValue | |
include Comparable | |
attr_accessor :dimension, :value | |
def initialize(dimension, value) | |
@dimension = dimension | |
@value = value | |
end | |
def <=>(dv) |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Blog</title> | |
</head> | |
<body> | |
<h1>A blog</h1> | |
<div id="app"> | |
<article v-for="item in items"> | |
<h2>{{ item.title }}</h2> |
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
package main | |
import ( | |
"image" | |
"image/color" | |
"image/gif" | |
"os" | |
) | |
func line(from, to []float64, img *image.Paletted) { |