Skip to content

Instantly share code, notes, and snippets.

View Zooip's full-sized avatar

Alexandre Narbonne Zooip

View GitHub Profile
@Zooip
Zooip / refresh_schema.sh
Last active February 15, 2024 15:30
Reset schema.rb from main
#!/bin/bash
# Fetch last changes from origin
git fetch
# Copy schema.rb from main
git checkout origin/main -- db/schema.rb
# Restore database with main state (erase all local data)
bundle exec rake db:schema:load
@Zooip
Zooip / Example - GET response.json
Last active June 11, 2021 19:04
Graphiti ActiveStorage attachment
{
"data": {
"id": "2235",
"type": "places",
"attributes": {
"name": "Test name",
"coordinates": {
"lon": 5.11135,
"lat": 45.41
},
@Zooip
Zooip / models.js.erb
Created December 18, 2017 07:44
JsonAPI-rb Devourable Serializable
export const song_attributes = <%= SerializableSong.devour_attributes.to_json %>
export const song_document_attributes = <%= SerializableSongDocument.devour_attributes.to_json %>
@Zooip
Zooip / Lock.rb
Created November 13, 2017 15:47
Mongoid lock system
class Lock
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::EmbeddedFindable
include GlobalID::Identification
DEFAULT_INTERFACE = :default
embedded_in :lockable, polymorphic: true