Skip to content

Instantly share code, notes, and snippets.

View stevebauman's full-sized avatar

Steve Bauman stevebauman

View GitHub Profile
@stevebauman
stevebauman / StateableInterface
Last active August 29, 2015 14:16
A stateable interface to be implemented on the inventory transactions model
interface StateableInterface
{
//E-Commerce states
const STATE_COMMERCE_CHECKOUT = 'commerce-checkout';
const STATE_COMMERCE_SOLD = 'commerce-sold';
const STATE_COMMERCE_RETURNED = 'commerce-returned';
const STATE_COMMERCE_RETURNED_PARTIAL = 'commerce-returned-partial';
const STATE_COMMERCE_RESERVERD = 'commerce-reserved';
const STATE_COMMERCE_BACK_ORDERED = 'commerce-back-ordered';
@stevebauman
stevebauman / inventory_transaction_tables
Last active August 29, 2015 14:16
Transaction Tables
Schema::create('inventory_transactions', function (Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->integer('stock_id')->unsigned();
$table->string('state');
$table->decimal('quantity', 8, 2)->default(0);
$table->foreign('stock_id')->references('id')->on('inventory_stocks')
->onUpdate('restrict')
@stevebauman
stevebauman / gist:00aaeaa0c7ca260a0aa5
Last active August 29, 2015 14:21
Recursive BOM Array Method
/**
* Returns all of the assemblies items in an
* easy to work with array.
*
* @param bool $recursive
*
* @return array
*/
public function getAssemblyItemsList($recursive = true, $depth = 0)
{
@stevebauman
stevebauman / gist:1a8100e155cd6e380d54
Last active August 29, 2015 14:21
Recursive BOM Method Results
array(2) {
[0]=>
array(7) {
["id"]=>
string(1) "2"
["name"]=>
string(9) "Table Top"
["metric_id"]=>
string(1) "1"
["category_id"]=>
@stevebauman
stevebauman / Purify Example
Created May 23, 2015 18:56
Purify Example
// Your BaseController
use Stevebauman\Purfiy\Purify;
class BaseController extends Controller
{
protected $purfiy;
public function __construct(Purify $purfiy)
{
@stevebauman
stevebauman / backup.bat
Created July 5, 2017 21:30
MySQL Windows Server Backup Script
echo Starting Backup.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set dt=%%c-%%a-%%b)
For /f "tokens=1-4 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b%%c%%d)
set database=database
set username=root
set password=password
set file=%database%-%dt%-%tm%.sql
@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";
@stevebauman
stevebauman / TextareaUpload.vue
Created July 11, 2017 16:08
Markdown Text Area Upload VueJS 2 Component
<template>
<textarea
:id="id"
:name="name"
:value="value"
:placeholder="placeholder"
:rows="rows"
:cols="cols"
class="form-control"
@dragover.prevent
@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 / 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,