Skip to content

Instantly share code, notes, and snippets.

m -rf drizzle-test
mkdir drizzle-test
cd drizzle-test
echo "{}" > package.json
npm install drizzle-orm pg
npm install -D drizzle-kit @types/pg typescript
echo "import { pgTable } from 'drizzle-orm/pg-core';" > test.ts
npx tsc test.ts
@rubys
rubys / Dockerfile
Created May 12, 2023 03:09
Barebones demo of ejs, express, node, npm, redis, pg, tailwindcss, typescript, and ws
# syntax = docker/dockerfile:1
FROM node:18-slim as base
# Node app lives here
WORKDIR /app
COPY <<-"EOF" package.json
{
"dependencies": {
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=19.7.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Remix/Prisma"
# Remix/Prisma app lives here
WORKDIR /app
@rubys
rubys / live_elements_demo.sh
Last active March 27, 2023 23:10
Live Elements Demo
rails new livedemo --css tailwind
cd livedemo
bin/importmap pin @flydotio/stimulus-live-elements@0.1.0
echo 'export { default } from "@rubys/stimulus-live-elements"' > app/javascript/controllers/live_elements_controller.js
bin/rails generate controller demo
echo 'Rails.application.routes.draw {root "demo#button"; post "demo/click"}' >> config/routes.rb
cat <<-"EOF" > app/views/demo/_header.html.erb
<%= turbo_frame_tag "header", class: "block bg-#{color}-400 mb-4" do %>
<h1 class="font-bold text-4xl">Live button demo</h1>
#
# Proof of concept - import maps with JSX transpilation. Can trivially
# be extended to TypeScript and all the languages currently supported
# with Sprockets.
#
# There are two parts to this:
# * Have `find_javascript_files_in_tree` in importmap-rails to not only
# find JS files, but also files that can be transpiled to JS.
# * Add sprockets JSX transformer, making use of esbuild
#
const icalgen = require('ical-generator');
const fs = require('fs').promises;
const path = require('path');
const deepEqual = require('deep-equal');
const input = '/home/rubys/svn/www.apachecon.com/acah2020/tracks';
const output = '/home/rubys/svn/www.apachecon.com/acah2020/calendar';
// Configure babel
require('@babel/register')({
rm -rf multisvn
mkdir multisvn
cd multisvn
mkdir repo
svnadmin create repo/r1
# initial setup
svn checkout file://$(pwd)/repo/r1
mkdir -p r1/foo/bar
touch r1/foo/bar/file1
@rubys
rubys / omakase.md
Last active September 19, 2018 23:40
The menu is omakase

Rails doctrine: The menu is omakase (translation: I'll leave it up to you)

Preface

I'm going to try to make the case that instead of focusing on Module requirements, we should focus on Loader requirements and let a thousand flowers bloom. Part of making my case, I will introduce a number of new use cases that may have here-to-fore seemed out of reach.

Parallel Evolution