Skip to content

Instantly share code, notes, and snippets.

import { AfterViewInit, Component, ElementRef, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { filter, map, switchMap, tap } from 'rxjs/operators';
import { LocationMap } from 'src/app/models/location-map.model';
import { Rectangle } from 'src/app/models/rectangle.model';
import { MapsService } from 'src/app/services/maps.service';
import { DocumentPatch } from 'src/app/models/document-patch.model';
import * as mapboxgl from 'mapbox-gl';
@rrecio
rrecio / LoginWithFacebook.m
Last active May 19, 2018 15:13
Service Object for Facebook Login integration written in Objective-C
//
// LoginWithFacebook.m
// Fuelzee
//
// Created by Rodrigo Recio on 6/26/15.
// Copyright © 2015 Fuelzee. All rights reserved.
//
/*
Mongoid::Errors::Validations:
Problem:
Validation of User failed.
Summary:
The following errors were found: Custom app not authorized
Resolution:
Try persisting the document with valid data or remove the validations.
# /Users/rodrigorecio/.rvm/gems/ruby-2.0.0-p598/gems/mongoid-3.1.6/lib/mongoid/persistence.rb:340:in `fail_validate!'
# /Users/rodrigorecio/.rvm/gems/ruby-2.0.0-p598/gems/mongoid-3.1.6/lib/mongoid/persistence.rb:102:in `save!'
@rrecio
rrecio / MyPlayground
Created June 17, 2015 16:57
core location playground
//: Playground - noun: a place where people can play
import UIKit
import CoreLocation
let locationMgr = CLLocationManager()
class GeoCordDelegate: NSObject, CLLocationManagerDelegate {
func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation) {
print("Updated Location: " + newLocation.description)
@rrecio
rrecio / gist:4c79a54285554a076b94
Created May 19, 2015 17:49
AFNetworking + Dispatch semaphore weird problem: Test keeps executing forever
// 1. Code to test Service Class LoadRewardsNearby
- (void)testLoadRewardsNearby {
CLLocation *location = [[CLLocation alloc] initWithLatitude:28.538336 longitude:-81.379236];
LoadRewardsNearby *rewardsNearby = [[LoadRewardsNearby alloc] initWithLocation:location];
NSArray *loadedRewards = [rewardsNearby load];
XCTAssertTrue(loadedRewards.count > 0, @"Rewards loading failed.");
}
// 2. Service Class LoadRewardsNearby
Process: ioquake3.ub [14237]
Path: /Applications/ioquake3/ioquake3fe-1.36.app/Contents/MacOS/ioquake3.ub
Identifier: org.ioquake.ioquake3
Version: 1.0
Code Type: X86 (Native)
Parent Process: ioquake3fe [14232]
Responsible: ioquake3fe [14232]
User ID: 502
Date/Time: 2014-09-06 11:56:22.185 -0300
@rrecio
rrecio / gist:6136058
Created August 1, 2013 22:52
Mixpanel User Identification
- (void)identifyMixpanelUser:(User *)user
{
Mixpanel *mixpanel = [Mixpanel sharedInstance];
NSMutableDictionary *properties = [NSMutableDictionary new];
if (user.email) {
[mixpanel identify:user.email];
properties[@"E-mail"] = user.email;
}
@rrecio
rrecio / gist:2836658
Created May 30, 2012 14:29
NSXMLParser Produto Example
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
{
if ([elementName isEqual:@"Produto"]) {
produtoTemp = [[Produto alloc] init];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if (produtoTemp != nil) {