Skip to content

Instantly share code, notes, and snippets.

View gizipp's full-sized avatar
🏠
Working from home

Gilang gizipp

🏠
Working from home
View GitHub Profile
@gizipp
gizipp / ruby-problem-test.md
Last active February 17, 2021 10:45
Ruby Problem Test

There are 2 problem that you may solve. You can create a text file with your answer and send to gizipp.gizipp@gmail.com, write on pastebin, or reply with your answer. Here's the problems :

1. Char Occurrence Counter

Make a small Ruby script to find the occurrence of each character in a word

Example Input and Output:

a)

@gizipp
gizipp / scrape-play-store.rb
Created October 11, 2020 06:49
Scrapes and parses application from the Google Play Store by query
require 'mechanize'
require 'pry'
require 'csv'
query = 'racing multiplayer'
agent = Mechanize.new
page = agent.get("https://play.google.com/store/search?q=#{query}&c=apps")
top_50_apps_links = []
page.links.each do |link|
@gizipp
gizipp / upgrade-rails-4-into-rails-6.md
Created April 7, 2020 11:34
Upgrade Rails 4 into Rails 6

How to upgrade Rails 4 into Rails 6? Step by Step

  • It's recommended to set ruby into e.g v2.6.5 by creating .ruby_version (if your are using rbenv) and add ruby '2.6.5' in Gemfile

    # Gemfile
    source 'https://rubygems.org'
    
    ruby '2.6.5'
@gizipp
gizipp / rspec-setup-in-rails-6.md
Created March 24, 2020 00:39
Rspec Setup in Rails 6
  1. Add rspec-rails in development and test group
group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'sqlite3', '~> 1.4'
  gem 'rspec-rails', '~> 3.9.0'
end
@gizipp
gizipp / sandi-metz-rules-for-developers.md
Created March 19, 2020 08:56
Sandi Metz' Rules For Developers
  1. Classes can be no longer than one hundred lines of code.
  2. Methods can be no longer than five lines of code.
  3. Pass no more than four parameters into a method. Hash options are parameters.
  4. Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object (@object.collaborator.value is not allowed).

https://yiming.dev/blog/2017/08/23/sandi-metzs-rules-for-oop/ https://thoughtbot.com/blog/sandi-metz-rules-for-developers

@gizipp
gizipp / status-code-explained.md
Created February 27, 2020 00:46
Status Code Explained

Status Code Explained

  • 200 – OK Everything is working

  • 201 – CREATED New resource has been created

  • 204 – NO CONTENT

@gizipp
gizipp / reset-database-pg-on-heroku.md
Created February 21, 2020 11:24
[Rails] How to reset PG Database on Heroku?

How to reset PG Database on Heroku?

TL;DR

heroku restart && heroku pg:reset DATABASE && heroku run rake db:migrate

Steps

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
@gizipp
gizipp / gist:4c6093e3851c2c6233ab57124e293915
Created February 21, 2019 09:17
Photography Call For Entries
https://visitcenter.org/call-for-entries/
https://jipfest.com/call-for-submissions/