Skip to content

Instantly share code, notes, and snippets.

View gavinhughes's full-sized avatar

Gavin Hughes gavinhughes

View GitHub Profile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; BACK UP YOUR LOGSEQ DIR BEFORE RUNNING THIS!
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Aug 4 2022, William R. Burdick Jr.
;;
;; LICENSE
;; This code is dual-licensed with MIT and GPL licenses.
@gtallen1187
gtallen1187 / slope_vs_starting.md
Created November 2, 2015 00:02
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@gavinhughes
gavinhughes / db_disconnect.rake
Created September 25, 2012 10:56
Rake task to disconnect postgres db
namespace :db do
desc "Drop postgresql db connections"
task :disconnect => :environment do
begin
ActiveRecord::Base.connection.select_all("select * from pg_stat_activity order by procpid;").each do |x|
ActiveRecord::Base.connection.execute("select pg_terminate_backend(#{x['procpid']})")
end
rescue
end
puts "DB sessions disconnected."
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@activefx
activefx / spec_helper.rb
Created October 10, 2011 20:19
Spec helper for use with guard, spork, rspec, factory girl, devise, capybara, and mongoid
require 'rubygems'
def start_simplecov
require 'simplecov'
SimpleCov.start 'rails' unless ENV["SKIP_COV"]
end
def spork?
defined?(Spork) && Spork.using_spork?
end
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@ddemaree
ddemaree / application.js.coffee
Created June 12, 2011 21:54
Simple Google Maps API v3 integration in CoffeeScript, with non-JS Static Maps fallback
#= require jquery
#= require jquery_ujs
#= require lib/modernizr
#= require lib/jquery.lettering
#= require_tree .
$ ->
$('*[data-googlemap]').googleMap()
true
@mrichman
mrichman / application.html.haml
Created May 30, 2009 19:43
Generic Compass Blueprint Layout & Styles
!!! Strict
%html{locale_attrs}
%head
%title&= yield(:title) || t(:site_name)
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
%meta{ :name => "description", :content => "" }/
%meta{ :name => "keywords", :content => "" }/
= stylesheet_link_tag 'screen', :media => 'screen, projection'
= stylesheet_link_tag 'print', :media => 'print'
= stylesheet_link_tag 'buttons', :media => 'screen, projection'