Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Open to possibilities. Enquire within.

Jeff Dickey jdickey

💭
Open to possibilities. Enquire within.
View GitHub Profile
@jdickey
jdickey / 00. Contents
Created Apr 4, 2012
Output from 'rake spec' using a newly-generated Cell; matcher syntax apparently has changed since Cells originally written
View 00. Contents
This Gist contains 4 files of interest:
- 01. Shell output from running rake spec with as-generated spec
- 02. As-generated articles_cell_spec.rb
- 03. My reworked articles_cell_spec.rb
- 04. Gemfile for the project
Posted in support of issue #117 on apotonick/cells project.
@jdickey
jdickey / crashdump.txt
Created Apr 17, 2012
Crash dump from Pry+CodeRay bug.
View crashdump.txt
/usr/local/bin/ruby -S rspec ./spec/cells/articles_cell_spec.rb ./spec/controllers/meldd_controller_spec.rb ./spec/helpers/articles_cell_helpers_spec.rb ./spec/helpers/meldd_helper_spec.rb ./spec/models/article_spec.rb ./spec/models/contribution_spec.rb ./spec/models/meldd_spec.rb ./spec/models/user_spec.rb ./spec/views/layouts/application.html.haml_spec.rb ./spec/views/meldd/index.html.haml_spec.rb
ArticlesCell
cell rendering
top_articles
should contain a top-level header element
should contain an unordered list element containing three list-item elements
newest_articles
should contain a top-level header element
should contain an unordered list element containing three list-item elements
@jdickey
jdickey / Gemfile
Created Apr 17, 2012
Gemfile in support of Pry issue 540
View Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'sentient_user'
gem 'timecop'
@jdickey
jdickey / 00-introduction.markdown
Created Apr 26, 2012
Assigning to field enumerated by Enumerize gem fails.
View 00-introduction.markdown

Problems with Assigning Values to enumerized Fields

I have a fairly simple data model that I wish to include an enumerated value in. If I set the :default value of that field, it has that value when the model is instantiated. If I explicitly assign a symbol from among my list of defined values to that field, it becomes an ordinary Symbol with no enumeration magic. If I do not assign a default value in the model definition, then the value is nil and cannot be modified.

Attached files:

  • 01-output.txt - snippet of output from running the spec
  • 02-article.rb - the data model with the enumerated field (article_status)
  • 03-article_spec.rb - (part of) an RSpec specfile for article.rb
@jdickey
jdickey / enumerize_testing.rb
Created Apr 26, 2012
Simplest possible use of Enumerize. Trying to track down my bug in Gist 2497174.
View enumerize_testing.rb
gem 'rails', '3.2.3' # change as required
require 'active_record'
require 'enumerize'
require 'awesome_print'
# Print out what version we're running
puts "Active Record #{ActiveRecord::VERSION::STRING}"
# Connect to an in-memory sqlite3 database (more on this in a moment)
@jdickey
jdickey / 00-introduction.markdown
Created Jul 22, 2012
Chicken-and-egg problem installing Gem `guard-rack` 1.1
View 00-introduction.markdown

Ran into this while installing a new Ubuntu Server 12.04 image. Dozens of other Gems install fine, but... have a look at 01-dump.txt

System is:

  • Ubuntu Server 12.04 (kernel 3.2.0-26-generic #41-Ubuntu) running under VMWare Fusion Version 4.1.3 (730298)
  • 1 GB RAM, 20 GB HD, 2 CPU cores
  • Ruby 1.9.3p0 (2011-10-30 revision 33570)
  • gem version 1.8.11

File 01-terminal-output.bash is the terminal output from attempting to install the Gem using sudo gem install guard-rack

View 00-introduction.md

What IS All This?

"All this" is some CoffeeScript specs (using Jasmine via Jasminerice) and code to exercise the Medialize ContextMenu jQuery plugin, through a thin wrapper class.

Specifically, this Gist contains source and spec files demonstrating the main problem that led to the filing of this issue on the jQuery-contextMenu project.

What's the problem?

@jdickey
jdickey / Bootstrap modal changes.md
Last active Dec 13, 2015
Discussion of changes in Bootstrap's `modal` (dialog) plugin between version 2.0 and the (now-)current 2.3.
View Bootstrap modal changes.md

Introduction

Bootstrap's modal-dialog behaviour has changed significantly since Version 2.0.x.

What interests me here is the behaviour I had previously been testing in Jasmine specs to detect whether the dialog was being shown or not. In earlier versions, Bootstrap would add the CSS class modal-open to the HTML body to indicate that there was a modal open somewhere on the page. You can make any of several arguments why that's a poor mechanism, including the fact that you can't look at the currently active DOM and easily tell which of several possible dialogs on a page is active.

Now, the markup for the outermost containing div of the dialog has changed significantly. I used this jsFiddle to explore how Bootstrap modifies that div in the DOM as of Bootstrap version 2.3.0.

Dialog markup as written

@jdickey
jdickey / CoffeeScript example source (Gist 1 of 2).coffee
Last active Dec 14, 2015
Example CoffeeScript source, showing that classes cannot be reopened as in JS and Ruby.
View CoffeeScript example source (Gist 1 of 2).coffee
class A
constructor: ->
@a = 1
class A
foo: ->
@a
a = new A()
a.foo()
@jdickey
jdickey / JavaScript output from compiling CoffeeScript example source (Gist 2 of 2).js
Created Feb 23, 2013
Output from compiling example CoffeeScript source, showing that classes cannot be reopened as in JS and Ruby: they're "just" variables
View JavaScript output from compiling CoffeeScript example source (Gist 2 of 2).js
// Generated by CoffeeScript 1.4.0
(function() {
var A, a;
A = (function() {
function A() {
this.a = 1;
}