Skip to content

Instantly share code, notes, and snippets.

@drbyte
drbyte / in-memory-sqlite-database.php
Created September 27, 2017 00:18 — forked from reinink/in-memory-sqlite-database.php
Give users completely safe sandboxed raw SQL reporting abilities
<?php
// Create in-memory SQLite database
$sqlite = new PDO('sqlite::memory:');
// Generate schema (for whatever tables you want)
$sqlite->prepare('CREATE TABLE users(id, family_id, first_name, last_name, email)')->execute();
$sqlite->prepare('CREATE TABLE families(id, name, phone, address)')->execute();
// Insert pre-defined data
<?php
# app/Validation/AllowedUsernameValidator.php
namespace App\Validation;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Routing\Router;
use Illuminate\Config\Repository;
@drbyte
drbyte / MobileApplication.php
Created March 6, 2017 22:18 — forked from brandonferens/MobileApplication.php
Trait for testing mobile devices in Dusk
<?php
namespace Tests;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
trait MobileApplication
{
/**
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi
@drbyte
drbyte / ApiRespond.php
Created November 15, 2016 16:08 — forked from dugajean/ApiRespond.php
Trait for easy creation of API responses
<?php
namespace App\Traits;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
trait ApiRespond
{
/**
<?php
namespace App\Http\Middleware;
use Closure;
class RoleMiddleware
{
/**
* Handle an incoming request.
@drbyte
drbyte / pr.md
Created March 14, 2016 04:58 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@drbyte
drbyte / Are you Ready to Hire an Engineer?.md
Created November 20, 2015 15:44 — forked from craychee/Are you Ready to Hire an Engineer?.md
A plain English checklist to help non-technical people decide if the business is ready to engage the services of an engineer or a consulting firm. This checklist was made to accompany the following blog post: http://craychee.io/blog/2015/09/17/are-you-ready-to-hire-an-engineer/

Are you Ready to Hire an Engineer?

A plain English checklist


This checklist is intended to help non-technical people decide if the business is ready to engage the services of an engineer or a consulting firm. It is the goal of this checklist to give non-technical folks a leg up in these conversations so that they are less likely to get into lengthy (and very expensive) engagements.


###Content Content pertains to information that you already provide customers or plan to make available to anyone who comes to your site.

@drbyte
drbyte / SnsBroadcaster.php
Last active September 11, 2015 18:14 — forked from jeskew/SnsBroadcaster.php
Laravel broadcasting with SNS
<?php
use Aws\Sns\SnsClient;
use Illuminate\Contracts\Broadcasting\Broadcaster;
class SnsBroadcaster implements Broadcaster
{
/** @var SnsClient */
private $sns;
/** @var array */
@drbyte
drbyte / bash_profile.md
Last active September 8, 2015 02:06 — forked from irazasyed/bash_profile.md
Terminal: Mac OS X Terminal Aliases & How-To - .bash_profile / .profile

Mac OS X Terminal Aliases & How-To

Collection of some of my fav terminal aliases that i use often & collected from the web. This file will be updated with more aliases as i find more. Feel free to comment and share your fav aliases you use :)

###Follow these simple steps to add the following aliases:###


  1. Within the Terminal, run: