Skip to content

Instantly share code, notes, and snippets.

View dsandstrom's full-sized avatar

Darrell Sandstrom dsandstrom

View GitHub Profile
@dsandstrom
dsandstrom / Dockerfile
Last active December 8, 2022 22:13
Dockerfile for Rails app
# Use the barebones version of Ruby 2.2.3.
FROM ruby:2.7.6
# Optionally set a maintainer name to let people know who made this image.
# MAINTAINER
# Install dependencies:
# - build-essential: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - libpq-dev: Communicate with postgres through the postgres gem
@dsandstrom
dsandstrom / init.coffee
Last active May 10, 2022 17:46
atom configs
# surround for ruby string interpolation
atom.commands.add 'atom-text-editor', 'custom:surround-interpolation', ->
return unless editor = atom.workspace.getActiveTextEditor()
editor.transact ->
# TODO: get cursor scope, add quotes if not a string
for selection in editor.getSelections()
text = selection.getText()
return unless text.length
@dsandstrom
dsandstrom / stylelint.config.js
Created July 4, 2021 23:28
Stylelint Config - scss-lint rules, smacss order
// stylelint.config.js
// SMACSS Ordering
// https://github.com/cahamilton/stylelint-config-property-sort-order-smacss
const sortOrderSmacss = require('stylelint-config-property-sort-order-smacss/generate');
module.exports = {
extends: 'stylelint-config-sass-guidelines',
plugins: ['stylelint-order', 'stylelint-scss'],
@dsandstrom
dsandstrom / stylelint.yml
Created July 4, 2021 23:24
Stylelint Github Workflow Action
# .github/workflows/stylelint.yml
# Checkout code, install npm/yarn, install js packages, run stylelint
# Set up for rails and stylelint config: stylelint.config.js
name: "Stylelint"
on: [push, pull_request]
jobs:
stylelint:
@dsandstrom
dsandstrom / preview_devise_mail.rb
Last active December 11, 2020 02:33 — forked from ThawanFidelis/preview_devise_mail.rb
Preview Devise Mails
# spec/mailers/previews/devise_mailer_preview.rb
class Devise::MailerPreview < ActionMailer::Preview
def confirmation_instructions
Devise::Mailer.confirmation_instructions(User.first, {})
end
def unlock_instructions
Devise::Mailer.unlock_instructions(User.first, "faketoken")
end
@dsandstrom
dsandstrom / authentication.rb
Last active December 12, 2020 06:07
View spec helper for CanCanCommunity/cancancan
# spec/support/authentication.rb
# Enable can? method in view specs for cancancan gem
#
# Example:
#
# ```
# let(:admin) { Fabricate(:user_admin) }
# before { enable_can(view, admin) }
# ```
@dsandstrom
dsandstrom / starbucks_us_locations.json
Created November 13, 2018 17:42 — forked from wf9a5m75/starbucks_us_locations.json
8902 locations of US Starbucks with addresses, latitude, and longitude
This file has been truncated, but you can view the full file.
[
{
"position": {
"lat": 61.21759217,
"lng": -149.8935557
},
"name": "Starbucks - AK - Anchorage 00001",
"address": "601 West Street_601 West 5th Avenue_Anchorage, Alaska 99501",
"phone": "907-277-2477"
},
@dsandstrom
dsandstrom / Dockerfile
Created August 16, 2017 22:56
Phoenix deployer using a Docker container to compile
FROM staticfloat/centos-i386:centos6
MAINTAINER Darrell Sandstrom
RUN yum update -y && yum clean all
RUN yum install -y wget && yum clean all
# Install dependencies
RUN yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git tar && yum clean all
# Install Erlang
@dsandstrom
dsandstrom / deploy.rb
Last active December 26, 2019 22:17 — forked from twetzel/deploy.rb
Compile assets locally with capistrano 3.5.0 and rails 4.2.x (Nginx-Unicorn zero downtime)
# Runs rake assets:clean
# Defaults to nil (no asset cleanup is performed)
# If you use Rails 4+ and you'd like to clean up old assets after each deploy,
# set this to the number of versions to keep
set :keep_assets, 2
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
namespace :deploy do
@dsandstrom
dsandstrom / .rubocop.yml
Last active August 27, 2022 22:30
Rubocop config files for Ruby 3.0 / Rails 6+
# .rubocop.yml
# rubocop config files for Ruby 3.0 / Rails 6+ project
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: false
Include: