Skip to content

Instantly share code, notes, and snippets.

@nwaughachukwuma
nwaughachukwuma / getVideoSnapshot.ts
Last active October 2, 2023 02:03
Get video frame preview (snapshot) from video element
type EventDef<D> = Event & { detail?: D }
type VideoRef = string | HTMLVideoElement | null
const eventName = 'image-updated'
export default function getVideoSnapshot(videoRef: VideoRef) {
if (typeof videoRef === 'string') {
videoRef = document.getElementById(videoRef) as HTMLVideoElement | null
}
if (!videoRef) {
throw new Error('Video element not found')
@ajay-ag
ajay-ag / Laravel And Alpine Pagination
Last active September 17, 2023 16:24
Laravel And Alpinej.js Pagination Component ,Alpine js
<div class="container-fluid">
<div class="row">
<!-- /.col-md-6 -->
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="row" id="laravelPagination" data-url="{{ route('country.page') }}" x-data="laravelPagination()"
x-init="init()">
<template x-for="item in country" :key="item.id">
<div class="card col-12 mb-3">
@sanampatel
sanampatel / laravel_deploy.txt
Last active July 31, 2024 10:37
Laravel Deploy Script after git pull
# GIT MERGE OPTIONS DEPENDING HOSTING OR DEPLOYMENT PROVIDERS
# git checkout -- .
# git checkout .
# git merge
# php artisan down || true
# Put the application into maintenance / demo mode
php artisan down
# GIT Clear current generated files so can pull new ones
@mrbar42
mrbar42 / README.md
Last active August 15, 2025 17:51
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@m2sh
m2sh / DOSpacesStorageServiceProvider.php
Last active January 17, 2024 05:03
How To Use Digitalocean Spaces as Laravel Cloud filesystems
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
use Storage;
@diegomengarda
diegomengarda / config.txt
Last active March 26, 2018 01:42
Configuration for Ubuntu to run Laravel
Start Server Laravel
*SWAP file - SOMENTE PARA SERVIDOR CLOUD
sudo fallocate -l 1G /swapfile // always 2x real memory
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
*Update repositories
sudo apt-get update
# v2 sintax
version: '2'
# Named volumes
volumes:
# MySQL Data
l5dbeka-mysql-data:
driver: local
# Postgres Data
server {
listen 80;
server_name CHANGEME.app;
root /var/www/vhosts/CHANGEME.app/public;
index index.html index.htm index.php;
charset utf-8;
location / {
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@vool
vool / laravel_post_receive hook
Last active May 5, 2022 22:39
Post receive hook for Laravel website deploy
#!/bin/bash
echo "********************"
echo "Post receive hook: Updating website"
echo "********************"
#set the git repo dir
GIT_REPO_DIR=~/git/<repo>.git
echo "The git repo dir is $GIT_REPO_DIR"