This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _.extend(Backbone.Model.prototype, { | |
| // By default, rails expects model params to be wrapped in a nested params hash | |
| // https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/params_wrapper.rb | |
| _paramsWrapper : function() { | |
| return this.paramsWrapper; | |
| } | |
| }); | |
| // Alias Backbone.sync method to inject Rails specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tempfile.open("attachment", "#{Rails.root}/tmp") do |f| | |
| f.binmode # my attachment is binary | |
| f.write(model.attachment.file.read) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme", | |
| "font_size": 13.0, | |
| "ensure_newline_at_eof_on_save": true, | |
| "tab_size": 2, | |
| "draw_white_space": "all", | |
| "translate_tabs_to_spaces": true, | |
| "trim_trailing_white_space_on_save": true | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Question < ActiveRecord::Base | |
| # UGLY | |
| def self.starts_with(*strings) | |
| # Big loop to build something like this... | |
| where("wording LIKE ? OR wording LIKE ? OR wording LIKE ?", 'blah%', 'blaah%', 'blaaah%') | |
| end | |
| # PURDY | |
| def self.starts_with(*strings) | |
| strings = strings.map { |s| s+'%' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| addNested: function(model) { | |
| var view = new View.Nested({ model: model }); | |
| this.$("#nested-view").html(view.render().el); | |
| // Then I can safely init stuff like chosen.js | |
| view.$("select").chosen(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #------ snip ------ | |
| # Includes many of our custom types and providers, as well as global | |
| # config. Required. | |
| github "boxen", "3.4.2" | |
| # Core modules for a basic development environment. You can replace | |
| # some/most of these if you want, but it's not recommended. |
OlderNewer