Skip to content

Instantly share code, notes, and snippets.

View Brian-Egan's full-sized avatar

Brian Egan Brian-Egan

  • Discovery
  • Washington, DC
View GitHub Profile
@Brian-Egan
Brian-Egan / tweetThreader.gs
Last active December 12, 2018 16:51
Easily turn a long chunk of text into a tweet thread for Twitter in Google Sheets. Copy/paste into Script Editor in Google Sheets.
/*
When an input cell containing text is passed to tweetThread(), the text is broken into tweet-length parts and returned.
Optional "includeNum" will add a (X/Y) to each message in the thread. Enabled by default. Set second parameter to false
to disable
*/
CHARACTER_LIMIT = 280;
function tweetThread(txt, includeNum) {
@Brian-Egan
Brian-Egan / toYaml.gs
Created November 28, 2018 21:52
Google Sheets toYaml() function
// Converts a given range in Google Sheets to YAML text.
function toYaml(range, header_row) {
range = range.filter(function(x) { return x[0] != ''});
header_row = header_row || false;
var yaml_arr = [];
if (header_row == true) {
yaml_arr.push("---");
var headers = range.shift();
range.forEach(function(row) {
var row_arr = [];
@Brian-Egan
Brian-Egan / gradient.rb
Created May 3, 2018 16:39
Generate HEX color gradients of any length from Ruby
# require "awesome_print"
## TO USE:
# 1. Create a new Gradient with the two end colors, and the amount of steps you'd like your gradient to have in between:
# -- i.e. gradient = Gradient.new("ffffff", "#d80015", 5)
# 2. This will print the gradient to the console, and return a Gradient object. The gradient colors are stored as an array, to access them either type `gradient.output` or run `gradient.generate`
# 3. To increase/decrease the number of steps in your gradient, simply run `.generate(steps)` with the new number of steps you'd like to use. i.e. `more_detailed_gradient = gradient.generate(15)`.
@Brian-Egan
Brian-Egan / downloadMultipleMonths.js
Last active April 16, 2018 16:22
Download Multiple Months of Fitbit Data as CSV
// Run this in the browser console on https://www.fitbit.com/export/user/data
// Pre-configured for importing these exports into Garmin Connect (using "Body" and "Activity" data only, and exporting as a CSV.
var i = 0;
document.getElementById("CUSTOM").checked = true; // Set time period to "Custom"
var checkboxes = document.getElementsByClassName("checkboxSpacing");
// Set it to export 'body' and 'activities' metrics. These are the only ones Garmin can import.
for (i in checkboxes) {
@Brian-Egan
Brian-Egan / dabblet.css
Created February 8, 2014 01:42
This is a manifest file that'll be compiled into application.css, which will include all the files
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
@Brian-Egan
Brian-Egan / gist:4012813
Created November 4, 2012 18:10 — forked from chyld/gist:3982139
IWD 4 final project
Final Project:
05 pts: Create new rails app called DinnerTyme
15 pts: Create the model, view and controllers using this screenshot as a reference:
http://grab.by/h9sC
10 pts: Create a home page (index) using a Home controller
10 pts: Create a navigation system (links) at the top of the site