Skip to content

Instantly share code, notes, and snippets.

#!/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
@gaearon
gaearon / slim-redux.js
Last active December 3, 2024 06:34
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
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])) {