Skip to content

Instantly share code, notes, and snippets.

View Braunson's full-sized avatar

Braunson Yager Braunson

View GitHub Profile
# SETUP #
DOMAIN=example.com
PROJECT_REPO="[email protected]:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
@MrPunyapal
MrPunyapal / 1 Types.md
Last active March 22, 2025 23:42
Types In PHP

Atomic Types (Built-in and Scalar)

// Built-in types
$variable = null;             // null type

// Scalar types
$boolVar = true;              // bool type
$intVar = 42;                 // int type
$floatVar = 3.14;             // float type
@dilin993
dilin993 / ChatController.php
Last active September 23, 2024 19:24
A Laravel chat controller in PHP using AWS Bedrock API
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Aws\BedrockRuntime\BedrockRuntimeClient;
class ChatController extends Controller
{
@wesbos
wesbos / logger.js
Created January 8, 2024 15:55
console.log line numbers in Node.js
// Use like this: node --import logger.js yourapp.js
import path from 'path';
const { log } = console;
[`debug`, `log`, `warn`, `error`, `table`, `dir`].forEach((methodName) => {
const originalLoggingMethod = console[methodName];
console[methodName] = (...args) => {
const originalPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;
@nullthoughts
nullthoughts / MacroServiceProvider.php
Last active February 22, 2025 19:29
Convert Laravel Scout query to Eloquent query (Macro)
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Laravel\Scout\Builder;
class MacroServiceProvider extends ServiceProvider
{
/**
@mmartinjoo
mmartinjoo / devops-with-laravel-toc.md
Last active March 24, 2025 09:00
DevOps with Laravel Table of Contents

Topics coming in the next edition:

  • ✅ Load balancers from scratch (published on 10th of October)
  • ✅ Terraform (published on 12th of November)
  • HELM

Fundamentals - 208 pages (Basic package)

Building a pipeline

nginx

  • Serving static content
  • CGI, FastCGI, php-fpm
@yzdbg
yzdbg / auto-dr.md
Last active November 3, 2023 17:11

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

@stormwild
stormwild / wordpress-github.md
Last active November 8, 2024 14:49
WordPress Github

WordPress Github Integration

Phind

how to integrate wordpress with github, such that whenever a post is published, a build is triggered, in github would I need to setup a webhook and in WordPress would I need to install a plugin that calls the webhook. Are there any WordPress plugins that can do this

Answer

To integrate WordPress with GitHub and trigger a build whenever a post is published, you can set up a webhook in GitHub and use a WordPress plugin that calls the webhook. Here is a step-by-step guide on how to achieve this:

@cdsaenz
cdsaenz / index.html
Created August 19, 2022 14:11
Demo Alpine JS and Fetch from Remote API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpine Ajax test</title>
</head>
<body>
<h1>Users API Retrieval Test</h1>
@shramee
shramee / google-reviews.php
Last active January 20, 2025 23:39
Get and shows google reviews
<?php
/**
* Get google reviews
* @return array Google reviews data
*/
function get_google_reviews(){
// URL to fetch
$google_api = 'https://maps.googleapis.com/maps/api/place/details/json?placeid=<your_place_id>&sensor=true&key=<key>';