This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose you have two heroku remote apps | |
myapp-dev & myapp-prod | |
and two git branches | |
master(for dev) & production | |
Now lets setup heroku on the existing git repo in your local machine | |
Assuming the branches and the apps exist already | |
git remote add heroku-myapp-dev https://git.heroku.com/myapp-dev.git | |
git remote add heroku-myapp-prod https://git.heroku.com/myapp-prod.git | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adwords controls metrics for a normal adwords account. | |
for adwords, first setup a MCC/adwords manager account -- https://adwords.google.com/home/tools/manager-accounts/ | |
Add the client account in this one using https://support.google.com/adwords/answer/6139186?hl=en#link | |
From the MCC account, create a developer token and apply for a basic token...its easy...not much required... | |
Now, for the development part | |
Use this library: https://github.com/googleads/google-api-ads-ruby/tree/master/adwords_api | |
Use this wiki: https://github.com/googleads/google-api-ads-ruby/wiki/API-access-using-own-credentials-%28installed-application-flow%29 | |
Create OAuth2 credentials for the client account(NOT THE MCC ACCOUNT) using https://developers.google.com/adwords/api/docs/guides/authentication#installed | |
and running setup_auth2.rb | |
Run and get results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /usr/local/sbin | |
certbot-auto renew | |
sudo service nginx reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.natashatherobot.com/ios-autolayout-scrollview/ | |
class ScrollTestViewController: UIViewController { | |
@IBOutlet weak var contentView: UIView! | |
@IBOutlet weak var scrollView: UIScrollView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let containerViewBounds = contentView.bounds | |
scrollView.contentSize=CGSizeMake(containerViewBounds.size.height + 20,containerViewBounds.size.width + 20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Stripe | |
class PaymentViewController: UIViewController, STPPaymentCardTextFieldDelegate { | |
var paymentTextField: STPPaymentCardTextField! | |
var saveButton: UIButton! | |
var saveAction: UIAlertAction! | |
override func viewDidLoad() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func showAlertButtonTapped(sender: UIButton) { | |
// create the alert | |
let alertController = UIAlertController(title: "Add Card", message: "Add your card details here and hit save\n\n\n", preferredStyle: UIAlertControllerStyle.Alert) | |
// alertController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width-20, 400) | |
// let margin:CGFloat = 8.0 | |
// let rect = CGRectMake(margin, margin, alertController.view.bounds.size.width - margin * 4.0, 44) | |
// let customView = UIView(frame: rect) | |
paymentTextField.frame = CGRectMake(5, 75, alertController.view.bounds.size.width - 150, 44)// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select the Info.plist file. | |
Click on the + button to add a key. | |
Add the key named NSLocationAlwaysUsageDescription. | |
Write a convincing description of why you need location in the background. | |
class MovieDetailViewController: UIViewController, CLLocationManagerDelegate { | |
@IBOutlet weak var mapView: MKMapView! | |
var locations = [MKPointAnnotation]() | |
lazy var locationManager: CLLocationManager! = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var player: AVQueuePlayer! | |
//for sound of assets let sound = NSDataAsset(name: "audio") | |
func viewDidLoad() { | |
let session = AVAudioSession.sharedInstance() | |
try! session.setCategory(AVAudioSessionCategoryPlayAndRecord) | |
let item = AVPlayerItem(URL: NSURL(string: "http://incompetech.com/music/royalty-free/mp3-royaltyfree/Motherlode.mp3")!) | |
let item2 = AVPlayerItem(URL: NSURL(string: "http://incompetech.com/music/royalty-free/mp3-royaltyfree/Vicious.mp3")!) | |
player = AVQueuePlayer(items: [ item, item2]) | |
player.actionAtItemEnd = .Advance | |