Skip to content

Instantly share code, notes, and snippets.

View niborg's full-sized avatar

Nick Knipe niborg

View GitHub Profile
0x07666C5dCdF60c6e837bDfc4f26Ad457e30dfC38
report: {
// Params to filter the results
//
filters: {
date_range: {
start: <formatted date String>, // required
end: <formatted date String> // optional defaults to today
},
matter_types: <Array of ids>, // optional, defaults to array containing all matter types
sources: <Array of ids>, // optional, defaults to array containing all sources,
@niborg
niborg / gist:39214bd8d088eacd1ffb296b6232060d
Last active March 19, 2018 15:07
template demonstrating that :if option in after_commit on: [event] triggered during other lifecycles
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
@niborg
niborg / date_parser.rb
Created July 12, 2019 18:19
Service wrapping Ruby's standard library so as to sniff out date ranges.
# frozen_string_literal: true
module Utilities
# Class wrapping Ruby's standard library so as to sniff out date ranges.
#
class DateParser
Error = Class.new(StandardError)
RangeParseError = Class.new(Error)
DateRangeNotPresent = Class.new(Error)
@niborg
niborg / login_macros.rb
Created April 29, 2020 22:12
Request spec login macros
def create_session(user)
payload = { username_or_email: user.email }
if user.two_factor?
payload.merge!(auth_code: user.otp_code)
else
payload.merge!(password: user.password)
end
post '/sessions', payload
error = session[:flash] && session[:flash][:error]