I hereby claim:
- I am joshuapbritz on github.
- I am joshuapaulbritz (https://keybase.io/joshuapaulbritz) on keybase.
- I have a public key ASDelTmNQ_iLeQQdrGuvohJPeQt8YhbqCwPyWJspGjzaXgo
To claim this, I am signing this object:
// This trick will make your image 30px wide and | |
// will automatically adjust the height of the | |
// image based on its aspect ratio. However, if | |
// the browser supports `object-fit`, the image | |
// will be made 30px by 30px and will size the | |
// image based on its aspect ratio | |
// (like background-size: cover) | |
img { | |
width: 30px; |
I hereby claim:
To claim this, I am signing this object:
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
function parseQuery(queryString) { | |
var query = {}; | |
var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&'); | |
for (var i = 0; i < pairs.length; i++) { | |
var pair = pairs[i].split('='); | |
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); | |
} | |
return query; | |
} |
function randomNumber() { | |
return 4 //Determined by dice roll. 100% guaranteed to be random | |
} |
function urlMaker(origin, path) { | |
var pl = path.length - 1; | |
var pathname = path.charAt(pl) === '/' ? path : path + '/'; | |
pathname = pathname.charAt(0) === '/' ? pathname : '/' + pathname; | |
var url = origin + pathname; | |
return url; | |
} | |
//Usage |