Skip to content

Instantly share code, notes, and snippets.

View scottmessinger's full-sized avatar

Scott Ames-Messinger scottmessinger

View GitHub Profile
import SortableListMixin from '../mixins/sortable-list';
import Part from '../models/part';
import Section from '../models/section';
var PartsController = Ember.ArrayController.extend(SortableListMixin, {
init: function(){
this._super()
// ISSUE #1 - probably unrelated the es6 change.
// Shouldn't the content be set automatically to an array?
if (Ember.isNone(this.get('content'))){
@scottmessinger
scottmessinger / gist:11184957
Created April 22, 2014 16:07
Questions about Ember

Ember does a bunch of useful, powerful, magical things that makes life easy. However, I find myself often a loss to understand how the magic works or how to hook into it. I think I struggle most to understand how & when things are instantiated, how they magically know of each other (e.g. the app knows all it's models & controllers), and how to instantiate things manually and give them access to all the other classes. Here are some examples:

  • If I create an instance of a controller, how do I make sure it has access to the app containers?
  • In Ember-CLI, how does Ember know about all the models/controllers/etc I create? When I write export default PostController, how does Ember register that as a controller and add it to the container?
  • In Ember-CLI, filenames & folder names make a difference. If files are named something unexpected, the documentation writes that they need to be imported automiatcally. Where would such an import statement go? What is the code path that the abnormally named class has to ski

type == "routine"

error

<!--
template: planbook.hbs
-->
{{render 'dates'}}
<!--
template: dates.hbs
controller: see DatesController below
App.PlanbookDate = Ember.Model.extend({
/**
* Computed Property
* This property returns a routine. If the routine is pristine,
* it creates a routine then adds parts from the routine template to it.
*
* If the routine is not pristine, it just returns the routine.
*
*/
@scottmessinger
scottmessinger / old_node.rb
Last active August 29, 2015 14:06
How I imagine the migration stuff happening
class OldNode
def lesson
@lesson ||= Lesson.find(id)
end
def verify_migration
self.verify_field_names
self.verify_sections
end
/**
* [SCATTER](http://nvd3.org/examples/scatter.html)
*/
[
{
"key": "Group 0",
"values": [
{
"x": 0.6396293678966859,
@scottmessinger
scottmessinger / component.js
Last active August 29, 2015 14:24
Data down observers
// SearchController
export default Ember.Controller.extend({
queryParams: ['query']
})
// SearchController template
{{x-search query=query}}
// X-Search component
export default Ember.Component.extend({
@scottmessinger
scottmessinger / 00_plan.md
Last active August 29, 2015 14:25
Payload Builder

Suggested Plan to migrate from AR to ES in our Rails app

Clean up Queries

  • Change the specs and the queries to move filters from filter to query.filtered.filter
  • Move {term: {budget_lea_id: budget_lea_id} from query to query.filtered.filter

Remove JBuilder

  • Create PayloadBuilder library to build payloads
  • Convert JBuilder code to PayloadBuilder library
@scottmessinger
scottmessinger / 00_usage.rb
Last active August 29, 2015 14:25
Transproc thoughts
# Usage: Setup
module A
extend Transproc::Registry
def self.hi(message)
h[:a_message] = message
end
end
module B
extend Transproc::Registry