This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.javascript_driver = :webkit | |
Capybara::Webkit.configure do |config| | |
config.block_unknown_urls | |
config.allow_url("lvh.me") | |
config.allow_url("*.lvh.me") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BraintreeHelper | |
SUCCESS_STATUSES = [ | |
Braintree::Transaction::Status::Authorizing, | |
Braintree::Transaction::Status::Authorized, | |
Braintree::Transaction::Status::Settled, | |
Braintree::Transaction::Status::SettlementConfirmed, | |
Braintree::Transaction::Status::SettlementPending, | |
Braintree::Transaction::Status::Settling, | |
Braintree::Transaction::Status::SubmittedForSettlement, | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************* | |
Fancy CSS Textboxes | |
**********************/ | |
$light-blue: #609FD5; | |
input[type="checkbox"] { | |
position: absolute; | |
left: -9999px; | |
visibility: hidden; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
class DropdownSearch extends Component { | |
state = { | |
cursor: null, | |
data: [], | |
isLoading: false, | |
mouseEnabled: true, | |
query: this.props.query, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
OlderNewer