Skip to content

Instantly share code, notes, and snippets.

Greg Blass gregblass

Block or report user

Report or block gregblass

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View capybara_webkit.rb
Capybara.javascript_driver = :webkit
Capybara::Webkit.configure do |config|
gregblass / lookup_spec.rb
Created Mar 18, 2016
Failing test examples
View lookup_spec.rb
require "rails_helper"
feature "account lookups" do
let(:account) { create(:account) }
scenario "attempts to lookup an account without entering anything into the input" do
visit login_path
click_button "Continue"
expect(page).not_to have_css('.alert')
expect(page.current_url).to eq("")
gregblass / better_time_ago_in_words.rb
Last active Oct 4, 2017
A better, Facebook-style activity time_ago_in_words
View better_time_ago_in_words.rb
def better_time_ago_in_words(date_time)
if date_time < 2.days.ago
"#{date_time.strftime('%B %e')} at #{date_time.strftime('%l:%M%P')}"
elsif date_time <
"Yesterday at #{date_time.strftime('%l:%M%P')}"
View monit.service
# Automatically start Monit when system boots
# File goes in: /lib/systemd/system/
Description=Pro-active monitoring utility for unix systems
gregblass / braintree_helper.rb
Created Dec 21, 2017
Better Braintree errors for Rails
View braintree_helper.rb
module BraintreeHelper
gregblass / checkboxes.scss
Last active Jun 2, 2018
Fancy CSS styling for Radio Buttons and Checkboxes
View checkboxes.scss
Fancy CSS Textboxes
$light-blue: #609FD5;
input[type="checkbox"] {
position: absolute;
left: -9999px;
visibility: hidden;
gregblass / trix_editor_input.rb
Last active Oct 23, 2018
Trix Editor custom form input component for SimpleForm
View trix_editor_input.rb
# I was using to do:
# f.input :my_input, as: :trix_editor
# Its currently been over two weeks since Rails 5.2 was released, and the
# gem was the only thing preventing me from using it in multiple projects:
# So I made this custom simpleform input for my apps to prevent this from happening again in the future.
gregblass / DropdownSearch.jsx
Last active Jun 20, 2019
React Dropdown XHR/AJAX-based search component
View DropdownSearch.jsx
import React, { Component } from 'react'
class DropdownSearch extends Component {
state = {
cursor: null,
data: [],
isLoading: false,
mouseEnabled: true,
query: this.props.query,
View prevent-form-resubmission.js
// Prevent submitting the form more than once at a time
$(document).on('submit', '#your-form-id', function() {
// Prevent the form from submitting subsequent times
$(this).submit(function() {
return false;
// Allow the form to be submitted the first time
return true;
View service_hits_frequency_guideline_limit.rb
# Flag the task if its service hits a service frequency guideline limit
def self.service_hits_frequency_guideline_limit(task)
service = task.service
if service.has_frequency_guidelines?
frequency = service.frequency
customer_jobs =
year = @old_job.year
count = 1
You can’t perform that action at this time.