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
/* | |
Copyright (c) 2018 Pete Michaud, github.com/PeteMichaud | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
module Gollum | |
# monkey patching Gollum::Page is a questionable decision. Could be refactored as a container or super class | |
class Page | |
attr_accessor :children | |
def pretty_title | |
# is this the right way to get th wiki_options from here? | |
@pt ||= if Precious::App.settings.wiki_options[:h1_title] | |
find_header_node(text_data) |
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
# fetchs SIB Campaigns | |
def fetch | |
# update/create | |
campaign_records.each do |record| | |
shoot = Shoot.find_or_initialize_by(campaign_id: record[:id]) | |
unless shoot.update(record) | |
# the data was invalid, so the shoot wasn't saved, do something about that here | |
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
class Widget < ActiveRecord::Base | |
include Thingable | |
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
require 'html2markdown' #gem install html2markdown | |
dirs = %w(_pages _posts) | |
class String | |
def word_wrap(line_width = 120) | |
self.split("\n").collect do |line| | |
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line | |
end * "\n" | |
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
module Draper | |
class CollectionDecorator | |
delegate :current_page, :total_pages, :limit_value, :model_name, :total_count, :offset_value, :last_page? | |
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
ActiveRecord::RecordNotSaved in Admin::UsersController#update | |
Failed to remove the existing associated subscription. The record failed to save when after its foreign key was set to nil. |
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
{"utf8"=>"✓", | |
"_method"=>"put", | |
"authenticity_token"=>"...", | |
"user"=>{"email"=>"[email protected]", | |
"password"=>"[FILTERED]", | |
"first_name"=>"Bob", | |
"last_name"=>"Jones", | |
"subscription"=>{"plan_id"=>"5"}}, | |
"password_confirmation"=>"[FILTERED]", | |
"commit"=>"Update User", |
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 User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :first_name, :last_name, :organization, :email, :password, :password_confirmation, :remember_me, :is_admin, :plan |
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
<fieldset> | |
<legend><%= form_legend %></legend> | |
<div class='control-group<%= " error" if @user.errors.has_key?(:email) %>'> | |
<label class='control-label'>Email</label> | |
<div class='controls'> | |
<%= f.text_field :email, :class => 'input-xlarge' %> | |
<% if @user.errors.has_key?(:email) %> | |
<span class='help-inline'>Email <%= @user.errors.get(:email).first %></span> |
NewerOlder