Skip to content

Instantly share code, notes, and snippets.

@rbwendt
rbwendt / gif.go
Created Sep 30, 2016
golang animated gif
View gif.go
package main
import (
"image"
"image/color"
"image/gif"
"os"
)
func line(from, to []float64, img *image.Paletted) {
@rbwendt
rbwendt / index.html
Last active Oct 5, 2016
dumb Perfect blog
View index.html
<!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>
View dimension_value.rb
class DynamicFlow::DimensionValue
include Comparable
attr_accessor :dimension, :value
def initialize(dimension, value)
@dimension = dimension
@value = value
end
def <=>(dv)
View gist:46279bb4e34d5b81641d6be9a7407c55
### 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:
View ruby array of arrays to table.rb
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(' | ') + ' |'