Skip to content

Instantly share code, notes, and snippets.


Greg Blass gregblass

View GitHub Profile
gregblass / livechat.js
Created Oct 14, 2020
LiveChat 2.0 + Turbolinks 5
View livechat.js
function loadChat(group = 0) {
window.__lc = window.__lc || {};
window.__lc.license = ########;
;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",])},once:function(){i(["once",])},off:function(){i(["off",])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",])},call:function(){i(["call",])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="",t.head.appendChild(n)}};!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))
function initChat() {
if (typeof LC_API !== 'undefined' && !LC_API.chat_running()) {'destroy');

Keybase proof

I hereby claim:

  • I am gregblass on github.
  • I am gregblass ( on keybase.
  • I have a public key ASAjR4KpGMlUWlNErjjcwWy48KC9tqxhz63qy9pJWVQmvAo

To claim this, I am signing this object:

View example.html
<div class='styled-select'>
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
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;
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,
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 Jan 24, 2021
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 / braintree_helper.rb
Created Dec 21, 2017
Better Braintree errors for Rails
View braintree_helper.rb
module BraintreeHelper
View monit.service
# Automatically start Monit when system boots
# File goes in: /lib/systemd/system/
Description=Pro-active monitoring utility for unix systems