Skip to content

Instantly share code, notes, and snippets.

@bogobogo
bogobogo / background.js
Created November 28, 2021 06:42 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@bogobogo
bogobogo / background.js
Created April 28, 2018 21:05 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@bogobogo
bogobogo / lisp.json
Last active April 21, 2021 20:29
lisp.json
{
"common lisp let": {
"prefix": "llet",
"body": [
"(let ((${1:var}))",
" ${2:body})"
],
"description": "common lisp let"
},
"common lisp if": {
element(by.id('some_id'))
element(by.label('Some Text!!'))
element(by.id('Grandson883').withAncestor(by.id('Son883')))
element(by.id('Son883').withDescendant(by.id('Grandson883')))
element(by.type('RCTImageView'))
element(by.id('UniqueId345').and(by.label('ID')))
element(by.label('Product')).atIndex(2)
element(by.traits(['button'])