Skip to content

Instantly share code, notes, and snippets.

Aboobacker MK redtachyons

Block or report user

Report or block redtachyons

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@redtachyons
redtachyons / rails-rpush.md
Last active Sep 22, 2018 — forked from alameenkhader/rails-rpush.md
Rpush/Rails Integration
View rails-rpush.md

rpush - https://github.com/rpush/rpush

Follow the steps in rpush to add the gem to your rails project

PushNotificationDevice

rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration
View setup
sudo -u postgres psql postgres
\password postgres
\q
pg_hba.cong -> peer-> md5
@redtachyons
redtachyons / SOLID.markdown
Created Dec 29, 2017 — forked from emaraschio/SOLID.markdown
SOLID Principles with ruby examples
View SOLID.markdown

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

@redtachyons
redtachyons / vcr.rb
Created Sep 7, 2017 — forked from just3ws/vcr.rb
VCR configuration that does a pretty good job of filtering out GitHub, Twitter, and LinkedIn keys.
View vcr.rb
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
c.default_cassette_options = { record: :new_episodes }
c.allow_http_connections_when_no_cassette = false
c.configure_rspec_metadata!
c.ignore_hosts 'codeclimate.com'
View prime.rb
require 'rspec'
require 'prime'
class SocChallenge
def self.call(*args)
new(*args)
end
def initialize(number)
@number = number
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@redtachyons
redtachyons / ways_to_use_vcr.rb
Created Apr 25, 2017 — forked from myronmarston/ways_to_use_vcr.rb
Ways to use VCR for a request made by a let block
View ways_to_use_vcr.rb
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
You can’t perform that action at this time.