This file contains hidden or 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
| non_us_currencies = re.compile(ur''' | |
| ^(HK|S\$|AED|CHF|NT\$|Rs|\xa3|x80|\xc5|\u20ac|\u00a3|\u0141|\u00a5) | # Prefix Currencies | |
| \d(Fr|Kr)$ # Postfix Currencies | |
| ''', re.MULTILINE | re.VERBOSE) | |
| if non_us_currencies.search(soup.getText('\n')): | |
| raise ValueError('Non US currency') |
This file contains hidden or 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
| import re | |
| from order import Order, BundleOrders | |
| def parser(html=None, plain=None, attachments=None, debug=False): | |
| if html == None: | |
| html = '' | |
| if plain == None: | |
| plain = '' |
This file contains hidden or 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
| import re | |
| from order import Order, BundleOrders | |
| def parser(html=None, plain=None, attachments=None, debug=False): | |
| if html == None: | |
| html = '' | |
| if plain == None: | |
| plain = '' |
This file contains hidden or 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
| @activities = PublicActivity::Activity.order("created_at desc").where(owner_id: current_user.followed_user_ids, owner_type: "User") |
This file contains hidden or 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
| @venues = Venue | |
| if params.has_key?(:ll) | |
| lat, lng = params[:ll].split(',') | |
| @venues = @venues.near(lat, lng) | |
| end | |
| if params.has_key?(:user_id) | |
| @venues = @venues.where(creator_id: params[:user_id]) | |
| end |
This file contains hidden or 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 Venue < ActiveRecord::Base | |
| belongs_to :location, dependent: :destroy | |
| has_and_belongs_to_many :categories | |
| has_many :yums | |
| has_one :contact, inverse_of: :venue, dependent: :destroy | |
| belongs_to :owner, foreign_key: :owner_id, class_name: "User" | |
| belongs_to :creator, foreign_key: :creator_id, class_name: "User" | |
| validates :name, presence: true |
This file contains hidden or 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
| module API | |
| module V1 | |
| class VenuesController < ApiController | |
| before_action :set_venue, except: [:index, :create] | |
| before_action :authenticate, only: [:create, :destroy] | |
| def index | |
| @venues = Venue | |
| if params.has_key?(:ll) |
This file contains hidden or 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
| module API | |
| module V1 | |
| class VenuesController < ApiController | |
| before_action :set_venue, except: [:index, :create] | |
| before_action :authenticate, only: [:create, :destroy] | |
| def index | |
| @venues = Venue | |
| @venues = @venues.creator(params[:user_id]) if params[:user_id].present? |
This file contains hidden or 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
| env = ENV["RAILS_ENV"] || "development" | |
| app_dir = "yummmie" | |
| worker_processes 4 | |
| # listen on both a Unix domain socket and a TCP port, | |
| # we use a shorter backlog for quicker failover when busy | |
| listen "/tmp/unicorn.#{app_dir}.socket", :backlog => 64 | |
| # Preload our app for more speed |
This file contains hidden or 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 followers | |
| @users = @user.followers.order("relationships.created_at DESC") | |
| @users = @users.where("relationships.follower_id > ?", params[:after]) if params[:after].present? | |
| @users = @users.where("relationships.follower_id < ?", params[:before]) if params[:before].present? | |
| @users = @users.limit(20) | |
| render :index, status: :ok | |
| end | |
| def following | |
| @users = @user.followed_users.order("relationships.created_at DESC") |