Fixes issue(s) # .
Changes proposed in this pull request:
/cc relevant people
Hop into a shell and to the root directory of your project and run | |
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr | |
Then wait a bit. You get a nice sorted list of lines of code and author name. | |
Add it to your bash profile like this | |
whodunit() { | |
git ls-tree --name-only -z -r HEAD -- $1 | xargs -0 -n1 git blame --line-porcelain | grep "^author "|sort|uniq -c|sort -nr | |
} |
Create bookmark and drop this in the URL field | |
javascript:!function(){let e,t=["kevinhyunilkim","rhkwong","yingyingchoi","t3ly","roger-mo-gusto","julieqdchen-gusto","Lizard381","jaguar1014"];function n(){if(t.length>0){const e=t.shift();document.getElementById("review-filter-field").value=e,document.getElementById("review-filter-field").dispatchEvent(new Event("focus"));let i=0;const s=function(){let t=document.querySelectorAll(".filterable-active .select-menu-item"),c=null;t.forEach(function(t){-1!==t.textContent.toLowerCase().indexOf(e.toLowerCase())&&(c=t)}),c?(c.click(),setTimeout(n,200)):i%3E8?setTimeout(n,200):(i++,setTimeout(s,500))};s()}else%20document.querySelectorAll(%22.sidebar-assignee.js-discussion-sidebar-item%20summary%22)[0].click(),e.parentNode.removeChild(e)}function%20i(){const%20e=function(){const%20t=document.querySelectorAll(%22.select-menu-list%20.select-menu-item%22).length;null==document.querySelector(%22.js-discussion-sidebar-menu%20.select-menu-header%22).offsetParent&&document.que |
Options -Indexes |
Fixes issue(s) # .
Changes proposed in this pull request:
/cc relevant people
RSpec::Matchers.define :be_monotonically_increasing do | |
match do |actual| | |
derivative = actual.each_cons(2).map{|x, y| y <=> x} | |
derivative.all?{|v| v >= 0} | |
end | |
failure_message_for_should do |actual| | |
"expected array #{actual.inspect} to be monotonically increasing" | |
end |
#!/usr/bin/env ruby | |
# require 'pry' | |
# require 'byebug' | |
module DelegateMe | |
def delegate_methods(methods, to:) | |
[methods].flatten.each do |method_name| | |
define_method method_name do |*arg, &block| | |
base = send(to) |
def tally inp; hash = Hash.new(0); inp.each {|k,v| hash[k] +=v}; hash; end | |
def histogram inp; hash = Hash.new(0); inp.each {|v| hash[v]+=1}; hash; end | |
def histogram2 inp; Hash[*inp.group_by{ |v| v }.flat_map{ |k, v| [k, v.size] }] end | |
def test_tally | |
tally([['a',1],['b',1],['a',1],['c',1],['a',3], ['c',1]]) == {'a'=>5, 'b'=>1, 'c'=>2} | |
end | |
def test_histogram | |
histogram(['a','b','a','c','a', 'c']) == {'a'=>3, 'b'=>1, 'c'=>2} |
(defun is-ruby-file (f) | |
(if (string-match "\\.rb$" f) | |
t | |
nil | |
)) | |
(defun is-javascript-file (f) | |
(if (or | |
(string-match "\\.jsx?$" f) | |
(string-match "\\.json$" f)) |
# because i can never remember exactly how and when to use concat | |
# when building content in helpers | |
def nested_content | |
content_tag 'div' do | |
concat(content_tag 'span', 'span block') | |
concat(tag 'br') | |
concat(link_to 'root link', root_path) | |
concat(tag 'br') | |
concat(link_to('#') do | |
concat(content_tag 'h2', 'Head \'em off') |
fetch
is a modern browser native XHR request handler that returns a promise. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
axios
is a library that does the same thing. https://github.com/axios/axios
The way they return data is a little different. Let's compare.