Skip to content

Instantly share code, notes, and snippets.

View kfitzpatrick's full-sized avatar

Kevin Fitzpatrick kfitzpatrick

  • Forj
  • Berkeley, CA, USA
  • 16:00 (UTC -07:00)
View GitHub Profile
Example 1:
function add(oneNumber, anotherNumber){
return (oneNumber + anotherNumber);
}
add(3,4);
-----------
#####################################
jasmine_fixtures_test_helper.rb - Include in lib/
#####################################
class ActionController::TestCase
def self.save_fixture(fixtures, &expectations)
fixtures.each do |(fixture_name, selector)|
should "save the content of the selector #{selector} to fixture file #{fixture_name}.html" do
@kfitzpatrick
kfitzpatrick / Temptest
Created January 26, 2011 20:51
Testing markdown
# heading 1
## heading 2
@kfitzpatrick
kfitzpatrick / gist:944901
Created April 27, 2011 18:43
Crappy install of postgres, but it totally works
#!/bin/bash
# This is only for development machines. Probably could be made a lot better.
sudo brew update
sudo chown -R pivotal /usr/local
# blow away default image's data directory
rm -rf /usr/local/var/postgres
@kfitzpatrick
kfitzpatrick / Page Behaviors
Created April 29, 2011 21:47 — forked from mdowning/Page Behaviors
Page Behaviors Spec
describe("Page Behaviors", function () {
beforeEach(function() {
spyOn(window, "alert").andCallFake(function() {
});
});
describe("given a page behavior", function () {
beforeEach(function() {
BehaviorMap['.foo'] = function() {
alert("The Pentagon!");
@kfitzpatrick
kfitzpatrick / gist:1057177
Created June 30, 2011 20:38
A JavaScript directory structure

Directory Structure

/project
  /public
    /javascripts
      /app
        project_library.js
      /lib
        general_lib_you_made.js

/vendor

@kfitzpatrick
kfitzpatrick / .gitconfig
Created November 14, 2011 17:36
Project files fun
[alias]
st = status
co = checkout
br = branch
ci = commit
pp = !git pull && git push
@kfitzpatrick
kfitzpatrick / ci.yml
Created November 18, 2011 00:07
Sample lobot config
---
app_name: foo-app-name
app_user: ci
git_location: git@github.com:foo/project.git
basic_auth:
- username: ci
password: ci
credentials:
aws_access_key_id: AAABBBCCCC
aws_secret_access_key: xyzxyzxyz
@kfitzpatrick
kfitzpatrick / gist:7c6f44cf9d5bd897406d
Created July 15, 2014 18:11
Downloading Papertrail logs on a Mac
# where d is how many days you want
# where h is how many hours you want
for d in $(seq 0 1); do for h in $(seq 0 1); do \
dt=$(echo `date -u -v-${d}d +%Y-%m-%d`-`printf %02d $h`);\
curl --progress-bar -f --no-include -o $dt.tsv.gz -L -H "X-Papertrail-Token: YOUR HTTP API KEY" https://papertrailapp.com/api/v1/archives/$dt/download;\
done done
@kfitzpatrick
kfitzpatrick / add-datasource.sh
Last active October 2, 2017 09:39
Adding a grafana datasource via curl not working
# First login
curl -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"user":"admin","email":"","password":"admin"}' --cookie-jar ~/foo 'http://localhost:3000/login'
# Response is {"message":"Logged in"}.
###
# This creates a cookie jar file in ~/foo like the following:
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.