Skip to content

Instantly share code, notes, and snippets.

View gregblass's full-sized avatar

Greg Blass gregblass

View GitHub Profile
# https://mmonit.com/wiki/Monit/Systemd
# Automatically start Monit when system boots
# File goes in: /lib/systemd/system/
[Unit]
Description=Pro-active monitoring utility for unix systems
After=network.target
[Service]
Type=simple
@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
@gregblass
gregblass / lookup_spec.rb
Created March 18, 2016 19:05
Failing test examples
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("http://lvh.me/login")
Capybara.javascript_driver = :webkit
Capybara::Webkit.configure do |config|
config.block_unknown_urls
config.allow_url("lvh.me")
config.allow_url("*.lvh.me")
end
@gregblass
gregblass / better_time_ago_in_words.rb
Last active October 4, 2017 14:43
A better, Facebook-style activity time_ago_in_words
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 < 1.day.ago
"Yesterday at #{date_time.strftime('%l:%M%P')}"
else
time_ago_in_words(date_time)
end
end