Skip to content

Instantly share code, notes, and snippets.

View kaycebasques's full-sized avatar
🤔

Kayce Basques kaycebasques

🤔
View GitHub Profile
@kaycebasques
kaycebasques / headful
Created January 18, 2018 17:09
headful puppeteer
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
const client = await page.target().createCDPSession();
await client.send('Network.setBlockedUrls', {
urls: [ 'example.com' ]
});
await page.goto('https://google.com');
{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3357.0 Safari/537.36","lighthouseVersion":"2.8.0","generatedTime":"2018-03-01T17:13:42.981Z","initialUrl":"https://www.bhaskar.com/","url":"https://m.bhaskar.com/","runWarnings":[],"audits":{"is-on-https":{"score":true,"displayValue":"","rawValue":true,"extendedInfo":{"value":[]},"scoringMode":"binary","name":"is-on-https","description":"Uses HTTPS","helpText":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https).","details":{"type":"list","header":{"type":"text","text":"Insecure URLs:"},"items":[]}},"redirects-http":{"score":true,"displayValue":"","rawValue":true,"scoringMode":"binary","name":"redirec
group: Products
Laptop = {
model, speed, ram, hd, screen, price
2001, 2.00, 2048, 240, 20.1, 3673
2002, 1.73, 1024, 80, 17.0, 949
2003, 1.80, 512, 60, 15.4, 549
2004, 2.00, 512, 60, 13.3, 1150
2005, 2.16, 1024, 120, 17.0, 2500
2006, 2.00, 2048, 80, 15.4, 1700
@kaycebasques
kaycebasques / Soccer.txt
Last active October 7, 2020 02:33
Soccer.txt
group: Soccer
TEAMS = {
Country, WorldRank, Continent
France, 1, E
USA, 2, NA
Mexico, 3, NA
Ireland, 4, E
Germany, 5, E
}
@kaycebasques
kaycebasques / permission.js
Created November 12, 2020 02:15
Cross-browser compatible code for requesting notification permission
async function subscribeButtonHandler() {
function permissionRequestCallback(result) {
permissionStatus = result;
subscribe();
}
async function subscribe() {
if (subscriptionInFlight) return;
subscriptionInFlight = true;
if (permissionStatus === 'denied') {
console.error('The user explicitly denied notification permission.');
# Run from root repo dir
git submodule add https://pigweed.googlesource.com/third_party/github/FreeRTOS/FreeRTOS-Kernel third_party/freertos &&
git submodule add https://pigweed.googlesource.com/third_party/github/STMicroelectronics/cmsis_core third_party/cmsis_core &&
git submodule add https://pigweed.googlesource.com/third_party/github/STMicroelectronics/cmsis_device_f4 third_party/cmsis_device &&
git submodule add https://pigweed.googlesource.com/third_party/github/STMicroelectronics/stm32f4xx_hal_driver third_party/hal_driver
# Add to //WORKSPACE
new_local_repository(
import logging # debug
log_id = 'debug' # debug
logger = logging.getLogger(log_id) # debug
handler = logging.FileHandler(f'{log_id}.log') # debug
logger.addHandler(handler) # debug
logger.setLevel(logging.DEBUG) # debug