Skip to content

Instantly share code, notes, and snippets.

View KeithP's full-sized avatar

Keith Payne KeithP

  • equidat
  • London
  • 03:36 (UTC +01:00)
View GitHub Profile
@KeithP
KeithP / select multiple checkboxes
Created August 6, 2014 12:47
jQuery CoffeeScript for shift + click to select multiple checkboxes
lastSelected = null
checkboxHead = $( "thead :checkbox" )
checkboxes = $( "tbody :checkbox" )
checkboxHead.click (e) ->
isChecked = this.checked
checkboxes.each ->
$(this).prop( "checked", isChecked )
checkboxes.click (e) ->
thisSelected = checkboxes.index( this )
isChecked = this.checked
#gemfile
...
gem 'rails', github: 'matthewd/rails', :ref => 'e4c197c7698e2'
...
$ bundle update
The git source `git://github.com/matthewd/rails.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching git://github.com/matthewd/rails.git
Fetching https://github.com/rossta/serviceworker-rails.git
32) Pages signed in should display the 'root_path'
Failure/Error: @user = create(:user)
ActiveRecord::StatementInvalid:
PG::UndefinedTable: ERROR: invalid reference to FROM-clause entry for table "i"
LINE 2: CROSS JOIN generate_subscripts(i.indkey, 1) k
^
HINT: There is an entry for table "i", but it cannot be referenced from this part of the query.
: SELECT a.attname FROM pg_index i
CROSS JOIN generate_subscripts(i.indkey, 1) k
1) Manage::NotificationSubscription
Failure/Error: it { is_expected.to respond_to :user }
ActiveRecord::StatementInvalid:
PG::UndefinedTable: ERROR: invalid reference to FROM-clause entry for table "i"
LINE 2: CROSS JOIN generate_subscripts(i.indkey, 1) k
^
HINT: There is an entry for table "i", but it cannot be referenced from this part of the query.
: SELECT a.attname FROM pg_index i
CROSS JOIN generate_subscripts(i.indkey, 1) k
1) Admins::DataLoadsController as an admin user POST create with valid params assigns a newly created data_load as @data_load
Failure/Error: @mon_mutex.lock
fatal:
No live threads left. Deadlock?
# /home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rails-e8af65a46325/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:86:in `clear_query_cache'
# /home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rails-e8af65a46325/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `disable_query_cache!'
# /home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rails-e8af65a46325/activesupport/lib/active_support/callbacks.rb:413:in `block in make_lambda'
# /home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rails-e8af65a46325/activesupport/lib/active_support/callbacks.rb:270:in `call'
# /home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rails-e8af65a46325/activesupport/lib/active_support/callbacks.rb:270:in `block in simple'
Failures:
1) Users::PasswordsController POST 'update' success should change the password
Failure/Error: @cond.wait(@monitor.instance_variable_get(:@mon_mutex), timeout)
fatal:
No live threads left. Deadlock?
# /home/keithp/.rvm/gems/ruby-2.3.0@my_app/bundler/gems/rails-5de1e4f2c45e/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `block in lock_thread='
# /home/keithp/.rvm/gems/ruby-2.3.0@my_app/bundler/gems/rails-5de1e4f2c45e/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:368:in `lock_thread='
# /home/keithp/.rvm/gems/ruby-2.3.0@my_app/bundler/gems/rails-5de1e4f2c45e/activerecord/lib/active_record/fixtures.rb:1012:in `block in teardown_fixtures'
@KeithP
KeithP / init.coffee
Created April 6, 2018 13:32
How to initialise https://cookieconsent.insites.com with "Disabling cookies" code
window.App ||= {}
App.init = ->
window.cookieconsent.initialise
"palette":
"popup":
"background": "#252e39"
,
"button":
"background": "#14a7d0"
@KeithP
KeithP / privacy_notice.html.md
Last active April 8, 2018 22:00
Privacy Noitice - for Simple GDPR Compliance

DATA PRIVACY NOTICE

Thank you for using MyWebApp.com. This notice is to help you understand what information we collect, how we use it and what choices you have about it.

1. How we collect information:

a) When you give it to us or give us permission to obtain it

@KeithP
KeithP / phone_breadcrumbs_builder.rb
Last active July 19, 2018 10:37
Make use of your Breadcrumbs in your phone-specific views, to give a simple page title and navigation up 1 in the Breadcrumb stack. You have already configured every page with Breadcrumbs, so use them in your phone view header.
# lib/phone_breadcrumbs_builder.rb
# inspired by https://gist.githubusercontent.com/marlosirapuan/3ceb02972400ea98ac5c8f419a61806b/raw/d994dc2d6b35702b4a66e2d1a01a9e9956883375/bulma_breadcrumbs_builder.rb
#
# Make use of your Breadcrumbs in your phone-specific views, to give a simple page title and navigation up 1
# in the Breadcrumb stack. You have already configured every page with Breadcrumbs, so use them in your phone view header.
#
# Example render in your phone view header:
#
# `<a href="/"><i class="fa fa-chevron-left"></i></a> This Page Title`
#
<!-- START-->
<hr>
<h3>Current planning applications:</h3>
<p><code><var><cite>Larger schemes currently awaiting planning decisions (updated weekly)</cite></var></code></p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json2html/1.2.0/json2html.min.js"></script><script>
function convertDate(inputFormat) {
function pad(s) { return (s < 10) ? '0' + s : s; }
var d = new Date(inputFormat);
return [pad(d.getDate()), pad(d.getMonth()+1), d.getFullYear()].join('/');
}