Skip to content

Instantly share code, notes, and snippets.

View jmccaffrey's full-sized avatar

John McCaffrey jmccaffrey

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@jmccaffrey
jmccaffrey / notes.md
Last active April 1, 2016 20:34
simple_calendar_demo_on_runnable
# there is an alternate way of doing this http://www.neverstopbuilding.com/gitpro
# prompt coloring
source ~/.git-completion.sh
#bash and rvm
function __git_dirty {
@jmccaffrey
jmccaffrey / Notes
Last active January 28, 2016 23:15
Thinkful Unit 2 Lesson 4 instructions
in Step 2 you download a file called dvdrental.zip
It might not be clear that you need to also do
'createuser -s postgres'
and
psql -U postgres
CREATE DATABASE dvdrental;
Step 3: 'Type the following command: unzip dvdrental.tar' should say 'unzip dvdrental.zip'
@jmccaffrey
jmccaffrey / index.html
Created February 19, 2013 23:08
A CodePen by Wendy Thompson.
<DOCTYPE! html>
<html lang="en">
<head>
<meta charset="utf-8">
<title="blue-dribbble">
<link rel="stylesheet" href="css/blue-styles.css">
</head>
<body>
@jmccaffrey
jmccaffrey / index.html
Created February 19, 2013 23:08
A CodePen by Wendy Thompson.
<DOCTYPE! html>
<html lang="en">
<head>
<meta charset="utf-8">
<title="blue-dribbble">
<link rel="stylesheet" href="css/blue-styles.css">
</head>
<body>
@jmccaffrey
jmccaffrey / yml_security_test.rb
Last active January 15, 2016 11:48
Simple Rails security test for CVE-2013-0156
#you can copy this into IRB or just run it as a file
require "net/http"
require "uri"
# require "net/https" # for testing ssl
url = "http://localhost:3000/login"
yaml = %{ --- !ruby/object:Time {} }
xml = %{<?xml version="1.0" encoding="UTF-8"?><foo type="yaml">#{yaml}</foo>}.strip
@jmccaffrey
jmccaffrey / notes.rb
Created November 15, 2012 22:55
Upgrading a rails 2.3.5 app from aspen to cedar
These are my notes while updating a sample app from aspen to cedar.
The app is just a demonstration of using formtastic with haml, and getting it to work on heroku.
heroku plugins:install https://github.com/heroku/heroku-aspen-migrate
Could not initialize heroku-aspen-migrate: no such file to load -- heroku/client/pgbackups
Are you attempting to install a Rails plugin? If so, use the following:
@jmccaffrey
jmccaffrey / freshbooks_hours_total_script.js
Created October 5, 2011 16:11
jquery script to calculate total number of billable and non-billable hours for Freshbooks invoices
//take this script and place it in your firebug or javascript console (when you are on the invoice edit page)
//it will segment billable and non-billable (0.00) and total them up (could be improved to group by rate)
var total=0;
function add_them(index, e){
var num = parseFloat($(e).val());
if (!isNaN(num)) {
total += num;
}
}
SELECT
t.TABLE_SCHEMA
, t.TABLE_NAME
, s.INDEX_NAME
, s.COLUMN_NAME
, s.SEQ_IN_INDEX
, (
SELECT MAX(SEQ_IN_INDEX)
FROM INFORMATION_SCHEMA.STATISTICS s2
WHERE s.TABLE_SCHEMA = s2.TABLE_SCHEMA