Skip to content

Instantly share code, notes, and snippets.

View JoshMcKin's full-sized avatar

Joshua T. Mckinney JoshMcKin

  • New Braunfels, TX
View GitHub Profile
@JoshMcKin
JoshMcKin / gist:809746
Created February 3, 2011 16:42
Early EventMachine Zendesk example
module EmZendesk
require 'em-http'
class Base < SimpleModel::Base
has_attributes :zen_resource, :params, :username, :password, :response, :company_url
has_attributes :format, :default => 'json'
has_attributes :http_method, :default => :post
validate :validates_post_response
@JoshMcKin
JoshMcKin / gist:801101
Created January 28, 2011 22:09
Nginx conf for thin clusters with shared ssl and redirect to ssl
user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@JoshMcKin
JoshMcKin / gist:801081
Created January 28, 2011 21:59
Deploy with Thin Rails 3
require "bundler/capistrano"
default_run_options[:pty] = true
set :user, 'user'
set :domain, 'SOMEDOMAIN.OR.IP'
set :application, "applcation_name"
set :repository, "/home/#{user}/git/#{application}.git/"
set :local_repository, "."
set :deploy_to, "/home/#{user}/#{application}"
@JoshMcKin
JoshMcKin / gist:801077
Created January 28, 2011 21:57
thin yml
---
chdir: /home/user/application_name/current
environment: sit
address: 0.0.0.0
port: 5000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 512
@JoshMcKin
JoshMcKin / gist:801076
Created January 28, 2011 21:57
thin yml
---
chdir: /home/user/application_name/current
environment: sit
address: 0.0.0.0
port: 5000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 512
@JoshMcKin
JoshMcKin / gist:780486
Created January 14, 2011 23:24
my engine.rb file
require 'my_engine'
require "rails"
require 'date_tools'
require 'ascyn_http'
require 'payment_calendar'
require 'simple_record_read_only'
require 'ventanex_encryption'
require 'simple_model'
require 'simple_record'
require "typhoeus"
@JoshMcKin
JoshMcKin / gist:780398
Created January 14, 2011 22:25
Engine gemspec
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "my_engine/version"
Gem::Specification.new do |s|
s.name = "msp_webpay"
s.version = MyEngine::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Joshua T. Mckinney "]
s.email = ["not a email"]
@JoshMcKin
JoshMcKin / gist:743958
Created December 16, 2010 20:28
SOAP XML with WSU Time Stamp
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wel="http://test.comt/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header>
<wsse:Security env:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2010-12-16T19:40:03Z</wsu:Created>
<wsu:Expires>2010-12-16T19:41:03Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</env:Header>
<env:Body>
@JoshMcKin
JoshMcKin / gist:703979
Created November 17, 2010 20:10
inheritance
class MyClass1
def working
puts "working"
end
def use_worker
working
end
end
def self.all_available_methods
controllers = Dir.new("#{RAILS_ROOT}/app/controllers").entries
controllers.each do |controller|
if controller =~ /_controller/
available_methods(controller)
end
end
end
def self.available_methods(controller)