Skip to content

Instantly share code, notes, and snippets.

View liamness's full-sized avatar

Liam Duffy liamness

View GitHub Profile
/*
Trying to use Three's awful online customer service chat widget?
Getting kicked because you got distracted / needed a piss?
Then this is the code snippet for you
*/
setInterval(() => {
const button = document.getElementById('session_inv_yes');
if (button) {
/*
Google currently don't offer a way to easily delete all the passwords that you have saved with them.
So if you need to do that, here is a thing that does that.
Just browse to passwords.google.com, log in, and paste the following into the console.
Of course, posting things you found on the internet into the console is usually a bad idea.
*/
(() => {
let currentButton
@liamness
liamness / srcdoc-shim.js
Last active August 29, 2015 14:18
Fallback for browsers that don't support srcdoc for iframes
(function() {
if(!('srcdoc' in document.createElement('iframe'))) {
var iframes = document.getElementsByTagName('iframe');
for(var i = 0, len = iframes.length; i < len; i++) {
var iframe = iframes[i];
if(iframe.hasAttribute('srcdoc')) {
iframe.src = 'javascript: window.frameElement.getAttribute(\'srcdoc\');';
}
@liamness
liamness / text-outline.scss
Last active August 29, 2015 14:11
because -webkit-text-stroke is never going to blossom into text-stroke
// because -webkit-text-stroke is never going to blossom into text-stroke
@mixin text-outline($width: 1px, $color: #000, $blur: 0) {
@if (not unitless($width)) and (unit($width) != 'px') {
@warn '$width should be unitless or in pixels';
} @else if $width < 1px {
@warn '$width should be positive';
} @else if $width > 10px {
@warn '$width should be 10px or less to avoid long compilation times and bloated css';
}
@liamness
liamness / traverse.js
Created November 19, 2014 14:34
Traverses an object to any depth to find and return an object with a property of a given value
var findInObj = function(obj, property, value) {
var currentObj, result;
var check = function(obj, property, value) {
if(obj[property] === value) {
return obj;
} else if(typeof obj === 'object') {
var childObj = findInObj(obj, property, value);
return childObj;
}
@liamness
liamness / querystring.js
Last active August 29, 2015 14:07
Pops everything from the url parameters into an object
var params = {};
location.search.substring(1).split('&').forEach(function(param) {
var keyValue = param.split('=');
if(keyValue.length === 2 && keyValue.indexOf('') === -1) {
params[keyValue[0]] = keyValue[1];
}
});
@liamness
liamness / index.html
Last active August 29, 2015 14:07
d3.js simple example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>