Skip to content

Instantly share code, notes, and snippets.

View raytiley's full-sized avatar

Ray Tiley raytiley

View GitHub Profile
@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')
});
@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 / 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 / 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 / ember-sortable-list.js
Created March 23, 2013 04:25
Creating a sortable view using the html5sortable plugin and emberjs
// Working on getting html5sortable plugin working
// Key part is needing to call the sortable() method using Ember.run.next
// If called straight away the functionality quickly gets applied, but then is lost
// At least that's what it looks like when stepping through chrome debugger
// http://farhadi.ir/projects/html5sortable/
App.SortableView = Ember.CollectionView.extend({
tagName: 'ul',
itemViewClass: 'App.SortableItemView',
<?php
//Configure Script
$server = "http://129.19.150.20/"; //include trailing backslash
//End Configure
$client = new SoapClient($server."CablecastWS/CablecastWS.asmx?WSDL"); // Creates New SOAP client using WSDL file
//Get the schedule from the web service
$result = $client->RenameDigitalFile(array(
@raytiley
raytiley / app.js
Last active December 14, 2015 04:59
How do I set it up so that task view and timeline view get rendered to the appropriate outlets. Both task and timeline view need the context of the specific task that is being viewed. /#/tasks/:task_id
<script type="text/x-handlebars" data-template-name="tasks">
<div class="row">
<div class="span3">
<h3>Task Sets</h2>
<ul>
{{#each taskSet in controller}}
<li>{{#linkTo "taskSet" taskSet}}{{ taskSet.name }}{{/linkTo}}</li>
{{/each}}
</ul>
</div>
@raytiley
raytiley / creaTV.php
Created February 9, 2013 00:15
Shows how to output an embeded limelight player from mediaID provided in CablecastAPI
<html>
<head><title>CreaTV Limelight Player Example</title></head>
<body>
<h1>Limelight Player From Cablecast API</h1>
<p>
<?php
//Setup Script
$server = "173.11.100.21"; //cablecast server address
$showID = isset($_GET['ShowID']) ? $_GET['ShowID'] : 15859;
$client = new SoapClient("http://$server/CablecastWS/CablecastWS.asmx?WSDL");
@raytiley
raytiley / datepicker-example.js
Created January 30, 2013 23:36
Just a simple jQueryUI based datepicker
<!-- This is the form element that will be transformed into a datepicker -->
<div type="text" id="ScheduleDate style="float:left;margin-left:15px">
<!-- This script finds the above datepicker and when a day is selected goes to the current url with a different date -->
<!-- EXAMPLE: http://YourServer/Schedule.php?date=2012-01-13 -->
<script>
$(function() {
$("#ScheduleDate").datepicker({
onSelect: function(dateText, inst) { window.location.href = location.href.substring(0,location.href.lastIndexOf("?"))+"?date="+dateText},
});
@raytiley
raytiley / kegbaord-config.json
Created December 11, 2012 01:50
Kegboard object response
{
"id": 24,
"boardName": "Ray's Kegboard",
"boardType": "uno",
"pins":[
{"pinNumber": 1, "type": "flow", "name": "Flow Meter A"},
{"pinNumber": 2, "type": "flow", "name": "Flow Meter B"},
{"pinNumber": 5, "type": "buzzer", "name": "Buzzer"},
{"pinNumber": 10, "type": "onewire-temp", "name": "Temperature"},
{"pinNumber": 13, "type": "relay", "name": "Solenoid A"}