Skip to content

Instantly share code, notes, and snippets.

View rocktronica's full-sized avatar
😎
sup

Tommy rocktronica

😎
sup
View GitHub Profile
var results = { heads: 0, tails: 0, total: 0 };
function coinflip() {
var heads = !!Math.round(Math.random());
if (heads) {
results.heads++;
} else {
results.tails++;
};
results.total++;
@rocktronica
rocktronica / gist:2025024
Created March 12, 2012 22:11
fixed header w/ whitespace
body { background: #fff; }
.dxmDomainTopGroup { position: fixed; z-index: 1; opacity: .8; }
.tdRight { padding: 0 20px; box-shadow: none; }
.MainFrame, .MainFrameTabs { -webkit-box-shadow: none; box-shadow: none; border: none; border-radius: 0; }
.tdLeft { background: #fff; border: none; }
.tdLeft .widget { background: #eef2f4 url("/App_Themes/BubbleBase/images/100-90-4-monochrome.png"); border: 1px solid #ccc; margin: 0 0 20px; border-radius: 2px; }
@rocktronica
rocktronica / iclicks.html
Created March 22, 2012 05:18
iClicks++
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>iClicks++</title>
</head>
<style>
*{padding:0;margin:0;font-size:inherit;}
body {
@rocktronica
rocktronica / gist:2175583
Created March 23, 2012 22:14
Lorem function w/ input and tinyMCE filler
function lorem(iWords, bPunct) {
var s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
words = s.toLowerCase().replace(/[^a-zA-Z 0-9]+/g,'').split(/\s/),
iWords = iWords || 5,
sOutput = "";
for (var i = 0; i < iWords; i++) {
sOutput += " " + words[Math.ceil(Math.random() * words.length) - 1];
if (bPunct && i < iWords - 1) {
if (!Math.round(Math.random() * 15)) {
sOutput += ".";
@rocktronica
rocktronica / netflix.css
Created March 25, 2012 22:58
Cleaner Netflix CSS
#SLPlayer {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 100% !important;
height: 100% !important;
}
body {
@rocktronica
rocktronica / hncommentsearch.js
Created April 1, 2012 17:51
Search and highlight HackerNews comments
// Paste this into your JS console, love.
var sNeedle = prompt("Find what?").toLowerCase();
var tds = document.getElementsByClassName("default");
var iTdCount = tds.length;
for (var i = 0; i < iTdCount; i++) {
var td = tds[i];
var sHtml = td.innerHTML.toLowerCase();
if (sHtml.indexOf(sNeedle) > -1) {
@rocktronica
rocktronica / gist:2367523
Created April 12, 2012 14:04
trying to fix false absolute URLs when using IP address as localhost
(function () {
// only run on IPs and browserling tunnel
if ((!!parseInt(location.host.replace(/\./g, ''), 10)) || (!!location.href.match('browserling'))) {
// fake out DOM to get URL ports
function getPort(sUrl) {
var a = document.createElement("a");
a.href = sUrl;
return a.port;
@rocktronica
rocktronica / sure.js
Created May 4, 2012 23:47
bookmarklet to confirm leave
javascript:(function(){window.onbeforeunload=function(){return '';}})();
data:text/html,Loading...<script>document.body.innerHTML=prompt("html?")</script>
@rocktronica
rocktronica / newdate.js
Created May 4, 2012 23:51
location.search="?"+(+new Date());
javascript:(function(){location.search="?"+(+new Date());}())