Skip to content

Instantly share code, notes, and snippets.

scottserok / Procfile
Created Apr 20, 2020
Webpack for Jekyll
View Procfile
jekyll: bundle exec jekyll s
webpack: webpack -w
scottserok / head.html
Created Apr 20, 2020
Webpack for Jekyll
View head.html
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ "/assets/styles.css" | relative_url }}">
{% asset bundle %}
scottserok / package.json
Created Apr 20, 2020
Webpack for Jekyll
View package.json
"name": "name",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"babel-core": "^6.26.3",
"babel-loader": "^8.1.0",
View webpack.config.js
var path = require("path");
module.exports = {
entry: "./src/index.js",
output: {
path: path.join(__dirname,"./assets/js/"),
filename: "bundle.js"
module: {
rules: [
scottserok / cookie_validation.rb
Created Jul 9, 2019
Extend CookieJar::CookieValidation with monkey-patched .domains_match method for Restforce workaround.
View cookie_validation.rb
scottserok / tiny_graphql_server.rb
Last active May 8, 2019
Tiny GraphQL server to share authentication and authorization pattern for mutations
View tiny_graphql_server.rb
require 'bundler/inline'
gemfile do
source ''
gem 'graphql'
gem 'rack'
gem 'webrick'
gem 'mail'
require 'json'
scottserok / ruby-pre-commit
Last active Mar 20, 2020
A Git pre-commit hook for Ruby projects that validates syntax, looks for any lingering puts or byebug statements.
View ruby-pre-commit
# A pre-commit hook for Ruby projects.
# == Installation
# From within a Ruby project directory in your terminal:
# curl >> .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
scottserok / csv_builder.rb
Created Jan 31, 2019
Simple class to easily build CSV outputs for your POROs or ActiveRecord models.
View csv_builder.rb
# CsvBuilder configures a model to generate a resource. Inspired by ActiveAdmin.
# Usage example:
# csv_builder = User, col_sep: ';'
# csv_builder.column :id
# csv_builder.column :email
# csv_builder.column("Name") { |resource| resource.display_name }
# csv_builder.headers %w[ID Email Name]
# csv_builder.scope { |scope| scope.where('created_at > ?', 7.days.ago) } # unavailable for POROs
scottserok / email_mx_validator.rb
Last active Jan 23, 2019
Add a custom MX validator to your rails app in app/validators/email_mx_validator.rb
View email_mx_validator.rb
# frozen_string_literal: true
require 'mail' unless defined? Mail
require 'resolv' unless defined? Resolv
# == Summary
# This validator checks for a valid DNS MX resource
# for the given email address. The domain of the email
# address is extracted and used to perform a DNS lookup
# for an MX resource. A valid DNS MX resource does not
scottserok / Dockerfile.aws_ruby_pg
Last active Dec 4, 2018
Dockerfile for AWS Serverless Ruby 2.5.3 with PG driver
View Dockerfile.aws_ruby_pg
FROM amazonlinux
LABEL maintainer=""
RUN yum install -y
RUN sed -i "s/rhel-\$releasever-\$basearch/rhel-latest-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"
RUN yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel ruby-devel gcc-c++ jq git patch which tar procps make glibc-devel postgresql10 postgresql-devel
RUN curl > ruby-2.5.3.tar.gz
RUN tar -xvzf ruby-2.5.3.tar.gz
RUN cd ruby-2.5.3 && ./configure && make && make install
You can’t perform that action at this time.