Skip to content

Instantly share code, notes, and snippets.

@Ianfeather
Ianfeather / buzz.json
Created October 24, 2023 14:31
Buzz from resource hub with badges and socialpromo
{
"buzz": {
"all_classifications": {
"editions": [
"US"
],
"sections": [
"Celebrity",
"Work & Money"
]
@Ianfeather
Ianfeather / mock.json
Created October 10, 2023 14:33
GET /pages/{pageID}
{
"id": 1,
"name": "en_us__bf_homepage",
"display_name": "BF Homepage",
"metadata": {},
"created_at": 1695932476,
"updated_at": 1695932476,
"deleted_at": null,
"last_updated_by": "test_user@buzzfeed.com",
"items": [
# 1. non-shopping post (will hit the else here https://github.com/buzzfeed/mono/blob/master/subbuzz_rendering_api/app/handlers/render.py#L112-L119)
curl --location --request POST 'https://subbuzz-rendering-api.dev.buzzfeed.io/v1/render/bpage' \
--header 'Content-Type: application/json' \
--data-raw '{"subbuzzes":[{"bfp_data":{"clients":[{"amp":{"supported":1,"version":""}},{"android":{"supported":0,"version":""}},{"apple_news":{"supported":1,"version":""}},{"ia":{"supported":1,"version":""}},{"ios":{"supported":0,"version":""}},{"oo_web":{"supported":1,"version":""}},{"smartnews":{"supported":0,"version":""}}],"data":{"amp":false,"apple_news":{"hidden":true,"role":"container"},"ia":false,"web":[{"attributes":[{"key":"id","value":"abb27cbb541044028dd5d8fc6e3c4952"}],"children":[{"content":"(new Image()).src = '\''https://capi.connatix.com/tr/si?token=dc1d8343-8081-406d-9a5e-53dc0c4e1021&cid=1bf35e8b-3d55-48a6-aef8-0ebfdd277df7'\''; cnx.cmd.push(function() { cnx({ playerId: \"dc1d8343-8081-406d-9a5e-53dc0c4e10
@Ianfeather
Ianfeather / cache-ratio.mjs
Last active November 9, 2022 11:39
Calculating Cache Hit Ratio from fastly logs
import { readdir, readFile } from 'node:fs/promises';
// Update this path to point to a directory of log files.
const logPath = './fastly-logs';
const files = await readdir(logPath);
// This map holds pairs of page name and page regex and is used to group requests into page types.
// The regex for each is tested against the url of the request in the logline
/// You should update this map to be relevant for the requests you're interested in.
const types = new Map([
@Ianfeather
Ianfeather / california.json
Last active July 30, 2018 14:42
Bringme hackweek data
[
{
"city": "Los Angeles",
"name": "Panda Express",
"title": "Behold: The Orange Chicken Burrito From Panda Express",
"latlong": "33.991521, -117.933127",
"video_id": 12771,
"bf_url": "",
"video_url": "https://www.facebook.com/buzzfeedbringme/videos/1514809721887184/",
"status": "Uploaded",
@Ianfeather
Ianfeather / buttons.css
Created September 5, 2017 14:59
buttons.css
.button {
cursor: pointer !important;
padding: 0 !important;
background-color: transparent !important;
background-image: none !important;
border: 1px solid transparent !important;
white-space: nowrap !important;
-webkit-appearance: none;
appearance: none;
-webkit-user-select: none;
@Ianfeather
Ianfeather / forms.css
Created September 5, 2017 14:58
forms.css
.text-input,
.text-input--small,
.textarea,
.textarea--small,
.select,
.select--small {
font-family: inherit !important;
background: #fff !important;
font-size: 1rem !important;
line-height: 1.5rem !important;
@Ianfeather
Ianfeather / flex.css
Created September 5, 2017 14:58
flex.css
.xs-flex {
display: flex !important; }
.xs-flex-order-1 {
order: 1 !important; }
.xs-flex-order-2 {
order: 2 !important; }
.xs-flex-order-3 {
@Ianfeather
Ianfeather / layout.css
Created September 5, 2017 14:56
layout.css
.xs-overflow-hidden {
overflow: hidden !important; }
.xs-overflow-auto {
overflow: auto !important;
-webkit-overflow-scrolling: touch; }
.xs-overflow-scroll {
overflow: scroll !important;
-webkit-overflow-scrolling: touch; }
function couldBePalindromic(word) {
let letters = word.split('');
let matches = letters.map(letter => {
// How many sets of characters are multiples of 2
return letters.filter((l) => l == letter).length % 2 == 0
})
// Filter out the ones that aren't
.filter((bool) => bool == true)