Skip to content

Instantly share code, notes, and snippets.

View milesmatthias's full-sized avatar

Miles Matthias milesmatthias

View GitHub Profile
@milesmatthias
milesmatthias / static.rake
Created April 29, 2014 20:17
part of a rake task to create an index and thank you page from given title and primary color
desc "given a name and primary color, build static index and thank you pages, returning directory path of files"
task :build, :site_id, :name, :primary_color do |t, args|
dirname = DateTime.now.to_s
dirname += '_' + args[:site_id] if args[:site_id].length > 0
dirpath = Rails.root.join("tmp/static_builds", dirname)
system("mkdir -p #{ dirpath.to_path }")
system("cp -r #{ Rails.root }/static/* #{ dirpath.to_path }")
puts("name = #{ args[:name] }")
@milesmatthias
milesmatthias / a.rb
Created May 16, 2014 20:10 — forked from ahoward/a.rb
# make this script run, update your gist with the running script, and it's
# output in a separate gist. the entire quzi should take 1-3 minutes, but you
# get 5.
#
# the meat - take < 5 minutes to do this
#
assert :hash do
x = {}
@milesmatthias
milesmatthias / headline_service.js.erb
Created June 10, 2014 13:52
AngularJS with Rails JSONP API
angular.module('app')
.factory('HeadlineService', ['$http',
function($http) {
'use strict';
var BASE_URL = "<%= [App.settings.api_base_url, '/services/headlines'].join %>",
CALLBACK_STRING = "?callback=JSON_CALLBACK";
return {
getHeadlines: function(){
@milesmatthias
milesmatthias / application.html.slim
Created July 18, 2014 01:23
Mobile detection on CloudFront
doctype html
head
= render partial: 'shared/mobile_detection'
javascript:
var device_cookie = cookie.get('device'),
cookiesEnabled = cookie.enabled();
@milesmatthias
milesmatthias / number_episodes.rb
Created October 5, 2014 23:22
A short ruby script I wrote to quicken the process of prefixing episodes with numbers on an external hard drive.
#!/usr/bin/env ruby
require 'pry'
require 'fileutils'
EPISODES = [
nil,
nil,
nil,
"My Happy Place.mov",
@milesmatthias
milesmatthias / mv_contents_up.rb
Created October 6, 2014 00:02
short ruby script used to move movies in a file structure created by itunes into a flat structure
#!/usr/bin/env ruby
# for each directory in the current directory:
#
# 1. move its contents up one directory (out of its current directory)
# 2. remove the (now empty) directory
#
# ( note: skips hidden files and . and .. )
require 'pry'
@milesmatthias
milesmatthias / slides.md.txt
Last active August 29, 2015 14:07
slides for intro_to_command_line gdi boulder (using mdp) (http://bit.ly/clgdi)
%title: intro_to_command_line
%author: milesmatthias.com
%date: 2014-09-21
# GDI upcoming events
#### Code &amp; Coffee
October 18th. 10a - 1p
Amante Coffee Baseline - Boulder
@milesmatthias
milesmatthias / invalidate_cf.rb
Created November 13, 2014 18:44
simple ruby script to invalidate cloudfront objects. requires having the aws gem installed.
#!/usr/bin/env ruby
##
# usage: AWS_SECRET_KEY=xxx AWS_ACCESS_KEY=xxx CF_DIST_ID=xxx ./invalidate_cf.rb file1.html file2.html
#
#
require 'aws'
require 'date'
require 'pry'
@milesmatthias
milesmatthias / remove_s3_object.rb
Created November 13, 2014 19:25
simple ruby script to remove an object from s3. requires having the aws gem installed.
#!/usr/bin/env ruby
##
# usage: AWS_SECRET_KEY=xxx AWS_ACCESS_KEY=xxx S3_BUCKET_NAME=xxx ./remove_s3_object.rb file1.html file2.html
#
#
require 'aws'
require 'pry'
@milesmatthias
milesmatthias / events.md
Last active August 29, 2015 14:20
Boulder Startup Week Development Track

Infrastructure & Architecture Design

Monday, 3:30pm - 4:30pm @ Boomtown;

With all of the powerful cloud services out there nowadays, it's more important than ever to give good thought about architecture when building your applications. This event has 3 awesome speakers who have experience in architecture design and will share their expertise and answer your questions about how to decide what infrastructure tools to use on your next project.

Dev Happy Hour

Tuesday, 4pm - 5pm @ Lyfe Kitchen