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 'integration_helper' | |
require 'rack' | |
require 'rack/handler/webrick' | |
describe HttpClient do | |
before :all do | |
@server = WEBrick::HTTPServer.new( | |
:Port => 9293, | |
:Logger => Rails.logger, | |
:AccessLog => Rails.logger |
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
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew cask install google-chrome | |
brew cask install slack | |
brew cask install sublime-text | |
brew cask install telegram-desktop | |
brew cask install spotify | |
brew cask install firefox | |
brew cask install iterm2 | |
brew cask install skype |
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 "dry-validation" | |
schema = Dry::Validation.Schema do | |
optional(:vin).maybe(:str?) | |
optional(:chassis_number).maybe(:str?) | |
optional(:engine_number).maybe(:str?) | |
optional(:body_number).maybe(:str?) | |
rule(numbers_presense: [:vin, :chassis_number, :engine_number, :body_number]) do |vin, chassis_number, engine_number, body_number| | |
vin.filled? | (engine_number.filled? & (chassis_number.filled? | body_number.filled?)) |
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 Aclass | |
def some_method | |
end | |
end | |
class Bclass < Aclass | |
end | |
class Cclass < Bclass | |
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
require "httparty" | |
require "base64" | |
# Put there your client id | |
client_id = "..." | |
binary_file = IO.read("image.jpg"); | |
base64_encoded_file = Base64.encode64(binary_file); | |
response = HTTParty.post( |
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 'spec_helper' | |
require 'ostruct' | |
class FakePostRepo | |
attr_reader :posts | |
def initialize | |
@posts = [] | |
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
# example 1 (current) | |
(1..100).each_slice(10) do |ids| | |
puts ids.inspect #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
end | |
# example 2 (suggestion) | |
(1..100).each_slice(10) do |ids| | |
puts ids.inspect #=> (1..10) | |
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
success = ProviderResponse::Success.new( | |
guid: transaction.guid, | |
status: :success | |
) | |
success = | |
ProviderResponse::Success.new( | |
guid: transaction.guid, | |
status: :success | |
) |
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 "active_support/core_ext/object/blank" | |
class FizzBuzzChecker | |
def initialize(point, point_name) | |
@point_name = point_name | |
@point = point | |
@current = 1 | |
end | |
def check |
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
http://apple.stackexchange.com/questions/14001/how-to-turn-off-all-animations-on-os-x | |
``` | |
# opening and closing windows and popovers | |
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false | |
# smooth scrolling | |
defaults write -g NSScrollAnimationEnabled -bool false | |
# showing and hiding sheets, resizing preference windows, zooming windows |
NewerOlder