This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LoadResources | |
module ClassMethods | |
def load_resource(resource_class, options = {}) | |
filter_options = options.slice :only, :except, :if, :unless | |
resource_options = options.except :only, :except, :if, :unless | |
send(:before_filter, filter_options) do |controller| | |
ResourceBuilder.new(controller, resource_class, resource_options) | |
.send(:load_resource) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('child', { | |
ready(){ | |
// send flash message | |
this.$root.$broadcast('flashMessage',{ | |
text: 'Better check yourself, you\'re not looking too good.', | |
type: 'warning',//optional | |
important: false,//optional | |
timeout: 5000//optional | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateInvoiceNumbers < ActiveRecord::Migration | |
def up | |
create_table :invoice_numbers do |t| | |
t.integer :year, null: false, unique: true | |
t.integer :next_number_within_year, null: false, default: 1 | |
end | |
add_index :invoice_numbers, :year, unique: true | |
(2016..2045).each do |year| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .railsrc | |
-B #Skip Bundle | |
-T #Skip Test-Unit | |
-d postgresql #Use postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div :id="uppyId"> | |
<div class="ThumbnailContainer" v-if="collection === 'thumbnail'"> | |
<button id="open-thumbnail-modal" class="button">Select file</button> | |
</div> | |
<div class="DashboardContainer" v-else></div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="mt-6"> | |
<%= f.label :tags, class: 'form-label' %> | |
<div class="border border-gray-300 rounded-md flex-1 block w-full transition duration-150 ease-in-out pt-1.5 px-2 mt-1" data-controller="tags" data-tags-tag-collection data-tags-autocomplete="true" data-tags-show-dropdown="" data-target="tags.container"> | |
<div class="flex flex-wrap cursor-text" data-action="click->tags#active"> | |
<div class="flex flex-wrap" data-target="tags.tags"> | |
<div class="text-sm p-2 bg-gray-100 rounded-md flex items-center space-x-1.5 mb-1.5 mr-2"> | |
<p>tag</p> | |
<div class="inline-flex bg-gray-500 text-gray-100 rounded-full p-1 hover:bg-gray-700 cursor-pointer"> | |
<svg class="h-3 w-3" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M6 18L18 6M6 6l12 12"></path></ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/organisation.rb | |
# schema like: | |
# | |
# create_table "organisations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| | |
# t.string "transponder", default: "my_laps", null: false | |
# | |
class Organisation < ApplicationRecord | |
attribute :transponder, TransponderType.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { navigator } from "@hotwired/turbo"; | |
import { Controller } from "stimulus"; | |
import { useMutation } from "stimulus-use"; | |
export default class extends Controller { | |
connect() { | |
useMutation(this, { attributes: true, childList: true, subtree: true }); | |
} | |
mutate(entries) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cable-car href="/cc/cable_car" csrf-token="94IkWdvagUHWPGVkD+VeBFVjGoM0zXAf6tgm6BPU+kEpOj2BTtI6bXJQzEDXGAF+R6Dc1ek7oNouatTMrbUy"> | |
<button | |
onclick="this.closest('cable-car').post(this, {extra: 123})" | |
data-x="1" | |
output="#show-the-things" | |
> | |
Do a thing! | |
</button> | |
<section id="show-the-things"></section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RefresherDemo</title> | |
<%= csrf_meta_tags %> | |
<%= csp_meta_tag %> | |
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> | |
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> | |
</head> |
OlderNewer