Skip to content

Instantly share code, notes, and snippets.

@addyosmani
addyosmani / headless.md
Last active May 17, 2024 03:38
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@cvan
cvan / google-sheets-sync-to-firebase.js
Last active March 23, 2020 18:05
Google Spreadsheets script for syncing to Firebase
function syncToFirebase () {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var output = [];
var sheetName = sheet.getName();
@bschwartz757
bschwartz757 / async.js
Last active November 15, 2023 03:23
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@bdkent
bdkent / createFullWidthMasonry.jsx
Last active February 10, 2019 21:46
react-virtualized <AutoSizer> + <Masonry>
var DEFAULT_CELL_HEIGHT = 250;
var DEFAULT_CELL_SPACING = 10;
function createFullWidthMasonry(props) {
var cellSpacing = props.cellSpacing || DEFAULT_CELL_SPACING;
var cellHeight = props.cellHeight || DEFAULT_CELL_HEIGHT;
var keyMapper = props.keyMapper || _.identity();
@codediodeio
codediodeio / database.rules.json
Last active July 29, 2024 09:39
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@ashlynnpai
ashlynnpai / index.html
Created September 14, 2017 14:55
Wikipedia API viewer
<body>
<input id="startSearch" type="text">
<button onClick="getEntries()">Search Wikipedia</button>
<div>
<button onClick="getRandom()">Get Random Entry</button>
</div>
<div id="showResults">
</div>
</body>
@kylemcdonald
kylemcdonald / Collect Parler Metadata.ipynb
Last active June 27, 2024 04:09
Collect video URLs and GPS data for Parler videos.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.