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.
var crm=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=750)}([function(e,t,n){(function(e){e.exports=function(){"use strict";var t,r;function i(){return t.app
@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}\" ";