Skip to content

Instantly share code, notes, and snippets.

@frankndungu
frankndungu / paypal.md
Last active February 27, 2025 06:35
How to integrate Paypal with Laravel 11

PayPal Integration for Laravel

This documentation provides instructions for integrating PayPal payments in Laravel using the srmklive/paypal package.

Installation

Install the package via Composer:

composer require srmklive/paypal
@mulhoon
mulhoon / last-modified-demo-server.js
Last active December 28, 2022 12:23
Counting unique visitors and bounces without cookies.
const express = require('express')
const app = express()
app.get('/ping', (req, res) => {
const now = Date.now(),
day = 8.64e7
// calculate midnight today and tomorrow
const midnight = Math.floor(now / day) * day
const midnightDate = new Date(midnight)
@mikemartin
mikemartin / _seo.antlers.html
Last active January 6, 2022 19:27
SEO Basic
{{ if seo_title == 'custom' }}
<title>{{ custom_title }}</title>
<meta name="twitter:title" content="{{ custom_title }}" />
<meta property="og:title" content="{{ custom_title }}" />
{{ else }}
<title>{{ title }} // {{ site:name }}</title>
<meta name="twitter:title" content="{{ title }}" />
<meta property="og:title" content="{{ title }}" />
{{ /if }}
@Hypnosphi
Hypnosphi / docker-shell.sh
Created November 29, 2019 17:53 — forked from falvarez/docker-shell.sh
Run docker container, mount current working directory and get interactive shell
docker run -ti -v $(pwd):/tmp -w /tmp DOCKER_IMAGE /bin/bash
@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;
@helmerdx
helmerdx / laravel_forge_security.md
Created May 16, 2017 01:35
Laravel Forge Security after provisioning

I install some of the following software to help me debug and make it more secure.

sudo apt-get install fail2ban bwm-ng htop iotop iftop nethogs tcptrack

fail2ban - blocks failed logins for a number of services (a must for me) bwm-ng - bandwidth monitor (generally good to see the traffic on a server) htop - updated top command to see CPU/RAM/processes running (just nicer) iotop - see disk usage and the process (handy for checking problems)

@jbanety
jbanety / build_pcntl.sh
Last active February 6, 2024 02:50
(Updated) Build PCNTL ext for MAMP PHP 7.4.2
#!/bin/bash
PHP_VERSION=7.4.2
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5
# Dirs
@nbhartiya
nbhartiya / javascript-widget-embedder.js
Created March 25, 2015 22:03
Javascript Widget Embedder Script
<script data-version='v1' data-client-id='clients-id' id='unique-embedder-id' type='text/javascript'>
// "data-version": It's useful to put the version of your embedder script in the "version" data
// attribute. This will enable you to more easily debug if any issues arise.
// "data-client-id": This id allows us to pull up the correct client's settings from our database.
// Each client may have different settings associated with their widget, and you can load them
// with this!
// "id": This HTML id allows us to refer to this embedder script's location. This is helpful
// if you want to inject html code in specific places in hour hosts's website or if you want to
// insert your payload script right next to this in the <head> tag.
@mcguffin
mcguffin / acf-get-field-key.php
Last active June 13, 2023 13:32
WordPress Advanced Custom Fields get field key from field name
<?php
/**
* Get field key for field name.
* Will return first matched acf field key for a give field name.
*
* ACF somehow requires a field key, where a sane developer would prefer a human readable field name.
* http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name
*
* This function will return the field_key of a certain field.
@milo
milo / github-webhook-handler.php
Last active October 29, 2024 15:45
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check