Skip to content

Instantly share code, notes, and snippets.

@svenfuchs
svenfuchs / en.yml
Created Aug 4, 2011 — forked from mislav/en.yml
will_paginate i18n keys
View en.yml
en:
# ommitting the :views namespace here probably isn't an option?
will_paginate:
page_entries_info:
single_page:
zero: "No %{model} found"
one: "Displaying 1 %{model}"
other: "Displaying all %{count} %{model}"
multi_page: "Displaying %{model} %{from} - %{to} of %{total} in total"
models:
View gist:1027175
diff --git a/actionpack/test/template/translation_helper_test.rb b/actionpack/test/template/translation_helper_test.rb
index cd9f54e..365841e 100644
--- a/actionpack/test/template/translation_helper_test.rb
+++ b/actionpack/test/template/translation_helper_test.rb
@@ -53,6 +53,12 @@ class TranslationHelperTest < ActiveSupport::TestCase
assert_equal false, I18n.translate(:"translations.missing").html_safe?
end
+ def test_i18n_translate_returns_unsafe_even_if_using_html_rescue_format
+ expected = '<span class="translation_missing" title="translation missing: en.translations.missing">Missing</span>'
View gist:995028
sinon.FakeXMLHttpRequest = (function () {
// ...
function FakeXMLHttpRequest() {
this.readyState = FakeXMLHttpRequest.UNSENT;
this.requestHeaders = {};
this.requestBody = null;
this.status = 0;
this.statusText = "";
this.eventListeners = {};
@svenfuchs
svenfuchs / template-collection-view-bug-1.md
Created May 8, 2011
Travis CI Sproutcore spike progress.
View template-collection-view-bug-1.md

This is fixed in 1.6beta (current master)

Demo: http://www.youtube.com/watch?v=qtN3h0cTiBE

When you go to http://travis-sproutcore.heroku.com/#!/svenfuchs/minimal and then click the "Build History" tab then you see 3 items even though a) the json response only contains 2 items and b) the tab controller's content property (i.e. the record array) also only contains 2 records.

My impression is that the following happens:

1. Going to http://travis-sproutcore.heroku.com/#!/svenfuchs/minimal (i.e. the "Current" tab) loads a single Build record using the data source's retrieveRecord() method. ~~2. Clicking on the "Build history" tab renders a template collection view which is bound to a record array which is populated via a query that has conditions that match the record loaded in 1). This query needs to be loaded from remote at this point. ~~

View gist:945381
travis@vserver16:~$ rvm list
rvm rubies
ruby-1.9.2-p180 [ x86_64 ]
=> ruby-1.8.7-p334 [ x86_64 ]
ruby-1.8.6-p420 [ x86_64 ]
ree-1.8.7-2011.03 [ x86_64 ]
ruby-1.9.1-p378 [ x86_64 ]
jruby-1.6.1 [ linux-amd64-java ]
View ruby_rvm_system_invocation.rb
#!/usr/bin/env ruby
# How to run a system command from ruby within a clean bash that has never sourced rvm using a custom ruby version
# 1) install rvm as the correct user
# 2) do NOT follow the instructions about sourcing and adding this to your .bashrc
# 3) run the following (change the versions accordingly)
ruby_versions = %w(ruby-1.8.7-p330 rbx-head)
@svenfuchs
svenfuchs / .travis.yml
Created Mar 23, 2011
.travis.yml example
View .travis.yml
script: "rake ci"
rvm:
- 1.8.7
- 1.9.2
gemfile:
- test/gemfiles/rails-2.3.x
- test/gemfiles/rails-3.0.x
env:
- FOO=bar
- FOO=baz
View gist:848290
class A < Exception; end
a = catch(:a) do
throw :a, A.new
end
p a
# => #<A: A>
View gist:823884
class Internationalization < Abstraction
def perform
@developer.work!
end
end
class Localization < Concretion
def perform
@translator.work!
end
@svenfuchs
svenfuchs / gist:822402
Created Feb 11, 2011
prototypical inheritence
View gist:822402
// see comments in https://gist.github.com/822371
inherits = function inherits (child, parent) {
var ctor = function(){};
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.prototype.constructor = child;
child.__super__ = parent.prototype;
}