Skip to content

Instantly share code, notes, and snippets.

@gadimbaylisahil
gadimbaylisahil / lightfulweb-takehome.md
Last active September 26, 2022 11:18
Ruby on Rails - basic take home assestment project

Aim of the task

To assess the ability of the candidate to setup and deploy a simple Rails application with different services to cloud.

Task Description

  • Build a form that takes the following information from the user:
    • First name
    • Last name
  • Date of Birth
@gadimbaylisahil
gadimbaylisahil / unroutable_routes.rake
Created May 31, 2022 09:32 — forked from natematykiewicz/unroutable_routes.rake
Find routes that will raise a routing error when requested
desc 'Find routes that will raise a routing error when requested'
task unroutable_routes: :environment do
# A lot of this code was taken from how `rake routes` works
# https://github.com/rails/rails/blob/f95c0b7e96eb36bc3efc0c5beffbb9e84ea664e4/railties/lib/rails/commands/routes/routes_command.rb
require 'action_dispatch/routing/inspector'
unroutables = Rails.application.routes.routes.
map { |r| ActionDispatch::Routing::RouteWrapper.new(r) }.
reject { |r| r.internal? || r.engine? || r.path.starts_with?('/rails/') || !r.controller }.
@gadimbaylisahil
gadimbaylisahil / gems_to_csv.rb
Created January 5, 2022 07:47
Gems to CSV exporter script
# Script to get list of gems installed on servers in a CSV file,
# with their licenses.
require 'csv'
class GemFinder
ROWS = %w[
name
added_date
removed_date
@gadimbaylisahil
gadimbaylisahil / nginx_assets.md
Created January 13, 2021 15:49 — forked from vishaltelangre/nginx_assets.md
Serving Static Assets via Nginx

Concept

  • People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
  • Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
  • Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
  • Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec
@gadimbaylisahil
gadimbaylisahil / capybara.rb
Created December 15, 2020 09:20
Capybara setup with Cuprite Driver
# frozen_string_literal: true
require 'capybara/cuprite'
Capybara.register_driver :cuprite do |app|
headless = !ENV.key?('CAPYBARA_HEADLESS') || ENV['CAPYBARA_HEADLESS'] == 'true'
options = {
headless: headless,
# Use this when running CAPYBARA_HEADLESS=false
@gadimbaylisahil
gadimbaylisahil / gist:73792d0a4ab2740d836a4565f83f77bf
Created August 30, 2019 10:32
LXC Configuration + Vagrant Arch Linux
Install lxc from arch repository
Install vagrant
Install vagrant pluging vagrant-lxc
Follow to setup network configuration
https://github.com/elemoine/vagrant-lxc-howto