Skip to content

Instantly share code, notes, and snippets.

View joeybeninghove's full-sized avatar

Joey Beninghove joeybeninghove

View GitHub Profile
namespace :code do
task precommit: %i[rubocop erblint csslint jslint jstest rspec]
task :rubocop do
system('rubocop', exception: true)
end
task :erblint do
system('bundle exec erblint --lint-all --enable-all-linters',
exception: true)
class Post
include ActiveModel::Model
YAML_FRONT_MATTER_REGEXP =
%r{\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)}m.freeze
attr_accessor :title, :date, :html, :filename
def slug
File.basename(filename, ".md").remove(filename[0, 11])
@joeybeninghove
joeybeninghove / Styles.js
Created July 24, 2019 18:59
React Native Tailwind-esque Styles
import React from "react";
import { StyleSheet } from "react-native";
import { colors } from "./Colors";
let stylesheet = StyleSheet.create({
"flex-1": { flex: 1 },
"flex-row": { flexDirection: "row" },
"justify-around": { justifyContent: "space-around" },
"justify-between": { justifyContent: "space-between" },
"items-center": { alignItems: "center" },
@joeybeninghove
joeybeninghove / _info_circle.html.erb
Created March 15, 2018 15:33
Tailwind + Inline SVG + View Partials
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="fill-current <%= css_classes %>"><path d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"/></svg>
cat <file_name> | gpg -ac -o- | curl -X PUT -T "-" https://transfer.sh/<file_name>.gpg
curl https://transfer.sh/<hash>/<file_name>.gpg | gpg -o- > <file_name>

Keybase proof

I hereby claim:

  • I am joeybeninghove on github.
  • I am joeybeninghove (https://keybase.io/joeybeninghove) on keybase.
  • I have a public key ASBdYH3-nFNSqHKVs7DrM5uCmMR7jaz4BcdPKrendX4Lcgo

To claim this, I am signing this object:

@joeybeninghove
joeybeninghove / .postcssrc.yml
Created February 15, 2018 02:21
Tailwind with Rails and Webpacker
plugins:
postcss-import: {}
postcss-cssnext: {}
tailwindcss: "./app/javascript/src/tailwind.js"
@joeybeninghove
joeybeninghove / outline.css
Created February 14, 2018 18:33
Little helper class to help with debugging CSS layout issues
body.debug * {
outline: 1px solid red !important;
}
@joeybeninghove
joeybeninghove / .irbrc
Created February 14, 2018 16:08
Retain history of commands for IRB and Rails console sessions
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
@joeybeninghove
joeybeninghove / .irbrc
Created February 14, 2018 02:06
Helper to show just the methods that matter for a Ruby object
class Object
def interesting_methods
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end