Skip to content

Instantly share code, notes, and snippets.

View jordanbyron's full-sized avatar

Jordan Byron jordanbyron

View GitHub Profile
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" RENAME CURRENT FILE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
@jordanbyron
jordanbyron / authentication.rb
Last active January 2, 2019 21:06
Custom authentication strategy for Devise with login screens, routes, and no database_authenticatable - Full writeup: http://blog.jordanbyron.com/post/54013166913/devise-authentication-strategy-without
module AuthApp
class CustomAuthentication < Devise::Strategies::Authenticatable
# This check is run before +authenticate!+ is called to determine if this
# authentication strategy is applicable. In this case we only try to authenticate
# if the login and password are present
#
def valid?
login && password
end
require 'prawn/labels'
names = %w[Jordan Chris Jon Mike Kelly Bob Greg]
Prawn::Labels.generate("names.pdf", names, type: "Avery5160",
document: { page_layout: :landscape }) do |pdf, name|
pdf.text name
end
--- a/app/views/admin/treatment_areas/index.html.haml
+++ b/app/views/admin/treatment_areas/index.html.haml
= header do
%h1 Treatment Areas
-%table.table.table-condensed.table-striped.table-hover
+%table
%thead
%tr
%th Name
request = Rack::Request.new(env)
current_scheme = if request.env['HTTPS'] == 'on'
'https'
elsif request.env['HTTP_X_FORWARDED_PROTO']
request.env['HTTP_X_FORWARDED_PROTO'].split(',')[0]
else
request.scheme
end
module Middleware
class Www
STARTS_WITH_WWW = /^buildinghero\./i
def initialize(app)
@app = app
end
def call(env)
/* $PostgreSQL: pgsql/contrib/citext/citext.sql.in,v 1.3 2008/09/05 18:25:16 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
--
-- PostgreSQL code for CITEXT.
--
-- Most I/O functions, and a few others, piggyback on the "text" type
-- functions via the implicit cast to text.
namespace :mailer do
desc 'Runs and emails daily reports to Geoff and Tom'
task :daily_reports => :environment do
report = Report.new
ReportMailer.daily_report(report).deliver
end
end
@jordanbyron
jordanbyron / integra.ini
Created July 2, 2012 13:50
Dexis Integrator configuration for Mission of Mercy integratio
[SOFTWARE]
debug = yes
link = dexfil
pms = CTMOM
path = X:\passtodex1.dat
setup = DEXIS Integrator 1.0 3-17-2009
country = us
window = 737 460 280 248
hidden = no
// Create a namespace for rafadc to work in
var ericgj = ericgj || {};
ericgj.WordDrawing = {
// Snip ....
}