Skip to content

Instantly share code, notes, and snippets.

View michelson's full-sized avatar
🏠
Working from home

Miguel Michelson Martinez michelson

🏠
Working from home
View GitHub Profile
@ismasan
ismasan / concurrent_processing.rb
Last active March 24, 2024 22:11
Practical Railway-oriented Pipeline for Ruby
# A Pipeline extension to process steps concurrently
# Example
# class ConcurrentPipeline < Pipeline
# include ConcurrentProcessing
# end
#
# MyPipeline = ConcurrentPipeline.new do |pl|
# pl.step ValidateInput
#
# # These steps run concurrently
@yahonda
yahonda / ruby31onrails.md
Last active April 9, 2024 20:46
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@noteflakes
noteflakes / chat.rb
Last active November 18, 2021 22:15
Real-world Concurrency with Ruby and Polyphony: a Telnet-based Chat App
# See also: https://noteflakes.com/articles/2021-11-13-real-world-polyphony-chat
require 'polyphony'
server = spin do
server_socket = TCPServer.new('0.0.0.0', 1234)
server_socket.accept_loop do |s|
spin { handle_session(s) }
end
end
@palkan
palkan / frame_display.rb
Last active November 2, 2021 15:32
tcpdump -> pretty http2 packets
# frozen_string_literal: true
# Example usage:
#
# tcpdump -i lo0 'port 3010' -v -X -l | ruby frame_display.rb
#
require 'bundler/inline'
gemfile(true, quiet: true) do
source 'https://rubygems.org'
@nnirror
nnirror / gist:f804f8d2f61e4cb4d539c23c67e03472
Created May 5, 2021 03:43
facet: generative midi sketch w/ code
<pre><code>
----------begin_max5_patcher----------
1126.3ocyXssTiiCD84juBU9ojZEtjZce2Wl+iLolxjH.yfuT1NrL0Ty9sus
kcXICIXCwvxCfK0H6SeNcqtawOmOK5xhG70Qj+jrhLa1OmOaVvTqgY8qmEkk
7vl6RpCaKZSQVlOuIh182Z7OzDr6u2W8iEb8RRwUWU6aHIYMjULxE.9iAePD
Lhj.jK3qiuMIaAKFTThjs7u9Zd+qTW58aIqtPtFscmOYKIunwSVssZW92Wr4
lhhZ+hUbMEjTAPkVpVtdIkz9oVt9q4DR70Io4K3vx3tO4BMaYvdVR4hUZFUC
36P0Jp1P0NpgSMv5kwkUEWhdDu0YtDo54Crz9DfwWPwnJfpDTkhpLTkipYG.
7dE8tzb+lhc4AY00aLeWVJpHMgX.u2XYRylaRyu9aU9MMcwPPoiEJq1YrZtT
HXfiR.mJVq.tVB.yxbNgAMZkwFKnYRvX3BgSBTBGLwLx5+CzhcM6Qk0aMcaH
@tlemens
tlemens / README.md
Last active March 8, 2023 22:55
time_ago_in_words and distance_of_time_in_words for Phoenix/Elixir
@KonnorRogers
KonnorRogers / environment.js
Last active October 3, 2022 17:25
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@tomholford
tomholford / install_pg_gem.md
Last active May 18, 2024 07:30
Install postgresql gem `pg` on macOS

Installing pg gem on macOS

If you're trying to install the postgresql gem pg and it is failing with the following error message:

Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb
// DISCLAIMER : You can now probably use `data-turbo-action="advance"` on your frame to perform what this controller is aiming to do
// https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit
// Note that you probably want to disable turbo cache as well for those page to make popstate work properly
import { navigator } from '@hotwired/turbo'
import { Controller } from '@hotwired/stimulus'
import { useMutation } from 'stimulus-use'
export default class extends Controller {
connect (): void {
//! Barebones baseview imgui plugin
#[macro_use]
extern crate vst;
use imgui::*;
use baseview::AppRunner;
use raw_window_handle::RawWindowHandle;
use vst::buffer::AudioBuffer;