Skip to content

Instantly share code, notes, and snippets.

View niquepa's full-sized avatar

Carlos Castillo niquepa

  • New York
View GitHub Profile
@niquepa
niquepa / friendship.rb
Created March 9, 2021 14:56 — forked from jibiel/friendship.rb
DRY Mutual Friendships / Friends in Ruby on Rails
# app/models/friendship.rb
class Friendship < ApplicationRecord
belongs_to :user
belongs_to :friend, class_name: 'User'
end
@niquepa
niquepa / machine.js
Last active August 30, 2021 16:38
Generated by XState Viz: https://xstate.js.org/viz
const contractMachine = Machine({
id: 'contracts',
initial: 'created',
context: {},
states: {
created: {
on: {
SAVE: 'created',
SUBMIT: 'estimated',