Skip to content

Instantly share code, notes, and snippets.

@TheRealNeil
TheRealNeil / excel_integration.rb
Created January 7, 2022 15:12
Module providing generic xlsx (Excel/OpenOffice) import/export functionality
# This module provides generic XLSX import/export capabilities.
# For more details check the gems;
# Exporting: 'caxlsx', https://github.com/caxlsx/caxlsx.git
# Importing: 'xsv', https://github.com/martijn/xsv
#
module ExcelIntegration
def self.included(base)
base.send :include, InstanceMethods
base.extend ClassMethods
end
@TheRealNeil
TheRealNeil / trix-bootstrap4.scss
Last active April 25, 2018 19:37
Bootstap 4 css for Trix
trix-toolbar {
margin-bottom: 1em;
.trix-button-row {
@extend .btn-toolbar;
justify-content: space-between;
.trix-button-group {
@extend .btn-group;
.trix-button {
@extend .btn;
@extend .btn-outline-secondary;
@TheRealNeil
TheRealNeil / test_helper.rb
Created March 13, 2018 11:57
Template Test Helper
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/reporters"
require 'capybara/rails'
require 'capybara/minitest'
require 'selenium-webdriver'
require 'capybara-screenshot/minitest'
require "database_cleaner"
@TheRealNeil
TheRealNeil / _photo.json.jbuilder
Created February 6, 2018 17:46
Using the Trix Editor plus Private File Upload Attachments to S3
json.extract! photo, :id, :image_data, :created_at, :updated_at
json.url photo_url(photo, format: :html)
json.image_url image_url_photo_url(photo)
@TheRealNeil
TheRealNeil / _application_bar.html.haml
Created January 16, 2018 13:51
DNA - Navigation Bar
%nav.navbar.sticky-top.navbar-expand.navbar-light.bg-light.border-bottom-1
.navbar-brand
= link_to root_path do
= image_tag 'dna-logo-col.svg', alt:"dna"
- if user_signed_in?
%span.navbar-text.py-0
= yield :page_heading
%button.navbar-toggler{type:"button", data:{toggle:"collapse", target:"#navbarTogglerDemo01"}, aria:{controls:"navbarTogglerDemo01", expanded:"false", label:"Toggle navigation"}}
%span.navbar-toggler-icon
.collapse.navbar-collapse#navbarTogglerDemo01
@TheRealNeil
TheRealNeil / application.html.haml
Created January 16, 2018 13:47
DNA - New Application Layout
!!!
%html{:lang => "en"}
%head
%meta{charset: "utf-8"}
%meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}
%meta{content: "", name: "description"}
%meta{content: "", name: "author"}
%meta{content: "none", name: "msapplication-config"}
%title DNA
@TheRealNeil
TheRealNeil / _side_navigation.html.haml
Created January 16, 2018 13:23
DNA Side Navigation
nav#sidebar.navbar.bg-light.navbar-light.border-right-1.full-height
%ul.navbar-nav.mb-auto
-# Repository
%li.nav-item
= link_to("#repositorySubmenu", class: "nav-link", data:{toggle:"collapse"}, aria:{expanded:"#{params[:controller].split('/')[0] == 'repository'}"}) do
%i.fa.fa-database{ aria: { hidden: "true" } }
%span.sidebar-text.hidden-sm-down= t('repository')
%ul#repositorySubmenu{class: "collapse list-unstyled #{'show' if params[:controller].split('/')[0] == 'repository'}"}
%li.nav-item= link_to t('processes'), repository_process_areas_path, class: "nav-link #{active?(params[:controller].split('/')[1], 'process_areas')}"
%li.nav-item= link_to t('scenarios'), repository_scenario_types_path, class: "nav-link #{active?(params[:controller].split('/')[1], 'scenario_types')}"