Skip to content

Instantly share code, notes, and snippets.

View richjenks's full-sized avatar
🏍️

Rich Jenkins richjenks

🏍️
View GitHub Profile
@richjenks
richjenks / fix-ssrs-in-non-trident-browsers.js
Created July 1, 2013 14:11
Fix SQL Server Reporting Services in non-Trident browsers
window.setInterval(function(){document.getElementById("ctl31_ctl09").style.overflow="visible";},2000);
@richjenks
richjenks / blank-favicon
Created September 2, 2013 08:26
Blank Favicon
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon">
@richjenks
richjenks / css-noise.css
Created September 12, 2013 15:54
CSS Noise
body {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdhMpxEnt5JetoulscpyzhXN5FRpuPHvbeQaKxFAEB6EN+cYN6xD7RYGpXpNndMmZgM5Dcs3YSNFDHUo2LGfZuukSWyUYirJAdYbF3MfqEKmjM+I2EfhA94iG3L7uKrR+GdWD73ydlIB+6hgref1QTlmgmbM3/LeX5GI1Ux1RWpgxpLuZ2+I+IjzZ8wqE4nilvQdkUdfhzI5QDWy+kw5Wgg2pGpeEVeCCA7b85BO3F9DzxB3cdqvBzWcmzbyMiqhzuYqtHRVG2y4x+KOlnyqla8AoWWpuBoYRxzXrfKuILl6SfiWCbjx
@richjenks
richjenks / uuid.php
Last active August 29, 2015 14:08
Generate UUID
<?php
/**
* uuid
*
* Generates a new UUID
*
* @return string A new UUID
*/
<?php
/**
* hash_cost_benchmark
*
* Benchmarks your server and selects an appropriate cost for hash_pasword
*
* @param float $target Maximum acceptable duration in seconds
* @param int $cost Initial cost
*
<?php
/**
* filesize
*
* Formats a filesize into a human-readable format
*
* Usage:
* <code>
* filesize(50, false, '{size} <small>{unit}</small');
<?php
/**
* sort_arr_by_key
*
* Sorts a given array by the values of its child arrays
*
* The code below would order the array items by age:
*
* <code>
@richjenks
richjenks / modify-mean.php
Last active August 29, 2015 14:08
Attempts to simulate the addition or removal of a value from a mean
<?php
/**
* modify_mean
*
* Add or subtract a value from a mean
* As if the original mean were calculate with/without it
*
* @param int $mean The current mean
* @param int $points The number of data points
@richjenks
richjenks / heatmap-hue.php
Last active August 29, 2015 14:08
Returns a hue value between green and red for an int between 0–100
<?php
/**
* heatmap
*
* Returns a hue value for HSL colors when given a level between 0–100
* Will accept higher/lower values, but will be outside of heatmap range
* Converts a percentage to a number between 0—120 in reverse
*
* @param int $level Integer between 0–100
@richjenks
richjenks / responsive-iframes.js
Created December 13, 2014 08:40
Responsive iframes, requires jQuery
// Find all iframes
var iframes = jQuery("iframe");
// Find & save the aspect ratio for all iframes
iframes.each(function () {
jQuery(this).data("ratio", this.height / this.width)
// Remove the hardcoded width & height attributes
.removeAttr("width")
.removeAttr("height");