This file contains 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 RIO | |
def self.succeed_now(value) | |
Succeed.new(value) | |
end | |
def self.fail_now(error) | |
Fail.new(error) | |
end | |
def flat_map(&blk) |
This file contains 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
require "minitest/autorun" | |
class TestIntersectionFilter < Minitest::Test | |
def test_data | |
[[1, 2, 3], [1, 2, 4], [1, 2, 5], | |
[1, 5, 7], [1, 5, 8], [1, 5, 9]] | |
end | |
def test_that_it_works | |
filtered_data = IntersectionFilter.filter(test_data) |
This file contains 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
https://lyncwebsp.softtek.com/lwa/WebPages/LwaClient.aspx?legacy=RmFsc2U!&xml=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48Y29uZi1pbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3J0Yy8yMDA5LzA1L3NpbXBsZWpvaW5jb25mZG9jIj48Y29uZi11cmk-c2lwOmNhcmxvcy52YXJnYXNAc29mdHRlay5jb207Z3J1dTtvcGFxdWU9YXBwOmNvbmY6Zm9jdXM6aWQ6UThVR0xKRzI8L2NvbmYtdXJpPjxzZXJ2ZXItdGltZT4xMzkuMDk5NDwvc2VydmVyLXRpbWU-PG9yaWdpbmFsLWluY29taW5nLXVybD5odHRwczovL21lZXRzcC5zb2Z0dGVrLmNvbS9jYXJsb3MudmFyZ2FzL1E4VUdMSkcyPC9vcmlnaW5hbC1pbmNvbWluZy11cmw-PGNvbmYta2V5PlE4VUdMSkcyPC9jb25mLWtleT48ZmFsbGJhY2stdXJsPmh0dHBzOi8vbWVldHNwLnNvZnR0ZWsuY29tL2Nhcmxvcy52YXJnYXMvUThVR0xKRzI_c2w9PC9mYWxsYmFjay11cmw-PHVjd2EtdXJsPmh0dHBzOi8vbHluY3dlYnNwLnNvZnR0ZWsuY29tL3Vjd2EvdjEvYXBwbGljYXRpb25zPC91Y3dhLXVybD48dWN3YS1leHQtdXJsPmh0dHBzOi8vbHluY3dlYnNwLnNvZnR0ZWsuY29tL3Vjd2EvdjEvYXBwbGljYXRpb25zPC91Y3dhLWV4dC11cmw-PHVjd2EtaW50LXVybD |
This file contains 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
require "rgeo" | |
WGS84 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" | |
WGS84_UTM = "+proj=utm +zone=22 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs" | |
x0, y0 = -48.10311146131618, -15.894902327065926 | |
x1, y1 = -48.103022948419394, -15.894858472899413 | |
mercator = RGeo::Geographic.simple_mercator_factory | |
geographic = RGeo::Geographic.projected_factory(projection_proj4: WGS84) |
This file contains 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
source "https://rubygems.org" | |
gem "minitest" | |
gem "rantly", github: "hayeah/rantly" |
This file contains 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
#!/bin/sh | |
for FILE in `git diff-index --name-status HEAD -- | awk '{print $2}'`; do | |
if [ "echo $FILE | grep .rb" ]; then | |
if [ "grep 'binding.pry|debugger' $FILE" ]; then | |
echo "$FILE: pry or debugger call. Fix it before committing." | |
exit 1 | |
fi | |
fi | |
done |
This file contains 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
require 'minitest/autorun' | |
TowEvent = Struct.new(:id, :license_plate, :category, :operator, :tow_car, | |
:entry_time, :address, :ordering) | |
class OrdersTowEvents | |
WEIGHTS = { truck: 100, car: 200, bike: 300 } | |
attr_reader :grouped_events | |
private :grouped_events |
This file contains 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 DelayableMailer < ActionMailer::Base | |
class QueueSetupError < StandardError; end | |
class << self | |
def queue(options) | |
@queue_name = options.fetch(:name) | |
@workers = options.fetch(:workers) { 2 } | |
setup_queue | |
end |
This file contains 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 MiopicAPI | |
def do_something_with(foo_id, bar_id) | |
foo = Foo.find(foo_id) | |
bar = Bar.find(bar_id) | |
# ... | |
end | |
end | |
# Refactoring 1 |
This file contains 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 Smile.Utils.MarkImageDrawer | |
constructor: (@mark, @canvas) -> | |
@margin = 4 | |
@backgroundColor = '#338e07' | |
@foregroundColor = '#fff' | |
@width = 40 | |
@height = 60 | |
# Public: Draws a Mark in the buffer. | |
# |
NewerOlder