Skip to content

Instantly share code, notes, and snippets.

@rmarscher
rmarscher / vite-plugin-deploy-aws-lambda-sst.patch
Last active September 19, 2024 15:49
Waku AWS Deploy Plugin Patch
diff --git a/packages/waku/src/lib/plugins/vite-plugin-deploy-aws-lambda.ts b/packages/waku/src/lib/plugins/vite-plugin-deploy-aws-lambda.ts
index 09a09d2..452efc7 100644
--- a/packages/waku/src/lib/plugins/vite-plugin-deploy-aws-lambda.ts
+++ b/packages/waku/src/lib/plugins/vite-plugin-deploy-aws-lambda.ts
@@ -1,10 +1,22 @@
import path from 'node:path';
-import { writeFileSync } from 'node:fs';
+import {
+ appendFileSync,
+ cpSync,
@rmarscher
rmarscher / example.html
Created August 1, 2024 04:54
Functions for building a webvtt preview thumbnail file generated by AWS MediaConvert - compatible with media chrome, plyr and other players
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
html,
body {
margin: 0;
padding: 0;
@rmarscher
rmarscher / waku.cloudflare-dev-server.ts
Last active September 19, 2024 01:24
Waku Cloudflare Pages Dev Server Middleware
import type { Hono } from 'hono';
import { getPlatformProxy } from 'wrangler';
import { WebSocketPair } from 'miniflare';
Object.assign(globalThis, { WebSocketPair })
export const cloudflareDevServer = (cfOptions: any) => async (app: Hono) => {
const proxyPromise = getPlatformProxy({
...(cfOptions || {}),
})
@rmarscher
rmarscher / fetch-graphql-schema.js
Created September 16, 2016 21:04
fetch-graphql-schema.js
// A script that can pull down the result of the introspection query
// from a running graphql server.
// Dependencies:
// npm i -S isomorphic-fetch graphql-tag graphql apollo-client
// Usage:
// node fetch-graphql-schema [graphql url]
// Example:
@rmarscher
rmarscher / openbr.rb
Created July 21, 2016 03:48
Homebrew formula for OpenBR with pull #486
class Openbr < Formula
# This should just temporarily override the official homebrew formula
# until the next release. And it is pointing to a commit on the
# master git branch, so use at your own risk. It does seem
# to get things working with the latest Qt version on homebrew.
# See https://github.com/biometrics/openbr/pull/486
# Copy the contents of this file to
# /usr/local/Library/Taps/homebrew/homebrew-science/openbr.rb
desc "Open Source Biometric Recognition"
@rmarscher
rmarscher / iscrollHandler.js
Last active January 15, 2018 04:07
scrollOverflowHandler for fullPage.js using iscroll
// Usage: requires a version of fullPage.js that incorporates
// pull request #1498: https://github.com/alvarotrigo/fullPage.js/pull/1498
//
// Then initialize fullPage.js and set this object to the
// scrollOverflowHandler option.
// ```
// scrollOverflow: true,
// scrollOverflowHandler: iscrollHandler,
// ```
@rmarscher
rmarscher / Modules.php
Last active August 29, 2015 13:58
Joomla! Template Module Positions In Lithium PHP
<?php
namespace app\extensions\helper;
use lithium\core\Libraries;
use lithium\template\view\TemplateException;
use lithium\template\View;
/**
* An implementation of Joomla! template module positions for Lithium.
@rmarscher
rmarscher / index.js
Created October 18, 2013 17:17
Invoke a shotgun.js shell from command-line without opening prompt. Put these files in a directory, run npm install, then run `node . help` to see it work.
var readline = require('readline'),
shotgun = require('shotgun'),
shell = new shotgun.Shell(),
context = {}; // Declare empty context object.
// Create interface that reads from console and outputs to console.
var rl = readline.createInterface(process.stdin, process.stdout);
// Configure shotgun.
shell
@rmarscher
rmarscher / DownloadsController.php
Created October 14, 2013 04:38
Lithium PHP framework CSV media handler - blacklists data not intended for export. See StackOverflow question "How do you remove specific fields from all entities of a record set in Lithium?": http://stackoverflow.com/questions/17189664/how-do-you-remove-specific-fields-from-all-entities-of-a-record-set-in-lithium/17202455
<?php
namespace app\controllers;
use app\models\Downloads;
class DownloadsController extends \lithium\action\Controller {
public function index() {
$this->request->privateKeys = array('id', 'user_id');
@rmarscher
rmarscher / MongoLogger.php
Created October 8, 2012 05:24
MongoDB logging in Lithium PHP
<?php
namespace li3_common\analysis;
use lithium\action\Request;
use lithium\console\Request as ConsoleRequest;
use lithium\core\Environment;
use lithium\data\Connections;
use lithium\util\String;
use MongoDate;