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
#!/usr/bin/env ruby | |
require 'find' | |
ACCESS_DENIED = ["$Recycle.Bin", "Documents and Settings", "Program Files", "Program Files (x86)", "ProgramData", ".", ".."] | |
def search(name, dirname = ".") | |
Find.find(dirname).find do |path| | |
! ACCESS_DENIED.include?(File.basename(path)) && | |
! File.directory?(path) && | |
File.basename(path) == name |
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
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |