Skip to content

Instantly share code, notes, and snippets.

View ITJoePC's full-sized avatar

JoePC ITJoePC

View GitHub Profile
@ITJoePC
ITJoePC / uri.js
Created April 27, 2016 15:37 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ITJoePC
ITJoePC / bling.js
Created November 8, 2017 21:09 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@ITJoePC
ITJoePC / querySelector.js
Created November 8, 2017 21:09 — forked from AllThingsSmitty/querySelector.js
Use querySelector with .bind() as a shortcut to familiar function names
// returns first element selected - $('input[name="food"]')
var $ = document.querySelector.bind(document);
// return array of selected elements - $$('img.dog')
var $$ = document.querySelectorAll.bind(document);
// Credit: https://twitter.com/wesbos/status/608341616173182977
@ITJoePC
ITJoePC / Repair-SPDistributedCache.ps1
Created July 2, 2020 23:13 — forked from wpsmith/Repair-SPDistributedCache.ps1
PowerShell: Repair SharePoint Distributed Cache Service Instance
<#
.Synopsis
Repairs the Distributed Cache on a Server.
.Description
Repairs the Distributed Cache on a Server by removing the current Distributed Cache Service instance.
.Parameter Server ("ServerName")
The Server running Distributed Cache Service
Type: String
@ITJoePC
ITJoePC / waldo.js
Created June 10, 2021 19:00 — forked from richard512/waldo.js
Waldo JS -- Find Strings in JS DOM
/*
Author: Angus Croll
Found at: https://javascriptweblog.wordpress.com/2011/07/11/waldo-search-the-javascript-runtime-in-under-1-kb/
MINIFIED AS A BOOKMARKLET:
javascript:(function(){var c=function(d,e,f){var f=f||{};var i=f.obj||window;var h=f.path||((i==window)?"window":"");var g=Object.keys(i);g.forEach(function(j){if((b[d]||d)(e,i,j)){console.log([h,".",j].join(""),"->",["(",typeof i[j],")"].join(""),i[j])}if(Object.prototype.toString.call(i[j])=="[object Object]"&&(i[j]!=i)&&h.split(".").indexOf(j)==-1){c(d,e,{obj:i[j],path:[h,j].join(".")})}})};var a=function(d,g,e,f){(!g||typeof e==g)?c(d,e,f):console.error([e,"must be",g].join(" "))};var b={name:function(d,e,f){return d==f},nameContains:function(d,e,f){return f.indexOf(d)>-1},type:function(d,e,f){return e[f] instanceof d},value:function(d,e,f){return e[f]===d},valueCoerced:function(d,e,f){return e[f]==d}};window.find={byName:function(d,e){a("name","string",d,e)},byNameContains:function(d,e){a("nameContains","string",d,e)},byType:function(d,e){a("typ
@ITJoePC
ITJoePC / console.save.js
Created October 18, 2021 22:57 — forked from raecoo/console.save.js
Save JSON object to file in Chrome Devtool
// e.g. console.save({hello: 'world'})
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)