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
//<![CDATA[ | |
//-----Classes----- | |
function SermonProperty(data) | |
{ | |
this.data = data; | |
this.html = data; | |
this.compareTo = function(obj) | |
{ |
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 ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
rescue_from ActiveRecord::RecordNotFound, :with => :render_404 | |
def render_404 | |
raise "A Page was not found!" | |
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
Verifying that "crispinheneise.id" is my Blockstack ID. https://onename.com/crispinheneise |
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
# amount_cents :integer default("0") | |
def amount=(amount) | |
amount = amount.gsub(/[^\d\.]/, '').to_f if amount.is_a?(String) | |
self.amount_cents = amount * 100 | |
end | |
def amount | |
amount_cents / 100.0 | |
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 ActivityCreator | |
def initialize(action, trackable, contact, comment=nil) | |
@trackable = trackable # the affected object (could be the same as contact) | |
@action = action # what was done | |
@comment = comment | |
@changes = collect_changes | |
end | |
def call |
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
module Trackable | |
extend ActiveSupport::Concern | |
included do | |
has_many :activities, -> {order("created_at DESC")}, as: :trackable, dependent: :nullify | |
after_commit :track_activity | |
before_destroy :track_destroy | |
end | |
def track_destroy |
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
# == Schema Information | |
# | |
# Table name: activities | |
# | |
# id :uuid not null, primary key | |
# user_id :uuid | |
# tenant_id :uuid | |
# contact_id :uuid | |
# trackable_type :string | |
# trackable_id :uuid |
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 Message < ApplicationRecord | |
include Trackable | |
# ... | |
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
# numbers.rb | |
def numbers(*ary) | |
ary.all?{|a| a.is_a?(Numeric)} | |
end | |
numbers(1,2,3.0) | |
# => true | |
numbers(1,2,'foo') | |
# => false |
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 PronounceablePassword | |
WORDS = (IO.readlines(File.join File.dirname(__FILE__), 'words.txt')).each { |w| w.chop! } | |
class << self | |
def random_pronouncable_password(options={}) | |
options={ | |
:rand_seed => 999 | |
}.update(options) | |
words = WORDS.dup | |
[words.delete_at(rand(words.length)), rand(options[:rand_seed]), words[rand(words.length)]].join("-") |