Skip to content

Instantly share code, notes, and snippets.

Mike Rose rosem

Block or report user

Report or block rosem

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ffbc651a1ba57392e47bb450831a931a
#pragma mark - Auth
- (void)updateNotifications:(NSNumber*)favorites messages:(NSNumber*)messages created:(NSNumber*)created {
if (!favorites && !messages && !created) { return; }
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self updateNotifications:favorites messages:messages created:created];
});
View gist:8f6e3f113b38f40653e39c639c305cea
Processing by EventsController#index as XML
User: Michael R
User-Agent: Mapchat 1.2.8 rev:197 (iPad; iOS 11.2.5; en_US)
User: Michael R
User-Agent: Mapchat 1.2.8 rev:197 (iPad; iOS 11.2.5; en_US)
[paperclip] Saving attachments.
Completed 200 OK in 15ms (ActiveRecord: 4.6ms)
nil can't be coerced into Float
["/var/www/chatio/shared/bundle/ruby/1.9.1/gems/geokit-1.11.0/lib/geokit/mappable.rb:58:in `-'", "/var/www/chatio/shared/bundle/ruby/1.9.1/gems/geokit-1.11.0/lib/geokit/mappable.rb:58:in `distance_between_flat'", "/var/www/chatio/shared/bundle/ruby/1.9.1/gems/geokit-1.11.0/lib/geokit/mappable.rb:44:in `distance_between'", "/var/www/chatio/shared/bundle/ruby/1.9.1/gems/geokit-1.11.0/lib/geokit/mappable.rb:213:in `distance_to'", "/var/www/chatio/releases/20180306231328/app/models/event.rb:74:in `distance'", "/var/www/chatio/shared/bundle/ruby/1.9.1/gems/acts_as_api-0.4.1/lib/acts_as_api/api_template.rb:120:in `process_value'", "/var/www/chatio/shared/bundle/ruby/1.9.1/gems/acts_as_api-0.4.1/lib/acts_as_api/api
View gist:d91c387969262e935722c6dde46ba515
class EventsController < APIController
# GET /events.xml
def index
@events = current_user.events.one_per_user.non_blocked(current_user.id)
if client_build_number < 171
@events = @events.where("event_type = 'create'")
end
@events = @events.order("max(events.created_at) DESC").limit(25)
View gist:360e42478240c88ebe533db9787fdaba
def notify_room(room, sender)
alert = "#{sender.pseudo} created #{room.title} nearby"
notifyees = User.within(prefered_distance, :origin => [room.lat, room.lng]).where(["prefered_distance is not null and lat is not null and lng is not null and id != ?", sender.id])
#notifyees = User.geo_scope(:origin => [room.lat, room.lng]).where(["#{User.distance_sql(Geokit::LatLng.new(room.lat, room.lng))} < prefered_distance and prefered_distance is not null and lat is not null and lng is not null and id != ?", sender.id])
# select users who haven't blocked the room owner
notifyees = notifyees.where('users.id not in (select user_id from blocked_users where blocked_users.blocked_id = ?)', room.user_id)
if !Room.with_deleted.find(room.id).deleted_at.nil?
View gist:d8715f1e3f0916bdd42c6e93cdd7a21e
Started POST "/rooms/geolocated.xml" for 174.230.18.33 at 2018-03-05 18:54:02 -0500
Processing by RoomsController#geolocated as XML
Parameters: {"ne"=>"38.364919,-121.857899", "res"=>"high", "sw"=>"37.036102,-122.994726"}
^[[1m^[[35mUser Load (0.6ms)^[[0m SELECT "users".* FROM "users" WHERE "users"."authentication_token" = 'SurFrddosuQcXV5ct7d4' AND ("users"."deleted_at" IS NULL) LIMIT 1
User: 382b4b34
User-Agent: Mapchat* 2.0 rev:197 (iPhone; iOS 11.2; en_US)
^[[1m^[[36m (0.1ms)^[[0m ^[[1mBEGIN^[[0m
^[[1m^[[35mUser Exists (0.2ms)^[[0m SELECT 1 AS one FROM "users" WHERE ("users"."uuid" = '6092AA9E-E11E-48F4-B189-FCF6D1F487FF' AND "users"."id" != 26) LIMIT 1
^[[1m^[[36m (0.3ms)^[[0m ^[[1mUPDATE "users" SET "ne_lat" = 38.364919, "ne_lng" = -121.857899, "sw_lat" = 37.036102, "sw_lng" = -122.994726, "updated_at" = '2018-03-05 23:54:03.001998' WHERE "users"."id" = 26^[[0m
[paperclip] Saving attachments.
View gist:88243b71a45b6ab79e52b5a93181a7f2
Started POST "/rooms/geolocated.xml" for 174.230.18.33 at 2018-03-05 18:32:57 -0500
Processing by RoomsController#geolocated as XML
Parameters: {"ne"=>"38.162181,-121.881439", "res"=>"high", "sw"=>"37.057131,-122.825671"}
^[[1m^[[36mUser Load (0.6ms)^[[0m ^[[1mSELECT "users".* FROM "users" WHERE "users"."authentication_token" = 'SurFrddosuQcXV5ct7d4' AND ("users"."deleted_at" IS NULL) LIMIT 1^[[0m
User: 382b4b34
User-Agent: Mapchat* 2.0 rev:197 (iPhone; iOS 11.2; en_US)
^[[1m^[[35m (0.1ms)^[[0m BEGIN
^[[1m^[[36mUser Exists (0.2ms)^[[0m ^[[1mSELECT 1 AS one FROM "users" WHERE ("users"."uuid" = '6092AA9E-E11E-48F4-B189-FCF6D1F487FF' AND "users"."id" != 26) LIMIT 1^[[0m
^[[1m^[[35m (0.3ms)^[[0m UPDATE "users" SET "ne_lat" = 38.162181, "ne_lng" = -121.881439, "sw_lat" = 37.057131, "sw_lng" = -122.825671, "updated_at" = '2018-03-05 23:32:57.764121' WHERE "users"."id" = 26
[paperclip] Saving attachments.
View gist:59a6a859e77340b071b6298a457f6e4b
User-Agent: Mapchat* 2.0 rev:197 (iPhone; iOS 11.2; en_US)
^[[1m^[[36m (0.1ms)^[[0m ^[[1mBEGIN^[[0m
^[[1m^[[35mUser Exists (0.2ms)^[[0m SELECT 1 AS one FROM "users" WHERE ("users"."uuid" = '6092AA9E-E11E-48F4-B189-FCF6D1F487FF' AND "users"."id" != 26) LIMIT 1
^[[1m^[[36m (0.3ms)^[[0m ^[[1mUPDATE "users" SET "ne_lat" = 38.368435, "ne_lng" = -121.911602, "sw_lat" = 37.454332, "sw_lng" = -122.695866, "updated_at" = '2018-03-05 23:22:51.713157' WHERE "users"."id" = 26^[[0m
[paperclip] Saving attachments.
^[[1m^[[35m (0.6ms)^[[0m COMMIT
^[[1m^[[36mRoom Load (0.6ms)^[[0m ^[[1mSELECT "rooms".* FROM "rooms" WHERE ("rooms"."deleted_at" IS NULL) AND (rooms.lat>37.454332 AND rooms.lat<38.368435 AND rooms.lng>-122.695866 AND rooms.lng<-121.911602) AND (private = 'f') AND (rooms.archived_at IS NULL AND (rooms.active_since IS NULL OR rooms.active_since <= '2018-03-05 23:22:51')) LIMIT 50^[[0m
^[[1m^[[35mMessage Load (0.8ms)^[[0m SELECT id, content, created_at, user_id, room_id, photo_file_name, photo_upda
View gist:47c05a2d6c024567ce67d187e7ab48b2
def geolocated
address_point = origin = [params[:lat].to_f, params[:lng].to_f]
if params[:ne] && params[:sw]
sw_lat, sw_lng = params[:sw].split(/,/)
ne_lat, ne_lng = params[:ne].split(/,/)
bounds = Geokit::Bounds.new(Geokit::LatLng.new(sw_lat,sw_lng),Geokit::LatLng.new(ne_lat,ne_lng))
current_user.update_region(bounds)
# use the center of the search region for distance calculation
address_point = origin = bounds.center
View gist:627488256595ce20be797db0085570a9
def geolocated
address_point = origin = [params[:lat].to_f, params[:lng].to_f]
if params[:ne] && params[:sw]
sw_lat, sw_lng = params[:sw].split(/,/)
ne_lat, ne_lng = params[:ne].split(/,/)
bounds = GeoKit::Bounds.new(GeoKit::LatLng.new(sw_lat,sw_lng),GeoKit::LatLng.new(ne_lat,ne_lng))
current_user.update_region(bounds)
# use the center of the search region for distance calculation
address_point = origin = bounds.center
View NSAttributedString+Extension.swift
//
// NSAttributedString+Extension.swift
// Contacts
//
// Created by Michael Rose on 8/9/17.
// Copyright © 2017 Mike Rose. All rights reserved.
//
import UIKit
You can’t perform that action at this time.