Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Holmberg mark-d-holmberg

View GitHub Profile
@mark-d-holmberg
mark-d-holmberg / srd_5e_monsters.json
Created Apr 4, 2020 — forked from tkfu/srd_5e_monsters.json
A JSON file with all the D&D 5e SRD monster data
View srd_5e_monsters.json
[
{
"name": "Aboleth",
"meta": "Large aberration, lawful evil",
"Armor Class": "17 (Natural Armor)",
"Hit Points": "135 (18d10 + 36)",
"Speed": "10 ft., swim 40 ft. ",
"STR": "21",
"STR_mod": "(+5)",
"DEX": "9",
View gist:b3f3f57ae845b9890a0f441c3d8937e0
bash_prompt_command() {
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
local NONE="\[\033[0m\]"
@mark-d-holmberg
mark-d-holmberg / spec_helper.rb
Last active Dec 25, 2015 — forked from pauljamesrussell/spec_helper.rb
Allows it to test accepts_nested_attributes_for with associations that are a `has_one`
View spec_helper.rb
# See: https://gist.github.com/1353500
# Use: it { should accept_nested_attributes_for(:association_name).using_has_one(true).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })}
RSpec::Matchers.define :accept_nested_attributes_for do |association|
match do |model|
@model = model
@nested_att_present = model.respond_to?("#{association}_attributes=".to_sym)
if @nested_att_present && @reject
model.send("#{association}_attributes=".to_sym,[@reject])
@reject_success = model.send("#{association}").empty?
end
@mark-d-holmberg
mark-d-holmberg / redcarpet.rb
Created Feb 15, 2012 — forked from stephencelis/redcarpet.rb
Redcarpet (Markdown) template handler for Rails 3.1.
View redcarpet.rb
class ActionView::Template
class Markdown
def call(template)
Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(template.source).inspect
end
end
ActionView::Template.register_template_handler :md, Markdown.new
end
You can’t perform that action at this time.