This file contains hidden or 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 | |
class Thing < ApplicationRecord | |
validates :name, presence: true | |
# can use before_create, before_save, before_update, after_save, after_create, | |
# after_update, before_validation, after_validation | |
# also accepts if/unless | |
before_save :set_bool #, if: proc { |thing| thing.name == 'TEST' } | |
This file contains hidden or 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/views/layouts/application.html.erb %> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RyancondronPhotography</title> | |
<%= csrf_meta_tags %> | |
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | |
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> | |
</head> |
This file contains hidden or 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
stages: | |
- test | |
- build | |
variables: | |
DB_HOST: postgres | |
DB_PASS: postgres | |
DB_USER: postgres | |
brakeman: |
This file contains hidden or 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 NotificationType | |
attr_accessor :id, :load_id | |
def initialize(id, load_id) | |
self.id = id | |
self.load_id = load_id | |
check_valid_id | |
end | |
def description |
This file contains hidden or 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 'delegate' | |
class ApplicationDecorator < SimpleDelegator | |
def self.decorate(instance) | |
return nil if instance.blank? | |
new instance | |
end | |
def self.decorate_collection(collection) | |
return [] if collection.nil? || collection.length.zero? |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Copyright:: Copyright (c) 2015 Gitlab.com | |
# Copyright:: Copyright (c) 2016 Amusement SMART, LLC | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or 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
packages: | |
- advanced-open-file | |
- color-picker | |
- emmet | |
- erb-helper | |
- file-icons | |
- filesize | |
- git-plus | |
- markdown-preview-plus | |
- minimap |
This file contains hidden or 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
<%= form_for @playlist do |f| %> | |
<%= f.text_field :name, placeholder: 'Name' %> | |
<%= f.text_area :description %> | |
<%= f.date_field :date_in %> | |
<%= f.date_field :date_out %> | |
<%= f.fields_for :media_files do |ff| %> | |
<%= ff.collection_select :media_file_id, MediaFile.all, :id, :name, {}, {} %> | |
<%= ff.select :position, options_for_select((1..50).step(1) {} | |
<%= ff.link_to_remove 'Remove from Playlist' %> | |
<% end %> |
This file contains hidden or 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 Archive < ActiveRecord::Base | |
#model will be read only! | |
def self.posts | |
Post.where('published = ? and published_date >= ? and published_date <= ?', true, Date.civil(a.year, a.month, 1), Date.civil(a.year, a.month, -1)) | |
end | |
end |
This file contains hidden or 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
ENV["RAILS_ENV"] ||= 'test' | |
require 'spec_helper' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'brakeman' | |
ActiveRecord::Migration.maintain_test_schema! | |
RSpec.configure do |config| | |
config.use_transactional_fixtures = true |