Skip to content

Instantly share code, notes, and snippets.

View svenfuchs's full-sized avatar

Sven Fuchs svenfuchs

View GitHub Profile
@svenfuchs
svenfuchs / en.yml
Created August 4, 2011 23:23 — forked from mislav/en.yml
will_paginate i18n keys
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:
@svenfuchs
svenfuchs / gist:1027175
Created June 15, 2011 14:06 — forked from spastorino/gist:1027174
i18n.patch
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>'
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 12:34
Travis CI Sproutcore spike progress.

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. ~~

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 ]
#!/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 March 23, 2011 14:31
.travis.yml example
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
class A < Exception; end
a = catch(:a) do
throw :a, A.new
end
p a
# => #<A: A>
@svenfuchs
svenfuchs / gist:823884
Created February 12, 2011 17:05
I18n vs L10n
class Internationalization < Abstraction
def perform
@developer.work!
end
end
class Localization < Concretion
def perform
@translator.work!
end
@svenfuchs
svenfuchs / gist:822402
Created February 11, 2011 14:17
prototypical inheritence
// 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;
}