Skip to content

Instantly share code, notes, and snippets.

class Travel < AdditionalInformation; end
[:test, :bob].each_with_object({}) do |key, res|
res[key] = params[key] if params[key]
end
saveNewPhoto: ->
newImage = @store.createRecord 'event_image', {
image: @get 'newPhotoImage'
caption: @get 'newPhotoCaption'
event: @get 'model'
}
newImage.save().then ((img)=>
@get('event_images').pushObject img
Ea.get('flash').success 'Image added'
), (=>
"Jake Craige & Matthew Hager
" Setup {{{
set rtp+=~/.poetic_dotfiles/powerline/powerline/bindings/vim/
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
filetype plugin indent on
" }}}
def top_retailers
retailers = self.site_product_prices.last_24_hours.trusted.by_price
retailers = retailers.group_by { |retailer| retailer.site }
.map(&:last)
.each{ |sites_array| sites_array.sort_by! { |site| site.weight }.reverse! }
.map(&:first).reverse
.sort_by { |x| x.price }
if retailers.count > 1
def information_type
params[:type].constantize
end
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"
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'
<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">
$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
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)