Skip to content

Instantly share code, notes, and snippets.

View paulcook's full-sized avatar

Paul Cook paulcook

  • OSU TCO
  • Columbus, OH
View GitHub Profile
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson ([email protected])
# added rubygems, replaced script_path with script from path_parts, added to_return to fix return error - Paul Cook
# clearly this could be cleaner, but it does work
require 'rubygems'
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
@paulcook
paulcook / account_example_without_context.rb
Created January 24, 2012 01:57 — forked from st33n/account_example_without_context.rb
DCI example in Ruby, without ContextAccessor
#!/usr/bin/env ruby
# Lean Architecture example in Ruby - without ContextAccessor
# In this example, the context passes the needed roles into each method it
# invokes, and so the roles have no reference back to the context.
# Model class with no external dependenices. Includes a simple find method
# to create and store instances given an id - for illustration purposes only.
class Account
attr_reader :account_id, :balance
#!/usr/bin/env ruby
# Lean Architecture example in Ruby - with ContextAccessor
# This example keeps interaction state in a "current context", represented
# by a ContextAccessor module. This can be mixed in to any class that needs
# access to the current context. It is implemented as a thread-local variable.
module ContextAccessor
def context
Thread.current[:context]
@paulcook
paulcook / config.ru
Created February 21, 2012 21:44
Legacy PHP with POW
require 'rubygems'
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
INDEXES = ['index.html','index.php', 'index.cgi']
use Rack::Rewrite do
rewrite %r{(.*/$)}, lambda {|match, rack_env|
to_return = rack_env['PATH_INFO']
@paulcook
paulcook / html5_valid_elements.js
Created July 4, 2012 00:01 — forked from veprbl/html5_valid_elements.js
TinyMCE valid_elements setting for HTML5
valid_elements : ""
+"@[accesskey|draggable|style|class|hidden|tabindex|contenteditable|id|title|contextmenu|lang|dir<ltr?rtl|spellcheck|"
+"onabort|onerror|onmousewheel|onblur|onfocus|onpause|oncanplay|onformchange|onplay|oncanplaythrough|onforminput|onplaying|onchange|oninput|onprogress|onclick|oninvalid|onratechange|oncontextmenu|onkeydown|onreadystatechange|ondblclick|onkeypress|onscroll|ondrag|onkeyup|onseeked|ondragend|onload|onseeking|ondragenter|onloadeddata|onselect|ondragleave|onloadedmetadata|onshow|ondragover|onloadstart|onstalled|ondragstart|onmousedown|onsubmit|ondrop|onmousemove|onsuspend|ondurationmouseout|ontimeupdate|onemptied|onmouseover|onvolumechange|onended|onmouseup|onwaiting],"
+"a[target<_blank?_self?_top?_parent|ping|media|href|hreflang|type"
+"|rel<alternate?archives?author?bookmark?external?feed?first?help?index?last?license?next?nofollow?noreferrer?prev?search?sidebar?tag?up"
+"],"
+"abbr,"
+"address,"
+"area[alt|coords|shape|href|target<_blank?_self?_top?_parent|ping|media
@paulcook
paulcook / bootstrap_pagination_helper.rb
Created September 4, 2012 15:46 — forked from oparrish/bootstrap_pagination_helper.rb
Link renderer to be used with will_paginate to render links to work with Twitter Bootstrap
module BootstrapPaginationHelper
class LinkRenderer < WillPaginate::ActionView::LinkRenderer
protected
def page_number(page)
unless page == current_page
link(page, page, :rel => rel_value(page))
else
link(page, "#", :class => 'active')
end
@paulcook
paulcook / topics.html
Created October 15, 2012 18:59
Topics in Gerontology Boxes
<section class="fancy">
<article>
<header>
<h3><span><!-- heading --></span></h3>
</header>
<p><!-- content here --></p>
</article>
</section>
<section class="fancy meet-the-faculty">
@paulcook
paulcook / gist:4149740
Created November 26, 2012 18:15
FD4ME HTML Boxes
<div class="fancy-box whats-it-all-mean">
<h3><span><!-- Title --></span></h3>
<div class="fancy-content">
</div>
</div>
<div class="fancy-box skill-building">
<h3><img src="/media/images/modules/skill_building.img.jpg" alt="Building Blocks" widht="50" height="34" /><span>Skill Building</span></h3>
<div class="fancy-content">
<div class="fancy-box whats-it-all-mean">
<h3><span><!-- Title --></span></h3>
<div class="fancy-content">
</div>
</div>
<div class="fancy-box skill-building">
<h3><img src="/media/images/modules/skill_building.img.jpg" alt="Building Blocks" widht="50" height="34" /><span>Skill Building</span></h3>
<div class="fancy-content">
@paulcook
paulcook / threefive.html
Last active December 10, 2015 19:48
A "Fizz Buzz" solution in javascript and html generating result in html table
<html>
<head>
<title>Three Five</title>
</head>
<body>
<table border="1">
<thead>
<tr>
<th>Int</th>
<th>Divisble by</th>