Skip to content

Instantly share code, notes, and snippets.

View cschulte22's full-sized avatar

Chris Schulte cschulte22

  • Ocean Breeze Software, LLC
  • San Diego
View GitHub Profile
@cschulte22
cschulte22 / _flash_notifications.html.erb
Created July 29, 2020 22:16
Rails flash with tailwind / alpinejs
<% if flash.any? %>
<div class="fixed inset-0 flex items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-start sm:justify-end z-50" data-flash-notifications='true'>
<% flash.each do |msg_type, msg| %>
<div x-data="{flashVisible: false, flashType: '<%= msg_type %>'}" x-show='flashVisible' x-init="() => {flashVisible=true; setTimeout(() => {flashVisible=false}, 5000)}" class="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto"
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
x-transition:enter-end="translate-y-0 opacity-100 sm:translate-x-0"
x-transition:leave="transition ease-out duration-100"

Keybase proof

I hereby claim:

  • I am cschulte22 on github.
  • I am cschulte22 (https://keybase.io/cschulte22) on keybase.
  • I have a public key whose fingerprint is B119 28D6 2EDD BB35 B5A5 6D22 A2CF 8906 CD23 22AE

To claim this, I am signing this object:

@cschulte22
cschulte22 / transfer.rb
Last active September 11, 2024 11:54
Ruby script to copy files from one S3 bucket to another using aws-sdk
require 'aws-sdk'
class Transfer
def initialize(from_bucket, to_bucket)
@s3 = AWS::S3.new
@from_bucket = @s3.buckets[from_bucket]
@to_bucket = @s3.buckets[to_bucket]
raise "#{from_bucket} does not exist" unless @from_bucket.exists?