Skip to content

Instantly share code, notes, and snippets.

import { consola } from "consola";
export default defineCachedEventHandler(async (event) => {
const query = getQuery(event);
const menuName = query.menuName as string;
const key = `cache:menu:${menuName}`;
const storage = useStorage();
let menu = await storage.getItem(key);
if (menu) {
consola.info(`return cached response for ${menuName}`);
@mhinton
mhinton / machine.js
Last active January 21, 2022 17:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
BEGIN MESSAGE.
qIdAC0GeiTeVVl4 zHpvYlekcDE4bMB QSvAGQIEo9ydxA5 X1cUqSNpbfwTVzk
8eXLAT8pHzhM57t 2D4NhDtxW5JTCKq 6Xr2MZHgg77vnVQ KBIg9MpJYPq0HLI
PbdDj518kPtQUhQ TSfET5p7qsN7dGc jRSgeO7tJshXKw2 TZ9KQfCDc14KQaR
TgpGykFE2wh1VWT zx4ZJa9SRJOpfyA E5je62IP.
END MESSAGE.
BEGIN MESSAGE.
iKELw8QhriPMnWn rc8ebdkCZ9fxNnk ov1EVtguIp0XpPI qZNYBOM3BH2O3L2
kGqxMnnFzKxYLJD golyEqkFv2yTCKq 6Xr2MZHgg6m1EMs AoHLNHbe5YgkJNP
plzt69F8HCNdYtk JkY8xNgjtGOcaTP 25wdo22jpuLgtZE ItCiGTkNlH9Ivx3
Qw2gTPltQrLi54h C1SsDesAcYW6XQJ p5mra2IP.
END MESSAGE.
BEGIN TRANSACTION;
BEGIN TRY
-- sql commands here
END TRY
BEGIN CATCH
-- Use RAISERROR inside the CATCH block to return error
const pkg = require("./package");
module.exports = {
mode: "universal",
env: {
USER_EMAIL: "[email protected]"
},
/*

Keybase proof

I hereby claim:

  • I am mhinton on github.
  • I am mhinton (https://keybase.io/mhinton) on keybase.
  • I have a public key whose fingerprint is E331 947E 983C 60F2 DAA5 ECEA 27B1 27EA B54C 6B7D

To claim this, I am signing this object:

@mhinton
mhinton / gist:4fc1328bbe071d7a62ef
Last active August 29, 2015 14:08
Namespaced fixtures/models failing
bin/rails g model admin/player first_name:string last_name:string position:string years_in_league:integer
bin/rake db:migrate
bin/rake test TEST=test/models/admin/player_test
Started with run options --seed 20010
Admin::Player
test_0001_must be valid ERROR (0.23s)
@mhinton
mhinton / wtf?
Last active August 29, 2015 14:07
Meteor Publication
Meteor.publish("logs", function (filter) {
var cursor = Logs.find(filter);
cursor.observe({
added: function(doc) {
console.log("observe added");
doc.display = true;
}
});
@mhinton
mhinton / gist:55efbb71a10c379c2320
Created September 11, 2014 15:41
Publish/Subscribe Problem
// file: server/data.js
FooCollection = new Meteor.Collection("foo_users");
Meteor.publish("fooUsers", function(){
return FooCollection.find({});
});
// file: client/base.js
FooUsers = new Meteor.Collection("foo_users");