Skip to content

Instantly share code, notes, and snippets.

View jakelazaroff's full-sized avatar
🎸
rocking out

Jake Lazaroff jakelazaroff

🎸
rocking out
View GitHub Profile
@jakelazaroff
jakelazaroff / i-frame.js
Last active December 4, 2023 10:16
simple web component that sandboxes its slotted elements inside an iframe
customElements.define(
"i-frame",
class extends HTMLElement {
#shadow = this.attachShadow({ mode: "closed" });
constructor() {
super();
this.#shadow.innerHTML = `
<slot></slot>
<iframe part="frame" srcdoc=""></iframe>
@jakelazaroff
jakelazaroff / rss2activitypub.js
Last active October 28, 2023 07:41
Publish the latest post in an RSS feed to an ActivityPub Starter Kit feed
import { XMLParser } from "fast-xml-parser";
import fetch from "node-fetch";
const RSS_URL = "https://jakelazaroff.com/rss.xml";
const ACTIVITYPUB_HOST = "https://shine-thunder-forgery.glitch.me";
const OUTBOX_URL = ACTIVITYPUB_HOST + "/test/outbox";
const CREATE_URL = ACTIVITYPUB_HOST + "/admin/create";
const ADMIN_USERNAME = "jake";
const ADMIN_PASSWORD = "test";
type Fn<A, B> = (a: A) => B;
function compose<A, B>(f1: Fn<A, B>): Fn<A, B>;
function compose<A, B, C>(f1: Fn<B, C>, fn2: Fn<A, B>): Fn<A, C>;
function compose<A, B, C, D>(
fn1: Fn<C, D>,
f2: Fn<B, C>,
fn3: Fn<A, B>
): Fn<A, D>;
function compose<A, B, C, D, E>(
@jakelazaroff
jakelazaroff / .slate
Created July 3, 2018 19:28
Slate config
alias hyper ctrl;alt;cmd
# maximize
bind m:${hyper} move screenOriginX;screenOriginY screenSizeX;screenSizeY
# center
bind c:${hyper} move screenSizeX/6;screenSizeY/6 2*screenSizeX/3;2*screenSizeY/3
# edges
alias halfSizeX screenSizeX/2
@jakelazaroff
jakelazaroff / .tmux.conf
Last active February 2, 2017 23:05
Dotfiles
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# turn on mouse scrollback
setw -g mouse on
# index windows and panes at 1
set -g base-index 1
@jakelazaroff
jakelazaroff / SKImage.swift
Last active January 9, 2018 00:42
A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
// SKImage
// A simple class that draws a PaintCode StyleKit "Image Method" image centered inside a UIView
// - installation: add to project and replace STYLEKIT_NAME comment with name of StyleKit class
// - instantiation: SKImage(image: "NameOfImage")
// - instantiation (with custom size): SKImage(image: "NameOfImage", size: CGRectMake(0, 0, 16, 16))
import UIKit
class SKImage: UIView {
@jakelazaroff
jakelazaroff / path.js
Last active August 29, 2015 14:14
Returns the value of a nested property if it exists, or undefined if it doesn't.
function nested(entity, path) {
path.split('.').some(function (property) {
entity = entity[property];
return typeof entity === 'undefined';
});
return entity;
};
@jakelazaroff
jakelazaroff / grid.scss
Last active January 3, 2016 14:19
small SASS grid.
$column-width: 60px;
$gutter-width: 20px;
$line-height: 20px;
@function columns ($columns: 1) {
@return $columns * ($column-width + $gutter-width) - $gutter-width;
}
@function rows ($lines: 1) {
@return $line-height * $lines;
@jakelazaroff
jakelazaroff / .tmux.conf
Created January 2, 2014 16:21
Some screen key bindings for tmux.
# set prefix to ctrl+a
unbind C-b
set -g prefix C-a
bind a send-prefix
# use space to cycle between windows
bind-key C-a last-window
bind-key Space next-window
bind-key C-Space previous-window