Skip to content

Instantly share code, notes, and snippets.

View GarrettS's full-sized avatar

Garrett Smith GarrettS

View GitHub Profile
@GarrettS
GarrettS / index.html
Created April 10, 2019 22:19
Welcome to Walmart Walmart Interview Question // source https://jsbin.com/jajazed
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Walmart Interview Question">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Welcome to Walmart</title>
</head>
<body>
@GarrettS
GarrettS / index.html
Created April 10, 2019 22:19
Welcome to Walmart Walmart Interview Question // source https://jsbin.com/jajazed
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Walmart Interview Question">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Welcome to Walmart</title>
</head>
<body>
@GarrettS
GarrettS / index.html
Last active April 10, 2019 16:21
Text Dollar — JP Morgan Chase Interview Question // source https://jsbin.com/tinuqar
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="JP Morgan Chase Interview Question">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JP Morgan Chase Intervew Question</title>
</head>
<body>
<h1></h1>
@GarrettS
GarrettS / index.html
Last active April 10, 2019 16:18
Max Range Sum — JP Morgan Chase Interview Question // source https://jsbin.com/cikekev
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="JP Morgan Chase Intervew Question">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JP Morgan Chase Intervew Question</title>
</head>
<body>
@GarrettS
GarrettS / YouTube Speed & Pitch
Last active October 17, 2017 06:11
Updated for standalone Video Player and also Framed Tweet Media (Edit Tweet ID)
(
function(v,n) {
var doc = this.contentDocument || document;
if(!v) v = doc.querySelector("video");
if(!v) return;
var fbButtonsDiv = doc.getElementById("fbPhotoPageButtons");
var artistworksDiv = doc.getElementById("playlist0");
@GarrettS
GarrettS / Variable Speed for YouTube
Last active August 27, 2015 17:56
Bookmarklet Variable Speed for YouTube
javascript:var gSpeedControl = (function(v,i,n,t){ n.insertBefore(i, n.firstChild);i.type="range";i.min=.3;setTimeout(function(){i.max=i.value=1;i.oninput();},1); i.step=.05;t=i.nextSibling;i.oninput=function(){t.data=(100*(v.playbackRate=i.value)|0)+"%"};return i})(document.querySelector("video"), document.createElement("input"), document.getElementById("watch-header"))
@GarrettS
GarrettS / gist:1fb0709bb03e8d5bae25
Created September 4, 2014 00:02
Selectors: findAncestor
function matchesSelector(el, selectorText, ctx) {
var all = (ctx||el.ownerDocument).querySelectorAll(selectorText);
return indexOf(all, el) != -1;
}
function findAncestor(el, selectorText, container) {
if(el == null || el === container)
return null;
var parent = el.parentNode;
@GarrettS
GarrettS / Prototype Inheritance
Created August 23, 2014 04:01
Prototype Inheritance - extends.
function Car(make) {
this.make = make;
}
Car.prototype.drive = function() {
console.log('driving ' + this.make);
};
@GarrettS
GarrettS / bind
Last active December 26, 2015 10:49
Function.prototype.bind example.
var couple = { m : "Garrett", f : "Tomomi" };
var marriage = function() { console.log(this.f + " is married to " + this.m); };
var status = marriage.bind(couple);
status();
"Tomomi is married to Garrett";
@GarrettS
GarrettS / tco no
Created June 21, 2012 23:46
tco no
document.addEventListener("mouseover", function(e) {
var t=e.target, u;
if(!t.href) t = t.parentNode;
if(t.href) {
if(t.host=="t.co"){
u=t.getAttribute("data-expanded-url");
if(!u && t.search) {
u=(u=t.search.match(/\burl=(.+)?&/))&&unescape(u[1]);
} else if(!u && t.title.indexOf("http") == 0) {
u = t.title;