Skip to content

Instantly share code, notes, and snippets.

View shantamg's full-sized avatar

Shantam Galuten shantamg

  • Mount Madonna, CA
View GitHub Profile
<?php
namespace App\Events;
use App\Jobs\BroadcastEventJob;
use Illuminate\Support\Str;
trait BroadcastsEvents
{
// Ably limit is 65536 bytes
@shantamg
shantamg / BroadcastsEventsTest.php
Last active June 17, 2024 20:01
Chunked Ably Message Tests
<?php
namespace Testing\Events;
use App\Events\BroadcastsEvents;
use App\Jobs\BroadcastEventJob;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Support\Facades\Bus;
use Testing\TestCase;
@shantamg
shantamg / BroadcastEventJob.php
Last active June 17, 2024 20:00
Chunking large Ably messages
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
@shantamg
shantamg / .gitconfig
Created November 2, 2022 16:15
Git alias for opening a PR on GitHub
[alias]
pr = "!f() { xdg-open "$(git config --get remote.origin.url | sed -r 's/.*(\\@|\\/\\/)(.*)(\\:|\\/)([^:\\/]*)\\/([^\\/\\.]*)\\.git/https:\\/\\/\\2\\/\\4\\/\\5/')/pull/new/$(git rev-parse --abbrev-ref HEAD)"; };f"
@shantamg
shantamg / config
Last active February 19, 2019 16:59
Log into MMC and MMI servers (~/.ssh/config)
Host mmc
HostName ec2-52-53-150-121.us-west-1.compute.amazonaws.com
User ubuntu
IdentityFile ~/.ssh/id_rsa.key
Host mmi
HostName ec2-54-67-32-96.us-west-1.compute.amazonaws.com
User ubuntu
IdentityFile ~/.ssh/id_rsa.key
@shantamg
shantamg / progress_message.rb
Created August 15, 2012 15:15
A class for creating a pretty progress bar for a loop in a rake task
class ProgressMessage
def initialize(message, goal)
@goal = goal
@current = 0
@current_tick = 0
@total_ticks = message.length + 5
puts "| #{message}... |"
print "|"
end