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 check_provisioning_profile_expiration.rb
now = DateTime.now.to_time
# You can test different times, like testing 300 days in the future with: now = (DateTime.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
#coding:utf-8
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
feed_file.close
@adamyanalunas
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
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 https://douglashill.co/reading-app/
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
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 {
$0.characters
}
// This prints ["T", "h", "i", "s", "i", "s", "s", "t", "r", "i", "n", "g", "a", "r", "r", "a", "y"]
print(characters)
let words = array.flatMap {
@adamyanalunas
adamyanalunas / levenshtein.swift
Created May 9, 2016
Siwft 3 compatible Levenshtein distance
View levenshtein.swift
// Light syntax cleanup from https://gist.github.com/daehn/f17e8cdcf8d91b046f3c
private extension String {
subscript(index: Int) -> Character {
return self[startIndex.advancedBy(index)]
}
subscript(range: Range<Int>) -> String {
let start = startIndex.advancedBy(range.startIndex)
View PULL_REQUEST_TEMPLATE.md

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 someuser@domain.com/password in the “foo” database
@adamyanalunas
adamyanalunas / post-install
Created Feb 5, 2015
A git post-install to update your pods, if needed
View post-install
#!/bin/bash
PREVIOUS_HEAD=$1
NEW_HEAD=$2
BRANCH_SWITCH=$3
if [[ $BRANCH_SWITCH == "1" && $PREVIOUS_HEAD != $NEW_HEAD ]]; then
# Kill the simulator.
SIM=`pgrep 'iPhone Simulator'`
@adamyanalunas
adamyanalunas / omg.m
Created Nov 8, 2014
What's wrong with this picture?
View omg.m
@interface Foo : NSObject
@property (nonatomic, assign)double ClassId, collegeId;
@property (nonatomic, retain)NSString *name, *date;
@end
@implementation Foo
@synthesize ClassId, collegeId;
View keybase.md

Keybase proof

I hereby claim:

  • I am adamyanalunas on github.
  • I am adamyanalunas (https://keybase.io/adamyanalunas) on keybase.
  • I have a public key whose fingerprint is 7E9D DFEF B640 4696 DBC6 97AF BFA8 7AD7 D1AA 2CFC

To claim this, I am signing this object:

You can’t perform that action at this time.