Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Anoob Bava anoobbava

🎯
Focusing
View GitHub Profile
View benchmark_evaluator.rb
class BenchmarkEvaluator
def initialize(count)
@count = count
end
def execute
results = {}
Rails.logger.info '===== Enqueuing jobs'
benchmark = "Enqueuing #{@count} ActiveJob jobs"
results[benchmark] = Benchmark.measure do
View pipelines.yml
image: user/docker_image_name
pipelines:
branches:
'*':
- step:
script:
- 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(snapshot.data.movies);
View trending_movies.dart
View detail.dart
body: SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(height: 10.0),
Text(
movieName,
style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold),
),
SizedBox(height: 10.0),
Text(
@anoobbava
anoobbava / rspec_model_testing_template.rb
Created Feb 10, 2021 — forked from kyletcarlson/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
anoobbava / main.dart
Created Oct 4, 2020
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');
runApp(MyApp());
}
@anoobbava
anoobbava / app.DockerFile
Created Feb 7, 2020 — 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:
@anoobbava
anoobbava / main.dart
Created Jan 8, 2020
blog_data_dart_flutter
View main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(home: MyApp()));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
View updateTodoMutation.js
updateTodoMutation (state, todo) {
let index = state.todos.findIndex(element => element.id === todo.id)
state.todos[index] = todo
}