Skip to content

Instantly share code, notes, and snippets.

View gchristofferson's full-sized avatar
👍
Working on something great

Gregg Christofferson gchristofferson

👍
Working on something great
  • Windsor California
View GitHub Profile
@gchristofferson
gchristofferson / cbl.js
Last active October 13, 2017 07:27 — forked from patt0/cbl.js
ContinuousBatchLibrary is a Google Apps Script library that manages large batches and works around the 5 minute limitation of GAS execution. It does this by setting time based triggers in the future as well as memorising the last processed key in the batch in order to restart from the correct position. At the end of the batch a cleanup function …
/**
* --- Continous Execution Library ---
*
* Copyright (c) 2013 Patrick Martinent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@gchristofferson
gchristofferson / minify-liquid.html
Created December 26, 2017 20:43 — forked from sskylar/minify-liquid.html
Simple HTML minify with Liquid/Siteleaf. Strips all line breaks, tabs, and extra spaces.
{% capture html %}
<html>
...
</html>
{% endcapture %}{{ html | strip_newlines | replace:' ','' | replace:' ','' | replace:' ',' ' }}
//I have to charCodeAt str i indexOf then add 13. then string from charCode using new number?
function rot13(str) { // LBH QVQ VG!
var array = str.split(" ");
var key = ["A","B","C","D","E","F",
"G","H","I","J","K","L",
"M","N","O","P","Q","R",
"S","T","U","V","W","X",
"Y","Z"];
var key1 = {
"A": [0],
@gchristofferson
gchristofferson / gist:52152917b5b279958838b958a081adf5
Created July 16, 2018 18:27 — forked from peterherrmann/gist:2700284
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
/**
* Invokes a function, performing up to 5 retries with exponential backoff.
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of
* about 32 seconds before it gives up and rethrows the last error.
* See: https://developers.google.com/google-apps/documents-list/#implementing_exponential_backoff
* <br>Author: peter.herrmann@gmail.com (Peter Herrmann)
<h3>Examples:</h3>
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email
var example1 = GASRetry.call(function(){return "Hello, " + Session.getActiveUser().getEmail();});
</pre><pre>//Calls an existing function
@gchristofferson
gchristofferson / mario.c
Created October 22, 2018 21:41
C program from course work that takes number of rows as input and prints a pyramid with that number of rows.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
@gchristofferson
gchristofferson / credit.c
Created October 22, 2018 21:42
C program from course work that validates a credit card number
#include <stdio.h>
#include <cs50.h>
#include <string.h>
int main(void)
@gchristofferson
gchristofferson / caesar.c
Last active October 22, 2018 21:56
C program "caesar's cipher" for course work
// This program encrypts a message using Caesar's cipher
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
@gchristofferson
gchristofferson / crack.c
Created October 22, 2018 21:57
This program takes a password hash from command line, then generates every possible 5 letter password combination using upper and lowercase letters, then uses crypt() to hash the generated word, and finally compares the hash to the user hash input from command line. If they match, password has been cracked.
/*-- This program takes a password hash from command line, then generates
every possible 5 letter password combination using upper and lowercase
letters, then uses crypt() to hash the generated word, and finally compares the hash
to the user hash input from command line. If they match, password has been cracked --*/
#define _XOPEN_SOURCE
@gchristofferson
gchristofferson / helpers.c
Created October 22, 2018 22:01
Course work helper functions for a music program that produced a music file from a separate file that contained the notes of the song.
// Helper functions for music
#include <cs50.h>
#include <math.h>
#include <stdio.h>