Skip to content

Instantly share code, notes, and snippets.

@FedericoElles
FedericoElles / fastclick.cdn.ondemand.js
Created March 23, 2016 08:28
Android: Is fastclick.js needed or required?
//Test URL:
// http://ftlabs.github.io/fastclick/examples/layer.html
(function () {
function isNeeded() {
var metaViewport;
var chromeVersion;
// Devices that don't support touch don't need FastClick
@CaptainJiNX
CaptainJiNX / highland-event-debouncer.js
Created February 16, 2017 12:02
From chrome://newtab/
'use strict';
const EventEmitter = require('events').EventEmitter;
const H = require('highland');
const emitter = new EventEmitter();
const delay = ({ key, value }) => {
return H((push, next) => {
H.log('----> REQUEST: ', key, value);
setTimeout(() => {
@Introvertuous
Introvertuous / index.html
Created February 22, 2018 13:29
Headless Chrome Thumbnails
<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" style="width: 1080px; height: 1080px"></canvas>
<script type="text/javascript">
var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
@AutomatedTester
AutomatedTester / startChrome.js
Created February 9, 2011 12:21
Starts Google Chrome
var util = require('util'),
exec = require('child_process').exec,
child;
child = exec('open "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
@myrdd
myrdd / sinon-chrome.js
Created April 7, 2018 05:20
extend sinon-chrome
// source: https://github.com/RequestPolicyContinued/requestpolicy/blob/1c9810d005a0bc12a7719484bf63f58616ff6cbf/tests/mocha/lib/sinon-chrome.js
const stableApiFx = require("sinon-chrome/config/stable-api-ff.json");
const Api = require("sinon-chrome/api");
for (let ns of stableApiFx) {
if (ns.namespace === "management") {
if (!("events" in ns)) ns.events = [];
ns.events.push({
"name": "onEnabled",
@pedrohenriquebr
pedrohenriquebr / index.js
Last active April 26, 2024 23:14
Puppeteer chrome connection
/**
* chrome --remote-debugging-port=9222
* --no-first-run --no-default-browser-check
**/
const puppeteer = require('puppeteer');
const axios = require('axios');
(async () => {
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 26, 2024 23:15
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string Electron/ anywhere in your user-agent.

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
@up1
up1 / index.js
Created April 17, 2017 02:55
Chrome Headless
const CDP = require("chrome-remote-interface");
CDP(client => {
const { Network, Page } = client;
Network.requestWillBeSent(params => {
console.log(params.request.url);
});
Page.loadEventFired(() => {
client.close();
});
@ashutoshpw
ashutoshpw / chrome.js
Created July 16, 2020 18:33
puppeteer-chrome
const p = require('puppeteer');
async function vo(){
const b = await p.launch({args: ['--no-sandbox']});
const page = await b.newPage();
await page.goto("https://www.opinionstage.com/polls/2462945/poll?sembed=1&wid=0");
page.on('console', msg => {
for (let i = 0; i < msg.args.length; ++i)
console.log(`${i}: ${msg.args[i]}`);
});
@nolanlawson
nolanlawson / bind-polyfill.js
Last active April 26, 2024 23:14
Chrome IndexedDB PouchDB heisenbug
(function () {
'use strict';
// minimal polyfill for phantomjs; in the future, we
// should do ES5_SHIM=true like pouchdb
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5
// internal IsCallable function