Skip to content

Instantly share code, notes, and snippets.

View tgaff's full-sized avatar

tgaff tgaff

  • Tokyo, Japan
  • 21:47 (UTC +09:00)
View GitHub Profile
@tgaff
tgaff / LM Studio remote coding assistant.md
Last active March 6, 2024 07:39
Using a remote system to serve AI Code helper with LM Studio & VS Code Continue extension (LLM)

I'm using a Windows machine with an RTX 3070 for this.

on the windows side

  1. install LM Studio
  2. install and start OpenSSH server
  3. download a model - ideally a code related one
  4. from the server tab a) select the model at top b) accept the updated prompt if needed
@tgaff
tgaff / 1readme.md
Last active July 25, 2023 03:31
github profile LLM experiment

I asked some popular LLMs to create a github profile readme.md. I used this prompt:

Hi, can you create an impressive github profile readme.md for me?

and when needed followed up with

could you provide that in markdown please?

results

@tgaff
tgaff / 1_turbo_stream_array_options.md
Last active February 8, 2023 03:19
multiple turbo streams

There are two ways to render multiple turbo streams:

  1. via the controller rendering an array of streams
  2. via a view file that contains multiple stream templates

The other two files on this gist demonstrate both methods.

DHH considers the first one bad.

I kinda like the first one because I think it makes it a little more obvious what the controller code was responsible for passing to where.

@tgaff
tgaff / stimulus.md
Created March 30, 2022 19:50
stimulus

naming

multi word controllers

Controller named complex_thing_controller.ts

doBigThing() {}
@tgaff
tgaff / upgrade26.md
Last active January 14, 2021 06:40
ruby 2.3 to 2.6 upgrade

local

brew upgrade ruby-install
ruby-install ruby 2.6.5

install bundler 2.1.4 (may not be necessary)

Depending on ruby version manager (rvm/chruby/rbenv) you may need to change directories or select ruby 2.6.5 then

@tgaff
tgaff / db_url_update_script.sh
Created January 17, 2020 20:14
Update elasticbeanstalk eb db url with utf8mb4 encoding and utf8mb4_unicode_ci collation - requires manual string edit!
#!/bin/bash
set +e
eb use $1
echo $1
eb printenv | grep DATABASE_URL
URL=`eb printenv | grep DATABASE_URL | sed -e 's/^[ \t]*//'`
echo "Using the above URL"
@tgaff
tgaff / show_thing.md
Last active June 27, 2023 01:21
Hidden details / summary in markdown
Click here if interested:
  • some detail
  • some much longer detail I wrote here to show you
  • gobbledy gook writing in her lalalala
@tgaff
tgaff / site-prism.md
Last active December 14, 2022 21:40 — forked from h-parekh/site-prism.md
What, why and a little bit of how to use site-prism

site prism

Page Object Model gem for ruby Page Objects are like react-components for integration spec code. They let you componentize pages or parts of pages so you don't use css-selectors every where.

If you have page.find('button', text: 'update section') in a lot of tests, when the PM says it should be 'Change Section' you have a lot of changes to make.
By sticking this in the page-object it limits the needed scope of change to just that POM and possible the one test that regression checked this.

pages