App.Customer = DS.Model.extend({
firstName:attr('string'),
address:belongsTo('address')
});
This file contains 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
# initializers/active_admin.rb | |
module ActiveAdmin | |
class OrderClause | |
alias_method :initialize_old, :initialize | |
alias_method :valid_old?, :valid? | |
alias_method :to_sql_old, :to_sql | |
def initialize(clause) | |
if clause.class == String | |
initialize_old(clause) |
This file contains 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
// mixins/hookup_container.js | |
App.HookupContainer = Ember.Mixin.create({ | |
// https://github.com/tehviking/giffindor/issues/1#issuecomment-51066764 | |
hookupContainer: function() { | |
this.container = SoftLacrosse.__container__; | |
}.on('init'), | |
}); | |
// components/my_component.js | |
App.MyComponent = Ember.Component.extend( |
This file contains 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
#!/usr/bin/ruby | |
require 'pty' | |
cmd = ARGV.first | |
begin | |
PTY.spawn( cmd ) do |stdin, stdout, pid| | |
begin | |
stdin.each do |line| |
Recently, I upgraded from ember-qunit 0.3.1 to 0.3.2. The main reason I wanted to upgrade was to take advantage of a new way of writing component tests.
Previously, there was no way to test how the component was actually used. A component test could instantiate a component and poke at its internals, but that isn't how we use components. We use them declaratively in templates. The old style also meant it was difficult to test block templates and impossible to test block parameters.
I really wanted the new test style, but it wasn't easy to get there. The following are my upgrade notes.
Many of my old component tests looked like
This file contains 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
export default Ember.Component.extend({ | |
interval: 1000, | |
timer: null, | |
startTimer() { | |
const timer = Ember.run.later(this, () => { | |
this.sendAction('tick'); | |
this.startTimer(); | |
}, this.get('interval')); | |
this.set('timer', timer); | |
}, |
This file contains 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
require 'right_aws' | |
namespace :utils do | |
namespace :attachments do | |
task :initialize_s3 => :environment do | |
s3_config = YAML.load_file(File.join(File.dirname(__FILE__), '/../../config/amazon_s3.yml')) | |
s3_config = s3_config[RAILS_ENV].to_options | |
@s3 = RightAws::S3.new(s3_config[:access_key_id], s3_config[:secret_access_key]) | |
end |
This file contains 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
module PaperclipMigrations | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def add_paperclip_fields(table, prefix) | |
add_column table, "#{prefix}_file_name", :string | |
add_column table, "#{prefix}_content_type", :string |
This file contains 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
#Tasks have been added to fully maintain nginx, unicorn, redis, memcached, start resque workers and run any command on any server in the farm. | |
#<pre> | |
#cap nginx:restart # Restart Nginx. | |
#cap nginx:start # Start Nginx. | |
#cap nginx:status # Status of Nginx. | |
#cap nginx:stop # Stop Nginx. | |
#cap nginx:tail_error # Tail the Nginx error logs. | |
#cap unicorn:reload # reload your unicorn servers. | |
#cap unicorn:restart # restart your unicorn servers. | |
#cap unicorn:start # start your unicorn servers. |
OlderNewer