This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.score(obj) | |
up_votes_weight = 0 | |
for vote in obj.votes.up_votes # recent votes on older posts have more weight | |
up_votes_weight += ((vote.created_at.to_date - obj.created_at.to_date).to_i / 2) + 1 | |
end # plus one for votes on recent posts to still get valued | |
_score = (up_votes_weight + (obj.comments.size / 2)) - | |
((obj.votes.down_votes.size.to_i * 2) + (Date.today - obj.created_at.to_date).to_i) | |
return _score | |
# also needs to check for clusters of recent votes, giving more | |
# weight to recent posts that are closer together in time, "hotness" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZIP_CODE_RANGE = 10 | |
def close_enough(content) | |
_close_enough = false | |
zips_in_range = [] | |
for zip in Zip.all | |
if self.zip_code and self.network_size and content.zip_code | |
if (self.zip_code - zip.zip_code).abs < ZIP_CODE_RANGE + self.network_size | |
zips_in_range << zip.zip_code | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
def close_enough(content) | |
_close_enough = false | |
zips_in_range = [] | |
for zip in Zip.all | |
# verifies values and gets zips within constant range | |
if self.zip_code and self.network_size and content.zip_code | |
difference = (self.zip_code - zip.zip_code).abs | |
if difference < Zip.zip_code_range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
class Reservation(Frame): | |
def __init__(self, parent): | |
Frame.__init__(self, parent, background="gray") | |
self.parent = parent | |
self.initUI() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def close_enough(content) | |
_close_enough = false | |
# content always close enough when inside current users zip code or cherry picked tab | |
if content.zip_code and self.zip_code and content.zip_code == self.zip_code or (content.is_a? Tab and \ | |
content.features.where(user_id: self.id).where(action: :cherry_pick).present?) | |
_close_enough = true | |
# close enough when within the users specified network size | |
elsif content.latitude and self.latitude and self.network_size and \ | |
GeoDistance.distance(content.latitude, content.longitude, self.latitude, | |
self.longitude).miles.number < self.network_size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).bindWithDelay("scroll", function() { | |
if($(window).scrollTop() + $(window).height() > $(document).height() - 150) { | |
if ($("#more_content_anchor")) { | |
var param = null; | |
if (document.URL.search("users") != -1) { | |
param = $.param({ user_id: document.URL.split("/")[4] }); | |
} else if (document.URL.search("tabs") != -1) { | |
param = $.param({ tab_id: document.URL.split("/")[4] }); | |
} else if (document.URL.search("notes") != -1) { | |
param = $.param({ notes: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def close_enough(content) | |
_close_enough = false | |
# content always close enough when inside current users zip code or cherry picked tab | |
if content.zip_code and self.zip_code and content.zip_code == self.zip_code or (content.is_a? Tab and \ | |
content.features.where(user_id: self.id).where(action: :cherry_pick).present?) | |
_close_enough = true | |
# close enough when within the users specified network size | |
elsif content.latitude and self.latitude and self.network_size and \ | |
GeoDistance.distance(content.latitude, content.longitude, self.latitude, | |
self.longitude).miles.number < self.network_size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def current_location | |
geoip = GeoIP.new('GeoLiteCity.dat').city(self.ip) | |
if defined? geoip and geoip | |
self.latitude = geoip.latitude | |
self.longitude = geoip.longitude | |
if latitude and longitude | |
geocoder = Geocoder.search("#{latitude}, #{longitude}").first | |
if geocoder and geocoder.formatted_address | |
self.address = geocoder.formatted_address | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for @maintenance do |f| %> | |
<p> | |
<%= f.check_box :title %> | |
</p> | |
<p> | |
<%= f.submit translate("Update"), class: "btn btn-default btn-lg btn-block" %> | |
</p> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Okay so the tool tips should appear in the following order they will have to branch off as the user | |
visits different aspects of the site. We will start of with what we will call the welcome screen, | |
which is the first page that the user sees after they have either created an account or log in. | |
1.hi, this is your site page being used as your welcome screen. It has articles, events that are close | |
to you. Later I'll show you how to choose a Drop [drop icon here] as your welcome screen | |
2.This is button will bring you back to the site page from anywhere on the site. | |
(referring to the elheroe logo that appears in the top left corner of every page.) |
OlderNewer