Skip to content

Instantly share code, notes, and snippets.

View bryanp's full-sized avatar

Bryan Powell bryanp

View GitHub Profile

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.

@bryanp
bryanp / gist:1182830
Created August 31, 2011 04:36
Pakyow Mailer
class Pakyow::Mailer < Pakyow::Presenter::View
attr_accessor :subject, :sender, :content_type, :delivery_method, :delivery_options
def initialize(*args)
@sender = Configuration::Base.mailer.default_sender
@content_type = Configuration::Base.mailer.default_content_type
@delivery_method = Configuration::Base.mailer.delivery_method
@delivery_options = Configuration::Base.mailer.delivery_options
@files = []
@bryanp
bryanp / gist:1206611
Created September 9, 2011 16:03
JS iPad Detection
function isiPad() {
return navigator.userAgent.match(/iPad/i) != null;
}
@bryanp
bryanp / gist:1484053
Created December 16, 2011 01:54
Proposed Presenter API Changes
# request for "/foo"
presenter.view_path
# => "foo"
presenter.root_path
# => "pakyow.html"
# change the view path
@bryanp
bryanp / gist:1512048
Created December 22, 2011 22:02
Staging Config Example
module PakyowApplication
class Application < Pakyow::Application
configure(:staging) do
DataMapper.setup(:default, "")
app.dev_mode = true
app.log = true
presentation.view_caching = true
end
@bryanp
bryanp / gist:1616670
Created January 15, 2012 18:23
DM Finalize
module PakyowApplication
class Application < Pakyow::Application
def initialize
super
DataMapper.finalize
end
...
end
end
@bryanp
bryanp / gist:1616676
Created January 15, 2012 18:23
auto_upgrade task
namespace :db do
desc "Upgrade the database"
task :upgrade do
DataMapper.auto_upgrade!
end
end
@bryanp
bryanp / gist:1644634
Created January 20, 2012 02:45
pakyow-auth control flow
# this would happen if auth fails (in Auth#create_session)
begin
throw :auth_fail, true
rescue ArgumentError
# uncaught, so do redirect etc
end
# and this would be the code in the app that implements pakyow-auth
@bryanp
bryanp / gist:1776580
Created February 9, 2012 02:24
pakyow dependencies
$ ruby -ropen-uri -rpp -e 'pp Marshal.load(open("https://rubygems.org/api/v1/dependencies?gems=pakyow"))'
[{:name=>"pakyow",
:number=>"0.7.1",
:platform=>"ruby",
:dependencies=>
[["pakyow-mailer", "= 0.7.1"],
["pakyow-presenter", "= 0.7.1"],
["pakyow-core", "= 0.7.1"]]},
{:name=>"pakyow",
:number=>"0.7.0",