Skip to content

Instantly share code, notes, and snippets.

View danbeaulieu's full-sized avatar

Dan Beaulieu danbeaulieu

View GitHub Profile
@danbeaulieu
danbeaulieu / Keybase.md
Created March 27, 2019 16:50
keybase.md

Keybase proof

I hereby claim:

  • I am danbeaulieu on github.
  • I am djbkeybase (https://keybase.io/djbkeybase) on keybase.
  • I have a public key ASC5v0RPdGlZ6gB6VVNi_YmCBn-TYVaMPXD95y_Z9gujvAo

To claim this, I am signing this object:

# in my _form.html.haml
= check_box :product, :exempt_from_schedule_policy
# as rendered in html
<input type="hidden" value="true" name="product[exempt_from_schedule_policy]">
<input id="product_exempt_from_schedule_policy" type="checkbox" value="true" name="product[exempt_from_schedule_policy]" checked="checked">
# post params as reported by firebug
utf8=%E2%9C%93&_method=put&authenticity_token=PtM7RQILcKoIzFi77abbFbobve9KEs5q9kCfofnZ8og%3D&product%5Bexempt_from_schedule_policy%5D=true&commit=Save+%26+continue
en:
foo: hello
products:
bar: goodbye
1.9.3p194 :001 > I18n.t('foo')
=> "hello"
1.9.3p194 :002 > I18n.t('products.bar')
=> "translation missing: en.products.bar"
= f.fields_for :product_images do |image_fields|
- if image_fields.object.new_record?
= image_fields.file_field :image
- else
%span
class OneListener
def success(range)
puts "range is #{range}"
end
end
def return_range(num)
Date.today..Date.today + num.day
end
SELECT st.id, sum(r.number_of_people) as people_total
FROM scheduled_tours as st
LEFT JOIN reservations AS r ON st.id = r.scheduled_tour_id
LEFT JOIN products AS p ON p.id = st.product_id
WHERE st.date = '2012-11-08'
GROUP BY st.id, p.max_capacity
HAVING SUM(r.number_of_people) IS null OR SUM(r.number_of_people) < p.max_capacity;
ScheduledTour.
joins(:reservations, :product).
routes:
'calendar': 'calendar',
'calendar/': 'calendar',
'calendar/:date': 'calendar',
'calendar/:date/': 'calendar',
'calendar/:date/:selected_tour_id': 'calendar',
'': 'calendar'
Installing pg (0.14.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/dan/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
Loading development environment (Rails 3.2.6)
1.9.3p194 :001 > I18n.locale
=> :es
1.9.3p194 :002 > I18n.locale = :en
=> :en
1.9.3p194 :005 > p = Product.find(27)
Product Load (0.8ms) SELECT "products".* FROM "products" WHERE "products"."id" = $1 LIMIT 1 [["id", 27]]
=> #<Product id: 27, min_capacity: 2, max_capacity: 10, start_time: "2000-01-01 22:18:00", languages: "English, Spanish", tour_operator_id: 4, created_at: "2012-10-19 22:20:53", updated_at: "2012-10-31 16:06:05", location: "Santiago", duration: #<BigDecimal:5267690,'0.8E1',9(18)>, price_in_local_units: 120000, internal_name: "Dans Climbing Trip", min_api_reservation_hours: 10>
1.9.3p194 :006 > p.translations
class TwoListener
def success(one, two)
puts "#{one}, #{two}"
end
end
def sender(listener, *args)
listener.send(:success, *args)
end