Skip to content

Instantly share code, notes, and snippets.

@dsimard
dsimard / has_many_through_includes.rb
Created April 8, 2015 16:28
`has_many :through` an association that uses `includes` throws an error
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.1.1' # as well as '4.2.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
@dsimard
dsimard / bug.rb
Created July 14, 2015 17:23
Paranoia
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
for (var i = 0, item; item = items[i]; i++) {
}
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
ls -1 *.jpg | awk -F. '{printf "convert %s.jpg -resize 320x240 %s-sm.jpg\n",$1,$1}'
set :shared_database_path, "#{shared_path}/db"
set :shared_config_path, "#{shared_path}/config"
# snip...
after "deploy:setup", "sqlite3:make_shared_folder"
after "deploy:setup", "sqlite3:build_configuration"
after "deploy:symlink", "sqlite3:link_configuration_file"
# snip...
$.post("http://mysite.com/users",
{ userId : 100,
name : "John",
lastName : "Boucher" },
function(data) {
if (data.ok) {
alert("User saved!");
} else {
alert("User NOT saved.");
}
jskataUndo.onChange = function() {
// This is called when there's a new action
// or when undo/redo is called
};
jsk.undo.canUndo(); //returns false
jsk.undo.execute(function() {}, function() {});
jsk.undo.canUndo(); //returns TRUE
jsk.undo.canRedo(); //returns false
jsk.undo.execute(function addUser() {
alert("Add user");
// code to add the user
},
function removeUser() {
alert("Remove user");
// code to remove the previously created user
}