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 "tailwindcss/base"; | |
@import "tailwindcss/components"; | |
@import "./components/buttons.css"; | |
@import "tailwindcss/utilities"; |
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 "tailwindcss/base"; | |
@import "tailwindcss/components"; | |
@import "./components/buttons.css"; | |
@import "./components/forms.css"; | |
@import "tailwindcss/utilities"; |
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
<% flash.each do |type, message| %> | |
<% if type == "alert" %> | |
<div class="bg-red-500"> | |
<div class="container px-2 mx-auto py-4 text-white text-center font-medium font-sans"> | |
<%= message %> | |
</div> | |
</div> | |
<% end %> | |
<% if type == "notice" %> | |
<div class="bg-green-500"> |
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
# This is for reference via the blog post/view at https://web-crunch.com/posts/ruby-on-rails-routing | |
require 'sidekiq/web' | |
Rails.application.routes.draw do | |
authenticate :user, lambda { |u| u.admin? } do # ensures authenticated users who are admins can only access anything within this block | |
mount Sidekiq::Web => '/sidekiq' # built into the sidekiq gem | |
end | |
devise_for :users # built into the Devise gem |
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
# Define the validator | |
# app/validators/array_validator.rb | |
class ArrayValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, values) | |
Array(values).each do |value| | |
options.each do |key, args| | |
validator_options = { attributes: attribute } | |
validator_options.merge!(args) if args.is_a?(Hash) |
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
source 'https://rubygems.org' | |
git_source(:github) do |repo_name| | |
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") | |
"https://github.com/#{repo_name}.git" | |
end | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', "5.2.3" |
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
<%= simple_form_for @tweet do |f| %> | |
<%= f.error_notification %> | |
<div class="field"> | |
<div class="control"> | |
<%= f.input :tweets, label: "Tweeet about it", input_html: { class: "textarea"}, wrapper: false, label_html: {class: "label"}, placeholder: "Compose a new tweeet...", autofocus: true %> | |
</div> | |
</div> | |
<%= f.button :submit, class: "button is-info" %> | |
<% 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
class TweetsController < ApplicationController | |
before_action :set_tweet, only: [:show, :edit, :update, :destroy] | |
# GET /tweets | |
# GET /tweets.json | |
def index | |
@tweets = Tweet.all.order("created_at DESC") | |
@tweet = Tweet.new | |
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
'use strict'; | |
var gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
imagemin = require('gulp-imagemin'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'), | |
watch = require('gulp-watch'), | |
sourcemaps = require('gulp-sourcemaps'), |
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
// Base Gulp File | |
var gulp = require('gulp'), | |
watch = require('gulp-watch'), | |
sass = require('gulp-sass'), | |
sourcemaps = require('gulp-sourcemaps'), | |
cssBase64 = require('gulp-css-base64'), | |
path = require('path'), | |
notify = require('gulp-notify'), | |
inlinesource = require('gulp-inline-source'), | |
browserSync = require('browser-sync'), |
NewerOlder