Skip to content

Instantly share code, notes, and snippets.

View gist:3da6240c55b7ce80f0b1a4d8cddb1ac7
sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g;s/.$//"`
@jhildensperger
jhildensperger / profile_export.js
Last active Sep 14, 2017
Node js script to export provisioning profiles with UUID + Name for better readability
View profile_export.js
/**
* 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;
View upload_to_crashlytics
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 Nov 12, 2015
Regular expressions to fix Swift formatting
View regex
// (optionalType?.nonOptionalType)! -> optionalType!.nonOptionalType
// find
\((\w+)\?\(.\w+)\)\!
// replace
$1!$2
// poorly formatted if statements
@jhildensperger
jhildensperger / make_fb_messenger_app.sh
Last active Aug 29, 2015
make a chrome app from FB Messenger
View make_fb_messenger_app.sh
# 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"
View log request
po [[NSString alloc] initWithFormat:@"date: %@ status: %i url: %@", [NSDate date], (int)[self.response statusCode], self.response.URL.absoluteString]
@jhildensperger
jhildensperger / preintstall_hook
Created Nov 21, 2014
Podfile preinstall hook to enerate a header for all headers in Pods targer
View preintstall_hook
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 Aug 29, 2015
Open current branch on github compared to master
View .open-github-branch.bash
# 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 Jul 14, 2014
An old fashioned Objective-C implementation of this awesome swift hamburger button https://github.com/robb/hamburger-button
View MenuButton.m
//
// 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 Jul 13, 2014
Swift out as described by Google's design documentation
View CAMediaTimingFunction+SwiftOut.m
#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];
}