Skip to content

Instantly share code, notes, and snippets.

View wnstn's full-sized avatar

Winston Hearn wnstn

View GitHub Profile
@wnstn
wnstn / rake-error-output.rb
Created January 8, 2013 20:26
rake error
PG::Error: ERROR: relation "facilities" does not exist
LINE 5: WHERE a.attrelid = '"facilities"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"facilities"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
@wnstn
wnstn / social.html
Last active December 10, 2015 19:58
markup for social
<div class="social-media">
<p>Connect with Vaco:</p>
<p class="social-icon"><a class="twitter" title="Vaco twitter home page" href="http://twitter.com/vaco_raleigh" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/Twitter.png" alt="Twitter" width="63" height="63" /></a></p>
<p class="social-icon"><a class="linked-in" title="Vaco linkedIn home page" href="http://www.linkedin.com/companies/vaco" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/LinkedIn_gradient.png" alt="linkedIn" width="63" height="63" /></a></p>
<p class="social-icon"><a class="facebook" title="Vaco facebook home page" href="http://www.facebook.com/pages/Raleigh-NC/Vaco-Raleigh/179980064366" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/Facebook.png" alt="facebook" width="63" height="63" /></a></p>
<p class="social-icon"><a class="blog" title="Vaco Blogging home page" href="http://vacor
if full_name.size == 3
patient.update_attributes(first_name: full_name[0,1], last_name: full_name[2])
else
patient.update_attributes(first_name: full_name[0], last_name: full_name[1])
end
@wnstn
wnstn / split_names.rb
Created September 14, 2012 19:44
patient_migration
def up
patients = Patient.find(:all)
patients.each do |patient|
full_name = patient.name.split
patient.update_attributes(first_name: full_name[0], last_name: full_name[1])
end
end
def down
patients = Patient.find(:all)
patients.each do |patient|
patient.name
@wnstn
wnstn / _visit.html.erb
Created September 12, 2012 22:41
data being passed in
<div class="outcome-section graph-container">
<h3 class="boxed-header">Overall Progress <%= records.last.integer_value %></h3>
<h3 class="boxed-header">Goal <%= ogoal.goal %></h3>
<div style="height:300px;" class="graph" data-scale="<%= ogoal.scale.min %>-<%= ogoal.scale.max %>" data-goal="<%= ogoal.goal %>" data-coordata="<%= records.to_a.map { |r| "#{r.progress_report.due_date.to_time.to_i*1000}|#{(r.integer_value)}" }.join(",") %>">
</div>
</div>
<div class="outcome-section graph-container">
<h3 class="boxed-header">Overall Progress <%= records.last.integer_value %></h3>
@wnstn
wnstn / visit_js.js.coffee
Created September 12, 2012 22:38
goal data
if goal
plotData = [
{
data: tracking
lines:
show: true
lineWidth: 1
points:
show: true
radius: 3
@wnstn
wnstn / app.coffee
Created August 30, 2012 03:51
mochaclub.coffee
$ ->
options =
autoPlay: true
autoPlayDelay: 6000
transitionThreshold: -100
startingFrameID: 1
nextButton: "#sequence .next"
prevButton: "#sequence .prev"
pauseOnHover: true
→ rspec spec/
1) School scopes#for_user ValEdAdmin should return the list of schools for the admin
Failure/Error: School.for_user(user).should == [school_1, school_2]
expected: [#<School id: 2358, district_id: 3016, name: "Test School", school_type: "public", created_at: "2012-08-13 18:54:16", updated_at: "2012-08-13 18:54:16", deleted_at: nil>, #<School id: 2359, district_id: 3017, name: "Test School", school_type: "public", created_at: "2012-08-13 18:54:17", updated_at: "2012-08-13 18:54:17", deleted_at: nil>]
got: [#<School id: 2359, district_id: 3017, name: "Test School", school_type: "public", created_at: "2012-08-13 18:54:17", updated_at: "2012-08-13 18:54:17", deleted_at: nil>, #<School id: 2358, district_id: 3016, name: "Test School", school_type: "public", created_at: "2012-08-13 18:54:16", updated_at: "2012-08-13 18:54:16", deleted_at: nil>] (using ==)
Diff:
@@ -1,3 +1,2 @@
-[#<School id: 2358, district_id: 3016, name: "Test School", school_type: "publ
@wnstn
wnstn / subnav.coffee
Created August 9, 2012 19:22
finding pjax
$ ->
$('.subnav a').on 'click', (event) ->
event.preventDefault()
# Find the section of the page to load the new content
currentSection = '#' + $(this).closest('section').attr('id')
# Find the div that pjax should replace
changeContent = '#' + $(currentSection + ' .pjax-content').attr('id')
#fetch the new content and animate it in