Skip to content

Instantly share code, notes, and snippets.

View priyankamk's full-sized avatar
🎯
Focusing

Priya priyankamk

🎯
Focusing
  • Arkade
  • Melbourne
View GitHub Profile
@priyankamk
priyankamk / ruby.md
Last active September 25, 2019 00:44
How to create a new ruby project

Ruby Project

  1. Make a folder for your project:

$ mkdir ruby_project

  1. Getting started with bundler is easy! Open a terminal window and run this command:

$ gem install bundler

@priyankamk
priyankamk / keybase.md
Created May 17, 2019 00:40
Keybase chat

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@priyankamk
priyankamk / how_to_add_integer_in_an_array.md
Last active May 6, 2019 05:17
How to add elements or integer or values in an array - RUBY

How to add integer in an array using inject - reduce family.

ar =[1000000001, 1000000002, 1000000003, 1000000004, 1000000005]
ar.inject(0) {|sum, x| sum + x}
5000000015
@priyankamk
priyankamk / How_to_compare_two_items_in_array.md
Created May 6, 2019 01:50
How to compare two items(values) in an array - RUBY

Comparing two values in an array of numbers.

ar = [1,2,1,2,1,3,2]
ar.group_by{|x| x}.values.map {|x| x.size/2 }.reduce(&:+)
2

To check any error in your file

bundle exec rake rubocop:auto_correct
@priyankamk
priyankamk / pullrequest_and_checkout.md
Last active May 7, 2019 11:54
how to add a pull request and checkout.md

When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.

Before creating a new branch, pull the changes from upstream. Your master needs to be up to date.

Switch to master branch using:

git checkout master
@priyankamk
priyankamk / command_line_and_how_to_Read_other_txt_Folder.md
Last active May 3, 2019 01:00
ARGV - ruby command line arguments

Ruby command line arguments By Alvin Alexander. Last updated: June 3 2016 Ruby FAQ: How do I read command line arguments in a Ruby script (Ruby command line args)?

To read command line args in a Ruby script, use the special Ruby array ARGV to get the information you need. Here are a few examples.

  1. Getting the number of command line args To get the number of command line arguments passed in to your Ruby script, check ARGV.length, like this:

quit unless our script gets two command line arguments

@priyankamk
priyankamk / config.yml
Last active April 22, 2019 01:59
.circle/config.yml
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.5.0-node-browsers
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
PGUSER: app-user
@priyankamk
priyankamk / .env
Created March 31, 2019 01:13
.env example
GIPHY_API_KEY=some-awesome-key
@priyankamk
priyankamk / rails_env.md
Created March 31, 2019 01:08
rails_console_env_example.md
~> rails c
Running via Spring preloader in process 54134
Loading development environment (Rails 5.2.2.1)

irb(main):001:0> ENV
=> { RAILS_ENV: "development }