Skip to content

Instantly share code, notes, and snippets.

View kevinvangelder's full-sized avatar

Kevin VanGelder kevinvangelder

View GitHub Profile
def dealers
return [] unless self.zip && self.distance
require 'haversine'
return @dealers if @dealers.present?
@dealers = []
# Convert zip to lat-long
starting_location = to_lat_long_hash(self.zip)
$(document).on "click", (e) ->
if($(e.target).parents().index($('.super-menu')) == -1)
if($('.super-menu').is(":visible"))
$('.super-menu').slideUp()
def contact
if params[:contact]
@contact = Contact.new(params[:contact])
if @contact.save
if ContactMailer.contact_email(contact).deliver()
@contact.sent = true
@contact.save
end
redirect_to contact_thank_you_url
end
def her_or_you(r = nil)
if current_user
"you" . r
else
"her"
end
end
@kevinvangelder
kevinvangelder / her_or_you(r)
Created June 27, 2013 19:41
her_or_you(r)
def her_or_you(r = nil)
if current_guest_user
"you" . r
else
"her"
end
end
@kevinvangelder
kevinvangelder / album-each.rb
Created July 10, 2013 00:28
albums-each.rb
- c = 0
- @albums.each do |a|
- if c == 0 || c % 3 == 0
- if c != 0
</div>
<div class="row-fluid">
= simple_form_for @important_date do |f|
= f.input :name
= f.input :date, as: :ui_date_picker, data: { date_format: "mm/dd/yy" }, value: @important_date.date.strftime("%m/%d/%Y")
= f.input :recurring
.form-actions
= link_to "Cancel", important_dates_url, class: "btn btn-inverse"
- if @important_date.id
= link_to "Delete", important_date_url(@important_date), method: :delete, class: "btn btn-danger"
= f.submit "Save", class: "btn btn-success"
@kevinvangelder
kevinvangelder / about.php
Created August 26, 2013 17:31
Country Restoration Satisfaction Old
$total = db_query_row("SELECT SUM(overall_customer_service) FROM surveys WHERE approved = 1");
$survey_count = db_count("surveys", "WHERE approved = 1");
$added_up = $total["SUM(overall_customer_service)"];
$average = ((103 * 9.733) + $added_up) / (103 + $survey_count); // this is taking into account the previous (103) unadded surveys
$rating = number_format((($average * 1000) / 100), 2);
@kevinvangelder
kevinvangelder / satisfaction_survey.rb
Created August 26, 2013 17:31
Country Restoration Satisfaction New
def self.customer_satisfaction
count = SatisfactionSurvey.where("approved=?", true).count
average = SatisfactionSurvey.where("approved = ?", true).sum("overall_customer_service")
average = average + (103 * 9.733)
count = count + 103
total = ((average / count) * 1000) / 100
total.round(2)
end

Keybase proof

I hereby claim:

  • I am kevinvangelder on github.
  • I am kevinvangelder (https://keybase.io/kevinvangelder) on keybase.
  • I have a public key whose fingerprint is B442 AD1A 3CFC 1582 5366 6E8C 819D 2FB2 8DD3 1EE0

To claim this, I am signing this object: