Skip to content

Instantly share code, notes, and snippets.

View sajanbasnet75's full-sized avatar
🎯
Focusing

Sajan Basnet sajanbasnet75

🎯
Focusing
View GitHub Profile
@hopsoft
hopsoft / db.rake
Last active May 22, 2024 22:53
Rails rake tasks for dump & restore of PostgreSQL databases
# 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"
end
puts cmd
@leastbad
leastbad / application_controller.rb
Created March 25, 2021 16:05
Notifications are fun (Devise, Bootstrap 5, Notyf, FontAwesome)
class ApplicationController < ActionController::Base
include CableReady::Broadcaster
include Toastable
end
@bradtraversy
bradtraversy / firebase_rules.txt
Last active May 30, 2024 14:05
Firebase rules for house marketplace app
// FIRESTORE RULES
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Listings
match /listings/{listing} {
allow read;
allow create: if request.auth != null && request.resource.data.imgUrls.size() < 7;
allow delete: if resource.data.userRef == request.auth.uid;