Skip to content

Instantly share code, notes, and snippets.

View Tucker-Eric's full-sized avatar
🤦‍♂️
Crushing It

Eric Tucker Tucker-Eric

🤦‍♂️
Crushing It
View GitHub Profile
@Tucker-Eric
Tucker-Eric / arrange_files.vbs
Last active October 29, 2015 20:43
Arrange Files Into Client Folders
Dim fso,f,strPathBuild,destFolder,clientFolder,newFile
'This is where we searching for the files to move
'This is also where the sub directories are located
destFolder = "F:\envista_data_files\Client Data"
'Create the File System Object that will do all file/folder manipulations
Set fso=CreateObject("Scripting.FileSystemObject")
'Create the folder object we are going to start searching in
Set f = fso.GetFolder(destFolder)
'Regular Expression to identify client id/code
@Tucker-Eric
Tucker-Eric / cloudflare-ips.conf
Last active December 7, 2016 17:17
Nginx config file to show a user's IP through cloudflare proxy
set_real_ip_from 103.21.244.0/22
set_real_ip_from 103.22.200.0/22
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
abbr -a g 'git'
abbr -a ga 'git add'
abbr -a gaa 'git add --all'
abbr -a gapa 'git add --patch'
abbr -a gb 'git branch'
abbr -a gba 'git branch -a'
abbr -a gbda 'git branch --merged | command grep -vE "^(\*|\s*master\s*\$)" | command xargs -n 1 git branch -d'
abbr -a gbl 'git blame -b -w'
abbr -a gbnm 'git branch --no-merged'
abbr -a gbr 'git branch --remote'
server {
listen 127.0.0.1:80;
server_name 127.0.0.1;
location /nginx_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
@Tucker-Eric
Tucker-Eric / getImages.vbs
Created October 5, 2016 18:20
HTML Image Scraper
'*****************************************************************
Const adSaveCreateOverWrite = 2
Const adTypeBinary = 1
Dim htmlSrc, dstDir
htmlSrc = InputBox("Enter Html File Name") & ".html"
dstDir = InputBox("Enter Folder Name To Place Images")
'*****************************************************************
'** Download the image
' strResult = GetImage(strSource, strDest)
getImgTagUrl htmlSrc, dstDir
@Tucker-Eric
Tucker-Eric / WhereHasWithTrait.php
Created November 11, 2016 20:10
Laravel Eloquent Model Trait for querying based on a relationship and including that relationship with the constraints with the results
<?php
namespace App\Models\Traits;
trait WhereHasWithTrait
{
public function scopeWhereHasWith($query, $relation, \Closure $closure)
{
return $query->whereHas($relation, $closure)->with([$relation => $closure]);
}
@Tucker-Eric
Tucker-Eric / generate.sh
Last active December 7, 2016 18:41
Generate Nginx Config
SED=`which sed`
CURRENT_DIR=`dirname $0`
echo "What is the domain?"
read DOMAIN
# check the domain is valid!
PATTERN="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$";
if [[ "$DOMAIN" =~ $PATTERN ]]; then
DOMAIN=`echo $DOMAIN | tr '[A-Z]' '[a-z]'`
@Tucker-Eric
Tucker-Eric / StateList.js
Created December 28, 2016 18:41
US State List
const StateList = [
{id: 'AL', name: 'Alabama'},
{id: 'AK', name: 'Alaska'},
{id: 'AZ', name: 'Arizona'},
{id: 'AR', name: 'Arkansas'},
{id: 'CA', name: 'California'},
{id: 'CO', name: 'Colorado'},
{id: 'CT', name: 'Connecticut'},
{id: 'DE', name: 'Delaware'},
{id: 'DC', name: 'District Of Columbia'},
@Tucker-Eric
Tucker-Eric / columnTotals.js
Last active January 12, 2017 22:38
Angular Column Total Directive
(function (angular) {
angular.module('column.totals', [])
.directive('columnTotal', ['$timeout', function ($timeout) {
function getOffset(elem) {
let offset = 0;
let prev = elem.previousElementSibling;
while (prev) {
offset++;
prev = prev.previousElementSibling;
}
@Tucker-Eric
Tucker-Eric / generate.sh
Created February 16, 2017 18:06
Script to generate nginx config
SED=`which sed`
CURRENT_DIR=`dirname $0`
echo "What is the domain?"
read DOMAIN
# check the domain is valid!
PATTERN="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$";
if [[ "$DOMAIN" =~ $PATTERN ]]; then
DOMAIN=`echo $DOMAIN | tr '[A-Z]' '[a-z]'`