Skip to content

Instantly share code, notes, and snippets.

@gkats
gkats / css.js
Created February 27, 2015 11:43
CSS Layout Debugger
// https://gist.github.com/addyosmani/fd3999ea7fce242756b1
// Using $$
[].forEach.call($$("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
// Using querySelectorAll
[].forEach.call(document.querySelectorAll("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
@gkats
gkats / has_one_bug.rb
Last active August 29, 2015 14:11
Possible bug in activerecord has_one
gem 'activerecord', '4.1.8'
# The behavior is the same with 4.2.0.rc3 as well
# gem 'activerecord', '4.2.0.rc3'
gem 'sqlite3'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)