Skip to content

Instantly share code, notes, and snippets.

@Nakort
Nakort / user_handoff.md
Last active January 30, 2017 20:31
User handoff

We will send over a token when the patient requests to see a dermatologist. This token will be used in step 4.

https://www.exampledermatologist.com?token=abcdefg1234567

To interact with MDLIVE’s API you must first obtain a jwt token using a set of credential.

POST https://mdlqa4-api.mdlive.com/auth/auth_token
 
Include in body: 
{
key = Base64.encode64(Random.new.bytes(32))
iv = Base64.encode64(Random.new.bytes(16))
// Javascript example:
// Encrypting
var key = CryptoJS.enc.Base64.parse("X/+3w9RBaEQHp3kJS/haIw8TpHgX03pUkEJoEfdDdhY=")
var iv = CryptoJS.enc.Base64.parse("LHYP7XXgN9KOOoiGw9M7mA==")
encrypted = CryptoJS.AES.encrypt("659-98-0876", key, { iv: iv, mode: CryptoJS.mode.CBC});
(function(){
var config = {
version: '',
apiKey: '',
apiKeyCC: ''
};
Skype.initialize({ apiKey: config.apiKey },
function (api) {
window.skypeWebAppCtor = api.application;
@Nakort
Nakort / ruby2_install_instructions
Created November 6, 2012 22:40
Installing ruby 2.0.0-preview1 with Homebrew in MacOsX
brew update
brew install libyaml
brew install openssl
rvm get head
rvm reinstall 2.0.0-preview1 --with-openssl-dir=`brew --prefix openssl` --with-gcc=clang
@Nakort
Nakort / gist:3939723
Created October 23, 2012 16:09
get_stats for a district in clever
require 'net/https'
require 'json'
def get_resource(url)
uri = URI("https://api.getclever.com#{url}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth('DEMO_KEY','')
class TipoUsuario < ActiveRecord::Base
has_many :usuarios
end
class Usuario < AcitveRecord::Base
belongs_to :tipo_usuario
end
ti_usuario = TipoUsuario.create!
usrio = Usuario.new
@Nakort
Nakort / soft_destroy.rb
Created October 16, 2011 15:12
Soft destroy library
# Place this in your lib folder
# Include it in your model
# Add a migration with a deleted_at timestamp column for that model
# and voila your records are now logically destroyed.
#
module SoftDestroy
extend ActiveSupport::Concern
included do
@Nakort
Nakort / dynamic_routes.rb
Created September 18, 2011 22:34
Writing code that generates code
[:saved_checkins, :invalid_checkins].each do |name|
controller name do
scope :path => name do
match "/", :action => "index", :as => name
match "/:id", :action => "destroy", :as => name.to_s.singularize, :via => :delete
match "/:id", :action => "create", :as => name.to_s.singularize, :via => :post
match "/:id", :action => "show", :as => name.to_s.singularize, :via => :get
end
end
end
@Nakort
Nakort / utilities.js.coffee
Created September 16, 2011 17:45
My First CoffeeScript
String.prototype.capitalize = ->
return @charAt(0).toUpperCase() + @slice(1)
window.remove_fields = (link) ->
($ link).prev("input[type='hidden']").val 1
($ link).parent.hide
window.add_fields = (link, association, content) ->
new_id = new Date().getTime
regexp = new RegExp("new_" + association, "g")