Skip to content

Instantly share code, notes, and snippets.

View boddhisattva's full-sized avatar
🌷
Vasudhaiva Kutumbakam 🙂

Mohnish G J boddhisattva

🌷
Vasudhaiva Kutumbakam 🙂
View GitHub Profile
@boddhisattva
boddhisattva / setup_system_tests_with_rspec_devise_rails6.md
Last active November 9, 2023 20:58
Setup System tests to work with RSpec, Devise and Rails 6

Setting this up took quite a bit of time and research for me, so just thought of sharing the learnings along the way that led to a working setup.

  • Initial error that I was getting with running System tests in Rails 6

    System test integration requires Rails >= 5.1 and has a hard dependency on a webserver and `capybara`, please add capybara to your Gemfile and configure a webserver (e.g. `Capybara.server = :webrick`) before attempting to use system tests.
    • since the error above says specify Capybara in the Gemfile, a part of my Gemfile looked like below:
@boddhisattva
boddhisattva / Guardfile
Created March 6, 2019 11:38
Guardfile code for running the exercise related tests in Exercism's Ruby Track
guard :minitest, test_folders: '.' do
watch(%r{^(.*/)?([^/]+)\.rb$}) do |match_data|
test_file = if match_data[2].include? "test"
match_data[2].split('_').first
else
match_data[2]
end
"./#{test_file}_test.rb"
@boddhisattva
boddhisattva / spec.rb
Last active December 27, 2018 07:48
Red-Green-Refactor by Example related exercise as part of the Fundamentals of TDD course in Upcase (https://thoughtbot.com/upcase/videos/red-green-refactor-by-example)
require 'rspec/autorun'
class Person
def initialize(first_name: , middle_name: nil, last_name: )
@first_name = first_name
@middle_name = middle_name
@last_name = last_name
end
@boddhisattva
boddhisattva / rna_transcription_v3.ex
Created October 24, 2018 10:34
RNA Transcript exercise v3
defmodule DNA do
@nucleotides %{?A => ?U, ?C => ?G, ?G => ?C, ?T => ?A }
@doc """
Transcribes a character list representing DNA nucleotides to RNA
## Examples
iex> DNA.to_rna('ACTG')
'UGAC'
defmodule RNATranscription do
@guanine ?G
@adenine ?A
@cystosine ?C
@uracil ?U
@thymine ?T
@doc """
Transcribes a character list representing DNA nucleotides to RNA
@boddhisattva
boddhisattva / rna_transcription.ex
Last active October 24, 2018 10:18
RNA Transcription Exercise - Elixir
defmodule RNATranscription do
@guanine "G"
@adenine "A"
@cystosine "C"
@uracil "U"
@thymine "T"
@doc """
Transcribes a character list representing DNA nucleotides to RNA
@boddhisattva
boddhisattva / supervisors_in_iex.md
Last active May 12, 2018 23:39
Trying out supervisors with Elixir:)
@boddhisattva
boddhisattva / check_the_elixir_version_being_used.md
Last active January 16, 2017 02:44
How to check the elixir version being used

In order to check which Elixir version one is currently using, you could use -

Either

a.

  elixir --version

or

@boddhisattva
boddhisattva / Preferences.sublime-settings
Last active January 11, 2017 01:10
Sublime Text 3 settings
{
"color_scheme": "Packages/Github Color Theme/GitHub.tmTheme",
"ensure_newline_at_eof_on_save": false,
"find_selected_text": true,
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"index_files": true,
@boddhisattva
boddhisattva / compare_strip_empty_vs_regex_implementation_for_silent.rb
Last active May 21, 2016 11:22
Benchmark comparison scripts wrt the bob exercise
SILENT = /\A\s*\z/
SILENT2 = ->(remark) { remark.strip.empty? }
def hey_fast(remark)
case remark
when SILENT
'Fine. Be that way!'
else
"Whatever."