Skip to content

Instantly share code, notes, and snippets.

Avatar
Always shipping.

Dan Loewenherz dlo

Always shipping.
View GitHub Profile
@eyepaq
eyepaq / HealthKitImport.swift
Created Feb 25, 2018
Quick and dirty import of CSV data into HealthKit .bodyMass measurements. I used this to import my Withings health data export.
View HealthKitImport.swift
/**
Quick and dirty CSV importer, only used once by me to import my own data, sharing it here
in case anyone finds it useful.
*/
class HealthKitCSVImporter {
let healthStore = HKHealthStore()
let bodyMassType = HKSampleType.quantityType(forIdentifier: .bodyMass)!
func authorizeHealthKit(completion: @escaping ((_ success: Bool, _ error: Error?) -> Void)) {
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active Dec 22, 2020
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
View InteractiveTransitionCollectionViewDeselection.m
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@clatwell
clatwell / phvn-features.md
Created Jun 20, 2017
[PHVN] Features and Maintenance
View phvn-features.md

Features

This is the primary list of things we hear about and also think would make sense for Posthaven.

  • Import from other blogs sites – primarily Wordpress a few requests for Tumblr and Medium
  • API – Primarily requested for blog post CRUD
  • Markdown support both in the online editor and when posting via email
  • Other types of payment than via credit card
@dlo
dlo / force_migration.sh
Last active Nov 6, 2016
For those of you who’ve run into the Xcode 8 / Swift migrator hanging issue, this script fixes it. It marks all targets in the project as migrated. For any targets that haven’t actually been migrated to Swift 2.3/3, the script outputs a one-liner that you can cut-and-paste to undo individual targets.
View force_migration.sh
#!/bin/bash
PROJ=$1
if [[ -z "$PROJ" ]]; then
echo "Please provide a path to an Xcode project file."
exit 1
fi
ROOT=$(/usr/libexec/PlistBuddy -c "Print rootObject" $PROJ)
@rjonesy
rjonesy / NewMacSetupRoutine.txt
Last active Sep 5, 2016
Ryan Jones New Mac Setup Routine
View NewMacSetupRoutine.txt
Ryan Jones | @rjonesy | 08-18-2016
All numbered lines are instructions. All non-number indented lines are code in Terminal.app (remove "$" when pasting in Terminal.app).
# PART 1
1. Make library folder visible again:
$ chflags nohidden ~/Library/
2. Disable local time machine:
$ sudo tmutil disablelocal
@tolpp
tolpp / xcode8-swift2.3-cocapods.podfile.rb
Created Jul 14, 2016
CocoaPods Podfile post_install script for adding swift_version property to targets or pod_project. You can use this post_install script if you are working with pods that not compatible with Swift 3.0.
View xcode8-swift2.3-cocapods.podfile.rb
# set true if all pods in the pod_project needs to be flaggged as swift 2.3
legacy_swift_pods_project = true
# Array for pods that will be flagged as swift version 2.3
# if legacy_swift_pods_project is true, you don't need to add any item in array.
legacy_swift_pods = ['Alamofire']
post_install do |installer|
if legacy_swift_pods_project
installer.pods_project.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
@keith
keith / link.sh
Last active Dec 22, 2016
Build to iOS 10 from Xcode 7.3.1
View link.sh
@cyrusboadway
cyrusboadway / google-domains-dynamic-dns-update.sh
Created Feb 20, 2016
Script to update a Google Domains DNS record
View google-domains-dynamic-dns-update.sh
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
@marcoarment
marcoarment / FCPrivateBatteryStatus.m
Created Jan 29, 2016
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
View FCPrivateBatteryStatus.m
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
{
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
@bnagy
bnagy / gpgmutt.md
Last active Dec 29, 2020
Mutt, Gmail and GPG
View gpgmutt.md

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
You can’t perform that action at this time.