Skip to content

Instantly share code, notes, and snippets.

View westonwatson's full-sized avatar

Weston Watson westonwatson

View GitHub Profile
@westonwatson
westonwatson / EXAMPLE_MOCKERY_TEST.PHP
Last active August 14, 2020 16:39
Example Mockery Attempt
<?php
/* ACTUAL FEATURE CLASS */
namespace App\Tools\Clients;
use App\Tools\Clients\Http\HttpClient;
use Illuminate\Support\Facades\App;
/**
* Class ScreenshotServiceClient.
@westonwatson
westonwatson / extract_uri_access_log.sh
Created April 7, 2020 13:48
Extract URI from apache access logs
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' | sed 's/\?.*//g' | sort | uniq -c | sort -rn > url_hits.txt
@westonwatson
westonwatson / studio.parse.iframe.js
Created November 21, 2019 19:25
Parse and Extract several Studio Session Storage values and use them for an iframe/pixel URL
//Parse and Extract values from text like "key=HELLO&value=WORLD&test=OK"
function getUriParameter(UriString, targetKey) {
var sPageURL = UriString;
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == targetKey)
{
return sParameterName[1];
@westonwatson
westonwatson / outline.links.js
Last active October 2, 2019 14:11
Create Outline.com Links for each anchor tag on a page.
@westonwatson
westonwatson / ycombinator.outline.js
Created October 1, 2019 13:11
Hacker News OUTLINE.COM links
//Run this code after page load
window.onload = function() {
//target story link container(s)
document.querySelectorAll('.storyLink').forEach(
function(nodeObj, objIndex) {
var parentNode = nodeObj.parentNode;
//make a copy of the story link
var cloneNode = nodeObj.cloneNode(true);
var hrefString = nodeObj.href;
//create the outline.com link
@westonwatson
westonwatson / proxy.php
Last active May 6, 2019 18:07
Make cross-domain requests with AJAX using this proxy.php script.
<?php
/* AJAX Proxy Script */
const TARGET_HEADER_KEYS = ['ACTION', 'METHOD'];
const ALLOWED_METHODS = ['POST', 'GET'];
// Grab Request Target from Headers
$headers = getallheaders();
//Validate Request Headers
This file has been truncated, but you can view the full file.
@westonwatson
westonwatson / unicode-chars.json
Created January 29, 2019 20:48
Some cool unicode chars mapped to their ASCII equivalents.
{frakturDict:{A:"๐”„",B:"๐”…",C:"โ„ญ",D:"๐”‡",E:"๐”ˆ",F:"๐”‰",G:"๐”Š",H:"โ„Œ",I:"โ„‘",J:"๐”",K:"๐”Ž",L:"๐”",M:"๐”",N:"๐”‘",O:"๐”’",P:"๐”“",Q:"๐””",R:"โ„œ",S:"๐”–",T:"๐”—",U:"๐”˜",V:"๐”™",W:"๐”š",X:"๐”›",Y:"๐”œ",Z:"โ„จ",a:"๐”ž",b:"๐”Ÿ",c:"๐” ",d:"๐”ก",e:"๐”ข",f:"๐”ฃ",g:"๐”ค",h:"๐”ฅ",i:"๐”ฆ",j:"๐”ง",k:"๐”จ",l:"๐”ฉ",m:"๐”ช",n:"๐”ซ",o:"๐”ฌ",p:"๐”ญ",q:"๐”ฎ",r:"๐”ฏ",s:"๐”ฐ",t:"๐”ฑ",u:"๐”ฒ",v:"๐”ณ",w:"๐”ด",x:"๐”ต",y:"๐”ถ",z:"๐”ท"},frakturBoldDict:{A:"๐•ฌ",B:"๐•ญ",C:"๐•ฎ",D:"๐•ฏ",E:"๐•ฐ",F:"๐•ฑ",G:"๐•ฒ",H:"๐•ณ",I:"๐•ด",J:"๐•ต",K:"๐•ถ",L:"๐•ท",M:"๐•ธ",N:"๐•น",O:"๐•บ",P:"๐•ป",Q:"๐•ผ",R:"๐•ฝ",S:"๐•พ",T:"๐•ฟ",U:"๐–€",V:"๐–",W:"๐–‚",X:"๐–ƒ",Y:"๐–„",Z:"๐–…",a:"๐–†",b:"๐–‡",c:"๐–ˆ",d:"๐–‰",e:"๐–Š",f:"๐–‹",g:"๐–Œ",h:"๐–",i:"๐–Ž",j:"๐–",k:"๐–",l:"๐–‘",m:"๐–’",n:"๐–“",o:"๐–”",p:"๐–•",q:"๐––",r:"๐–—",s:"๐–˜",t:"๐–™",u:"๐–š",v:"๐–›",w:"๐–œ",x:"๐–",y:"๐–ž",z:"๐–Ÿ"},monospaceDict:{0:"๐Ÿถ",1:"๐Ÿท",2:"๐Ÿธ",3:"๐Ÿน",4:"๐Ÿบ",5:"๐Ÿป",6:"๐Ÿผ",7:"๐Ÿฝ",8:"๐Ÿพ",9:"๐Ÿฟ",A:"๐™ฐ",B:"๐™ฑ",C:"๐™ฒ",D:"๐™ณ",E:"๐™ด",F:"๐™ต",G:"๐™ถ",H:"๐™ท",I:"๐™ธ",J:"๐™น",K:"๐™บ",L:"๐™ป",M:"๐™ผ",N:"๐™ฝ",O:"๐™พ",P:"๐™ฟ",Q:"๐š€",R:"๐š",S:"๐š‚",T:"๐šƒ",U:"๐š„",V:"๐š…",W:"๐š†",X:"๐š‡",Y:"๐šˆ",Z:"๐š‰",a:"๐šŠ",b:"๐š‹",c:"๐šŒ",d:"๐š",e:"๐šŽ",f:"๐š",g:"๐š",h:"๐š‘",i:"๐š’",j:"๐š“",k:"๐š”",l:"๐š•",m:"๐š–",n:"๐š—",o:"๐š˜",p:"๐š™",q:"๐šš",r:"๐š›",s:"๐šœ",t:"๐š",u:"๐šž",v:"๐šŸ",w:"๐š 
@westonwatson
westonwatson / emount.sh
Created March 5, 2018 14:39
Mount Removable Drives in Windows' Ubuntu/Bash/Subsystem
#!/bin/bash
cat << EOF
__________ ______ ______________ ______ _________
___ ____/ ___ |/ /_ __ \\_ / / /__ | / /__ __/
__ __/ / /|_/ /_ / / / / / /__ |/ /__ /
_ /___ / / / / / /_/ // /_/ / _ /| / _ /
/_____/ /_/ /_/ \\____/ \\____/ /_/ |_/ /_/
Must be run as root
EOF
@westonwatson
westonwatson / html_tag.php
Created April 10, 2014 16:38
html_tag helper method
function html_tag($tag_name,$options=null){
$html = "<";
$html .= $tag_name;
if ($options){
if (is_array($options)){
$html .= " ";
foreach($options as $key => $val){
$html .= "{$key}=\"{$val}\" ";