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
@michelson
michelson / async_method_job.rb
Created April 23, 2024 01:50
Asynchronously Concern
class AsyncMethodJob < ApplicationJob
queue_as :default
def perform(target:, method_name:, args:, queue_name: :default)
self.class.queue_as(queue_name)
# `target` could be either an instance or a class
target = target.constantize if target.is_a?(String) # Convert class name to class object if needed
target.send(method_name, *args)
end
end
defmodule Rauversion.AutoContext do
defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
import Ecto.Query, warn: false
alias Rauversion.Repo
def list do
Repo.all(unquote(opts))
end
<%= turbo_frame_tag "conversation-list-#{@app.key}" do %>
<%= render partial: 'conversation', collection: @conversations, locals: {app: @app} %>
<% end %>
@michelson
michelson / danteRenderer
Created December 2, 2019 05:12
dante renderer example from redraft
/**
* You can use inline styles or classNames inside your callbacks
*/
import React, {Component} from 'react'
import redraft from 'redraft'
var Prism = require('prismjs');
//Prism.highlightAll();
@michelson
michelson / file1.txt
Created December 31, 2018 02:49
My first gist
Aren't gists great!
require 'rubygems'
require 'json'
require 'em-hiredis'
require 'faye/websocket'
require 'rack'
Faye::EventSource.class_eval do
attr_accessor :connected_at
end
defmodule UploaderHandler do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
# import Supervisor.Spec
IO.puts "iniciando"
children = [
@michelson
michelson / kind_behavior.rb
Created July 15, 2016 04:58
kind behavior
module Concerns
module KindBehavior
extend ActiveSupport::Concern
included do |base|
#base.extend( Concerns::KindBehavior::ModelClassMethods )
# usage
@michelson
michelson / cimgui-compile-result
Created April 24, 2016 05:07
cimgui test.c compile
In file included from test.c:2:
./cimgui.h:26:12: error: unknown type name 'ImGuiIO'
CIMGUI_API ImGuiIO* igGetIO();
^
./cimgui.h:27:12: error: unknown type name 'ImGuiStyle'
CIMGUI_API ImGuiStyle* igGetStyle();
^
./cimgui.h:28:12: error: unknown type name 'ImDrawData'
CIMGUI_API ImDrawData* igGetDrawData();
^
## start here:
- https://github.com/notro/rpi-source/wiki
## then here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=99688
and