Skip to content

Instantly share code, notes, and snippets.

@benknight
benknight / gist:4047491
Created November 9, 2012 18:51
Alfred Shell Script Extension for opening an SSH tunnel via BrowserStack's Java command line tool to test multiple internal hosts.
#!/bin/bash
# BrowserStack SSH Tunnel Setup
# Find your key by logging into BrowserStack and finding your command line tunnel setup info
KEY=YOUR_KEY_HERE
# Add your internal hosts here
INTERNAL_HOSTS=( dev alpha beta whatever whocares )
for host in ${INTERNAL_HOSTS[@]} ; do
@benknight
benknight / dabblet.css
Created January 7, 2013 23:48
Look! Protocol relative URIs don't work in data URIs.
/**
* Look! Protocol relative URIs don't work in data URIs.
*/
iframe { width: 500px; }
@benknight
benknight / dabblet.css
Created January 17, 2013 21:47
Demonstating negative margin behavior on absolutely positioned elements.
/*
* Demonstating negative margin behavior on absolutely positioned elements.
*
* Conclusion: Browser only changes position when the margin is set on the same side as the position offset.
* E.g. style rule has margin-top and top set, or margin-bottom and bottom. See A & C.
*/
div {
position: absolute;
width: 100px;
height: 100px;
@benknight
benknight / dabblet.css
Created January 28, 2013 02:52 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
@benknight
benknight / gist:5127586
Last active December 14, 2015 18:09
Inverted Google Analytics Dashboard. Cool for big screen monitors!
#main-body {
-webkit-filter: invert(100%) hue-rotate(180deg);
zoom: 125%;
}
#ID-overtimePanel {
padding-top: 10px;
}
/* remove margin intended to clear header */
@benknight
benknight / gist:5135874
Last active December 14, 2015 19:19
Append Grapper to the bottom half of the window
var grapper = document.createElement('iframe');
grapper.id = 'grapper';
grapper.src = 'http://dev16.706.yelpcorp.com:4773/';
document.body.appendChild(grapper);
@benknight
benknight / dabblet.css
Created April 9, 2013 19:06
Old flexbox will stretch to contain floats, while new flexbox won't (proper behavior).
/**
* Old flexbox will stretch to contain floats, while new flexbox won't (proper behavior).
*/
.flex-container {
display: -webkit-flex;
background: paleGreen;
}
.flex-container.old {
@benknight
benknight / dabblet.css
Created May 7, 2013 20:58
When mouseup and mousedown occur on different target elements, nothing happens. Therefore, it's probably a bad idea to "depress" buttons down 1px on click. Doesn't matter if you use CSS transform or position.
/**
* When mouseup and mousedown occur on different target elements, nothing happens.
*/
a { display: block; }
a:active {
transform: translateY(100px);
}
@benknight
benknight / gist:6503634
Last active December 22, 2015 17:08
Scss @extend puzzle
// In:
// ---
li ul li a {
color: white;
}
li li li b {
@extend a;
}
@benknight
benknight / gist:6558278
Last active December 23, 2015 01:09
Code for applying JavaScript and CSS code from a Gist to a page. (This is *so* meta.)
<h1>Apply Gist Bookmarklet</h1>
Drag me into the bookmarks bar:<br>
<a href="javascript:(function()%7Bvar%20gist_id%3Dprompt(%27What%E2%80%99s%20the%20Gist%20ID%3F%27)%3Bvar%20css%3D%5B%5D%3Bvar%20js%3D%5B%5D%3Bvar%20applyCSS%3Dfunction()%7Bfor(var%20x%20in%20css)%7Bvar%20style%3Ddocument.createElement(%27style%27)%3Bstyle.innerHTML%3Dcss%5Bx%5D%3Bdocument.head.appendChild(style)%3B%7D%7D%3Bvar%20applyJS%3Dfunction()%7Bfor(var%20x%20in%20js)%7Bvar%20script%3Ddocument.createElement(%27script%27)%3Bscript.innerHTML%3Djs%5Bx%5D%3Bdocument.body.appendChild(script)%3B%7D%7D%3Bvar%20xhr%3Dnew%20XMLHttpRequest()%3Bxhr.open(%27GET%27,%27https://api.github.com/gists/%27%2Bgist_id,true)%3Bxhr.onload%3Dfunction()%7Bvar%20data%3DJSON.parse(this.responseText)%3Bfor(var%20file%20in%20data.files)%7Bif(data.files%5Bfile%5D.language%3D%3D%27CSS%27)%7Bcss.push(data.files%5Bfile%5D.content)%3B%7Dif(data.files%5Bfile%5D.language%3D%3D%27JavaScript%27)%7Bjs.push(data.files%5Bfile%5D.content)%3B%7D%7DapplyCSS()%3BapplyJS()%3B%7D