Skip to content

Instantly share code, notes, and snippets.

View peterkappus's full-sized avatar

Peter Kappus peterkappus

View GitHub Profile
@peterkappus
peterkappus / names.txt
Created June 6, 2016 14:46
Popular given names from around the world. Taken from https://en.wikipedia.org/wiki/List_of_most_popular_given_names in June 2016
Aada
Aadya
Aaliyah
Aaradhya
Aarav
Aaron
Aasha
Abbas
Abbie
Abdallah
@peterkappus
peterkappus / data_copy.js
Created June 20, 2016 15:45
Google Sheets script for copying data between sheets.
function copyValues(source_name,dest_name,range_name) {
// Get Spreadsheets
var key = "<YOUR_SPREADSHEET_KEY>";
var source_sheet = SpreadsheetApp.openById(key).getSheetByName(source_name);
var target_sheet = SpreadsheetApp.openById(key).getSheetByName(dest_name);
var lastRow = source_sheet.getLastRow();
// Set Ranges
@peterkappus
peterkappus / omniauth-weekdone.rb
Last active June 21, 2016 20:59
A draft OmniAuth strategy for WeekDone.
#A draft OmniAuth Strategy for Weekdone
#TODO: Write some tests
#TODO: Package as a gem and submit for addition to the strategy list https://github.com/intridea/omniauth/wiki/List-of-Strategies
#See the contribution guide: https://github.com/intridea/omniauth/wiki/Strategy-Contribution-Guide
require 'omniauth-oauth2'
require 'omniauth'
module OmniAuth
module Strategies
@peterkappus
peterkappus / weekdone-rest-client.rb
Last active June 21, 2016 21:30
A draft ruby wrapper for the WeekDone REST API
class WeekDoneClient
require 'rest-client'
# Initializes a new client object
#
# @param token [String] The auth token
# @return WeekDoneClient
def initialize(token)
@token = token
end
@peterkappus
peterkappus / weekdone-sinatra.rb
Created June 21, 2016 21:39
A demo WeekDone omniauth strategy and REST client in a sinatra app.
require 'sinatra'
#require 'pry'
require 'omniauth-oauth2'
require 'omniauth'
module OmniAuth
module Strategies
class WeekDone < OmniAuth::Strategies::OAuth2
@peterkappus
peterkappus / Google Spreadsheet Cheats.md
Created July 8, 2016 13:33
Some handy tidbits for working with Google Spreadsheets

Select rows within a date range using an import range statement.

=query(importrange("https://docs.google.com/spreadsheets/d/<PEOPLE_DATABASE>/edit#gid=1208515556","CS People Database!A:Z"),"SELECT * WHERE Col6 = TRUE AND Col14 > date '" & text(E1,"yyyy-MM-dd") &"' AND Col14 < date '" & text(G1,"yyyy-MM-dd") &"' Order by Col14")
@peterkappus
peterkappus / iterm_profile.json
Last active December 31, 2016 15:31
Setting up my Macbook Air
{
"Guid" : "535EDCAD-1190-4EA2-840A-B79A37561292",
"Tags" : [
],
"Ansi 12 Color" : {
"Blue Component" : "0.8117647",
"Green Component" : "0.6235294",
"Red Component" : "0.4470588"
},
@peterkappus
peterkappus / backup.rb
Created July 10, 2016 22:00
A backup script to backup various things to my USB Drive
#!/usr/bin/ruby
#copy ~/Library/keychain
#for testing
rsync_flags = "avzn --delete"
#for real...
#--delete => delete files which don't exist in the source
rsync_flags = "avz --delete"
@peterkappus
peterkappus / updateActuals.gs
Created August 25, 2016 12:50
Hunt for finance actuals in the source sheet, process, re-format, and save to destination actuals sheet.
var source_sheet_doc = SpreadsheetApp.openById("XXXXX");
var destination_doc = SpreadsheetApp.openById("XXXXXX");
// How many months of actuals do we have?
// NOTE: Update this monthly as new actuals are available.
var months_of_actuals = 4;
// which column should we search for the trigger?
// NOTE: if the finance sheet changes, update this
var SEARCH_COLUMN_INDEX = 3;
@peterkappus
peterkappus / publishDataToSheets.gs
Last active August 25, 2016 13:54
Loop through a list of sheet URLs and publish data from a central sheet into new tabs on each child sheet.
/*
Copy ALL finance actuals to each team forecast sheet so they can be used to show actuals in graphs, etc and assist forecasting.
*/
//source actuals sheet (from our Report master)
var source_sheet_doc = SpreadsheetApp.openById("XXXXXXX");