Skip to content

Instantly share code, notes, and snippets.

View gregblass's full-sized avatar

Greg Blass gregblass

View GitHub Profile
@gregblass
gregblass / trix_editor_input.rb
Last active July 14, 2023 10:00
Trix Editor custom form input component for SimpleForm
# I was using https://github.com/maclover7/trix 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:
# https://github.com/maclover7/trix/pull/61#issuecomment-384312659
#
# So I made this custom simpleform input for my apps to prevent this from happening again in the future.
#
@gregblass
gregblass / colors.rb
Last active August 12, 2021 11:07
Tailwind CSS Colors for Ruby
# ==============================
# Tailwind CSS Colors
#
# config/initializers/colors.rb
# ==============================
COLORS = {
# Blue Gray
blue_gray_50: '#F8FAFC',
@gregblass
gregblass / livechat.js
Created October 14, 2020 01:41
LiveChat 2.0 + Turbolinks 5
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",c.call(arguments)])},once:function(){i(["once",c.call(arguments)])},off:function(){i(["off",c.call(arguments)])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="https://cdn.livechatinc.com/tracking.js",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()) {
LiveChatWidget.call('destroy');
}

Keybase proof

I hereby claim:

  • I am gregblass on github.
  • I am gregblass (https://keybase.io/gregblass) on keybase.
  • I have a public key ASAjR4KpGMlUWlNErjjcwWy48KC9tqxhz63qy9pJWVQmvAo

To claim this, I am signing this object:

<div class='styled-select'>
<select>
<option></option>
<option></option>
...
</select>
</div>
@gregblass
gregblass / App.js
Last active September 21, 2019 17:30
Expo/React Navigation - Google Analytics Integration
import React, { Component } from 'react'
import { RootNavigator } from './navigators'
import { GoogleAnalyticsTracker } from './utils/analytics'
import { GA_TRACKING_ID } from './constants'
class App extends Component {
// gets the current screen from navigation state
getCurrentRouteName = (navigationState) => {
if (!navigationState) {
return null
# 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 = @old_job.customer.jobs.completed
year = @old_job.year
count = 1
// 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
gregblass / DropdownSearch.jsx
Last active June 20, 2019 23:26
React Dropdown XHR/AJAX-based search component
import React, { Component } from 'react'
class DropdownSearch extends Component {
state = {
cursor: null,
data: [],
isLoading: false,
mouseEnabled: true,
query: this.props.query,
}
@gregblass
gregblass / checkboxes.scss
Last active June 2, 2018 10:46
Fancy CSS styling for Radio Buttons and Checkboxes
/*********************
Fancy CSS Textboxes
**********************/
$light-blue: #609FD5;
input[type="checkbox"] {
position: absolute;
left: -9999px;
visibility: hidden;