Skip to content

Instantly share code, notes, and snippets.

Natan Rolnik natanrolnik

View GitHub Profile
View Fastfile-part1.rb
fastlane_version "1.33.0"
default_platform :ios
platform :ios do
before_all do
cocoapods
ENV['KEYCHAIN_NAME'] = "TempKeychain.keychain"
end
View Fastfile-example.rb
fastlane_version "1.33.0"
default_platform :ios
platform :ios do
before_all do
cocoapods
ENV['KEYCHAIN_NAME'] = "TempKeychain.keychain"
end
View Fastfile-part2.rb
desc "Submit a new Beta Build to Fabric without notifications"
lane :fabric_silent do
import_certificates
sigh(adhoc: true)
ENV["PROFILE_UDID"] = lane_context[SharedValues::SIGH_UDID] # use the UDID of the newly created provisioning profile
gym(scheme: "MyApp AdHoc", sdk: "iphoneos9.0", use_legacy_build_api: true)
crashlytics(notifications: false)
end
View Fastlane-Circle.yml
machine:
xcode:
version: "7.0"
dependencies:
pre:
- brew install mogenerator --HEAD #if you are using mogenerator, you need this step. Otherwise, ignore it
deployment:
staging:
View Fastfile-import_certificates.rb
def import_certificates
return unless Helper.is_ci? # As in my local machine I don't need to import the certificates, only run if it's in the CI
create_keychain(
name: ENV["KEYCHAIN_NAME"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: true,
password: ENV["KEYCHAIN_PASSWORD"]
View Parse-fastlane-notification.js
Parse.Cloud.afterSave("LaneResult", function(request) {
var query = new Parse.Query(Parse.Installation);
var text = "New event from " + request.object.get("App") + ": " + request.object.get("EventType");
Parse.Push.send({
where: query, // Set our Installation query
data: {
alert: text,
sound: "register.aiff"
View Fastfile-after_all-error.rb
after_all do |lane|
notify "Fastlane succeeded '#{lane}'" unless Helper.is_ci? #if I'm running it locally, show a terminal OS X notification
push_notify(lane, "Succeeded") #check the bonus part!
end
error do |lane, exception|
notify "Fastlane failed '#{lane}'" unless Helper.is_ci? #if I'm running it locally, show a terminal OS X notification
push_notify(lane, "Failed") #check the bonus part!
end
View fastlane-parse-notify.rb
def push_notify(lane_name, success)
require 'uri'
uri = URI.parse("https://api.parse.com/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new("/1/classes/LaneResult")
request.add_field('Content-Type', 'application/json')
request.add_field('X-Parse-Application-Id', 'my_parse_id')
request.add_field('X-Parse-Master-Key', 'my_parse_key')
View Gemfile
source 'https://rubygems.org'
gem 'cocoapods', '~> 1.5.3'
gem 'fastlane', '~> 2.100.1'
@natanrolnik
natanrolnik / UIViewFitInSuperView.swift
Last active Dec 8, 2016
Handy methods on UIView to allow easier additions of subviews (and constraints via code)
View UIViewFitInSuperView.swift
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension NSLayoutConstraint {
func applyInset(_ insets: UIEdgeInsets) -> NSLayoutConstraint {
guard firstAttribute == secondAttribute else {
return self
}
You can’t perform that action at this time.