Skip to content

Instantly share code, notes, and snippets.

sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g;s/.$//"`
@jhildensperger
jhildensperger / profile_export.js
Last active September 14, 2017 12:11
Node js script to export provisioning profiles with UUID + Name for better readability
/**
* Export provisioning profiles with UUID + Name for better readability.
* Copies of the original profile with the new naming convention will be created in the current working directory
* usage: node profile_export.js -f path/to/profile.mobileprovision
* usage: node profile_export.js -d path/to/profiles/
*/
const path = require('path');
const fs = require('fs');
const exec = require('child_process').exec;
@jhildensperger
jhildensperger / upload_to_crashlytics
Created December 20, 2015 00:24
Archive post-action
exec > /tmp/upload_to_crashlytics_logfile.txt 2>&1
export CODE_SIGN_KEYCHAIN=login.keychain
${SRCROOT}/Scripts/submit f36625510d3a31bd3a5f3372cf9a645f64846e1c b8cfc914d1a9e8356d40fc4456ebc8ec7ca90acc1e1910b046937d7caf0c101e \
-releaseNotes ${SRCROOT}/Scripts/release_notes.txt
-groupAliases Testers \
-notifications YES
open /tmp/upload_to_crashlytics_logfile.txt
@jhildensperger
jhildensperger / regex
Created November 12, 2015 20:23
Regular expressions to fix Swift formatting
// (optionalType?.nonOptionalType)! -> optionalType!.nonOptionalType
// find
\((\w+)\?\(.\w+)\)\!
// replace
$1!$2
// poorly formatted if statements
@jhildensperger
jhildensperger / make_fb_messenger_app.sh
Last active August 29, 2015 14:22
make a chrome app from FB Messenger
# run
# curl -o $TMPDIR/make_fb_messenger_app.sh 'https://gist.githubusercontent.com/jhildensperger/8b1e71eaf3566ec951b9/raw/52f02d049dd25a987b2cb33e092f3882fc256bab/make_fb_messenger_app.sh' && \
# chmod +x $TMPDIR/make_fb_messenger_app.sh && \
# $TMPDIR/make_fb_messenger_app.sh
#!/bin/sh
chromeAppPath="/Applications/Google Chrome.app"
chromeExecutablePath="$chromeAppPath/Contents/MacOS/Google Chrome"
@jhildensperger
jhildensperger / log request
Created March 23, 2015 21:41
log requests
po [[NSString alloc] initWithFormat:@"date: %@ status: %i url: %@", [NSDate date], (int)[self.response statusCode], self.response.URL.absoluteString]
@jhildensperger
jhildensperger / preintstall_hook
Created November 21, 2014 21:06
Podfile preinstall hook to enerate a header for all headers in Pods targer
pre_install do |installer_representation|
aggregate_target = installer_representation.installer.aggregate_targets.detect { |target| target.name == "Pods" }
pods = installer_representation.pods.select { |pod| aggregate_target.pod_targets.collect(&:pod_name).include?(pod.name) }
pod_names = ['AFNetworking']
File.open('PodHeaders.h', 'w') do |header|
pods.select {|pod| pod_names.include?(pod.name)}.each do |pod|
header.puts "\n#pragma mark - " + pod.name + "\n\n"
pod.source_files.select {|path| path.extname == ".h"}.each do |header_path|
header_file = header_path.basename.to_s
next if header_path =~ /Spec/
@jhildensperger
jhildensperger / .open-github-branch.bash
Last active August 29, 2015 14:08
Open current branch on github compared to master
# add .open-github-branch.bash to ~/
# add commented code to your ~/.bash_profile
# restart terminal and enjoy!
#
# if [ -f ~/.open-github-branch.bash ]; then
# . ~/.open-github-branch.bash
# fi
#
# alias gpr='__open_github_branch'
@jhildensperger
jhildensperger / MenuButton.m
Created July 14, 2014 08:43
An old fashioned Objective-C implementation of this awesome swift hamburger button https://github.com/robb/hamburger-button
//
// MenuButton.m
//
// Created by James Hildensperger on 7/13/14.
// Copyright (c) 2014 Zymurgical. All rights reserved.
//
#import "MenuButton.h"
static CGFloat menuStrokeStart = 0.325;
@jhildensperger
jhildensperger / CAMediaTimingFunction+SwiftOut.m
Created July 13, 2014 20:35
Swift out as described by Google's design documentation
#import "CAMediaTimingFunction+SwiftOut.h"
@implementation CAMediaTimingFunction (SwiftOut)
+ (CAMediaTimingFunction *)swiftOut
{
CGPoint controlPoint1 = CGPointMake(0.4, 0.0);
CGPoint controlPoint2 = CGPointMake(0.2, 1.0);
return [self functionWithControlPoints:controlPoint1.x :controlPoint1.y :controlPoint2.x :controlPoint2.y];
}