Skip to content

Instantly share code, notes, and snippets.

View cromwellryan's full-sized avatar

Ryan Cromwell cromwellryan

View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
showNav: false,
didInsertElement () {
this.$('.nav-wrapper').appendAround();
this.$('.search-wrapper').appendAround();
this.$('.sign-in-wrapper').appendAround();
this.$('.universal-nav-wrapper').appendAround();
},
class CompositeEnrollmentCommand
def initialize(enrollment)
@enrollment = enrollment
end
def execute
commands
.each { |c| c.execute }
end
@cromwellryan
cromwellryan / cromwellryan.md
Last active February 10, 2016 17:39
Notes from Dayton Clean Coders 2016-02-10
@cromwellryan
cromwellryan / application.route.js
Created January 27, 2016 18:19
didInitAttrs vs Computed
import Ember from 'ember';
export default Ember.Route.extend({
setupController: function(controller,model) {
this._super(controller,model);
this.startWatchingTime(controller);
},
startWatchingTime: function(controller){
var self = this;
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
things: [1,2,3,4,5],
smaller: Ember.computed('things', function() {
return this.get('things').slice(0,2);
})
});
var myApp = {
formatActivities(data, asOf) {
var activities = data.activity;
asOf = asOf || moment(); // optional arguments make testing easier... sometimes
var formatted = activities.map( (activity) => {
return {
"displayName": `${activity.user.firstName} ${activity.user.lastName} (${activity.user.username})`,
"formattedDateTime": moment(activity.written_at).from(asOf),
"activity": activity.activity
{
"activity": [
{
"user": {
"username": "gandolfJ",
"firstName": "James",
"lastName": "Gandolfini"
},
"written_at": "2016-01-11T18:25:43.511Z",
"activity": "Logged in"
@cromwellryan
cromwellryan / 1.js
Last active January 18, 2016 01:46
myModule.showSecondaryData = function() {
$.ajax({
url: '//br-frontend-testing-triangles.herokuapp.com',
success: function(data) {
$('#triangleType').text(data.type);
},
error: function(jqXHR, textStatus, errorThrown) {
$('#error').text('Error: ' + errorThrown);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@cromwellryan
cromwellryan / application.controller.js
Last active December 5, 2015 04:45
Registration Flow
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Registration'
});