Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben W Merovex

View GitHub Profile
@Merovex
Merovex / Gemfile
Created Jan 24, 2021 — forked from dhh/Gemfile
HEY's Gemfile
View Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@Merovex
Merovex / Gemfile
Created Jan 24, 2021 — forked from dhh/Gemfile
HEY's Gemfile
View Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
View JSON United States Cities and States SQL
CREATE TABLE `states` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@Merovex
Merovex / font-family-serif.scss
Last active Sep 30, 2020
Baseline the Serif font to the OS defaults, similar to what is used in Bootstrap's Reboot (same mix seen in dozens of websites using serif in body.
View font-family-serif.scss
// font-family: Cambria, Georgia, "Times New Roman", Times, serif;
// Noto Serif found on modern Android and many Linux distros.
// Times is Mac OS
// Georgia is a classic serif font that I have seen leading this everywhere.
$font-family-sans-serif: Cambria, Georgia, "Noto Serif", "Times New Roman", Times, serif;
View improved-a11y-contrast.scss
@function pow($base, $exponents) {
$raised: 1;
@for $i from 1 through $exponents {
$raised: $raised * $base;
}
@return $raised;
}
@function luma($color){
// Thanks voxpelli for a very concise implementation of luminance measure in sass
// Adapted from: https://gist.github.com/voxpelli/6304812
@Merovex
Merovex / create_toc.rb
Created Aug 2, 2020
Ruby Table of Contents generator for Markdown file in 6 lines
View create_toc.rb
puts "\nCreating Table of Contents"
# This TOC generator assumes you don't care to include the page header
toc = "## Contents\n\n" + content.scan(/^##\s?(.*)\n/iu).flatten.map do |header|
next if header == 'Contents'
indent = " " * header.count("#")
anchor = header.downcase.gsub(/\W+/,'-').chomp('-')
"%s* [%s](#%s)\n" % [indent,header,anchor]
end.join
View vcode-fiction-settings.json
{
"extensions.showRecommendationsOnlyOnDemand": true,
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"editor.wordWrap": "wordWrapColumn",
"editor.mouseWheelZoom": true,
"editor.tabCompletion": "on",
"editor.fontFamily": "'Fira Code', Consolas, 'Courier New', monospace",
"editor.fontSize": 16,
"editor.fontWeight": "400",
View slate-to-markdown.js
export default function parseToMarkdown(chunk) {
let children = !chunk.type
? chunk.text
: chunk.children.map(c => parseToMarkdown({ ...c, parentType: chunk.type })).join('');
if (children === '') return;
// formatting
if (chunk.bold) {
children = `**${children.trim()}** `;
View Pandoc-HR-DOCX.lua
-- Converts "* * *" Horizontal Rule to a "#" separator in Word DOCX
local hashrule = [[<w:p>
<w:pPr>
<w:pStyle w:val="HorizontalRule"/>
<w:ind w:firstLine="0"/>
<w:jc w:val="center"/>
</w:pPr>
<w:r>
<w:t>#</w:t>
</w:r>
@Merovex
Merovex / _contrast.scss
Last active Dec 22, 2019
Ensures color contrast for Accessibility, with decent granularity.
View _contrast.scss
@function pow($base, $exponents) {
$raised: 1;
@for $i from 1 through $exponents {
$raised: $raised * $base;
}
@return $raised;
}
@function luma($color){
// Thanks voxpelli for a very concise implementation of luminance measure in sass
// Adapted from: https://gist.github.com/voxpelli/6304812