Skip to content

Instantly share code, notes, and snippets.

@umaar
umaar / gist:4058535
Created November 12, 2012 10:28
Referencing the default background colour of an Android theme
android:background=”?android:attr/windowBackground”
require 'sim_launcher'
require 'selenium-webdriver'
simulator = SimLauncher::DirectClient.for_iphone_app( "iWebDriver.app", '6.0' )
simulator.relaunch()
# see if iWebDriver is loaded(contact the host)
# retry a few times just incase
connected = false
(0..2).each do
// phantomjs --web-security=no most_used_css_property_names.js
var urls = [
'http://google.com',
'http://facebook.com',
'http://youtube.com',
'http://yahoo.com',
'https://github.com/',
'http://twitter.com/',
'http://en.wikipedia.org/wiki/Main_Page',
/**
* iOS 6 style switch checkboxes
* by Lea Verou http://lea.verou.me
*/
:root input[type="checkbox"] { /* :root here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}
/*global console */
/*
* In this file, we do a search for two non-existent selectors
* However the failure of only one of them contains the error we actually want
*/
(function() {
"use strict";
/**
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/
* @author Lea Verou
*/
(function() {
if(!window.StyleFix) {
return;
@umaar
umaar / webdriver-hover.js
Created February 17, 2014 14:05
Hover over an element in WebDriverJS
/*
* Hover over an element on the page
*/
(function() {
"use strict";
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().usingServer().withCapabilities({'browserName': 'chrome' }).build();
// called once, to initialize
createBubbles: function(){
var self = this,
el = this.element,
width = $(window).width(),
height = $(window).height(),
canvas = document.createElement('canvas');
el.style.width = canvas.width = width;
el.style.height = canvas.height = height;

Keybase proof

I hereby claim:

  • I am umaar on github.
  • I am umaar (https://keybase.io/umaar) on keybase.
  • I have a public key whose fingerprint is 8D22 FAC6 0CE3 6C2A F52A F55D ECE8 0641 2622 7FB5

To claim this, I am signing this object:

const combine = (...arrays)
=> [].concat(...arrays);
const compact = arr
=> arr.filter(el => el);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
)();