debugging
parent
39c63d126c
commit
73e1e7b9da
|
@ -1,3 +1,5 @@
|
|||
require "stringio"
|
||||
|
||||
class Pipeline
|
||||
def initialize(source)
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class Array
|
|||
Math.sqrt((avg ** 2 - (map{|i| i.to_f ** 2}.avg)).abs)
|
||||
end
|
||||
|
||||
def my_reduce(&reducer)
|
||||
def reduce(&reducer)
|
||||
ret = Hash.new;
|
||||
each do |k,v|
|
||||
ret[k] = Array.new unless ret.has_key? k;
|
||||
|
@ -289,7 +289,7 @@ class Array
|
|||
map { |x| [x, 0] }.
|
||||
to_h.
|
||||
join(map { |x| (x.to_f / bin_width).to_i * bin_width }.
|
||||
my_reduce { |k,v| v.count },
|
||||
reduce { |k,v| v.count },
|
||||
:left
|
||||
).
|
||||
map { |bin, cnt| [bin, cnt.compact.sum] }.
|
||||
|
|
|
@ -8,7 +8,7 @@ title: Funding Sources
|
|||
<% $db["cv/okennedy/grants"].
|
||||
where { |grant| ["accepted", "completed"].include? grant["status"] }.
|
||||
map { |grant| [grant["start"].split(/\//)[-1].to_i, grant] }.
|
||||
my_reduce.
|
||||
reduce.
|
||||
sort_by { |x| -x[0] }.
|
||||
each do |year, grants| %>
|
||||
<h2><%=year%></h2>
|
||||
|
|
|
@ -4,7 +4,7 @@ title: Publications
|
|||
<div style="height: 20px"> </div>
|
||||
|
||||
<div class="paper_list">
|
||||
<% $db["publications"].map { |pub| [pub["year"].to_i, pub] }.my_reduce.each do |year, pubs| %>
|
||||
<% $db["publications"].map { |pub| [pub["year"].to_i, pub] }.reduce.each do |year, pubs| %>
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<center><h2><%= year %></h2></center>
|
||||
|
|
Loading…
Reference in New Issue