This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WeekDoneClient | |
require 'rest-client' | |
# Initializes a new client object | |
# | |
# @param token [String] The auth token | |
# @return WeekDoneClient | |
def initialize(token) | |
@token = token | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aada | |
Aadya | |
Aaliyah | |
Aaradhya | |
Aarav | |
Aaron | |
Aasha | |
Abbas | |
Abbie | |
Abdallah |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#usage: ruby build... [INPUT_FILE] | |
#what it does: makes a folder named after the input file and builds the necessary versions for S6 | |
#requirements: rsvg-convert to rasterise the SVG and imagemagick to make the versions | |
file = ARGV[0] or abort ("No input file specified.") | |
big_width = 6500 | |
basename = File::basename(file,".svg") | |
Dir::mkdir(basename,0700) unless File.exists? basename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body xonload="convert()"> | |
<script language="javascript"> | |
function convert(){ | |
source_rows = document.getElementById('raw_input').value.split("\n") | |
headers = source_rows.shift().split("\t"); | |
//rows now contains only data | |
data = [] | |
for(i in source_rows){ | |
interim_row_data = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What: Turn a multi-column CSV file into the nested "flare.json" structure required by D3 for a collapsible tree diagram like this: https://bl.ocks.org/mbostock/4339083 | |
# I couldn't find a generic way to do this so I wrote this script. Help & comments welcome! | |
# How: Nested hashes group the data. Then a recurive function builds a new hash with the correct format for the JSON. | |
# Caveats: Currently supports up to 4 levels/columns of depth | |
# TODO: make it generically support n-levels | |
# Who: Peter Kappus (http://kapp.us) | |
# CSV Format: | |
# Create a CSV called "data.csv" with any headers you like. It might look like this: | |
# group_name, team_name, person_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#my rails 4 gemfile with | |
#bootstrap | |
#sass | |
#postgresql | |
#slim templates | |
#puma | |
#blahblahblah :) | |
#for heroku, make a Procfile like so: | |
# web: bundle exec rails server -p $PORT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#handy bash functions to easily add things to text files | |
#todo list | |
td() { echo $@ >> /path/to/your/todo.txt; } | |
#log (with date time stamp) | |
log() { echo $(date) $@ >> /path/to/your/log.txt;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Fix those annoying "invalid byte sequence in UTF-8" errors when parsing CSVs, etc. | |
#prints to STDOUT where you can redirect to a new file, etc. | |
#NOTE: this just strips out invalid/undef characters which may be a Very Bad Thing™ - YMMV | |
#suggestions welcome... | |
#also fix annoying newlin chars created by excel... replace \r with \r (weird but works) | |
input_file = ARGV[0] or raise "No input file specified" | |
puts IO.read(input_file).encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/\r/,"\r") |