Skip to content

Instantly share code, notes, and snippets.

View dcorking's full-sized avatar

David Corking dcorking

View GitHub Profile
@dcorking
dcorking / rgo.sh
Created November 24, 2012 15:50
Launch some handy cheat sheets and other console windows for Rails development
#!/bin/bash
# Launch some handy cheat sheets and other console windows for Rails development
# in unix-like systems
# http://creativecommons.org/publicdomain/zero/1.0/
# To the extent possible under law, dcorking has waived all copyright
# and related or neighbouring rights to rgo.sh. This work is published
# from: United Kingdom.
@dcorking
dcorking / .emacs
Created December 7, 2012 19:10
Some personalizations to GNU Emacs 23
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(desktop-save-mode t)
'(inferior-lisp-program "sbcl")
'(printer-name "Laserjet-3-office")
'(ps-font-family (quote Courier))
'(ps-font-size 10.0)
@dcorking
dcorking / repeated-fedup.rb
Created May 10, 2013 11:31
I wrote this to run as a job to help with an upgrade from Fedora 17 to Fedora 18. It runs fedup repeatedly, for example if yum fails due to the python error, 'Cannot allocate memory'.
#!/bin/ruby
#######################
# "repeated-fedup.rb" #
#######################
# runs fedup repeatedly, for example if yum fails due to the
# python error, 'Cannot allocate memory'
# continually updates a fedupdebugXX.log in the current directory
@dcorking
dcorking / transcript1 - compilation terminated
Last active December 20, 2015 02:29
Installing capybara-webkit gem on a nitrous.io VM with ruby 1.9.3
cd src/ && make -f Makefile.webkit_server
make[1]: Entering directory `/home/action/.rvm/gems/ruby-2.0.0-p195/gems/capybara-webkit-1.0.0/src'
g++ -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -I. -x c++-header -c stable.h -o webkit_server.gch/c++
In file included from /usr/include/c++/4.6/sstream:580:0,
from stable.h:39:
/usr/include/c++/4.6/bits/sstream.tcc:288:1: fatal error: can’t write PCH file: No space left on device
compilation terminated.
Preprocessed source stored into /tmp/ccsZAyIK.out file, please attach this to your bugreport.
make[1]: *** [webkit_server.gch/c++] Error 1
make[1]: Leaving directory `/home/action/.rvm/gems/ruby-2.0.0-p195/gems/capybara-webkit-1.0.0/src'
@dcorking
dcorking / transcript1
Created August 2, 2013 13:15
bundler failures under rbenv
david1@www:~$ rails new asilly-blogsite
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
@dcorking
dcorking / notes
Created August 4, 2013 05:20
Making the debugger available to Rails server
Gemfile: gem 'debugger'
.rspec:--debug --color
config/environments/development.rb: config.assets.debug = true
config/environments/test.rb: config.assets.allow_debugging = true
features/support/env.rb:require 'ruby-debug'
@dcorking
dcorking / minitest-stack-trace
Created August 5, 2013 13:36
Minitest not working in Rails 3.2.14. Is this line misconfigured? require File.expand_path('../../config/environment', __FILE__)
david2@www:~/daves-dream-blog$ bundle exec rake db:test:load
david2@www:~/daves-dream-blog$ bundle exec ruby -Itest test/functional/dreams_controller_test.rb
/home/david2/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `state_machine' for Subscription(Table doesn't exist):Class (NoMethodError)
from /home/david2/.rvm/gems/ruby-1.9.3-p448/gems/saas-0.1.1/app/models/subscription.rb:20:in `<class:Subscription>'
from /home/david2/.rvm/gems/ruby-1.9.3-p448/gems/saas-0.1.1/app/models/subscription.rb:1:in `<top (required)>'
from /home/david2/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
from /home/david2/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
from /home/david2/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/david2/.rvm/gems/ru
@dcorking
dcorking / _form.html.erb
Created August 6, 2013 16:31
typo in form partial
<div>
<%= f.label :donation_info %>
<%= f.text_field :donation_info, :class => "org_form" %>
</div>
<%= charity_admin_display_msg %>
<div class="field">
<%= text_field_tag 'organization_admin_email', :size => 100, class: 'org_form %>
</div>
<div class="actions">
<%= f.submit %>
@dcorking
dcorking / Can't edit the article
Created August 22, 2013 20:13
Typo spec that passes on its own, but fails when running the whole rspec suite
Failures:
1) Admin::ContentController with admin connection edit action should edit article
Failure/Error: get :edit, 'id' => @article.id
ActionView::Template::Error:
undefined method `to_sym' for nil:NilClass
# ./spec/models/page_spec.rb:68:in `block in except'
# ./spec/models/page_spec.rb:68:in `reject'
# ./spec/models/page_spec.rb:68:in `except'
# ./app/views/admin/shared/_merge.html.erb:3:in `_app_views_admin_shared__merge_html_erb__108427934_120784420__461995380'
@dcorking
dcorking / insert-mysolution.rkt
Created October 10, 2013 12:48
Is this number of "white-box" tests overkill? I see that even with 6 tests, I forgot to test the base case. It is a binary search tree insert function, from Module 6a of the Systematic Program Design MOOC by Gregor Kiczales.
(define BST0 false)
(define BST1 (make-node 1 "abc" false false))
(define BST4 (make-node 4 "dcj" false (make-node 7 "ruf" false false)))
(define BST3 (make-node 3 "ilk" BST1 BST4))
(define BST42
(make-node 42 "ily"
(make-node 27 "wit" (make-node 14 "olp" false false) false)
false))
(define BST10 (make-node 10 "why" BST3 BST42))