Skip to content

Instantly share code, notes, and snippets.

View benschac's full-sized avatar
🤓
doing beep boops

benjamin benschac

🤓
doing beep boops
View GitHub Profile
@benschac
benschac / expo-av patch
Created December 28, 2023 00:17
expo-av next.js video patch
diff --git a/registry.js b/registry.js
index 02470da3c4962ad1bbdc62d9ed295c19ca4905fe..3d1ec8b8153f8aa7a7597d933097301973225f1e 100644
--- a/registry.js
+++ b/registry.js
@@ -4,35 +4,21 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @flow strict
- * @format
var fans = document.querySelectorAll("a");
var fans = [...fans];
var [junk, ...rest] = fans;
var csv = rest
.map((fan) => {
return `${fan.href}, ${fan.textContent}\n`;
})
.join(",");
// Given an array of integers arr, a pair (n,m) is called “special” if arr[n] == arr[m], and n < m.
// Return the number of special pairs.
// Hint: Nested for loops can work for this one, but a hashmap solution will have a better runtime!
// $ specialPairs([1,2,3,1,1,3])
// $ 4 // (0,3), (0,4), (3,4), (2,5)
function specialPairs(arr) {
// let cache = {};
let count = 0;
@benschac
benschac / README.md
Created October 28, 2020 14:41 — forked from david-crespo/README.md
Download tagged photos and videos from Facebook (Python 3)

Why

When you download an archive of your Facebook account, Facebook includes photos and videos you've uploaded, but not photos and videos you're tagged in that were uploaded by other people. This is a script to automatically download those.

Setup

  1. pip3 install selenium
  2. Download the ChromeDriver executable and put it somewhere in your PATH
  3. Set FB_USER_ID and CHROME_PROFILE_PATH in helpers.py
  4. Set CONTAINER_SELECTOR (see below)
// Given an array of people objects (where each person has a name and a number of pizza slices they’re hungry for)
// and a number for the number of slices that the pizza can be sliced into, return the number of pizzas you need to buy.
function gimmePizza(arr, slices) {
let totalSlices = arr.reduce((prev, curr) => {
prev += curr.num;
return prev;
}, 0);
return Math.ceil(totalSlices / slices);
function fibsLike(arr) {
let longest = 0;
for (let q = 0; q < arr.length; q++) {
let acc = new Set([]);
for (let i = q; i < arr.length; i++) {
for (let j = i + 1; j < arr.length; j++) {
let slow = arr[i];
let fast = arr[j];
let idx = arr.indexOf(slow + fast);
:root {
/* TODO -- Use postCSS to get pow() function */
--font-size: min(max(1rem, 4vw), 22px);
--ratio: 1.5;
--line-height-small: calc(var(--ratio) * .7);
--measure: 60ch;
--s-5: calc(var(--s-4) / var(--ratio));
--s-4: calc(var(--s-3) / var(--ratio));
--s-3: calc(var(--s-2) / var(--ratio));
--s-2: calc(var(--s-1) / var(--ratio));
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
aa = add -A .
cm = commit -m
gr = grep -Ii
merged = branch --merged
st = status
@benschac
benschac / ben.svg
Created May 11, 2020 21:52
ben.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am benschac on github.
  • I am benschac (https://keybase.io/benschac) on keybase.
  • I have a public key ASAVg8mvmT0myT5ftMHxHvlQCjLHFRkujr-w2Yo-yXgydQo

To claim this, I am signing this object: