Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @file
* leaflet powered custom maps for townelake homes.
* by Jake Craige @ Poetic Systems
*/
/**
* How To Import Lots
* TL:DR Delete all current lots(feed/json), import feed lots, import json lots
class Product < ActiveRecord::Base
belongs_to :category
has_many :trackings
has_many :site_product_prices, -> { order(:id => :asc) }
has_many :user_price_alerts
after_create :extract_color_from_name, :update_brand_and_model_number_if_blank, :remove_false_values, :run_delayed_jobs
validates_presence_of :name
# Credits to @danyhunter for initial idea and implementation
# https://github.com/danyhunter
( () ->
if typeof angular is 'undefined'
return
module = angular.module 'SteroidsKeyboardFix', []
module.directive 'input', () ->
document.addEventListener('resume', function() {
if(window.ea_timeoutId) {
clearTimeout(window.ea_timeoutId);
}
window.ea_timeoutId = setTimeout(function() {
launchURL = steroids.app.getLaunchURL();
matches = launchURL.toString().match(/\/\/(\w+)\?\w+=(\w+)/);
action = matches[1];
id = matches[2];
module.directive 'selectallgroup', ->
restrict: 'A'
link: (scope, ele, attrs)->
$(ele).on 'change', ->
$(@).parents('h3').next('ul').find('input[type=checkbox]').each ()->
unless $(@).is(':disabled')
selectAllChecked = $(ele).prop('checked')
if selectAllChecked
$(@).prop('checked', false)
$scope.$watch 'invites', ()->
selected = _.map $scope.invites, (ele, index)->
parseInt(index) if ele is true
$scope.invitesPrepared = _.compact selected # remove undefined's
$scope.inviteLength = $scope.invitesPrepared.length
, true
<div ng-show="!_.isEmpty(notInvitedGuests)" ng-repeat="(groupName, guests) in notInvitedGuests">
<h3 class="topcoat-list__header caps">
<label class="topcoat-checkbox">
<input type="checkbox" selectallgroup>
<div class="topcoat-checkbox__checkmark"></div>
</label>
{{ groupName }} - Not Yet Invited
</h3>
<ul class="topcoat-list__container">
<li class="topcoat-list__item small disclosure" ng-show="guests" ng-repeat="guest in guests">
class ChangeAdditionalInformationColumnsToPromos < ActiveRecord::Migration
class RealPromo < ActiveRecord::Base; self.table_name = 'promos'; end
def up
rename_column :additional_informations, :body, :description
add_column :additional_informations, :title, :string
add_column :additional_informations, :url, :string
add_column :additional_informations, :phone, :string
add_column :additional_informations, :type, :string, default: 'Other'
resources :others, controller: :additional_informations, type: "Other"
resources :promos, controller: :additional_informations, type: "Promo"
resources :gifts, controller: :additional_informations, type: "Gift"
resources :travels, controller: :additional_informations, type: "Travel"
resources :lodgings, controller: :additional_informations, type: "Lodging"
def information_type
params[:type].constantize
end