Skip to content

Instantly share code, notes, and snippets.

View antonioJASR's full-sized avatar
💭
Grug

Antonio Sánchez antonioJASR

💭
Grug
View GitHub Profile
@antonioJASR
antonioJASR / frame
Created January 20, 2024 19:09 — forked from chadwhitacre/frame
#!/usr/bin/env zsh
# frame foo.webp bar.png
rm -rf framed
mkdir framed
for img in ${@:1}; do
magick "$img" \
-fuzz 1% -trim -bordercolor white -border 100 \
-resize "1024x576" \
-background "#EEE" -compose Copy -gravity center -extent "1600x900" \
"framed/$img"
@antonioJASR
antonioJASR / #ChatGPT Streaming.md
Created June 26, 2023 02:21 — forked from alexrudall/#ChatGPT Streaming.md
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Alt Text

First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.

@antonioJASR
antonioJASR / #ChatGPT Streaming.md
Created June 26, 2023 02:21 — forked from alexrudall/#ChatGPT Streaming.md
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Alt Text

First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.

@antonioJASR
antonioJASR / turbo_transitions.js
Created January 19, 2023 04:14 — forked from jaredcwhite/turbo_transitions.js
Nice transitions using Turbo
document.addEventListener("turbo:visit", () => {
let main = document.querySelector("main");
if (main.dataset.turboTransition == "false") return;
let [movement, scale] = ["-12px", "0.99"];
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
[movement, scale] = ["-6px", "1"]
};
@antonioJASR
antonioJASR / install_docker.md
Created June 11, 2020 01:25
Install Docker in Elementary Hera

Install Docker HERA

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
@antonioJASR
antonioJASR / test.exs
Created June 9, 2020 00:36
Phoenix 1.5 running mix test too slow
# just add this line to the file: config/test.exs
config :pbkdf2_elixir, rounds: 1
@antonioJASR
antonioJASR / index.html
Created March 15, 2020 04:16
Apply Gradient to a Path
<svg width="660" height="220">
<defs>
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#05a"/>
<stop offset="100%" stop-color="#0a5"/>
</linearGradient>
</defs>
<path d="M150 0 L75 200 L225 200 Z" />
@antonioJASR
antonioJASR / 1.md
Created November 29, 2018 03:25 — forked from swyxio/1.md
Learn In Public - 7 opinions for your tech career

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos or Twitch streams. Start a newsletter. Draw cartoons (people loooove cartoons!). Whatever your thing is, make the thing you wish you had found when you were learning. Don't judge your results by "claps" or retweets or stars or upvotes - just talk to yourself from 3 months ago. I keep an almost-daily dev blog written for no one else but me.

Guess what? It

@antonioJASR
antonioJASR / yardoc_cheatsheet.md
Created November 15, 2018 18:54 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

javascript:(function(){
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "img[alt=\"\"],img:not([alt]){ filter:grayscale(100%) }";
document.body.appendChild(css);
})();