Skip to content

Instantly share code, notes, and snippets.

View rheajt's full-sized avatar
🏠
Working from home

jordan rhea rheajt

🏠
Working from home
View GitHub Profile
@rheajt
rheajt / add-new.js
Created December 8, 2015 06:56
jquery add new input box with click
//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) {
@rheajt
rheajt / readme.md
Created January 21, 2016 10:13
scotch.io tutorial about using gulp.js

#Scotch.io Tutorial

Original article found here...

The gulp api is incredibly light containing 4 top level functions. They are

  1. gulp.task
  2. gulp.src
  3. gulp.dest
  4. gulp.watch
@rheajt
rheajt / getTags.gs
Created February 24, 2016 07:35
parent-teacher conference helper
function getAvailableTags() {
var data = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Gradesheet').getDataRange().getValues();
var headers = 1; // number of header rows to skip at top
var studentNumber = 0; // column # (0-based) containing tag
var firstName = 1;
var lastName = 2;
var availableTags = [];
for (var row = headers; row < data.length; row++) {
@rheajt
rheajt / gulpfile.js
Created March 2, 2016 15:37
scotch.io tutorial on using gulp
// 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');
@rheajt
rheajt / gulpfile.js
Created May 31, 2016 20:04
basic gulpfile
//My first attempt at creating a gulpfile.
//npm install --save-dev gulp gulp-connect gulp-sass gulp-babel babel-preset-react babel-preset-es2015
//run with 'gulp'
var gulp = require('gulp'),
connect = require('gulp-connect'),
babel = require('gulp-babel'),
sass = require('gulp-sass');
gulp.task('default', ['babel', 'sass', 'connect', 'watch']);
/**
* 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
@rheajt
rheajt / Code.gs
Last active July 5, 2016 15:33
kern viewer
function onOpen() {
SpreadsheetApp.getUi()
.createAddonMenu()
.addItem('KERNView', 'openKernView')
.addToUi();
}
function onInstall() {
onOpen();
}
@rheajt
rheajt / README.md
Last active July 7, 2016 16:51
a simple way to turn your google sheet into a json object

Turn your Google Sheet into a JSONP service

  1. Copy the above code into the script editor
  2. Replace 'SHEET_ID_TO_SERVE' with the key to the sheet you are trying to serve as JSON
  3. Deploy as a web application
  4. Copy the URL that is created
  5. At the end of the URL add '?prefix=?'
  6. Enjoy your new API!

I hope this is detailed enough description. If you are questions/comments/suggestions hit me up on twitter @rheajt

function Caesarize(shiftNum) {
this.shiftNum = shiftNum; //the number to shift the alphabet
}
Caesarize.prototype.codify = function(sentence) {
var sentenceArr = [];
var shiftNum = this.shiftNum;
sentence = sentence.toLowerCase();