Skip to content

Instantly share code, notes, and snippets.

View ali-ehmed's full-sized avatar
🎄
Focusing

Ali Ahmed ali-ehmed

🎄
Focusing
View GitHub Profile
@ali-ehmed
ali-ehmed / activestorage_dump_files_from_s3.rb
Created November 5, 2019 12:01
ActiveStorage - Dump files from AWS S3 storage
namespace :storage do
desc 'Downloading All Files from AWS - S3'
task dump: :environment do
verify_environment!
ActiveStorage::Blob.establish_connection(:development)
ActiveStorage::Blob.find_each do |blob|
path = make_path_for(blob.key)
if FileTest.exists?(path)
puts "ALREADY EXISTS #{blob.key} : => #{blob.filename}"
@ali-ehmed
ali-ehmed / platform_graphql_client.rb
Last active March 14, 2022 15:39
RSpec - Stub Graphql Client Adapter
require 'graphql/client'
require 'graphql/client/http'
module PlatformGraphqlClient
# Configure GraphQL endpoint using the basic HTTP network adapter.
HTTP = GraphQL::Client::HTTP.new('http://localhost:3001/api/graphql') do
# def headers(context)
# # Optionally set any HTTP headers
# { "Access-Token": "user-access-token" }
# end