Skip to content

Instantly share code, notes, and snippets.

View dummied's full-sized avatar

Chris Vannoy dummied

View GitHub Profile
@dummied
dummied / gist:da5fd51970b42b1000ca
Created July 1, 2015 15:56
Week 1, Day 2 Homework review
# Create an array of all of the students in our class. Assign it to a variable named "our_class".
our_class = ["Caleb", "Andrew", "Alec", "Maggie", "Danny", "Dallie", "Emanuel", "Shane", "Pete", "Joe", "Tad"]
# Find all the students whose first name is less than 5 characters
our_class.select{|student| student.length < 5}
# Turn a sentence into an Array, and select the words that are four characters long.
class Person
attr_accessor :height,
:name,
:weight,
:eye_color,
:number_of_arms,
:number_of_legs,
:age,
:number_of_eyes
@dummied
dummied / app.rb
Created April 9, 2015 00:40
indy.rb Notes API in Sinatra
require 'bundler/setup'
require 'sinatra'
require 'mongoid'
require 'json'
Mongoid.load!("./mongoid.yml")
before do
content_type :json
end
@dummied
dummied / gist:c9ebf6d316d0e24c3e03
Created January 23, 2015 17:32
Client Documentation CMS requirements

Here's what I have in mind:

  • Individual logins limited to particular client account. No need for deeper authorization past that. Account, has_many Users
  • Table of contents listing related documents, with last-updated timestamp
  • Ability to download (styled) PDF version of the current document state
  • Full-text Search
  • Email notifications for account creation, document creation and document update
  • Branding per account and overall (logo, colors)

Nice to have:

@dummied
dummied / example.rb
Created October 21, 2014 18:01
Example controller action to ping Google Analytics on a direct file download
require "uri"
require "net/http"
def download
tracking_params =
{
v: 1,
t: 'event',
ec: 'testing',
el: 'direct',
@dummied
dummied / controller.rb
Last active August 29, 2015 14:07
Example Rails controller action to send a ping to Google Analytics on a file download
require "uri"
require "net/http"
def download
our_params = {v: 1, t: 'event', ec: 'testing', el: 'direct', ea: 'download', tid: GA_TRACKING_ID}
our_params[:uip] = request.fullpath
our_params[:dr] = request.headers["HTTP_REFERER"]
our_params[:cid] = request.uuid
our_params[:dl] = request.original_url
our_params[:ua] = request.headers["User-Agent"]
@dummied
dummied / gist:11144802
Created April 21, 2014 14:46
Slap-dash notes from Mig Reyes' talk at re:build 2014

re:build 2014: All the Wrong Things

Presenter: [Mig Reyes][2409-001]

  • Working for [Basecamp][2409-002], previously worked for [Threadless][2409-003]. Also a teacher
  • We think of speakers as experts.
  • "I'm probably an expert at not being an expert."
  • There are all these titles ... What the fuck? Is this industry playing a joke on us?"
  • At the end of the day, we're all web makers
  • Rip up your business cards. We end up doing the work we do because our business cards say that's what we should be doing.
@dummied
dummied / gist:10687406
Created April 14, 2014 22:31
Better Schrödinger joke

Schrödinger and Heisenberg are driving from Vegas to California when a cop pulls them over.

Officer: Do you know how fast you were going?

Heisenberg: No, but we knew where we were.

Officer: Did you know you have a dead cat in the trunk?

Schrödinger: Well, now we do.

@font-face {
font-family:'wf_SegoeUILight';
src:url('http://i.s-microsoft.com/fonts/Segoe-UI/West-European/Light/latest.eot');
src:local("Segoe UI Light"),local("Segoe WP Light"),url('http://i.s-microsoft.com/fonts/Segoe-UI/West-European/Light/latest.eot?#iefix')
format('embedded-opentype'),url('http://i.s-microsoft.com/fonts/Segoe-UI/West-European/Light/latest.woff')
format('woff'),url('http://i.s-microsoft.com/fonts/Segoe-UI/West-European/Light/latest.ttf')
format('truetype'),url('http://i.s-microsoft.com/fonts/Segoe-UI/West-European/Light/latest.svg#web')
format('svg');
font-weight:normal;
font-style: normal;
@dummied
dummied / gist:8924334
Created February 10, 2014 21:14
Short little bash script that I use in TextExpander (abbr = llink) to paste a link without all the utm_ crap.
#!/bin/bash
pbpaste | ruby -e "puts gets.gsub(/(|\/)((|\?|&)utm(|_)\S+(&|\z))/, '').strip"