Skip to content

Instantly share code, notes, and snippets.

View Flaque's full-sized avatar
。・:*:・゚★,。・:*:・゚☆

Evan Conrad Flaque

。・:*:・゚★,。・:*:・゚☆
View GitHub Profile
@nrktkt
nrktkt / analytics-cheat-sheet.sql
Last active October 21, 2020 02:17
cheat sheet with postgres queries for common analytics metrics
-- based off the metrics on the dashboard of the mixpanel music finder demo
create table events (
id bigserial primary key,
user_id varchar,
created_at timestamptz not null default now(),
name varchar not null,
properties jsonb not null default '{}'
);
@kisenka
kisenka / inmemory-webpack-compiler.js
Last active April 15, 2023 15:09
Webpack in-memory filesystem
var webpack = require('webpack');
var MemoryFS = require('memory-fs');
var SingleEntryDependency = require('webpack/lib/dependencies/SingleEntryDependency');
var fs = new MemoryFS();
fs.mkdirpSync('/src');
fs.writeFileSync('/src/app.js', 'require("./dep.js")', 'utf-8');
fs.writeFileSync('/src/dep.js', 'module.exports = function(msg){console.log(msg)}', 'utf-8');
fs.writeFileSync('/src/extra-entry.js', 'require("./dep.js")', 'utf-8');
@mackuba
mackuba / content_blocker_tips.md
Last active April 19, 2023 13:51
Tips for writing iOS content blockers - HelsinkiOS
  • read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
  • start by adding a new extension target to your iOS app of type “content blocker”
  • launch the app using the main target’s scheme + a call to SFContentBlockerManager.reloadContentBlockerWithIdentifier() with the extension’s id in application:didFinishLaunchingWithOptions: to auto-reload the blocker in development mode
  • if you don’t call reloadContentBlockerWithIdentifier() then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving)
  • use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
  • things like periods in the url-filter regexp need to be escaped with double backslashes, e.g. facebook\\.net
  • if you use if-domain, it needs to be an array, even for one element
  • domain foo.com might not match www.foo.com even though I think it’s supposed to (UPDATE: They've changed it in one of