Skip to content

Instantly share code, notes, and snippets.

@stevepop
stevepop / ModelActivityTrait.php
Created July 11, 2017 15:22
ModelActivity Trait used to Track My Laravel Models
<?php namespace App\Traits;
use App\ActivityLog;
use ReflectionClass;
use Illuminate\Support\Facades\Auth;
trait ModelActivity
{
/** Method automatically called by Eloquent **/
protected static function bootModelActivity()
{
foreach (static::getModelEvents() as $event) {
@stevepop
stevepop / DumpSqlServiceProvider.php
Created September 13, 2017 16:25 — forked from tomcastleman/DumpSqlServiceProvider.php
Laravel Query Builder Dump SQL Macro
<?php
namespace App\Providers;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\ServiceProvider;
class DumpSqlServiceProvider extends ServiceProvider
{
public function boot()

Configuring Nuxt application with PM2 in Production

I struggled a but getting this running so I have decided to add my notes here to remind me as well as share with others who might go through the same isses.

Build our application for production and deploy

$ npm run build
git push <your-remote> <your branch>
@stevepop
stevepop / letsencrypt_ubuntu_16.04.md
Last active March 9, 2018 20:55
Create LetsEncrypt on Ubuntu 16.04

Steps To Create LetsEncrypt on Ubuntu 16.04

Get the Nginx Cerbot plugin

sudo git clone https://github.com/certbot/certbot /opt/certbot

Execute cerbot-auto specifying the nginx plugin

sudo /opt/certbot/certbot-auto --nginx
- name: Add PHP7.1 ppa repository
  apt_repository: repo='ppa:ondrej/php'

- name: Install packages
  apt: pkg={{ item }} state=latest update_cache=yes
  with_items:
   - mysql-client
   - nginx
 - php7.1-cli
@stevepop
stevepop / README.md
Created May 13, 2018 00:11 — forked from Alymosul/README.md
Downgrade PHP 7.2 to 7.1 on Laravel Forge

Install php7.1 related stuff..

apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
php7.1-cli php7.1-dev \
php7.1-pgsql php7.1-sqlite3 php7.1-gd \
php7.1-curl php7.1-memcached \
php7.1-imap php7.1-mysql php7.1-mbstring \
php7.1-xml php7.1-zip php7.1-bcmath php7.1-soap \
php7.1-intl php7.1-readline php-xdebug php-pear php7.1-fpm
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
@stevepop
stevepop / DatePicker.vue
Created July 6, 2018 15:08
DatePicker.vue
<template>
<div class="w-1/4">
<input :value="value" class="form-input" type="text" ref="input" id="datepicker">
</div>
</template>
<script>
import Pickaday from 'pikaday'
export default {
<template>
<div class="bg-grey-dark p-6">
<h2 class="my-6">Wrapping External Libraries as Vue Components (Datepicker)</h2>
<date-picker v-model="date" format="DD/MM/YYYY" :options="{firstDay: 7}"></date-picker>
</div>
</template>
<script>
import DatePicker from "@/components/DatePicker.vue"
export default {
@stevepop
stevepop / gist:c90ca8e20b2a1fc72c5e830ce723a28d
Created July 30, 2018 06:47 — forked from snipe/gist:aee3b4f5793cfe0c3d39
Laravel Artisan command to upload fils to S3 with cache-control headers
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class MoveToS3 extends Command {
/**
* The console command name.