Skip to content

Instantly share code, notes, and snippets.

const isAutoplaySupported = function (callback) {
var timeout;
var waitTime = 200;
var retries = 5;
var currentTry = 0;
var elem = document.createElement('video');
var elemStyle = elem.style;
function testAutoplay(arg) {
currentTry++;
@Grahnz
Grahnz / WebWindow.cs
Created October 2, 2016 23:17 — forked from drawcode/WebWindow.cs
Unity WebWindow (browser within unity editor window, helpful for tools that require a web view or more beyond basic controls).
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
public class WebWindow : EditorWindow {
static Rect windowRect = new Rect(100,100,800,600);
static BindingFlags fullBinding = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
static StringComparison ignoreCase = StringComparison.CurrentCultureIgnoreCase;
@Grahnz
Grahnz / screenshot.js
Created July 24, 2016 01:26
phantomjs cli for screenshotting with query selector
var page = require('webpage').create();
var args = require('system').args;
//minimum 3 arguments, 1: this js file, 2: url, 3: querySelector, 4[optional]: output file name
if (args.length < 3 || args.length > 4) {
console.log('Invalid arguments, pass url & querySelector');
} else {
//get cl arguments
var url = args[1];
var querySelector = args[2];
@Grahnz
Grahnz / webkit-pseudo-elements.md
Created July 20, 2016 08:28 — forked from leostratus/webkit-pseudo-elements.md
Webkit Pseudo-Element Selectors (Shadow DOM Elements)

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;