Skip to content

Instantly share code, notes, and snippets.

View KeithP's full-sized avatar

Keith Payne KeithP

  • equidat
  • London
  • 08:19 (UTC)
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
@KeithP
KeithP / .ebextensions\01-increase-timeout.config
Created October 23, 2014 20:38
Increase Elastic beanstalk timeout to 30 minutes
option_settings:
- namespace: aws:elasticbeanstalk:command
option_name: Timeout
value: 1800
@KeithP
KeithP / .ebextensions redis.config
Last active March 11, 2022 06:49
install redis on AWS EC2
packages:
yum:
gcc-c++: []
make: []
git: []
commands:
redis_script_01:
command: wget https://raw.github.com/KeithP/install-redis-amazon-linux-centos/master/redis-install-script.sh
redis_script_02:
command: chmod 777 redis-install-script.sh
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance
files:
"/etc/nginx/conf.d/websockets.conf" :
content: |
upstream backend {
server unix:///var/run/puma/my_app.sock;
}
#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"