Skip to content

Instantly share code, notes, and snippets.

Toran Billups toranb

Block or report user

Report or block toranb

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
@toranb
toranb / ember-integration-test-with-multi-select.js
Created Aug 26, 2015
a simple ember example showing how to select multiple items in a "multi select" (integration testing)
View ember-integration-test-with-multi-select.js
test('multi select in a ember integration test', function(assert) {
//setup your model and other component state ...
this.render(hbs`{{my-multi-select model=model options=options}}`);
this.$('.some-multi-select > option[value="' + MY_NEW_ID + '"]').prop('selected',true).trigger('change');
assert.equal(model.get('related_things').get('length'), new_count_with_added_item);
});
View store.js
function buildRecord(type, data, store) {
var containerKey = 'model:' + type;
var factory = store.container.lookupFactory(containerKey);
var record = factory.create({
id: data.id,
$data: data
});
View eak-lite-sample.js
App = Ember.Application.create();
App.Router.map(function() {
this.resource("people", { path: "/" });
});
App.PeopleRoute = Ember.Route.extend({
model: function() {
return App.Person.find();
}
@toranb
toranb / index.html
Created Apr 9, 2014
the basic index.html file for eak-lite blog series
View index.html
<!DOCTYPE html>
<html>
<head>
<title>example app</title>
</head>
<body>
<script src='js/vendor/jquery/jquery.min.js'></script>
<script src='js/vendor/handlebars/handlebars.js'></script>
<script src='js/vendor/ember/ember.min.js'></script>
@toranb
toranb / step2.js
Created Apr 10, 2014
added grunt / grunt-cli / grunt-contrib-concat
View step2.js
{
"dependencies": {
"bower": "*",
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-concat": "*"
},
"scripts": {
"postinstall": "bower install"
}
@toranb
toranb / step2-index.html
Created Apr 10, 2014
updated index.html w/ single js asset file referenced
View step2-index.html
<!DOCTYPE html>
<html>
<head>
<title>example app</title>
</head>
<body>
<script src='js/dist/deps.min.js'></script>
<script type="text/x-handlebars" data-template-name="application">
{{outlet}}
@toranb
toranb / step2-gruntfile.js
Created Apr 10, 2014
added simple grunt file w/ concat logic
View step2-gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.initConfig({
concat: {
dist: {
src: [
'js/vendor/jquery/jquery.min.js',
'js/vendor/handlebars/handlebars.js',
'js/vendor/ember/ember.min.js',
@toranb
toranb / step3-gruntfile.js
Last active Aug 29, 2015
added handlebars precompile step
View step3-gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-ember-template-compiler');
grunt.initConfig({
emberhandlebars: {
compile: {
options: {
templateName: function(sourceFile) {
var newSource = sourceFile.replace('js/templates/', '');
return newSource.replace('.handlebars', '');
@toranb
toranb / step3-package.json
Created Apr 10, 2014
added grunt-ember-template-compiler
View step3-package.json
{
"dependencies": {
"bower": "*",
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-concat": "*",
"grunt-ember-template-compiler": "1.5.0"
},
"scripts": {
"postinstall": "bower install"
@toranb
toranb / step4-concat.js
Created Apr 11, 2014
updated concat for ES6
View step4-concat.js
concat: {
dist: {
src: [
'js/vendor/jquery/jquery.min.js',
'js/vendor/handlebars/handlebars.js',
'js/vendor/ember/ember.min.js',
'js/lib/loader.js',
'js/lib/ember-resolver.js',
'js/dist/transpiled/app/**/*.js',
'js/dist/tmpl.min.js'],
You can’t perform that action at this time.