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
| class Opencv < Formula | |
| desc "Open source computer vision library" | |
| homepage "http://opencv.org/" | |
| url "https://github.com/opencv/opencv/archive/2.4.13.2.tar.gz" | |
| sha256 "4b00c110e6c54943cbbb7cf0d35c5bc148133ab2095ee4aaa0ac0a4f67c58080" | |
| revision 2 | |
| bottle do | |
| sha256 "db402b1fbfc0ae68dd024fc78f63ad4232a64300a8c40b32cb39668d1c8637b2" => :high_sierra | |
| sha256 "53cfcc3c43d671f32a7723e369c3501d65218f4084d9d2fa633671cf14c8381b" => :sierra |
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
| def json_pretty(obj) | |
| str = StringIO.new | |
| Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i) | |
| str.rewind | |
| puts str.read.gsub("=>", ": ") | |
| end | |
| def pretty(obj) | |
| str = StringIO.new | |
| Pry::ColorPrinter.pp(JSON.parse(obj.to_json), str, (`tput cols` || "200").strip.to_i) |
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
| class CaptureThings | |
| attr_reader :things | |
| def initialize(&block) | |
| @things = [] | |
| instance_eval(&block) | |
| end | |
| def method_missing(thing) | |
| @things << thing.to_s | |
| end | |
| end |
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
| class RedisLock | |
| class << self | |
| def with_lock(name, wait: false) | |
| key = "LOCK:#{name}" | |
| until fetch_lock(key) | |
| if wait | |
| sleep(1) | |
| else | |
| return | |
| end |
OlderNewer