Skip to content

Instantly share code, notes, and snippets.

View byronferguson's full-sized avatar

Byron Ferguson byronferguson

View GitHub Profile
@byronferguson
byronferguson / Interview
Created July 8, 2015 18:58
General Interview Design
SQL: grab questions for page
CF:
NavBar
Sidebar
Body/Content
Loop(questions) {
Module(options) {}
}
Next Page
var pageInfo = [];
var questionInfo = {};
// Loop over the questions to fill in the other aspects (options / responses)
for(var record in local.results) {
structClear(local.questionInfo);
structInsert(local.questionInfo, "question", record);
structInsert(local.questionInfo, "options", record.qID);
structInsert(local.questionInfo, "responses", 1);
<div class="form-group">
<label for="schoolLevel">Which school are you currently attending?</label>
<select name="schoolLevel" id="schoolLevel" class="form-control">
<option value="0"></option>
<option value="1">High School</option>
<option value="2">Home School</option>
<option value="3">2yr College</option>
<option value="4">4yr College</option>
<option value="5">Other</option>
<option value="6">Not Attending</option>
@byronferguson
byronferguson / gist:b297d74cdb5830114528
Created August 12, 2015 16:41
AngularJS Factory not found
app.factory('InterviewPageFactory', function($http, URL) {
var getData = function(pageID) {
return $http.get(URL + 'interviews/page/' + pageID);
}
return {
getData: getData
};
});
@byronferguson
byronferguson / apiFactory.js
Last active September 4, 2015 19:46
Work in progress: attempting to create a simple REST interface object
(function(global, $) {
var ccREST = function(studentID, institutionID, clusterID) {
return new ccREST.init(studentID, institutionID, clusterID);
};
var BASE_API_URL = '/api/v1/index.cfm';
var createResponsePackage = function(clusterID) {
clusterID = clusterID || 0;
submitResponses: function() {
$.ajax({
url : postResponseURL(this.studentID),
method : 'POST',
dataType : 'json',
data : JSON.stringify(this.responseObject),
contentType : "application/json; charset=utf-8",
success : function(data, status) {
this.resetResponsePackage();
},
@byronferguson
byronferguson / app.js
Last active September 21, 2015 20:00
ui-route oddly misbehaving somewhere
'use strict';
/**
* @ngdoc overview
* @name app [smartadminApp]
* @description
* # app [smartadminApp]
*
* Main module of the application.
*/
@byronferguson
byronferguson / Details.cfc
Last active September 28, 2015 19:22
Hiddens not being stripped \r\n
component extends="taffy.core.resource" taffy_uri="/students/{studentID:[0-9]+}/details" {
function get(required numeric studentID) {
try {
var proc = new storedProc();
//proc.setDatasource( "MyCCMajors" );
proc.setProcedure("generateReportDetailsByID");
proc.addParam(value=arguments.studentID, cfsqltype="cf_sql_integer");
@byronferguson
byronferguson / studentFactory.js
Created September 28, 2015 20:32
factory to generate RESTful API interface for DI into controllers
angular.module('cc.services').factory('studentFactory', function($http) {
var urlBase = '/api/v1/index.cfm/students';
var resourceFactory = {};
resourceFactory.getList = function() {
return $http.get(urlBase);
};
resourceFactory.getStudentByID = function(studentID) {
'use strict';
angular.module('app.student').controller('ccRecommendationsCtrl', function () {
this.showClusters = function() {
return this.recommendations.length;
};
this.showDisciplines = function(cluster) {
return cluster.disciplines.length;