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
# frozen_string_literal: true | |
module PhlexUI | |
class Form::Builder < Base | |
# include Phlex::Rails::Helpers::FormAuthenticityToken | |
def initialize(model: nil, scope: nil, url: nil, format: nil, method: :post, **attrs) | |
@object = model | |
@scope = scope | |
@url = url |
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
You'll need to update the following variables: | |
- ENV['APP_NAME'] | |
- ENV['COMPANY_ADDRESS'] | |
- ENV['HOST'] | |
Make sure you have app/assets/images/logo.svg for this line: | |
helpers.image_url('logo.svg') | |
And also update the CSS variables to match your color scheme: | |
:root { |
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 AttributeMerger | |
attr_reader :default_attrs, :user_attrs | |
OVERRIDE_KEY = '!'.freeze | |
def initialize(default_attrs, user_attrs) | |
@default_attrs = flatten_hash(default_attrs) | |
@user_attrs = flatten_hash(user_attrs) | |
end | |
def call |
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
.animated { | |
animation-duration: 0.2s; | |
animation-fill-mode: forwards; | |
} | |
@keyframes fadeIn { | |
from { | |
// transform: scale(0.99); | |
opacity: 0; | |
} |
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 CreateTeams < ActiveRecord::Migration[6.0] | |
def change | |
create_table :teams do |t| | |
t.string :name | |
t.timestamps | |
end | |
end | |
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
# User stories: | |
# -list tasks | |
# -add a task | |
# -mark a task as done | |
# -remove a task | |
# MVC(R) | |
# model | |
# view | |
# controller |
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
name | bought | price | |
---|---|---|---|
macbook pro | false | 20 | |
handbag | false | 35 | |
Long Pendant Sterling Silver Necklace | false | 50 |
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
# TODO: you can build your calculator program here! | |
# create a calculator | |
require 'colorize' | |
def prompt(text) | |
puts text.yellow | |
end | |
def addition(first, last) | |
first + second |
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
def acronymize(text) | |
# 'text' is a string | |
# we need access to each word (so lets break it up) => array | |
words = text.split # we have an array now 👍 | |
# get the first letter of each --> join them --> capitalize the whole word | |
words.map{|word| word[0]}.join.upcase | |
end | |
# 'situation normal all fucked up' => snafu | |
p acronymize('situation normal all fucked up') |
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
require 'date' | |
# Livecode | |
def days_until_christmas | |
# return the number of days until net christmas | |
today = Date.today | |
current_year = Date.today.year | |
christmas = Date.new(current_year, 12, 25) | |
# subtract to get the amount of days b/w | |
christmas = christmas.next_year if today > christmas |
NewerOlder