Skip to content

Instantly share code, notes, and snippets.

Scott Ames-Messinger scottmessinger

Block or report user

Report or block scottmessinger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scottmessinger
scottmessinger / 00_plan.md
Last active Aug 29, 2015
Payload Builder
View 00_plan.md

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 / process.rb
Created Jul 15, 2015
Importer with Transproc
View process.rb
preprocessor = Preprocessor.build
processor = Processor.build
evaluator = InputFunctions[:eval_values, [{ 'jd' => 'jd001' }]]
create_authors_with_books = rom.command([
:authors, [:create, [:books, [:create]]]
])
@scottmessinger
scottmessinger / component.js
Last active Aug 29, 2015
Data down observers
View component.js
// SearchController
export default Ember.Controller.extend({
queryParams: ['query']
})
// SearchController template
{{x-search query=query}}
// X-Search component
export default Ember.Component.extend({
View NVD3--scatter-bubble.js
/**
* [SCATTER](http://nvd3.org/examples/scatter.html)
*/
[
{
"key": "Group 0",
"values": [
{
"x": 0.6396293678966859,
@scottmessinger
scottmessinger / old_node.rb
Last active Aug 29, 2015
How I imagine the migration stuff happening
View old_node.rb
class OldNode
def lesson
@lesson ||= Lesson.find(id)
end
def verify_migration
self.verify_field_names
self.verify_sections
end
View gist:11200608
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.
*
*/
View 1.templates.hbs
<!--
template: planbook.hbs
-->
{{render 'dates'}}
<!--
template: dates.hbs
controller: see DatesController below
@scottmessinger
scottmessinger / gist:11184957
Created Apr 22, 2014
Questions about Ember
View gist:11184957

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
View 1. parts-controller.js
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'))){
You can’t perform that action at this time.