Skip to content

Instantly share code, notes, and snippets.

View mckelvaney's full-sized avatar

Michael McKelvaney mckelvaney

View GitHub Profile
@mckelvaney
mckelvaney / airtable_schedule_conflict_script
Created February 28, 2020 00:52 — forked from jmoglesby/airtable_schedule_conflict_script
This is a script written to aid in detecting scheduling conflicts in Airtable's "Event planning" template base, and with a Script Block
/*
Script: Check for Speaker Schedule Conflicts
Author: Jeremy Oglesby
This script was written to be used with the "Event planning"
Airtable template, and can be adapted to any similarly
structured base where the requirement to detect overlapping
start and end times is pressing.
When scheduling large Programs with many individual events
@mckelvaney
mckelvaney / icalendar.rb
Created September 17, 2019 11:41 — forked from dcparker/icalendar.rb
ICAL file parser in Ruby
require 'net/http'
require 'uri'
require 'time'
class Time
def self.gcalschema(tzid) # We may not be handling Time Zones in the best way...
tzid =~ /(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z/ ? # yyyymmddThhmmss
# Strange, sometimes it's 4 hours ahead, sometimes 4 hours behind. Need to figure out the timezone piece of ical.
# Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") - 4*60*60 :
Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") :
@mckelvaney
mckelvaney / config.rb
Created November 8, 2018 23:05
Loading environment specific config files in Sinatra
config_file = File.expand_path(File.join('config', 'environments', "#{Sinatra::Base.environment}.rb"))
require config_file
@mckelvaney
mckelvaney / README.md
Created June 19, 2018 16:25 — forked from MarkMurphy/README.md
Rails resumable uploads

Uploads large files in multiple chunks. Also has the ability to resume if the upload is interrupted.

Typical usage:

  1. Send a POST request to /upload with the first chunk of the file and receive an upload id in return.
  2. Repeatedly PATCH subsequent chunks using the upload id to identify the upload in progress and an offset representing the number of bytes transferred so far.
  3. After each chunk has been uploaded, the server returns a new offset representing the total amount transferred.
  4. After the last chunk commit the upload by passing its id to another endpoint such as POST /upload/commit/:id:
@mckelvaney
mckelvaney / intercom-delete-old-users.js
Created January 25, 2018 11:13 — forked from zthomas/intercom-delete-old-users.js
Script to delete and clear old users from intercom. Useful for lowering the monthly bill
// License: MIT, feel free to use it!
const Intercom = require('intercom-client');
const appId = 'APP_ID'
const apiKey = 'APP_KEY'
const client = new Intercom.Client(appId, apiKey);
const async = require('async-q')
//REF: https://developers.intercom.com/reference#iterating-over-all-users
//WARNING: you can only have one scroll working at once. you need to wait for that scroll to clear to try again
@mckelvaney
mckelvaney / config.ru
Created January 29, 2016 15:15
Heroku config for Jekyll site
require 'rack'
require 'rack/contrib/try_static'
require 'rack/jekyll'
# Use basic auth for the site — be sure to change ['username', 'password'] to something secure
use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ['username', 'password']
end
# Use Rack::TryStatic otherwise the pretty URLs won't work for the Jekyll structure
@mckelvaney
mckelvaney / config.ru
Created January 29, 2016 15:05
Password protect Rack app on Heroku
require 'rack'
# Change the ['admin', 'admin'] to something more secure :wink:
use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ['admin', 'admin']
end
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip

Keybase proof

I hereby claim:

  • I am mckelvaney on github.
  • I am mckelvaney (https://keybase.io/mckelvaney) on keybase.
  • I have a public key whose fingerprint is E437 AC70 F8B2 7301 074A D47D B756 E1C4 45D6 C1EC

To claim this, I am signing this object:

@mckelvaney
mckelvaney / gist:52a07bba0d7582576fa8
Created March 5, 2015 10:58
Update CA certs in ubuntu
sudo update-ca-certificates --fresh