Skip to content

Instantly share code, notes, and snippets.

View atmonshi's full-sized avatar

Lara Zeus atmonshi

View GitHub Profile
@paulredmond
paulredmond / ValidateMailgunWebhook.php
Created April 24, 2017 21:55
Laravel Middleware to Validate a signed Mailgun webhook
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
/**
* Validate Mailgun Webhooks
* @see https://documentation.mailgun.com/user_manual.html#securing-webhooks
@nick-f
nick-f / laravel-spark-metrics-dummy-data.php
Created December 1, 2016 05:39
Generate random data for Laravel Spark metrics to show off the graphs
Route::get('/metricsdummy', function() {
for ($i = 0; $i < 100; $i++) {
DB::table('performance_indicators')->insert([
'monthly_recurring_revenue' => mt_rand(1000, 2000),
'yearly_recurring_revenue' => mt_rand(50000, 60000),
'daily_volume' => mt_rand(100, 300),
'new_users' => mt_rand(50, 100),
'created_at' => Carbon\Carbon::now()->subDays($i),
'updated_at' => Carbon\Carbon::now()->subDays($i),
]);
@brianclogan
brianclogan / readme.md
Last active June 12, 2025 07:12
SENTRY WEBHOOK PUBLISH - FORGE

When using Laravel Forge with Sentry, I found that I wanted a way to, when Forge deployed a new update, alert sentry of a release.

Here is what I did.

Edit the deploy script and add:

VERSION='{"version":"'$(git log --pretty=format:'%H' -n 1)'"}'
curl {YOUR_SENTRY_URL_HERE}/ \
  -X POST \

-H 'Content-Type: application/json' \

@gilbitron
gilbitron / ApiController.php
Last active July 21, 2020 01:05
ApiController Template for Laravel Spark
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
abstract class ApiController extends Controller
@dillinghamio
dillinghamio / SparkRoleMiddleware.md
Last active April 8, 2022 03:50
Team Role Middleware For Laravel Spark

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){
@dillinghamio
dillinghamio / laravel-spark-rotating-pricing-table.md
Last active August 13, 2019 13:53
Laravel Spark Pricing Table

Rotating Pricing Table for Laravel Spark

Can be placed anywhere, try it out on welcome.blade.php


Laravel Spark Pricing Table ###If you're using team plans just swap out $sparkPlans = Spark::plans(); with $sparkPlans = Spark::teamPlans();


@adamwathan
adamwathan / v-cloak.md
Last active November 6, 2024 14:28
Useful CSS utilities for Vue.js cloaking

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
 
@rap2hpoutre
rap2hpoutre / laravel-forge-deploy.sh
Last active March 28, 2024 15:45
Laravel Forge deploy script without downtime
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
rm -R /home/forge/deploy
fi
if [ -d "/home/forge/backup" ]; then
rm -R /home/forge/backup
fi
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 16, 2025 04:34
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@sindresorhus
sindresorhus / post-merge
Last active May 17, 2025 14:19
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"