#Scotch.io Tutorial
Original article found here...
The gulp api is incredibly light containing 4 top level functions. They are
- gulp.task
- gulp.src
- gulp.dest
- gulp.watch
app.factory('Auth', ['$firebaseAuth', 'FBURL', | |
function($firebaseAuth, FBURL) { | |
var ref = new Firebase(FBURL); | |
return $firebaseAuth(ref); | |
}]); | |
app.factory('User', ['FBURL', '$firebaseObject', | |
function(FBURL, $firebaseObject) { | |
var ref = new Firebase(FBURL + '/users'); | |
var userData = {}; |
//Add new section click | |
$('#sections').on('click', 'button',function() { | |
var sectionNum = $('#sections').children().length + 1; | |
// Create the snippet of html for each section | |
var html = '<div class="block">'; | |
html += '<div class="inline form-group">'; | |
html += '<label>Section ' + sectionNum + '</label>'; | |
html += '<input class="lesson-section" id="section' + sectionNum + '">'; | |
html += '</div>'; | |
html += '<div class="inline form-group">'; |
function drawer(price, cash, cid) { | |
var totalCid = cid.map(function(each) {return each[1];}) | |
.reduce(function(a, b) {return a + b;}); | |
var inDrawer = cid.map(function(each) {return [each[0], getCurrencyTotals(each)];}); | |
var totalDue = cash - price; | |
if(totalDue > totalCid) { |
function AVGCOMPLETES(arr) { | |
//declare the array that will be used to get the average | |
//push 100 to the array if the field is 'complete' and 0 to the array if the field is 'incomplete' | |
var averageArray = []; | |
for(i = 0; i < arr[0].length; i++) { | |
if(typeof arr[0][i] === 'string') { | |
if(arr[0][i].toLowerCase() === 'complete') { | |
averageArray.push(100); | |
} else if(arr[0][i].toLowerCase() === 'incomplete') { | |
averageArray.push(50); |
/* Comment out the last line of the analytics code that is given by Google. | |
* This code triggers on page views in angular | |
*/ | |
app.run(['$rootScope', '$location', '$window', function($rootScope, $location, $window) { | |
$rootScope.$on('$routeChangeSuccess', function() { | |
$window.ga('send', 'pageview', {page: $location.url()}); | |
}); | |
}]); |
#Scotch.io Tutorial
Original article found here...
The gulp api is incredibly light containing 4 top level functions. They are
// basic gulpfile.js based on the scotch.io tutorial | |
var gulp = require('gulp'), | |
gulpUtil = require('gulp-util'), | |
jshint = require('gulp-jshint'), | |
sass = require('gulp-sass'), | |
sourcemaps = require('gulp-sourcemaps'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'); | |
/** | |
* Return, rewrite, regrade | |
* | |
* @param {number} The original grade | |
* @param {number} The re-graded assignment | |
* @param {number} The percentage of the regraded assignment to count | |
* @return The curved grade | |
* @customfunction | |
*/ | |
function REGRADEDCURVE(original, newGrade, percentage) { |
/** | |
* Gives you the top 4 values from a range | |
* @param {array} range of numbers to get the top 4 from | |
* @param {number} number of values to return | |
* @return top 4 | |
* @customfunction | |
*/ | |
function GETTOP(gradeRange, topNumber) { | |
var allGrades = gradeRange.reduce(function(a,b) { | |
// flatten the multidimensional array into a single array |