Skip to content

Instantly share code, notes, and snippets.

🙃
¯\_(ツ)_/¯

Frank franks921

View GitHub Profile
@franks921
franks921 / index.html.slim
Last active Oct 18, 2018
Simple stimulus slim view helpers
View index.html.slim
.logo--floating.mb-g6x
= glyph('logo--icon')
.section.clear
= simple_form_for :search,
url: patients_search_path,
html: @stimulus.controller,
method: :get do |f|
= f.input :q,
@franks921
franks921 / .travis.yml
Created Aug 19, 2018
Postgres 10 on Travis
View .travis.yml
env:
global:
- PGPORT=5433
language: ruby
rvm:
- 2.5.1
cache:
@franks921
franks921 / USAGE.md
Created Jul 19, 2018
Basic Sidekiq config
View USAGE.md

Starting Sidekiq

bundle exec sidekiq -C config/sidekiq.yml

Perform Job Immediately

TestJob.perform_now(user_id: current_user.id)
@franks921
franks921 / control_indicator_helper.rb
Last active Jul 18, 2018
SimpleForm Initializer for Foundation 6 with additional markup to allow styling of checkboxes, radio buttons and file controls
View control_indicator_helper.rb
# lib/components/control_indicator_helper.rb
module ControlIndicatorComponent
def select_arrow(wrapper_options=nil)
@arrow_icon ||= begin
if options[:arrow_icon].nil? || options[:arrow_icon].to_s == 'default'
''
else
options[:arrow_icon].to_s.html_safe
end
@franks921
franks921 / gist:af1e3c3dba1627451abc8552a5e99baf
Last active Jun 25, 2018
Ruby random South African ID number generator
View gist:af1e3c3dba1627451abc8552a5e99baf
def id_number(birthday, gender)
gender = (0..4).to_a.sample if gender == 'female'
gender = (5..9).to_a.sample if gender == 'male'
random_sequence = rand.to_s[2..5]
citizenship = 0
race = 8
id_number = [
birthday.gsub('-', '')[2..-1],
gender,
@franks921
franks921 / 1-README.md
Last active Aug 1, 2017
Heroku Reporting Dynos
View 1-README.md

Setup

  • Add a new worker to your Procfile. In this gist I used reporter
  • Add the Heroku Platform gem to your Gemfile
  • Create the HerokuReporterDyno module in lib or any other auto-loadable path
  • Create two jobs. A caller (Reporting::GeneratorJob) and a runner (Reporting::RunnerJob)
  • Deploy
  • Once deployed, log into Heroku and change the newly added reporter dyno to a Performance M or Performance M dyno

How this all works

View hsb-hsl.scss
@function hsb($hue, $saturation, $brightness, $alpha: 1, $hsl-saturation: '') {
@if $brightness == 0 {
@return hsla(0, 0, 0, $alpha);
} @else {
$hsl-lightness: (2 - $saturation / 100) * ($brightness / 2);
$hsl-saturation: ($brightness * $saturation) / if($hsl-lightness < 50, $hsl-lightness * 2, 200 - $hsl-lightness * 2);
@return hsla($hue, $hsl-saturation, $hsl-lightness, $alpha);
}
}
@franks921
franks921 / _helpers.sass
Created Nov 20, 2016
Foundation Helpers
View _helpers.sass
// Create helper classes from $foundation-palette
@each $color, $hex-value in $foundation-palette
.color--#{$color}
color: $hex-value
.color--bg-#{$color}
background-color: $hex-value
// Create helper classes from $header-sizes
@each $size, $headers in $header-sizes
+breakpoint($size)
@franks921
franks921 / svg_glyph.rb
Created Nov 16, 2016
SVG Glyph Helpers
View svg_glyph.rb
# app/lib/svg_glyph.rb
class SvgGlyph
CURRENT_COLOR = '#383838'
GLYPH_NS = 'glyphs'
GLYPH_PATH = "app/assets/images/#{GLYPH_NS}"
def self.h
ActionController::Base.helpers
View _material-colors.scss
$material-colors-map: (
'red': (
'50': #ffebee,
'100': #ffcdd2,
'200': #ef9a9a,
'300': #e57373,
'400': #ef5350,
'500': #f44336,
'600': #e53935,
'700': #d32f2f,
You can’t perform that action at this time.