Skip to content

Instantly share code, notes, and snippets.

View amitpatelx's full-sized avatar

Amit Patel amitpatelx

View GitHub Profile
Note for portal developer
-------------------------
Change SubmissionsHelper::MOST_IMPORTANT_PROPERTY_ATTRIBUTES when this list changes
Most important fields starts
-----------------------------
external_link
external_id
title
@amitpatelx
amitpatelx / README.md
Created October 2, 2020 08:19
Spiders > Development and Deployment Processes (WIP)

This page outlines about practices we are following related to development and deployment

Branches

  1. Create branch from master branch unless explicitely mentioned.
  2. Every spider should have own branch.
  3. Pull latest changes from the master/parent branch before creating a branch from it.
  4. Branch name should be self-explanatory, probably same as name of the spider.
  5. Avoid creating nested branches from working branches. Do proper planning before start coding to avoid nested branching.
@amitpatelx
amitpatelx / <country>_spider.rb
Last active September 21, 2020 12:41
Extract property details
# frozen_string_literal: true
class FranceSpider < ApplicationSpider
APARTMENT_TYPES = %w(lejlighed appartement apartment piso flat atico penthouse duplex t1 t2 t3 t4 t5 t6)
def apartment_types
APARTMENT_TYPES
end
HOUSE_TYPES = %w(hus chalet bungalow maison house home villa)
@dteoh
dteoh / rspec_rails_set_session.md
Created May 29, 2020 07:49
Setting session variables in an RSpec Rails request spec

Setting session variables in an RSpec Rails request spec

You are writing a spec with type: :request, i.e. an integration spec instead of a controller spec. Integration specs are wrappers around Rails' ActionDispatch::IntegrationTest class. I usually write controller tests using this instead of type: :controller, mainly because it exercises more of the request and response handling stack. So instead of writing something like get :index to start the request, you would write get books_path or similar.

One of the issues with using type: :request is that you lose the ability to

@absyah
absyah / A helpful ActiveRecord setting only 1 person has ever used
Created August 2, 2019 03:23
Nate Berkopec's Ruby Performance Newsletters
A memory-saving ActiveRecord setting has been used by just one application ever, according to GitHub
There's a common performance problem in many Rails background jobs.
Background jobs often do operations across large sets of data. Basically, they do silly things like User.all.each(&:send_daily_newsletter).
So, there's a problem with that query. In development and test environments, User.all will probably return a few rows, maybe a dozen at most. Most developers have extremely limited seed data on their local machines.
In production, however, User.all will probably return quite a few rows. Depending on the app you work on, maybe a few hundred thousand.
There's a tiiiiiny issue with a result set that returns 100,000 rows, and it's not just that the SQL query will take a long time to return. It will have irreversible effects on your Ruby app too!
@DarthSim
DarthSim / 00.imgproxy_vs_alternatives.md
Last active May 29, 2024 09:10
imgproxy vs alternatives benchmark

imgproxy vs alternatives benchmark

Setup

  • c5.xlarge AWS instance: 4 CPUs, 8 GB RAM
  • Ubuntu 18.04
  • Go 1.12
  • Python 2.7
  • Vips 8.7.4
@JasonTrue
JasonTrue / searchkick_and_elasticsearch_guidance.md
Last active March 7, 2024 14:42
Searchkick and Elastic Search guidance

Resources:

https://github.com/ankane/searchkick

Indexing

By default, simply adding the call 'searchkick' to a model will do an unclever indexing of all fields (but not has_many or belongs_to attributes).

In practice, you'll need to customize what gets indexed. This is done by defining a method on your model called search_data

def search_data

@satendra02
satendra02 / app.DockerFile
Last active March 3, 2024 10:13
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@kirankarki
kirankarki / Upgrading rails 5.0 to 5.1
Created October 30, 2017 13:19
Notes on upgrading rails 5.0 to 5.1
1. Change rails version in Gemfile
> gem 'rails', '~> 5.1', '>= 5.1.4'
2. Remove Gemfile.lock
> git rm Gemfile.lock
3. Run bundle install command
> bundle install --jobs=5
4. Run rails' app update to apply changes to app
@amitpatelx
amitpatelx / README.md
Last active September 23, 2018 20:30
Development and Deployment Processes

This page outlines about practices we are following related to development and deployment

Branches

  1. Unless mentioned in issue or verbally, create all branches from develop branch.
  2. Pull latest changes from the parent branch before creating a branch from it.
  3. Branch name should be self-explanatory about the issue you are working on(Trello Card). It is highly discouraged to use an abbreviation, issue number etc in branch names.
  4. Avoid creating nested branches from working branches. Do proper planning before start coding.

Naming the branch

  1. All enhacements and feature branches should start with feature/ eg. feature/google-oauth-integration which will be created from develop only.