Skip to content

Instantly share code, notes, and snippets.

View raytiley's full-sized avatar

Ray Tiley raytiley

View GitHub Profile
@raytiley
raytiley / arraycontroller-issues.js
Last active December 15, 2015 08:19
Need some help figuring out why the content in the sortable-item view is coming from the CategoryController and not the DocumentController
App.CategoryController = Ember.ObjectController.extend({
needs: ['documents'],
uploads: new Array()
});
App.DocumentController = Ember.ObjectController.extend({
isEditing:true,
editDocument: function () {
console.log('handling edit');
this.set('isEditing', true);
@raytiley
raytiley / Category.hbs
Last active December 15, 2015 09:19
Trying to figure out how I can run the same code that is in didInsertElement when items are added or removed from the sortedDocuments use in the #each helper.
<script type="text/x-handlebars" data-template-name="category">
<h3>{{ name }}</h3>
{{#view App.SortableContainer }}
{{#each sortedDocuments itemController="document"}}
<li {{bindAttr data-document-id="id" }}>
{{#if isEditing }}
{{view App.InlineDocumentEditView valueBinding="name" }}
{{else}}
<label {{ action editDocument on="doubleClick" }}>{{ name }}</label>
<a {{bindAttr href="url"}}>download</a>
@raytiley
raytiley / S3Upload.js
Created March 27, 2013 00:07
This class uploads to an S3 bucket. And was adapted from this blog post: http://www.ioncannon.net/programming/1539/direct-browser-uploading-amazon-s3-cors-fileapi-xhr2-and-signed-puts/ You need to have an endpoint on your server that will sign your S3 request for you ('covered in the plog post'). To use: App.S3Upload.create({ file: file-from-fil…
App.S3Upload = Ember.Object.extend({
progress: 0,
state: "pending",
bucket: 'your-bucket'
complete: false,
s3url: null,
xhr: null,
file: null,
fileName: function() {
var file = this.get('file');
@raytiley
raytiley / gist:5454261
Created April 24, 2013 18:16
relationship not working
App.Show = DS.Model.extend({
title: DS.attr('string'),
airing: DS.hasMany('App.Airing')
});
App.Airing = DS.Model.extend({
channel: DS.attr('number'),
show: DS.belongsTo('App.Show')
});
<?php
//Configure Script
$server = "http://50.200.83.14/"; //include trailing backslash
$channelID = 3; //Cablecast Channel ID
$displayDays = 0; //Number of Days to Display
$showDetailsURL = "/?page_id=540&"; // Must end with a '?' or '&'
date_default_timezone_set('America/New_York');
//End Configure
//SOAP Client Setup
@raytiley
raytiley / massSave.js
Last active December 19, 2015 05:48
Looking for someone to sanity check me. Even with a 10 second delay on the server, the console message gets logged immediatly indicating that $.when is resolving the promises immediately.
var clips = [
App.Clip.create({name: 'test one'}),
App.Clip.create({name: 'test two'}),
];
var saveAll = function() {
clips.map(function(clip) {
return clip.save();
});
}
<thead>
<tr>
<th style="width:50%">File</th>
<th style="width:10%">Actions</th>
<th style="width:10%">Size</th>
<th style="width:10%">Server</th>
<th style="width:10%">Details</th>
</tr>
</thead>
<tbody>
App.FilesValidController = App.PaginationController.extend({
filesBinding: 'content',
goToPage: function(page) {
var offset = page -1;
this.set('pagerProps.offset', offset);
//hack
var files = App.DigitalFile.find({isValid:true, isOrphaned: false, offset:offset});
files.meta = this.get('pagerProps');
this.set('model', App.DigitalFile.find({isValid:true, isOrphaned: false, offset:offset}));
}
<table class="table table-striped table-bordered table-condensed" style="table-layout: fixed">
<thead>
<tr>
<th style="width:50%">File</th>
<th style="width:10%">Actions</th>
<th style="width:10%">Size</th>
<th style="width:10%">Server</th>
<th style="width:10%">Details</th>
</tr>
</thead>
@raytiley
raytiley / gist:5980470
Created July 12, 2013 00:31
Probably a shameful example of how to do things wrong.
embedCode: function() {
var config = this.get('show.location.vodConfiguration');
if(!config || !config.get('isLoaded'))
return '';
var fileName = this.get('fileName'),
baseUrl = config.get('baseUrl'),
template = config.get('embedTemplate');