Skip to content

Instantly share code, notes, and snippets.

source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '3.2.14'
gem 'cancan', '1.6.10'
gem 'carmen-rails', '1.0.0'
gem 'carrierwave', '0.9.0'
gem 'carrierwave-mongoid', '0.6.1', require: 'carrierwave/mongoid'
@jwoertink
jwoertink / gist:5702300
Created June 3, 2013 23:19
What is the best way to index this in MongoDB? Even more so, what is the best way to index this with mongoid in rails?
{
"$or" => [{"receivers"=>"5149fb21d863673f0f000001"}, {"actor_id"=>"5149fb21d863673f0f000001"}],
"_id" => {"$ne" => "51a91dd4d8636716cc000015"},
"created_at" => {"$gt" => 2013-05-31 22:01:56 UTC},
"action" => {"$nin" => [:comment, :favorite]},
"object_type" => {"$nin" => ["User"]}
}
function initialize() {
var map = Gmaps.map.map
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(<%= @lat %>, <%= @lon %>),
new google.maps.LatLng(<%= @lat %>, <%= @lon %>));
map.setZoom(15);
var input = (document.getElementById('place-search'));
garage = ['122', '123', '1234', '1505'].collect { |n| rets_property.attribute[n] unless rets_property.attribute[n].nil? }.compact.first
{garage: garage}
><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-39403734-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
# string :url
class Feed < ActiveRecord::Base
validates :url, presence: true
end
var timezones = function() {
zones = [
{ value: "Abu Dhabi", label: "Abu Dhabi" },
{ value: "Adelaide", label: "Adelaide" },
{ value: "Alaska", label: "Alaska" },
{ value: "Almaty", label: "Almaty" },
# Need a method that takes a date and based on a given time zone gives me the correct offset
# with daylight savings time into consideration
Time.zone = "Pacific US and Canada"
Time.some_method_name("2013-03-09") #=> "PST -0800"
Time.some_method_name("2013-03-10") #=> "PDT -0700"
#############
ActiveSupport::TimeZone.all.sort_by(&:name).each_with_index do |timezone, index|
<select name="event[time_zone]" id="event_time_zone"><option value="American Samoa">(GMT-11:00) American Samoa</option>
<option value="International Date Line West">(GMT-11:00) International Date Line West</option>
<option value="Midway Island">(GMT-11:00) Midway Island</option>
<option value="Hawaii">(GMT-10:00) Hawaii</option>
<option value="Alaska">(GMT-09:00) Alaska</option>
<option value="Pacific Time (US &amp; Canada)">(GMT-08:00) Pacific Time (US &amp; Canada)</option>
<option value="Tijuana">(GMT-08:00) Tijuana</option>
<option value="Arizona">(GMT-07:00) Arizona</option>
<option value="Chihuahua">(GMT-07:00) Chihuahua</option>
<option value="Mazatlan">(GMT-07:00) Mazatlan</option>
step 'I am a registered user connected to facebook' do
VCR.use_cassette 'authentication/facebook/test_users', :record => :new_episodes do
@test_users = Koala::Facebook::TestUsers.new(app_id: Settings.facebook.app_id, secret: Settings.facebook.app_secret)
@fb_user = @test_users.create(true, User.facebook_permissions.join(','))
@current_user ||= User.find_and_update_for_facebook_oauth(@fb_user)
end
end
step 'I have :count :provider friends' do |count, provider|
case provider.to_s