Skip to content

Instantly share code, notes, and snippets.

View Rykus0's full-sized avatar

Tom Pietrosanti Rykus0

View GitHub Profile
@Rykus0
Rykus0 / querystring.js
Created September 26, 2012 18:25
JavaScript: Query String
var qs = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
@Rykus0
Rykus0 / mq.css
Created October 3, 2012 19:24 — forked from chriscoyier/mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
var db;
var indexedDB = window.indexedDB || window.webkitIndexedDB
|| window.mozIndexedDB || window.msIndexedDB;
var IDBTransaction = window.IDBTransaction ||
window.webkitIDBTransaction;
@Rykus0
Rykus0 / style.css
Created December 5, 2012 15:00 — forked from technopagan/style.css
Progressive Enahncement to use SVG sprites with PNG fallback for IE6+7
/**
* Progressive Enahncement to use SVG sprites with PNG fallback for IE6+7
*
* The trick:
* Legacy IE does not support rgba values.
* By defining a rgba background color together with the
* SVG background image for all modern browsers, legacy IE
* will ignore the SVG and use the
* first background definition containing the fallback PNG
*
@Rykus0
Rykus0 / hasFocus.js
Last active November 30, 2018 09:52
Nightwatch custom assertion for testing whether an element currently has focus
var util = require('util');
exports.assertion = function(selector, msg) {
var ancestors = selector;
// If the selector comes from a section of a page object
// selector will be an array of objects starting from the outermost
// ancestor (section), and ending with the element
// Join their selectors in order
// Should probably look into getting this added to core