Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Sanders DaveSanders

View GitHub Profile
@DaveSanders
DaveSanders / sr_rspec_notes.md
Last active Nov 11, 2020
notes for stimulus_reflex + Rspec
View sr_rspec_notes.md

Scenario

I want to use Rspec to build feature specs that test SR pages, just like normal web pages.

Therefore, I expect Capybara + Rspec to be able to do things like:

visit login_path
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password + 'BAD'
expect(page).to have_content('That email or password is not correct')
@DaveSanders
DaveSanders / Accessibility Resources.txt
Last active Oct 2, 2018
Awesome Accessibility Resources
View Accessibility Resources.txt
List via Brian Rowe, accessibility expert. (brian@therowes.org)
General/Articles
WCAG - https://www.w3.org/WAI/standards-guidelines/wcag/
Smashing Magazine - https://www.smashingmagazine.com/category/accessibility
24 Accessibility - https://www.24a11y.com/
W3C Tutorials - https://www.w3.org/WAI/tutorials/
Deque University - https://dequeuniversity.com/
Inclusive Design 24 - https://inclusivedesign24.org/2018/
@DaveSanders
DaveSanders / gist:8721734
Created Jan 30, 2014
SQL MERGE for Upsert example
View gist:8721734
--- CREATE THE TABLE
USE [Bench]
GO
/****** Object: Table [dbo].[users] Script Date: 1/30/2014 5:42:46 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
@DaveSanders
DaveSanders / gist:5835642
Created Jun 22, 2013
code example for omniauth routes.
View gist:5835642
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
devise_for :users
get '/auth/:provider/callback', to: 'oauth#create'
end
end
@DaveSanders
DaveSanders / test.svg
Created May 18, 2012
Test SVG for StackOverflow question
View test.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DaveSanders
DaveSanders / gist:2017386
Created Mar 11, 2012
Install ruby debug with 1.9.3p125
View gist:2017386
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2017386)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p125 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@DaveSanders
DaveSanders / gist:1705064
Created Jan 30, 2012
Stacktrace for stack overflow
View gist:1705064
Mysql::Error: Table 'pestnowtest.orders' doesn't exist: SHOW FULL FIELDS FROM `orders`
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:233:in `query'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:233:in `block in execute'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activesupport-3.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestnow/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:233:in `execute'
/Users/dave/.rvm/gems/ruby-1.9.2-p290@pestno
View gist:1351731
<!DOCTYPE html>
<meta charset='utf-8'>
<html lang="en">
<head>
<link rel="stylesheet" href="jquery.svg.css"/>
<script src="jquery-1.7.min.js"></script>
<script src="jquery.svg.js"></script>
<script src="jquery.svgdom.js"></script>
<style>
@DaveSanders
DaveSanders / gist:1340607
Created Nov 4, 2011
JQuery add-on that adds a "enter" key press event
View gist:1340607
jQuery.fn.enter = function(callback) {
this.keypress(function(e){
if (e.which == 13) {
e.preventDefault();
callback.call(this);
}
});
return this;
}
View gist:522985
module DatatableHelper
#converts an object array into DataTable format
#example output:
#{"sEcho": 1, "iTotalRecords": 57, "iTotalDisplayRecords": 57,
#{"aaData": [
#["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"],["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"],["Gecko","Camino 1.0","OSX.2+","1.8","A"],["Gecko","Camino 1.5","OSX.3+","1.8","A"],["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"],["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"],["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"],["Gecko","Mozilla 1.0","Win 95+ / OSX.1+","1","A"]
#] }
def self.to_table(data, params = {})
You can’t perform that action at this time.