Skip to content

Instantly share code, notes, and snippets.

Adam Yanalunas adamyanalunas

Block or report user

Report or block adamyanalunas

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 app_store_license.rb
def app_store_license(bundle_id: nil, license: "", countries: nil)
# Make sure your Spacehip::Tunes.client is already logged in
app = Spaceship::Tunes::Application.find(bundle_id)
raise "Could not find an app with the bundle ID `#{bundle_id}`" unless app
app_id = app.apple_id
details = app.details
url = "{app_id}/details"
adamyanalunas / fastlane_connect_api_data_protection.rb
Created Nov 14, 2019
A template for creating a request to set an App ID’s data protection capability
View fastlane_connect_api_data_protection.rb
def set_data_protection(bundle_id: nil, level: nil)
puts "Setting data protection level to `#{level}` for `#{bundle_id}`"
token = Spaceship::ConnectAPI::Token.create()
client = token)
# Bundle IDs have, themselves, a unique ID. We’ll have to look that up first before firing off this request.
bundle_info = Spaceship::ConnectAPI::BundleId.all(filter: {identifier: bundle_id}).first
bundle_id_id =
View check_provisioning_profile_expiration.rb
now =
# You can test different times, like testing 300 days in the future with: now = ( + 300).to_time
provisioning_profile = "~/Library/MobileDevice/Provisioning Profiles/11BBCC...AF21BD2.mobileprovision"
expiration_string = `/usr/libexec/PlistBuddy -c 'Print :ExpirationDate' /dev/stdin <<< $(security cms -D -i #{provisioning_profile})`.chomp
expiration_date = DateTime.strptime(expiration_string, '%a %b %d %H:%M:%S PST %Y').to_time
remaining_days = (expiration_date.to_i - now.to_i) / (3600 * 24)
if remaining_days < 1
# Delete ".red" if you aren’t using the Colorize gem
View feed_muncher.rb
#!/usr/bin/env ruby
require "open-uri"
require "fileutils"
destination_path = ENV['RSS_DOWNLOAD_DESTINATION'] || File.expand_path('.')
feed_url = ENV['RSS_FEED']
feed_file = URI.parse(feed_url).open
adamyanalunas / private_nsobject_initializer.swift
Created Feb 14, 2019
Generic Swift initializer of NSObjects with private init
View private_nsobject_initializer.swift
fileprivate extension NSObject {
Initializes private init() subclasses of NSObject. Pure Swift classes
(and especially structs) will not work here.
// Given a class “PrivateInitClass” where `init()` is private
let somePrivateInitClassInstance = (PrivateInitClass.forcedInit() as PrivateInitClass)
adamyanalunas / KeyboardTableView.swift
Created Jan 11, 2019 — forked from douglashill/KeyboardTableView.swift
A UITableView that allows navigation and selection using a hardware keyboard.
View KeyboardTableView.swift
// Douglas Hill, December 2018
// Made for
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
var selectAboveDiscoverabilityTitle: String?
adamyanalunas / strings.swift
Created Sep 28, 2017
Swift 4 array of string iteration differences
View strings.swift
// Normal array of strings
let array = ["This", "is", "string", "array"]
let characters = array.flatMap {
// This prints ["T", "h", "i", "s", "i", "s", "s", "t", "r", "i", "n", "g", "a", "r", "r", "a", "y"]
let words = array.flatMap {
adamyanalunas / levenshtein.swift
Created May 9, 2016
Siwft 3 compatible Levenshtein distance
View levenshtein.swift
// Light syntax cleanup from
private extension String {
subscript(index: Int) -> Character {
return self[startIndex.advancedBy(index)]
subscript(range: Range<Int>) -> String {
let start = startIndex.advancedBy(range.startIndex)

Addresses issue: #

Preflight (optional)

  • List work to be done before PR can be reviewed
  • Keep this as brief as possible, this is not a place for storytelling
  • bundle install or bundle exec pod install
  • Reading some backstory
  • Set up credentials in the “foo” database
adamyanalunas / post-install
Created Feb 5, 2015
A git post-install to update your pods, if needed
View post-install
if [[ $BRANCH_SWITCH == "1" && $PREVIOUS_HEAD != $NEW_HEAD ]]; then
# Kill the simulator.
SIM=`pgrep 'iPhone Simulator'`
You can’t perform that action at this time.