Skip to content

Instantly share code, notes, and snippets.

View kdiogenes's full-sized avatar
🐝

Kadu Diógenes kdiogenes

🐝
View GitHub Profile
1) User sign in signs in as an account owner successfully
Failure/Error: page.current_url.should == sign_in_url
expected: "http://test1.example.com/sign_in"
got: "http://www.example.com/" (using ==)
# ./spec/features/users/sign_in_spec.rb:11:in `block (3 levels) in <top (required)>'
pt-BR:
devise:
confirmations:
confirmed: "Sua conta foi confirmada com sucesso. Realize seu login por favor."
send_instructions: "Dentro de minutos você receberá um e-mail com instruções para confirmar a sua conta."
send_paranoid_instructions: "Caso seu e-mail exista em nossa base, você receberá um e-mail em poucos minutos com instruções sobre como confirmar sua conta."
failure:
already_authenticated: "Você já está logado."
inactive: "A sua conta não foi ativada ainda."
invalid: "E-mail ou senha inválidos."
@kdiogenes
kdiogenes / gist:8942718
Created February 11, 2014 19:49
Epf: Workaround for @session.load works with a singular resource
# If you have a singular resource, with this code, you can write the following
# to get your resource: @session.load(MyModel, 'singular')
# I don't like the 'singular' as an ID and prefer how RoR differentiate between
# singular and multiple resources, but for now is what I have :)
Ember.Inflector.inflector.uncountable('my_model')
get = Ember.get
Ep.RestAdapter.reopen
buildURL: (record, suffix) ->
@kdiogenes
kdiogenes / gist:9142037
Created February 21, 2014 19:48
ember-easyForm: Custom input type for number field
App.InputNumber = Ember.EasyForm.TextField.extend
type: 'number'
attributeBindings: ['min', 'step']
Ember.EasyForm.Config.registerInputType('number', App.InputNumber);
@kdiogenes
kdiogenes / gist:10423985
Created April 10, 2014 21:12
ember-easyForm: test uses the specified model declared in a needs controller
test('uses the specified model declared in a needs controller', function() {
var NeedsController = Ember.ObjectController.extend({
needs: 'another_controller_with_big_name',
anotherController: Ember.computed.alias('controllers.another_controller_with_big_name'),
container: container
});
container.register('controller:another_controller_with_big_name', Ember.ObjectController.create({
theModel: { foo: 'LOL' },
foo: 'BORING'
@kdiogenes
kdiogenes / nested-fields-for-radios.patch
Created May 10, 2014 21:16
formbuilder: nested fields for radios
diff --git index.html index.html
index a65e625..30503cf 100644
--- index.html
+++ index.html
@@ -64,10 +64,20 @@
"field_options": {
"options": [{
"label": "Yes",
- "checked": false
+ "checked": false,
@kdiogenes
kdiogenes / response_fields.html
Created May 10, 2014 21:16
formbuilder: templates/partials/response_fields.html
<div class='fb-no-response-fields'>No response fields</div>
<div class='fb-response-fields'></div>
@kdiogenes
kdiogenes / gist:233fecc5db6b73012ada
Created January 29, 2015 18:11
fontcustom: patch to make symbolic links be understood as alias
diff --git a/lib/fontcustom/generator/font.rb b/lib/fontcustom/generator/font.rb
index d9ffd21..402516f 100644
--- a/lib/fontcustom/generator/font.rb
+++ b/lib/fontcustom/generator/font.rb
@@ -50,6 +50,7 @@ module Fontcustom
files = Dir.glob File.join(@options[:input][:vectors], "*.svg")
glyphs = {}
files.each do |file|
+ next if File.symlink?(file)
name = File.basename file, ".svg"
@kdiogenes
kdiogenes / gist:87240f32fb2fc5ab8bfe
Created February 7, 2015 14:53
paloma: patch to avoid namespace controller clash
diff --git a/vendor/assets/javascripts/paloma/controller_factory.js b/vendor/assets/javascripts/paloma/controller_factory.js
index 23c34b0..b4ab47b 100644
--- a/vendor/assets/javascripts/paloma/controller_factory.js
+++ b/vendor/assets/javascripts/paloma/controller_factory.js
@@ -18,7 +18,9 @@
scope = scope[namespace];
}
- return scope[config['controller']] = createConstructor();
+ scope[config['controller']] = scope[config['controller']] || {};
@kdiogenes
kdiogenes / gist:cd69c312f0f38a37c8a9
Created February 19, 2015 23:03
javascript: 2048 IA
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('o 1m,1p,T,6,1C,1I,1s,1u,1q,1t,1v,1G,q,1n,X,S,1J,1d,c,s=[].s||g(1B){h(o i=0,l=u.B;i<l;i++){8(i 14 u&&u[i]===1B)e i}e-1};1D.1Z.7=g(1y,17){o p,w,z,F,18,19;8(17==V){17=L}z=u;8(u.1F()){e}p=R 0;F=R 0;19=u.1Y(1y);18=u.1X(19);w=N;u.1V();18.x.1N(g(x){18.y.1N(g(y){o Q,H,O;p={x:x,y:y};F=z.Z.1M(p);8(F){O=z.1W(p,19);H=z.Z.1M(O.H);8(H&&H.P===F.P&&!H.1x){Q=1w 20(O.H,F.P*2);Q.1x=[F,H];z.Z.1U(Q);z.Z.21(F);F.25(O.H);z.r+=Q.P;8(Q.P===22){z.1E=L}}t{z.26(F,O.1Q)}8(!z.1T(p,F)){w=L}}})});8(w&&17){u.1S();8(!u.1R()){u.1P=L}}8(w){u.2c()}e w};S={W:[0,0],d:[1,2],G:[2,3],1z:[3,1]};c=[];1C=g(9){e 1H.2h(1H.2g(9))};T=g(7){o 1i,w;1i=q.2i();w=q.7(7[0],N);c[7[1]]={9:q.Z.9,r:q.r,w:w,1A:7[0]};q.27.2f(1i);e q.2e()};6=g(p){