This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Properties | |
def property(property_name) | |
define_method(property_name) do | |
instance_variable_get("@#{property_name}".to_sym) | |
end | |
define_method("#{property_name}=".to_sym) do |value| | |
instance_variable_set("@#{property_name}".to_sym, value) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require 'properties' | |
class PropertiesTest < MiniTest::Unit::TestCase | |
class Foo | |
extend Properties | |
property :bar | |
end | |
def setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest_client' | |
require 'json' | |
class Twitter | |
def initialize(username) | |
@username = username | |
end | |
def timeline | |
raw_json = RestClient.get "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=#{@username}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host: localhost | |
client_id: "4119a135-63cf-4074-bcc5-6e9619b71d55" | |
client_secret: "rhexrhex" | |
additional_properties: | |
authorization_endpoint: "/simpledb-openid-connect-server/authorize" | |
user_info_endpoint: "/simpledb-openid-connect-server/userinfo?schema=openid" | |
token_endpoint: "/simpledb-openid-connect-server/token" | |
jwk_url: "/jwk" | |
issuer: "http://localhost:8080/simpledb-openid-connect-server/" | |
scope: "openid profile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config.ru b/config.ru | |
index 88a4115..d453cc6 100644 | |
--- a/config.ru | |
+++ b/config.ru | |
@@ -7,6 +7,31 @@ require 'warden' | |
require 'warden_omniauth' | |
require 'yaml' | |
+module OpenIDConnect | |
+ class AccessToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'rack/oauth2' | |
require 'json' | |
require 'json/jwt' | |
def client | |
# app id, app secret, and site are all test-env specific | |
Rack::OAuth2::Client.new( | |
:identifier => 'd7633f880b4771b4f91f107a1a27835e', | |
:secret => '40dc03bf175980bccd15df10f9db1aa2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'moped' | |
db = Moped::Session.new(["localhost:27017"]) | |
db.use('foo') | |
wrapped_result = db.command(:aggregate => 'patient_cache', :pipeline => [ | |
{'$unwind' => "$values"}, | |
{'$group' => {'_id' => '$values', 'count' => {"$sum" => 1}}} | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# To enable this hook, rename this file to "pre-commit". | |
PRY_PATTERN="require.+[\'\"]pry[\'\"]|binding\.pry" | |
# Redirect output to stderr. | |
exec 1>&2 | |
if git diff --cached | grep '^\+' | grep -q -E $PRY_PATTERN; then | |
echo "ERROR: There is left over pry stuff in this commit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mdb-schema current_lmrp.mdb postgres | psql lcd | |
mdb-tables -1 current_lmrp.mdb | xargs -Itable sh -c "mdb-export -H current_lmrp.mdb table > newcsv/table.csv" | |
ls newcsv | xargs -I{} sh -c "echo {} | cut -d'.' -f1" | xargs -I{} psql -c "COPY {} from '/Users/andrewg/Downloads/current_lmrp/newcsv/{}.csv' DELIMITER ',' CSV;" lcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://rxnav.nlm.nih.gov/REST/Ndfrt/properties/nui=N0000178444&propertyName=VUID |