Skip to content

Instantly share code, notes, and snippets.

View brandoncordell's full-sized avatar

Brandon Cordell brandoncordell

View GitHub Profile
#array to check for an actual item location
arr = ["a1","b1","c1","a2", "b2", "c2", "a3", "b3", "c3"]
var = ''
# blank has for locations
locations = {
a1: {},
a2: {},
a3: {},
b1: {},
b2: {},
@brandoncordell
brandoncordell / respond_to.rb
Created December 14, 2017 16:12
respond_to js and json
module Admin
class EcardProgramsController < BaseController
def index
@ecard_programs = EcardProgram.all
end
def create
@ecard_program = EcardProgram.new(ecard_program_params)
respond_to do |format|
// app/javascript/packs/application.js
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
// vendor
require('@rails/ujs').start();
require('turbolinks').start();
Process: Dungeondraft [6875]
Path: /Applications/Dungeondraft.app/Contents/MacOS/Dungeondraft
Identifier: com.dungeondraft.macos
Version: 1.0.1 (1.0.1.3)
Code Type: X86-64 (Translated)
Parent Process: ??? [1]
Responsible: Dungeondraft [6875]
User ID: 501
Date/Time: 2021-07-05 23:16:01.438 -0400
@brandoncordell
brandoncordell / icon_component.rb
Created August 21, 2021 17:05
view_component issue
# frozen_string_literal: true
# app/components/icon/component.rb (using sidecar assets via the view_component-contrib gem)
module Icon
class Component < ApplicationViewComponent
DEFAULT_SIZE = :base
SIZES = %i[xxs xs sm base lg xl xxl].freeze
SIZE_MAPPINGS = {
xxs: 'fa-2xs',
xs: 'fa-xs',