Skip to content

Instantly share code, notes, and snippets.

@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()
@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 / configure-mailgun
Created July 5, 2016 15:41 — forked from jgeewax/configure-mailgun
Script to configure Postfix for Mailgun
#!/bin/bash
# Configuration for the script
POSTFIX_CONFIG=/etc/postfix/main.cf
POSTFIX_SASL=/etc/postfix/sasl_passwd
function confirm () {
read -r -p "${1:-Are you sure? [Y/n]} " response
if [[ $response == "" || $response == "y" || $response == "Y" ]]; then
echo 0;
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@stevepop
stevepop / esqueries
Last active August 29, 2015 14:08
Sample Elasticsearch Queries
GET /products/_mapping?pretty=true
GET /products_multi_tagged/_mapping?pretty=true
POST products_multi_tagged/_search?pretty=true
{
"query": {
"bool": {
"should": [
{
@stevepop
stevepop / eloquent.md
Last active August 29, 2015 14:07 — forked from msurguy/eloquent.md

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

<div class="modal hide fade" id="confirm-dialog">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Confirm</h3>
</div>
<div class="modal-body">
&nbsp;
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger">Ok</a>
@stevepop
stevepop / windows_ubuntu_dev.sh
Created September 24, 2012 12:51
Setup of Dev Environment for Ubuntu VM on Windows host
#!/bin/bash
cat "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
apt-get install -y python-software-properties
add-apt-repository ppa:nginx/stable -y
add-apt-repository ppa:ondrej/php5 -y
apt-get update