Skip to content

Instantly share code, notes, and snippets.

View Dhaulagiri's full-sized avatar

Brian Runnells Dhaulagiri

View GitHub Profile
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@Dhaulagiri
Dhaulagiri / ember-data.md
Last active August 29, 2015 14:19
Ember Data Docs

Ember Data

In general, I would say that the documentation could improve simply from being a lot more explicit about the particular details that are important when using Ember Data:

  • What are the actual conventions Ember Data is expecting your API to adhere to?
  • If your API is not following them, what are the steps you can take to override the defaults to get on the happy path? In practice these are pretty easy which is great, but it is not terribly obvious to users.
  • The answers to these questions exist in the current docs, but they require a lot of navigating around the site.
  • Where are the ember data docs? They are implied when reading the Ember model docs, but it should be a lot easier and more clear, shouldn't it?
  • The Ember guides assume you are using Ember Data, but that is not made explicit in any way.
  • Most common issue is that the RESTAdapter needs to be extended to massage api data into format the ember expects. This should be a lot easier to determine based on the docs.
@Dhaulagiri
Dhaulagiri / gist:cf5787663d9f93e99d05
Created June 22, 2015 20:45
Ember Data 2.0 JSONAPISerializer
import DS from 'ember-data';
import Ember from 'ember';
export default DS.JSONAPISerializer.extend({
normalizeArrayResponse: function(store, primaryModelClass, payload, id, requestType) {
var data = {},
extracted = [],
root = 'data',
type = Ember.String.pluralize(primaryModelClass.modelName);

Switch To Vim For Good

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I did the switch.

Some background: my decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Non Optional

  1. Watch the Derek Wyatt videos in order (at least the “Novice” ones for now): http://derekwyatt.org/vim/tutorials/
  2. Read the first part of this Sta
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
isSelected: true
});
@Dhaulagiri
Dhaulagiri / signature.js
Last active August 26, 2015 20:14
support signature
javascript:(function()%7Bfunction callback()%7B(function(%24)%7Bvar jQuery%3D%24%3B%24('.public .form-control').val(%24('.public .form-control').val() %2B "%5Cn%5Cn Thanks%2C %5Cn Brian Runnells %5Cn Human Interface Team")%7D)(jQuery.noConflict(true))%7Dvar s%3Ddocument.createElement("script")%3Bs.src%3D"https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js"%3Bif(s.addEventListener)%7Bs.addEventListener("load"%2Ccallback%2Cfalse)%7Delse if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
currentWhen: 'foo bar'
});
@Dhaulagiri
Dhaulagiri / ember-master-in-ember-cli-app.md
Last active September 14, 2015 14:25 — forked from rwjblue/ember-master-in-ember-cli-app.md
Developing on Ember master (linked locally), with an Ember CLI application.

From a terminal run the following commands:

git clone git@github.com:emberjs/ember.js
cd ember.js
npm install
npm start

While that is running open another terminal and run the following (starting from the ember.js folder you cloned a moment ago):

@Dhaulagiri
Dhaulagiri / asset-rewrite-2.js
Last active December 11, 2015 12:47
asset-rev-debugging
AssetRewrite.prototype.processString = function (string, relativePath) {
var newString = string;
for (var i = 0, keyLength = this.assetMapKeys.length; i < keyLength; i++) {
var key = this.assetMapKeys[i];
// Start timer
console.time(key);
if (this.assetMap.hasOwnProperty(key)) {
/*
@Dhaulagiri
Dhaulagiri / asset-rewrite-1.js
Created December 11, 2015 12:47
asset-rewrite-1
AssetRewrite.prototype.processString = function (string, relativePath) {
// Start timer
console.time(key);
var newString = string;
for (var i = 0, keyLength = this.assetMapKeys.length; i < keyLength; i++) {
var key = this.assetMapKeys[i];
// Start timer
console.time(key)