Skip to content

Instantly share code, notes, and snippets.

View anoobbava's full-sized avatar

Anoob Bava anoobbava

View GitHub Profile
anoobbava / db.rake
Created August 31, 2022 05:49 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
View db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
puts cmd
anoobbava / benchmark_evaluator.rb
Created August 12, 2022 07:13
benchmark Evaluator
View benchmark_evaluator.rb
class BenchmarkEvaluator
def initialize(count)
@count = count
def execute
results = {} '===== Enqueuing jobs'
benchmark = "Enqueuing #{@count} ActiveJob jobs"
results[benchmark] = Benchmark.measure do
View pipelines.yml
image: user/docker_image_name
- step:
- export DATABASE_URL=postgresql://pg_user:pg_user_password@localhost/pipelines
- bundle exec rails db:schema:load RAILS_ENV=test
View upcoming_movies.dart
Widget build(BuildContext context) {
return FutureBuilder(
future: fetchMovies(),
builder: (context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) {
return Center(
child: Image.asset('assets/images/loading.gif'),
} else {
return HorizontalCards(;
View trending_movies.dart
anoobbava / detail.dart
Created October 17, 2021 15:14
for blogging
View detail.dart
body: SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(height: 10.0),
style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold),
SizedBox(height: 10.0),
anoobbava / rspec_model_testing_template.rb
Created February 10, 2021 11:28 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
anoobbava / main.dart
Created October 4, 2020 17:16
main.dart for blogging
View main.dart
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import './pages/home_page.dart';
import './pages/search_movies.dart';
Future main() async {
await DotEnv().load('.env');
anoobbava / .zshrc
Last active February 24, 2020 12:41
Web development guide tools
View .zshrc
export ZSH="/home/anoob/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
anoobbava / app.DockerFile
Created February 7, 2020 10:30 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
View app.DockerFile
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: