Skip to content

Instantly share code, notes, and snippets.

View taylor's full-sized avatar
🐢
🌊

Taylor Carpenter taylor

🐢
🌊
View GitHub Profile
' Copyright (c) 2007, Tony Ivanov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
# ====== TODAY'S KATA:
# * create an Achievements API
# * create an Achievement model, a User model, and a db table for many-many relationship between the two
# * now, write the Goliath+Grape code to create 3 endpoints:
# * 1. an endpoint to SHOW an Achievement (GET /v1/achievements/1)
# * 2. an endpoint to SHOW a User (GET /v1/users/1)
# * 3. an endpoint to GRANT an Achievement to a user (???)
# EXAMPLE GEMFILE THAT SHOULD WORK:
#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
#!/usr/bin/env ruby
# Require gems with versions
begin
require 'logger'
require 'rubygems'
gem 'fog', '~> 0.6.0'
gem 'trollop', '~> 1.16.2'
require 'fog'; require 'trollop'
@taylor
taylor / gist:4076083
Created November 15, 2012 01:37 — forked from anonymous/gist:4057537
Watch udev events and configure shit that should be automatically configured in the first place.
#!/bin/sh
config_input() {
setxkbmap -option ctrl:nocaps
dev="TPPS/2 IBM TrackPoint"
xinput --set-prop "$dev" "Evdev Wheel Emulation" 1
xinput --set-prop "$dev" "Evdev Wheel Emulation Button" 2
xinput --set-int-prop "$dev" "Evdev Wheel Emulation Axes" 8 6 7 4 5
}
@taylor
taylor / gist:4057678
Created November 12, 2012 05:33 — forked from anonymous/gist:4057537
Watch udev events and configure shit that should be automatically configured in the first place.
#!/bin/sh
config_input() {
setxkbmap -option ctrl:nocaps
dev="TPPS/2 IBM TrackPoint"
xinput --set-prop "$dev" "Evdev Wheel Emulation" 1
xinput --set-prop "$dev" "Evdev Wheel Emulation Button" 2
xinput --set-int-prop "$dev" "Evdev Wheel Emulation Axes" 8 6 7 4 5
}
@taylor
taylor / rc.lua
Created November 9, 2012 12:04 — forked from anonymous/rc.lua
require('awful')
require('awful.autofocus')
require('awful.rules')
require('beautiful')
require('naughty')
require('obvious.battery')
require('debian.menu')
beautiful.init('.config/awesome/themes/custom/theme.lua')
@taylor
taylor / gist:3999603
Created November 2, 2012 09:00 — forked from ehlertij/gist:2897482
Chef recipes: proxy_up, proxy_down, haproxy_add, haproxy_remove
######################
# proxy_up.sh.erb
#!/bin/bash
echo 'Starting emproxy...'
sudo monit start all -g emproxy_ngin
echo 'Sleeping for 5s before reloading haproxy...'
sleep 5
echo 'Reloading haproxy...'
/data/ngin/shared/bin/haproxy_remove
db = rds.create_db_instance(
:db_instance_identifier => "[FILTERED]",
:allocated_storage => 100,
:db_instance_class => "db.m1.small",
:engine => "MySQL5.1",
:master_username => '[FILTERED]',
:master_user_password => '[FILTERED]',
:db_name => '[FILTERED]',
:availability_zone => 'us-east-1c'
)
@taylor
taylor / gist:3803103
Created September 29, 2012 03:54 — forked from weavejester/gist:1001206
Clojure on Heroku
~/$ lein new ring-on-heroku
Created new project in: /home/jim/Development/ring-on-heroku
~/$ cd ring-on-heroku
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj
(ns ring-on-heroku.core
(:use ring.util.response
ring.adapter.jetty))
(defn app [req]