This is a custom css stylesheet for Markdown gists using the jist.in service.
To use, simply add the custom.css
file to your gist.
Below is a demonstration of all markdown components and how they appear styled.
# config.rb | |
after_configuration do | |
if defined?(RailsAssets) | |
RailsAssets.load_paths.each do |path| | |
sprockets.append_path path unless sprockets.paths.include? path | |
Dir[File.join(path, '*')].select do |contents| | |
File.file? contents | |
end.map do |file| | |
Pathname.new File.basename file |
require 'active_record' | |
require 'postgres_ext' | |
require 'minitest/autorun' | |
require 'logger' | |
# DB created on localhost with `createdb first_or_initialize` | |
ActiveRecord::Base.establish_connection('postgres://localhost/first_or_initialize') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do |
require 'active_model/serializer/associations' | |
module ActiveModel | |
class Serializer | |
def initialize(object, options={}) | |
@object = object | |
@scope = options[:scope] | |
@root = options.fetch(:root, self.class._root) | |
@meta_key = options[:meta_key] || :meta | |
@meta = options[@meta_key] |
Gem::Specification.new do |s| | |
s.name = 'quack' | |
s.summary = '' | |
s.description = '' | |
s.version = '0.0.1' | |
s.platform = Gem::Platform::RUBY | |
s.files = ['quack.rb'] | |
s.require_path = '.' | |
// Colors selected to match the Twilight theme | |
@git-added-color: #8F9D6A; | |
@git-modified-color: #7587A6; | |
@git-removed-color: #CF6A4C; | |
// Blur inactive windows | |
body.is-blurred .workspace { | |
-webkit-filter: blur(0.13em) hue-rotate(19deg); | |
} |
namespace :secret do | |
desc "Replace application's secret_key_base in the secret_token initalizer with a new one" | |
task :reset do | |
# Rails default location | |
@secret_token_file ||= Rails.root.join('config', 'initializers', 'secret_token.rb') | |
# Find first string in file | |
@secret_token_finder ||= /(?<=config\.secret_key_base\s\=\s["'])(.*?)(?=["'])/ | |
File.open(@secret_token_file, 'r+') do |file| |
These are my personally cultivated styleguides for different types of text (normally code or markup).
They're less about common conventions (ie. put single spaces between sentences or new lines between different contexts) and more about what syntax features to prefer or avoid in which contexts. As such, they expect the reader to be familiar with the language or markup in question. They are not suitable introductory material to a syntax.
Comments and discussion are welcome, otherwise I'd just keep these in my head instead of on a publicly available forum. I especially invite you to try and change my mind: these, like all opinions and code, are works in progress; not absolutes.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in the OXFORD ENGLISH DICTIONARY.
# Put in your .iex, and `require Pattern` | |
defmodule Pattern do | |
defmacro match?(pattern, input, code_block // []) do | |
code = Dict.get(code_block, :do, nil) | |
quote do | |
case unquote(input) do | |
unquote(pattern) -> | |
unquote(code) | |
:ok | |
_ -> |
defmodule Guard.Helpers do | |
@moduledoc """ | |
Tools for creating custom guards. Deprecated in favor of `Kernel.defguard`. | |
""" | |
@doc """ | |
Creates a macro that's aware of its presence in a guard. | |
Taken from https://github.com/elixir-lang/elixir/blob/df8b216357e023e4ef078be396fed6b873d6a938/lib/elixir/lib/kernel.ex#L1601-L1615, |