Skip to content

Instantly share code, notes, and snippets.

View rubenarakelyan's full-sized avatar
💾
Coding and reminiscing

Ruben Arakelyan rubenarakelyan

💾
Coding and reminiscing
View GitHub Profile
@AndyObtiva
AndyObtiva / ruby-case-statement-array-include-pattern-matching.rb
Created January 1, 2021 01:15
How to test Array Inclusion in Ruby Case Statements via Pattern Matching
# Relating to [YASL](https://github.com/AndyObtiva/yasl)
def dump_ruby_basic_data_type_data(object)
case object.class.ancestors.map(&:name)
in [*, 'Time', *]
object.to_datetime.marshal_dump
in [*, 'Date', *]
object.marshal_dump
in [*, 'Complex', *] | [*, 'Rational', *] | [*, 'Regexp', *] | [*, 'Symbol', *] | [*, 'BigDecimal', *]
object.to_s
in [*, 'Set', *]
@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp

If you've had to re-associate your virtual machine with vagrant, but vagrant ssh now requires a password to connect, this is because the ssh key associated with the box disappeared. You can still get in with the password vagrant (usually), but many workflows will need the automatic connection.

Here's how to regain public/private key authentication to ssh into your vagrant virtual machine:

Run vagrant up, then vagrant ssh-config to find the IdentityFile:

$ vagrant ssh-config
Host default
  HostName 127.0.0.1