Skip to content

Instantly share code, notes, and snippets.

View stevebauman's full-sized avatar

Steve Bauman stevebauman

View GitHub Profile
@stevebauman
stevebauman / SubmissionFormRequest.php
Created October 29, 2019 16:02
A Laravel validation rule for throttling form requests.
<?php
namespace App\Http\Requests;
use App\Rules\Throttle;
use Illuminate\Foundation\Http\FormRequest;
class SubmissionFormRequest extends FormRequest
{
/**
@stevebauman
stevebauman / DirectoryMounter.php
Last active June 18, 2020 17:29
PHP Windows Directory Mounter
<?php
use UnexpectedValueException;
class DirectoryMounter
{
/**
* The path to mount.
*
* @var string|null
@stevebauman
stevebauman / ForceHttps.php
Created March 28, 2019 19:58
A Laravel HTTP middleware to force HTTPS requests. Doesn't run when running in local development or when running unit tests.
<?php
namespace App\Http\Middleware;
use Closure;
class ForceHttps
{
/**
* Handle an incoming request.
@stevebauman
stevebauman / Security Group.md
Last active March 22, 2019 13:38
Create a security group using Adldap2

Using Adldap2:

use Adldap\Laravel\Facades\Adldap;

$dn = "CN=".$groupName.",OU=AclGroups,".ACL_OU_AD;

$group = Adldap::make()->group([
    'dn' => $dn,
    'cn' => $groupName,
 'samaccountname' =&gt; $groupName,
@stevebauman
stevebauman / Export.sql
Created December 17, 2018 21:47
Dynamics GP Export / Query User Security Roles
-- This can be used for GP 2010, GP 2013, GP 2015 and GP 2016.
use DYNAMICS;
SELECT
UserMaster.USRCLASS AS 'User Class',
UserMaster.USERID AS 'User ID',
UserMaster.USERNAME AS 'Username',
CASE UserMaster.UserStatus
WHEN 1 THEN
@stevebauman
stevebauman / index.php
Created June 29, 2018 14:44
Wait Times - How To
// Require the class files.
require 'Reader.php'
require 'ToUs.php';
require 'ToCanada.php';
// Create the reader instances.
$toUsReader = new ToUs();
$toCanadaReader = new ToCanada();
// Retrieve to US wait times.
@stevebauman
stevebauman / Throttle.php
Last active February 25, 2025 07:16
Laravel Throttle Validation Rule
<?php
namespace App\Rules;
use Illuminate\Http\Request;
use Illuminate\Cache\RateLimiter;
use Illuminate\Contracts\Validation\Rule;
class Throttle implements Rule
{
@stevebauman
stevebauman / Signature.vue
Last active August 9, 2024 14:30
A VueJS Signature canvas field, using szimek/signature_pad
<template>
<div>
<canvas ref="canvas"></canvas>
<div class="clearfix"></div>
<div class="btn-group">
<button @click="clear" type="button" class="btn btn-default">
<i class="fa fa-times"></i>
Clear Signature
@stevebauman
stevebauman / Export-Procedures.ps1
Created November 21, 2017 23:01
Export MSSQL Stored Procedures with Powershell
# Start Script
Set-ExecutionPolicy RemoteSigned
$servername = 'SQL01';
$dbname = 'DATABASE';
$scriptpath = 'C:\Users\johndoe\Desktop\Procedures';
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Data") | Out-Null
$srv = new-object "Microsoft.SqlServer.Management.SMO.Server" $serverName
@stevebauman
stevebauman / export-reports.ps1
Created November 20, 2017 22:24
A Powershell Script to Export SQL Report Server 2012 Reports (SRSS)
# Configuration data
# SQL Server Instance name.
[string] $server = "PC-RPT01";
# ReportServer Database.
[string] $database = "ReportServer";
# Path to export the reports to.
[string] $folder = "C:\Users\johndoe\Desktop\Reports";