Skip to content

Instantly share code, notes, and snippets.

View danielbehrendt's full-sized avatar

Daniel Behrendt danielbehrendt

View GitHub Profile
@tanthammar
tanthammar / session-timeout-alert-after-livewire-scripts.blade.php
Last active November 23, 2023 11:50
Laravel Livewire Turbolinks Blade component to keep session alive
{{-- You do not need to add this component if you are using the permanent option in the head component --}}
<script>
if (!window.sessionTimerPermanent && window.Livewire) {
window.livewire.hook('afterDomUpdate', startSessionTimer)
}
// if you are on livewire > 1.3.1 and want to avoid the default error alert
// https://github.com/livewire/livewire/pull/1146
window.livewire.onError(statusCode => {
if (statusCode === 419) {
@tanthammar
tanthammar / Media.blade.php
Last active October 19, 2022 00:01
LiveWire Spatie Media Image upload with VueCroppa
<div id="media-comp" class="display-contents">
<media inline-template>
<form>
<div v-for="(image, index) in form" :key="index" @touchstart.stop @mousedown.stop class="col-span-6">
<h3 class="text-3xl font-medium">@{{ image.label }}</h3>
<p class="py-3">Allowed Width @{{image.width}}px, Height @{{image.height}}px, Max file size @{{image.maxFileSize}}</p>
<input v-model="image.value" wire:model="@{{ image.name }}" type="hidden">
<croppa v-model="image.model" :width="image.width" :height="image.height"
:placeholder="locale == 'sv' ? 'Välj en bild' : 'Choose an image'"
:accept="'image/*'" :file-size-limit="image.maxByte" :zoom-speed="3" :disable-drag-and-drop="false"
@MadMikeyB
MadMikeyB / INSTALL-SHOPWARE-SIX.md
Last active November 19, 2022 19:49
Shopware 6 - Laravel Valet Driver

Install Shopware 6 (For Development)

cd ~/sites
valet park
# clone shopware
git clone -b 6.1 https://github.com/shopware/development.git shopware
# change directory
cd shopware
# install dependencies
@sudharsans
sudharsans / CustomResourceSample.yaml
Last active November 20, 2020 14:02
Custom Lambda function to enable logs types to publish RDS logs to Amazon CloudWatch Logs
---
AWSTemplateFormatVersion: '2010-09-09'
Resources:
EnableLogs:
Type: Custom::EnableLogs
Version: '1.0'
Properties:
ServiceToken: arn:aws:lambda:us-east-1:acc:function:rds-EnableRDSLogs-1O6XLL6LWNR5Z
DBInstanceIdentifier: mydb
Outputs:
@tonioriol
tonioriol / laravel-forge-deploy.sh
Last active April 25, 2023 22:20 — forked from rap2hpoutre/laravel-forge-deploy.sh
Laravel Forge zero downtime deployment script
# stop script on error signal
set -e
SITE="your-site-original-folder-name.com"
DEPL="/home/forge/deployments/${SITE}"
# create directory and any intermediate directories if don't exist
mkdir -p ${DEPL}
CUR="/home/forge/${SITE}"
---
AWSTemplateFormatVersion: '2010-09-09'
Metadata:
Version: 1
LastUpdated: 2017-05-16 16:58:35
UpdatedBy: estahn
Comments: Generated by cfn-ansible
Description: >
@TrafeX
TrafeX / wp-lambda-cronjob.py
Created January 10, 2017 14:17
WordPress Lambda Cronjob
import urllib2
def lambda_handler(event, context):
req = urllib2.Request('https://www.thewebsite.nl/wp/wp-cron.php?doing_wp_cron', headers={'User-Agent' : "AWS Lambda Cron"})
con = urllib2.urlopen(req)
print con.read()
@bmhatfield
bmhatfield / .zshrc
Last active March 7, 2024 23:11
OSX Keychain Environment Variables
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/keychain-environment-variables.sh
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# provide: "AKIAYOURACCESSKEY"
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
@vancluever
vancluever / amifind.sh
Created January 26, 2016 08:05
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@marcellodesales
marcellodesales / ec2-host-from-tag-to-env-vars.sh
Last active November 8, 2022 11:49
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User