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
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
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
@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
@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
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
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
<tbody> | |
<!-- BEGIN: Printed Items --> | |
<!-- BEGIN: 0 --> | |
<tr> | |
<td width="300"> | |
<div class="thumbnail"> | |
<p>Front</p> | |
<div class="thumbnailContainer"> | |
<img src="https://www.overnightprints.com/tmp/m_opstore29/optmp47848//fth_v2_4b5766da83c618.31094929.jpg" /> | |
</div><!-- thumbnailContainer --> |
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
item_pattern = r''' | |
(?P<quantity>\d+)\sx\s | |
\((?P<price>\$\-*[\d\.,]+)\)\s | |
(?P<name>[\S\s]+)\$\-*[\d\.,]+ | |
''' |